text
stringlengths 7
3.69M
|
|---|
import React, {Component} from "react";
import PropTypes from "prop-types";
import {Form} from 'antd';
import {FormElement} from '@/library/components';
import './style.less';
import _ from 'lodash';
/**
* 可标记表格高阶组件,dataSource中每条数据,必须含有id作为唯一标识
* columns 添加 formProps
* */
export default function Editable(OriTable) {
@Form.create()
class EditableCell extends React.Component {
// 使重置起作用
componentDidUpdate(prevProps, prevState, snapshot) {
const {form, record, dataIndex} = this.props;
const prevRecord = prevProps.record;
const prevValue = prevRecord[dataIndex];
const value = record[dataIndex];
if (value !== prevValue) form.resetFields();
}
// 截流触发,提高性能
handleChange = _.debounce(() => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (err) return;
const {value, dataSource, onChange} = this.props;
if (onChange) {
const source = value || dataSource;
const ds = source.map(item => {
const {id} = item;
return {...item, ...values[id]};
});
onChange(ds);
}
});
}, 500);
renderCell = () => {
const {form, record, title, dataIndex, formProps, size} = this.props;
const {id} = record;
const field = `${id}[${dataIndex}]`;
const value = record[dataIndex];
return (
<FormElement
{...formProps}
form={form}
label={title}
labelWidth={formProps.required ? 10 : 0}
colon={false}
field={field}
initialValue={value}
onChange={this.handleChange}
size={size}
/>
);
};
render() {
const {
editable,
title,
dataIndex,
record,
value,
onChange,
formProps,
form,
children,
...restProps
} = this.props;
return (
<td {...restProps}>
{editable ? (
this.renderCell()
) : (
children
)}
</td>
);
}
}
class EditableTable extends Component {
static propTypes = {
dataSource: PropTypes.array,
columns: PropTypes.array,
value: PropTypes.array,
onChange: PropTypes.func,
};
render() {
const {
value,
dataSource,
onChange,
columns,
rowKey,
size,
...others
} = this.props;
const ds = value || dataSource;
if (!this.initDataSource && ds?.length) this.initDataSource = ds;
const components = {
body: {
cell: EditableCell,
},
};
const nextColumns = columns.map(col => {
const editable = !!col.formProps;
if (!editable) return col;
return {
...col,
onCell: record => ({
record,
value: value || dataSource,
formProps: col.formProps,
editable,
title: col.title,
dataIndex: col.dataIndex,
onChange,
size,
}),
};
});
return (
<OriTable
className="table-editable-root"
{...others}
size={size}
rowKey={rowKey}
components={components}
columns={nextColumns}
dataSource={ds}
/>
);
}
}
return EditableTable;
}
|
var path = require('path')
module.exports = {
mode: 'production',
entry: {
'/default/home': ['./views/default/home.js'],
'/default/site/home': ['./views/default/site/home.js'],
'/default/site/fe/user/member': ['./views/default/site/fe/user/member.js'],
'/default/site/fe/matter/article/main': [
'./views/default/site/fe/matter/article/main.js',
],
'/default/site/fe/matter/link/main': [
'./views/default/site/fe/matter/link/main.js',
],
'/default/site/fe/matter/channel/main': [
'./views/default/site/fe/matter/channel/main.js',
],
'/default/site/fe/matter/enroll/input': [
'./views/default/site/fe/matter/enroll/input.js',
],
'/default/site/fe/matter/enroll/view': [
'./views/default/site/fe/matter/enroll/view.js',
],
'/default/site/fe/matter/enroll/cowork': [
'./views/default/site/fe/matter/enroll/cowork.js',
],
'/default/site/fe/matter/enroll/share': [
'./views/default/site/fe/matter/enroll/share.js',
],
'/default/site/fe/matter/enroll/repos': [
'./views/default/site/fe/matter/enroll/repos.js',
],
'/default/site/fe/matter/enroll/topic': [
'./views/default/site/fe/matter/enroll/topic.js',
],
'/default/site/fe/matter/enroll/score': [
'./views/default/site/fe/matter/enroll/score.js',
],
'/default/site/fe/matter/enroll/preview': [
'./views/default/site/fe/matter/enroll/preview.js',
],
'/default/site/fe/matter/enroll/template': [
'./views/default/site/fe/matter/enroll/template.js',
],
'/default/site/fe/matter/enroll/activities': [
'./views/default/site/fe/matter/enroll/activities.js',
],
'/default/site/fe/matter/enroll/summary': [
'./views/default/site/fe/matter/enroll/summary.js',
],
'/default/site/fe/matter/enroll/people': [
'./views/default/site/fe/matter/enroll/people.js',
],
'/default/site/fe/matter/signin/signin': [
'./views/default/site/fe/matter/signin/signin.js',
],
'/default/site/fe/matter/signin/view': [
'./views/default/site/fe/matter/signin/view.js',
],
'/default/site/fe/matter/signin/preview': [
'./views/default/site/fe/matter/signin/preview.js',
],
'/default/site/fe/matter/group/main': [
'./views/default/site/fe/matter/group/main.js',
],
'/default/site/fe/matter/group/team': [
'./views/default/site/fe/matter/group/team.js',
],
'/default/site/fe/matter/group/invite': [
'./views/default/site/fe/matter/group/invite.js',
],
'/default/site/fe/invite/access': [
'./views/default/site/fe/invite/access.js',
],
},
output: {
path: path.resolve(__dirname, 'bundles'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.html$/,
use: 'html-loader',
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
{
test: /\.less$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'less-loader',
},
],
},
{
test: /\.(jpg|png|jpeg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 100000,
name: './static/img/[name].[hash:7].[ext]',
},
},
],
},
],
},
}
|
import React, { Component } from 'react';
import { StyleSheet, View, ActivityIndicator, FlatList, Text, Image, Alert } from 'react-native';
export default class Project extends Component {
constructor(props) {
super(props);
this.state = {
isLoading: true
}
}
GetItem(Girl_name) {
Alert.alert(Girl_name);
}
FlatListItemSeparator = () => {
return (
<View
style={{
height: 2,
width: "100%",
backgroundColor: "#000",
}}
/>
);
}
webCall = () => {
return fetch('https://mocki.io/v1/8801fb36-5e2b-4a36-9944-e03b50798c17')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson.GirlImages
}, function () {
// In this block you can do something with new state.
});
})
.catch((error) => {
console.error(error);
});
}
componentDidMount() {
this.webCall();
}
render() {
if (this.state.isLoading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" />
</View>
);
}
return (
<View style={styles.MainContainer}>
<FlatList
data={this.state.dataSource}
ItemSeparatorComponent={this.FlatListItemSeparator}
renderItem={({ item }) =>
<View style={{ flex: 1, flexDirection: 'row' }}>
<Image source={{ uri: item.image }} style={styles.imageView} />
<Text onPress={this.GetItem.bind(this, item.description)} style={styles.textView} >{item.description}</Text>
</View>
}
keyExtractor={(item, index) => index.toString()}
/>
</View>
);
}
}
const styles = StyleSheet.create({
MainContainer: {
justifyContent: 'center',
flex: 1,
margin: 5,
},
imageView: {
width: '50%',
height: 200,
margin: 7,
borderRadius: 7
},
textView: {
width: '50%',
textAlignVertical: 'center',
padding: 10,
color: '#000'
}
});
|
const v_app = Vue.createApp({
data() {
return {
myName: "John",
myAge: 29,
myLink: "https://pbs.twimg.com/media/E52EvABVUAQxdZ-?format=jpg&name=medium"
};
},
methods: {
addAge() {
var myAgeF = this.myAge + 5;
return myAgeF;
},
randomNum(){
var randomN = Math.random();
return Math.floor(randomN * 2);
}
}
});
v_app.mount("#assignment");
|
const config = {
env: {
test: {
presets: [
[
'next/babel',
{
'preset-env': { modules: 'commonjs' }
}
]
]
}
},
ignore: ['.idea', '.vscode', 'node_modules', 'out'],
presets: ['next/babel', '@zeit/next-typescript/babel'],
plugins: [
[
'module-resolver',
{
root: ['.'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.css'],
cwd: 'babelrc'
}
],
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-proposal-optional-chaining'
]
}
module.exports = config
|
Phoenix.Views.LocationDetails = Phoenix.View.extend({
name: 'location/details',
className: 'location-details',
crumbs: {
type: 'anchorMarker',
name: function() {
if (this.isCurrentStore()) {
return 'My Store';
} else {
return 'Store Details';
}
},
'class': function() {
if (this.isCurrentStore()) {
return 'current-store';
}
}
},
events: {
'click .set-store': 'setCurrentStore',
'rendered': 'rendered'
},
context: function() {
var model = this.model;
return _.defaults({
city: model.attributes.address.city,
extendedStoreServices: _.filter(model.attributes.storeServices, function(service) {
return _.isArray(service.hoursOfOperation) || service.phone;
}),
storeHref: "location/" + model.attributes.storeNumber,
mapUrl: Phoenix.locationCore.MapView.getStaticMap({
width: 102,
height: 76,
zoom: 11,
lat: model.attributes.latitude,
lng: model.attributes.longitude
}),
mapLink: 'location/map/' + model.attributes.latitude + '/' + model.attributes.longitude
}, model.attributes);
},
rendered: function() {
if (this.isCurrentStore()) {
$(this.el).addClass('current');
}
},
setCurrentStore: function(event) {
event.preventDefault();
// pharmacy store will be set with the wicket app but we'll remember it here so the "my store" behavior works correctly
Phoenix.setStore(this.model);
$(this.el).addClass('current');
if (Phoenix.locationCore.getLocationType() === Phoenix.locationCore.TYPE_PHARMACY) {
this.model.setAsPharmacyStore();
}
//Phoenix.breadcrumb.updateCrumbs(this);
},
isCurrentStore: function() {
return this.model && this.model.attributes.storeNumber === Phoenix.getStoreId();
}
});
|
class Taxi {
constructor(taxiFare, taxiID, taxiDriver){
this.fare = taxiFare;
this.ID = taxiID;
this.profit = 0;
this.driver = taxiDriver;
}
}
Taxi.prototype.calculate = function(amount,amountPeople){
var gain = amountPeople * this.fare;
this.profit += gain;
document.getElementById("profit").innerHTML = "Profit: " + this.profit ;
if(amount == -1)
return (-1);
alert ("Change $: " + (amount -(gain)));
console.log(this.profit);
}
function getFare(event) {
event.preventDefault();
let driver = document.getElementById("driver").value;
let fare = document.getElementById("fare").value;
let taxiID = document.getElementById("taxiID").value;
if (driver != "" && fare != "" && taxiID != ""){
obj = new Taxi(fare, taxiID, driver);
document.getElementById("details").innerHTML = "Route: " + taxiID + " Driver: " + driver;
document.getElementById("taxiFare").style.display = "none";
document.getElementById("calculate").style.display = "block";
console.log("object fare: " + obj.fare + " object ID: " + obj.ID);
}
}
function getChange() {
event.preventDefault();
let people = document.getElementById("numOfPeople").value;
let paid = document.getElementById("amount").value;
if (people != "" && paid != ""){
document. getElementById("calculate").reset();
alert(people + " people paid an amount of " + paid);
obj.calculate(paid, people);}
}
|
import React from "react";
import PropTypes from 'prop-types';
import DefaultAvatarIcon from './svg/DefaultAvatarIcon';
const Avatar = ({user}) => {
return (
<div>
{getUserAvatar(user.photoURL)}
</div>
);
};
function getUserAvatar(photoURL) {
let loggedImg;
if (photoURL === null) {
loggedImg = <DefaultAvatarIcon/>;
} else {
loggedImg = <img className="avatar_container" alt="img" src={photoURL}/>;
}
return (
<div>
{loggedImg}
</div>
);
}
Avatar.propTypes = {
user: PropTypes.object.isRequired
};
export default Avatar;
|
import setupHtmlToArticleJson from 'html-to-article-json';
import articleJsonToAmp from 'article-json-to-amp';
import Promise from 'bluebird';
import imageSize from 'request-image-size';
const timeout = 5000;
const addDimensions = (json) => Promise.all(
json.map(row => {
const {embedType, width, height, src} = row;
if (embedType !== 'image' || (width && height) || !src) {
return row;
}
return new Promise((resolve, reject) => {
imageSize({ uri: src, timeout }, (err, dimensions) => {
if (err) {
reject(err);
} else {
row.width = dimensions.width;
row.height = dimensions.height;
resolve(row);
}
});
});
})
);
module.exports = () => {
const htmlToArticleJson = setupHtmlToArticleJson();
const htmlToAmp = html => Promise.resolve(htmlToArticleJson(html))
.then(json => addDimensions(json))
.then(json => Promise.resolve(articleJsonToAmp(json)));
return (html, cb) => {
if (cb) {
htmlToAmp(html).then(amp => cb(null, amp), err => cb(err));
} else {
return htmlToAmp(html);
}
};
};
|
/*
* @Description:
* @Author: yamanashi12
* @Date: 2019-05-18 16:00:30
* @LastEditTime: 2021-01-21 11:08:11
* @LastEditors: Please set LastEditors
*/
module.exports = {
root: true,
env: {
browser: true
},
extends: ['plugin:vue/essential', 'airbnb-base'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
semi: ['error', 'never'], // 禁用 分号
'no-multiple-empty-lines': ['error'], // 代码空行 数量
'linebreak-style': [0 ,'error', 'windows'], // 使用windows的换行
'comma-dangle': [2, 'never'], // 对象数组最后一个不带逗号
"no-trailing-spaces": 0, // 禁用 校验代码末尾带空格
"import/no-dynamic-require": 0, // 禁用 动态require
"import/no-unresolved": 0,
"no-param-reassign": 0, // 声明为函数参数的变量可能会引起误解
"max-len": ["error", 150], // 单行代码最大长度
"guard-for-in": 0, // 禁用 禁用for in 循环
"no-shadow": 0, // 禁用 禁止页面内相容参数名
"object-shorthand": 0, // 禁用 禁止对象内使用带引号字符串
"no-restricted-syntax": 0,
"no-plusplus": 0, // 禁用 ++
'consistent-return': 0, // 关闭箭头函数必须要return
'no-return-assign': 0, // return 语句中不能有赋值表达式
'global-require': 0, // 关闭禁止使用requrie
'prefer-promise-reject-errors':0, // 这条规则旨在确保承诺只被Error对象拒绝。
"import/extensions": "off", // 禁用文件名详细文件类型后缀
"max-lines": [1, 500],
"no-empty": 0 // 方法内容为空
},
parserOptions: {
parser: 'babel-eslint'
},
plugins: [
'vue'
]
}
|
import React,{Component} from 'react';
import Modal from '../../components/UI/Modal/Modal'
import Auxilary from '../Auxilary/Auxilary'
const withErrorHandler = (WrappedComponent,axios) => {
return class extends Component{
state ={
error : null
}
componentDidMount(){
this.reqInterceters=axios.interceptors.request.use(req=>{
this.setState({
error:null
})
return req;
})
this.resInterceters= axios.interceptors.response.use(res=>res,error => {
this.setState({
error:error
})
})
}
componentWillUnmount(){
axios.interceptors.request.eject(this.reqInterceters)
axios.interceptors.response.eject(this.resInterceters)
}
errorConfirmedHandler = () => {
this.setState({
error:null
})
}
render(){
return (
<Auxilary>
<Modal show={this.state.error}
clicked ={this.errorConfirmedHandler}>
{this.state.error ?this.state.error.message:null}
</Modal>
<WrappedComponent {...this.props} />
</Auxilary>
)
}
}
}
export default withErrorHandler
|
const AWS = require('aws-sdk');
const express = require("express");
const app = express();
const cors = require("cors");
app.use(cors());
const server = app.listen(3001, function(){
console.log("Node.js is listening to PORT:" + server.address().port);
});
app.get("/api/url", function(req, res, next){
const s3 = new AWS.S3();
const params = {Bucket: "s3-bucket-name", Key: req.query.filename, Expires: 30, ContentType: req.query.filetype };
s3.getSignedUrl('putObject', params, function (err, url) {
console.log(url);
res.json({'url': url});
});
});
|
OC.L10N.register(
"systemtags",
{
"Name" : "ಹೆಸರು",
"Size" : " ಗಾತ್ರ",
"Modified" : "ಬದಲಾಯಿಸಿದ"
},
"nplurals=2; plural=(n > 1);");
|
//[COMMENTS]
/*
Instructions
Add the less than operator to the indicated lines so that the return statements make sense.
testLessThan(0) should return "Under 25"
testLessThan(24) should return "Under 25"
testLessThan(25) should return "Under 55"
testLessThan(54) should return "Under 55"
testLessThan(55) should return "55 or Over"
testLessThan(99) should return "55 or Over"
You should use the < operator at least twice
*/
//[COMMENTS]
function testLessThan(val) {
if (val < 25) { // Change this line
return "Under 25";
}
if (val < 55) { // Change this line
return "Under 55";
}
return "55 or Over";
}
// Change this value to test
testLessThan(10);
|
import React, { Component } from "react";
import "./buttonsArticle.scss";
class ButtonsArticle extends Component {
constructor(props) {
super(props);
this.onDeleteArticle = this.onDeleteArticle.bind(this);
}
onDeleteArticle() {
this.setState({ showArticle: false });
this.props.deleteArticle(this.props.id);
}
render() {
const deleteButton = (
<button className="btn-danger" onClick={this.onDeleteArticle}>
Delete
</button>
);
if (this.props.updateArticle) {
return (
<div>
<button
className="btn-secondary"
onClick={() => {
this.props.onUpdateArticle();
}}
>
Submit
</button>
{deleteButton}
</div>
);
} else {
return (
<div>
<button
className="btn-secondary"
onClick={() => {
this.props.onUpdateArticle();
}}
>
Update
</button>
{deleteButton}
</div>
);
}
}
}
export default ButtonsArticle;
|
angular.module('app')
.component('mainService', {
controller: 'publicfunctions',
bindings: { $router: '<'}
})
.component('homeComp', {
templateUrl: './pages/home/home.html',
controller: 'HomeCtrl',
bindings: { $router: '<' }
})
.component('loginComp', {
templateUrl: './pages/login/login.html',
controller: 'LoginCtrl',
bindings: { $router: '<' }
})
.component('scoreboardComp', {
templateUrl: './pages/scoreboard/scoreboard.html',
controller: 'ScoreboardCtrl',
bindings: { $router: '<' }
})
.component('introComp', {
templateUrl: './pages/intro/intro.html',
controller: 'IntroCtrl',
bindings: { $router: '<' }
})
.component('opdracht1Comp', {
templateUrl: './pages/opdracht1/opdracht1.html',
controller: 'Opdracht1Ctrl',
bindings: { $router: '<' }
})
.component('opdracht2Comp', {
templateUrl: './pages/opdracht2/opdracht2.html',
controller: 'Opdracht2Ctrl',
bindings: { $router: '<' }
})
.component('opdracht3Comp', {
templateUrl: './pages/opdracht3/opdracht3.html',
controller: 'Opdracht3Ctrl',
bindings: { $router: '<' }
})
.component('opdracht4Comp', {
templateUrl: './pages/opdracht4/opdracht4.html',
controller: 'Opdracht4Ctrl',
bindings: { $router: '<' }
})
.component('opdracht5Comp', {
templateUrl: './pages/opdracht5/opdracht5.html',
controller: 'Opdracht5Ctrl',
bindings: { $router: '<' }
})
.component('opdracht6Comp', {
templateUrl: './pages/opdracht6/opdracht6.html',
controller: 'Opdracht6Ctrl',
bindings: { $router: '<' }
})
.component('opdracht7Comp', {
templateUrl: './pages/opdracht7/opdracht7.html',
controller: 'Opdracht7Ctrl',
bindings: { $router: '<' }
})
.component('opdracht8Comp', {
templateUrl: './pages/opdracht8/opdracht8.html',
controller: 'Opdracht8Ctrl',
bindings: { $router: '<' }
})
.component('opdracht9Comp', {
templateUrl: './pages/opdracht9/opdracht9.html',
controller: 'Opdracht9Ctrl',
bindings: { $router: '<' }
})
.component('opdracht10Comp', {
templateUrl: './pages/opdracht10/opdracht10.html',
controller: 'Opdracht10Ctrl',
bindings: { $router: '<' }
})
.component('multiplayerComp', {
templateUrl: './pages/multiplayer/multiplayer.html',
controller: 'MultiplayerCtrl',
bindings: { $router: '<' }
})
.component('realtimemultiplayerComp', {
templateUrl: './pages/multiplayer/realtime/realtime.multiplayer.html',
controller: 'RealTimeMultiplayerCtrl',
bindings: { $router: '<' }
})
.component('realtimedonemultiplayerComp', {
templateUrl: './pages/multiplayer/realtimedone/realtimedone.multiplayer.html',
controller: 'RealtimeDoneMultiplayerCtrl',
bindings: { $router: '<' }
})
.component('chatComp', {
templateUrl: './pages/chat/chat.html',
controller: 'ChatCtrl',
bindings: { $router: '<' }
});
|
export const currentCardSelector = (state) => state.monikimmers.currentCard;
export const currentRoundSelector = (state) => state.monikimmers.currentRound;
export const cardsSelector = (state) => state.monikimmers.cards;
|
/**
*
* Component provides the base functionality required to be a component within the
* dex.js framework.
*
* Base capabilities:
* <ul>
* <li>Provides a base lifecycle
* <ol>
* <li>render() - Create the component from the ground up.</li>
* <li>update() - Update the component.</li>
* <li>destroy() - Destroy the component.</li>
* <li>resize() - Resize the component</li>
* </ol>
* </li>
* <li>Configure the object via a Configuration object.</li>
* <li>Communicate with other components via publish/subscribe.</li>
* <li>Save and load state
* <ul>
* <li>Inside an html div element</li>
* <li>To and from JSON</li>
* </ul>
* </li>
* <li>Visual components can be configured via gui-definitions</li>
* </ul>
*
*/
export class Component {
/**
* Construct a new Component from an optionally provided configuration.
*
* @param {Object|Configuration} [config] - The configuration to be used in constructing
* this new Component.
*
*/
constructor(newConfig = new dex.Configuration()) {
if (newConfig instanceof dex.Configuration) {
/**
*
* @type {Configuration} config - The configuration.
*/
this.config = newConfig;
}
else {
this.config = new dex.Configuration(newConfig);
}
/**
*
* @type {{contents: [], name: string, type: string}}
*/
this.guiDefinition = {
"type": "group",
"name": this.config.get("id") + " Settings",
"contents": []
};
/**
* @type {string}
*/
this.channel = this.getDomTarget();
/**
* @type {jQuery|HTMLElement}
*/
this.$root = undefined;
// Create our top level container.
// TODO: accommodate components with special container requirements more generically
if (this.config.get("class") === "dex-ui-slider") {
this.$root = $(`<input id="${this.config.get("id")}" class="dex-cmp ${this.config.get("class")}"></input>`);
}
else {
this.$root = $(`<div id="${this.config.get("id")}" class="dex-cmp ${this.config.get("class")}"></div>`);
}
/**
* @type {jQuery|HTMLElement}
*/
this.$parent = $("body");
// If parent is supplied, append ourselves to it:
if (this.config.isDefined("parent")) {
let parent = (this.config.get("parent"))
// If jquery node:
if (parent instanceof $) {
this.$parent = parent
}
else {
this.$parent = $(parent)
}
}
this.$parent.append(this.$root)
}
/**
*
* Returns whether or not the named parameter is configured for this Component.
*
* @param {string} name - The name of the parameter.
*
* @return {boolean} True if defined, false otherwise.
*
*/
isDefined(name) {
return this.config.isDefined(name)
}
/**
*
* A lifecycle event placeholder for components to define. This is where
* initialization occurs, document trees are created prior to actually being
* rendered.
*/
initialize() {
dex.log(`Initializer undefined for component: ${this.getDomTarget()}`)
}
/**
*
* Set a configuration parameter.
*
* @param {string} name - The name of the configuration parameter.
* @param {any} value - The value of the configuration parameter.
*
*/
set(name, value) {
//dex.log(`SETTING: ${name}=${value}`)
this.config.set(name, value);
if (name === "parent") {
// detach from old node
this.$root.detach()
let parent = value
if (parent instanceof $) {
this.$parent = parent
parent.append(this.$root)
}
else {
this.$parent = $(parent)
this.$parent.append(this.$root)
}
this.initialize()
}
return this;
}
/**
*
* Gets the value of the specified configuration parameter.
*
* @param {string} name - The name of the configuration parameter.
*
* @return {any} The value of the configuration parameter.
*
*/
get(name) {
return this.config.get(name);
}
/**
*
* Returns the gui definition for this component.
*
* @return {object} The gui definition for this object.
*
*/
getGuiDefinition() {
return this.guiDefinition
}
/**
*
* Returns the DOM target for this component. The dom target is of the
* form "#${id}.${class}" and can serve as a suitable selector.
*
* @return {string} A string containing the dom target for this component.
*
* @example // Given component c with id=foo and class= bar, the call:
* c.getDomTarget() // would return "#foo.bar"
*
*/
getDomTarget() {
return `#${this.get("id")}.${this.get("class")}`
}
/**
*
* A synonym for getDomTarget.
*
* @returns {string} A string containing the dom target for this component.
* This dom target is also used to create a unique channel name within the
* dex.bus pub/sub intra-component communication channel.
*
*/
getChannel() {
return this.getDomTarget();
}
/**
*
* Publish an event to the dex.bus.
*
* @param {string} eventType - The name of the event.
* @param {object} event - The object payload of the event.
*
*/
publish(eventType, event) {
//dex.log(`Publish: channel="${this.channel}", type="${eventType}", payload:`, event)
dex.bus.publish(this.channel, eventType, event);
}
/**
*
* Subscribe to events from the specified channel.
*
* @param {Component|string} channel - The channel name or component
* whose events were are interested in receiving.
* @param {string} eventType - The type of events we are
* interested in receiving.
* @param {function(event: Object)} fn - A callback function to be invoked when the
* event is received.
*
* @returns {function} Returns the callback function. The function
* is required as part of the unsubscribe mechanism and must be
* retained in order to unsubscribe from these events in the future.
*/
subscribe(channel, eventType, fn) {
if (channel instanceof Component) {
//dex.log(`Subscribe: cmp-channel="${channel.getDomTarget()}", type="${eventType}"`)
return dex.bus.subscribe(channel.getDomTarget(), eventType, fn)
}
//dex.log(`Subscribe: str-channel="${channel}", type="${eventType}", fn:`, fn)
return dex.bus.subscribe(channel, eventType, fn);
}
/**
* Unsubscribe from the specified events.
*
* @param {Component|string} channel - The channel name or component
* whose events to which we wish to unsubscribe.
* @param {string} eventType - The type of events we are no longer
* interested in receiving.
* @param {function} fn - The callback function generated from the
* subscribe activity.
*/
unsubscribe(channel, eventType, fn) {
if (channel instanceof Component) {
dex.bus.unsubscribe(channel.getDomTarget(), eventType, fn)
}
else {
// TODO: Is the this.channel part of this a bug?
dex.bus.unsubscribe(this.channel, eventType, fn);
}
}
/**
*
* A default no-op implementation of render. Subclasses should
* override this method with one which provides an initial rendering
* of their specific component. This is a great place to put
* one-time only initialization logic.
*
* @return {Component} Returns this component for the purpose of method
* chaining.
*
*/
render() {
// Set up event handlers
dex.addResizeEvent(this);
return this;
};
/**
*
* A default no-op implementation of update. This will update the
* current component relative to any new setting or data changes.
*
* @return {Component} returns this component for the purpose of method
* chaining.
*/
update() {
return this;
};
/**
*
* Saves the current component configuration to a div within the
* DOM tree. Currently not implemented.
*
* @returns {Component} Returns this component for the purpose of
* method chaining.
*/
save() {
return this;
}
/**
*
* Resize the component. Currently not implemented.
*
* @returns {Component} Returns this component for the purpose of
* method chaining.
*
*/
resize() {
return this;
};
/**
*
* Delete the component. Currently not implemented.
*
* @returns {Component} Returns this component for the purpose of
* method chaining.
*
*/
delete() {
// TODO: Remove resize event.
}
}
|
const email = document.getElementById("email");
const username = document.getElementById("username");
const password = document.getElementById("password");
const passwordConfirm = document.getElementById("passwordConfirm");
const form = document.getElementById("form");
form.addEventListener("submit", submeter);
function submeter(e) {
e.preventDefault();
confirmUser([email, username, password, passwordConfirm]);
verificarSenha(passwordConfirm, password);
}
function verificarSenha(passwordConfirm, password) {
if (
(passwordConfirm.value == password.value) &
(passwordConfirm.value != "") &
(password.value != "")
) {
const parentSenha1 = password.parentNode;
parentSenha1.setAttribute("class", "form-control success");
const parentSenha2 = passwordConfirm.parentNode;
parentSenha2.setAttribute("class", "form-control success");
} else {
const parentUser = passwordConfirm.parentNode;
const small = parentUser.querySelector("small");
small.innerHTML = `A senha não é igual à anterior`;
parentUser.setAttribute("class", "form-control error");
}
}
function confirmUser(valores) {
valores.forEach(variavel => {
if (variavel.value === "") {
const parentUser = variavel.parentNode;
const small = parentUser.querySelector("small");
small.innerHTML = `${variavel.id} é preciso`;
parentUser.setAttribute("class", "form-control error");
} else if (variavel.id === "email") {
if (validateEmail(variavel.value) === false) {
const parentUser = variavel.parentNode;
const small = parentUser.querySelector("small");
small.innerHTML = `Ponha um ${variavel.id} válido`;
parentUser.setAttribute("class", "form-control error");
} else {
const parentUser = variavel.parentNode;
parentUser.setAttribute("class", "form-control success");
}
} else {
const parentUser = variavel.parentNode;
parentUser.setAttribute("class", "form-control success");
}
});
}
function validateEmail(mail) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
return true;
}
return false;
}
|
import React, { useState, useEffect } from 'react';
import { Form } from 'react-bootstrap';
import { useDispatch } from 'react-redux';
import Select from 'react-select';
import { roleList } from '../../../containers/manage-users/role-list-action';
const EditUser = ({
closeEditUserPopup,
editUserDetails,
setEditUserDetails,
handleUpdateUser,
}) => {
const role = { label: editUserDetails.role, value: editUserDetails.role };
const status = {
label: editUserDetails.status,
value: editUserDetails.status,
};
const [roles, setRoles] = useState([]);
const dispatch = useDispatch();
const roleListCallback = (rolesList) => {
const options = rolesList.map((roleObj) => {
return { label: roleObj.role, value: roleObj.slug };
});
setRoles(options);
};
useEffect(() => {
roleList(dispatch, roleListCallback);
}, []);
const statusList = [
{ label: 'active', value: 'active' },
{ label: 'inactive', value: 'inactive' },
];
const customStyles = {
control: (base, state) => ({
...base,
'&:hover': {
border: state.isFocused ? 'solid 1px #dfdfdf' : 'solid 1px #dfdfdf',
},
border: state.isFocused ? 'solid 1px #dfdfdf' : 'solid 1px #dfdfdf',
// This line disable the blue border
boxShadow: state.isFocused ? 'solid 1px #dfdfdf' : 'solid 1px #dfdfdf',
}),
};
return (
<div className="editpopup-sec">
<div className="editpopup-header">
<h2>Edit</h2>
</div>
<div className="editpopup-form-sec">
<Form>
<div className="editpopup-input-value">
<label className="editpopup-input-title">Name</label>
<Form.Control
type="text"
placeholder="Sunil Kumar"
name="name"
value={editUserDetails.name}
onChange={(e) =>
setEditUserDetails({ ...editUserDetails, name: e.target.value })
}
/>
</div>
<div className="editpopup-input-value">
<label className="editpopup-input-title">Mobile No</label>
<Form.Control
type="text"
placeholder="9998989898"
name="mobileNo"
value={editUserDetails.mobileNumber}
onChange={(e) =>
setEditUserDetails({
...editUserDetails,
mobileNumber: e.target.value,
})
}
/>
</div>
<div className="editpopup-input-value">
<label className="editpopup-input-title">Role</label>
<Select
onChange={(e) =>
setEditUserDetails({
...editUserDetails,
role: e.value,
})
}
options={roles}
value={role}
styles={customStyles}
theme={(theme) => ({
...theme,
colors: {
...theme.colors,
primary: '#d8d8d8',
primary25: 'neutral10',
},
})}
/>
</div>
<div className="editpopup-input-value">
<label className="editpopup-input-title">Status</label>
<div className="Editmultipleselect">
<Select
onChange={(e) =>
setEditUserDetails({
...editUserDetails,
status: e.value,
})
}
options={statusList}
value={status}
styles={customStyles}
theme={(theme) => ({
...theme,
colors: {
...theme.colors,
primary: '#d8d8d8',
primary25: 'neutral10',
},
})}
/>
</div>
</div>
</Form>
</div>
<div className="editpopup-bottom">
<button className="cancel-btn" onClick={closeEditUserPopup}>
Cancel
</button>
<button className="black-border-btn" onClick={handleUpdateUser}>
OK
</button>
</div>
</div>
);
};
export default EditUser;
|
import React, { Component, useState } from "react";
import { Redirect } from "react-router";
import {useUuid, useAuth} from "../context/authcontext";
export default function EditForm (props){
const {item, closeEditForm,update, updateItemChanges, isLoggedIn } = props;
const {authTokens} = useAuth();
const {userUuid} = useUuid();
return(
<React.Fragment>
<form className ="form-default" >
<p className="error-message">{isLoggedIn?"":"Login to your account to save "}</p>
<h1 className ="form-header" >Edit</h1>
<div className="editform-textarea-div">
<textarea name ="description" onChange ={(e)=>updateItemChanges(e)} value ={item.description} className="editform-textarea"/>
</div>
<input type="hidden" name ="todo_owner" value={userUuid}/>
<div className="editform-btn-div"> <input type="button" className ="btn btn-tertiary" value="Cancel" onClick ={()=>closeEditForm()}/>
<input type="button" className ="button-primary" onClick ={()=>update(item)} value="Save"/></div>
</form>
</React.Fragment>
);}
|
import React from 'react';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { View, Text, Image, Alert } from 'react-native';
import { useSelector } from 'react-redux';
import { useNavigation } from '@react-navigation/native';
import { Container, Left, Avatar, Info, Name, Time } from './styles';
import { TouchableOpacity } from 'react-native-gesture-handler';
import Notificacao from '../../../src/screens/private/Notificacao';
/**
source={{ uri: 'https://api.adorable.io/avatar/50/rocketseat.png' }}
*/
export default function Header() {
const investidor = useSelector(state => state.user.profile);
const navigation = useNavigation(); //faz a parte de navegação entre telas
//console.log('*********');
//console.log(user);
//console.log('==============');
//console.log(user.id);
//const { navigate } = this.props.navigation;
// function ServicosItens()
//navigation.navigate('ServicosItens');
//}
return (
<Container>
<Left>
<Avatar
source={require('~/assets/avatar_app.png')}
/>
<Info>
<Name>{investidor.razao_social}</Name>
<Time>{investidor.documento}</Time>
</Info>
</Left>
<TouchableOpacity onPress={() => navigation.navigate('ServicesTab.Notificacao')} >
<Icon name="notifications" size={20} color="#000" />
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('ServicosItens')} >
<Icon name="menu" size={20} color="#000" />
</TouchableOpacity>
</Container>
);
}
|
$(document).ready(function() {
$("#fortune").submit(function(event) {
event.preventDefault();
var lucky = 0;
var unlucky = 0;
$("input:checkbox:checked").each(function() {
if ($(this).val() === "lucky") {
lucky += 1;
} else {
unlucky += 1;
}
});
$(".result").hide();
if (lucky - 1 > unlucky) {
$("#lucky").show();
} else if (unlucky - 1 > lucky) {
$("#unlucky").show();
} else {
$("#whatever").show();
}
$("#fortune").hide();
$("#return").show();
});
$("#clickable").click(function() {
$("#fortune").show();
$("#return").hide();
$(".result").hide();
});
});
|
/* Include dependencies */
const simpleGit = require( 'simple-git/promise' )( '/tmp' );
const fs = require( 'fs-extra' );
/* Create an object to store the status of the repos */
const repos = {};
/* Define what branch we are using based on the environment variable */
const branch_name = process.env.NODE_ENV == 'production' ? 'master' : 'dev';
/* Get the URL of the repo */
const GIT_REPO = process.env.LAYOUT_REPO || 'https://github.com/genny-project/layouts.git';
/* Setup the authentication if provided */
if ( process.env.SSH_PRIVATE_KEY ) {
/* Write the private key to file */
fs.writeFileSync( '/root/private.key', `-----BEGIN RSA PRIVATE KEY-----\n${process.env.SSH_PRIVATE_KEY.trim()}\n-----END RSA PRIVATE KEY-----` );
/* Change the file permissions */
fs.chmodSync( '/root/private.key', '600' );
}
/* Return a setup instance of simpleGit */
function getGit() {
return simpleGit;
}
/* Returns a unique repo identifier from the name */
function getRepoName( url ) {
return url.split( '/' )[url.split( '/' ).length - 1].split( '.git' )[0];
}
/* Fetches from a particular repo */
function fetch( url, callback ) {
console.log( url );
/* Check whether we are in dev mode. If so do nothing */
if ( process.env.DEV === 'true' ) {
callback();
return;
}
if ( !url ) {
url = GIT_REPO;
}
if ( repos[url] ) {
callback();
return;
}
/* Get a name for the repo */
const repoName = getRepoName( url );
/* Clone the repo */
const git = getGit();
git.clone( url, `/tmp/${repoName}` ).then(() => {
/* Pull the branch */
git.cwd( `/tmp/${repoName}` ).then(() => {
/* Set a username and email */
git.addConfig( 'user.name', 'Layout Cache' ).then(() => {
git.addConfig( 'user.email', 'layouts@genny.life' ).then(() => {
git.checkout( branch_name ).then(() => {
console.log( 'Pulled branch', branch_name );
repos[url] = true;
if ( url !== GIT_REPO ) {
fs.copy( '/tmp/layouts/shared', `/tmp/${repoName}/shared`, err => {
if ( err ) {
console.error( err );
}
});
}
callback();
/* Pull this repo every minute moving forwards */
setInterval(() => {
pull( url );
}, process.env.SYNC_INTERVAL || 60000 );
});
});
});
});
}).catch( function( err ) { console.log( err ); });
}
/* Pulls from a particular repo */
function pull( url ) {
/* Clone the repo */
const git = getGit();
/* Get a name for the repo */
const repoName = getRepoName( url );
git.cwd( `/tmp/${repoName}` ).then(() => {
git.pull( branch_name ).then(() => {
console.log( `Updated ${branch_name}` );
if ( url !== GIT_REPO ) {
fs.copy( '/tmp/layouts/shared', `/tmp/${repoName}/shared`, err => {
if ( err ) {
console.error( err );
}
});
}
});
});
}
/* Create a new Express HTTP server */
const express = require( 'express' );
const app = express();
const cors = require( 'cors' );
app.use( cors());
/* When the app starts fetch the public repo */
/* Serve up layouts from the local directory */
app.use(( req, res ) => {
let basePath = '/tmp/layouts';
if ( req.query.url ) {
basePath = `/tmp/${req.query.url.split( '/' )[1].split( '.git' )[0]}`;
}
/* Fetch the repo if needed */
fetch( GIT_REPO, () => {
fetch( req.query.url, () => {
});
});
/* Check whether the path is a folder */
try {
const isDir = fs.lstatSync( `${basePath}${req.path.split( '?' )[0]}` ).isDirectory();
if ( isDir ) {
/* Get all of the files in the directory */
fs.readdir( `${basePath}${req.path.split( '?' )[0]}`, ( err, files ) => {
res.json( files.map( f => ({
name: f,
download_url: `${req.protocol}://${req.get( 'host' )}${req.originalUrl.split( '?' )[0]}/${f}`,
path: `${req.originalUrl.split( '?' )[0]}/${f}`,
modified_date: fs.statSync( `${basePath}${req.originalUrl.split( '?' )[0]}/${f}` ).mtime
})));
});
return;
} else {
/* Read the file */
fs.readFile( `${basePath}${req.path.split( '?' )[0]}`, ( err, result ) => {
if ( err || !result ) {
res.status( 404 );
res.json({ error: 'File / folder not found' });
return;
}
res.send( result );
});
}
} catch ( e ) {
res.status( 404 );
res.json({ error: 'File / folder not found' });
return;
}
});
/* Listen on port 2223 */
app.listen( 2223, () => console.log( 'Layout cache listening on port 2223!' ));
/* Include the public server */
require( './public.js' );
/* When the app starts fetch the repo */
fetch( GIT_REPO, () => {});
|
'use strict';
var PromisePolyfill = require('Promise');
var rssParser = require('../modules/rssParser');
var twitterCount = require('../modules/twitterCount');
// TODO: Add JSdoc
var serverRes,
rssObject = {
title: '',
link: '',
image: '',
items: []
},
rssURL = [
'http://www.reddit.com/r/technology/.rss',
'http://www.reddit.com/r/science/.rss',
'http://www.reddit.com/r/Environment/.rss',
'http://www.reddit.com/r/userexperience/.rss',
'http://www.reddit.com/.rss',
'http://www.reddit.com/r/news+worldnews+science+EverythingScience+technology+environment.rss',
'http://www.reddit.com/r/Entrepreneur+smallbusiness+startups+marketing+business.rss',
'http://www.reddit.com/r/Marketing+webmarketing.rss',
'http://www.reddit.com/r/goodnews+goodnewseveryone+upliftingnews.rss',
'http://www.reddit.com/r/programming.rss',
'http://www.reddit.com/r/javascript.rss',
'http://www.reddit.com/r/montreal.rss',
'http://www.reddit.com/r/Quebec.rss'
];
function rebuildArray() {
rssObject.items.sort(function(a, b) {
return b.count - a.count;
});
}
function renderPage() {
serverRes.render('feed', rssObject);
}
function getCountAllItems() {
return PromisePolyfill.all(
rssObject.items.map(function(element) {
return twitterCount.getCount(element.newUrl);
})
);
}
function addCountAllItems(countValues) {
rssObject.items.map(function(element, index) {
element.count = countValues[index];
});
}
function updateRSSArray() {
getCountAllItems()
.done(function(results) {
addCountAllItems(results);
rebuildArray();
renderPage();
});
}
exports.parse = function(req, res) {
var urlIndex = --req.params.feedUrl,
feedUrl;
serverRes = res;
feedUrl = rssURL[urlIndex];
rssParser.parseRss(feedUrl)
.done(function(responseObject) {
rssObject = responseObject;
updateRSSArray();
});
};
|
import React from 'react';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import Header from './structure/Header';
import Footer from './structure/Footer';
import Menu from './ice-cream/Menu';
import EditIceCream from './ice-cream/EditIceCream';
import IceCreams from './ice-cream/IceCreams';
import AddIceCream from './ice-cream/AddIceCream';
// node-sass not installed ---------------------------------
// import './styles/ice-cream.scss';
import geomanistBookWoff from './assets/fonts/geomanist/geomanist-book.woff';
import geomanistBookWoff2 from './assets/fonts/geomanist/geomanist-book.woff2';
import cornerstoneWoff from './assets/fonts/cornerstone.woff';
import cornerstoneWoff2 from './assets/fonts/cornerstone.woff2';
import { Global, css } from '@emotion/core';
const globalStyle = css`
@font-face {
font-family: 'geomanist';
src: url(${geomanistBookWoff2}) format('woff2'),
url(${geomanistBookWoff}) format('woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'cornerstone';
src: url(${cornerstoneWoff2}) format('woff2'),
url(${cornerstoneWoff}) format('woff');
font-weight: 400;
font-style: normal;
}
*,
*:before,
*:after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
color: #333;
background: #ff71ba;
font-family: 'geomanist', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
display: flex;
}
#root {
width: 100%;
}
a {
&:hover {
text-decoration: none;
}
}
h1,
h2,
h3,
h4,
h5 {
font-weight: normal;
padding: 0;
margin: 0;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 20px;
}
.visually-hidden:not(:focus):not(:active) {
clip: rect(0 0 0 0);
clip-path: inset(100%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
.skip-link {
padding: 6px;
position: absolute;
top: -40px;
left: 0px;
color: white;
border-right: 1px solid white;
border-bottom: 1px solid white;
border-bottom-right-radius: 8px;
background: #5c4268;
transition: top 1s ease-out;
z-index: 100;
&:focus {
position: absolute;
left: 0px;
top: 0px;
outline-color: transparent;
transition: top 0.1s ease-in;
}
}
`;
// ---------------------------------------------------------
const App = () => {
return (
<Router>
<Global styles={globalStyle} />
<a href="#main" className="skip-link">
Skip to content
</a>
<Header />
<Switch>
<Route path="/" component={ Menu } exact />
<Route path="/ice-creams" component={IceCreams} />
<Route path="/menu-items/add" component={AddIceCream} exact />
<Route path="/menu-items/:menuItemId" component={EditIceCream} />
<Redirect to="/" />
</Switch>
<Footer />
</Router>
);
}
export default App;
|
//load the usermodel
let employeeModel = require("../model/employee.model");
//define the functions for use with the employee table
//add an employee, given their firstname, lastname, and email address. Will be performed by Admin
//employees start with the same password and ids are auto-generated
let addEmployee = (request, response)=> {
let newEmp = request.body;
//get the highest existing id from the employees table. The new employee's id will be that + 1
employeeModel.find({}).sort([["_id",-1]]).exec((err, result)=> {
let empId = 0;
if (!err) {
//If there are no existing employees, start with id 1
if (result.length == 0) {
empId = 1;
}
else {
//sorted from highest to lowest, so result[0] will have the highest id
empId = result[0]._id + 1;
}
//every newly added employee's password will be "temporary@123", will be prompted to change at their first login
employeeModel.insertMany({id:empId, firstname:newEmp.firstname, lastname:newEmp.lastname,
email:newEmp.email, password:"temporary@123"}, (err1, result1) => {
if (!err1) {
response.send({result:true, msg:"Successfully added employee " + empId});
console.log("Successfully added employee " + empId);
}
else {
console.log(err1);
response.send({result:false, msg:"Error: " + err1});
}
})
}
else {
console.log(err);
response.send({result:false, msg:"Error: " + err});
}
});
}
//Delete an employee using their id
let deleteEmployee = (request, response)=> {
let employeeId = request.body;
employeeModel.deleteOne({id:employeeId.id}, (err, result)=> {
if (!err) {
if (result.deletedCount == 1) {
console.log("Successfully deleted employee " + employeeId.id);
response.send({result:false, msg:"Successfully deleted employee " + employeeId.id});
}
else {
console.log("No employee with that ID found");
response.send({result:false, msg:"No employee with that ID found"});
}
}
else {
console.log(err);
response.send({result:false, msg:result});
}
})
}
module.exports = {addEmployee, deleteEmployee};
|
const express = require('express');
const server = express();
// É necessário dizer para o express que ele vai usar JSON para que ele possa receber informações nesse formato
server.use(express.json());
//Usando route params
const users = ['Gustavo','João','Paulo'];
//Middleware global - neste caso ele exibe o log da aplicação
server.use((request, response, next) => {
//Usando o console.time e console.timeEnd é possivel calcular o tempo que a requisição que o next() chamou gastou para executar
console.time('Request');
console.log(`Metodo : ${request.method}; URL : ${request.url};`);
//utilizando esta função a api vai chamar a rota que foi selecionada pelo cliente
next();
console.timeEnd('Request');
});
//Middleware local - para utiliza-lo é necessário passar essa função como parametro das chamadas das rotas
function checkUserExists(request,response,next) {
if (!request.body.name) {
return response.status(400).json({ error : 'User not found!'})
}
return next();
}
function checkUserIsInArray(request, response, next) {
const user = users[request.params.index];
if (!user) {
return response.status(400).json({ error : 'User does not exists!'});
}
request.user = user;
return next();
}
// Ler todos os usuarios
server.get('/users', (request,response) => {
return response.json(users);
})
// Ler apenas um usuario
// checkUserIsInArray é um middleware
server.get('/users/:index', checkUserIsInArray, (request,response) => {
const { index } = request.params;
// As duas linhas tem o mesmo objetivo, porem a linha acima usa desestruturação
//const id = request.params.id
//return response.json(users[index]);
// Essa informação presente em request.user foi preenchida no middleware checkUserIsInArray
return response.json(request.user);
});
//Cria novo usuario
//checkUserExists é um middleware local
server.post('/users',checkUserExists, (request, response) => {
const { name } = request.body;
users.push(name);
response.json(users);
});
// Edita um usuario
//checkUserExists é um middleware local
//checkUserIsInArray é outro middleware
server.put('/users/:index',checkUserExists, checkUserIsInArray, (request, response) => {
const { index } = request.params;
const { name } = request.body;
users[index] = name;
return response.json(users);
});
// Exclui um usuario
// checkUserIsInArray é um middleware
server.delete('/users/:index',checkUserIsInArray,(request,response) => {
const { index } = request.params;
users.splice(index, 1);
return response.send();
});
server.listen(3000);
|
const {router} = require("../../config/expressconfig");
const checkAuth = require('../auth/middleware/checkAuth')
const dir_impressions = require('./dir_impressions')
router.get("/get-dir-impressions", checkAuth, async (req, res) => {
return res.json(await dir_impressions.getUserGroupByData(req.query.user_id, req.query.dateFilter));
});
module.exports = router
|
$(document).ready(function(){
var icon_alt = document.getElementById("main-icon");
var res_alt = document.getElementById("vu");
/* Intro Animation */
var main_name = document.getElementById("headname");
var main_text = document.getElementById("introtxt");
var vu = document.getElementById("vu");
var introtl = new TimelineMax({});
introtl
.fromTo(icon_alt, 1, {
right: "0%",
top:"10%",
scale: 1,
visibility: 'hidden',
opacity: 0,
}, {
right: "0%",
top:"0%",
visibility: 'visible',
autoAlpha: 1,
opacity: 1
})
.fromTo(main_name, 1, {
visibility: 'hidden',
opacity: 0,
x:50
}, {
visibility: 'visible',
x:0,
autoAlpha: 1,
opacity: 1
}, '-=0.5')
.fromTo(main_text, 1, {
visibility: 'hidden',
opacity: 0,
x:50
}, {
visibility: 'visible',
x:0,
autoAlpha: 1,
opacity: 1
}, '-=0.5')
.fromTo(res_alt, 1, {
visibility: 'hidden',
opacity: 0,
x: -50
}, {
visibility: 'visible',
opacity: 1,
x: 0,
autoAlpha: 1
}, '-=0.5');
/* Get the 10 different components of the icon */
var vu1 = document.getElementById("micstand");
var vu2 = document.getElementById("micball");
var vu3 = document.getElementById("speaker");
var vu4 = document.getElementById("stagebot");
var vu5 = document.getElementById("stagetop");
var comp1 = document.getElementById("vidscreen");
var comp2 = document.getElementById("vidrec");
var comp3 = document.getElementById("voiceup");
var comp4 = document.getElementById("compscreen");
var comp5 = document.getElementById("cursor");
var logo = document.getElementById("VU");
var VU = new TimelineMax({repeat:-1, delay: 1, paused: true});
VU
.fromTo(vu4, 0.5, {
y:100
}, {
y:0
})
.fromTo(vu5, 0.5, {
y:100
}, {
y:0
}, '-=0.5')
.fromTo(vu1, 1, {
y: 500
}, {
y: 0
})
.fromTo(vu2, 1, {
visibility: "hidden",
opacity: 0
}, {
visibility: "visible",
opacity: 1,
autoAlpha: 1
})
.fromTo(vu3, 1, {
visibility: "hidden",
opacity: 0
}, {
visibility: "visible",
opacity: 1,
autoAlpha: 1
})
.to(vu1, 1, {morphSVG: comp1, delay: 1, fill: "#0071BC"})
.to(vu2, 1, {morphSVG: comp2, fill: "#00A99D"}, '-=1')
.to(vu3, 1, {morphSVG: comp3, fill: "black"}, '-=1')
.to(vu4, 1, {morphSVG: comp4, fill: "#666666"}, '-=1')
.to(vu5, 1, {morphSVG: comp5, fill: "black"}, '-=1')
//cursor motion
.to(vu5, 1, {x: 100, y: -20})
.to(vu5, 1, {x: -50, y: -30})
.fromTo(logo, 1, {opacity: 0, autoAlpha: 0},
{opacity: 1, autoAlpha: 1}, '-=1')
.to(vu1, 1, {morphSVG: vu1, delay: 1, fill: "#4D4D4D"})
.to(vu2, 1, {morphSVG: vu2, fill: "#B3B3B3"}, '-=1')
.to(vu3, 1, {morphSVG: vu3, fill: "black"}, '-=1')
.to(vu4, 1, {morphSVG: vu4, fill: "#A67C52"}, '-=1')
.to(vu5, 1, {morphSVG: vu5, x:0, y:0, fill: "#8C6239"}, '-=1')
.to(logo, 1, {opacity: 0, autoAlpha: 0}, '-=1')
//dissolve
.to(vu1, 0.5, {opacity: 0, autoAlpha: 0})
.to(vu2, 0.5, {opacity: 0, autoAlpha: 0}, '-=0.5')
.to(vu3, 0.5, {opacity: 0, autoAlpha: 0}, '-=0.5')
.to(vu4, 0.5, {opacity: 0, autoAlpha: 0}, '-=0.5')
.to(vu5, 0.5, {opacity: 0, autoAlpha: 0}, '-=0.5');
introtl.play();
VU.play();
});
|
const router = require("express").Router();
const { isAuth, isGuest } = require("../middlewares/guards");
const { body, validationResult } = require("express-validator");
router.get("/register", isGuest(), (req, res) => {
res.render("register", { title: "Register" });
});
router.post(
"/register",
isGuest(),
body(
"username",
"Username must contain at least 5 latin alphanumeric characters!"
).trim().isLength({ min: 5 }).isAlphanumeric("en-US"),
body(
"password",
"Password must contain at least 8 latin alphanumeric characters!"
).trim().isLength({ min: 8 }).isAlphanumeric("en-US"),
body(
"repeatPassword",
"Passwords must match!"
).custom((value, { req }) => {
if(value != req.body.password){
throw new Error("Passwords don't match!");
}
return true;
}),
async (req, res) => {
try {
let errors = validationResult(req);
if (!errors.isEmpty()) {
errors = errors.mapped();
throw new Error(Object.values(errors).map(e => e.msg).join('\n'));
}
await req.auth.register(req.body);
res.redirect("/products");
} catch (err) {
res.render("register", {
title: "Register",
errors: err.message.split('\n'),
username: req.body.username || "",
});
}
}
);
router.get("/login", isGuest(), (req, res) => {
res.render("login", { title: "Login" });
});
router.post("/login",
isGuest(),
body("username").trim().not().isEmpty(),
body("password").trim().not().isEmpty(),
async (req, res) => {
try {
const errors = validationResult(req);
if(errors.isEmpty() == false){
throw new Error('Username and password are required!');
}
await req.auth.login(req.body);
res.redirect("/products");
} catch (err) {
res.render("login", {
title: "Login",
errors: [err.message],
username: req.body.username || "",
});
}
});
router.get("/logout", isAuth(), async (req, res) => {
await req.auth.logout();
res.redirect("/products");
});
module.exports = router;
|
import React from 'react';
import { connect } from 'react-redux';
let Event = ({ event }) => {
return (
<div className="event-list-item">
<h6>{event.title || event.name}</h6>
<div>{event.description}</div>
<div>{event.date}</div>
</div>);
};
Event.propTypes = {
event: React.PropTypes.shape({
title: React.PropTypes.string,
done: React.PropTypes.bool,
id: React.PropTypes.string,
link: React.PropTypes.string
})
};
Event = connect()(Event);
export default Event;
|
import React, { useState } from 'react';
import nanoid from 'nanoid';
import moment from 'moment';
import 'moment/locale/ru';
import StepsForm from './StepsForm';
import StepsTable from './StepsTable';
import './Steps.css';
moment.locale('ru');
function Steps(props) {
const [steps, setSteps] = useState([]);
const handleFormSubmit = item => {
const newItem = {
...item,
id: nanoid()
};
setSteps(prevSteps => {
if (prevSteps.some(prevItem => moment(prevItem.date).isSame(item.date))) {
return prevSteps.map(prevItem => {
if (moment(prevItem.date).isSame(item.date)) {
return {
...prevItem,
distance: prevItem.distance + item.distance
};
}
return prevItem;
});
}
return [...prevSteps, newItem];
});
};
const handleItemRemove = id => {
setSteps(prevSteps => {
return prevSteps.filter(item => item.id !== id);
});
};
return (
<div className="Steps">
<StepsForm onSubmit={handleFormSubmit} />
<StepsTable
items={steps}
onItemRemove={handleItemRemove}
/>
</div>
);
}
export default Steps;
|
import React, { useContext } from "react";
import { Button } from "@material-ui/core";
import { UserContext } from "../App";
function DeleteFromCart(props) {
const { user, setUser } = useContext(UserContext);
const { id } = props;
return (
<Button
onClick={(e) => {
setUser({ ...user, cart: [...user.cart.filter((c) => c !== id)] });
}}
variant="contained"
color="primary"
height="100%"
data-testid="deleteButton"
>
Delete
</Button>
);
}
export default DeleteFromCart;
|
'use strict';
var loopback = require('loopback');
var boot = require('loopback-boot');
var app = module.exports = loopback();
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, function (err) {
if (err) throw err;
// start the server if `$ node server.js`
if (require.main === module)
app.start();
});
app.start = function () {
// start the web server
return app.listen(function () {
app.emit('started');
console.log( "BACKEND INIT - ENV mode: ", process.env.NODE_ENV );
console.log( "BACKEND INIT - ENV DEBUG_LEVEL SET", process.env.DEBUG_LEVEL );
if (process.env.NODE_ENV == "dev" && process.env.DEBUG_LEVEL == 6 ) {
console.log("BACKEND INIT - ENV:");
console.log(process.env);
}
var baseUrl = app.get('url').replace(/\/$/, '');
console.log('BACKEND INIT - web server listening at: %s', baseUrl);
//if dev mode, init loopback REST API GUI
if (process.env.NODE_ENV == "dev" && app.get('loopback-component-explorer')) {
var explorerPath = app.get('loopback-component-explorer').mountPath;
console.log('BACKEND INIT - loopback component explorer REST API at %s%s', baseUrl, explorerPath);
}
});
};
|
describe("Checkbox Disabler", function() {
var checkboxDisabler;
var mockCheckboxes;
var mock$Checkboxes;
var mockLimit;
var mockProxy;
beforeEach(function() {
mockCheckboxes = {};
mock$Checkboxes = jasmine.createSpyObj('mock$Checkboxes', ['on'])
mockLimit = 2;
mockProxy = {};
spyOn(window, "$").and.callFake(function (selector) {
if(selector === mockCheckboxes) {
return mock$Checkboxes;
}
});
spyOn($, "proxy").and.returnValue(mockProxy);
spyOn(kitty.CheckboxDisabler.prototype, "checkState");
checkboxDisabler = new kitty.CheckboxDisabler(mockCheckboxes, mockLimit);
});
describe('Creating a checkbox disabler', function () {
it('Creates a checkboxes property', function () {
expect(checkboxDisabler.checkboxes).toBe(mockCheckboxes);
});
it('Creates a limit property', function () {
expect(checkboxDisabler.limit).toBe(mockLimit);
});
it('Listens to the checkbox change event', function () {
expect($).toHaveBeenCalledWith(mockCheckboxes);
expect($.proxy).toHaveBeenCalledWith(jasmine.any(Object), "checkboxChanged");
});
it('Checks the state of the checkboxes', function () {
expect(kitty.CheckboxDisabler.prototype.checkState).toHaveBeenCalled();
});
});
describe('Checkbox change event fires', function () {
it('Checks the state of the checkboxes', function () {
expect(kitty.CheckboxDisabler.prototype.checkState).toHaveBeenCalled();
});
});
});
|
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Vehicles', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING,
allowNull: false
},
model: {
type: Sequelize.STRING
},
fuel: {
type: Sequelize.FLOAT,
defaultValue: '10.0'
},
fuelType: {
type: Sequelize.INTEGER
},
fuelRatio: {
type: Sequelize.FLOAT
},
tankCapacity: {
type: Sequelize.FLOAT,
defaultValue: '20.0'
},
owner: {
type: Sequelize.INTEGER
},
primaryColor: {
type: Sequelize.STRING
},
secondaryColor: {
type: Sequelize.STRING
},
plate: {
type: Sequelize.STRING(8),
defaultValue: null
},
plateType: {
type: Sequelize.INTEGER,
defaultValue: 0
},
dirtLevel: {
type: Sequelize.FLOAT,
defaultValue: 0
},
position: {
type: Sequelize.TEXT
},
dimension: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('Vehicles')
};
|
const fs = require('fs');
const rimraf = require('rimraf');
const isFileTooOld = (filepath) => {
const diffInMs = Date.now() - fs.statSync(filepath).atime; // Result is in ms
const diffInMn = Math.floor(diffInMs / (1000 * 60)); // in mn
const timeLimitInMin = 30 * 24 * 60; // 30 days in mn
// const timeLimitInMin = 1 // 1 min for testing;
return (diffInMn > timeLimitInMin);
}
const extensionsToBeDeleted = (filename) => {
const movieExtensions = ['mkv', 'mp4', 'vtt'];
const extension = filename.split('.').pop()
return movieExtensions.includes(extension);
}
const needsToBeDeleted = (file) => {
return (isFileTooOld(file) && extensionsToBeDeleted(file));
}
const containsAFileToBeDeleted = (folderPath) => {
var files = fs.readdirSync(folderPath);
let toBeDeleted = false;
files.forEach(file => {
if (needsToBeDeleted(folderPath + '/' + file)) toBeDeleted = true;
})
return toBeDeleted;
}
const deleteOldFiles = (dir) => {
var files = fs.readdirSync(dir);
for (var i in files) {
var name = dir + '/' + files[i];
if (fs.statSync(name).isDirectory()) {
if (containsAFileToBeDeleted(name) === true) {
rimraf.sync(name);
console.log("Deleted directory:", name);
}
} else {
if (needsToBeDeleted(name) === true) {
fs.unlinkSync(name);
console.log("Deleted file:", name);
}
}
}
}
function deleteUnusedFiles() {
deleteOldFiles(__dirname + '/../downloads');
deleteOldFiles(__dirname + '/../client/public/subtitles');
}
module.exports.deleteUnusedFiles = deleteUnusedFiles;
|
import signUpUser from './4-user-promise';
import uploadPhoto from './5-photo-reject';
export default async function handleProfileSignup(firstName, lastName, fileName) {
const promiseUser = {
status: 'pending',
};
const promisePhoto = {
status: 'pending',
};
const res = await signUpUser(firstName, lastName)
.catch((e) => {
promiseUser.value = e.toString();
});
if (!res) {
promiseUser.status = 'rejected';
} else {
promiseUser.status = 'fulfilled';
promiseUser.value = res;
}
const resP = await uploadPhoto(fileName)
.catch((e) => {
promisePhoto.value = e.toString();
});
if (!resP) {
promisePhoto.status = 'rejected';
} else {
promisePhoto.status = 'fulfilled';
promisePhoto.value = resP;
}
return [promiseUser, promisePhoto];
}
|
$("#skill_add").click(function() {
let form_data = $("form").serializeArray();
$.ajax({
url: "/profiles/skill/add/",
method: "POST",
dataType: 'json',
data: form_data,
timeout : 100000,
success: function (data) {
console.log(data);
if (data['error']) {
alert(data['error']);
} else {
window.opener.location.href = window.opener.location.href;
window.close();
}
},
error: function (e) {
console.log("ERROR: ", e);
},
done: function (e) {
console.log("DONE");
}
});
});
|
var searchData=
[
['var',['VAR',['../structsymcpp_1_1ComplexToken.html#a5d5ae44d6f5862b7e3a409156ac54ae3abd5d4f26be00a727b2a32f52b9d3d475',1,'symcpp::ComplexToken']]]
];
|
var usermanageController = function(model, view) {
this.model = model;
this.view = view;
this.init();
}
usermanageController.prototype.init = function() {
this.handlers();
this.enable();
}
usermanageController.prototype.load = function(data) {
this.model.load();
}
usermanageController.prototype.delete = function(username){
this.model.delete(username);
}
usermanageController.prototype.handlers = function() {
this.loadHandler = this.load.bind(this);
this.deleteHandler = this.delete.bind(this);
}
usermanageController.prototype.enable = function() {
this.view.loadEvent.attach(this.loadHandler());
this.view.deleteEvent.attach(this.deleteHandler);
return this;
}
|
MyApp.controller('ScratchListCtrl', function($scope, $ionicPopup, $ionicScrollDelegate, $state, $rootScope, Utils) {
$scope.name = Utils.selectedName;
$scope.scratchlist = Utils.scratchList;
$scope.onMedalItem = function(entryNumber) {
Utils.classListOptions.fromScene = 1;
$state.go('app.classdetail', {"entryNumber": parseInt(entryNumber)});
};
$scope.onSchoolingHunterItem = function(entryNumber) {
Utils.classListOptions.fromScene = 1;
$state.go('app.classdetail', {"entryNumber": parseInt(entryNumber)});
};
$scope.onChildrenHorseItem = function(entryNumber) {
Utils.classListOptions.fromScene = 1;
$state.go('app.classdetail', {"entryNumber": parseInt(entryNumber)});
};
})
|
module.exports = function(config) {
'use strict';
var browsers = ['Chrome', 'Firefox'];
var reporters = ['clear-screen', 'mocha', 'coverage'];
config.set({
basePath: '',
frameworks: ['mocha', 'sinon-chai'],
files: [
'src/boa.js',
'tests/**/*.coffee'
],
preprocessors: {
'src/**/*.js': 'coverage',
'**/*.coffee': ['coffee']
},
reporters: reporters,
coverageReporter: {
reporters: [
{type: 'text-summary'},
{type: 'html'},
{type: 'lcov'}
]
},
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
browsers: browsers,
singleRun: false
});
};
|
'use strict';
export default class User {
/**
* @constructor
*/
constructor(data) {
this.id = data.id || null;
this.firstName = data.firstName || null;
this.lastName = data.lastName || null;
this.email = data.email || null;
this.picture = data.picture || 'http://i.imgur.com/A7Dy18f.png';
this.createdAt = data.createdAt || null;
this.updatedAt = data.updatedAt || null;
}
/**
* Returns the full name of the user.
* @method name
* @return {String}
*/
name() {
return this.firstName + ' ' + this.lastName;
}
}
|
function math(firstNum,secondNum,thirdNum) {
return (secondNum * thirdNum) + firstNum;
}
var mathResult = math(53,61,67);
console.log(mathResult);
|
(function ($, undefined) {
$.namespace('inews.property.event');
inews.property.event.EventScrollToDetectDlg = function (options) {
var body, button;
var el, self = this;
this._options = options;
this._editorOrientation = $('.editor-area').IEditor('getOrientation');
if (this._editorOrientation == ORIENTATION_LANDSCAPE) {
this._oldEditorScrollPos = $('.editor-area').scrollLeft();
} else {
this._oldEditorScrollPos = $('.editor-area').scrollTop();
}
this._oldEditorLockSet = {};
this._oldEditorLockSet[EDITOR_LOCK_MOVE] = $('.editor-area').IEditor('getLock', EDITOR_LOCK_MOVE);
this._oldEditorLockSet[EDITOR_LOCK_SELECT] = $('.editor-area').IEditor('getLock', EDITOR_LOCK_SELECT);
this._oldEditorLockSet[EDITOR_LOCK_RESIZE] = $('.editor-area').IEditor('getLock', EDITOR_LOCK_RESIZE);
this._oldEditorLockSet[EDITOR_LOCK_CREATE] = $('.editor-area').IEditor('getLock', EDITOR_LOCK_CREATE);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_MOVE, true);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_RESIZE, true);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_SELECT, true);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_CREATE, true);
if (options.position) {
if (this._editorOrientation == ORIENTATION_LANDSCAPE) {
$('.editor-area').scrollLeft(options.position);
} else {
$('.editor-area').scrollTop(options.position);
}
}
body = $('<div></div>').addClass('ia-event-scrollto-detect').addClass('ia-event-dlg');
if (options.id) body.attr('id', options.id);
$('<div></div>').addClass('msg').html(MESSAGE['IA_EVENT_SCROLLTO_DETECT_POSITION']).appendTo(body);
$('<hr></hr>').appendTo(body);
button = $('<div></div>').addClass('buttonset').appendTo(body);
$('<button></button>').attr('id', 'ia-event-scrollto-detect-apply').attr('data-action', BTN_APPLY).html(MESSAGE['APPLY']).appendTo(button);
$('<button></button>').attr('id', 'ia-event-scrollto-detect-cancel').attr('data-action', BTN_CANCEL).html(MESSAGE['CANCEL']).appendTo(button);
this.dlg = new inews.Dialog({
width: 220,
//height: 66,
right: 120,
top: 120,
modal: false,
el: body,
title: MESSAGE['IA_EVENT_SCROLLTO_DETECT'],
showCloseBtn: false
});
this._el = this.dlg.getEl();
$(this._el).find('.buttonset button').on(EVT_MOUSECLICK, function (e) {
var action = $(this).attr('data-action');
self._el.trigger(EVT_BUTTONCLICK, [action]);
self.close();
e.preventDefault();
e.stopPropagation();
});
};
inews.property.event.EventScrollToDetectDlg.prototype.close = function () {
var el = this.dlg.getEl();
$(el).find('.buttonset button').off(EVT_MOUSECLICK);
$(el).trigger(EVT_CLOSE);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_MOVE, this._oldEditorLockSet[EDITOR_LOCK_MOVE]);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_RESIZE, this._oldEditorLockSet[EDITOR_LOCK_RESIZE]);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_SELECT, this._oldEditorLockSet[EDITOR_LOCK_SELECT]);
$('.editor-area').IEditor('setLock', EDITOR_LOCK_CREATE, this._oldEditorLockSet[EDITOR_LOCK_CREATE]);
if (this._editorOrientation == ORIENTATION_LANDSCAPE) {
$('.editor-area').scrollLeft(this._oldEditorScrollPos);
} else {
$('.editor-area').scrollTop(this._oldEditorScrollPos);
}
this.dlg.close();
};
}(jQuery));
|
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Animated,
Dimensions,
Easing,
TouchableOpacity,
} from 'react-native';
const {width,height} = Dimensions.get('window');
import ToastExample from '../ToastTest/Toast';
const arr = [];
for(var i=0;i < 500; i++){
arr.push(i);
}
export default class AnimatedTest extends Component{
constructor(props){
super(props);
this.animateedValue = [];
arr.forEach((value)=>{
this.animateedValue[value] = new Animated.Value(0);
})
}
componentDidMount(){
this.animate();
ToastExample.show('Awesome',ToastExample.SHORT);
}
animate(){
const animations = arr.map((item)=>{
return Animated.timing(
this.animateedValue[item],
{
toValue:1,
duration:100,
}
)
});
//Animated.sequence(animations).start()
Animated.stagger(100, animations).start()
}
render(){
const animations = arr.map((a,i)=>{
return <Animated.View key={i}
style={{opacity:this.animateedValue[a],height:20,width:20,backgroundColor:'red',marginTop:3,marginLeft:3}}
/>
});
return(
<View style={styles.container}>
{animations}
</View>
);
}
}
const styles = StyleSheet.create({
container:{
flex:1,
flexDirection:'row',
flexWrap:'wrap'
},
button:{
height:30,
backgroundColor:'blue'
}
});
|
var gulp = require('gulp');
var polymerScss = require('gulp-polymer-sass');
var gulpSass = require('gulp-sass');
var browserSync = require('browser-sync');
gulp.task('browser-sync', function () {
var files = [
'**/*.html',
'**/*.{png,jpg,gif,svg}'
];
browserSync.init(files, {
server: {
baseDir: './'
},
// Read here http://www.browsersync.io/docs/options/
// port: 8181,
// Tunnel the Browsersync server through a random Public URL
// tunnel: true,
// Attempt to use the URL "http://my-private-site.localtunnel.me"
// tunnel: "ppress",
// Inject CSS changes
injectChanges: true
});
gulp.watch("src/**/*", ['polymerscss']);
gulp.watch("src/**/*").on('change', browserSync.reload);
});
gulp.task('polymerscss', function () {
return gulp.src('src/**/*.html')
.pipe(polymerScss())
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('scss', function () {
return gulp.src('src/**/*.scss')
.pipe(gulpSass())
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('default', ['polymerscss','browser-sync', 'scss'], function () {
gulp.watch('src/**/*.html', ['polymerscss', browserSync.reload]);
gulp.watch('src/**/*.scss', ['scss', browserSync.reload]);
});
|
'use strict';
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var CartSchema = new Schema({
productId: {
type: String,
required: 'Kindly enter the product-id'
},
productName: {
type: String,
required: 'Kindly enter the name of the product'
},
quantity: {
type: Number,
required: 'Kindly enter the available quantity'
},
amount: {
type: Number,
required: 'Kindly enter the price of the model'
},
username:{
type:String,
required:"username is missing"
}
});
module.exports = mongoose.model('Cart', CartSchema);
|
const fs = require('fs');
fs.writeFile('./demo.txt', '我已经刻在你的脑子里啦', err => {
if (err) {
console.log('文件内容写入失败');
} else {
console.log('文件内容写入成功');
}
});
|
Grailbird.data.tweets_2014_01 =
[ {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 91, 113 ],
"url" : "http:\/\/t.co\/Z0LiG2hcrv",
"expanded_url" : "http:\/\/en.wikipedia.org\/wiki\/At_the_Cat's_Cradle,_1992",
"display_url" : "en.wikipedia.org\/wiki\/At_the_Ca\u2026"
} ]
},
"geo" : { },
"id_str" : "429112102620364801",
"text" : "Really enjoying this Ween Live album. They are pro's at not taking yourself to seriously.\nhttp:\/\/t.co\/Z0LiG2hcrv",
"id" : 429112102620364801,
"created_at" : "2014-01-31 04:41:12 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "payton",
"screen_name" : "SlickestOfRicks",
"indices" : [ 3, 19 ],
"id_str" : "16463985",
"id" : 16463985
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428798105807380480",
"text" : "RT @SlickestOfRicks: If you run counterclockwise around an owl long enough it's head will fall off.",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003ETwitter for iPhone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428602404188487680",
"text" : "If you run counterclockwise around an owl long enough it's head will fall off.",
"id" : 428602404188487680,
"created_at" : "2014-01-29 18:55:50 +0000",
"user" : {
"name" : "payton",
"screen_name" : "SlickestOfRicks",
"protected" : false,
"id_str" : "16463985",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/565572842780364800\/tBxI4r1J_normal.jpeg",
"id" : 16463985,
"verified" : false
}
},
"id" : 428798105807380480,
"created_at" : "2014-01-30 07:53:29 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428744100074897408",
"text" : "I've been git stashing and popping all day!",
"id" : 428744100074897408,
"created_at" : "2014-01-30 04:18:53 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Inspire9",
"screen_name" : "inspire9",
"indices" : [ 60, 69 ],
"id_str" : "190533521",
"id" : 190533521
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428648944139137024",
"text" : "Kind of depressing how many books about Steve Jobs line the @inspire9 shelves. 0 books on Wozniak. Who deserves more credit?",
"id" : 428648944139137024,
"created_at" : "2014-01-29 22:00:46 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "CoffeeScript",
"screen_name" : "CoffeeScript",
"indices" : [ 3, 16 ],
"id_str" : "144894853",
"id" : 144894853
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 89, 111 ],
"url" : "http:\/\/t.co\/4fxAW3PfeD",
"expanded_url" : "http:\/\/coffeescript.org\/#changelog",
"display_url" : "coffeescript.org\/#changelog"
} ]
},
"geo" : { },
"id_str" : "428280312573878273",
"text" : "RT @CoffeeScript: CoffeeScript 1.7.0 is out! Paren-free chaining and other new features: http:\/\/t.co\/4fxAW3PfeD",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/www.echofon.com\/\" rel=\"nofollow\"\u003EEchofon\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 71, 93 ],
"url" : "http:\/\/t.co\/4fxAW3PfeD",
"expanded_url" : "http:\/\/coffeescript.org\/#changelog",
"display_url" : "coffeescript.org\/#changelog"
} ]
},
"geo" : { },
"id_str" : "428257387599122433",
"text" : "CoffeeScript 1.7.0 is out! Paren-free chaining and other new features: http:\/\/t.co\/4fxAW3PfeD",
"id" : 428257387599122433,
"created_at" : "2014-01-28 20:04:52 +0000",
"user" : {
"name" : "CoffeeScript",
"screen_name" : "CoffeeScript",
"protected" : false,
"id_str" : "144894853",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/557241144392708096\/slQydAMv_normal.png",
"id" : 144894853,
"verified" : false
}
},
"id" : 428280312573878273,
"created_at" : "2014-01-28 21:35:58 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Zoe Calton",
"screen_name" : "ZoeAppleseed",
"indices" : [ 3, 16 ],
"id_str" : "2268581455",
"id" : 2268581455
} ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/428098821826957312\/photo\/1",
"indices" : [ 18, 40 ],
"url" : "http:\/\/t.co\/50W5b8qyIz",
"media_url" : "http:\/\/pbs.twimg.com\/media\/BfDpnDMCUAArbCw.jpg",
"id_str" : "428098821680156672",
"id" : 428098821680156672,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/BfDpnDMCUAArbCw.jpg",
"sizes" : [ {
"h" : 285,
"resize" : "fit",
"w" : 500
}, {
"h" : 193,
"resize" : "fit",
"w" : 340
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 285,
"resize" : "fit",
"w" : 500
}, {
"h" : 285,
"resize" : "fit",
"w" : 500
} ],
"display_url" : "pic.twitter.com\/50W5b8qyIz"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428101424954630144",
"text" : "RT @ZoeAppleseed: http:\/\/t.co\/50W5b8qyIz",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/www.apple.com\" rel=\"nofollow\"\u003EiOS\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/428098821826957312\/photo\/1",
"indices" : [ 0, 22 ],
"url" : "http:\/\/t.co\/50W5b8qyIz",
"media_url" : "http:\/\/pbs.twimg.com\/media\/BfDpnDMCUAArbCw.jpg",
"id_str" : "428098821680156672",
"id" : 428098821680156672,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/BfDpnDMCUAArbCw.jpg",
"sizes" : [ {
"h" : 285,
"resize" : "fit",
"w" : 500
}, {
"h" : 193,
"resize" : "fit",
"w" : 340
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 285,
"resize" : "fit",
"w" : 500
}, {
"h" : 285,
"resize" : "fit",
"w" : 500
} ],
"display_url" : "pic.twitter.com\/50W5b8qyIz"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428098821826957312",
"text" : "http:\/\/t.co\/50W5b8qyIz",
"id" : 428098821826957312,
"created_at" : "2014-01-28 09:34:47 +0000",
"user" : {
"name" : "Zoe Calton",
"screen_name" : "ZoeAppleseed",
"protected" : false,
"id_str" : "2268581455",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/577990416483545088\/mhOWEjUQ_normal.jpeg",
"id" : 2268581455,
"verified" : false
}
},
"id" : 428101424954630144,
"created_at" : "2014-01-28 09:45:08 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "corey",
"screen_name" : "djcoreynolan",
"indices" : [ 3, 16 ],
"id_str" : "1419818227",
"id" : 1419818227
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428050349224497152",
"text" : "RT @djcoreynolan: Nonprogrammer: I don't trust a machine to do something I can do myself. Programmer: I don't trust myself to do something \u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "428019344342151168",
"text" : "Nonprogrammer: I don't trust a machine to do something I can do myself. Programmer: I don't trust myself to do something a machine can.",
"id" : 428019344342151168,
"created_at" : "2014-01-28 04:18:58 +0000",
"user" : {
"name" : "corey",
"screen_name" : "djcoreynolan",
"protected" : false,
"id_str" : "1419818227",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/428078737054130177\/6RTEuYm6_normal.jpeg",
"id" : 1419818227,
"verified" : false
}
},
"id" : 428050349224497152,
"created_at" : "2014-01-28 06:22:10 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "427568125656039424",
"text" : "I just realised, I really care about the URL's of a web app.",
"id" : 427568125656039424,
"created_at" : "2014-01-26 22:25:59 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "427408184718811136",
"text" : "I can hear helicopters and fireworks. It sounds like there is an invasion out there!",
"id" : 427408184718811136,
"created_at" : "2014-01-26 11:50:26 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Chris Franklin",
"screen_name" : "Campster",
"indices" : [ 0, 9 ],
"id_str" : "13640822",
"id" : 13640822
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "426987184974221312",
"geo" : { },
"id_str" : "426995936628195328",
"in_reply_to_user_id" : 13640822,
"text" : "@Campster I really appreciate what you do. This video convinced me to join your Patreon campaign.",
"id" : 426995936628195328,
"in_reply_to_status_id" : 426987184974221312,
"created_at" : "2014-01-25 08:32:19 +0000",
"in_reply_to_screen_name" : "Campster",
"in_reply_to_user_id_str" : "13640822",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Chris Franklin",
"screen_name" : "Campster",
"indices" : [ 3, 12 ],
"id_str" : "13640822",
"id" : 13640822
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 14, 37 ],
"url" : "https:\/\/t.co\/K5XmSH1ZAN",
"expanded_url" : "https:\/\/www.youtube.com\/watch?v=8VThsdoxwgc",
"display_url" : "youtube.com\/watch?v=8VThsd\u2026"
} ]
},
"geo" : { },
"id_str" : "426993708811034624",
"text" : "RT @Campster: https:\/\/t.co\/K5XmSH1ZAN This month's thing is up! This time I'm talking about The Novelist. And it gets kinda awkward.",
"retweeted_status" : {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 0, 23 ],
"url" : "https:\/\/t.co\/K5XmSH1ZAN",
"expanded_url" : "https:\/\/www.youtube.com\/watch?v=8VThsdoxwgc",
"display_url" : "youtube.com\/watch?v=8VThsd\u2026"
} ]
},
"geo" : { },
"id_str" : "426987184974221312",
"text" : "https:\/\/t.co\/K5XmSH1ZAN This month's thing is up! This time I'm talking about The Novelist. And it gets kinda awkward.",
"id" : 426987184974221312,
"created_at" : "2014-01-25 07:57:32 +0000",
"user" : {
"name" : "Chris Franklin",
"screen_name" : "Campster",
"protected" : false,
"id_str" : "13640822",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/528418545827209217\/ZroTOLVW_normal.png",
"id" : 13640822,
"verified" : false
}
},
"id" : 426993708811034624,
"created_at" : "2014-01-25 08:23:28 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "426532208786956289",
"geo" : { },
"id_str" : "426645800622387200",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle No, I've only ever seen about three, and that was on top of a mountain in Hartley, not by the road!",
"id" : 426645800622387200,
"in_reply_to_status_id" : 426532208786956289,
"created_at" : "2014-01-24 09:21:00 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Microsoft",
"screen_name" : "Microsoft",
"indices" : [ 7, 17 ],
"id_str" : "74286565",
"id" : 74286565
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "426526322404241408",
"text" : "Called @Microsoft support, as they deducted money randomly from my account. Just put me on hold for no reason. Been on the line for 2 hrs!",
"id" : 426526322404241408,
"created_at" : "2014-01-24 01:26:14 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425602629171826688",
"text" : "If you don't go the extra mile, you never left.",
"id" : 425602629171826688,
"created_at" : "2014-01-21 12:15:48 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Rami Ismail",
"screen_name" : "tha_rami",
"indices" : [ 81, 90 ],
"id_str" : "17064600",
"id" : 17064600
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 58, 80 ],
"url" : "http:\/\/t.co\/OPPiJFvalN",
"expanded_url" : "http:\/\/ramiismail.com\/",
"display_url" : "ramiismail.com"
} ]
},
"geo" : { },
"id_str" : "425473180132577281",
"text" : "Maybe, the best web design I have seen, or ever will see: http:\/\/t.co\/OPPiJFvalN @tha_rami",
"id" : 425473180132577281,
"created_at" : "2014-01-21 03:41:25 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425471294583214080",
"text" : "Just ordered my first pair of good headphones. More wax, less of the ear kind.",
"id" : 425471294583214080,
"created_at" : "2014-01-21 03:33:56 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"indices" : [ 3, 14 ],
"id_str" : "70587360",
"id" : 70587360
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425401814846955520",
"text" : "RT @ADAMATOMIC: \u201Ci\u2019m gonna die someday! sit down at this computer and do some work!\u201D \u201Ci\u2019m gonna die someday! why am i sitting at this compu\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/tapbots.com\/software\/tweetbot\/mac\" rel=\"nofollow\"\u003ETweetbot for Mac\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425382184824754176",
"text" : "\u201Ci\u2019m gonna die someday! sit down at this computer and do some work!\u201D \u201Ci\u2019m gonna die someday! why am i sitting at this computer all day!?\u201D",
"id" : 425382184824754176,
"created_at" : "2014-01-20 21:39:50 +0000",
"user" : {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"protected" : false,
"id_str" : "70587360",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/583782677561507840\/w_Y9WDjX_normal.jpg",
"id" : 70587360,
"verified" : false
}
},
"id" : 425401814846955520,
"created_at" : "2014-01-20 22:57:50 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 71, 93 ],
"url" : "http:\/\/t.co\/bf0jB6PgVS",
"expanded_url" : "http:\/\/canyongames.tumblr.com\/post\/73927716331\/the-turtle-and-the-poet",
"display_url" : "canyongames.tumblr.com\/post\/739277163\u2026"
} ]
},
"geo" : { },
"id_str" : "425165928628645888",
"text" : "Here is a short story I wrote on the weekend.\nThe Turtle and the Poet:\nhttp:\/\/t.co\/bf0jB6PgVS",
"id" : 425165928628645888,
"created_at" : "2014-01-20 07:20:31 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425164320347934720",
"text" : "You can factor it out: \"I like this game's gameplay\". -> \"I like how this game plays.\" -> \"I like this game.\"",
"id" : 425164320347934720,
"created_at" : "2014-01-20 07:14:07 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "425163183918030849",
"text" : "Can't stand the word gameplay. An empty useless term. \"This movie has great moviewatch\", \"This book is great because of its bookread\".",
"id" : 425163183918030849,
"created_at" : "2014-01-20 07:09:36 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424895506536349696",
"text" : "That is enough candid first world problems for one night.",
"id" : 424895506536349696,
"created_at" : "2014-01-19 13:25:57 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424894841420382209",
"text" : "Games have taken up all of my head space. Before that it was music. Maybe both are false idols and I need to walk away from them.",
"id" : 424894841420382209,
"created_at" : "2014-01-19 13:23:19 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 64, 87 ],
"url" : "https:\/\/t.co\/CMLoKRi1sY",
"expanded_url" : "https:\/\/soundcloud.com\/gazevectors\/sets\/impossible-lake",
"display_url" : "soundcloud.com\/gazevectors\/se\u2026"
} ]
},
"geo" : { },
"id_str" : "424894253135720448",
"text" : "I'm listening to a record I released one year and 20 days ago. https:\/\/t.co\/CMLoKRi1sY\n\nIt was so important to me to release it. But why?",
"id" : 424894253135720448,
"created_at" : "2014-01-19 13:20:58 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424893976907243521",
"text" : "My life has gone such a different direction to what I expected. In some ways it is everything I ever wanted. But it is also so foreign.",
"id" : 424893976907243521,
"created_at" : "2014-01-19 13:19:52 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ {
"text" : "ld48",
"indices" : [ 15, 20 ]
} ],
"urls" : [ {
"indices" : [ 97, 120 ],
"url" : "https:\/\/t.co\/3bzhJxjU46",
"expanded_url" : "https:\/\/github.com\/JAForbes\/downplay",
"display_url" : "github.com\/JAForbes\/downp\u2026"
} ]
},
"geo" : { },
"id_str" : "424662431613206528",
"text" : "I'm porting my #ld48 game to my downplay, as a way of seeing where downplay needs improvement. \nhttps:\/\/t.co\/3bzhJxjU46",
"id" : 424662431613206528,
"created_at" : "2014-01-18 21:59:48 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Dupont Cashbundle",
"screen_name" : "crushingbort",
"indices" : [ 3, 16 ],
"id_str" : "188587219",
"id" : 188587219
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424340876433711104",
"text" : "RT @crushingbort: if you fall asleep on a bus when you're the last passenger, you will wake up as the bus driver. This is my story *twinkle\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003ETwitter for iPhone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424325582097514496",
"text" : "if you fall asleep on a bus when you're the last passenger, you will wake up as the bus driver. This is my story *twinkle sfx*",
"id" : 424325582097514496,
"created_at" : "2014-01-17 23:41:17 +0000",
"user" : {
"name" : "Dupont Cashbundle",
"screen_name" : "crushingbort",
"protected" : false,
"id_str" : "188587219",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/539314247767842816\/de_trD2o_normal.jpeg",
"id" : 188587219,
"verified" : false
}
},
"id" : 424340876433711104,
"created_at" : "2014-01-18 00:42:03 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424021489264758784",
"text" : "RT @ZoeCalton: To make doing the dishes in 44 degree heat more pleasant, i recommend balancing a bag of frozen peas on your head during the\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/ipad\" rel=\"nofollow\"\u003ETwitter for iPad\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "424016878646747136",
"text" : "To make doing the dishes in 44 degree heat more pleasant, i recommend balancing a bag of frozen peas on your head during the ordeal.",
"id" : 424016878646747136,
"created_at" : "2014-01-17 03:14:36 +0000",
"user" : {
"name" : "Zoe Calton",
"screen_name" : "ZoeAppleseed",
"protected" : false,
"id_str" : "2268581455",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/577990416483545088\/mhOWEjUQ_normal.jpeg",
"id" : 2268581455,
"verified" : false
}
},
"id" : 424021489264758784,
"created_at" : "2014-01-17 03:32:55 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "423661840166432768",
"text" : "I'm so hooked on recursion.",
"id" : 423661840166432768,
"created_at" : "2014-01-16 03:43:48 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "423580642211663872",
"text" : "The Mac is so mouse oriented.",
"id" : 423580642211663872,
"created_at" : "2014-01-15 22:21:09 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "423423909031981056",
"geo" : { },
"id_str" : "423424417264177153",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle I'm really lucky to have aircon at work. Meanwhile @ZoeCalton has to cope with this ridiculous heat!",
"id" : 423424417264177153,
"in_reply_to_status_id" : 423423909031981056,
"created_at" : "2014-01-15 12:00:22 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "423315263082086400",
"geo" : { },
"id_str" : "423423100512772097",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle I keep missing your tweets because you are not '@ ing' me :)",
"id" : 423423100512772097,
"in_reply_to_status_id" : 423315263082086400,
"created_at" : "2014-01-15 11:55:08 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Simon Hope",
"screen_name" : "mapbutcher",
"indices" : [ 3, 14 ],
"id_str" : "16034664",
"id" : 16034664
}, {
"name" : "John Forbes",
"screen_name" : "JohnRForbes",
"indices" : [ 114, 126 ],
"id_str" : "50233687",
"id" : 50233687
} ],
"media" : [ ],
"hashtags" : [ {
"text" : "QGIS",
"indices" : [ 105, 110 ]
} ],
"urls" : [ {
"indices" : [ 82, 104 ],
"url" : "http:\/\/t.co\/GHJk9hkDgl",
"expanded_url" : "http:\/\/bit.ly\/1amKO6d",
"display_url" : "bit.ly\/1amKO6d"
} ]
},
"geo" : { },
"id_str" : "423422460839460864",
"text" : "RT @mapbutcher: I'm exercising some GIS foo using PyQGIS and I'm liking it a lot. http:\/\/t.co\/GHJk9hkDgl #QGIS\nCC @JohnRForbes",
"id" : 423422460839460864,
"created_at" : "2014-01-15 11:52:36 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "423314759262281728",
"text" : "Things they should teach kids in school No#1: The importance of keyboard shortcuts.",
"id" : 423314759262281728,
"created_at" : "2014-01-15 04:44:38 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "423241295033671681",
"geo" : { },
"id_str" : "423282769247354882",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle Really? Where? How?",
"id" : 423282769247354882,
"in_reply_to_status_id" : 423241295033671681,
"created_at" : "2014-01-15 02:37:31 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "423281557680295936",
"text" : "RT @ZoeCalton: I have just started an art blog, not sure how i feel about this yet.",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/ipad\" rel=\"nofollow\"\u003ETwitter for iPad\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "423270925438443521",
"text" : "I have just started an art blog, not sure how i feel about this yet.",
"id" : 423270925438443521,
"created_at" : "2014-01-15 01:50:27 +0000",
"user" : {
"name" : "Zoe Calton",
"screen_name" : "ZoeAppleseed",
"protected" : false,
"id_str" : "2268581455",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/577990416483545088\/mhOWEjUQ_normal.jpeg",
"id" : 2268581455,
"verified" : false
}
},
"id" : 423281557680295936,
"created_at" : "2014-01-15 02:32:42 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Fox.EXE",
"screen_name" : "Linux_EXE",
"indices" : [ 0, 10 ],
"id_str" : "386323329",
"id" : 386323329
}, {
"name" : "Gergely Sink\u00F3",
"screen_name" : "Kwayne64",
"indices" : [ 11, 20 ],
"id_str" : "1435946689",
"id" : 1435946689
}, {
"name" : "FTL",
"screen_name" : "FTLgame",
"indices" : [ 21, 29 ],
"id_str" : "381988690",
"id" : 381988690
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "422937037667201024",
"geo" : { },
"id_str" : "422969813955117056",
"in_reply_to_user_id" : 386323329,
"text" : "@Linux_EXE @Kwayne64 @FTLgame Oh no! I'm that guy.",
"id" : 422969813955117056,
"in_reply_to_status_id" : 422937037667201024,
"created_at" : "2014-01-14 05:53:56 +0000",
"in_reply_to_screen_name" : "Linux_EXE",
"in_reply_to_user_id_str" : "386323329",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 16, 38 ],
"url" : "http:\/\/t.co\/eqBvMjRnrR",
"expanded_url" : "http:\/\/css-tricks.com\/snippets\/css\/css-triangle\/",
"display_url" : "css-tricks.com\/snippets\/css\/c\u2026"
} ]
},
"geo" : { },
"id_str" : "422914922373070848",
"text" : "CSS Triangles! http:\/\/t.co\/eqBvMjRnrR",
"id" : 422914922373070848,
"created_at" : "2014-01-14 02:15:49 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Gergely Sink\u00F3",
"screen_name" : "Kwayne64",
"indices" : [ 0, 9 ],
"id_str" : "1435946689",
"id" : 1435946689
}, {
"name" : "FTL",
"screen_name" : "FTLgame",
"indices" : [ 10, 18 ],
"id_str" : "381988690",
"id" : 381988690
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "422671071817392128",
"geo" : { },
"id_str" : "422913182072467457",
"in_reply_to_user_id" : 1435946689,
"text" : "@Kwayne64 @FTLgame What is that version of the game? I've never seen that UI.",
"id" : 422913182072467457,
"in_reply_to_status_id" : 422671071817392128,
"created_at" : "2014-01-14 02:08:54 +0000",
"in_reply_to_screen_name" : "Kwayne64",
"in_reply_to_user_id_str" : "1435946689",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"indices" : [ 3, 14 ],
"id_str" : "70587360",
"id" : 70587360
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422912573495705600",
"text" : "RT @ADAMATOMIC: (thanks for the encouraging feedback everybody!! it\u2019s genuinely nice to hear, still pretty afraid when i pick up the wacom \u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/tapbots.com\/software\/tweetbot\/mac\" rel=\"nofollow\"\u003ETweetbot for Mac\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422848759920218112",
"text" : "(thanks for the encouraging feedback everybody!! it\u2019s genuinely nice to hear, still pretty afraid when i pick up the wacom each afternoon\u2026)",
"id" : 422848759920218112,
"created_at" : "2014-01-13 21:52:55 +0000",
"user" : {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"protected" : false,
"id_str" : "70587360",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/583782677561507840\/w_Y9WDjX_normal.jpg",
"id" : 70587360,
"verified" : false
}
},
"id" : 422912573495705600,
"created_at" : "2014-01-14 02:06:29 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "jon klassen",
"screen_name" : "burstofbeaden",
"indices" : [ 3, 17 ],
"id_str" : "64783035",
"id" : 64783035
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422912230691049473",
"text" : "RT @burstofbeaden: if anyone needs peanut butter i bought a new peanut butter and put it next to the 2 other peanut butters and the 32 bott\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422893496102445056",
"text" : "if anyone needs peanut butter i bought a new peanut butter and put it next to the 2 other peanut butters and the 32 bottles of olive oil.",
"id" : 422893496102445056,
"created_at" : "2014-01-14 00:50:41 +0000",
"user" : {
"name" : "jon klassen",
"screen_name" : "burstofbeaden",
"protected" : false,
"id_str" : "64783035",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/561269982286188544\/uxJ4krnr_normal.jpeg",
"id" : 64783035,
"verified" : false
}
},
"id" : 422912230691049473,
"created_at" : "2014-01-14 02:05:07 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422903723161944064",
"text" : "JQuery is freaking incredible!",
"id" : 422903723161944064,
"created_at" : "2014-01-14 01:31:19 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422854226587299841",
"text" : "It'd be kind of cool to not use style sheets and just use JSON that you throw at $.css(). One benefit: no stylesheets.",
"id" : 422854226587299841,
"created_at" : "2014-01-13 22:14:38 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422851479678894080",
"text" : "Favourite line of Elysium: \"Store it in a private cloud!\" Why would you store something so secret in the cloud? Amazon Propaganda.",
"id" : 422851479678894080,
"created_at" : "2014-01-13 22:03:43 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422850177334915072",
"text" : "When I use Linux, I feel like I am in a really nice shack in the woods, hiding from the authorities.",
"id" : 422850177334915072,
"created_at" : "2014-01-13 21:58:33 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422850049299591168",
"text" : "When I use a mac, I feel like I'm in the 90's. When I use Windows 8 I feel like I am in a futuristic movie that was made in the 90's.",
"id" : 422850049299591168,
"created_at" : "2014-01-13 21:58:02 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422848639367532544",
"text" : "The more big companies let me down, the more I understand what those Linux guys are talking about.",
"id" : 422848639367532544,
"created_at" : "2014-01-13 21:52:26 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422239371169783808",
"text" : "Want Minecraft, but don't want Java. What do?",
"id" : 422239371169783808,
"created_at" : "2014-01-12 05:31:25 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Robert Yang",
"screen_name" : "radiatoryang",
"indices" : [ 0, 13 ],
"id_str" : "165537786",
"id" : 165537786
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "422219469348302849",
"geo" : { },
"id_str" : "422221436300705792",
"in_reply_to_user_id" : 165537786,
"text" : "@radiatoryang Sublime",
"id" : 422221436300705792,
"in_reply_to_status_id" : 422219469348302849,
"created_at" : "2014-01-12 04:20:09 +0000",
"in_reply_to_screen_name" : "radiatoryang",
"in_reply_to_user_id_str" : "165537786",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Captain Dave",
"screen_name" : "DaveWallsworth",
"indices" : [ 3, 18 ],
"id_str" : "424120588",
"id" : 424120588
}, {
"name" : "Liz Bonnin",
"screen_name" : "lizbonnin",
"indices" : [ 20, 30 ],
"id_str" : "421274906",
"id" : 421274906
}, {
"name" : "Dara \u00D3 Briain",
"screen_name" : "daraobriain",
"indices" : [ 31, 43 ],
"id_str" : "44874400",
"id" : 44874400
}, {
"name" : "Brian Cox",
"screen_name" : "ProfBrianCox",
"indices" : [ 44, 57 ],
"id_str" : "17939037",
"id" : 17939037
} ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/DaveWallsworth\/status\/421279303263731713\/photo\/1",
"indices" : [ 139, 140 ],
"url" : "http:\/\/t.co\/L9r9MQVtEG",
"media_url" : "http:\/\/pbs.twimg.com\/media\/BdivS1bCQAAEWv6.jpg",
"id_str" : "421279303272120320",
"id" : 421279303272120320,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/BdivS1bCQAAEWv6.jpg",
"sizes" : [ {
"h" : 1325,
"resize" : "fit",
"w" : 2000
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 397,
"resize" : "fit",
"w" : 600
}, {
"h" : 678,
"resize" : "fit",
"w" : 1024
}, {
"h" : 225,
"resize" : "fit",
"w" : 340
} ],
"display_url" : "pic.twitter.com\/L9r9MQVtEG"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422217573216698369",
"text" : "RT @DaveWallsworth: @lizbonnin @daraobriain @ProfBrianCox Taken from 39000ft over the Atlantic from the flight deck of a BA A318 to LCY. ht\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Liz Bonnin",
"screen_name" : "lizbonnin",
"indices" : [ 0, 10 ],
"id_str" : "421274906",
"id" : 421274906
}, {
"name" : "Dara \u00D3 Briain",
"screen_name" : "daraobriain",
"indices" : [ 11, 23 ],
"id_str" : "44874400",
"id" : 44874400
}, {
"name" : "Brian Cox",
"screen_name" : "ProfBrianCox",
"indices" : [ 24, 37 ],
"id_str" : "17939037",
"id" : 17939037
} ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/DaveWallsworth\/status\/421279303263731713\/photo\/1",
"indices" : [ 117, 139 ],
"url" : "http:\/\/t.co\/L9r9MQVtEG",
"media_url" : "http:\/\/pbs.twimg.com\/media\/BdivS1bCQAAEWv6.jpg",
"id_str" : "421279303272120320",
"id" : 421279303272120320,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/BdivS1bCQAAEWv6.jpg",
"sizes" : [ {
"h" : 1325,
"resize" : "fit",
"w" : 2000
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 397,
"resize" : "fit",
"w" : 600
}, {
"h" : 678,
"resize" : "fit",
"w" : 1024
}, {
"h" : 225,
"resize" : "fit",
"w" : 340
} ],
"display_url" : "pic.twitter.com\/L9r9MQVtEG"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421279303263731713",
"in_reply_to_user_id" : 421274906,
"text" : "@lizbonnin @daraobriain @ProfBrianCox Taken from 39000ft over the Atlantic from the flight deck of a BA A318 to LCY. http:\/\/t.co\/L9r9MQVtEG",
"id" : 421279303263731713,
"created_at" : "2014-01-09 13:56:27 +0000",
"in_reply_to_screen_name" : "lizbonnin",
"in_reply_to_user_id_str" : "421274906",
"user" : {
"name" : "Captain Dave",
"screen_name" : "DaveWallsworth",
"protected" : false,
"id_str" : "424120588",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/547173354684563456\/R8BvbSy7_normal.jpeg",
"id" : 424120588,
"verified" : false
}
},
"id" : 422217573216698369,
"created_at" : "2014-01-12 04:04:48 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "422153271810068480",
"text" : "I really want a drum kit, and a house where I can drum in the morning and not piss anyone off.",
"id" : 422153271810068480,
"created_at" : "2014-01-11 23:49:17 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421997053363757056",
"geo" : { },
"id_str" : "422152232717414400",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle Yeah that would have been amazing! Where did they play?",
"id" : 422152232717414400,
"in_reply_to_status_id" : 421997053363757056,
"created_at" : "2014-01-11 23:45:10 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ {
"text" : "ld48",
"indices" : [ 87, 92 ]
} ],
"urls" : [ {
"indices" : [ 63, 86 ],
"url" : "https:\/\/t.co\/3bzhJxjU46",
"expanded_url" : "https:\/\/github.com\/JAForbes\/downplay",
"display_url" : "github.com\/JAForbes\/downp\u2026"
} ]
},
"geo" : { },
"id_str" : "421931483415080960",
"text" : "I just released the extremely early alpha of my level syntax.\n\nhttps:\/\/t.co\/3bzhJxjU46 #ld48",
"id" : 421931483415080960,
"created_at" : "2014-01-11 09:07:59 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "iiNet",
"screen_name" : "iiNet",
"indices" : [ 0, 6 ],
"id_str" : "16464855",
"id" : 16464855
}, {
"name" : "Tal Waterhouse",
"screen_name" : "iiTalW",
"indices" : [ 7, 14 ],
"id_str" : "1425333223",
"id" : 1425333223
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421920423753043968",
"geo" : { },
"id_str" : "421920700509589504",
"in_reply_to_user_id" : 16464855,
"text" : "@iiNet @iiTalW Awesome, will do.",
"id" : 421920700509589504,
"in_reply_to_status_id" : 421920423753043968,
"created_at" : "2014-01-11 08:25:08 +0000",
"in_reply_to_screen_name" : "iiNet",
"in_reply_to_user_id_str" : "16464855",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "iiNet",
"screen_name" : "iiNet",
"indices" : [ 0, 6 ],
"id_str" : "16464855",
"id" : 16464855
}, {
"name" : "Tal Waterhouse",
"screen_name" : "iiTalW",
"indices" : [ 7, 14 ],
"id_str" : "1425333223",
"id" : 1425333223
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421919667071246337",
"geo" : { },
"id_str" : "421920152985153537",
"in_reply_to_user_id" : 16464855,
"text" : "@iiNet @iiTalW I haven't spoken to support. But I have disabled Port Blocking. Any help would be great!",
"id" : 421920152985153537,
"in_reply_to_status_id" : 421919667071246337,
"created_at" : "2014-01-11 08:22:58 +0000",
"in_reply_to_screen_name" : "iiNet",
"in_reply_to_user_id_str" : "16464855",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "iiNet",
"screen_name" : "iiNet",
"indices" : [ 126, 132 ],
"id_str" : "16464855",
"id" : 16464855
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421919124566974464",
"text" : "Can't get my server seen from outside of my LAN. I'm in the DMZ and disabled port blocking. Thinking of changing ISP's from @iiNet.",
"id" : 421919124566974464,
"created_at" : "2014-01-11 08:18:52 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421863466631036929",
"text" : "Screwed my pi, cant even boot now. Flashing the drive and starting again.",
"id" : 421863466631036929,
"created_at" : "2014-01-11 04:37:42 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421832839139586048",
"text" : "\"I hate ads!\"\n\nThis tweet was brought to you by Heineken.",
"id" : 421832839139586048,
"created_at" : "2014-01-11 02:36:00 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Chris Remo",
"screen_name" : "chrisremo",
"indices" : [ 3, 13 ],
"id_str" : "16792453",
"id" : 16792453
}, {
"name" : "Idle Thumbs",
"screen_name" : "idlethumbs",
"indices" : [ 37, 48 ],
"id_str" : "42110634",
"id" : 42110634
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 139, 140 ],
"url" : "http:\/\/t.co\/epvQ74ZGAX",
"expanded_url" : "http:\/\/www.youtube.com\/watch?v=oDGbem2mKGM",
"display_url" : "youtube.com\/watch?v=oDGbem\u2026"
} ]
},
"geo" : { },
"id_str" : "421828855859380224",
"text" : "RT @chrisremo: You may not listen to @idlethumbs but you probably still shouldn't miss this important Robot News. It affects us all. http:\/\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Idle Thumbs",
"screen_name" : "idlethumbs",
"indices" : [ 22, 33 ],
"id_str" : "42110634",
"id" : 42110634
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 118, 140 ],
"url" : "http:\/\/t.co\/epvQ74ZGAX",
"expanded_url" : "http:\/\/www.youtube.com\/watch?v=oDGbem2mKGM",
"display_url" : "youtube.com\/watch?v=oDGbem\u2026"
} ]
},
"geo" : { },
"id_str" : "421713889244348416",
"text" : "You may not listen to @idlethumbs but you probably still shouldn't miss this important Robot News. It affects us all. http:\/\/t.co\/epvQ74ZGAX",
"id" : 421713889244348416,
"created_at" : "2014-01-10 18:43:20 +0000",
"user" : {
"name" : "Chris Remo",
"screen_name" : "chrisremo",
"protected" : false,
"id_str" : "16792453",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/524703390186471424\/K6Qg0AAE_normal.jpeg",
"id" : 16792453,
"verified" : false
}
},
"id" : 421828855859380224,
"created_at" : "2014-01-11 02:20:11 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 0, 8 ],
"id_str" : "612076511",
"id" : 612076511
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421731358080520192",
"geo" : { },
"id_str" : "421821754281951232",
"in_reply_to_user_id" : 612076511,
"text" : "@surface It didn't vibrate, and there were no error codes. The event log said Kernel Power Failure: Severe. I've now returned the Surface.",
"id" : 421821754281951232,
"in_reply_to_status_id" : 421731358080520192,
"created_at" : "2014-01-11 01:51:57 +0000",
"in_reply_to_screen_name" : "surface",
"in_reply_to_user_id_str" : "612076511",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421620235188178944",
"text" : "Spent 2 hours following a webserver tut for my raspPi using nginx. Didn't work. Kinda bummed. But at least I learned some unix commands.",
"id" : 421620235188178944,
"created_at" : "2014-01-10 12:31:12 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Cold Rice",
"screen_name" : "ColdRice_Dev",
"indices" : [ 0, 13 ],
"id_str" : "1627070246",
"id" : 1627070246
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421588213497470976",
"geo" : { },
"id_str" : "421599560415207424",
"in_reply_to_user_id" : 1627070246,
"text" : "@ColdRice_Dev The clouds look amazing!",
"id" : 421599560415207424,
"in_reply_to_status_id" : 421588213497470976,
"created_at" : "2014-01-10 11:09:02 +0000",
"in_reply_to_screen_name" : "ColdRice_Dev",
"in_reply_to_user_id_str" : "1627070246",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 10, 18 ],
"id_str" : "612076511",
"id" : 612076511
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421548590268289024",
"text" : "I miss my @surface :(",
"id" : 421548590268289024,
"created_at" : "2014-01-10 07:46:30 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421537847493922816",
"text" : "Reflow in the browser on the mac doesn't work properly for me in Chrome or Safari. It's like it just ignores resize.",
"id" : 421537847493922816,
"created_at" : "2014-01-10 07:03:49 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421512936293548032",
"text" : "\"sudo rm -rf iTunes.app\/\"\nTerminated.",
"id" : 421512936293548032,
"created_at" : "2014-01-10 05:24:50 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421511755215273985",
"text" : "\"iTunes can't be modified or deleted because it's required by OS X\". Ok....?",
"id" : 421511755215273985,
"created_at" : "2014-01-10 05:20:08 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "421505975552471040",
"geo" : { },
"id_str" : "421506315282702337",
"in_reply_to_user_id" : 2268581455,
"text" : "@ZoeCalton I think I am, I watched the videos.",
"id" : 421506315282702337,
"in_reply_to_status_id" : 421505975552471040,
"created_at" : "2014-01-10 04:58:31 +0000",
"in_reply_to_screen_name" : "ZoeAppleseed",
"in_reply_to_user_id_str" : "2268581455",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421504844596133888",
"text" : "But it's great to have an actual terminal now. I'm missing being to able to touch the screen.",
"id" : 421504844596133888,
"created_at" : "2014-01-10 04:52:40 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421502522759467009",
"text" : "Macs are hilarious: When holding down delete until there is nothing else to delete the computer vibrates like crazy.\nPLEASE STOP DELETING!",
"id" : 421502522759467009,
"created_at" : "2014-01-10 04:43:27 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421501595902173184",
"text" : "Macs are hilarious: Video demonstrating the touchpad (sensually). There is all these 90's power point animations whenever you do something.",
"id" : 421501595902173184,
"created_at" : "2014-01-10 04:39:46 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 0, 8 ],
"id_str" : "612076511",
"id" : 612076511
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421445295143010305",
"in_reply_to_user_id" : 612076511,
"text" : "@surface wont boot again. So I'm heading into the city to return it(3rd time?). Possibly get a mac *shudders*.",
"id" : 421445295143010305,
"created_at" : "2014-01-10 00:56:03 +0000",
"in_reply_to_screen_name" : "surface",
"in_reply_to_user_id_str" : "612076511",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "421400096484257792",
"text" : "It is so annoying that there is a social network thing called pocket. Because I had an idea for a social network thing called pocket.",
"id" : 421400096484257792,
"created_at" : "2014-01-09 21:56:26 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Erin Robinson",
"screen_name" : "Livelyivy",
"indices" : [ 3, 13 ],
"id_str" : "24422716",
"id" : 24422716
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 126, 140 ],
"url" : "http:\/\/t.co\/vJrgARZAiB",
"expanded_url" : "http:\/\/youtu.be\/MTY1Kje0yLg",
"display_url" : "youtu.be\/MTY1Kje0yLg"
} ]
},
"geo" : { },
"id_str" : "421202307007533056",
"text" : "RT @Livelyivy: Posting this again because it's great: gravity explained using a Lycra mesh, some weights, and various marbles http:\/\/t.co\/v\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 111, 133 ],
"url" : "http:\/\/t.co\/vJrgARZAiB",
"expanded_url" : "http:\/\/youtu.be\/MTY1Kje0yLg",
"display_url" : "youtu.be\/MTY1Kje0yLg"
} ]
},
"geo" : { },
"id_str" : "421113822573637632",
"text" : "Posting this again because it's great: gravity explained using a Lycra mesh, some weights, and various marbles http:\/\/t.co\/vJrgARZAiB",
"id" : 421113822573637632,
"created_at" : "2014-01-09 02:58:53 +0000",
"user" : {
"name" : "Erin Robinson",
"screen_name" : "Livelyivy",
"protected" : false,
"id_str" : "24422716",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/440430797732855808\/FRclruP0_normal.png",
"id" : 24422716,
"verified" : false
}
},
"id" : 421202307007533056,
"created_at" : "2014-01-09 08:50:30 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Wings of St. Nazaire",
"screen_name" : "WingsOfNazaire",
"indices" : [ 3, 18 ],
"id_str" : "2154515000",
"id" : 2154515000
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 82, 104 ],
"url" : "http:\/\/t.co\/UwR2qvvuwn",
"expanded_url" : "http:\/\/www.youtube.com\/watch?v=vicQNY-dg4I",
"display_url" : "youtube.com\/watch?v=vicQNY\u2026"
} ]
},
"geo" : { },
"id_str" : "421197243333361664",
"text" : "RT @WingsOfNazaire: Also, check out this really well done look at our open alpha: http:\/\/t.co\/UwR2qvvuwn",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 62, 84 ],
"url" : "http:\/\/t.co\/UwR2qvvuwn",
"expanded_url" : "http:\/\/www.youtube.com\/watch?v=vicQNY-dg4I",
"display_url" : "youtube.com\/watch?v=vicQNY\u2026"
} ]
},
"geo" : { },
"id_str" : "421164043819180032",
"text" : "Also, check out this really well done look at our open alpha: http:\/\/t.co\/UwR2qvvuwn",
"id" : 421164043819180032,
"created_at" : "2014-01-09 06:18:27 +0000",
"user" : {
"name" : "Wings of St. Nazaire",
"screen_name" : "WingsOfNazaire",
"protected" : false,
"id_str" : "2154515000",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/518996588706803713\/RZ2UL5FC_normal.png",
"id" : 2154515000,
"verified" : false
}
},
"id" : 421197243333361664,
"created_at" : "2014-01-09 08:30:22 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "John Cusack",
"screen_name" : "johncusack",
"indices" : [ 3, 14 ],
"id_str" : "17017636",
"id" : 17017636
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 51, 73 ],
"url" : "http:\/\/t.co\/fnKbzjTZYi",
"expanded_url" : "http:\/\/consortiumnews.com\/2014\/01\/07\/nsa-insiders-reveal-what-went-wrong\/",
"display_url" : "consortiumnews.com\/2014\/01\/07\/nsa\u2026"
} ]
},
"geo" : { },
"id_str" : "420895911917547523",
"text" : "RT @johncusack: Daniel Ellsberg asked I share this http:\/\/t.co\/fnKbzjTZYi",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/www.apple.com\" rel=\"nofollow\"\u003EiOS\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 35, 57 ],
"url" : "http:\/\/t.co\/fnKbzjTZYi",
"expanded_url" : "http:\/\/consortiumnews.com\/2014\/01\/07\/nsa-insiders-reveal-what-went-wrong\/",
"display_url" : "consortiumnews.com\/2014\/01\/07\/nsa\u2026"
} ]
},
"geo" : { },
"id_str" : "420821058518671361",
"text" : "Daniel Ellsberg asked I share this http:\/\/t.co\/fnKbzjTZYi",
"id" : 420821058518671361,
"created_at" : "2014-01-08 07:35:33 +0000",
"user" : {
"name" : "John Cusack",
"screen_name" : "johncusack",
"protected" : false,
"id_str" : "17017636",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/422722129646206976\/FOAk5uFE_normal.jpeg",
"id" : 17017636,
"verified" : true
}
},
"id" : 420895911917547523,
"created_at" : "2014-01-08 12:32:59 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Alexander Muscat",
"screen_name" : "alexandermuscat",
"indices" : [ 0, 16 ],
"id_str" : "59736969",
"id" : 59736969
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420816976940789760",
"geo" : { },
"id_str" : "420821513525141504",
"in_reply_to_user_id" : 59736969,
"text" : "@alexandermuscat All good, How about Tuesday night?",
"id" : 420821513525141504,
"in_reply_to_status_id" : 420816976940789760,
"created_at" : "2014-01-08 07:37:21 +0000",
"in_reply_to_screen_name" : "alexandermuscat",
"in_reply_to_user_id_str" : "59736969",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 12, 20 ],
"id_str" : "612076511",
"id" : 612076511
}, {
"name" : "Microsoft",
"screen_name" : "Microsoft",
"indices" : [ 91, 101 ],
"id_str" : "74286565",
"id" : 74286565
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420782394342273024",
"geo" : { },
"id_str" : "420782668670717953",
"in_reply_to_user_id" : 16025792,
"text" : "The current @surface, is working fine for the most part. But it has been frustrating, and @Microsoft support were not helpful at all.",
"id" : 420782668670717953,
"in_reply_to_status_id" : 420782394342273024,
"created_at" : "2014-01-08 05:03:00 +0000",
"in_reply_to_screen_name" : "james_a_forbes",
"in_reply_to_user_id_str" : "16025792",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 0, 8 ],
"id_str" : "612076511",
"id" : 612076511
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420782078074974208",
"geo" : { },
"id_str" : "420782394342273024",
"in_reply_to_user_id" : 16025792,
"text" : "@surface So I then bought a 256gb from a local retailer. But that Surface had a BSOD and then wouldn't boot. So I replaced it, same thing.",
"id" : 420782394342273024,
"in_reply_to_status_id" : 420782078074974208,
"created_at" : "2014-01-08 05:01:55 +0000",
"in_reply_to_screen_name" : "james_a_forbes",
"in_reply_to_user_id_str" : "16025792",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 0, 8 ],
"id_str" : "612076511",
"id" : 612076511
}, {
"name" : "Microsoft",
"screen_name" : "Microsoft",
"indices" : [ 94, 104 ],
"id_str" : "74286565",
"id" : 74286565
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420336345606029312",
"geo" : { },
"id_str" : "420782078074974208",
"in_reply_to_user_id" : 612076511,
"text" : "@surface I originally intended to order the 512gb, but due to delays I ordered the 256gb from @Microsoft . But it never arrived.",
"id" : 420782078074974208,
"in_reply_to_status_id" : 420336345606029312,
"created_at" : "2014-01-08 05:00:39 +0000",
"in_reply_to_screen_name" : "surface",
"in_reply_to_user_id_str" : "612076511",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420780241406017538",
"text" : "But Beck came on, and I'm really getting into it.",
"id" : 420780241406017538,
"created_at" : "2014-01-08 04:53:21 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420780187358216194",
"text" : "I listened to the new BRMC album. It had some okay bits but mostly the stadium reverb and \"epic\" guitars really bugged me.",
"id" : 420780187358216194,
"created_at" : "2014-01-08 04:53:09 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420769000037949440",
"geo" : { },
"id_str" : "420778914529566722",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle I'm so glad you liked them! Next batch I'll try to get a hold of Darryl's Peanut Butter, it is the best!",
"id" : 420778914529566722,
"in_reply_to_status_id" : 420769000037949440,
"created_at" : "2014-01-08 04:48:05 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ {
"text" : "i9bookshelf",
"indices" : [ 29, 41 ]
} ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420722900946022403",
"text" : "I returned The E Myth to the #i9bookshelf",
"id" : 420722900946022403,
"created_at" : "2014-01-08 01:05:30 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420702959572230144",
"text" : "Trying to set up my RPi as a second monitor at work using Synergy. Later I want to turn the pi into a wireless hdmi receiver.",
"id" : 420702959572230144,
"created_at" : "2014-01-07 23:46:16 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420442092444209152",
"text" : "Tupperwerewolf",
"id" : 420442092444209152,
"created_at" : "2014-01-07 06:29:40 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Alexander Muscat",
"screen_name" : "alexandermuscat",
"indices" : [ 0, 16 ],
"id_str" : "59736969",
"id" : 59736969
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "420419880395890688",
"geo" : { },
"id_str" : "420420056774754305",
"in_reply_to_user_id" : 59736969,
"text" : "@alexandermuscat Friday is good.",
"id" : 420420056774754305,
"in_reply_to_status_id" : 420419880395890688,
"created_at" : "2014-01-07 05:02:07 +0000",
"in_reply_to_screen_name" : "alexandermuscat",
"in_reply_to_user_id_str" : "59736969",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420319284674297857",
"text" : "Aside from not having a keyboard or mouse right now, I'm really happy with my workflow.",
"id" : 420319284674297857,
"created_at" : "2014-01-06 22:21:41 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420318318503809024",
"text" : "I get so frustrated that things I can do in Sublime Text, I can't do in Windows, or Chrome etc. Sublime Text.",
"id" : 420318318503809024,
"created_at" : "2014-01-06 22:17:50 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420100304541974530",
"text" : "Of Pitchforks top 50, nothing has stood out so far. Next up: The Range - Nonfiction. Here's hoping.",
"id" : 420100304541974530,
"created_at" : "2014-01-06 07:51:32 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420099930036764673",
"text" : "Speedy Ortiz sounds like Elliot Smith (Melodically), Nirvana (Texturally) & Fugazi (Structurally) but without anything new.",
"id" : 420099930036764673,
"created_at" : "2014-01-06 07:50:03 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420077214684553217",
"text" : "Trying out some new music, because music is dead to me. Pitchfork says \"Pusha T\".",
"id" : 420077214684553217,
"created_at" : "2014-01-06 06:19:47 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420046949706776576",
"text" : "I don't know why, but music doesn't connect with me lately.",
"id" : 420046949706776576,
"created_at" : "2014-01-06 04:19:31 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "420030057612988418",
"text" : "A great dirty UI hack. If you want a more interactive link, but don't want multiple assets for hover & click. Just change the opacity.",
"id" : 420030057612988418,
"created_at" : "2014-01-06 03:12:24 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419985481879658496",
"text" : "I'd be content to never experience the words \"Content\" and \"Experience\" again.",
"id" : 419985481879658496,
"created_at" : "2014-01-06 00:15:16 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"indices" : [ 3, 14 ],
"id_str" : "70587360",
"id" : 70587360
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419983184369942531",
"text" : "RT @ADAMATOMIC: sometimes i think the whole point of practice isn\u2019t to learn or explore but just to be less afraid",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/tapbots.com\/software\/tweetbot\/mac\" rel=\"nofollow\"\u003ETweetbot for Mac\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419930035852541952",
"text" : "sometimes i think the whole point of practice isn\u2019t to learn or explore but just to be less afraid",
"id" : 419930035852541952,
"created_at" : "2014-01-05 20:34:57 +0000",
"user" : {
"name" : "adam",
"screen_name" : "ADAMATOMIC",
"protected" : false,
"id_str" : "70587360",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/583782677561507840\/w_Y9WDjX_normal.jpg",
"id" : 70587360,
"verified" : false
}
},
"id" : 419983184369942531,
"created_at" : "2014-01-06 00:06:08 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Trevor Timm",
"screen_name" : "trevortimm",
"indices" : [ 3, 14 ],
"id_str" : "224079521",
"id" : 224079521
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 139, 140 ],
"url" : "http:\/\/t.co\/q0cfVNbSUB",
"expanded_url" : "http:\/\/www.newyorker.com\/talk\/comment\/2014\/01\/13\/140113taco_talk_wright?mobify=0",
"display_url" : "newyorker.com\/talk\/comment\/2\u2026"
} ]
},
"geo" : { },
"id_str" : "419981432136548352",
"text" : "RT @trevortimm: Anyone who still believes the \"NSA mass surveillance would've stopped 9\/11\" talking point should really read this: http:\/\/t\u2026",
"retweeted_status" : {
"source" : "\u003Ca href=\"http:\/\/itunes.apple.com\/us\/app\/twitter\/id409789998?mt=12\" rel=\"nofollow\"\u003ETwitter for Mac\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 115, 137 ],
"url" : "http:\/\/t.co\/q0cfVNbSUB",
"expanded_url" : "http:\/\/www.newyorker.com\/talk\/comment\/2014\/01\/13\/140113taco_talk_wright?mobify=0",
"display_url" : "newyorker.com\/talk\/comment\/2\u2026"
} ]
},
"geo" : { },
"id_str" : "419948354357821440",
"text" : "Anyone who still believes the \"NSA mass surveillance would've stopped 9\/11\" talking point should really read this: http:\/\/t.co\/q0cfVNbSUB",
"id" : 419948354357821440,
"created_at" : "2014-01-05 21:47:44 +0000",
"user" : {
"name" : "Trevor Timm",
"screen_name" : "trevortimm",
"protected" : false,
"id_str" : "224079521",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/513928354861309952\/ZXOBnAjq_normal.jpeg",
"id" : 224079521,
"verified" : true
}
},
"id" : 419981432136548352,
"created_at" : "2014-01-05 23:59:10 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419972193540272128",
"text" : "New favourite JS hack for multiline strings. Put your string in a div, and then access its inner html.",
"id" : 419972193540272128,
"created_at" : "2014-01-05 23:22:28 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419960775348719616",
"text" : "Giving spotify another chance.",
"id" : 419960775348719616,
"created_at" : "2014-01-05 22:37:05 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Alexander Muscat",
"screen_name" : "alexandermuscat",
"indices" : [ 0, 16 ],
"id_str" : "59736969",
"id" : 59736969
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "419746732411346944",
"geo" : { },
"id_str" : "419950464809959424",
"in_reply_to_user_id" : 59736969,
"text" : "@alexandermuscat Nice, maybe that would work better. Any day in particular?",
"id" : 419950464809959424,
"in_reply_to_status_id" : 419746732411346944,
"created_at" : "2014-01-05 21:56:07 +0000",
"in_reply_to_screen_name" : "alexandermuscat",
"in_reply_to_user_id_str" : "59736969",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419946387376054272",
"text" : "I've seen the inside of the sausage factory. I never want to eat a factory again.",
"id" : 419946387376054272,
"created_at" : "2014-01-05 21:39:55 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Alexander Muscat",
"screen_name" : "alexandermuscat",
"indices" : [ 0, 16 ],
"id_str" : "59736969",
"id" : 59736969
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "419726913733541889",
"geo" : { },
"id_str" : "419741881182855168",
"in_reply_to_user_id" : 59736969,
"text" : "@alexandermuscat Any day but Thursday. What if we recorded upstairs at that restaurant near Southern Cross in the early evening?",
"id" : 419741881182855168,
"in_reply_to_status_id" : 419726913733541889,
"created_at" : "2014-01-05 08:07:17 +0000",
"in_reply_to_screen_name" : "alexandermuscat",
"in_reply_to_user_id_str" : "59736969",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419679394672558080",
"text" : "Mordialloc. Mordialloc. Morgan Freeman.",
"id" : 419679394672558080,
"created_at" : "2014-01-05 03:58:59 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419623810162114560",
"text" : "TIL Op shop means Opportunity shop, Seagulls surf the wind(hover), and Seaford is beautiful.",
"id" : 419623810162114560,
"created_at" : "2014-01-05 00:18:07 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419592065635192832",
"text" : "If flash worked on my phone I'd be playing cubic on every train trip ever.",
"id" : 419592065635192832,
"created_at" : "2014-01-04 22:11:58 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 114, 136 ],
"url" : "http:\/\/t.co\/df6zSu9DAY",
"expanded_url" : "http:\/\/adamatomic.com\/cubic\/",
"display_url" : "adamatomic.com\/cubic\/"
} ]
},
"geo" : { },
"id_str" : "419450613831704576",
"text" : "It took me a good long while to figure out what Cubic was all about, but I finally get it, and it is incredible. http:\/\/t.co\/df6zSu9DAY",
"id" : 419450613831704576,
"created_at" : "2014-01-04 12:49:54 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419433877279494144",
"text" : "I finally automated my invoicing. I pull my online calendar's rss feed, strip the time, tally it up and render a markdown invoice. Yay!",
"id" : 419433877279494144,
"created_at" : "2014-01-04 11:43:23 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419390781556682752",
"text" : "Also Saturn and it's moons are amazing and beautiful.",
"id" : 419390781556682752,
"created_at" : "2014-01-04 08:52:08 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419389272261550081",
"in_reply_to_user_id" : 2268581455,
"text" : "@ZoeCalton was embarrassed to get her leftover pizza take away. She was worried they might get annoyed at wasting a box on her.",
"id" : 419389272261550081,
"created_at" : "2014-01-04 08:46:09 +0000",
"in_reply_to_screen_name" : "ZoeAppleseed",
"in_reply_to_user_id_str" : "2268581455",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419387613334630400",
"text" : "I just learned you can jQuery with nodejs. That is so cool.",
"id" : 419387613334630400,
"created_at" : "2014-01-04 08:39:33 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 35, 43 ],
"id_str" : "612076511",
"id" : 612076511
}, {
"name" : "Microsoft",
"screen_name" : "Microsoft",
"indices" : [ 72, 82 ],
"id_str" : "74286565",
"id" : 74286565
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419287911075291136",
"text" : "And that is not counting the first @surface which I ordered online from @microsoft (which never arrived).",
"id" : 419287911075291136,
"created_at" : "2014-01-04 02:03:22 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Surface",
"screen_name" : "surface",
"indices" : [ 33, 41 ],
"id_str" : "612076511",
"id" : 612076511
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "419287485626077184",
"text" : "Going into the city to return my @surface pro 2 (for the third time). I love the product but it has been such a nightmare.",
"id" : 419287485626077184,
"created_at" : "2014-01-04 02:01:41 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Alexander Muscat",
"screen_name" : "alexandermuscat",
"indices" : [ 0, 16 ],
"id_str" : "59736969",
"id" : 59736969
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418882365084024833",
"in_reply_to_user_id" : 59736969,
"text" : "@alexandermuscat maybe we can do our first recording this week coming? You got a free few hours?",
"id" : 418882365084024833,
"created_at" : "2014-01-02 23:11:52 +0000",
"in_reply_to_screen_name" : "alexandermuscat",
"in_reply_to_user_id_str" : "59736969",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418881681534103552",
"text" : "Bus driver is texting, misses two green lights.",
"id" : 418881681534103552,
"created_at" : "2014-01-02 23:09:09 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "418793287508455424",
"geo" : { },
"id_str" : "418843314519945216",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle oh really? How so?",
"id" : 418843314519945216,
"in_reply_to_status_id" : 418793287508455424,
"created_at" : "2014-01-02 20:36:42 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/418699257202241537\/photo\/1",
"indices" : [ 118, 140 ],
"url" : "http:\/\/t.co\/aLq6JIbmsA",
"media_url" : "http:\/\/pbs.twimg.com\/media\/Bc-EwYXCMAA4YfJ.png",
"id_str" : "418699257076396032",
"id" : 418699257076396032,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bc-EwYXCMAA4YfJ.png",
"sizes" : [ {
"h" : 331,
"resize" : "fit",
"w" : 685
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 289,
"resize" : "fit",
"w" : 600
}, {
"h" : 331,
"resize" : "fit",
"w" : 685
}, {
"h" : 164,
"resize" : "fit",
"w" : 340
} ],
"display_url" : "pic.twitter.com\/aLq6JIbmsA"
} ],
"hashtags" : [ {
"text" : "ld48",
"indices" : [ 112, 117 ]
} ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418699257202241537",
"text" : "Prototyped a level syntax. It is a little rough around the edges, but will release it as soon as it is ready. #ld48 http:\/\/t.co\/aLq6JIbmsA",
"id" : 418699257202241537,
"created_at" : "2014-01-02 11:04:16 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418553746889506816",
"text" : "Peanut butter and banana milkshakes are insane!",
"id" : 418553746889506816,
"created_at" : "2014-01-02 01:26:04 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ {
"indices" : [ 106, 128 ],
"url" : "http:\/\/t.co\/psRDrJ4wGf",
"expanded_url" : "http:\/\/galactic-princess.com\/",
"display_url" : "galactic-princess.com"
} ]
},
"geo" : { },
"id_str" : "418515300632371201",
"text" : "Galactic Princess looks stunning. I wish there was a twitter because otherwise I might forget about it. http:\/\/t.co\/psRDrJ4wGf",
"id" : 418515300632371201,
"created_at" : "2014-01-01 22:53:17 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ {
"text" : "ld48",
"indices" : [ 118, 123 ]
} ],
"urls" : [ {
"indices" : [ 95, 117 ],
"url" : "http:\/\/t.co\/L9hyWq0zxS",
"expanded_url" : "http:\/\/www.deconstructeam.com\/games\/gods-will-be-watching\/",
"display_url" : "deconstructeam.com\/games\/gods-wil\u2026"
} ]
},
"geo" : { },
"id_str" : "418510741964980224",
"text" : "I was so intrigued by Gods Will Be Watching. I'm excited that it is being developed further. http:\/\/t.co\/L9hyWq0zxS #ld48",
"id" : 418510741964980224,
"created_at" : "2014-01-01 22:35:11 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418489923826487296",
"text" : "Oh god! So sick of eggs!",
"id" : 418489923826487296,
"created_at" : "2014-01-01 21:12:27 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/418312036959809536\/photo\/1",
"indices" : [ 39, 61 ],
"url" : "http:\/\/t.co\/ZILj9EpIvn",
"media_url" : "http:\/\/pbs.twimg.com\/media\/Bc4klMACcAAw3qt.jpg",
"id_str" : "418312036687179776",
"id" : 418312036687179776,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bc4klMACcAAw3qt.jpg",
"sizes" : [ {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 1024,
"resize" : "fit",
"w" : 577
}, {
"h" : 1024,
"resize" : "fit",
"w" : 577
}, {
"h" : 1024,
"resize" : "fit",
"w" : 577
}, {
"h" : 603,
"resize" : "fit",
"w" : 340
} ],
"display_url" : "pic.twitter.com\/ZILj9EpIvn"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "418311010303213570",
"geo" : { },
"id_str" : "418312036959809536",
"in_reply_to_user_id" : 402394871,
"text" : "@ThePoitras I challenge you to a duel! http:\/\/t.co\/ZILj9EpIvn",
"id" : 418312036959809536,
"in_reply_to_status_id" : 418311010303213570,
"created_at" : "2014-01-01 09:25:36 +0000",
"in_reply_to_screen_name" : "TeemPwahtrah",
"in_reply_to_user_id_str" : "402394871",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "418300756958015488",
"geo" : { },
"id_str" : "418310250605723648",
"in_reply_to_user_id" : 402394871,
"text" : "@ThePoitras I didn't add anything to the pizza because I needed to taste the base on its own so that next time I'd know what works with it.",
"id" : 418310250605723648,
"in_reply_to_status_id" : 418300756958015488,
"created_at" : "2014-01-01 09:18:30 +0000",
"in_reply_to_screen_name" : "TeemPwahtrah",
"in_reply_to_user_id_str" : "402394871",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Siena Somerset",
"screen_name" : "doktorgoogle",
"indices" : [ 0, 13 ],
"id_str" : "486414259",
"id" : 486414259
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"in_reply_to_status_id_str" : "418278556557275136",
"geo" : { },
"id_str" : "418290353863548928",
"in_reply_to_user_id" : 486414259,
"text" : "@doktorgoogle Like a beautiful savoury biscuit base. It was a beautiful pizza, but I may need to experiment with cooling time\/temp.",
"id" : 418290353863548928,
"in_reply_to_status_id" : 418278556557275136,
"created_at" : "2014-01-01 07:59:26 +0000",
"in_reply_to_screen_name" : "doktorgoogle",
"in_reply_to_user_id_str" : "486414259",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ {
"expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/418273616011075584\/photo\/1",
"indices" : [ 94, 116 ],
"url" : "http:\/\/t.co\/69iK0t2iQ6",
"media_url" : "http:\/\/pbs.twimg.com\/media\/Bc4BozGCEAAiaeJ.jpg",
"id_str" : "418273615813939200",
"id" : 418273615813939200,
"media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bc4BozGCEAAiaeJ.jpg",
"sizes" : [ {
"h" : 577,
"resize" : "fit",
"w" : 1024
}, {
"h" : 577,
"resize" : "fit",
"w" : 1024
}, {
"h" : 338,
"resize" : "fit",
"w" : 600
}, {
"h" : 150,
"resize" : "crop",
"w" : 150
}, {
"h" : 191,
"resize" : "fit",
"w" : 340
} ],
"display_url" : "pic.twitter.com\/69iK0t2iQ6"
} ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418273616011075584",
"text" : "Trying an Almond meal pizza base tonight. seemed to turn out okay. We'll see how it tastes http:\/\/t.co\/69iK0t2iQ6",
"id" : 418273616011075584,
"created_at" : "2014-01-01 06:52:55 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
}, {
"source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ {
"name" : "Steve Martin",
"screen_name" : "SteveMartinToGo",
"indices" : [ 3, 19 ],
"id_str" : "14824849",
"id" : 14824849
} ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418177003150266368",
"text" : "RT @SteveMartinToGo: It's New Year's Eve! Don't forget to set your clocks back.",
"retweeted_status" : {
"source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E",
"entities" : {
"user_mentions" : [ ],
"media" : [ ],
"hashtags" : [ ],
"urls" : [ ]
},
"geo" : { },
"id_str" : "418062715328802816",
"text" : "It's New Year's Eve! Don't forget to set your clocks back.",
"id" : 418062715328802816,
"created_at" : "2013-12-31 16:54:53 +0000",
"user" : {
"name" : "Steve Martin",
"screen_name" : "SteveMartinToGo",
"protected" : false,
"id_str" : "14824849",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/581948664605646848\/gSIVFPmx_normal.jpg",
"id" : 14824849,
"verified" : true
}
},
"id" : 418177003150266368,
"created_at" : "2014-01-01 00:29:01 +0000",
"user" : {
"name" : "James Forbes",
"screen_name" : "james_a_forbes",
"protected" : false,
"id_str" : "16025792",
"profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg",
"id" : 16025792,
"verified" : false
}
} ]
|
import React from 'react';
import styled, { css } from 'styled-components';
import { visuallyHidden } from '../../../theme';
import Logo from '../../ui/Logo';
import vars from '../../../vars';
import MainMenu from '../MainMenu';
export default function Header({ route, ...props }) {
const isFronPage = route.name === 'index';
let logo;
const logoLink = (
<LogoLink href="/" title="Torna alla homepage">
<StyledLogo />
<LogoText>{vars.siteName}</LogoText>
</LogoLink>
);
if (isFronPage) {
logo = <H1LogoContainer>{logoLink}</H1LogoContainer>;
} else {
logo = <PlainLogoContainer>{logoLink}</PlainLogoContainer>;
}
return (
<HeaderContainer id="js-header" {...props}>
{logo}
<nav>
<MainMenu route={route} />
</nav>
</HeaderContainer>
);
}
const HeaderContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 var(--space-unit);
height: var(--header-height);
`;
const logostyles = css`
width: var(--logo-width);
margin: 0;
transform: translateY(0.2rem);
`;
const H1LogoContainer = styled.h1`
${logostyles};
`;
const PlainLogoContainer = styled.div`
${logostyles};
`;
const StyledLogo = styled(Logo)`
fill: var(--color-text-light-accent);
will-change: transform;
transition: transform 0.2s ease-in;
:hover {
transform: translateY(-0.15em);
}
`;
const LogoText = styled.span`
${visuallyHidden}
`;
const LogoLink = styled.a`
display: grid;
place-items: center;
`;
|
const mongoose = require('mongoose')
const Schema = mongoose.Schema
const PlaceSchema = new Schema({
is: String,
title: String
})
module.exports = mongoose.models.Place || mongoose.model('Place', PlaceSchema)
|
function palindrome(str) {
var string = str;
string=string.toLowerCase();
string=string.match(/[A-Za-z0-9]/g);
var stringCheck=[];
for(let i=0;i<string.length;i++){
stringCheck.unshift(string[i]);
}
string=string.join('');
stringCheck=stringCheck.join('');
if(string==stringCheck){
return true;
}
else{
return false;
}
}
|
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-babel')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-sass')
grunt.loadNpmTasks("grunt-ts")
grunt.initConfig({
clean: ['dist'],
copy: {
src_to_dist: {
cwd: 'src',
expand: true,
src: ['**/*', '!**/*.ts', '!**/*.js', '!**/*.scss'],
dest: 'dist'
},
pluginDef: {
expand: true,
src: ['README.md'],
dest: 'dist'
}
},
watch: {
rebuild_all: {
files: ['src/**/*', 'README.md'],
tasks: ['default'],
options: {spawn: false}
}
},
babel: {
options: {
sourceMap: true,
presets: ['es2015'],
plugins: ['transform-es2015-modules-systemjs']
},
dist: {
files: [{
cwd: 'src',
expand: true,
src: ['**/*.js'],
dest: 'dist',
ext: '.js'
}]
}
},
ts: {
default : {
tsconfig: './tsconfig.json',
options: {
skipLibCheck: true
}
}
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'dist/css/monasca.dark.css': 'src/sass/monasca.dark.scss',
'dist/css/monasca.light.css': 'src/sass/monasca.light.scss'
}
}
}
})
grunt.registerTask('default', ['clean', 'sass', 'copy', 'babel', 'ts'])
}
|
"use strict";
Object.defineProperty(exports, "compileGetter", {
enumerable: true,
get: function get() {
return _data.compileGetter;
}
});
Object.defineProperty(exports, "compileSetter", {
enumerable: true,
get: function get() {
return _data.compileSetter;
}
});
var _data = require("./core/utils/data");
|
const redis = require('redis');
const { REDIS_CONF } = require('../conf/db');
//创建客户端
const redisClient = redis.createClient(REDIS_CONF.port,REDIS_CONF.host);
redisClient.on('error',err=>{
console.error('err');
});
function set(key,val) {
if (typeof val === 'object'){
val = JSON.stringify(val)
}
redisClient.set(key,val,redis.print);
}
function get(key) {
return new Promise((resolve,reject)=>{
redisClient.get(key,(err,val)=>{
if(err){
reject(err);
return
}
if(val == null){
resolve(null);
}
//如果是object 先尝试用JSON.parse返回 如果有错误 就返回原值
try{
resolve(JSON.parse(val))
}catch (e) {
resolve(val)
}
// //退出
// redisClient.quit();
});
})
}
module.exports = {
set,
get
}
|
/**
* Convert string to 32bit integer
* @param {String} string String that should be hashed
* @return {String} Converted 32bit integer
*/
module.exports = (string) => {
let hash = 0;
let length = string.length;
let char;
if (length === 0) {
return hash;
}
for (let i = 0; i < length; i++) {
char = string.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash |= 0; // Convert to 32bit integer
}
return hash;
};
|
import React from 'react';
import {
StyleSheet,
View,
ScrollView,
Text,
TouchableWithoutFeedback,
} from 'react-native';
import { Card, ListItem, Button , Avatar} from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
const Task = props => {
const {
taskId,
taskTitle,
navigate,
} = props;
return (
<TouchableWithoutFeedback
onPress={ () => navigate('TaskDetails', {taskId}) } >
<Card
containerStyle={styles.cardContainer} >
<Text style={{ marginBottom: 30 }} >
{taskTitle}
</Text>
{/* CardMetrics */}
<View
style={ styles.metricsContainer } >
<Icon
name={'calendar-o'}
size={16} />
<Text
style={ styles.metricsText } >
{ ` ${'05/15/2018'}` }
</Text>
<Icon
name={'comment-o'}
size={16} />
<Text
style={ styles.metricsText } >
{ ` ${3}` }
</Text>
<Icon
name={'paperclip'}
size={16} />
<Text
style={ styles.metricsText } >
{ ` ${3}` }
</Text>
</View>
{/* CardButtons */}
{/* <View style={styles.buttonContainer}>
<Button
//raised
fontSize={14}
icon={{ name: 'check' }}
backgroundColor='grey'
//fontFamily='Lato'
buttonStyle={{ height: 35, width: 110 }}
title='Complete' />
<Button
//raised
fontSize={14}
icon={{ name: 'delete' }}
backgroundColor='grey'
//fontFamily='Lato'
buttonStyle={{ height: 35, width: 110 }}
title='Dismiss' />
<Button
//raised
icon={{ name: 'message' }}
fontSize={14}
backgroundColor='grey'
//fontFamily='Lato'
buttonStyle={{ height: 35, width: 110 }}
title='Message' />
</View>*/}
<View
style={styles.avatarContainer} >
{/* <Icon
name={ 'medkit' }
style={[ styles.icon ]}
size={16} />*/}
<View
style={{ paddingLeft: 0 }} >
<View
style={styles.avatars} >
<Avatar
containerStyle={{ marginRight: 10 }}
small
rounded
source={{uri: "https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg"}}
onPress={() => console.log("Works!")}
activeOpacity={0.7} />
<Avatar
containerStyle={{ marginRight: 10 }}
small
rounded
source={{uri: "https://s3.amazonaws.com/uifaces/faces/twitter/kfriedson/128.jpg"}}
onPress={() => console.log("Works!")}
activeOpacity={0.7} />
</View>
</View>
</View>
</Card>
</TouchableWithoutFeedback>
)
}
const styles = StyleSheet.create({
cardContainer: {
shadowColor: 'rgba(0,0,0, .2)',
shadowOffset: { height: 2, width: 2 },
shadowOpacity: 1,
shadowRadius: 2,
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'space-around',
padding: 0,
paddingTop: 10,
},
metricsContainer: {
flexDirection: 'row',
backgroundColor: 'transparent',
borderBottomColor: '#bbb',
},
metricsText: {
color: 'grey',
fontSize: 14,
textAlign: 'right',
paddingRight: 15,
paddingBottom: 10,
},
taskContainer: {
flex: 1,
backgroundColor: '#fff',
paddingBottom: 10,
},
avatarContainer: {
flexDirection: 'row',
//paddingLeft: 10,
paddingRight: 50,
paddingTop: 5,
},
avatars: {
flexDirection: 'row',
},
icon: {
justifyContent: 'center',
alignContent: 'center',
alignSelf: 'center',
//textAlign: 'center',
},
})
export default Task;
|
"use strict";
const express = require('express');
const router = express.Router();
module.exports = (knex) => {
// Get all lists
router.get("/", (req, res) => {
knex
.select("*")
.from("lists")
.then((results) => {
res.json(results);
});
});
// Get lists by id
router.get("/:list_id", (req, res) => {
if (req.params.list_id > 0) {
knex
.select("*")
.from("lists")
.where("id", req.params.list_id)
.then((results) => {
res.json(results);
});
}
});
// Get all markers by list_id
router.get("/:list_id/markers", (req, res) => {
if (req.params.list_id > 0) {
knex
.select("*")
.from("markers")
.where("list_id", req.params.list_id)
.then((results) => {
res.json(results);
});
}
});
// Get list contributions
router.get("/:list_id/contributions", (req, res) => {
if (req.params.list_id > 0){
knex
.select('*')
.from('contributions')
.innerJoin('lists', 'contributions.list_id', 'lists.id')
.where('user_id', req.session.user.id)
.then((results) => {
res.json(results);
});
}
});
// Create new list
router.post("/", (req, res) => {
// perform validations here
let list;
console.log("req.body: ", req.body);
console.log("user.id: ", req.session.user.id);
if (true) {
list = {
name: req.body.name,
description: req.body.description
};
// Insert list into lists, returns the id as a confirmation
var contrib;
knex("lists")
.insert(list, 'id').then(function (id, err) {
if (err) {
console.log(err);
} else {
contrib = {
list_id: id[0],
user_id: req.session.user.id
};
console.log("list: ", list);
console.log(`Insert to lists successful: id=${id}`);
console.log("contrib:", contrib);
knex("contributions")
.insert(contrib).then(function (result, err) {
if (err) {
console.log(err);
} else {
console.log(`Insert to contribution table successful`);
}
});
}
});
res.redirect('/');
}
});
// Toggle favourites (post version)
router.post("/:list_id/favourites", (req, res) => {
// perform validations here
if (req.params.list_id > 0){
console.log("list_id", req.params.list_id);
console.log("user.id", req.session.user.id);
var favs = {
list_id: req.params.list_id,
user_id: req.session.user.id
};
knex("favourites")
.where('user_id', req.session.user.id)
.andWhere('list_id', req.params.list_id)
.then(function (result, err) {
if (err) {
console.log(err);
} else {
if (result.length === 0) {
knex("favourites")
.insert(favs).then(function (result, err) {
if (err) {
console.log(err);
} else {
console.log(`Insert into favourite table successful`);
}
});
} else {
console.log("exists!");
// Delete it
knex('favourites')
.where('user_id', req.session.user.id)
.andWhere('list_id', req.params.list_id)
.del()
.then(function (result, err) {
if (err) {
console.log(err);
} else {
console.log(`Deleted favourite`);
}
});
}
}
});
res.redirect('/');
}
});
// Toggle favourites (get version)
router.get("/:list_id/favourites", (req, res) => {
// perform validations here
if (req.params.list_id > 0){
console.log("list_id", req.params.list_id);
console.log("user.id", req.session.user.id);
var favs = {
list_id: req.params.list_id,
user_id: req.session.user.id
};
knex("favourites")
.where('user_id', req.session.user.id)
.andWhere('list_id', req.params.list_id)
.then(function (result, err) {
if (err) {
console.log(err);
} else {
if (result.length === 0) {
knex("favourites")
.insert(favs).then(function (result, err) {
if (err) {
console.log(err);
} else {
console.log(`Insert into favourite table successful`);
}
});
} else {
console.log("exists!");
// Delete it
knex('favourites')
.where('user_id', req.session.user.id)
.andWhere('list_id', req.params.list_id)
.del()
.then(function (result, err) {
if (err) {
console.log(err);
} else {
console.log(`Deleted favourite`);
}
});
}
}
});
res.redirect('/');
}
});
// Update list
router.post("/:list_id/update", (req, res) => {
// perform validation here
if (req.params.list_id > 0){
let list = {};
if (true) {
list = {
name: req.body.name,
description: req.body.description
};
}
knex("lists")
.where("id", req.params.list_id)
.update(list, "id")
.then(function (id, err) {
if (err) {
console.log(err);
} else {
console.log(`Update successful`);
res.redirect("/");
// res.send(`Update successful\n`);
}
});
}
});
// get form to perform update
router.get("/:list_id/edit", (req, res) => {
var getMarker = function (listId, callback){
knex("lists")
.where("id", listId)
.then(function(results) {
callback(results);
});
};
getMarker(req.params.list_id, function(results){
console.log(results[0]);
return res.render("partials/edit-list", results[0]);
});
});
// Delete list
router.get("/:list_id/delete", (req, res) => {
knex("contributions")
.where("list_id", req.params.list_id)
.del()
.then((results) => {
knex("lists")
.where("id", req.params.list_id)
.del()
.then((results) => {
console.log(`Delete successful`);
res.redirect("/");
});
});
});
return router;
};
|
import './index.css'
const EMOJI_GAME_LOGO =
'https://assets.ccbp.in/frontend/react-js/game-logo-img.png'
const NavBar = props => {
const {isPlaying, score, totalScore} = props
return (
<div className="navbar-container">
<div className="navbar-containers">
<img
className="emoji-game-logo"
src={EMOJI_GAME_LOGO}
alt="emoji game logo"
/>
<h1 className="emoji-game-navbar-heading">Emoji Game</h1>
</div>
{isPlaying && (
<div className="navbar-containers">
<p className="navbar-text">Score:{` ${score}`}</p>
<p className="navbar-text">Top Score:{` ${totalScore} `}</p>
</div>
)}
</div>
)
}
export default NavBar
|
var mysql = require("mysql");
var multer = require('multer');
var DIR = './src/assets/uploads/';
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './src/assets/uploads/')
},
filename: function (req, file, cb) {
cb(null, file.originalname);
}
});
var upload = multer({ storage: storage }).single('photo');
function REST_ROUTER(router,connection,md5) {
var self = this;
self.handleRoutes(router,connection,md5);
}
REST_ROUTER.prototype.handleRoutes= function(router,connection,md5) {
router.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
next();
});
router.get("/",function(req,res){
res.json({"Message" : "Widaj swiecie !"});
});
router.get("/users",function(req,res){
var query = "SELECT * FROM ??";
var table = ["pracownik"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "users" : rows});
}
});
});
router.post('/upload', function (req, res, next) {
var path = '';
upload(req, res, function (err) {
if (err) {
// An error occurred when uploading
console.log(err);
return res.status(422).send("an Error occured")
}
console.log(req.file);
path = req.file.originalname;
res.json(path);
});
});
router.post("/newUser",function(req,res){
var query = "INSERT INTO ?? VALUES (null,?,?,?,?,?)";
var table = ["pracownik", req.body.Imie, req.body.Nazwisko, req.body.Stanowisko, req.body.haslo, req.body.email];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Pracownik został dodany do bazy"});
}
});
});
router.delete("/deleteUser/:id",function(req,res){
var query = "DELETE from ?? WHERE ??=?";
var table = ["pracownik","id_pracownika",req.params.id];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Usunięto praconika o id "+req.params.id});
}
});
});
router.delete("/deleteUserWorkplace/:id",function(req,res){
var query = "DELETE from ?? WHERE ??=?";
var table = ["stanowisko","id_stanowiska",req.params.id];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Usunięto praconika ze stanowiska o id "+req.params.id});
}
});
});
router.post("/newUserWorkplace",function(req,res){
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["stanowisko", req.body.pracownik_id_pracownika, req.body.nazwa_maszyny];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Użytkownik został przydzielony do stanowiska"});
}
});
})
router.get("/machines",function(req,res){
var query = "SELECT id_stanowiska, nazwa_maszyny, id_pracownika, Imie, Nazwisko FROM ??, ?? where pracownik_id_pracownika=id_pracownika";
var table = ["stanowisko", "pracownik"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "machines" : rows});
}
});
});
router.put("/user",function(req,res){
var query = "UPDATE ?? SET ?? = ?, ?? = ?, ?? = ?, ?? = ?, ?? = ? WHERE ?? = ?";
var table = ["pracownik", "Imie", req.body.Imie, "Nazwisko", req.body.Nazwisko, "Stanowisko", req.body.Stanowisko, "haslo", req.body.haslo, "email", req.body.email, "id_pracownika", req.body.id_pracownika];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dokonano modyfikacji w tabeli pracownik"});
}
});
});
router.put("/UserWorkplace",function(req,res){
var query = "UPDATE ?? SET ?? = ?, ?? = ? WHERE ?? = ?";
var table = ["stanowisko", "pracownik_id_pracownika", req.body.pracownik_id_pracownika, "nazwa_maszyny", req.body.nazwa_maszyny, "id_stanowiska", req.body.id_stanowiska];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dokonano modyfikacji w tabeli stanowisko"});
}
});
});
router.get("/halfProducts",function(req,res){
var query = "SELECT id_stanu, id_polproduktu, nazwa_polproduktu, typ_polproduktu, ilosc_polproduktu FROM ??, ?? WHERE polprodukty_id_polproduktu = id_polproduktu";
var table = ["stan_magazynu_polproduktu", "polprodukty"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "halfProducts" : rows});
}
});
});
router.post("/AddnewHalfProducts",function(req,res) {
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["polprodukty", req.body.nazwa_polproduktu, req.body.typ_polproduktu];
query = mysql.format(query, table);
connection.query(query, function (err) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
connection.query('SELECT max(id_polproduktu) as max from polprodukty', function (err, rows) {
var ret = JSON.parse(JSON.stringify(rows));
id_pol = ret[0].max;
var query2 = "INSERT INTO ?? VALUES (null,?,?)";
var table2 = ["stan_magazynu_polproduktu", id_pol, req.body.ilosc_polproduktu];
query2 = mysql.format(query2, table2);
connection.query(query2, function (err) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
res.json({"Error": false, "Message": "Dodano nowy półprodukt"});
}
});
});
}
});
});
router.put("/EditHalfProducts",function(req,res){
var query = "UPDATE ?? SET ?? = ?, ?? = ? WHERE ?? = ?";
var table = ["stan_magazynu_polproduktu", "polprodukty_id_polproduktu", req.body.polprodukty_id_polproduktu, "ilosc_polproduktu", req.body.ilosc_polproduktu, "id_stanu", req.body.id_stanu];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dokonano modyfikacji stanu półproduktu"});
}
});
});
router.get("/viewOfOrder",function(req,res){
var query = "SELECT id_zamowienie, pracownik_id_pracownika, id_produktu, nazwa_produktu, model_produktu_id_modelu, ilosc_zamowienia, data_zamowienia, data_realizacji, filename, nazwa_modelu FROM ??, ??, ?? WHERE zamowienie.produkt_id_produktu = produkt.id_produktu AND zamowienie.model_produktu_id_modelu = model_produktu.id_modelu";
var table = ["zamowienie", "produkt", "model_produktu"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "viewOfOrder" : rows});
}
});
});
router.post("/newOrder",function(req,res){
var query = "INSERT INTO ?? VALUES (null,?,?,?,?,?,?,?)";
var table = ["zamowienie", req.body.pracownik_id_pracownika, req.body.produkt_id_produktu, req.body.model_produktu_id_modelu, req.body.ilosc_zamowienia, req.body.data_zamowienia, req.body.data_realizacji, req.body.filename];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
connection.query('SELECT max(id_zamowienie) as max from zamowienie', function (err, rows) {
var ret = JSON.parse(JSON.stringify(rows));
id_zam = ret[0].max;
var query2 = "INSERT INTO ?? VALUES (null,?,?)";
var table2 = ["przekazanie_zamowienia_do_produkcji", id_zam, req.body.ilosc_zamowienia];
query2 = mysql.format(query2, table2);
connection.query(query2, function (err) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
var query3 = "SELECT polprodukty_id_polproduktu, Zuzycie FROM ?? WHERE ?? = ?";
var table3 = ["zuzycie_polproduktow_na_produkt", "model_produktu_id_modelu", req.body.model_produktu_id_modelu];
query3 = mysql.format(query3,table3);
connection.query(query3,function(err, rows) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
var values = [];
for ( var i = 0; i<rows.length; i++) {
var row = rows[i]['Zuzycie'];
var row2 = rows[i]['polprodukty_id_polproduktu'];
values.push({
'Zuzycie': row,
'polprodukty_id_polproduktu': row2
});
var query4 = "SELECT ilosc_polproduktu, stan_magazynu_polproduktu.polprodukty_id_polproduktu, Zuzycie FROM ??, ?? WHERE ?? = ? AND ?? = ? AND ?? = ??";
var table4 = ['stan_magazynu_polproduktu', 'zuzycie_polproduktow_na_produkt', 'stan_magazynu_polproduktu.polprodukty_id_polproduktu', rows[i]['polprodukty_id_polproduktu'], "model_produktu_id_modelu", req.body.model_produktu_id_modelu, "zuzycie_polproduktow_na_produkt.polprodukty_id_polproduktu", "stan_magazynu_polproduktu.polprodukty_id_polproduktu"];
query4 = mysql.format(query4,table4);
connection.query(query4,function (err, rows2) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
var values2 = [];
for (var j = 0; j<rows2.length; j++) {
var query5 = "UPDATE ?? SET ?? = ? WHERE ?? = ?";
var table5 = ["stan_magazynu_polproduktu", "ilosc_polproduktu", rows2[j]['ilosc_polproduktu'] - (rows2[j]['Zuzycie'] * req.body.ilosc_zamowienia), "polprodukty_id_polproduktu", rows2[j]['polprodukty_id_polproduktu']];
query5 = mysql.format(query5, table5);
connection.query(query5);
}
}
});
}
res.json({"Error": false, "Message": "Zamówienie zostało złożone"});
}
});
}
});
});
}
});
});
router.get("/productionStage",function (req,res) {
var query = "SELECT id_etapu_produkcji, nazwa_maszyny, nazwa_etapu FROM ??, ?? WHERE stanowisko_id_stanowiska = id_stanowiska";
var table = ["etap_produkcji", "stanowisko"];
query = mysql.format(query, table);
connection.query(query, function (err, rows) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
res.json({"Error": false, "Message": "Success", "productionStage": rows});
}
});
});
router.post("/newProductionStage",function (req,res){
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["etap_produkcji", req.body.stanowisko_id_stanowiska, req.body.nazwa_etapu];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dodano nowy etap produkcji"});
}
});
})
router.post("/newProductConsumption",function (req,res){
var query = "INSERT INTO ?? VALUES (?,?,?)";
var table = ["zuzycie_polproduktow_na_produkt", req.body.Polprodukty_id_polproduktu, req.body.model_produktu_id_modelu, req.body.Zuzycie];
query = mysql.format(query, table);
console.log(req.body);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dodano nową pozycję zużycia półproduktu na produkt"});
}
});
})
router.get("/product",function (req,res) {
var query = "SELECT * FROM ??";
var table = ["model_produktu"];
query = mysql.format(query, table);
connection.query(query, function (err, rows) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
res.json({"Error": false, "Message": "Success", "product": rows});
}
});
});
router.get("/consumptionOfIntermediates",function (req,res) {
var query = "SELECT model_produktu_id_modelu, Polprodukty_id_polproduktu, nazwa_modelu, nazwa_produktu, nazwa_polproduktu, Zuzycie FROM ??, ??, ??, ?? WHERE model_produktu_id_modelu = id_modelu AND Polprodukty_id_polproduktu = id_polproduktu AND produkt_id_produktu = id_produktu";
var table = ["zuzycie_polproduktow_na_produkt", "polprodukty", "model_produktu", "produkt"];
query = mysql.format(query, table);
connection.query(query, function (err, rows) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
res.json({"Error": false, "Message": "Success", "consumptionOfIntermediates": rows});
}
});
});
router.post("/deleteConsumptionOfIntermediates",function(req,res) {
var query = "DELETE from ?? WHERE model_produktu_id_modelu = ? AND Polprodukty_id_polproduktu = ?";
var table = ["zuzycie_polproduktow_na_produkt", req.body.model_produktu_id_modelu, req.body.Polprodukty_id_polproduktu];
query = mysql.format(query,table);
connection.query(query,function(err, rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Usunięto pozycję"});
}
});
});
router.post("/login",function(req,res){
var query = "select Imie, Nazwisko, id_pracownika, Stanowisko from ?? where email=? AND haslo=?";
var table = ["pracownik", req.body.email, req.body.haslo];
query = mysql.format(query, table);
connection.query(query,function(err,rows){
if(err || !rows.length) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "user" : rows});
}
});
});
router.get("/users/:id",function(req,res){
var query = "SELECT id_pracownika, Imie, Nazwisko, Stanowisko, email FROM pracownik WHERE ??=?";
var table = ["id_pracownika",req.params.id];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "user" : rows});
}
});
});
router.get("/warehouse",function(req,res){
var query = "SELECT id_produktu_magazynu, id_produkcji, data_godzina_wprowadzenia, stan_w_magazynie, etap_produkcji_id_etapu_produkcji, nazwa_etapu, zamowienie_id_zamowienie, filename, nazwa_produktu, model_produktu_id_modelu, nazwa_modelu, id_stanowiska, nazwa_maszyny, Imie, Nazwisko FROM ??, ??, ??, ??, ??, ??, ??, ??, ?? WHERE magazyn.produkcja_id_produkcji = produkcja.id_produkcji AND produkcja.etap_produkcji_id_etapu_produkcji = etap_produkcji.id_etapu_produkcji AND produkcja.przekazanie_zamowienia_do_produkcji_id_przekazania_zamowienia = przekazanie_zamowienia_do_produkcji.id_przekazania_zamowienia AND id_zamowienie = zamowienie_id_zamowienie AND zamowienie.produkt_id_produktu = produkt.id_produktu AND zamowienie.model_produktu_id_modelu = model_produktu.id_modelu AND stanowisko_id_stanowiska = id_stanowiska AND magazyn.pracownik_id_pracownika = pracownik.id_pracownika";
var table = ["magazyn", "produkcja", "etap_produkcji", "przekazanie_zamowienia_do_produkcji", "zamowienie", "produkt", "model_produktu", "stanowisko", "pracownik"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "warehouse" : rows});
}
});
});
router.put("/warehouseTaking",function(req,res){
var query = "UPDATE ?? SET ?? = ?, ?? = ? WHERE ?? = ?";
var table = ["magazyn", "stan_w_magazynie", req.body.stan_w_magazynie, "pracownik_id_pracownika", req.body.pracownik_id_pracownika, "id_produktu_magazynu", req.body.id_produktu_magazynu];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Pobrano element do obróbki"});
}
});
});
router.put("/warehouseTakingAdd",function(req,res){
var query = "UPDATE ?? SET ?? = ?, ?? = ?, ?? = ? WHERE ?? = ?";
var table = ["magazyn", "data_godzina_wprowadzenia", req.body.data_godzina_wprowadzenia, "stan_w_magazynie", req.body.stan_w_magazynie, "pracownik_id_pracownika", req.body.pracownik_id_pracownika, "id_produktu_magazynu", req.body.id_produktu_magazynu];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
var query2 = "UPDATE ?? SET ?? = ? WHERE ?? = ?";
var table2 = ["produkcja", "etap_produkcji_id_etapu_produkcji", req.body.etap_produkcji_id_etapu_produkcji, "id_produkcji", req.body.id_produkcji];
query2 = mysql.format(query2, table2);
connection.query(query2,function (err) {
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Wstawiono element do magazynu"});
}
});
}
});
});
router.get("/productionResults",function(req,res){
var query = "SELECT id_wynikow_produkcji, produkcja_id_produkcji, data_wyprodukowania, zamowienie_id_zamowienie, nazwa_produktu, ilosc_zamowienia, nazwa_produktu, nazwa_modelu, data_zamowienia, data_realizacji FROM ??, ??, ??, ??, ??, ?? WHERE produkcja_id_produkcji = id_produkcji AND produkcja.przekazanie_zamowienia_do_produkcji_id_przekazania_zamowienia = przekazanie_zamowienia_do_produkcji.id_przekazania_zamowienia AND zamowienie_id_zamowienie = id_zamowienie AND zamowienie.produkt_id_produktu = produkt.id_produktu AND zamowienie.model_produktu_id_modelu = model_produktu.id_modelu";
var table = ["wyniki_produkcji", "zamowienie", "produkcja", "produkt", "przekazanie_zamowienia_do_produkcji", "model_produktu"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "productionResults" : rows});
}
});
});
router.post("/AddproductionResults",function(req,res){
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["wyniki_produkcji", req.body.produkcja_id_produkcji, req.body.data_wyprodukowania];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
var query2 = "DELETE from ?? WHERE ??=? AND ??=?";
var table2 = ["magazyn", "produkcja_id_produkcji", req.body.produkcja_id_produkcji, "id_produktu_magazynu",req.body.id_produktu_magazynu];
query2 = mysql.format(query2,table2);
connection.query(query2,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Usunięto element z magazynu"});
}
});
}
});
});
router.get("/products",function(req,res){
var query = "SELECT * FROM ??";
var table = ["produkt"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "products" : rows});
}
});
});
router.post("/newProduct",function (req,res){
var query = "INSERT INTO ?? VALUES (null,?)";
var table = ["produkt", req.body.nazwa_produktu];
query = mysql.format(query, table);
console.log(req.body);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dodano nowy produkt"});
}
});
})
router.post("/newProductsModel",function (req,res){
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["model_produktu", req.body.produkt_id_produktu, req.body.nazwa_modelu];
query = mysql.format(query, table);
console.log(req.body);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Dodano nowy model produktu"});
}
});
})
router.get("/productsModel",function(req,res){
var query = "SELECT id_modelu, produkt_id_produktu, nazwa_modelu, nazwa_produktu FROM ??, ?? WHERE produkt_id_produktu = id_produktu";
var table = ["model_produktu", "produkt"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "productsModel" : rows});
}
});
});
router.get("/productTable",function(req,res){
var query = "SELECT id_modelu, produkt_id_produktu, nazwa_modelu, nazwa_produktu FROM ??, ?? WHERE produkt_id_produktu = id_produktu AND nazwa_produktu = 'Stół'";
var table = ["model_produktu", "produkt"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "productTable" : rows});
}
});
});
router.get("/productTab",function(req,res){
var query = "SELECT id_modelu, produkt_id_produktu, nazwa_modelu, nazwa_produktu FROM ??, ?? WHERE produkt_id_produktu = id_produktu AND nazwa_produktu = 'Stolik'";
var table = ["model_produktu", "produkt"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "productTab" : rows});
}
});
});
router.get("/transferOfTheOrder",function(req,res){
var query = "SELECT id_przekazania_zamowienia, zamowienie_id_zamowienie, ilosc FROM ??";
var table = ["przekazanie_zamowienia_do_produkcji"];
query = mysql.format(query,table);
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "transferOfTheOrder" : rows});
}
});
});
router.put("/AddTransferOfTheOrder",function(req,res){
var query = "INSERT INTO ?? VALUES (null,?,?)";
var table = ["produkcja", req.body.przekazanie_zamowienia_do_produkcji_id_przekazania_zamowienia, req.body.etap_produkcji_id_etapu_produkcji];
query = mysql.format(query, table);
connection.query(query,function(err){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
var query2 = "UPDATE ?? SET ?? = ? WHERE ?? = ?";
var table2 = ["przekazanie_zamowienia_do_produkcji", "ilosc", req.body.ilosc, "id_przekazania_zamowienia", req.body.id_przekazania_zamowienia];
query2 = mysql.format(query2, table2);
connection.query(query2,function (err) {
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
connection.query('SELECT max(id_produkcji) as max from produkcja', function (err, rows) {
var ret = JSON.parse(JSON.stringify(rows));
id_przek = ret[0].max;
var query3 = "INSERT INTO ?? VALUES (null,?,?,?,?)";
var table3 = ["magazyn", id_przek, req.body.data_godzina_wprowadzenia, req.body.stan_w_magazynie, req.body.pracownik_id_pracownika];
query3 = mysql.format(query3, table3);
connection.query(query3, function (err) {
if (err) {
res.json({"Error": true, "Message": "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Wstawiono element do magazynu"});
}
});
});
}
});
}
});
});
router.get("/theResultOfTheProductionOfTables",function(req,res){
connection.query('SELECT nazwa_produktu, count(produkt_id_produktu) AS Ilosc_zamowien_produktu FROM zamowienie, produkt WHERE produkt.id_produktu=zamowienie.produkt_id_produktu GROUP BY nazwa_produktu ORDER BY Ilosc_zamowien_produktu DESC LIMIT 5',function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "data" : rows});
}
});
});
router.get("/theResultOfTheProductionOfModelTables",function(req,res){
connection.query('SELECT nazwa_modelu, count(model_produktu_id_modelu) AS Ilosc_zamowien_modelu FROM zamowienie, model_produktu WHERE model_produktu.id_modelu=zamowienie.model_produktu_id_modelu AND model_produktu.produkt_id_produktu = 1 GROUP BY nazwa_modelu ORDER BY Ilosc_zamowien_modelu DESC LIMIT 5',function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "data" : rows});
}
});
});
router.get("/theResultOfTheProductionOfModelTable",function(req,res){
connection.query('SELECT nazwa_modelu, count(ilosc_zamowienia) AS Ilosc_zamowien_modelu FROM zamowienie, model_produktu WHERE model_produktu.id_modelu=zamowienie.model_produktu_id_modelu AND model_produktu.produkt_id_produktu = 2 GROUP BY nazwa_modelu ORDER BY Ilosc_zamowien_modelu DESC LIMIT 5',function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing MySQL query"});
} else {
res.json({"Error" : false, "Message" : "Success", "data" : rows});
}
});
});
};
module.exports = REST_ROUTER;
|
/******************************
INITIALIZE DATA OBJECTS
*******************************/
var budgetItems = localStorage.getItem("budgetItems");
if(budgetItems == null){
budgetItems = [];
}
else{
budgetItems = JSON.parse(budgetItems);
}
var expenses = localStorage.getItem("expenses");
if(expenses == null){
expenses = [];
}
else{
expenses = JSON.parse(expenses);
}
var settings = localStorage.getItem("settings");
if(settings == null){
settings = {
"autoCycle": false,
"expenseOverview": "showRem"
};
}
/*****************************
MANIPULATION FUNCTIONS
******************************/
// SAVING DATA
function setLocalStorage(key, data){
data = JSON.stringify(data);
localStorage.setItem(key, data);
}
function saveSettings(setting){
var val = "";
if(setting == "autoCycle"){
var cb = $("#autoCycle");
if(cb.is(":checked")){
val = true;
}
else{
val = false;
}
settings.autoCycle = val;
}
if(setting == "expenseOverview"){
val = $("input[name='expOverview']:checked").val();
settings.expenseOverview = val;
}
setLocalStorage("settings", settings);
}
function newCycle(){
var count = expenses.length;
if(count > 0){
for(var i = 0; i < count; i++){
expenses[i].status = "Inactive";
}
setLocalStorage("expenses", expenses);
}
closeDialog(); // index.js
calculateRemaining();
getFrag("expenses"); // index.js
}
function calculateRemaining(){
if(budgetItems.length > 0){
for(var i = 0; i < budgetItems.length; i++){
var item = budgetItems[i].name;
var totalExps = 0.00
for(var j = 0; j < expenses.length; j++){
if(expenses[j].budgetItem == item && expenses[j].status == "Active"){
totalExps = totalExps + expenses[j].amount;
}
}
var rem = budgetItems[i].amount - totalExps;
budgetItems[i].remaining = rem;
}
setLocalStorage("budgetItems", budgetItems);
}
}
function saveExpenseEdit(){
var expId = parseInt($("#expIdEdit").val(), 10);
var amount = parseFloat($("#expenseAmountEdit").val());
var budgetItem = $("#expenseBudgetEdit").val();
var note = $("#expenseNoteEdit").val();
var rec = expenses[expId];
rec.amount = amount;
rec.budgetItem = budgetItem;
rec.note = note;
setLocalStorage("expenses", expenses);
closeDialog(); // index.js
calculateRemaining();
getFrag("expenses"); // index.js
}
function saveBudgetItem(){
var name = $("#budgetItemName").val();
var amount = parseFloat($("#budgetItemAmount").val());
var budgetItem = new Object();
budgetItem.itemId = budgetItems.length;
budgetItem.name = name;
budgetItem.amount = amount;
budgetItem.remaining = amount;
budgetItems.push(budgetItem);
setLocalStorage("budgetItems", budgetItems);
closeDialog(); // index.js
calculateRemaining();
getFrag("budgets"); // index.js
}
function saveBudgetItemEdit(id){
var name = $("#budgetItemNameEdit").val();
var amount = parseFloat($("#budgetItemAmountEdit").val());
budgetItems[id].name = name;
budgetItems[id].amount = amount;
budgetItems[id].remaining = amount;
setLocalStorage("budgetItems", budgetItems);
closeDialog(); // index.js
calculateRemaining();
getFrag("budgets"); // index.js
}
function saveExpense(){
var amount = parseFloat($("#expenseAmount").val());
var budgetItem = $("#expenseBudget").val();
var note = $("#expenseNote").val();
var expense = new Object();
expense.expId = expenses.length;
expense.date = formatDate(new Date());
expense.amount = amount;
expense.budgetItem = budgetItem;
expense.note = note;
expense.status = "Active";
expenses.push(expense);
setLocalStorage("expenses", expenses);
closeDialog(); // index.js
calculateRemaining();
getFrag("expenses"); // index.js
}
// REMOVING DATA
function hardReset(){
expenses = [];
budgetItems = [];
setLocalStorage("expenses", expenses);
setLocalStorage("budgetItems", budgetItems);
closeDialog(); // index.js
getFrag("budgets"); // index.js
}
function deleteExpense(){
var index = parseInt($("#expIdEdit").val(), 10);
expenses.splice(index, 1);
// reset object id's
for(var i = 0; i < expenses.length; i++){
expenses[i].expId = i;
}
setLocalStorage("expenses", expenses);
closeDialog(); // index.js
calculateRemaining();
getFrag("expenses"); // index.js
}
function deleteBudgetItem(){
var index = parseInt($("#budgetItemIdEdit").val(), 10);
budgetItems.splice(index, 1);
// reset object id's
for(var i = 0; i < budgetItems.length; i++){
budgetItems[i].itemId = i;
}
setLocalStorage("budgetItems", budgetItems);
closeDialog(); // index.js
getFrag("budgets"); // index.js
}
// DISPLAYING DATA
function getDisplayData(fragId){
switch(fragId){
case "budgetsFrag":
calculateRemaining();
getDisplayBudgetItems();
break;
case "expensesFrag":
getDisplayBudgetItemExpenseView();
break;
case "archiveFrag":
getDisplayArchivedExpenses();
break;
}
}
function getDisplayArchivedExpenses(){
var h = "";
var count = expenses.length;
for(var i = 0; i < count; i++){
if(expenses[i].status == "Inactive"){
h = h + "<tr onclick=\"getDialog('viewExpenseModal', "+expenses[i].expId+")\">" +
"<td>"+expenses[i].date+"</td>" +
"<td>"+expenses[i].budgetItem+"</td>" +
"<td>"+formatCurrency(expenses[i].amount)+"</td>" +
"</tr>";
}
}
$("#archiveItemsContainer").html(h);
}
function getDisplayBudgetItems(){
var h = "";
var count = budgetItems.length;
var amtTotal = 0.00;
var remTotal = 0.00;
for(var i = 0; i < count; i++){
var row = "<tr onclick='getEditBudgetItem("+budgetItems[i].itemId+")'><td>"+budgetItems[i].name+"</td><td>"+formatCurrency(budgetItems[i].amount)+"</td><td>"+formatCurrency(budgetItems[i].remaining)+"</td></tr>";
h = h + row;
amtTotal = amtTotal + budgetItems[i].amount;
remTotal = remTotal + budgetItems[i].remaining;
}
$("#budgetItemsContainer").html(h);
$("#budgetsAmtTotal").html(formatCurrency(amtTotal));
$("#budgetsRemTotal").html(formatCurrency(remTotal));
}
function getDisplayBudgetItem(id){
var itemId = id;
var name = budgetItems[id].name;
var amount = budgetItems[id].amount;
$("#budgetItemIdEdit").val(id);
$("#budgetItemNameEdit").val(name);
$("#budgetItemAmountEdit").val(amount);
}
function getDisplayBudgetItemList(){
var h = "";
var count = budgetItems.length;
for(var i = 0; i < count; i++){
h = h + "<option value='"+budgetItems[i].name+"'>"+budgetItems[i].name+"</option>"
}
$("#expenseBudget").html(h);
}
function getDisplayBudgetItemExpenseView(){
var count = budgetItems.length;
var h = "";
var progress = 0.0;
if(count > 0){
for(var i = 0; i < count; i++){
progress = (1 - (budgetItems[i].remaining / budgetItems[i].amount)) * 100;
var style = "";
if(progress >= 85 && progress < 95){
style = "warning";
}
if(progress >= 95){
style = "danger";
}
var expenseOverview = "";
if(settings.expenseOverview == "showRem"){
expenseOverview = formatCurrency(budgetItems[i].remaining) + " <span class='rem-text-sub'>rem</span";
}
else if(settings.expenseOverview == "showSpent"){
var spent = (budgetItems[i].amount - budgetItems[i].remaining);
expenseOverview = formatCurrency(spent) + " <span class='rem-text-sub'>spent</span";
}
h = h + "<div class='budget-item' onclick=\"getDialog('budgetItemExpenses', '"+budgetItems[i].name+"')\">" +
"<div class='budget-item-header'>"+budgetItems[i].name+": <span class='rem-text'>"+expenseOverview+"</span></div>" +
"<div class='progress-bar'>" +
"<div class='progress "+style+"' style='width:"+progress+"%'></div>" +
"</div>" +
"</div>";
}
}
$("#expenseViewContainer").html(h);
// calculate total progress and display progress bar
var prog = "";
var totalProg = 0.0;
var totalAmt = 0.00;
var totalRem = 0.00;
for(var i = 0; i < budgetItems.length; i++){
totalAmt = totalAmt + budgetItems[i].amount;
totalRem = totalRem + budgetItems[i].remaining;
}
totalProg = (1 - (totalRem / totalAmt)) * 100;
var totalProgStyle = "";
if(totalProg >= 85 && totalProg < 95){
totalProgStyle = "warning";
}
if(totalProg >= 95){
totalProgStyle = "danger";
}
if(isNaN(totalProg)){
totalProgStyle = "";
totalProg = 0.00;
}
prog = "<div class='progress "+totalProgStyle+"' style='width:"+totalProg+"%'></div>";
$("#totalProgressContainer").html(prog);
}
function getDisplayExpensesList(budgetItem){
var h = "";
if(expenses.length > 0){
for(var i = 0; i < expenses.length; i++){
if(expenses[i].budgetItem == budgetItem && expenses[i].status == "Active"){
h = h + "<tr onclick=\"getDialog('viewExpenseModal', "+expenses[i].expId+")\">" +
"<td>"+expenses[i].date+"</td>" +
"<td>"+expenses[i].note+"</td>" +
"<td>"+formatCurrency(expenses[i].amount)+"</td>" +
"</tr>";
}
}
}
$("#budgetItemExpensesTitle").html(budgetItem);
$("#budgetItemExpensesContainer").html(h);
}
function getExpenseViewData(expId){
var rec = expenses[expId];
$("#expViewId").val(rec.expId);
$("#expViewDate").html(rec.date);
$("#expViewNote").html(rec.note);
$("#expViewAmount").html(formatCurrency(rec.amount));
$("#expViewBudgetItem").html(rec.budgetItem);
$("#expViewStatus").html(rec.status);
if(rec.status == "Active"){
$("#expViewStatus").addClass("active-status")
}
else{
$("#expViewStatus").addClass("inactive-status");
}
}
function getExpenseEditData(){
var expId = $("#expViewId").val();
var rec = expenses[expId];
$("#expIdEdit").val(expId);
$("#expenseAmountEdit").val(rec.amount);
$("#expenseBudgetEdit").val(rec.budgetItem);
$("#expenseNoteEdit").val(rec.note);
var h = "";
var count = budgetItems.length;
for(var i = 0; i < count; i++){
h = h + "<option value='"+budgetItems[i].name+"'>"+budgetItems[i].name+"</option>"
}
$("#expenseBudgetEdit").html(h).val(rec.budgetItem);
}
|
#!/usr/bin/env node
import * as childprocess from 'child_process';
import * as path from 'path';
import * as fs from 'fs';
import * as program from 'commander';
import {startServer, createServer, startApplication, createDefaultMiddleware} from './server/server';
import {CLIArguments, BuildCommandArgs, CLITestArguments, JestMode} from './types';
import {createProviderZip} from './scripts/createProviderZip';
import {createRuntimeChannels} from './scripts/createRuntimeChannels';
import {executeWebpack} from './webpack/executeWebpack';
import {getProjectConfig} from './utils/getProjectConfig';
import {runIntegrationTests, runUnitTests} from './testing/runner';
import getModuleRoot from './utils/getModuleRoot';
import {executeAllPlugins} from './webpack/plugins/pluginExecutor';
/**
* Start command
*/
program.command('start')
.description('Builds and runs a demo app, for testing service functionality.')
.option(
'-v, --providerVersion <version>',
'Sets the runtime version for the provider. Defaults to "local". Options: local | staging | stable | x.y.z',
'local'
)
.option('-r, --runtime <version>', 'Sets the runtime version. Options: stable | w.x.y.z')
.option('-m, --mode <mode>', 'Sets the webpack mode. Defaults to "development". Options: development | production | none', 'development')
.option('-n, --noDemo', 'Runs the server but will not launch the demo application.', true)
.option('-s, --static', 'Launches the server and application using pre-built files.', true)
.option('-w, --writeToDisk', 'Writes and serves the built files from disk.', true)
.action(startCommandProcess);
/**
* Build command
*/
program.command('build')
.description('Builds the project and writes output to disk, will simultaneously build client, provider and demo app.')
.action(buildCommandProcess)
.option('-m, --mode <mode>', 'Sets the webpack build mode. Defaults to "production". Options: development | production | none', 'production');
/**
* Create Runtime channels
*/
program.command('channels')
.description('Creates additional provider manifests that will run the provider on specific runtime channels.')
.action(createRuntimeChannels);
/**
* Zip command
*/
program.command('zip')
.description('Creates a zip file that contains the provider source code and resources. Can be used to re-deploy the provider internally.')
.action(createProviderZip);
/**
* ESLint Check
*/
program.command('check')
.description('Checks the project for linting issues.')
.option('-c, --noCache', 'Disables eslint caching', false)
.action((args: {noCache: boolean}) => {
runEsLintCommand(false, args.noCache === undefined ? true : false);
});
/**
* ESLint Fix
*/
program.command('fix')
.description('Checks the project for linting issues, and fixes issues wherever possible.')
.option('-c, --noCache', 'Disables eslint caching', false)
.action((args: {noCache: boolean}) => {
runEsLintCommand(true, args.noCache === undefined ? true : false);
});
/**
* Typedoc command
*/
program.command('docs')
.description('Generates typedoc for the project using the standardized theme.')
.action(generateTypedoc);
/**
* Jest commands
*/
program.command('test <type>')
.description('Runs all jest tests for the provided type. Type may be "int" or "unit"')
.option('-r, --runtime <version>', 'Sets the runtime version. Options: stable | w.x.y.z')
.option('-e, --mode <mode>', 'Sets the webpack mode. Defaults to "development". Options: development | production | none', 'development')
.option('-s, --static', 'Launches the server and application using pre-built files.', true)
.option('-n, --fileNames <fileNames...>', 'Runs all tests in the given file.')
.option('-f, --filter <filter>', 'Only runs tests whose names match the given pattern.')
.option('-m, --customMiddlewarePath <path>', 'Path to a custom middleware js file. Only applicable for Integration tests.')
.option('-x, --extraArgs <extraArgs...>', 'Any extra arguments to pass on to jest')
.option('-c, --noColor', 'Disables the color for the jest terminal output text', true)
.action(startTestRunner);
/**
* Executes plugins
*/
program.command('plugins [action]')
.description('Executes all runnable plugins with the supplied action')
.action(startPluginExecutor);
/**
* Process CLI commands
*/
program.parse(process.argv);
// If program was called with no arguments, show help
if (program.args.length === 0) {
program.help();
}
function startPluginExecutor(action?: string) {
return executeAllPlugins(action);
}
/**
* Initiator for the jest int/unit tests
*/
function startTestRunner(type: JestMode, args: CLITestArguments) {
const sanitizedArgs: CLITestArguments = {
providerVersion: 'testing',
noDemo: true,
writeToDisk: args.static !== undefined && args.static ? false : true,
mode: args.mode || 'development',
static: args.static === undefined ? false : true,
filter: args.filter ? `--testNamePattern=${args.filter}` : '',
fileNames: (args.fileNames && (args.fileNames as unknown as string).split(' ').map((testFileName) => `${testFileName}.${type}test.ts`)) || [],
customMiddlewarePath: (args.customMiddlewarePath && path.resolve(args.customMiddlewarePath)) || undefined,
runtime: args.runtime,
noColor: args.noColor === undefined ? false : true,
extraArgs: (args.extraArgs && (args.extraArgs as unknown as string).split(' ')) || []
};
const jestArgs = [];
/**
* Pushes in the colors argument if requested
*/
if (!sanitizedArgs.noColor) {
jestArgs.push('--colors');
}
/**
* Pushes in any file names provided
*/
if (sanitizedArgs.fileNames) {
jestArgs.push(...sanitizedArgs.fileNames);
}
/**
* Pushes in the requested filter
*/
if (sanitizedArgs.filter) {
jestArgs.push(sanitizedArgs.filter);
}
/**
* Adds any extra arguments to the end
*/
if (sanitizedArgs.extraArgs) {
jestArgs.push(...sanitizedArgs.extraArgs);
}
if (type === 'int') {
runIntegrationTests(jestArgs, sanitizedArgs);
} else if (type === 'unit') {
runUnitTests(jestArgs);
} else {
console.log('Invalid test type. Use "int" or "unit"');
}
}
/**
* Starts the build + server process, passing in any provided CLI arguments
*/
async function startCommandProcess(args: CLIArguments) {
const sanitizedArgs: CLIArguments = {
providerVersion: args.providerVersion || 'local',
mode: args.mode || 'development',
noDemo: args.noDemo === undefined ? false : true,
static: args.static === undefined ? false : true,
writeToDisk: args.writeToDisk === undefined ? false : true,
runtime: args.runtime
};
const server = await createServer();
await createDefaultMiddleware(server, sanitizedArgs);
await startServer(server);
startApplication(sanitizedArgs);
}
/**
* Initiates a webpack build for the extending project
*/
async function buildCommandProcess(args: BuildCommandArgs) {
const sanitizedArgs = {mode: args.mode || 'production'};
await executeWebpack(sanitizedArgs.mode, true);
process.exit(0);
}
/**
* Executes ESlint, optionally executing the fix flag.
*/
function runEsLintCommand(fix: boolean, cache: boolean) {
const eslintCmd = path.resolve('./node_modules/.bin/eslint');
const eslintConfig = path.join(getModuleRoot(), '/.eslintrc.json');
const cmd = `"${eslintCmd}" src test --ext .ts --ext .tsx ${fix ? '--fix' : ''} ${cache ? '--cache' : ''} --config "${eslintConfig}"`;
childprocess.execSync(cmd, {stdio: 'inherit'});
}
/**
* Generates typedoc
*/
function generateTypedoc() {
const docsHomePage = path.resolve('./docs/DOCS.md');
const readme = fs.existsSync(docsHomePage) ? docsHomePage : 'none';
const config = getProjectConfig();
const [typedocCmd, themeDir, outDir, tsConfig] = [
'./node_modules/.bin/typedoc',
`${getModuleRoot()}/typedoc-template`,
'./dist/docs/api',
'./src/client/tsconfig.json'
].map((filePath) => path.resolve(filePath));
const cmd = `"${typedocCmd}" --name "OpenFin ${config.SERVICE_TITLE}" --theme "${themeDir}" --out "${outDir}" --excludeNotExported --excludePrivate --excludeProtected --hideGenerator --tsconfig "${tsConfig}" --readme ${readme}`; // eslint-disable-line
childprocess.execSync(cmd, {stdio: 'inherit'});
}
|
var passport = require('passport');
var mongoose = require('mongoose');
var User = mongoose.model('User');
var sendJSONresponse = function(res, status, content) {
res.status(status);
res.json(content);
};
// REGISTER API CONTROLLER
module.exports.register = function(req, res) {
var user = new User();
// take the data from the submitted form and create a new mongoose model instance
user.name = req.body.name;
user.email = req.body.email;
// call setPassword method to add the salt & hash to the instance
user.setPassword(req.body.password);
// save instance as a record to the DB
// TODO later include error catches and form validations inside save function here
user.save(function(err) {
var token;
// generate a jwt and send inside json response
token = user.generateJwt();
res.status(200);
res.json({
"token" : token
});
});
};
// LOGIN API CONTROLLER
// TODO add form validation here; check reqd fields
// call authenticate method which callsback parameters
// err, user and info. if user exists, it can be used to
// generate a JWT to return to browser
module.exports.login = function(req, res) {
passport.authenticate('local', function(err, user, info){
var token;
// if passport throws an error
if (err) {
res.status(404).json(err);
return;
}
// if a user is Found
if (user) {
token = user.generateJwt();
res.status(200);
res.json({
"token" : token
});
} else {
// if a user is not Found
res.status(401).json(info);
}
})(req, res);
};
|
//메인 게시글
module.exports = (sequelize, DataTypes) => {
const Main_gaci = sequelize.define('Main_gaci', {
Main_gaci_contents_user_name: {
type: DataTypes.STRING(20),
allowNull: false,
},
Main_gaci_contents: {
type: DataTypes.TEXT,
allowNull: false
}
}, {
charset: 'utf8mb4', //한글 + 이모티콘 게시글에 이모티콘이 달릴 수 있기 떄문에
collate: 'utf8mb4_general_ci', //이모티콘때문에
});
Main_gaci.assoicate = (db) => {
db.Main_gaci.belongsTo(db.User);
db.Main_gaci.hasMany(db.Comment);
}
return Main_gaci;
}
|
// AJ.trainer/base.js
// Defines the base event for AJ Downs
//$ PackConfig
{ "sprites" : [ "base.png" ] }
//$!
module.exports = {
id: "AJ.trainer",
sprite: "base.png",
sprite_format: "pt_vertcol-32",
name: "AJ Downs",
infodex: "game.crystal.trainer.ajdowns",
sprite_creator: "Nintendo",
};
|
import path from 'path'
const robotsOptions = {
root: path.join(__dirname, '..', '..', '..', '..', 'client', 'static'),
headers: {
'Content-Type': 'text/plain;charset=UTF-8',
},
}
const robots = (req, res) => res.status(200).sendFile('robots.txt', robotsOptions)
module.exports = robots
|
function colorBgCheckbox(){
chart.destroy();
console.log('Bg color changed.');
bg_color_html = document.getElementById('bgColors').value;
if (type == 'doughnut' || type == 'polarArea' || type == 'pie') { bg_color = ['#ff3300', '#0033cc', '#ffff66', '#00ff00', '#660066', '#ff00ff', '#800000', '#00ffff', '#996633', '#009999', '#cc6699', '#cccc00']; }
else { bg_color = bg_color_html; }
make_chart();
}
function colorBorderCheckbox() {
chart.destroy();
bord_color = document.getElementById('borderColors').value;
make_chart();
}
function typeCheckbox() {
chart.destroy();
type = document.getElementById('type').value;
if ((type == 'doughnut' || type == 'polarArea' || type == 'pie')) {bg_color = ['#ff3300', '#0033cc', '#ffff66', '#00ff00', '#660066', '#ff00ff', '#800000', '#00ffff', '#996633', '#009999', '#cc6699', '#cccc00', '#ff1a1a', '#b32d00', '#1affff']; }
else { bg_color = '#b3b3ff'; }
make_chart();
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
angular.module("appRec").directive("ngUploadChange", function () {
return{
scope: {
ngUploadChange: "&"
},
link: function ($scope, $element, $attrs) {
$element.on("change", function (event) {
$scope.$apply(function () {
$scope.ngUploadChange({$event: event})
})
})
$scope.$on("$destroy", function () {
$element.off();
});
}
}
});
angular.module('appRec').controller('detLeadRecController', function ($scope, $http, $routeParams, $modal) {
$scope.lead = $routeParams.id;
$scope.tipoUser = JSON.parse(sessionStorage.userData).tipo;
$scope.editar = false;
$scope.readOnly = true;
$scope.onCall = false;
$scope.comunicacoes = [];
$scope.show = false;
$scope.e = {};
$scope.sim = {};
$scope.addNewOR = false;
$scope.addNewOC = false;
$scope.addNewSim = false;
$scope.temHistorico = false;
$scope.titular = "primeiro";
$scope.firstT = "active";
$scope.secondT = "";
$scope.reverse = true;
$scope.txEsforco = 0.0;
// Prazo Taxa
$scope.prazotaxa = [];
$scope.c = {};
$scope.s = {};
//INICIAR
getLeadAllInfo();
//Button para fazer a chamada
$scope.makeCall = function (lead) {
if (!$scope.onCall) {
$scope.onCall = !$scope.onCall;
$http({
url: 'restful/makeCall.php',
method: 'POST',
data: JSON.stringify({"user": JSON.parse(sessionStorage.userData), "telefone": $scope.ic.telefone, "lead": lead})
}).then(function (answer) {
if (answer.data.failure) {
alert(answer.data.results[0].error);
}
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
});
} else {
$scope.onCall = !$scope.onCall;
$http({
url: 'restful/makeCall.php',
method: 'POST',
data: JSON.stringify({"user": JSON.parse(sessionStorage.userData), "telefone": 0, "lead": 0})
}).then(function (answer) {
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
});
}
};
//Button when no answer
$scope.noAnswer = function (leadId) {
//Confirm this click
$scope.onCall = false;
var param = {};
param.lead = $scope.p;
param.user = JSON.parse(sessionStorage.userData);
if (!($scope.dl.status == 8 || $scope.dl.status == 108 || ($scope.dl.status >= 10 && $scope.status < 100))) {
if (confirm('Pretende agendar para o dia seguinte? ')) {
$http({
url: 'php/recup/agendamentoAutomaticoRec.php',
method: 'POST',
data: JSON.stringify(param)
}).then(function (answer) {
console.log(answer.data);
//Desligar chamada
$http({
url: 'restful/makeCall.php',
method: 'POST',
data: JSON.stringify({"user": JSON.parse(sessionStorage.userData), "telefone": 0, "lead": 0})
}).then(function (answer) {
// alert(answer.data);
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
window.location.replace('#/dash');
});
});
}
}
// window.location.replace('#/dash');
};
$scope.notAtribuited = function (lead) {
// anular por o numero não estar atribuido
if (confirm('Vai fechar LEAD como não Atribuido. \nPretende continuar?')) {
//if the email exist then cal function to send email
$scope.onCall = false;
if ($scope.ic.email) {
var parm = {};
parm.lead = lead;
parm.user = JSON.parse(sessionStorage.userData);
$http({
url: 'php/gestor/sendEmailBadContact.php',
method: 'POST',
data: JSON.stringify(parm)
}).then(function (answer) {
console.log(answer.data);
//call function to change lead status to ANULADO (103)
updateStatus(103, lead);
window.location.replace("");
});
}
}
}
//Botão de agendamento
$scope.agendar = function (lead) {
//abrir modal para fazer o agendamento
var modalInstance = $modal.open({
templateUrl: 'modalAgendamento.html',
controller: 'modalInstanceAgendamentoRec',
size: 'sm',
resolve: {items: function () {
return lead;
}
}
});
modalInstance.result.then(function () {
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
window.location.replace('#');
});
}
//Fora do expediente - enviar SMS e Email
$scope.foraDoExpediente = function () {
//Confirm this click
//Agendamento and go to dashboard
var param = {};
param.lead = $scope.dl;
param.user = JSON.parse(sessionStorage.userData);
$http({
url: 'php/recup/foraDoExpediente.php',
method: 'POST',
data: JSON.stringify(param)
}).then(function (answer) {
console.log(answer.data);
});
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
window.location.replace("");
};
//Ativar a lead se esta estiver anulada com documentação pedida
$scope.ativar = function (lead) {
var array = ['3', '4', '5', '9', '14', '15', '18', '19', '28', '29', '31', '103', '104', '105', '109'];
if (array.indexOf(lead.status) > -1 && lead.docpedida) {
if (confirm("Pretende ativar este processo?")) {
$http({
url: 'php/recup/ativarProcesso.php',
method: 'POST',
data: JSON.stringify({'user': JSON.parse(sessionStorage.userData), 'lead': lead})
}).then(function (answer) {
if (answer.data) {
alert(answer.data);
}
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
getLeadAllInfo();
});
}
}
};
// Atualizar o segundo proponente
$scope.updateSegProp = function(value) {
$scope.p.segundoproponente = value;
$http({
url: 'php/updateSegProp.php',
method: 'POST',
data: JSON.stringify({'lead': $scope.lead, 'segprop': value})
}).then(function (answer) {
console.log(answer);
});
}
/**
* Atualizar a outra informação
* @param {type} lead
* @param {type} outrainfo
* @returns {undefined}
*/
$scope.updateOutraInfo = function (lead, outrainfo) {
if (outrainfo != '') {
$http({
url: 'php/updateOutraInfo.php',
method: 'POST',
data: JSON.stringify({'lead': lead, 'outrainfo': outrainfo})
}).then(function (answer) {
console.log(answer);
});
}
}
//calcular a idade
$scope.calcIdade = function () {
var today = new Date();
var year = Number($scope.p.datanascimento.substr(-4));
$scope.p.idade = today.getFullYear() - year;
console.log($scope.p.datanascimento);
}
//Definição dos tabs
$scope.tabs = [{
title: 'Cliente',
id: 'zero.tpl'
}, {
title: 'Informação Financeira',
id: 'one.tpl'
}, {
title: 'Documentos',
id: 'two.tpl'
}, {
title: 'Registo de Contactos',
id: 'three.tpl',
}, {
title: 'Financiamentos',
id: 'four.tpl'
}, {
title: 'Rejeições',
id: 'five.tpl'
}, {
title: 'Notas do Analista',
id: 'six.tpl'
}, {
title: 'Comprovativos',
id: 'seven.tpl'
}, {
title: 'Cartões',
id: 'eight.tpl'
}, {
title: 'Comunicações',
id: 'nine.tpl'
}];
/*
* Controlo dos tabs e dos paineis
*/
if (sessionStorage.currentTab != undefined) {
$scope.currentTab = sessionStorage.currentTab;
var t = {};
t.id = $scope.currentTab;
onClickTabFunc(t);
} else {
$scope.currentTab = 'one.tpl';
// sessionStorage.currentTab = 'zero.tpl';
}
//Função para navegar nas tabs da listagem
$scope.onClickTab = function (tab) {
onClickTabFunc(tab);
};
$scope.isActiveTab = function (tabId) {
return tabId == $scope.currentTab;
};
//Adicionar linha de OR
$scope.saveLinhaOR = function (or) {
if (or.tiporendimento && or.valorrendimento && or.periocidade) {
$http({
url: "php/addNewOR.php",
method: "POST",
data: JSON.stringify({'lead': $scope.dl.id, 'or': or})
}).then(function (answer) {
if (answer.data.msg == 'OK') {
$scope.rendimentos = answer.data.rendimentos;
$scope.addNewOR = false;
$scope.checkParceiros();
$scope.calcularTxEsforco();
} else {
alert(answer.data.msg);
}
});
} else {
alert("Atenção! Tem que preencher os campos todos");
}
}
//Remover linha de OR
$scope.removeLnOR = function (ln) {
$http({
url: "php/recup/removeLnOR.php",
method: "POST",
data: JSON.stringify({'or': ln})
}).then(function (answer) {
$scope.rendimentos = $scope.rendimentos.filter((el) => {
return el.linha != ln.linha
});
console.log($scope.rendimentos);
$scope.checkParceiros();
$scope.calcularTxEsforco();
});
}
//Adicionar linha de OC
$scope.saveLinha = function (oc) {
if (oc.tipocredito && oc.valorcredito && oc.prestacao && (oc.liquidar || oc.liquidar == 0)) {
$http({
url: "php/addNewOC.php",
method: "POST",
data: JSON.stringify({'lead': $scope.dl.id, 'oc': oc})
}).then(function (answer) {
if (answer.data.msg == 'OK') {
$scope.creditos = answer.data.creditos;
$scope.addNewOC = false;
$scope.calcularTxEsforco();
} else {
alert(answer.data.msg);
}
});
} else {
alert("Atenção! Tem que preencher os campos todos");
}
}
//Remover linha de OC
$scope.removeLnOC = function (ln) {
$http({
url: "php/recup/removeLnOC.php",
method: "POST",
data: JSON.stringify({'or': ln})
}).then(function (answer) {
$scope.creditos = $scope.creditos.filter((el) => {
return el.linha != ln.linha
});
console.log($scope.creditos);
$scope.calcularTxEsforco();
});
}
//Guardar linha de Simulação para Email
$scope.saveLinhaSim = function (sim) {
if (sim.tipocredito && sim.valor && sim.prazo) {
$http({
url: "php/recup/saveSimulaEmail.php",
method: "POST",
data: JSON.stringify({'lead': $scope.dl.id, 'sim': sim, 'gestor': sessionStorage.userId})
}).then(function (answer) {
$scope.simulacoesEmail = answer.data;
$scope.addNewSim = false;
});
} else {
alert("Atenção! Tem que preencher os campos todos");
}
}
//Processo
$scope.saveProcesso = function (p) {
$http({
'url': 'php/recup/saveProcessForm.php',
'method': 'POST',
'data': JSON.stringify({'lead': $scope.dl.id, 'process': p})
}).then(function (answer) {
if (answer.data == 'OK') {
$scope.s.segundoproponente = $scope.p.segundoproponente;
// alert("Guardado");
if (p.segundoproponente == 1 && $scope.titular == 'primeiro') {
window.scrollTo(0, 80);
$scope.firstT ='';
$scope.secondT = 'active';
$scope.titular = 'segundo';
} else {
window.scrollTo(0, 80);
$scope.onClickTab({
title: 'Documentos',
id: 'two.tpl'
});
}
} else {
alert("Atenção!!! Não gravou!");
}
});
}
$scope.saveInfoFin = function (ic, f, p) {
console.log(ic);
console.log(f);
console.log(p);
ic.diaprestacao = $scope.p.diaprestacao
f.vencimento = p.vencimento;
f.vencimento2 = p.vencimento2;
f.venc_cetelem = p.venc_cetelem;
f.venc_cetelem2 = p.venc_cetelem2;
f.valorhabitacao = p.valorhabitacao;
$http({
url: "php/recup/saveInfoFin.php",
method: "POST",
data: JSON.stringify({'lead': $scope.dl.id, 'ic': ic, 'fin': f, 'gestor': sessionStorage.userId})
}).then(function (answer) {
console.log(answer.data);
});
// passa para o tab do cliente
window.scrollTo(0,80);
$scope.onClickTab({title: 'Cliente', id: 'zero.tpl' });
}
// TX DE ESFORÇO
$scope.calcularTxEsforco = function () {
$scope.txEsforco = 0;
var vencimento = +$scope.p.vencimento;
if ($scope.s.segundoproponente == 1) {
vencimento += +$scope.p.vencimento2;
}
if (!$scope.p.valorhabitacao) {
$scope.p.valorhabitacao = 0;
}
custosGerais = +$scope.p.valorhabitacao + +$scope.s.prestacaopretendida;
// Outros Creditos
var valorOC = $scope.calcOC()
// Outros Rendimentos
var valorOR = $scope.calcOR();
// Calulo da tx
$scope.txEsforco = ((custosGerais + valorOC) / (vencimento + valorOR)) * 100;
$scope.txEsforco <= 65 ? $scope.progressColor = 'progress-bar-success' : $scope.progressColor = 'progress-bar-danger';
}
// Calcular Outros Rendimentos
$scope.calcOR = function () {
var valorOR = 0;
if ($scope.rendimentos) {
var result = [];
var keys = Object.keys($scope.rendimentos);
keys.forEach(function (key) {
result.push($scope.rendimentos[key]);
});
if (result.length >= 0) {
result.forEach(function (ln) {
if(ln.usar) {
ln.periocidade == 'Ano' ? valorOR += +(ln.valorrendimento / 12) : valorOR += +ln.valorrendimento;
}
});
}
}
return valorOR;
}
// Calcular Outros Creditos
$scope.calcOC = function () {
var resp = 0;
if ($scope.creditos) {
var result = [];
var keys = Object.keys($scope.creditos);
keys.forEach(function (key) {
result.push($scope.creditos[key]);
});
if (result.length >= 0) {
result.forEach(function (ln) {
if (ln.liquidar==0) {
resp += +ln.prestacao;
}
});
}
}
return resp;
}
// Calculo de Simulações para enviar por email
$scope.calcSimulaEmail = function (ln) {
console.table(ln);
var ptxline = $scope.prazotaxa.filter((el) => {
if (ln.tipocredito == el.tipocredito && ln.prazo >= el.prazo && ln.prazo <= el.prazotop)
{
return el;
}
})[0];
console.table(ptxline);
var prestacao = +(+ln.valor / ((1 - Math.pow((1 + (+ptxline.taxa / 100) / 12), -ln.prazo)) / ((+ptxline.taxa / 100) / 12))).toFixed(2);
console.log(prestacao);
$scope.sim.prestacao = prestacao;
}
$scope.calcPrestacao = function (ln) {
console.table(ln);
var ptxline = $scope.prazotaxa.filter((el) => {
if (ln.tipocredito == el.tipocredito && ln.prazopretendido >= el.prazo && ln.prazopretendido <= el.prazotop)
{
return el;
}
})[0];
var prestacao = +(+ln.valorpretendido / ((1 - Math.pow((1 + (+ptxline.taxa / 100) / 12), -ln.prazopretendido)) / ((+ptxline.taxa / 100) / 12))).toFixed(2);
console.log(prestacao);
$scope.s.prestacaopretendida = prestacao;
}
//Agendar BP 22
$scope.agendaBP22 = function (lead) {
if (lead) {
if (confirm("Vai agendar para o proximo dia 22. Pretende continuar?")) {
$http({
url: 'php/gestor/agendamentoBP22.php',
method: 'POST',
data: JSON.stringify({'lead': lead, 'userId': sessionStorage.userId})
}).then(function (answer) {
// console.log(answer.data);
window.location.replace("");
});
}
}
}
//Anexar documento
$scope.anexarDoc = function (d, lead) {
//open modal to attach documentation
var parm = {};
parm.lead = lead;
parm.doc = d;
parm.op = "Anexar";
var modalInstance = $modal.open({
templateUrl: 'modalAnexarDocsPesq.html',
controller: 'modalInstanceAnexarDocsPesq',
size: 'lg',
resolve: {items: function () {
return parm;
}
}
});
modalInstance.result.then(function () {
getLeadAllInfo();
});
};
// Merge Documento a pdf existente
$scope.mergeDoc = function (doc) {
//open modal to attach documentation
var parm = {};
parm.lead = doc.lead;
parm.doc = doc;
parm.op = "Juntar";
var modalInstance = $modal.open({
templateUrl: 'modalAnexarDocsPesq.html',
controller: 'modalInstanceMergeDocs',
size: 'lg',
resolve: {items: function () {
return parm;
}
}
});
modalInstance.result.then(function () {
getLeadAllInfo();
});
};
//Anexar Doc Extra
$scope.anexarDocExtra = function () {
//open modal to attach documentation
var modalInstance = $modal.open({
templateUrl: 'modalAnexarDocsExtra.html',
controller: 'modalInstanceAnexarDocsExtra',
size: 'lg',
resolve: {items: function () {
return $scope.lead;
}
}
});
modalInstance.result.then(function () {
getLeadAllInfo();
});
};
//Ver documentação
$scope.verDoc = function (doc) { //doc inclui o lead id
//open modal to view documentation
var modalInstance = $modal.open({
templateUrl: 'modalViewDoc.html',
controller: 'modalInstanceViewDoc',
size: 'lg',
resolve: {items: function () {
return doc;
}
}
});
modalInstance.result.then(function () {
getLeadAllInfo();
});
};
//RGPD - Eliminar dados
$scope.delRGPD = function (lead) {
if (confirm("Vai eliminar os dados pessoais para esta LEAD. Pretende continuar?")) {
$http({
url: 'php/delRGPD.php',
method: 'POST',
data: JSON.stringify({'lead': lead, 'user': sessionStorage.userId})
}).then(function (answer) {
alert("Toda a informação pessoal foi eleminada!");
window.location.replace('#!/dashboard');
});
}
};
//Rejeitar LEAD
$scope.rejeitarLead = function (lead) {
//Agendamento and go to dashboard
var modalInstance = $modal.open({
templateUrl: 'modalRejeitar.html',
controller: 'modalInstanceRejeitar',
size: 'lg',
resolve: {items: function () {
return lead;
}
}
});
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
};
//DOCUMENTAÇAO
//Botão para descarregar um documento (fx)
$scope.descarregarDoc = function (doc) {
$http({
url: 'php/getDocumentacao.php',
method: 'POST',
data: JSON.stringify({'lead': doc.lead, 'linha': doc.linha})
}).then(function (answer) {
var doc = answer.data[0];
// console.log(JSON.stringify(doc));
if (doc.tipo == 'jpg') {
download("data:image/jpg;base64," + doc.fx64, doc.nomefx);
}
if (doc.tipo == 'jpeg') {
download("data:image/jpeg;base64," + doc.fx64, doc.nomefx);
}
if (doc.tipo == 'png') {
download("data:image/png;base64," + doc.fx64, doc.nomefx);
}
if (doc.tipo == 'pdf') {
download("data:application/pdf;base64," + doc.fx64, doc.nomefx);
}
if (doc.tipo == 'docx') {
download("data:application/docx;base64," + doc.fx64, doc.nomefx);
}
});
};
//Botão para descarregar todos os documentos para o ambiente de trabalho
$scope.descarregarDocs = function (lead) {
$http({
url: 'php/getDocumentacao.php',
method: 'POST',
data: JSON.stringify({'lead': lead})
}).then(function (answer) {
answer.data.forEach(function (ln) {
if (ln.tipo == 'jpg') {
download("data:image/jpg;base64," + ln.fx64, ln.nomefx);
}
if (ln.tipo == 'jpeg') {
download("data:image/jpeg;base64," + ln.fx64, ln.nomefx);
}
if (ln.tipo == 'png') {
download("data:image/png;base64," + ln.fx64, ln.nomefx);
}
if (ln.tipo == 'pdf') {
download("data:application/pdf;base64," + ln.fx64, ln.nomefx);
}
if (ln.tipo == 'docx') {
download("data:application/docx;base64," + ln.fx64, ln.nomefx);
}
});
});
};
//Editar - altera o readonly para false
$scope.editarLead = function () {
$scope.editar = true;
$scope.readOnly = false;
};
//Guardar as alterações
$scope.gravarLead = function (lead) {
$scope.editar = false;
$scope.readOnly = true;
//atualizar o processo
var parm = {};
parm.lead = lead;
parm.user = JSON.parse(sessionStorage.userData);
if (!$scope.ic.segundoproponente || $scope.ic.segundoproponente == 0) {
$scope.ic.nome2 = null;
$scope.ic.parentesco2 = null;
$scope.ic.telefone2 = null;
$scope.ic.nif2 = null;
$scope.ic.idade2 = null;
$scope.ic.profissao2 = null;
$scope.p.vencimento2 = null;
$scope.ic.tipocontrato2 = null;
$scope.ic.inicio2 = null;
$scope.ic.mesmahabitacao = null;
}
if ($scope.mesmaHabitacao) {
$scope.ic.mesmahabitacao = 'Sim';
$scope.ic.tipohabitacao2 = null;
$scope.ic.valorhabitacao2 = null;
$scope.ic.declarada2 = null;
$scope.ic.anoiniciohabitacao2 = null;
} else {
$scope.ic.mesmahabitacao = '';
}
parm.ic = $scope.ic;
$http({
url: 'php/gestor/editarProcesso.php',
method: 'POST',
data: JSON.stringify(parm)
}).then(function (answer) {
//alert(answer.data);
});
};
//Abrir uma nova janela para mostrar o process-form
$scope.processForm = function (lead) {
window.location.replace('#!/processForm/' + lead);
}
//Enviar para a Analise
$scope.envParaAnalise = function (lead) {
//Send to Analise with full documentation or incomplete
if (confirm("Vai enviar para a Analise! Pretende continuar?")) {
$http({
url: 'php/gestor/sendToAnalise.php',
method: 'POST',
data: JSON.stringify({'lead': lead, 'gestor': sessionStorage.userData})
}).then(function (answer) {
if (answer.data != '') {
alert(answer.data);
}
window.location.replace('#!/dashboard');
});
}
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
};
//Pedir Documentação em falta
$scope.pedirDoc = function (lead, p, s) {
lead.tipocredito = s.tipocredito;
lead.email = p.email;
lead.segundoproponente = s.segundoproponente;
//abrir modal com lista de documentação a pedir
var modalInstance = $modal.open({
templateUrl: 'modalPedirDoc.html',
controller: 'modalInstancePedirDoc',
size: 'lg',
resolve: {items: function () {
return lead;
}
}
});
modalInstance.result.then(function (answer) {
//getLeadAllInfo($routeParams.id);
sessionStorage.turn === 'N' ? sessionStorage.turn = 'A' : sessionStorage.turn = 'N';
window.location.replace('#!/gdashboard');
});
};
//Documentação OK - quando está a aguardar documentação vai colocar como pendente
$scope.docsOk = function (lead) {
$http({
url: 'php/analista/updateStatusAnalista.php',
method: 'POST',
data: JSON.stringify({'lead': lead, 'status': 22})
}).then(function (answer) {
// getLeadAllInfo($routeParams.id);
window.history.back(-1);
});
};
//Remover Documento
$scope.removerDoc = function (doc, lead) {
if (confirm('Vai APAGAR este documento! Pretende Continuar?')) {
$http({
url: 'php/removerDoc.php',
method: 'POST',
data: JSON.stringify({'doc': doc, 'lead': lead, 'op': 'Delete'})
}).then(function (answer) {
getLeadAllInfo($routeParams.id);
});
}
};
//Cancelar Pedido de documento
$scope.cancelarPedidoDoc = function (doc, lead) {
$http({
url: 'php/removerDoc.php',
method: 'POST',
data: JSON.stringify({'doc': doc, 'lead': lead, 'op': 'Cancel'})
}).then(function (answer) {
getLeadAllInfo($routeParams.id);
});
};
//Alterar a designação de um documento
$scope.changeDoc = function (doc) {
//abrir modal com lista de documentação para escolher
var modalInstance = $modal.open({
templateUrl: 'modalChangeDoc.html',
controller: 'modalInstanceChangeDoc',
size: 'lg',
resolve: {items: function () {
return doc;
}
}
});
modalInstance.result.then(function (answer) {
// alert(answer);
getLeadAllInfo($routeParams.id);
});
};
//Botão para descarregar o CONTRATO para o ambiente de trabalho
$scope.descarregarContrato = function (c) {
download("data:application/pdf;base64," + c.fx64, c.nome);
};
//Ver Contrato
$scope.verContrato = function (doc) {
var modalInstance = $modal.open({
templateUrl: 'modalViewDoc.html',
controller: 'modalInstanceViewContratoG',
size: 'lg',
resolve: {items: function () {
return doc;
}
}
});
modalInstance.result.then(function () {
// getLeadAllInfo();
});
};
//Botão para descarregar o comprovativo para o ambiente de trabalho
$scope.descarregarComprovativo = function (c) {
if (c.tipodoc == 'jpg') {
download("data:image/jpeg;base64," + c.documento, c.nomedoc);
} else {
download("data:application/pdf;base64," + c.documento, c.nomedoc);
}
};
//Ver Comprovativo
$scope.verComprovativo = function (doc) {
var modalInstance = $modal.open({
templateUrl: 'modalViewComp1.html',
controller: 'modalInstanceViewComp1',
size: 'lg',
resolve: {items: function () {
return doc;
}
}
});
modalInstance.result.then(function () {
// getLeadAllInfo();
});
};
//Comunicações enviar email
$scope.enviarComunicacao = function (e) {
if (e.assunto && e.texto) {
$http({
url: 'php/sendComunicacao.php',
method: 'POST',
data: JSON.stringify({'lead': $scope.lead, 'e': e, 'tipo': 'G'})
}).then(function (answer) {
alert(answer.data.msg);
if (answer.data.msg = "Enviado") {
$scope.e = {};
$scope.comunicacoes = answer.data.comunicacoes;
}
});
} else {
alert("Atenção! Tem de preencher o assunto e o texto do email.");
}
}
//Button to open modal to view Historico
$scope.showHistorico = function (lead) {
//Validate fields
var obj = {};
obj.leads = $scope.listaHistorico;
obj.lead = $scope.lead;
var modalInstance = $modal.open({
templateUrl: 'modalHistorico.html',
controller: 'modalInstanceHistorico',
size: 'lg',
resolve: {items: function () {
return obj;
}
}
});
};
// Abrir modal com lista de simulações guardadas
$scope.getSimulacoes = function (lead) {
var modalInstance = $modal.open({
templateUrl: 'modalGetSimulaDet.html',
controller: 'modalInstanceGetSimulaDet',
size: 'lg',
resolve: {items: function () {
return lead;
}
}
});
modalInstance.result.then(function (answer) {
$scope.s = {};
$scope.p.vencimento = answer.vencimento;
$scope.p.vencimento2 = answer.vencimento2;
$scope.p.venc_cetelem = answer.venc_cetelem;
$scope.p.venc_cetelem2 = answer.venc_cetelem2;
$scope.ic.outrosrendimentos = answer.outrosrendimentos;
$scope.ic.outroscreditos = answer.outroscreditos;
$scope.ic.valorhabitacao = answer.valorhabitacao;
$scope.ic.filhos = answer.filhos;
$scope.s.valorpretendido = answer.valorpretendido;
$scope.s.prestacaopretendida = answer.prestacaopretendida;
$scope.s.prazopretendido = answer.prazopretendido;
$scope.s.tipocredito = answer.tipocredito;
$scope.s.segundoproponente = answer.segundoproponente;
$scope.checkParceiros();
});
}
//FUNCTIONS
/**
* Function to update LEAD status and register contact
* @param {int} status
* @param {obj) lead
* @returns {undefined}
*/
function updateStatus(status, lead) {
var param = {};
param.lead = lead;
param.userId = sessionStorage.userId;
param.status = status;
$http({
url: 'php/updateLeadStatus.php',
method: 'POST',
data: JSON.stringify(param)
}).then(function (answer) {
// alert(answer.data);
});
;
}
function onClickTabFunc(tab) {
var x = document.getElementById(tab.id);
var k = document.getElementsByClassName('pn');
for (var i = 0; i < k.length; i++) {
if (x !== k[i]) {
k[i].className = k[i].className.replace(" show", " hide");
} else {
k[i].className = k[i].className.replace(" hide", " show");
}
}
$scope.currentTab = tab.id;
}
//Obter todos os dados da LEAD/Processo
function getLeadAllInfo() {
if ($scope.lead) {
//Estados Civil
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_sitfamiliar'
}).then(function (answer) {
$scope.estadoscivis = answer.data;
});
//Tipos de documentos
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_tiposdoc'
}).then(function (answer) {
$scope.tiposdoc = answer.data;
});
//Relaçoes familiares
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_relacaofamiliar'
}).then(function (answer) {
$scope.relacoesfamiliares = answer.data;
});
//Nacionalidades
$http.get('lib/nacionalidades.json').then(function (answer) {
$scope.nacionalidades = answer.data;
});
//Tipos de contrato
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_sitprofissional'
}).then(function (answer) {
$scope.tiposcontrato = answer.data;
});
//Tipo Habitação
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_tipohabitacao'
}).then(function (answer) {
$scope.tiposhabitacao = answer.data;
});
//Tabela Prazo Taxa
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_prazotaxa'
}).then(function (answer) {
$scope.prazotaxa = answer.data;
});
//Comunicações
$http({
url: 'php/getComunicacoes.php',
method: 'POST',
data: $scope.lead
}).then(function (answer) {
$scope.comunicacoes = answer.data;
});
//Obter as regras de financiamento dos parceiros
$http({
url: 'php/analista/getRegrasFinanciamento.php',
method: 'GET'
}).then(function (answer) {
$scope.regras = answer.data;
});
//Informações da LEAD
$http({
url: 'php/recup/getLeadAllInfo.php',
method: 'POST',
data: JSON.stringify({"lead": $scope.lead, "user": JSON.parse(sessionStorage.userData)})
}).then(function (answer) {
$scope.dl = answer.data.dlead;
$scope.ic = answer.data.infoCliente;
$scope.rendimentos = answer.data.rendimentos;
$scope.creditos = answer.data.creditos;
$scope.contactos = answer.data.contactos;
$scope.docs = answer.data.docs;
$scope.financiamentos = answer.data.financiamentos;
$scope.contratos = answer.data.contratos;
$scope.calculos = answer.data.calculos;
$scope.s = answer.data.simula;
$scope.s.prazopretendido = $scope.ic.prazopretendido;
$scope.s.prestacaopretendida = $scope.ic.prestacaopretendida;
$scope.s.segundoproponente = $scope.ic.segundoproponente;
$scope.p = answer.data.processo;
$scope.listaHistorico = answer.data.historic;
$scope.simulacoesEmail = answer.data.simulaemail;
if ($scope.listaHistorico.length > 0) {
$scope.temHistorico = true;
}
//Obter informação da aplicação das regras dos parceiros
$scope.checkParceiros();
if ($scope.ic.mesmahabitacao == 'Sim') {
$scope.mesmaHabitacao = true;
} else {
$scope.mesmaHabitacao = false;
}
$scope.rejeicoes = '';
(answer.data.rejeicoes).forEach(function (ln) {
$scope.rejeicoes += ln.data + ' --> ' + ln.motivo + '; ' + ln.obs + '; ' + ln.outro + '\n';
});
$scope.cc = answer.data.cc;
});
getComprovativos($scope.lead);
} else {
alert("Atenção! Verifique os dados e tente novamente.");
}
}
//Checa parceiros
$scope.checkParceiros = function () {
$scope.calcularTxEsforco();
console.log($scope.s.segundoproponente);
if (!$scope.s.segundoproponente || $scope.s.segundoproponente == 0) {
$scope.RLiq = +$scope.p.vencimento + +$scope.calcOR();
$scope.RLiqCt = +$scope.p.venc_cetelem + +$scope.calcOR();
} else {
$scope.RLiq = +$scope.p.vencimento + +$scope.p.vencimento2 + +$scope.calcOR();
$scope.RLiqCt = +$scope.p.venc_cetelem + +$scope.p.venc_cetelem2 + +$scope.calcOR();
}
$scope.despesa = +$scope.ic.valorhabitacao + +$scope.calcOC();
//Calculos da tx de esforço e validação das regras
$scope.parceirosChk = [];
$scope.regras.forEach(function (ln) {
ln['motivo'] = "";
//Validar tipo de credito, valor pretendido, prazo, idade
if ($scope.s.tipocredito == ln.tipocredito) {
if (($scope.p.idade < +ln.idade_min) || ($scope.p.idade > +ln.idade_max)) {
ln['motivo'] = "Idade do cliente";
} else if (($scope.s.prazopretendido < +ln.prazo_min) || ($scope.s.prazopretendido > +ln.prazo_max)) {
ln['motivo'] = "Prazo";
} else if ((+$scope.s.valorpretendido < +ln.montante_min) || (+$scope.s.valorpretendido > +ln.montante_max)) {
ln['motivo'] = "Montante pedido";
} else if ($scope.s.segundoproponente == 0 && ($scope.p.vencimento < +ln.vencimento_1t) && ln.indice_rl == '1.00') {
ln['motivo'] = "Vencimento 1º titular";
} else if ((+$scope.p.venc_cetelem < +ln.vencimento_1t) && +ln.indice_rl > 1) {
ln['motivo'] = "Vencimento 14/12 1º titular";
} else if ($scope.s.segundoproponente == 1 && (+$scope.p.venc_cetelem2 < +ln.vencimento_2t) && +ln.indice_rl > 1) {
ln['motivo'] = "Vencimento 14/12 2º titular";
} else if ($scope.s.segundoproponente == 1 && (+$scope.p.vencimento2 < +ln.vencimento_2t)
&& ((+$scope.p.vencimento + +$scope.p.vencimento2) < +ln.soma_venc) && ln.indice_rl == '1.00') {
ln['motivo'] = "Vencimento 2º titular";
} else if ((+$scope.p.vencimento + +$scope.p.vencimento2) < +ln.soma_venc) {
ln['motivo'] = "Vencimento(s) com valor inferior ao exigido (" + ln.soma_venc + ")";
} else {
//Calculos
$scope.RL = 0;
if (!$scope.s.segundoproponente || $scope.s.segundoproponente == 0) {
//só um titular
if (+ln.indice_rl > 1) {
if (ln.tipocredito == 'CHCC') {
$scope.RL = +$scope.p.venc_cetelem;
} else {
$scope.RL = +$scope.p.venc_cetelem + +$scope.ic.outrosrendimentos;
}
} else {
$scope.RL = +$scope.p.vencimento + +$scope.ic.outrosrendimentos;
}
} else {
// dois titulares
if (+ln.indice_rl > 1) {
if (ln.tipocredito == 'CHCC') {
$scope.RL = +$scope.p.venc_cetelem + +$scope.p.venc_cetelem2;
} else {
$scope.RL = +$scope.p.venc_cetelem + +$scope.p.venc_cetelem2 + +$scope.ic.outrosrendimentos;
}
} else {
$scope.RL = +$scope.p.vencimento + +$scope.p.vencimento2 + +$scope.ic.outrosrendimentos;
}
}
//Taxa de esfoço
ln['txEsf'] = Math.round(((+$scope.ic.valorhabitacao + +$scope.ic.outroscreditos + +$scope.s.prestacaopretendida + (+$scope.ic.filhos * +ln.filhos)) / (+$scope.RL * +ln.indice_rl)) * 100);
//Disponibilidade Orçamental
if (ln['parceiro' != 7]) {
// Calculo normal
ln['disp'] = Math.round(+$scope.RL - (+$scope.ic.valorhabitacao + +$scope.s.prestacaopretendida + +$scope.ic.outroscreditos + (+$scope.ic.filhos * +ln.filhos) + +ln.disp_orcamental));
} else {
var DispOrcUnicre = 0;
// Calculo de disponibilidade para UNICRE - depende do tipo de habitação
if ($scope.ic.tipohabitacao == 1) { // tipo habitação
DispOrcUnicre = ln['habarrendada'];
} else {
DispOrcUnicre = ln['habpropria'];
}
// Calculo
ln['disp'] = Math.round(+$scope.RL - (+$scope.ic.valorhabitacao + +$scope.s.prestacaopretendida + +$scope.ic.outroscreditos
+ (+$scope.ic.filhos * +ln.filhos) + +ln.disp_orcamental + +DispOrcUnicre));
}
if (+ln['txEsf'] > +ln.tx_esfoco && +ln.tolerancia == 0) {
ln['motivo'] = "Taxa de esforço";
} else if (+ln['txEsf'] > (+ln.tx_esforco + +ln.tolerancia)) {
ln['motivo'] = "Taxa de esforço";
} else if (+ln['disp'] <= 0) {
ln['motivo'] = "Disponibilidade orçamental";
}
}
if (ln['motivo'] != "") {
ln['parceiroOk'] = "parceiroRed";
} else {
ln['parceiroOk'] = "parceiroOk";
}
$scope.parceirosChk.push(ln);
}
});
}
function getComprovativos(lead) {
$http({
url: 'php/analista/getComprovativosList.php',
method: 'POST',
data: lead
}).then(function (answer) {
$scope.comprovativos = answer.data;
});
}
});
/**
* Modal instance to select required documents, how to send and ETA
*/
angular.module('appRec').controller('modalInstancePedirDoc', function ($scope, $rootScope, $http, $modalInstance, items) {
$scope.lead = items;
console.log($scope.lead);
$scope.d = {};
$scope.m = {};
$scope.e = {};
$scope.outroDoc = '';
var date = new Date();
var mes = '00';
if (date.getMonth() + 1 < 10) {
mes = '0' + (date.getMonth() + 1);
} else {
mes = date.getMonth() + 1;
}
$scope.minDate = date.getFullYear() + '-' + mes + '-' + date.getDate();
if ($scope.m.email) {
$scope.e.tipoenvio = 'email';
}
//Get Documentation
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_docnecessaria'
}).then(function (answer) {
$scope.docs1 = [];
$scope.docs2 = [];
$scope.d = [];
$scope.d.docs1 = [];
$scope.d.docs2 = [];
answer.data.forEach(function (ln) {
if (ln.titular == 1) {
$scope.docs1.push(ln);
ln.tipocredito == 'T' ? $scope.d.docs1.push(ln) : null;
($scope.lead.tipocredito == "CC" && ln.tipocredito == 'C') ? $scope.d.docs1.push(ln) : null;
(($scope.lead.tipocredito == "CHCC" || $scope.lead.tipocredito == "CH1" || $scope.lead.tipocredito == "CH2")
&& ln.tipocredito == 'H') ? $scope.d.docs1.push(ln) : null;
} else if ($scope.lead.segundoproponente == 1) {
$scope.docs2.push(ln);
ln.tipocredito == 'T' ? $scope.d.docs2.push(ln) : null;
($scope.lead.tipocredito == "CC" && ln.tipocredito == 'C') ? $scope.d.docs2.push(ln) : null;
}
});
});
$scope.saveProcess = function (d, m, e) {
//Validar os dados do formulario do modal
//Documentação - pelo menos um documento
var erro = false;
if (d.docs1 == undefined || d.docs1.length == 0) {
alert('Atenção! Não selecionou nenhum tipo de documento!');
//erro = true;
}
var docs = {};
if (d.docs2) {
docs.docs = d.docs1.concat(d.docs2);
} else {
docs.docs = d.docs1;
}
if (!erro) {
//Gravar os dados do formulario
$rootScope.prograssing = true;
//Pedir a documentação selecionada
console.log(docs.docs);
$http({
url: "php/recup/sendEmailMissingDocsA.php",
method: 'POST',
data: JSON.stringify({'lead': $scope.lead.id, 'docFalta': docs.docs, 'outroDoc': $scope.outroDoc, 'user': JSON.parse(sessionStorage.userData)})
}).then(function (answer) {
alert(answer.data);
$modalInstance.close('OK');
$rootScope.prograssing = false;
});
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to attach documents
*/
angular.module('appRec').controller('modalInstanceAnexarDocsPesq', function ($scope, $http, $modalInstance, items) {
$scope.lead = items.lead;
$scope.doc = items.doc;
$scope.da = {};
$scope.file = {};
$scope.novonome = '';
$scope.maxFileSize = 4000000;
$scope.wait = true;
$scope.compressImage = function (event) {
var file = event.target.files[0];
// console.log(file['name']);
$scope.file.filename = event.target.files[0]['name'];
$scope.file.filetype = file.type;
if (file.type == 'image/jpeg' || file.type == 'image/png') {
ImageTools.resize(file, {
width: 800, // maximum width
height: 1000 // maximum height
}, function (blob, didItResize) {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
});
} else if (file.type == 'application/pdf') {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
} else {
alert("Este tipo de ficheiro não é aceite! Somente JPG, PNG ou PDF");
}
};
//Apenas quando faz a anexação dos documentos no momento
$scope.saveAttachedDoc = function () {
//guardar o ficheiro na arq_documentação e alterar o cad_docpedida
if ($scope.file && !$scope.wait) {
//Gravar os dados do formulario
var obj = {};
obj.lead = items.lead;
obj.doc = $scope.doc;
obj.userId = sessionStorage.userId;
// obj.fxBase64 = 'data:' + $scope.file.filetype + ';base64,' + $scope.file.base64;
obj.fxBase64 = $scope.file.base64data;
obj.nomeFx = $scope.novonome;
obj.type = ($scope.file.filetype).substr(($scope.file.filetype).indexOf('/') + 1);
$http({
url: 'sisleadsrest/cltdocs',
method: 'POST',
data: JSON.stringify(obj)
}).then(function (answer) {
$modalInstance.close(answer.data);
});
} else {
alert("Tem de selecionar um ficheiro ou aguardar que carregue.");
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to Merge document to other that exists
*/
angular.module('appRec').controller('modalInstanceMergeDocs', function ($scope, $http, $modalInstance, items) {
$scope.lead = items.lead;
$scope.doc = items.doc;
console.table(items.doc);
$scope.da = {};
$scope.file = {};
$scope.maxFileSize = 4000000;
$scope.wait = true;
$scope.compressImage = function (event) {
var file = event.target.files[0];
// console.log(file['name']);
$scope.file.filename = event.target.files[0]['name'];
$scope.file.filetype = file.type;
if (file.type == 'image/jpeg' || file.type == 'image/png') {
ImageTools.resize(file, {
width: 800, // maximum width
height: 1000 // maximum height
}, function (blob, didItResize) {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
});
} else if (file.type == 'application/pdf') {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
} else {
alert("Este tipo de ficheiro não é aceite! Somente JPG, PNG ou PDF");
}
};
//Apenas quando faz a anexação dos documentos no momento
$scope.saveAttachedDoc = function () {
//guardar o ficheiro na arq_documentação e alterar o cad_docpedida
if ($scope.file && !$scope.wait) {
//Gravar os dados do formulario
var obj = {};
obj.lead = items.lead;
obj.doc = $scope.doc;
obj.userId = sessionStorage.userId;
// obj.fxBase64 = 'data:' + $scope.file.filetype + ';base64,' + $scope.file.base64;
obj.fxBase64 = $scope.file.base64data;
obj.nomeFx = $scope.novonome;
obj.type = ($scope.file.filetype).substr(($scope.file.filetype).indexOf('/') + 1);
obj.op = "Merge";
$http({
url: 'sisleadsrest/cltdocs',
method: 'POST',
data: JSON.stringify(obj)
}).then(function (answer) {
$modalInstance.close(answer.data);
});
} else {
alert("Tem de selecionar um ficheiro ou aguardar que carregue.");
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to view document.
*/
angular.module('appRec').controller('modalInstanceViewDoc', function ($scope, $http, $modalInstance, items, $timeout, $rootScope, $sce) {
$scope.nomedoc = items.nomedoc;
$rootScope.prograssing = true;
$http({
url: 'php/getDocBase64.php',
method: 'POST',
data: JSON.stringify(items)
}).then(function (answer) {
var fx64 = answer.data.fx64.replace(/[^\x20-\x7E]/gmi, '');
if (answer.data.tipo == 'jpg') {
console.log('JPG: ' + answer.data.tipo);
$scope.imagePath = $sce.trustAsResourceUrl('data:image/jpg;base64,' + answer.data.fx64);
} else if (answer.data.tipo == 'jpeg') {
console.log('JPEG: ' + answer.data.tipo);
$scope.imagePath = $sce.trustAsResourceUrl('data:image/jpeg;base64,' + answer.data.fx64);
} else {
console.log('PDF: ' + fx64);
$scope.imagePath = $sce.trustAsResourceUrl('data:application/pdf;base64,' + fx64);
}
$rootScope.prograssing = false;
});
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to attach documents
*/
angular.module('appRec').controller('modalInstanceAnexarDocsExtra', function ($scope, $http, $modalInstance, items) {
$scope.lead = items;
$scope.novonome = "";
$scope.d = {};
$scope.file = {};
$scope.wait = true;
//obter tipos de documentos
$http({
url: "php/getData.php",
method: "POST",
data: 'cnf_docnecessaria'
}).then(function (answer) {
$scope.docs = answer.data;
});
$scope.compressImage2 = function (event) {
var file = event.target.files[0];
// console.log(file['name']);
$scope.file.filename = event.target.files[0]['name'];
$scope.file.filetype = file.type;
if (file.type == 'image/jpeg' || file.type == 'image/png') {
ImageTools.resize(file, {
width: 800, // maximum width
height: 1000 // maximum height
}, function (blob, didItResize) {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
});
} else if (file.type == 'application/pdf') {
//Converter blob to base64
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = function () {
$scope.file.base64data = reader.result;
$scope.wait = false;
// console.log($scope.file.base64data);
};
} else {
alert("Este tipo de ficheiro não é aceite! Somente JPG, PNG ou PDF");
}
};
//Atualizar o novoNome
$scope.upNovoNome = function (d) {
var novonome = '';
for (var i = 0; i < d.docs.length; i++) {
novonome += d.docs[i].sigla + '_';
}
$scope.novonome = novonome;
};
//Guardar o ficheiro extra
$scope.saveAttachedDocExtra = function () {
if ($scope.file && !$scope.wait && $scope.d.docs[0]) {
//Gravar os dados do formulario
var obj = {};
obj.lead = $scope.lead;
obj.doc = $scope.d.docs[0];
obj.doc.tipodoc = $scope.d.docs[0].id;
obj.userId = sessionStorage.userId;
obj.nomeFx = $scope.file.filename;
obj.type = ($scope.file.filetype).substr(($scope.file.filetype).indexOf('/') + 1);
$http({
url: 'php/saveAttachDocumentExtra.php',
method: 'POST',
data: JSON.stringify(obj)
}).then(function (answer) {
obj.fxBase64 = $scope.file.base64data;
obj.doc.linha = answer.data;
$http({
url: 'sisleadsrest/cltdocs',
method: 'POST',
data: JSON.stringify(obj)
}).then(function (answer) {
$modalInstance.close('answer.data');
});
});
} else {
alert("Verifique as seleções!");
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to register Rejection
*/
angular.module('appRec').controller('modalInstanceRejeitar', function ($scope, $http, $modalInstance, items) {
$scope.m = {};
$scope.rejeitar = function () {
if (!$scope.r) {
alert("Tem de selecionar um motivo ou descrever!");
} else {
var param = {};
param.user = JSON.parse(sessionStorage.userData);
param.lead = items;
param.motivo = $scope.r;
$http({
url: 'php/recup/registarRejeicao.php',
method: 'POST',
data: JSON.stringify(param)
}).then(function (answer) {
console.log(answer);
});
window.location.replace("");
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to enviar email a pedir Documentos
*/
angular.module('appRec').controller('modalInstancePedirDoc2', function ($scope, $modalInstance, $http, items) {
$scope.lead = items;
$scope.d = {};
$scope.outroDoc = '';
//Obter lista de documentação
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_docnecessaria'
}).then(function (answer) {
$scope.docs = answer.data;
//Pedir a documentação selecionada
$scope.enviarPedidoDoc = function (d) {
if (d) {
$http({
url: "php/recup/sendEmailMissingDocsA.php",
method: 'POST',
data: JSON.stringify({'lead': $scope.lead, 'docFalta': d.docs, 'outroDoc': $scope.outroDoc, 'user': JSON.parse(sessionStorage.userData)})
}).then(function (answer) {
alert(answer.data);
$modalInstance.close('OK');
});
}
};
//Enviar o pedido da documentação em falta
$scope.enviarPedidoDocEmFalta = function (lead, d) {
if (d) {
$http({
url: "php/recup/sendEmailMissingDocsA_1.php",
method: 'POST',
data: JSON.stringify({'lead': lead, 'docFalta': d.docs, 'outroDoc': $scope.outroDoc, 'user': JSON.parse(sessionStorage.userData)})
}).then(function (answer) {
alert(answer.data);
$modalInstance.close('OK');
});
}
};
});
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to change doc name
*/
angular.module('appRec').controller('modalInstanceChangeDoc', function ($scope, $http, $modalInstance, items) {
$scope.d = {};
$scope.docOrig = items;
//obter tipos de documentos
$http({
url: "php/getData.php",
method: "POST",
data: 'cnf_docnecessaria'
}).then(function (answer) {
$scope.docs = answer.data;
});
$scope.saveChange = function (d) {
if (d.docs.length == 1) {
$http({
url: 'php/changeNameDoc.php',
method: 'POST',
data: JSON.stringify({'docOrig': $scope.docOrig, 'docNew': d.docs})
}).then(function (answer) {
$modalInstance.close();
});
} else {
alert("Só pode selecionar um!!");
}
};
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to view Comprovativo.
*/
angular.module('appRec').controller('modalInstanceViewComp1', function ($scope, $modalInstance, items, $sce) {
$scope.nomedoc = items.instituicao;
if (items.tipodoc === "jpg") {
$scope.imagePath = $sce.trustAsResourceUrl('data:image/jpg;base64,' + items.documento);
} else {
$scope.imagePath = $sce.trustAsResourceUrl('data:application/pdf;base64,' + items.documento);
}
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to view CONTRATO.
*/
angular.module('appRec').controller('modalInstanceViewContratoG', function ($scope, $rootScope, $modalInstance, items, $sce) {
$scope.nomedoc = items.nome;
$rootScope.prograssing = true;
$scope.imagePath = $sce.trustAsResourceUrl('data:application/pdf;base64,' + items.fx64);
$rootScope.prograssing = false;
//Obter o base64 para a lead e linha que está no doc
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance para fazer o agendamento
*/
angular.module('appRec').controller('modalInstanceAgendamentoRec', function ($scope, $http, $modalInstance, items) {
$scope.ag = {};
$scope.ag.lead = items;
$scope.ag.user = sessionStorage.userId;
$scope.saveAgendamento = function (ag) {
if (ag.data) {
var dia = ag.data.getDate();
var mes = ag.data.getMonth() + 1;
var ano = ag.data.getFullYear();
ag.data = (ano + '-' + mes + '-' + dia).toLocaleString();
} else {
ag.data = null;
}
$http({
url: 'php/recup/agendamentoNoDetalhe.php',
method: 'POST',
data: JSON.stringify(ag)
}).then(function (answer) {
console.log(answer.data);
$modalInstance.close('OK');
});
}
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to list historico de leads
*/
angular.module('appRec').controller('modalInstanceHistorico', function ($scope, $http, $modal, $modalInstance, items) {
$scope.lista = items.leads;
// console.log(items.lead);
$scope.openHistoricoLeadDetail = function (lead) {
var modalInstance = $modal.open({
templateUrl: 'modalHistoricoLeadsDetail.html',
controller: 'modalInstanceHistoricoLeadsDetail',
size: 'lg',
resolve: {items: function () {
return lead;
}
}
});
}
$scope.anularRepetida = function () {
$http({
url: 'php/gestor/anulaRepetida.php',
method: 'POST',
data: JSON.stringify({'lead': items.lead, 'user': sessionStorage.userId})
}).then(function (answer) {
window.location.replace("");
});
}
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
/**
* Modal instance to list open lead detail
*/
angular.module('appRec').controller('modalInstanceHistoricoLeadsDetail', function ($scope, $http, $modalInstance, items) {
$scope.lead = items;
$scope.readOnly = true;
if ($scope.lead) {
$http({
url: 'php/getData.php',
method: 'POST',
data: 'cnf_sitfamiliar'
}).then(function (answer) {
$scope.estadoscivis = answer.data;
});
$http({
url: 'php/getLeadAllInfo.php',
method: 'POST',
data: JSON.stringify({"lead": $scope.lead, "user": JSON.parse(sessionStorage.userData)})
}).then(function (answer) {
$scope.dl = answer.data.dlead;
$scope.ic = answer.data.infoCliente;
$scope.rendimentos = answer.data.rendimentos;
$scope.creditos = answer.data.creditos;
$scope.contactos = answer.data.contactos;
$scope.docs = answer.data.docs;
$scope.financiamentos = answer.data.financiamentos;
// $scope.rejeicoes = answer.data.rejeicoes;
$scope.rejeicoes = '';
(answer.data.rejeicoes).forEach(function (ln) {
$scope.rejeicoes += ln.data + ' --> ' + ln.motivo + '; ' + ln.obs + '; ' + ln.outro + '\n';
});
});
} else {
alert("Atenção! Verifique os dados e tente novamente.");
}
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
// Modal instance para Listar e selecionar simulações guardadas
angular.module('appRec').controller('modalInstanceGetSimulaDet', function ($scope, $http, $modalInstance, items) {
$scope.lead = items;
$scope.sim = {};
$http({
url: 'php/analista/getSimulacoes.php',
method: 'POST',
data: $scope.lead
}).then(function (answer) {
$scope.simulacoes = answer.data;
});
$scope.selectSimula = function (s) {
$modalInstance.close(s);
}
$scope.closeModal = function () {
$modalInstance.dismiss('Cancel');
};
});
|
import Landmark from "./abstract/Landmark";
import selector from "./../utils/selector";
import elements from "./../utils/elements";
import create from "./../utils/create";
class Form extends Landmark {
get elements() {
// get native elements
var selector = ["button", "fieldset", "input", "object", "output", "select", "textarea"].join(":not([role]),");
var res = Array.from(this.elements.querySelectorAll(selector));
var explicitRole = "";
explicitRole += selector.getDeepRole("button");
explicitRole += selector.getDeepRole("input");
explicitRole += selector.getDeepRole("status");
explicitRole += selector.getDeepRole("select");
Array.prototype.forEach(
this.elements.querySelectorAll(explicitRole),
node => res.push(elements.get(node) || create.one(node))
);
console.log(res, explicitRole, selector);
return res;
}
}
export default Form;
|
import React from 'react';
import { Credit } from '../credit';
import { PaginatedItems } from '../paginated-items';
const data = [
{
creditId: '5a88f80a9251410b4d05826b',
name: 'Joaquin Phoenix',
character: 'Arthur Fleck / Joker',
profileImgUrl:
'https://image.tmdb.org/t/p/w185/zixTWuMZ1D8EopgOhLVZ6Js2ux3.jpg'
},
{
creditId: '5b5242749251411f8600052d',
name: 'Robert De Niro',
character: 'Murray Franklin',
profileImgUrl:
'https://image.tmdb.org/t/p/w185/8Bgdfv1oN9Mw0YuMHP6fw8KzDkc.jpg'
},
{
creditId: '5b5122a00e0a262596006a4c',
name: 'Zazie Beetz',
character: 'Sophie Dumond',
profileImgUrl:
'https://image.tmdb.org/t/p/w185/sgxzT54GnvgeMnOZgpQQx9csAdd.jpg'
},
{
creditId: '5b5636fcc3a3685c8e026bac',
name: 'Frances Conroy',
character: 'Penny Fleck',
profileImgUrl:
'https://image.tmdb.org/t/p/w185/aJRQAkO24L6bH8qkkE5Iv1nA3gf.jpg'
},
{
creditId: '5b9fecf0c3a3680441002ee1',
name: 'Brett Cullen',
character: 'Thomas Wayne',
profileImgUrl:
'https://image.tmdb.org/t/p/w185/o94R8Z59lrwbZ0LcUkDSPu1GS7q.jpg'
}
];
const renderer = prop => (
<Credit
id={prop.creditId}
name={prop.name}
description={prop.character}
imageUrl={prop.profileImgUrl}
/>
);
export default {
title: 'PaginatedItems'
};
export const base = () => (
<PaginatedItems data={data} pageSize={3} renderer={renderer} />
);
|
// const mongoose = require('mongoose')
const baseModel = require('./base.js');
/**
* test(tests) Model
* 测试
*/
// let testSchma = new mongoose.Schema({
// username: String,
// password: String,
// age: Number,
// address: String
// })
// const testModel = mongoose.model('Test', testSchma)
// module.exports = testModel
// 继承baseModel方法
class testModel extends baseModel {
// 当前model名称
getName() {
return 'Test';
}
// 当前model内 类型处理
getSchema() {
return {
username: String,
password: String,
age: Number,
address: String
}
}
// 保存
save(data) {
let test = new this.model(data);
return test.save();
}
// 返回列表
list() {
return this.model
.find()
.select('_id username age address password') // 取指定的字段
// .exec(); //显示id name email role
}
// 通过username名称查找
findByUsername(name) {
return this.model.findOne({
username: name
});
}
// 通过 id 查找
findById(id) {
return this.model.findOne({
_id: id
});
}
// 删除
delete(id) {
return this.model.deleteOne({
_id: id
});
}
// 更新
update(id, data) {
return this.model.updateOne(
{
_id: id
},
data
);
}
// 判断名称是否唯一性
checkNameRepeat(name) {
return this.model.countDocuments({
username: name
});
}
}
module.exports = testModel;
|
$(".ico-menu").click(function(){
//$(".lista-menu")
//$(".modal-menu").show();
$(".modal-menu").fadeIn(500);
})
$(".close-modal").click(function(){
//$(".modal-menu").hide();
$(".modal-menu").fadeOut(1000);
})
|
angular.module('entraide').factory('ChainPromiseFactory', [function () {
// Example of use :
//var chain = $q.when();
//angular.forEach(roles, function(role, i) {
// var callbackSuccessCondition = i==roles.length;
// chain = chain.then(ChainPromiseFactory.chain(UserService.addRole, [user.id, role.id], successCallback, errorCallback, callbackSuccessCondition));
//});
return {
chain: function(method, params, callbackSuccess, callbackError, csc, cec) {
return function() {
return method.apply(this, params).then(function(params){
if(!(angular.isDefined(csc) && csc != null && csc == false)){
callbackSuccess(params);
}
}, function(err){
if(!(angular.isDefined(csc) && cec != null && cec == false)){
callbackError(err);
}
});
};
}
};
}]);
|
'use strict';
module.exports = pandora => {
pandora
.fork('sandbox-app', 'midway/server');
};
|
const bat = document.querySelector("button");
let number = 1;
let act = 1;
const ad = () => {
const kwadrat = document.createElement("div");
if (act == 4) {
number = 4;
act = 0;
kwadrat.classList.add("cir");
}
kwadrat.textContent = number;
document.body.appendChild(kwadrat);
// if (number % 4 == 0) {
// kwadrat.classList.add("cir")
// number = 0;
// }
number++
act++
}
bat.addEventListener("click", ad)
|
import change from '../src';
describe('circular state', () => {
test('circular state should not be cause exception', () => {
const circular = {};
circular.circular = circular;
let child = change(circular);
for (let i = 0; i < 43; i++) {
child = child.circular;
}
});
});
|
function arrayOddEvenCount(arr) {
let evenCount = 0;
let oddCount = 0;
let zeroCount = 0;
arr.forEach((element) => {
if (element === undefined || element === null) {
return;
}
if (element === 0) zeroCount += 1;
else if (element % 2 === 0) evenCount += 1;
else if (element % 2 === 1) oddCount += 1;
});
let arrayCounted = [evenCount, oddCount, zeroCount];
let outputResult = "четных: " + evenCount + "; нечетных: " + oddCount;
if (zeroCount > 0) {
outputResult += "; нулей: " + zeroCount;
}
console.log(outputResult);
return arrayCounted;
}
arrayOddEvenCount([1, 2, null, 0]);
module.exports = arrayOddEvenCount;
|
export const imagePickerOptions = {
quality: 0.5,
storageOptions: {
cameraRoll: false,
}
}
|
import React from 'react';
import {Button,Checkbox,Select,Radio,Switch,Form,Row,Col,Icon,Modal,Input,InputNumber,Cascader,Tooltip } from 'antd';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const OptGroup = Select.OptGroup;
const InputGroup = Input.Group;
import {FetchUtil} from '../../utils/fetchUtil';
import {trim} from '../../utils/validateUtil';
export default class EditDataListMeta extends React.Component{
constructor(props){
super(props);
this.state={
visible:false,
metaList:[],
initialList:[]
}
}
// 获取数据
fetchData=()=>{
FetchUtil('/datalistmeta/list/'+this.props.row.id,'GET','',
(data) => {
let initialData = data.data.list.map((item)=>{
return item.label
});
this.setState({
metaList:data.data.list,
initialList:initialData
})
});
}
handleChange=(index,e)=>{
var name = e.target.name;
var value = e.target.value;
var metaList=this.state.metaList;
metaList[index][name]=trim(value);
this.setState({
metaList:metaList
});
}
addField=()=>{
let metaList=this.state.metaList;
metaList.push({
dataListId:this.props.row.id,
fieldName:'',
label:'',
seqNum:1
});
this.setState({
metaList:metaList
})
}
deleteField=(index)=>{
let metaList=this.state.metaList;
metaList.splice(index,1);
this.setState({
metaList:metaList
})
}
showModal=()=>{
this.fetchData();
this.setState({
visible:true
})
}
handleSubmit=()=>{
let labelIsNull = this.state.metaList.some((item)=>{
if(!item.label){
return true;
}
});
let labelIsChange = this.state.metaList.some((item,index,array)=>{
if( (array.length > this.state.initialList.length) || (item.label !== this.state.initialList[index]) ){
return true;
}
});
let reg = /^[\u4e00-\u9fa5 \w]{2,10}$/;
let labelReg = this.state.metaList.every((item,index,array)=>{
if(reg.test(item.label)){
return true;
}
});
if(this.state.metaList.length==0){
Modal.error({
title: '提交失败',
content: '请添加至少一个字段'
});
return false;
}else if(labelIsNull){
Modal.error({
title: '提交失败',
content: '字段名不能为空!'
});
return false;
}else if(!labelReg){
Modal.error({
title: '提交失败',
content: '字段名含有特殊字符,或者字符长度不符合!'
});
return false;
}else if(labelIsChange){
FetchUtil('/datalistmeta/','PUT',JSON.stringify(this.state.metaList),
(data) => {
this.setState({
visible:false
});
});
}else {
this.setState({
visible:false
});
}
}
handleCancel=()=>{
this.setState({
visible:false
})
}
render(){
return (
<span>
<Tooltip title="管理黑/白名单字段" onClick={this.showModal}><a>管理字段</a></Tooltip>
<Modal title="编辑字段" visible={this.state.visible} onOk={this.handleSubmit} onCancel={this.handleCancel}>
<Row>
{this.state.initialList.length ?'':<Col span={6} offset={10}>
<span className="addRule" style={{display:"block",marginBottom:10}} onClick={this.addField}><Icon type="plus" /> 添加字段</span>
</Col>
}
{this.state.initialList.length ?<Col span={25} offset={2} style={{fontSize:14,marginBottom:10,color:'#f00'}}><span >现有字段不能删除,若需要删除字段,则建议直接删除列表!</span></Col>:<Col span={1} offset={1}>
<Tooltip placement="right" title={'现有字段不能删除,若需要删除字段,则建议直接删除列表!'}>
<Icon style={{fontSize:16,marginBottom:10}} type="question-circle-o" />
</Tooltip>
</Col>}
</Row>
<Form horizontal form={this.props.form}>
{this.state.metaList.map(function(info,i){
return (
<FormItem key={i+'meta'} label='字段名' labelCol={{span:10}}>
<Col span={4} offset={1}>
<Input name="label" value={info.label} placeholder={'字段名'} onChange={this.handleChange.bind(this,i)}/>
</Col>
<Col span={2} offset={1}>
<Tooltip placement="right" title={'字段名,一般为中文,如"手机号码",2-10位可由中文、英文字母、数字、下划线的组合'}>
<Icon style={{fontSize:16}} type="question-circle-o" />
</Tooltip>
</Col>
<Col span={1} offset={1}>
<i onClick={this.deleteField.bind(this,i)} className="fa fa-trash" style={{fontSize:16}}/>
</Col>
</FormItem>
);
}.bind(this))}
</Form>
</Modal>
</span>
);
}
}
|
'use strict';
exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.createTable('hourly_aggregations', function(table) {
table.increments();
table.datetime('start_time').notNullable();
table.tinyint('action').notNullable();
table.integer('total').unsigned().notNullable().defaultTo(0);
table.integer('successful').unsigned().notNullable().defaultTo(0);
table.integer('failed').unsigned().notNullable().defaultTo(0);
table.integer('ios').unsigned().notNullable().defaultTo(0);
table.integer('android').unsigned().notNullable().defaultTo(0);
table.unique(['action','start_time']);
})
]);
};
exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.dropTableIfExists('hourly_aggregations')
]);
};
|
module.exports = (server) => {
const pedidoController = require('../controller/pedido.controller')
server.post('/api/pedidos', pedidoController.create)
server.get('/api/pedidos', pedidoController.findAll)
server.get('/api/pedidos/:id', pedidoController.findById)
server.put('/api/pedidos/:id', pedidoController.update)
server.delete('/api/pedidos/:id', pedidoController.delete)
}
|
import {v4} from 'node-uuid';
/*
* action types
*/
export const ADD_NOTE = 'ADD_NOTE';
export const DELETE_NOTE = 'DELETE_NOTE';
/*
* action creators
*/
export function addNote(body) {
return {
type: ADD_TODO,
id: v4(),
body
};
}
export function deleteNote(id) {
return { type: DELETE_NOTE, id }
}
|
'use strict';
module.exports = {
up: queryInterface => queryInterface.renameColumn('users', 'firstName', 'name')
};
|
/**
* formValidate: Validates the form.
*
* Project: Assignment_6
* Author: Hongming Li
* Date Created: March 24, 2019
* Last Modified: March 24, 2019
*/
const itemDescription = ["MacBook", "The Razer", "WD My Passport", "Nexus 7", "DD-45 Drums"];
const itemPrice = [1899.99, 79.99, 179.99, 249.99, 119.99];
const itemImage = ["mac.png", "mouse.png", "wdehd.png", "nexus.png", "drums.png"];
let numberOfItemsInCart = 0;
let orderTotal = 0;
/*
* Handles the submit event of the survey form
*
* param e A reference to the event object
* return True if no validation errors; False if the form has
* validation errors
*/
function validate(e) {
if (formHasErrors()) {
// Prevents the form from submitting
e.preventDefault();
return false;
}
return true;
}
/*
* Handles the reset event for the form.
*
* param e A reference to the event object
* return True allows the reset to happen; False prevents
* the browser from resetting the form.
*/
function resetForm(e) {
// Confirm that the user wants to reset the form.
if ( confirm('Clear order?') ) {
// Ensure all error fields are hidden
hideErrors();
// Set focus to the first text field on the page
document.getElementById("qty1").focus();
// When using onReset="resetForm()" in markup, returning true will allow
// the form to reset
return true;
}
// Prevents the form from resetting
e.preventDefault();
// When using onReset="resetForm()" in markup, returning false would prevent
// the form from resetting
return false;
}
/*
* Does all the error checking for the form.
*
* return True if an error was found; False if no errors were found
*/
function formHasErrors() {
let hasError = false;
hideErrors();
// Validates the itmes in cart.
if (numberOfItemsInCart < 1) {
alert("You have no items in your cart.");
hasError = true;
}
// Validates required fields
let requiredFields = ["fullname", "address", "city", "province", "postal", "email", "cardname", "cardnumber"];
for (let i = 0; i < requiredFields.length; i++) {
let e = document.getElementById(requiredFields[i]);
if (e.type == "text") {
e.value = trim(e.value);
}
if (!e.value) {
hasError = true;
showError(requiredFields[i]);
}
}
// Validates Postal Code format
if (!getError("postal") && !isValidPostalCode()) {
hasError = true;
showError("postalformat");
}
// Validates Email format
if (!getError("email") && !isValidEmail()) {
hasError = true;
showError("emailformat");
}
// Validates card type
if (!hasCardType()) {
hasError = true;
showError("cardtype");
}
// Validates month
if (isNaN(document.getElementById("month").value)) {
showError("month");
}
// Validates card expiration
if (!getError("month") && isExpired()) {
hasError = true;
showError("expiry");
}
// Validates card number
if (!getError("cardnumber") && !isValidNumber()) {
hasError = true;
showError("invalidcard");
}
// Sets focus to first error
if (hasError) {
setFocusToFirstError();
}
return hasError;
}
/*
* Displays the error for an invalid form field.
*
* param errorId The id of the error element to display.
*/
function showError(errorId)
{
document.getElementById(errorId + "_error").style.display = "block";
}
/*
* Checks whether an error message is displayed.
*
* param errorId The id of the error element to be checked.
* return True if the error message is displayed. False if not.
*/
function getError(errorId)
{
return document.getElementById(errorId + "_error").style.display == "block";
}
/*
* Checks if the postal code is valid.
*
* return True if the postal code is valid. False if not.
*/
function isValidPostalCode() {
return /^[A-Za-z0-9]{3} ?[A-Za-z0-9]{3}$/.test(document.getElementById("postal").value);
}
/*
* Checks if the Email address is valid.
*
* return True if the Email address is valid. False if not.
*/
function isValidEmail() {
return /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/
.test(document.getElementById("email").value);
}
/*
* Checks if a card type is selected
*
* return True if a card type is selected. False if not.
*/
function hasCardType() {
let selected = false;
let inputs = document.getElementById("cardTypes").getElementsByTagName("input");
for (let i = 0; i < inputs.length; i++) {
if (inputs[i].type == "radio" && inputs[i].checked == true) {
selected = true;
break;
}
}
return selected;
}
/*
* Checks if the card is expired
*
* return True if the card is expired. False if not.
*/
function isExpired() {
let currentDate = new Date();
let currentYear = currentDate.getFullYear();
let currentMonth = currentDate.getMonth();
let cardYear = parseInt(document.getElementById("year").value);
let cardMonth = parseInt(document.getElementById("month").value);
return cardYear < currentYear || (cardYear == currentYear && cardMonth < currentMonth);
}
/*
* Checks if the card number is valid.
*
* return True if the card number is valid. False if not.
*/
function isValidNumber() {
let cardNumber = document.getElementById("cardnumber").value;
if (!/\d{10}/.test(cardNumber)) {
return false;
}
let factors = [4,3,2,7,6,5,4,3,2];
let sum = 0;
for (let i = 0; i < 9; i++) {
sum += parseInt(cardNumber.charAt(i)) * factors[i];
}
return (11 - (sum % 11)) == parseInt(cardNumber.charAt(9));
}
/*
* Set focus to the first error on the form.
*/
function setFocusToFirstError()
{
if (numberOfItemsInCart < 1) {
document.getElementsByClassName("qty")[0].focus();
} else {
var errors = document.getElementsByClassName("error");
for (let i = 0; i < errors.length; i++) {
if (errors[i].style.display == "block") {
let e = errors[i].parentNode.getElementsByTagName("input")[0];
// for select elements
if (!e) {
e = errors[i].parentNode.getElementsByTagName("select")[0];
}
e.focus();
if (e.type == "text" || e.type == "number") {
e.select();
}
break;
}
}
}
}
/*
* Adds an item to the cart and hides the quantity and add button for the product being ordered.
*
* param itemNumber The number used in the id of the quantity, item and remove button elements.
*/
function addItemToCart(itemNumber) {
// Get the value of the quantity field for the add button that was clicked
let quantityValue = trim(document.getElementById("qty" + itemNumber).value);
// Determine if the quantity value is valid
if ( !isNaN(quantityValue) && quantityValue != "" && quantityValue != null && quantityValue != 0 && !document.getElementById("cartItem" + itemNumber) ) {
// Hide the parent of the quantity field being evaluated
document.getElementById("qty" + itemNumber).parentNode.style.visibility = "hidden";
// Determine if there are no items in the car
if ( numberOfItemsInCart == 0 ) {
// Hide the no items in cart list item
document.getElementById("noItems").style.display = "none";
}
// Create the image for the cart item
let cartItemImage = document.createElement("img");
cartItemImage.src = "images/" + itemImage[itemNumber - 1];
cartItemImage.alt = itemDescription[itemNumber - 1];
// Create the span element containing the item description
let cartItemDescription = document.createElement("span");
cartItemDescription.innerHTML = itemDescription[itemNumber - 1];
// Create the span element containing the quanitity to order
let cartItemQuanity = document.createElement("span");
cartItemQuanity.innerHTML = quantityValue;
// Calculate the subtotal of the item ordered
let itemTotal = quantityValue * itemPrice[itemNumber - 1];
// Create the span element containing the subtotal of the item ordered
let cartItemTotal = document.createElement("span");
cartItemTotal.innerHTML = formatCurrency(itemTotal);
// Create the remove button for the cart item
let cartItemRemoveButton = document.createElement("button");
cartItemRemoveButton.setAttribute("id", "removeItem" + itemNumber);
cartItemRemoveButton.setAttribute("type", "button");
cartItemRemoveButton.innerHTML = "Remove";
cartItemRemoveButton.addEventListener("click",
// Annonymous function for the click event of a cart item remove button
function() {
// Removes the buttons grandparent (li) from the cart list
this.parentNode.parentNode.removeChild(this.parentNode);
// Deteremine the quantity field id for the item being removed from the cart by
// getting the number at the end of the remove button's id
let itemQuantityFieldId = "qty" + this.id.charAt(this.id.length - 1);
// Get a reference to quanitity field of the item being removed form the cart
let itemQuantityField = document.getElementById(itemQuantityFieldId);
// Set the visibility of the quantity field's parent (div) to visible
itemQuantityField.parentNode.style.visibility = "visible";
// Initialize the quantity field value
itemQuantityField.value = "";
// Decrement the number of items in the cart
numberOfItemsInCart--;
// Decrement the order total
orderTotal -= itemTotal;
// Update the total purchase in the cart
document.getElementById("cartTotal").innerHTML = formatCurrency(orderTotal);
// Determine if there are no items in the car
if ( numberOfItemsInCart == 0 ) {
// Show the no items in cart list item
document.getElementById("noItems").style.display = "block";
}
},
false
);
// Create a div used to clear the floats
let cartClearDiv = document.createElement("div");
cartClearDiv.setAttribute("class", "clear");
// Create the paragraph which contains the cart item summary elements
let cartItemParagraph = document.createElement("p");
cartItemParagraph.appendChild(cartItemImage);
cartItemParagraph.appendChild(cartItemDescription);
cartItemParagraph.appendChild(document.createElement("br"));
cartItemParagraph.appendChild(document.createTextNode("Quantity: "));
cartItemParagraph.appendChild(cartItemQuanity);
cartItemParagraph.appendChild(document.createElement("br"));
cartItemParagraph.appendChild(document.createTextNode("Total: "));
cartItemParagraph.appendChild(cartItemTotal);
// Create the cart list item and add the elements within it
let cartItem = document.createElement("li");
cartItem.setAttribute("id", "cartItem" + itemNumber);
cartItem.appendChild(cartItemParagraph);
cartItem.appendChild(cartItemRemoveButton);
cartItem.appendChild(cartClearDiv);
// Add the cart list item to the top of the list
let cart = document.getElementById("cart");
cart.insertBefore(cartItem, cart.childNodes[0]);
// Increment the number of items in the cart
numberOfItemsInCart++;
// Increment the total purchase amount
orderTotal += itemTotal;
// Update the total puchase amount in the cart
document.getElementById("cartTotal").innerHTML = formatCurrency(orderTotal);
}
}
/*
* Hides all of the error elements.
*/
function hideErrors() {
var errors = document.getElementsByClassName("error");
for (let i = 0; i < errors.length; i++) {
errors[i].style.display = "none";
}
}
/*
* Handles the load event of the document.
*/
function load() {
// Populate the year select with up to date values
let year = document.getElementById("year");
let currentDate = new Date();
for(let i = 0; i < 7; i++) {
let newYearOption = document.createElement("option");
newYearOption.value = currentDate.getFullYear() + i;
newYearOption.innerHTML = currentDate.getFullYear() + i;
year.appendChild(newYearOption);
}
document.getElementById("orderform").addEventListener("submit", validate);
document.getElementById("orderform").addEventListener("reset", resetForm);
let buttons = document.getElementById("products").getElementsByTagName("button");
for (let i = 0; i < buttons.length; i++) {
let itemNumber = i + 1;
buttons[i].addEventListener("click", function(){
addItemToCart(itemNumber);
});
}
hideErrors();
}
// Add document load event listener
document.addEventListener("DOMContentLoaded", load);
|
import firebase from "firebase";
const firebaseConfig = {
apiKey: "AIzaSyCaHWNGrY_Gebw4mjeYlKB-yN7n-xQuLZE",
authDomain: "unsplash-159af.firebaseapp.com",
projectId: "unsplash-159af",
storageBucket: "unsplash-159af.appspot.com",
messagingSenderId: "789003634943",
appId: "1:789003634943:web:b0e382058781e0b4bea4ca",
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
const db = firebase.firestore();
export default db;
|
import React, { Component } from "react";
import { isOverdue } from "../../util/date";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { connect } from "react-redux";
const PropRow = ({ name, label, value }) => {
return (
<p className={`prop ${name}`}>
<span className="prop-name">{label}</span>
<span className="prop-value">{value}</span>
</p>
);
};
class FixedDashboard extends Component {
state = {
open: false
};
handleToggleShow = () => {
this.setState({ open: !this.state.open });
};
render() {
const todos = this.props.todos;
let numOfOverdueTodos = 0;
let numOfTodosDone = 0;
todos.forEach(todo => {
if (todo.done) {
++numOfTodosDone;
} else if (todo.due && isOverdue(todo.due)) {
++numOfOverdueTodos;
}
});
const numOfTodos = todos.length;
return (
<div
className={`fixed-dashboard ${this.state.open ? "open" : "closed"}`}
onClick={this.handleToggleShow}
>
<FontAwesomeIcon
className="toggle-btn clickable"
icon="arrow-circle-right"
/>
<div className="fixed-dashboard-content">
<div className="props">
<PropRow name="total" label="총 할 일" value={numOfTodos} />
<PropRow name="done" label="완료 한 일" value={numOfTodosDone} />
<PropRow
name="overdue"
label="기한 지난 일"
value={numOfOverdueTodos}
/>
</div>
<button
className="fixed-dashboard-content-btn"
onClick={e => {
this.props.onDeleteDone(todos);
e.stopPropagation();
}}
>
완료된 작업 삭제
</button>
</div>
</div>
);
}
}
const mapDispatchToProps = dispatch => {
return {
onDeleteDone: originalTodos => dispatch(deleteDone(originalTodos))
};
};
export default connect(
() => ({}),
mapDispatchToProps
)(FixedDashboard);
|
//=== MENU ===//
const menuTrigger = document.querySelector('.menu-trigger');
const theHeader = document.querySelector('.the-header');
const mainMenu = document.querySelector('.main-menu');
const body = document.querySelector('body');
let menuOpen = false;
menuTrigger.addEventListener('click', () => {
if(!menuOpen) {
menuTrigger.classList.add('open');
theHeader.classList.add('open');
mainMenu.classList.add('open');
menuOpen = true;
body.style.paddingTop = "72px";
} else{
menuTrigger.classList.remove('open');
theHeader.classList.remove('open');
mainMenu.classList.remove('open');
menuOpen = false;
body.style.paddingTop = "0";
}
});
//=== /MENU ===//
//=== SCROLL BUTTON ===//
const scrollToTopBtn = document.querySelector('#backToTopBtn');
function scrollToTop(){
body.scrollTo({
top: 0,
behavior: "smooth"
});
}
scrollToTopBtn.addEventListner('click', scrollToTop);
//=== /SCROLL BUTTON ===//
|
angular.module('app')
.constant('ROOM_CATEGORY_ENDPOINT', '/admin/hotels/rooms/categories/:id')
.constant('ROOM_CATEGORY_NAMES_ENDPOINT', '/admin/hotels/rooms/categories/names')
.factory('RoomCategory', function($resource, ROOM_CATEGORY_ENDPOINT) {
return $resource(ROOM_CATEGORY_ENDPOINT, { id: '@_id' }, {
update: {
method: 'PUT'
}
});
})
.service('RoomCategoryService', function($resource, RoomCategory, ROOM_CATEGORY_NAMES_ENDPOINT) {
this.getAll = params => RoomCategory.query(params);
this.get = index => RoomCategory.get({id: index});
this.save = RoomCategory => RoomCategory.$save();
this.update = RoomCategory => RoomCategory.$update({id: RoomCategory.id})
this.getAllNames = () => $resource(ROOM_CATEGORY_NAMES_ENDPOINT).query();
this.deleteRoomCategory = roomCategory => roomCategory.$delete({id: roomCategory.id});
});
|
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import BookShelf from './BookShelf'
/**
* Component that represents the main page (books for each shelf)
*/
class MainPage extends Component {
shelves = [
{ "key": "currentlyReading", "name": "Currently reading" },
{ "key": "wantToRead", "name": "Want to read" },
{ "key": "read", "name": "Read" }
]
render = () => {
const { books, shelfState, onBookShelfSwitch } = this.props;
let booksByShelf = this.getBooksByShelves(books, shelfState);
return (
<div className="list-books">
<div className="list-books-title">
<h1>MyReads</h1>
</div>
<div className="list-books-content">
<div>
{this.props.loading && (<p>Loading...</p>)}
{!this.props.loading && this.shelves.map((shelf) => {
let shelfBooks = booksByShelf[shelf.key] || []
return (
<BookShelf
key={shelf.key}
name={shelf.name}
books={shelfBooks}
onBookShelfSwitch={onBookShelfSwitch} />)
}
)}
</div>
</div>
<div className="open-search">
<Link to="/search">
<button>Add a book</button>
</Link>
</div>
</div>
)
}
getBooksByShelves(books, shelfState) {
let booksByShelf = {}
books.forEach(book => {
let shelfKey = shelfState[`${book.id}-shelf`]
let shelfBooks = booksByShelf[shelfKey] || [];
shelfBooks.push(...[book]);
booksByShelf[shelfKey] = shelfBooks;
})
return booksByShelf;
}
}
export default MainPage;
|
var num1 = parseFloat(prompt("enter first number :"));
var num2 = parseFloat(prompt("enter second number ;"));
var number = Math.max(num1, num2);
document.write(number);
|
var JsonLdParser = require('rdf-parser-jsonld');
rdf.parsers['application/ld+json'] = JsonLdParser;
if (typeof window !== 'undefined') {
window.JsonLdParser = JsonLdParser;
}
|
const router = require('express').Router()
const multer = require("multer")
const controller = require('../../controllers/api/blog')
const upload = require('../../functions/upload').upload
const resize = require("../../functions/resize")
const path = require("path")
const fs = require("fs")
const { check } = require('express-validator')
const commonFunction = require("../../functions/commonFunctions")
const constant = require("../../functions/constant")
const blogModel = require("../../models/blogs")
const privacyMiddleware = require("../../middleware/has-permission")
const middlewareEnable = require("../../middleware/enable")
const isLogin = require("../../middleware/is-login")
router.use('/blogs/upload-image',isLogin, (req, res, next) => {
middlewareEnable.isEnable(req, res, next, "blog",'edit')
}, async (req, res, next) => {
await commonFunction.getGeneralInfo(req, res, '', true)
req.allowedFileTypes = /jpeg|jpg|png|gif/
var currUpload = upload('file', "upload/images/blogs/editors/", req)
req.imageResize = [
{ width: req.widthResize, height: req.heightResize }
];
currUpload(req, res, function (err) {
if (err) {
req.imageError = "Uploaded image is too large to upload, please choose smaller image and try again.";
next()
} else {
req.fileName = req.file ? req.file.filename : false;
if (req.file && req.appSettings.upload_system != "s3" && req.appSettings.upload_system != "wisabi") {
const extension = path.extname(req.fileName);
const file = path.basename(req.fileName, extension);
const pathName = req.serverDirectoryPath + "/public/upload/images/blogs/editors/"
const newFileName = file + "_main" + extension;
var resizeObj = new resize(pathName, req.fileName, req)
resizeObj.save(pathName+newFileName,{ width: req.widthResize, height: req.heightResize }).then(res => {
if(res){
fs.unlink(pathName + req.fileName, function (err) {
if (err) {
console.error(err);
}
});
req.fileName = newFileName;
next()
}else{
req.imageError = "Your image contains an unknown image file encoding. The file encoding type is not recognized, please use a different image.";
next()
}
})
}else if(req.originalS3ImageName && (req.appSettings.upload_system == "s3" || req.appSettings.upload_system == "wisabi")){
req.fileName = req.originalS3ImageName
next()
} else {
next()
}
}
});
}, controller.upload)
router.post('/blogs/delete',isLogin,(req,res,next) => {
middlewareEnable.isEnable(req,res,next,"blog",'delete')
}, multer().none(), async (req, res, next) => {
const id = req.body.id
await blogModel.findByCustomUrl(id, req, res).then(result => {
if (result) {
req.item = result
}
})
privacyMiddleware.isValid(req, res, next, 'blog', 'delete')
}, controller.delete)
router.post('/blog-category/:id', (req, res, next) => {
middlewareEnable.isEnable(req, res, next, "blog",'view')
}, multer().none(), controller.category)
router.post('/blogs-browse', (req, res, next) => {
middlewareEnable.isEnable(req, res, next, "blog",'view')
}, multer().none(), controller.browse)
router.post('/blogs/create',isLogin, (req, res, next) => {
middlewareEnable.isEnable(req, res, next, "blog",'create')
}, async (req, res, next) => {
await commonFunction.getGeneralInfo(req, res, '', true)
if (req.levelPermissions["blog.quota"] > 0) {
//get count of user uploaded video
await blogModel.userBlogUploadCount(req, res).then(result => {
if (result) {
if (result.totalBlogs >= req.levelPermissions["blog.quota"]) {
req.quotaLimitError = true
}
}
}).catch(error => {
return res.send({ error: fieldErrors.errors([{ msg: constant.general.GENERAL }], true), status: errorCodes.serverError }).end();
})
}
if (req.quotaLimitError) {
next()
return
}
req.allowedFileTypes = /jpeg|jpg|png|gif/
var currUpload = upload('image', "upload/images/blogs/", req)
req.imageResize = [
{ width: 1200, height: req.heightResize }
];
currUpload(req, res, function (err) {
if (err) {
req.imageError = "Uploaded image is too large to upload, please choose smaller image and try again.";
next()
} else {
req.fileName = req.file ? req.file.filename : false;
if (req.file && req.appSettings.upload_system != "s3" && req.appSettings.upload_system != "wisabi") {
const extension = path.extname(req.fileName);
const file = path.basename(req.fileName, extension);
const pathName = req.serverDirectoryPath + "/public/upload/images/blogs/"
const newFileName = file + "_main" + extension;
var resizeObj = new resize(pathName, req.fileName, req)
resizeObj.save(pathName+newFileName,{ width: 1200, height: req.heightResize }).then(res => {
if(res){
fs.unlink(pathName + req.fileName, function (err) {
if (err) {
console.error(err);
}
});
req.fileName = newFileName;
next()
}else{
req.imageError = "Your image contains an unknown image file encoding. The file encoding type is not recognized, please use a different image.";
next()
}
})
}else if(req.originalS3ImageName && (req.appSettings.upload_system == "s3" || req.appSettings.upload_system == "wisabi")){
req.fileName = req.originalS3ImageName
next()
} else {
next()
}
}
});
},
[
check("title").not().isEmpty().withMessage(constant.error.TITLEMESSAGE).trim(),
check("description").not().isEmpty().withMessage(constant.error.DESCRIPTIONMESSAGE).trim(),
], controller.create)
module.exports = router;
|
function get(el) {
if(typeof el === "string")
return document.getElementById(el);
return el;
}
var rand = function(max, min, _int) {
var max = (max === 0 || max)?max:1,
min = min || 0,
gen = min + (max - min)*Math.random();
return (_int)?Math.round(gen):gen;
};
function setStyleCss3(object, key, value) {
var keyName = key.substr(0,1).toUpperCase() + key.substr(1);
object.style['webkit' + keyName] = value;
object.style['moz' + keyName] = value;
object.style['ms' + keyName] = value;
object.style[key] = value;
}
function getFont(family) {
family = (family || "").replace(/[^A-Za-z]/g, '').toLowerCase();
var sans = 'Helvetica, Arial, "Microsoft YaHei New", "Microsoft Yahei", "微软雅黑", 宋体, SimSun, STXihei, "华文细黑", sans-serif';
var serif = 'Georgia, "Times New Roman", "FangSong", "仿宋", STFangSong, "华文仿宋", serif';
var fonts = {
helvetica : sans,
verdana : "Verdana, Geneva," + sans,
lucida : "Lucida Sans Unicode, Lucida Grande," + sans,
tahoma : "Tahoma, Geneva," + sans,
trebuchet : "Trebuchet MS," + sans,
impact : "Impact, Charcoal, Arial Black," + sans,
comicsans : "Comic Sans MS, Comic Sans, cursive," + sans,
georgia : serif,
palatino : "Palatino Linotype, Book Antiqua, Palatino," + serif,
times : "Times New Roman, Times," + serif,
courier : "Courier New, Courier, monospace, Times," + serif
}
var font = fonts[family] || fonts.helvetica;
return font;
}
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
*/
function rgbToHsl(r, g, b){
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min){
h = s = 0; // achromatic
}else{
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max){
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, l];
}
/**
* Converts an HSL color value to RGB. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes h, s, and l are contained in the set [0, 1] and
* returns r, g, and b in the set [0, 255].
*
* @param Number h The hue
* @param Number s The saturation
* @param Number l The lightness
* @return Array The RGB representation
*/
function hslToRgb(h, s, l){
var r, g, b;
if(s == 0){
r = g = b = l; // achromatic
}else{
function hue2rgb(p, q, t){
if(t < 0) t += 1;
if(t > 1) t -= 1;
if(t < 1/6) return p + (q - p) * 6 * t;
if(t < 1/2) return q;
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
}
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return [r * 255, g * 255, b * 255];
}
/*============================================*/
var Dropdown = (function(){
var container = get('widgetContainer');
var listOptions = get('listOptions');
var buttonSelect = get('buttonSelect');
var buttonLink = get('buttonLink');
var containerWidth, containerHeight;
var isRunning = false;
var isStop = false;
/*--- settings from banner flow ---*/
var font;
var fontSize;
var dropdownColor, dropdownTextColor;
var buttonColor, buttonTextColor;
var layout;
var languageTexts;
var LAYOUT_ONE_LINE = "One Line";
var LAYOUT_TWO_LINE = "Two Line";
var caretText = "<span class='caret'></span>";
var styleClass = "style-inline";
var idTemptDiv = "divTempt";
var idTempSpan = "spanTempt";
var paddingWidth = 24;
var spaceCaret = 5 + 8;
function startWidget(currentSesssion){
if(!containerWidth || !containerHeight)
return;
listOptions.style.opacity = "0";
listOptions.style.height = "auto";
listOptions.style.display = "block";
listOptions.getBoundingClientRect(); // force to apply new style to listOptions
buildHtml();
buildCSS();
registerEvent();
buttonSelect.getBoundingClientRect(); // force to apply new style to buttonSelect
var hButton = parseInt(window.getComputedStyle(buttonSelect).getPropertyValue('height'));
var hOptions = parseInt(window.getComputedStyle(listOptions).getPropertyValue('height'));
var hSpace = 2;
if(hButton + hOptions + hSpace > containerHeight) {
listOptions.style.height = containerHeight - hButton - hSpace + 'px' ;
}
listOptions.style.display = "none";
listOptions.style.opacity = "1";
}
function calculateHoverColor(rgbColor) {
rgbColor = rgbColor.substr("rgba(".length, rgbColor.length - 1 - "rgba(".length).split(",");
var hslColor = rgbToHsl(parseInt(rgbColor[0]), parseInt(rgbColor[1]), parseInt(rgbColor[2]));
var l = hslColor[2];
l = l- 0.05;
if(l <= 0)
l += 0.05;
hslColor[2] = l;
var newRgbColor = hslToRgb(hslColor[0], hslColor[1], hslColor[2]);
return "rgba(" + (newRgbColor[0] | 0) + "," + (newRgbColor[1] | 0) + "," + (newRgbColor[2] | 0) + "," + rgbColor[3] + ")"
}
function buildCSS() {
var styleOlds = document.querySelectorAll('.'+styleClass);
if(styleOlds && styleOlds.length > 0) {
for(var i = 0; i < styleOlds.length; i++) {
document.head.removeChild(styleOlds[i]);
}
}
var borderColorSelect = calculateHoverColor(dropdownColor);
var borderColorLink = calculateHoverColor(buttonColor);
var styleNew = document.createElement('style');
styleNew.setAttribute('class', styleClass);
styleNew.setAttribute('type', 'text/css');
styleNew.innerHTML = ".widget-container {\n" +
"font-family: " + font + ";\n" +
"opacity: 1;\n" +
"}\n" +
".dropdown {\n" +
"display:" + (layout.toLowerCase() == LAYOUT_ONE_LINE.toLowerCase() ? "inline-block;" : "block;") +
"}\n" +
".btn, .dropdown-menu {\n" +
"font-family: " + font + ";\n" +
"font-size:" + fontSize + "px;\n" +
"}\n" +
".btn-select {\n" +
"color: " + dropdownTextColor + ";\n" +
"background-color:" + dropdownColor + ";\n" +
"border-color:" + borderColorSelect + ";\n" +
"}\n" +
".btn-select:hover, .btn-select:active {\n" +
"color: " + dropdownTextColor + ";\n" +
"background-color:" + borderColorSelect + ";\n" +
"border-color: transparent;\n" +
"}\n" +
".btn-link {\n" +
"color: " + buttonTextColor + ";\n" +
"background-color:" + buttonColor + ";\n" +
"border-color:" + borderColorLink + ";\n" +
"}\n" +
".btn-link:hover, .btn-link:active {\n" +
"color: " + buttonTextColor + ";\n" +
"background-color:" + borderColorLink + ";\n" +
"border-color: transparent;\n" +
"}\n";
document.head.appendChild(styleNew);
}
function buildHtml() {
if(!languageTexts || languageTexts.length == 0)
return;
listOptions.innerHTML = "";
// Create temp div to calculate the biggest text in options
var divTempt = document.createElement('div');
divTempt.setAttribute('id', idTemptDiv);
divTempt.style.display = "block";
divTempt.style.visibility = "hidden";
var spanTempt = document.createElement('span');
spanTempt.setAttribute('id', idTemptDiv);
spanTempt.style.fontFamily = font;
spanTempt.style.fontSize = fontSize + "px";
spanTempt.style.display = "inline-block";
divTempt.appendChild(spanTempt);
document.body.appendChild(divTempt);
// template: list of options and the last one is the text for the button
var option;
var firstOption = true;
var maxWidth = 0;
for(var i=0; i<languageTexts.length; i++) {
option = [];
var indexSplit = languageTexts[i].indexOf(':');
if(indexSplit >= 0) {
option.push(languageTexts[i].substr(0, indexSplit));
if(indexSplit + 1 < languageTexts[i].length - 1) {
option.push(languageTexts[i].substr(indexSplit+1));
}
} else {
option.push(languageTexts[i]);
}
// Set the default selected option
if(firstOption && option && option.length > 0) {
firstOption = false;
buttonSelect.innerHTML = option[0] + caretText;
if(option.length >= 2)
buttonLink.setAttribute('href', option[1]);
spanTempt.innerHTML = option[0];
spanTempt.getBoundingClientRect();
var textWidth = parseInt(window.getComputedStyle(spanTempt).getPropertyValue('width'));
if(textWidth > maxWidth)
maxWidth = textWidth;
}
// Create options
if(option && option.length >= 2) {
var li = document.createElement('li');
var a = document.createElement('a');
a.innerHTML = option[0];
a.setAttribute('href', option[1]);
li.appendChild(a);
listOptions.appendChild(li);
spanTempt.innerHTML = option[0];
spanTempt.getBoundingClientRect();
var textWidth = parseInt(window.getComputedStyle(spanTempt).getPropertyValue('width'));
if(textWidth > maxWidth)
maxWidth = textWidth;
}
buttonSelect.style.width = maxWidth + paddingWidth + spaceCaret + 'px';
// Set text for the button link
if(i == languageTexts.length - 1) {
if(option && option.length == 1)
buttonLink.innerHTML = option[0];
else
buttonLink.innerHTML = "Enter text";
}
}
// Remove temp div
document.body.removeChild(divTempt);
}
var isRegisterEvent = false;
function registerEvent() {
var allOptions = listOptions.getElementsByTagName('a');
for(var i=0; i<allOptions.length; i++) {
allOptions[i].onclick = function(event) {
var text = event.target.innerHTML;
var link = event.target.getAttribute('href');
buttonSelect.innerHTML = text + caretText;
buttonLink.setAttribute('href', link);
return false;
}
}
if(isRegisterEvent)
return;
isRegisterEvent = true;
document.onclick = function(){
listOptions.style.display = "none";
}
buttonSelect.onclick = function(event){
event.stopPropagation();
listOptions.style.display = "block";
}
listOptions.onchange = function(event) {
buttonLink.setAttribute('href', event.target.value);
}
buttonLink.onclick = function(event) {
var href = event.target.getAttribute('href');
if(!href || href.length == 0)
return false;
return true;
}
}
/*==============================================*/
/*===== Start point of animation =====*/
/*==============================================*/
function reloadGlobalVariables() {
containerWidth = parseInt(window.getComputedStyle(container).getPropertyValue('width'));
containerHeight = parseInt(window.getComputedStyle(container).getPropertyValue('height'));
}
function stopCurrentAnimation(callback) {
isStop = true;
if(isRunning) {
var timeout = setTimeout(function(){
clearTimeout(timeout);
stopCurrentAnimation(callback);
}, 200);
} else {
isStop = false;
if(callback)
callback();
}
}
function startAnimation(currentSesssion) {
stopCurrentAnimation(function(){
startWidget(currentSesssion);
});
}
/*==============================================*/
/*===== Default settings from Banner Flow =====*/
/*==============================================*/
var removeTags = ["s","u","i","b"];
function preProcessLanguageText(text) {
text = text || "";
var patt;
for(var i=0; i<removeTags.length; i++) {
patt = new RegExp("</?" + removeTags[i] + ">", "g");
text = text.replace(patt, "");
}
var lineTexts = new Array();
var m;
patt = new RegExp("<div>([^<]*)</div>", "g");
lineTexts = new Array();
while(m = patt.exec(text)) {
lineTexts.push(m[1]);
}
if(lineTexts.length == 0)
lineTexts.push(text);
return lineTexts;
}
function loadSettings(isLoadText) {
if(typeof BannerFlow !== "undefined") {
font = BannerFlow.settings.font;
fontSize = BannerFlow.settings.fontSize;
if(fontSize <= 0)
fontSize = 14;
dropdownColor = BannerFlow.settings.dropdownColor;
dropdownTextColor = BannerFlow.settings.dropdownTextColor;
buttonColor = BannerFlow.settings.buttonColor;
buttonTextColor = BannerFlow.settings.buttonTextColor;
layout = BannerFlow.settings.layout;
} else {
font = "Arial";
fontSize = 14;
dropdownColor = "rgba(0,255,255,1)";
dropdownTextColor = "rgba(255,0,0,1)";
buttonColor = "rgba(255,0,0,1)";
buttonTextColor = "rgba(0,255,255,1)";
layout = LAYOUT_TWO_LINE;
}
font = getFont(font);
if(isLoadText)
languageTexts = preProcessLanguageText(languageTexts);
}
/*====================================================*/
var timeoutStart;
var sessionId = 0;
function init(isLoadText) {
if(timeoutStart) {
clearTimeout(timeoutStart);
timeoutStart = setTimeout(function() {
loadSettings(isLoadText);
reloadGlobalVariables();
startAnimation(++sessionId);
}, 500);
} else {
timeoutStart = setTimeout(function(){
loadSettings(isLoadText);
reloadGlobalVariables();
startAnimation(++sessionId);
}, 0);
}
}
function getLanguageText() {
if(typeof BannerFlow !== "undefined"){
languageTexts = BannerFlow.text;
} else { // for testing
languageTexts = "";
languageTexts += "<div>Google:https://www.google.com</div>";
languageTexts += "<div>Facebook:https://www.facebook.com</div>";
languageTexts += "<div>Microsoft:https://www.microsoft.com</div>";
languageTexts += "<div>Thegioididong.com:https://www.thegioididong.com</div>";
languageTexts += "<div>SEE</div>";
}
}
var isStartAnimation = false;
function onStarted() {
if(typeof BannerFlow != "undefined" && !BannerFlow.editorMode && isStartAnimation) {
return;
}
isStartAnimation = true;
getLanguageText();
init(true);
}
function onResized(){
if(typeof BannerFlow != "undefined" && !BannerFlow.editorMode) {
return;
}
init();
}
function onSettingChanged(){
if(typeof BannerFlow != "undefined" && !BannerFlow.editorMode) {
return;
}
init();
}
return {
start: onStarted,
onResized: onResized,
onSettingChanged: onSettingChanged
};
})();
if(typeof BannerFlow == "undefined"){
Dropdown.start();
} else {
BannerFlow.addEventListener(BannerFlow.RESIZE, function () {
Dropdown.onResized();
});
BannerFlow.addEventListener(BannerFlow.SETTINGS_CHANGED, function () {
Dropdown.onSettingChanged();
});
BannerFlow.addEventListener(BannerFlow.TEXT_CHANGED, function () {
Dropdown.start();
});
BannerFlow.addEventListener(BannerFlow.START_ANIMATION, function() {
Dropdown.start();
});
}
|
import React from 'react';
import {
cleanup,
fireEvent,
render,
screen,
waitFor
} from '@testing-library/react';
import { getArticles } from '../services/getArticles';
import NewsSearch from './NewsSearch';
jest.mock('../services/getArticles');
describe('NewsSearch container', () => {
it('should a search bar with a button to search', () => {
render(<NewsSearch />);
screen.getByText('Click me');
});
it('should display a list of articles', async() => {
getArticles.mockResolvedValue([
{
source: 'article source',
title: 'test title3',
author: 'fake af author',
content: 'some true stuff',
imageUrl: 'https://fakeplaceholder.image.url.you/couldnt',
url: 'google.com',
},
{
source: 'article source',
title: 'test title2',
author: 'fake af author',
content: 'some true stuff',
imageUrl: 'https://fakeplaceholder.image.url.you/couldnt',
url: 'google.com',
},
{
source: 'article source',
title: 'test title1',
author: 'fake af author',
content: 'some true stuff',
imageUrl: 'https://fakeplaceholder.image.url.you/couldnt',
url: 'google.com',
}
]);
render(<NewsSearch />);
fireEvent.click(screen.getByText('Click me'));
setTimeout(() => {
const articleList = screen.getAllByTestId('article');
return expect(articleList).not.toBeEmptyDOMElement();
}, 3000);
});
});
|
const { admin } = require("../../../utils/firebase");
module.exports = (req, res, next) => {
if (!req.headers.authorization)
return res.status(403).json({
error: "must include an id token in the authorization header",
step: "validateIdToken"
});
if (!req.headers.authorization.startsWith("Bearer "))
return res.status(403).json({
error: "authorization must include a Bearer token",
step: "validateIdToken"
});
const [, idToken] = req.headers.authorization.split("Bearer ");
admin
.auth()
.verifyIdToken(idToken)
.then(decodedIdToken => {
const isRegister = req.url === '/register';
const isPassword = decodedIdToken.sign_in_provider === 'password';
req.canDeleteFirebaseAccount = isRegister && isPassword;
req.decodedIdToken = decodedIdToken;
next();
})
.catch(error => {
res.status(403).json({ error: error.code, step: "validateIdToken" });
});
};
|
const ComponentCollector = require('./structures/ComponentCollector');
const Halt = require('./structures/Halt');
const ReactionCollector = require('./structures/ReactionCollector');
/**
* Handles async message functions
*/
class MessageAwaiter {
constructor(client) {
this.client = client;
this.halts = new Map();
this.reactionCollectors = new Map();
this.componentCollectors = new Map();
}
/**
* Creates a halt. This pauses any events in the event handler for a specific channel and user.
* This allows any async functions to handle any follow-up messages.
* @param {string} channelID The channel's ID
* @param {string} userID The user's ID
* @param {number} [timeout=30000] The time until the halt is auto-cleared
*/
createHalt(channelID, userID, timeout = 60000) {
const id = `${channelID}:${userID}`;
if (this.halts.has(id)) this.halts.get(id).end();
const halt = new Halt(this, timeout);
halt.once('end', () => this.halts.delete(id));
this.halts.set(id, halt);
return halt;
}
/**
* Creates a reaction collector. Any reactions from the user will be emitted from the collector.
* @param {string} message The message to collect from
* @param {string} userID The user's ID
* @param {number} [timeout=30000] The time until the halt is auto-cleared
*/
createReactionCollector(message, userID, timeout = 60000) {
const id = `${message.id}:${userID}`;
if (this.reactionCollectors.has(id)) this.reactionCollectors.get(id).end();
const collector = new ReactionCollector(this, timeout);
collector.once('end', () => this.reactionCollectors.delete(id));
this.reactionCollectors.set(id, collector);
return collector;
}
/**
* Creates a component collector. Any component interactions from the user will be emitted from the collector.
* @param {string} message The message to collect from
* @param {string} userID The user's ID
* @param {number} [timeout=30000] The time until the halt is auto-cleared
*/
createComponentCollector(message, userID, timeout = 60000) {
const id = `${message.id}:${userID}`;
if (this.componentCollectors.has(id)) this.componentCollectors.get(id).end();
const collector = new ComponentCollector(this, timeout);
collector.once('end', () => this.componentCollectors.delete(id));
this.componentCollectors.set(id, collector);
return collector;
}
/**
* Gets an ongoing halt based on a message
* @param {Message} message
*/
getHalt(message) {
const id = `${message.channel.id}:${message.author.id}`;
return this.halts.get(id);
}
/**
* Processes a halt based on a message
* @param {Message} message
*/
processHalt(message) {
const id = `${message.channel.id}:${message.author.id}`;
if (this.halts.has(id)) {
const halt = this.halts.get(id);
halt._onMessage(message);
return true;
}
return false;
}
/**
* Awaits the next message from a user
* @param {Message} message The message to wait for
* @param {Object} [options] The options for the await
* @param {number} [options.filter] The message filter
* @param {number} [options.timeout=30000] The timeout for the halt
* @returns {?Message}
*/
awaitMessage(message, { filter = () => true, timeout = 60000 } = {}) {
return new Promise(resolve => {
const halt = this.createHalt(message.channel.id, message.author.id, timeout);
let foundMessage = null;
halt.on('message', nextMessage => {
if (filter(nextMessage)) {
foundMessage = nextMessage;
halt.end();
}
});
halt.on('end', () => resolve(foundMessage));
});
}
/**
* Same as {@see #awaitMessage}, but is used for getting user input via next message
* @param {Message} message The message to wait for
* @param {LocaleModule} _ The localization module
* @param {Object} [options] The options for the await
* @param {number} [options.filter] The message filter
* @param {number} [options.timeout=30000] The timeout for the halt
* @param {string} [options.header] The content to put in the bot message
* @returns {?Message}
*/
async getInput(message, _, { filter = () => true, timeout = 60000, header = null } = {}) {
await message.channel.createMessage(`<@${message.author.id}>, ` + (header || _('prompt.input')) + '\n\n' +
_('prompt.cancel_input', { cancelPrompt: `<@!${this.client.user.id}> cancel` }));
return new Promise(resolve => {
const halt = this.createHalt(message.channel.id, message.author.id, timeout);
let handled = false, input = null;
halt.on('message', nextMessage => {
if (filter(nextMessage)) {
const cancelRegex = new RegExp(`^(?:<@!?${this.client.user.id}>\\s?)(cancel|stop|end)$`);
if (!nextMessage.content || cancelRegex.test(nextMessage.content.toLowerCase())) {
handled = true;
message.channel.createMessage(`<@${message.author.id}>, ` + _('prompt.input_canceled'));
} else input = nextMessage.content;
halt.end();
}
});
halt.on('end', async () => {
if (!input && !handled)
await message.channel.createMessage(`<@${message.author.id}>, ` + _('prompt.input_canceled'));
resolve(input);
});
});
}
/**
* Same as {@see #getInput}, but resulves attachments to a URL input
* @param {Message} message The message to wait for
* @param {LocaleModule} _ The localization module
* @param {Object} [options] The options for the await
* @param {number} [options.filter] The message filter
* @param {number} [options.timeout=30000] The timeout for the halt
* @param {string} [options.header] The content to put in the bot message
* @returns {?Message}
*/
async getInputOrAttachment(message, _, { filter = () => true, timeout = 60000, header = null } = {}) {
await message.channel.createMessage(`<@${message.author.id}>, ` + (header || _('prompt.input')) + '\n\n' +
_('prompt.cancel_input', { cancelPrompt: `<@!${this.client.user.id}> cancel` }));
return new Promise(resolve => {
const halt = this.createHalt(message.channel.id, message.author.id, timeout);
let handled = false, input = null;
halt.on('message', nextMessage => {
if (filter(nextMessage)) {
const cancelRegex = new RegExp(`^(?:<@!?${this.client.user.id}>\\s?)(cancel|stop|end)$`);
if ((!nextMessage.content && !nextMessage.attachments[0]) ||
cancelRegex.test(nextMessage.content.toLowerCase())) {
handled = true;
message.channel.createMessage(`<@${message.author.id}>, ` + _('prompt.input_canceled'));
} else input = nextMessage.content || nextMessage.attachments[0].url;
halt.end();
}
});
halt.on('end', async () => {
if (!input && !handled)
await message.channel.createMessage(`<@${message.author.id}>, ` + _('prompt.input_canceled'));
resolve(input);
});
});
}
/**
* Same as {@see #awaitMessage}, but is used for confirmation
* @param {Message} message The message to wait for
* @param {LocaleModule} _ The localization module
* @param {Object} [options] The options for the await
* @param {number} [options.timeout=30000] The timeout for the halt
* @param {string} [options.header] The content to put in the bot message
* @returns {?Message}
*/
async confirm(message, _, { timeout = 60000, header = null } = {}) {
await message.channel.createMessage(`<@${message.author.id}>, ` +
(header || _('prompt.confirm')) + '\n\n' + _('prompt.cancel_confirm'));
return new Promise(resolve => {
const halt = this.createHalt(message.channel.id, message.author.id, timeout);
let input = false;
halt.on('message', nextMessage => {
input = nextMessage.content === 'yes';
halt.end();
});
halt.on('end', async () => {
if (!input)
await message.channel.createMessage(`<@${message.author.id}>, ` + _('prompt.no_confirm'));
resolve(input);
});
});
}
}
MessageAwaiter.Halt = Halt;
module.exports = MessageAwaiter;
|
var LopHoc = function () {
this.danhSachHocVien = [];
this.tenLopHoc = 'FrontEnd54';
this.layDanhSachHocVien = function () {
return this.danhSachHocVien
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.