code
stringlengths
2
1.05M
'use strict'; /** * @ngdoc function * @name tagrefineryGuiApp.thatcontroller:MainCtrl * @description * # MainCtrl * Controller of the tagrefineryGuiApp */ angular.module('tagrefineryGuiApp') .controller('MainCtrl', ["$scope", "socket", "$rootScope", "$timeout", function ($scope, socket, $rootScope, $timeout) { var that = this; that.connectionStatus = false; //////////////////////////////////////////////// // Destroy //////////////////////////////////////////////// $scope.$on("$destroy", function() { socket.removeAllListeners('connect'); socket.removeAllListeners('disconnect'); socket.removeAllListeners('connect_error'); }); //////////////////////////////////////////////// // Global //////////////////////////////////////////////// socket.on('connect', function () { that.connectionStatus = true; }); socket.on('disconnect', function () { that.connectionStatus = false; }); socket.on('connect_error', function () { that.connectionStatus = false; }); }]);
"use strict"; exports.__esModule = true; var _stringify = require("babel-runtime/core-js/json/stringify"); var _stringify2 = _interopRequireDefault(_stringify); var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var STATE_KEY_PREFIX = "@@scroll|"; var GATSBY_ROUTER_SCROLL_STATE = "___GATSBY_REACT_ROUTER_SCROLL"; var SessionStorage = function () { function SessionStorage() { (0, _classCallCheck3.default)(this, SessionStorage); } SessionStorage.prototype.read = function read(location, key) { var stateKey = this.getStateKey(location, key); try { var value = sessionStorage.getItem(stateKey); return JSON.parse(value); } catch (e) { console.warn("[gatsby-react-router-scroll] Unable to access sessionStorage; sessionStorage is not available."); if (window && window[GATSBY_ROUTER_SCROLL_STATE] && window[GATSBY_ROUTER_SCROLL_STATE][stateKey]) { return window[GATSBY_ROUTER_SCROLL_STATE][stateKey]; } return {}; } }; SessionStorage.prototype.save = function save(location, key, value) { var stateKey = this.getStateKey(location, key); var storedValue = (0, _stringify2.default)(value); try { sessionStorage.setItem(stateKey, storedValue); } catch (e) { if (window && window[GATSBY_ROUTER_SCROLL_STATE]) { window[GATSBY_ROUTER_SCROLL_STATE][stateKey] = JSON.parse(storedValue); } else { window[GATSBY_ROUTER_SCROLL_STATE] = {}; window[GATSBY_ROUTER_SCROLL_STATE][stateKey] = JSON.parse(storedValue); } console.warn("[gatsby-react-router-scroll] Unable to save state in sessionStorage; sessionStorage is not available."); } }; SessionStorage.prototype.getStateKey = function getStateKey(location, key) { var locationKey = location.key; var stateKeyBase = "" + STATE_KEY_PREFIX + locationKey; return key === null || typeof key === "undefined" ? stateKeyBase : stateKeyBase + "|" + key; }; return SessionStorage; }(); exports.default = SessionStorage;
'use strict'; var gulp = require('gulp'); var browserSync = require('browser-sync'); var browserSyncSpa = require('browser-sync-spa'); var config = require('./config'); var paths = config.paths; function browserSyncInit(baseDir, browser) { browser = browser === undefined ? 'default' : browser; var routes; // if src path is in the baseDir(s) provided, add /bower_components as a route if (baseDir === paths.src || (Array.isArray(baseDir) && baseDir.indexOf(paths.src) !== -1)) { routes = { '/bower_components': 'bower_components' }; } var server = { baseDir: baseDir, routes: routes }; browserSync.instance = browserSync.init({ startPath: '/', server: server, browser: browser }); } browserSync.use(browserSyncSpa({ selector: '[ng-app]'// Only needed for angular apps })); gulp.task('serve', ['watch'], function () { // serve the .tmp and src directories browserSyncInit([paths.tmpServe, paths.src]); }); gulp.task('serve:dist', ['build'], function () { // serve the dist directory browserSyncInit(paths.dist); }); gulp.task('serve-e2e', ['html', 'styles', 'scripts:watch'], function () { browserSyncInit([paths.tmpServe, paths.src], []); }); gulp.task('serve-e2e:dist', ['build'], function () { browserSyncInit(paths.dist, []); });
// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.16/esri/copyright.txt for details. //>>built define("require exports ../core/tsSupport/assignHelper ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../request ../core/promiseUtils ../core/queryUtils ../core/accessorSupport/decorators ../geometry/support/normalizeUtils ./Task ./mixins/NAServiceDescription ./support/ServiceAreaSolveResult".split(" "),function(y,z,l,n,m,p,q,r,k,t,u,v,w){var x=r.createQueryParamsHelper({accumulateAttributes:{name:"accumulateAttributeNames"},attributeParameterValues:!0,defaultBreaks:!0,facilities:!0, outSpatialReference:{name:"outSR",getter:function(h){return h.outSpatialReference.wkid}},pointBarriers:{name:"barriers"},polylineBarriers:!0,polygonBarriers:!0,restrictionAttributes:{name:"restrictionAttributeNames"},returnPointBarriers:{name:"returnBarriers"},travelMode:!0});return function(h){function b(a){a=h.call(this,a)||this;a.url=null;return a}n(b,h);b.prototype.solve=function(a,b){var e=this,f=[],c=[],d={},g={};a.facilities&&a.facilities.features&&this._collectGeometries(a.facilities.features, c,"facilities.features",d);a.pointBarriers&&a.pointBarriers.features&&this._collectGeometries(a.pointBarriers.features,c,"pointBarriers.features",d);a.polylineBarriers&&a.polylineBarriers.features&&this._collectGeometries(a.polylineBarriers.features,c,"polylineBarriers.features",d);a.polygonBarriers&&a.polygonBarriers.features&&this._collectGeometries(a.polygonBarriers.features,c,"polygonBarriers.features",d);return t.normalizeCentralMeridian(c).then(function(a){for(var b in d){var c=d[b];f.push(b); g[b]=a.slice(c[0],c[1])}return e._isInputGeometryZAware(g,f)?e.getServiceDescription():q.resolve({dontCheck:!0})}).then(function(c){("dontCheck"in c?c.dontCheck:c.hasZ)||e._dropZValuesOffInputGeometry(g,f);c=function(c){g[c].forEach(function(b,d){a.get(c)[d].geometry=b})};for(var d in g)c(d);d={query:l({},e.parsedUrl.query,{f:"json"},x.toQueryParams(a))};if(e.requestOptions||b)d=l({},e.requestOptions,b,d);return p(e.parsedUrl.path+"/solveServiceArea",d)}).then(function(a){return w.fromJSON(a.data)})}; b.prototype._collectGeometries=function(a,b,e,f){f[e]=[b.length,b.length+a.length];a.forEach(function(a){b.push(a.geometry)})};m([k.property()],b.prototype,"url",void 0);return b=m([k.subclass("esri.tasks.ServiceAreaTask")],b)}(k.declared(v.NAServiceDescriptionMixin(u)))});
/* jshint node: true */ var timer = require('grunt-timer'); module.exports = function (grunt) { timer.init(grunt); var config = require('./config'); require('load-grunt-tasks')(grunt); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { dist: { src: [ 'src/js/intro.js', 'src/js/DOM.js', 'src/js/DiffData.js', 'src/js/DiffView.js', 'src/js/diff.js', 'src/js/outro.js' ], dest: 'src/built.js' }, dev: { src: '<%= concat.dist.src %>', dest: '<%= uglify.dist.dest %>' } }, uglify: { options: { sourceMap: true, }, dist: { src: '<%= concat.dist.dest %>', dest: 'dist/js/diff.min.js' } }, sass: { dist: { src: 'src/styles/diff.scss', dest: 'dist/css/diff.css' } }, jshint: { options: { force: true, jshintrc: true, }, all: { src: ['src/js/*.js', 'lib/*.js', 'Gruntfile.js' ], } }, watch: { options: { livereload: true }, jshint : { files: [ '<%= jshint.all.src %>'], tasks: 'jshint' }, concat: { files: '<%= concat.dist.src %>', tasks: 'concat' }, sass: { files: '<%= sass.dist.src %>', tasks: 'sass' } }, nodemon: { dev: { script: 'index.js', options: { ignore: ['node_modules/**', 'dist/**'] } }, }, open: { dev: { path: 'http://localhost:' + config.port + '/' } }, concurrent: { dev: [ 'nodemon:dev', 'open', 'watch&build'], options: { logConcurrentOutput: true } } }); grunt.registerTask('build', [ 'concat:dist', 'uglify', 'sass']); grunt.registerTask('build-dev', [ 'concat:dev', 'sass']); grunt.registerTask('watch&build', [ 'build-dev', 'jshint', 'watch']); grunt.registerTask('server', [ 'concurrent:dev' ]); grunt.registerTask('default', 'server'); };
define(['jquery', 'amplify', 'ko', 'a/settings/model.settingPanel', 'languages'], function ($, amplify, ko, settingPanelModel, languages) { var organizationModel = function () { var self = this; self.id = ko.observable(); self.name = ko.observable() .extend({ required: { params: true, message: languages.common.requiredField }, minLength: 2 }); self.code = ko.observable() .extend({ required: { params: true, message: languages.common.requiredField }, minLength: 1 }); self.lastChangedUser = ko.observable(); self.lastChangedTime = ko.observable(); self.settingsPanel = ko.observable(); self.map = function (data) { ko.mapping.fromJS(data, { 'ignore': ["settingPanel"] }, self); var r = new settingPanelModel(); r.map(data.settingsPanel); self.settingsPanel(r); }; self.toJS= function() { var data = ko.mapping.toJS(self); data.settingsPanel = self.settingsPanel().toJS(); return data; } self.isNew = ko.observable(false); self.validationErrors = ko.validation.group(self); self.isValid = ko.computed(function () { return self.validationErrors().length === 0; }); return self; }; return organizationModel; });
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "./pan-gesture", "../util/util", "../util/dom"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var pan_gesture_1 = require("./pan-gesture"); var util_1 = require("../util/util"); var dom_1 = require("../util/dom"); /** * @hidden */ var SlideGesture = (function (_super) { __extends(SlideGesture, _super); /** * @param {?} plt * @param {?} element * @param {?=} opts */ function SlideGesture(plt, element, opts) { if (opts === void 0) { opts = {}; } var _this = _super.call(this, plt, element, opts) || this; _this.slide = null; return _this; } /** * @param {?} slide * @param {?} ev * @return {?} */ SlideGesture.prototype.getSlideBoundaries = function (slide, ev) { return { min: 0, max: this.getNativeElement().offsetWidth }; }; /** * @param {?} slide * @param {?} ev * @return {?} */ SlideGesture.prototype.getElementStartPos = function (slide, ev) { return 0; }; /** * @param {?} ev * @return {?} */ SlideGesture.prototype.onDragStart = function (ev) { this.onSlideBeforeStart(ev); var /** @type {?} */ coord = (dom_1.pointerCoord(ev)); var /** @type {?} */ pos = coord[this.direction]; this.slide = { min: 0, max: 0, pointerStartPos: pos, pos: pos, timestamp: Date.now(), elementStartPos: 0, started: true, delta: 0, distance: 0, velocity: 0, }; // TODO: we should run this in the next frame var _a = this.getSlideBoundaries(this.slide, ev), min = _a.min, max = _a.max; this.slide.min = min; this.slide.max = max; this.slide.elementStartPos = this.getElementStartPos(this.slide, ev); this.onSlideStart(this.slide, ev); }; /** * @param {?} ev * @return {?} */ SlideGesture.prototype.onDragMove = function (ev) { var /** @type {?} */ slide = this.slide; (void 0) /* assert */; var /** @type {?} */ coord = (dom_1.pointerCoord(ev)); var /** @type {?} */ newPos = coord[this.direction]; var /** @type {?} */ newTimestamp = Date.now(); var /** @type {?} */ velocity = (this.plt.isRTL ? (slide.pos - newPos) : (newPos - slide.pos)) / (newTimestamp - slide.timestamp); slide.pos = newPos; slide.timestamp = newTimestamp; slide.distance = util_1.clamp(slide.min, (this.plt.isRTL ? slide.pointerStartPos - newPos : newPos - slide.pointerStartPos) + slide.elementStartPos, slide.max); slide.velocity = velocity; slide.delta = (this.plt.isRTL ? slide.pointerStartPos - newPos : newPos - slide.pointerStartPos); this.onSlide(slide, ev); }; /** * @param {?} ev * @return {?} */ SlideGesture.prototype.onDragEnd = function (ev) { this.onSlideEnd(this.slide, ev); this.slide = null; }; /** * @param {?=} ev * @return {?} */ SlideGesture.prototype.onSlideBeforeStart = function (ev) { }; /** * @param {?=} slide * @param {?=} ev * @return {?} */ SlideGesture.prototype.onSlideStart = function (slide, ev) { }; /** * @param {?=} slide * @param {?=} ev * @return {?} */ SlideGesture.prototype.onSlide = function (slide, ev) { }; /** * @param {?=} slide * @param {?=} ev * @return {?} */ SlideGesture.prototype.onSlideEnd = function (slide, ev) { }; return SlideGesture; }(pan_gesture_1.PanGesture)); exports.SlideGesture = SlideGesture; function SlideGesture_tsickle_Closure_declarations() { /** @type {?} */ SlideGesture.prototype.slide; } }); //# sourceMappingURL=slide-gesture.js.map
'use strict'; var hunt = require('./../index.js')({ 'port': 3000, 'mongoUrl': 'mongo://localhost/hunt_dev', 'enableMongoose': true, 'disableCsrf': true }); /* * Creating mongoose model of Trophies * So, this model is accessible by hunt.model.Trophy * and by request.model.Trophy in controllers */ hunt.extendModel('Trophy', require('./models/trophy.model.js')); /* * Exporting Trophy model as REST interface */ hunt.exportModelToRest({ 'mountPount': '/api/v1/trophy', 'modelName': 'Trophy', 'ownerId': 'author' }); /* * Exporting User model as REST interface */ hunt.exportModelToRest({ 'mountPount': '/api/v1/user', 'modelName': 'User', 'ownerId': '_id' }); hunt.startWebServer();
/* stylec comparison: strict */ var good = 1 === 3; var good = 1 !== 3; var bad = 1 == 3; //! column: 10 var bad = 1 != 3; //! column: 10
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema; /** * Post Schema */ var PostSchema = new Schema({ created: { type: Date, default: Date.now }, name:{ type: String, required: true, trim: true }, description: { type: String, required: true, trim: true }, user: { type: Schema.ObjectId, ref: 'User' }, }); /** * Statics */ PostSchema.statics.load = function(id, cb) { this.findOne({ _id: id }).populate('user', 'name username').exec(cb); }; mongoose.model('Post', PostSchema);
// FIRST TIME ONLY- run: // ./node_modules/.bin/webdriver-manager update // // Try: `npm run webdriver:update` // // AND THEN EVERYTIME ... // 1. Compile with `tsc` // 2. Make sure the test server (e.g., lite-server: localhost:8080) is running. // 3. ./node_modules/.bin/protractor protractor.config.js // // To do all steps, try: `npm run e2e` var fs = require('fs'); var path = require('canonical-path'); var _ = require('lodash'); exports.config = { directConnect: true, // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' }, // Framework to use. Jasmine is recommended. framework: 'jasmine', // Spec patterns are relative to this config file specs: ['**/*e2e-spec.js' ], // For angular tests useAllAngular2AppRoots: true, // Base URL for application server baseUrl: 'http://localhost:8080', // doesn't seem to work. // resultJsonOutputFile: "foo.json", getPageTimeout: 20000, onPrepare: function() { //// SpecReporter //var SpecReporter = require('jasmine-spec-reporter'); //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'none'})); //// jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'})); // debugging // console.log('browser.params:' + JSON.stringify(browser.params)); jasmine.getEnv().addReporter(new Reporter( browser.params )) ; // Allow changing bootstrap mode to NG1 for upgrade tests global.setProtractorToNg1Mode = function() { browser.useAllAngular2AppRoots = false; browser.rootEl = 'body'; }; }, jasmineNodeOpts: { defaultTimeoutInterval: 30000, showTiming: true, print: function() {} } }; // Custom reporter function Reporter(options) { var _defaultOutputFile = path.resolve(process.cwd(), './_test-output', 'protractor-results.txt'); options.outputFile = options.outputFile || _defaultOutputFile; initOutputFile(options.outputFile); options.appDir = options.appDir || './'; var _root = { appDir: options.appDir, suites: [] }; log('AppDir: ' + options.appDir, +1); var _currentSuite; this.suiteStarted = function(suite) { _currentSuite = { description: suite.description, status: null, specs: [] }; _root.suites.push(_currentSuite); log('Suite: ' + suite.description, +1); }; this.suiteDone = function(suite) { var statuses = _currentSuite.specs.map(function(spec) { return spec.status; }); statuses = _.uniq(statuses); var status = statuses.indexOf('failed') >= 0 ? 'failed' : statuses.join(', '); _currentSuite.status = status; log('Suite ' + _currentSuite.status + ': ' + suite.description, -1); }; this.specStarted = function(spec) { }; this.specDone = function(spec) { var currentSpec = { description: spec.description, status: spec.status }; if (spec.failedExpectations.length > 0) { currentSpec.failedExpectations = spec.failedExpectations; } _currentSuite.specs.push(currentSpec); log(spec.status + ' - ' + spec.description); }; this.jasmineDone = function() { outputFile = options.outputFile; //// Alternate approach - just stringify the _root - not as pretty //// but might be more useful for automation. // var output = JSON.stringify(_root, null, 2); var output = formatOutput(_root); fs.appendFileSync(outputFile, output); }; function ensureDirectoryExistence(filePath) { var dirname = path.dirname(filePath); if (directoryExists(dirname)) { return true; } ensureDirectoryExistence(dirname); fs.mkdirSync(dirname); } function directoryExists(path) { try { return fs.statSync(path).isDirectory(); } catch (err) { return false; } } function initOutputFile(outputFile) { ensureDirectoryExistence(outputFile); var header = "Protractor results for: " + (new Date()).toLocaleString() + "\n\n"; fs.writeFileSync(outputFile, header); } // for output file output function formatOutput(output) { var indent = ' '; var pad = ' '; var results = []; results.push('AppDir:' + output.appDir); output.suites.forEach(function(suite) { results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status); pad+=indent; suite.specs.forEach(function(spec) { results.push(pad + spec.status + ' - ' + spec.description); if (spec.failedExpectations) { pad+=indent; spec.failedExpectations.forEach(function (fe) { results.push(pad + 'message: ' + fe.message); }); pad=pad.substr(2); } }); pad = pad.substr(2); results.push(''); }); results.push(''); return results.join('\n'); } // for console output var _pad; function log(str, indent) { _pad = _pad || ''; if (indent == -1) { _pad = _pad.substr(2); } console.log(_pad + str); if (indent == 1) { _pad = _pad + ' '; } } }
const config = { mongoURL: process.env.MONGO_URL || 'mongodb://localhost:27017/mern-starter', port: process.env.OPENSHIFT_NODEJS_PORT || 8, }; export const baseURL = typeof window === 'undefined' ? process.env.BASE_URL || (`http://localhost:${config.port}`) : ''; export const API_URL = (typeof window === 'undefined' || process.env.NODE_ENV === 'test') ? process.env.BASE_URL || (`http://localhost:${process.env.PORT || config.port}/api`) : '/api'; export default config;
'use strict'; angular .module('FlexUI') .directive('flexList', flexList); function flexList() { var directive = { scope: false, template: '<div class="flex-list" ng-transclude></div>', // html路径 transclude: true, replace: true, restrict: 'E' //指令的使用方式 }; return directive; }
export const basic_cup = {"viewBox":"0 0 64 64","children":[{"name":"path","attribs":{"fill":"none","stroke":"#000000","stroke-width":"2","stroke-miterlimit":"10","d":"M16,27c0,4.418,6.059,8,16,8s16-3.582,16-8V1H16V27z\r\n\t"},"children":[]},{"name":"line","attribs":{"fill":"none","stroke":"#000000","stroke-width":"2","stroke-miterlimit":"10","x1":"20","y1":"63","x2":"44","y2":"63"},"children":[]},{"name":"line","attribs":{"fill":"none","stroke":"#000000","stroke-width":"2","stroke-miterlimit":"10","x1":"32","y1":"35","x2":"32","y2":"63"},"children":[]},{"name":"path","attribs":{"fill":"none","stroke":"#000000","stroke-width":"2","stroke-miterlimit":"10","d":"M16,7H7c0,0,0,9,9,9"},"children":[]},{"name":"path","attribs":{"fill":"none","stroke":"#000000","stroke-width":"2","stroke-miterlimit":"10","d":"M48,7h9c0,0,0,9-9,9"},"children":[]}]};
import test from 'ava' import identity from '../../lib/internals/identity' test('returns identity', t => { const x = identity(42) t.is(x, 42) })
export { default } from './datamap';
// @flow import React, {Component} from 'react'; import { View, ScrollView, RefreshControl, TouchableOpacity, Text, Image, StyleSheet } from 'react-native'; import {connect} from 'react-redux'; import {CSHeader} from '../../components/CSHeader'; import {loadRequests, acceptRequest, removeRequest} from '../../redux/actions'; import {getDateString, daysOfWeek} from '../../helpers'; function getDateStringWithDay(date: Date) { return `${getDateString(date)} ${daysOfWeek[date.getDay()]}`; } function RequestCell(props) { const { request } = props; const isTraveler = request.type === 'traveler'; const { firstName, lastName, avatar } = isTraveler ? request.host : request.traveler; var acceptText; var onPressIsWorking = false; if (isTraveler) { acceptText = request.hostAccepted ? 'Accepted' : 'Wait for accept'; } else { onPressIsWorking = !request.hostAccepted && true; acceptText = request.hostAccepted ? 'Accepted' : 'Press to accept'; } return ( <View style={{borderBottomWidth: 0.5}}> <TouchableOpacity onPress={props.onPress} style={{height: 85, flexDirection: 'row'}} > <View style={{width: 90, height: 90, alignItems: 'center', justifyContent: 'center'}}> <Image source={avatar || require('../../components/img/blank_picture.png')} style={{width: 70, height: 70, borderRadius: 35}}/> </View> <View style={{flex: 1, justifyContent: 'space-around'}}> <Text style={{fontSize: 17}}>{`${isTraveler ? 'To' : 'From'} ${firstName} ${lastName}`}</Text> <Text style={{color: '#b6c3cb'}}> { `${getDateStringWithDay(request.arrives)} - ${ getDateStringWithDay(request.departs) }` } </Text> <Text style={{color: '#00002b'}}>{request.tripDetail}</Text> <Text style={{color: '#b3b3b3'}}>{getDateString(request.createdAt)}</Text> </View> </TouchableOpacity> <View style={{height: 30, flexDirection: 'row', alignItems: 'center', marginLeft: 20}}> <Text>Status: </Text> <TouchableOpacity disabled={!onPressIsWorking} onPress={props.onAcceptPress} style={{height: 22, width: 150, borderRadius: 2, alignItems: 'center', justifyContent: 'center', marginLeft: 18, backgroundColor: '#2f81b7'}} > <Text style={{color: 'white'}}>{acceptText}</Text> </TouchableOpacity> <TouchableOpacity onPress={props.onRemovePress} style={{height: 22, width: 80, borderRadius: 2, alignItems: 'center', justifyContent: 'center', marginLeft: 5, backgroundColor: '#b3b3b3'}} > <Text style={{color: 'white'}}>Remove</Text> </TouchableOpacity> </View> </View> ); } class MessagesScreen extends Component { constructor(props) { super(props); this.state = { refreshing: false }; } render() { return ( <View style={styles.container}> <CSHeader style={styles.header} title="Requests" /> <ScrollView automaticallyAdjustContentInsets={false} style={styles.container} refreshControl={ <RefreshControl title="Pull to refresh..." refreshing={this.state.refreshing} onRefresh={() => { this.setState({refreshing: true}); this.props.dispatch(loadRequests()) .then(() => this.setState({refreshing: false})); }} /> } > { this.props.requests.map((request, i) => ( <RequestCell key={i} request={request} onRemovePress={() => this.props.dispatch(removeRequest(request.id))} onAcceptPress={() => this.props.dispatch(acceptRequest(request.id, request.type))} onPress={() => this.props.navigator.push({ screen: 'profile', data: { type: 'member', account: request.type === 'traveler' ? request.host : request.traveler } })} /> )) } </ScrollView> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1 }, header: { backgroundColor: 'white' } }); export default connect( state => ({requests: state.request.requests}) )(MessagesScreen);
const fs = require('fs'); const path = require('path'); const Benchmark = require('benchmark'); const load = require('load-json-file'); const nearestPoint = require('./').default; const pts = load.sync(path.join(__dirname, 'test', 'in', 'points.json')); /** * Benchmark Results * * turf-nearest-point x 72,623 ops/sec ±9.23% (73 runs sampled) */ const suite = new Benchmark.Suite('turf-nearest-point'); suite .add('turf-nearest-point', () => nearestPoint(pts.properties.targetPoint, pts)) .on('cycle', e => console.log(String(e.target))) .on('complete', () => {}) .run();
/** Functions related to the Timer Bar */ import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles'; import { BuffColours, ColourBackPre, ColourGray, ColourOrange, ColourPurple, LastNumberOfTimers, } from '../VariablesAndData'; import { CreateTimer } from './CreateDOMElements'; /** * This function creates the TimerBar and appends it to l('wrapper') */ export function CreateTimerBar() { const TimerBar = document.createElement('div'); TimerBar.id = 'CMTimerBar'; TimerBar.style.position = 'absolute'; TimerBar.style.display = 'none'; TimerBar.style.height = '0px'; TimerBar.style.fontSize = '10px'; TimerBar.style.fontWeight = 'bold'; TimerBar.style.backgroundColor = 'black'; // Create standard Autosave bar const CMTimerBarAutosave = CreateTimer('CMTimerBarAutosave', 'Autosave', [ { id: 'CMTimerBarAutosaveBar', colour: ColourPurple }, ]); TimerBar.appendChild(CMTimerBarAutosave); // Create standard Golden Cookie bar const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [ { id: 'CMTimerBarGCMinBar', colour: ColourGray }, { id: 'CMTimerBarGCBar', colour: ColourPurple }, ]); TimerBar.appendChild(CMTimerBarGC); // Create standard Reindeer bar const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [ { id: 'CMTimerBarRenMinBar', colour: ColourGray }, { id: 'CMTimerBarRenBar', colour: ColourOrange }, ]); TimerBar.appendChild(CMTimerBarRen); const TimerBarBuffTimers = document.createElement('div'); TimerBarBuffTimers.id = 'CMTimerBarBuffTimers'; TimerBar.appendChild(TimerBarBuffTimers); l('wrapper').appendChild(TimerBar); } /** * This function updates indivudual timers in the timer bar */ export function UpdateTimerBar() { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1) { // label width: 113, timer width: 30, div margin: 20 const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163; // label width: 113, div margin: 20, calculate timer width at runtime const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133; let numberOfTimers = 0; if ( Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AutosaveTimerBar && Game.prefs.autosave ) { const timeTillNextAutosave = (Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60))) / Game.fps; l('CMTimerBarAutosave').style.display = ''; l('CMTimerBarAutosaveBar').style.width = `${Math.round( (timeTillNextAutosave * (maxWidthOneBar - Math.ceil(timeTillNextAutosave).toString().length * 8)) / 60, )}px`; if ( Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1 ) { l('CMTimerBarAutosaveBar').textContent = Math.ceil(timeTillNextAutosave); } else l('CMTimerBarAutosaveBar').textContent = ''; l('CMTimerBarAutosaveTime').textContent = Math.ceil(timeTillNextAutosave); numberOfTimers += 1; } else l('CMTimerBarAutosave').style.display = 'none'; // Regulates visibility of Golden Cookie timer if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) { l('CMTimerBarGC').style.display = ''; l('CMTimerBarGCMinBar').style.width = `${Math.round( (Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar) / Game.shimmerTypes.golden.maxTime, )}px`; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil( (Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps, ); else l('CMTimerBarGCMinBar').textContent = ''; if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) { l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px'; l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px'; } else { l('CMTimerBarGCMinBar').style.borderTopRightRadius = ''; l('CMTimerBarGCMinBar').style.borderBottomRightRadius = ''; } l('CMTimerBarGCBar').style.width = `${Math.round( (Math.min( Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time, ) * maxWidthTwoBar) / Game.shimmerTypes.golden.maxTime, )}px`; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1) l('CMTimerBarGCBar').textContent = Math.ceil( Math.min( Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time, ) / Game.fps, ); else l('CMTimerBarGCBar').textContent = ''; const chanceToSpawn = Math.max( 0, (Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) / (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime), ) ** 5; l('CMTimerBarGCTime').textContent = `${Math.ceil( (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps, )} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', { style: 'percent', })}`; numberOfTimers += 1; } else l('CMTimerBarGC').style.display = 'none'; // Regulates visibility of Reindeer timer if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) { l('CMTimerBarRen').style.display = ''; l('CMTimerBarRenMinBar').style.width = `${Math.round( (Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar) / Game.shimmerTypes.reindeer.maxTime, )}px`; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1) l('CMTimerBarRenMinBar').textContent = Math.ceil( (Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps, ); else l('CMTimerBarRenMinBar').textContent = ''; l('CMTimerBarRenBar').style.width = `${Math.round( (Math.min( Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time, ) * maxWidthTwoBar) / Game.shimmerTypes.reindeer.maxTime, )}px`; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1) l('CMTimerBarRenBar').textContent = Math.ceil( Math.min( Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time, ) / Game.fps, ); else l('CMTimerBarRenBar').textContent = ''; const chanceToSpawn = Math.max( 0, (Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) / (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime), ) ** 5; l('CMTimerBarRenTime').textContent = `${Math.ceil( (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps, )} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', { style: 'percent', })}`; numberOfTimers += 1; } else { l('CMTimerBarRen').style.display = 'none'; } // On every frame all buff-timers are deleted and re-created const BuffTimerBars = {}; l('CMTimerBarBuffTimers').innerHTML = ''; Object.keys(Game.buffs).forEach((i) => { if (Game.buffs[i]) { const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [ { id: `${Game.buffs[i].name}Bar` }, ]); timer.style.display = ''; let classColour = ''; // Gives specific timers specific colours if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') { classColour = BuffColours[Game.buffs[i].name]; } else classColour = ColourPurple; timer.lastChild.children[1].className = ColourBackPre + classColour; timer.lastChild.children[1].style.color = 'black'; if ( Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay === 2 ) timer.lastChild.children[1].textContent = `${Math.round( 100 * (Game.buffs[i].time / Game.buffs[i].maxTime), )}%`; else timer.lastChild.children[1].textContent = ''; timer.lastChild.children[1].style.width = `${Math.round( (Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) / Game.buffs[i].maxTime, )}px`; timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps); numberOfTimers += 1; BuffTimerBars[Game.buffs[i].name] = timer; } }); Object.keys(BuffTimerBars).forEach((i) => { l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]); }); if (numberOfTimers !== 0) { l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`; } if (LastNumberOfTimers !== numberOfTimers) { LastNumberOfTimers = numberOfTimers; UpdateBotTimerBarPosition(); } } }
window.Channel = Backbone.Model.extend({ urlRoot: "/api/channels", idAttribute: "_id", initialize: function () { this.validators = {}; this.validators.name = function (value) { return value.length > 0 ? {isValid: true} : {isValid: false, message: "You must enter a name"}; }; this.validators.kind = function (value) { return value.length > 0 ? {isValid: true} : {isValid: false, message: "You must select the type of sensor"}; }; this.validators.unit = function (value) { return value.length > 0 ? {isValid: true} : {isValid: false, message: "You must select the unit"}; }; }, validateItem: function (key) { return (this.validators[key]) ? this.validators[key](this.get(key)) : {isValid: true}; }, // TODO: Implement Backbone's standard validate() method instead. validateAll: function () { var messages = {}; for (var key in this.validators) { if(this.validators.hasOwnProperty(key)) { var check = this.validators[key](this.get(key)); if (check.isValid === false) { messages[key] = check.message; } } } return _.size(messages) > 0 ? {isValid: false, messages: messages} : {isValid: true}; }, defaults: { _id: null, name: "", description: "", kind: "", resolution: "", unit: "", value: "-", active: true } }); window.ChannelCollection = Backbone.Collection.extend({ model: Channel, url: "/api/channels" });
/* eslint-env node */ const Canvas = require('canvas'); const fs = require('fs'); const { Image } = Canvas; /** * Create a new canvas object with height and width * set to the given values. * * @param width {number} The width of the canvas. * @param height {number} The height of the canvas. * * @return {Canvas} A canvas object with * height and width set to the given values. */ function createCanvas(width, height) { return new Canvas(width, height); } /** * Load the image given by the file path, returning * a promise to the image represented by the given path. * * @parm path {string} The path to the image. * * @return {Image} An image element referring to * the given path. */ function loadImage(path) { return new Promise((resolve, reject) => { fs.readFile(path, (err, data) => { if (err) { reject(err); return; } const image = new Image(); image.onload = () => resolve(image); image.onerror = err => reject(err); image.src = data; resolve(image); }); }); } module.exports = { createCanvas, loadImage, };
/* * grunt-init-gruntfile * https://gruntjs.com/ * * Copyright (c) 2012 "Cowboy" Ben Alman, contributors * Licensed under the MIT license. */ 'use strict'; // Basic template description. exports.description = 'Create a basic Gruntfile.'; // Template-specific notes to be displayed before question prompts. exports.notes = 'This template tries to guess file and directory paths, but ' + 'you will most likely need to edit the generated Gruntfile.js file before ' + 'running grunt. _If you run grunt after generating the Gruntfile, and ' + 'it exits with errors, edit the file!_'; // Any existing file or directory matching this wildcard will cause a warning. exports.warnOn = 'Gruntfile.js'; // The actual init template. exports.template = function(grunt, init, done) { init.process({}, [ // Prompt for these values. { name: 'dom', message: 'Is the DOM involved in ANY way?', default: 'Y/n', warning: 'Yes: QUnit unit tests + JSHint "browser" globals. No: Nodeunit unit tests.' }, { name: 'min_concat', message: 'Will files be concatenated or minified?', default: 'Y/n', warning: 'Yes: min + concat tasks. No: nothing to see here.' }, { name: 'package_json', message: 'Will you have a package.json file?', default: 'Y/n', warning: 'This changes how filenames are determined and banners are generated.' } ], function(err, props) { props.dom = /y/i.test(props.dom); props.min_concat = /y/i.test(props.min_concat); props.package_json = /y/i.test(props.package_json); props.test_task = props.dom ? 'qunit' : 'nodeunit'; props.file_name = props.package_json ? '<%= pkg.name %>' : 'FILE_NAME'; // Find the first `preferred` item existing in `arr`. function prefer(arr, preferred) { for (var i = 0; i < preferred.length; i++) { if (arr.indexOf(preferred[i]) !== -1) { return preferred[i]; } } return preferred[0]; } // Guess at some directories, if they exist. var dirs = grunt.file.expand({filter: 'isDirectory'}, '*').map(function(d) { return d.slice(0, -1); }); props.lib_dir = prefer(dirs, ['lib', 'src']); props.test_dir = prefer(dirs, ['test', 'tests', 'unit', 'spec']); // Maybe this should be extended to support more libraries. Patches welcome! props.jquery = grunt.file.expand({filter: 'isFile'}, '**/jquery*.js').length > 0; // Files to copy (and process). var files = init.filesToCopy(props); // Actually copy (and process) files. init.copyAndProcess(files, props); // If is package_json true, generate package.json if (props.package_json) { var devDependencies = { 'grunt': '~0.4.5', 'grunt-contrib-jshint': '~0.10.0', 'grunt-contrib-watch': '~0.6.1' }; if (props.dom) { devDependencies['grunt-contrib-qunit'] = '~0.5.2'; } else { devDependencies['grunt-contrib-nodeunit'] = '~0.4.1'; } if (props.min_concat) { devDependencies['grunt-contrib-concat'] = '~0.4.0'; devDependencies['grunt-contrib-uglify'] = '~0.5.0'; } // Generate package.json file, used by npm and grunt. init.writePackageJSON('package.json', { node_version: '>= 0.10.0', devDependencies: devDependencies }); } // All done! done(); }); };
define(["require", "exports", "../Util", "../Factory", "../Shape", "../Validators", "../Global"], function (require, exports, Util_1, Factory_1, Shape_1, Validators_1, Global_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ellipse = void 0; /** * Ellipse constructor * @constructor * @memberof Konva * @augments Konva.Shape * @param {Object} config * @param {Object} config.radius defines x and y radius * @@shapeParams * @@nodeParams * @example * var ellipse = new Konva.Ellipse({ * radius : { * x : 50, * y : 50 * }, * fill: 'red' * }); */ class Ellipse extends Shape_1.Shape { _sceneFunc(context) { var rx = this.radiusX(), ry = this.radiusY(); context.beginPath(); context.save(); if (rx !== ry) { context.scale(1, ry / rx); } context.arc(0, 0, rx, 0, Math.PI * 2, false); context.restore(); context.closePath(); context.fillStrokeShape(this); } getWidth() { return this.radiusX() * 2; } getHeight() { return this.radiusY() * 2; } setWidth(width) { this.radiusX(width / 2); } setHeight(height) { this.radiusY(height / 2); } } exports.Ellipse = Ellipse; Ellipse.prototype.className = 'Ellipse'; Ellipse.prototype._centroid = true; Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY']; Global_1._registerNode(Ellipse); // add getters setters Factory_1.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']); /** * get/set radius * @name Konva.Ellipse#radius * @method * @param {Object} radius * @param {Number} radius.x * @param {Number} radius.y * @returns {Object} * @example * // get radius * var radius = ellipse.radius(); * * // set radius * ellipse.radius({ * x: 200, * y: 100 * }); */ Factory_1.Factory.addGetterSetter(Ellipse, 'radiusX', 0, Validators_1.getNumberValidator()); /** * get/set radius x * @name Konva.Ellipse#radiusX * @method * @param {Number} x * @returns {Number} * @example * // get radius x * var radiusX = ellipse.radiusX(); * * // set radius x * ellipse.radiusX(200); */ Factory_1.Factory.addGetterSetter(Ellipse, 'radiusY', 0, Validators_1.getNumberValidator()); /** * get/set radius y * @name Konva.Ellipse#radiusY * @method * @param {Number} y * @returns {Number} * @example * // get radius y * var radiusY = ellipse.radiusY(); * * // set radius y * ellipse.radiusY(200); */ Util_1.Collection.mapMethods(Ellipse); });
version https://git-lfs.github.com/spec/v1 oid sha256:76394fcd8b69f1fb049370566cb65476f56411174ce3c91740f3cedc0b2e0446 size 35769
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class AndroidFolder extends React.Component { render() { if(this.props.bare) { return <g> <g id="Icon_10_"> <g> <g> <path d="M213.338,96H74.666C51.197,96,32,115.198,32,138.667v234.666C32,396.802,51.197,416,74.666,416h362.668 C460.803,416,480,396.802,480,373.333V186.667C480,163.198,460.803,144,437.334,144H256.006L213.338,96z"></path> </g> </g> </g> </g>; } return <IconBase> <g id="Icon_10_"> <g> <g> <path d="M213.338,96H74.666C51.197,96,32,115.198,32,138.667v234.666C32,396.802,51.197,416,74.666,416h362.668 C460.803,416,480,396.802,480,373.333V186.667C480,163.198,460.803,144,437.334,144H256.006L213.338,96z"></path> </g> </g> </g> </IconBase>; } };AndroidFolder.defaultProps = {bare: false}
export var trueDocs = { name: 'true', category: 'Constants', syntax: ['true'], description: 'Boolean value true', examples: ['true'], seealso: ['false'] };
function simpleState (options) { "use strict"; if (!options) { options = {}; } this._state = null; /// name of the stored cookie this.cookieName = options.cookieName || "last-page-state"; /// cookie persistance mode: /// page - valid for the current page only with long expiration date /// session - valid only for current session (short expiration date) and page /// site - valid for the role site with long expiration date /// site session - valid only for current session (short expiration date) but for the hole site this.persistence = options.persistence || "page"; // check if we have HTML5 storage this.useHtml5Storage = function () { try { return 'localStorage' in window && window['localStorage'] !== null; } catch (e) { return false; } }(); // select persistence mode: localStorage or cookie if (this.useHtml5Storage) { if (this.persistence.indexOf("page") >= 0 || this.persistence === "session") { var p = window.location.href.split('://')[1].split('#')[0].split('?')[0].split('/'); this.cookieName = (p.pop() || "") + "_" + this.cookieName; this.cookieName = (p.pop() || "") + "_" + this.cookieName; } if (this.persistence.indexOf("session") >= 0) { this.read = function (key) { return sessionStorage[key]; }; this.write = function (key, data) { sessionStorage[key] = data; }; } else { this.read = function (key) { return localStorage[key]; }; this.write = function (key, data) { localStorage[key] = data; }; } } else { // fallback to cookie usage // based on https://developer.mozilla.org/en-US/docs/Web/API/document.cookie this.read = function (sKey) { if (!sKey) { return null; } return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; }; this.write = function (sKey, sValue) { // prepare options var vEnd, sDomain, sPath, bSecure; if (this.persistence.indexOf("session") < 0) { vEnd = Infinity; } if (this.persistence.indexOf("site") >= 0) { sPath = "/"; } if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } var sExpires = ""; if (vEnd) { switch (vEnd.constructor) { case Number: sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; break; case String: sExpires = "; expires=" + vEnd; break; case Date: sExpires = "; expires=" + vEnd.toUTCString(); break; } } document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); return true; }; } } simpleState.prototype.load = function () { var c = this.read(this.cookieName); if (c) { this._state = JSON.parse(c); } if (!this._state) { this._state = {}; } return this; }; simpleState.prototype.save = function () { if (!this._state) { return; } // prepare cookie value and save this.write(this.cookieName, JSON.stringify(this._state)); }; simpleState.prototype.get = function (key, defaultValue) { // load data if necessary if (!this._state) { this.load(); } var st = this._state; if (st) { var c = st[key]; if (!c || (typeof c === "number" && isNaN(c))) { return defaultValue; } return c; } return defaultValue; }; simpleState.prototype.set = function (key, value, skipAutoSave) { // load data if necessary if (!this._state) { this.load(); } // update value if (!value) { delete this._state[key]; } else { this._state[key] = value; } // try to save if (!skipAutoSave) { this.save(); } return this; }; simpleState.prototype.clear = function () { this._state = {}; this.save(); }; var simplePageState = new simpleState({ persistence: "page", cookieName: "last-page-state" }); var simpleSessionState = new simpleState({ persistence: "session page", cookieName: "last-session-state" });
import { connect } from 'react-redux'; import { getErrorMessage } from '../../../../technical/network/selectors'; function mapStateToProps(state) { return { errorMessage: getErrorMessage(state), }; } function createMapDispatchToProps({ goNext }) { return (dispatch) => ({ onClick(event) { event.preventDefault(); goNext(dispatch); }, }); } export function containerFactory(component, { goNext }) { return connect( mapStateToProps, createMapDispatchToProps({ goNext }) )(component); }
const NeDB = require('nedb'); const path = require('path'); module.exports = function (app) { const dbPath = app.get('nedb'); const Model = new NeDB({ filename: path.join(dbPath, 'overlay.db'), autoload: true }); return Model; };
import PropTypes from 'prop-types' import React, { PureComponent } from 'react' import rokka from '../rokka' import Spinner from './Spinner' import FramelessLayout from './layouts/FramelessLayout' import { login, setAlert } from '../state' import cx from 'classnames' function hasUpperCase(str) { return str.toLowerCase() !== str } class Signup extends PureComponent { constructor() { super() this.state = { email: '', organization: '', showTransition: false, showLoader: false, organizationOnlyLowercaseError: false } this.onSubmit = this.onSubmit.bind(this) } onSubmit(e) { e.preventDefault() this.setState({ showLoader: true }) rokka() .users.create(this.state.email, this.state.organization) .then(response => { return login(this.state.organization, response.body.api_key, done => { setAlert( 'success', 'Successfully signed up. You will receive an email with the credentials', 5000 ) this.setState({ showLoader: false }) this.props.router.history.push('/') done() }) }) .catch(err => { this.setState({ showLoader: false }) let message = err.error.error.message if (err.statusCode === 403 || err.statusCode === 404) { setAlert('error', 'Authentication failed') } else if (err.statusCode === 400) { setAlert('error', message) } else { setAlert('error', 'Unknown error occurred') } }) } onChange(e) { let { organizationOnlyLowercaseError } = this.state const target = e.target let value = target.value const name = target.name if (name === 'organization' && hasUpperCase(value)) { value = value.toLowerCase() organizationOnlyLowercaseError = true } this.setState({ [name]: value, organizationOnlyLowercaseError }) } render() { const { organization, organizationOnlyLowercaseError, email } = this.state return ( <FramelessLayout {...this.props}> <div className="rka-signup-container"> <div className="row"> <div className="col-md-5"> <div className="rka-signup-brand"> <i className="rka-header-logo mb-lg" /> <h2 className="txt-white rka-h2"> Start for free. Try out rokka without any risk. </h2> <p className="mt-sm txt-white"> You can use rokka with up to 2 GB of space and 5 GB of traffic per month for free. </p> <p className="txt-white">No credit card required.</p> <p className="rka-login-brand-powered">Powered by Liip.</p> </div> </div> <div className="col-md-7"> <div className="rka-signup-form-container"> <form onSubmit={this.onSubmit}> <div className="rka-form-group"> <label className="rka-label" htmlFor="organization"> Organization </label> <input className="rka-input-txt" type="text" value={organization} id="organization" name="organization" onChange={e => this.onChange(e)} /> {organizationOnlyLowercaseError && ( <div className="mt-xs txt-xs txt-gray"> Organizations can only be in lowercase </div> )} </div> <div className="rka-form-group"> <label className="rka-label" htmlFor="email"> E-mail </label> <input className="rka-input-txt" value={email} type="email" id="email" name="email" onChange={e => this.onChange(e)} /> </div> <button className={cx('rka-button rka-button-brand mt-sm', { disabled: this.state.showLoader })} type="submit" > {this.state.showLoader ? ( <div className="sk-cube-small sk-cube-white"> <Spinner /> </div> ) : ( 'Start your free account' )} </button> <p className="txt-gray-darkest mt-md lh-lg"> By creating an account, you agree to rokka's <a href="http://rokka.io/assets/pdf/Rokka_Terms_of_use_EN.pdf" target="_blank" rel="noopener noreferrer" className="pl-xs rka-link" > Terms & Conditions </a> </p> </form> </div> </div> </div> </div> </FramelessLayout> ) } } Signup.propTypes = { router: PropTypes.shape({ history: PropTypes.shape({ push: PropTypes.func.isRequired }).isRequired }).isRequired } export default Signup
export class CreateRoleWindow { load() { $(document).ready(() => { const _roleAppService = abp.services.app.role; const $container = $("#container"); const $form = $("#createRoleForm"); $container .jstree({ "checkbox": { keep_selected_style: false, three_state: false, cascade: '' }, 'plugins': ["wholerow", "html_data", "checkbox", "ui"], 'core': { "multiple": true, 'themes': { 'name': 'proton', 'responsive': true } } }); $container.on('ready.jstree', () => { $container.jstree("open_all"); }); $container.on("changed.jstree", (e, data) => { if (!data.node) { return; } let childrenNodes; if (data.node.state.selected) { selectNodeAndAllParents($container.jstree('get_parent', data.node)); childrenNodes = $.makeArray($container.jstree('get_children_dom', data.node)); $container.jstree('select_node', childrenNodes); } else { childrenNodes = $.makeArray($container.jstree('get_children_dom', data.node)); $container.jstree('deselect_node', childrenNodes); } }); let selectNodeAndAllParents = (node) => { $container.jstree('select_node', node, true); let parent = $container.jstree('get_parent', node); if (parent) { selectNodeAndAllParents(parent); } }; $form.on("submit", (e) => { e.preventDefault(); let data = { Permissions: [], DisplayName: $("#DisplayName").val(), Name: $("#DisplayName").val(), IsDefault: $("#IsDefault").is(":checked") } let selected = $container.jstree('get_selected'); $(selected).each((index, v) => { data.Permissions.push({ Name: v, Granted: true }); }); abp.ui.setBusy($form, _roleAppService.createRole(data).done(() => { periModal.close(); })); }); }); } }
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const InnerGraph = require("../optimize/InnerGraph"); const ConstDependency = require("./ConstDependency"); const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDependency"); const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency"); const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency"); const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency"); const { harmonySpecifierTag } = require("./HarmonyImportDependencyParserPlugin"); const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency"); module.exports = class HarmonyExportDependencyParserPlugin { constructor(options) { const { module: moduleOptions } = options; this.strictExportPresence = moduleOptions.strictExportPresence; this.importAwait = options.importAwait; } apply(parser) { parser.hooks.export.tap( "HarmonyExportDependencyParserPlugin", statement => { const dep = new HarmonyExportHeaderDependency( statement.declaration && statement.declaration.range, statement.range ); dep.loc = Object.create(statement.loc); dep.loc.index = -1; parser.state.module.addPresentationalDependency(dep); return true; } ); parser.hooks.exportImport.tap( "HarmonyExportDependencyParserPlugin", (statement, source) => { parser.state.lastHarmonyImportOrder = (parser.state.lastHarmonyImportOrder || 0) + 1; const clearDep = new ConstDependency("", statement.range); clearDep.loc = Object.create(statement.loc); clearDep.loc.index = -1; parser.state.module.addPresentationalDependency(clearDep); const sideEffectDep = new HarmonyImportSideEffectDependency( source, parser.state.lastHarmonyImportOrder ); sideEffectDep.await = statement.await; sideEffectDep.loc = Object.create(statement.loc); sideEffectDep.loc.index = -1; parser.state.current.addDependency(sideEffectDep); if (statement.await && !this.importAwait) { throw new Error( "Used 'export await' but import-await experiment is not enabled (set experiments.importAwait: true to enable it)" ); } return true; } ); parser.hooks.exportExpression.tap( "HarmonyExportDependencyParserPlugin", (statement, expr) => { const comments = parser.getComments([ statement.range[0], expr.range[0] ]); const dep = new HarmonyExportExpressionDependency( expr.range, statement.range, comments .map(c => { switch (c.type) { case "Block": return `/*${c.value}*/`; case "Line": return `//${c.value}\n`; } return ""; }) .join("") ); dep.loc = Object.create(statement.loc); dep.loc.index = -1; parser.state.current.addDependency(dep); InnerGraph.addVariableUsage( parser, expr.type.endsWith("Declaration") && expr.id ? expr.id.name : "*default*", "default" ); return true; } ); parser.hooks.exportSpecifier.tap( "HarmonyExportDependencyParserPlugin", (statement, id, name, idx) => { const settings = parser.getTagData(id, harmonySpecifierTag); let dep; const harmonyNamedExports = (parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set()); harmonyNamedExports.add(name); InnerGraph.addVariableUsage(parser, id, name); if (settings) { dep = new HarmonyExportImportedSpecifierDependency( settings.source, settings.sourceOrder, settings.ids, name, harmonyNamedExports, null, this.strictExportPresence ); dep.await = settings.await; } else { dep = new HarmonyExportSpecifierDependency(id, name); } dep.loc = Object.create(statement.loc); dep.loc.index = idx; parser.state.current.addDependency(dep); return true; } ); parser.hooks.exportImportSpecifier.tap( "HarmonyExportDependencyParserPlugin", (statement, source, id, name, idx) => { const harmonyNamedExports = (parser.state.harmonyNamedExports = parser.state.harmonyNamedExports || new Set()); let harmonyStarExports = null; if (name) { harmonyNamedExports.add(name); } else { harmonyStarExports = parser.state.harmonyStarExports = parser.state.harmonyStarExports || []; } const dep = new HarmonyExportImportedSpecifierDependency( source, parser.state.lastHarmonyImportOrder, id ? [id] : [], name, harmonyNamedExports, harmonyStarExports && harmonyStarExports.slice(), this.strictExportPresence ); if (harmonyStarExports) { harmonyStarExports.push(dep); } dep.await = statement.await; dep.loc = Object.create(statement.loc); dep.loc.index = idx; parser.state.current.addDependency(dep); return true; } ); } };
import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' import { provideHooks } from 'redial' import { Link } from 'react-router' import { loadCategories, loadTags } from '../../actions/home' const hooks = { fetch: ({ dispatch }) => Promise.all( [dispatch(loadCategories()), dispatch(loadTags())] ) } export default class Home extends Component { static propTypes = { isLoadingTags: PropTypes.bool.isRequired, isLoadingCategories: PropTypes.bool.isRequired, categoryCount: PropTypes.number.isRequired, categories: PropTypes.array.isRequired, tagCount: PropTypes.number.isRequired, tags: PropTypes.array.isRequired, } render() { const { categories, tags, categoryCount, tagCount, isLoadingTags, isLoadingCategories } = this.props return ( <div> <h3>Categories</h3> { isLoadingCategories && <div>Loading Categories...</div> } { !isLoadingCategories && <div> <p>Has total {categoryCount} categories</p> <ul> {categories.map(({ slug, name }, idx) => ( <li key={idx}> <Link to={`/category/${slug}`}>{name}</Link> </li> ))} </ul> </div>} <h3>Tags</h3> { isLoadingTags && <div>Loading Tags...</div> } { !isLoadingTags && <div> <p>Has total {tagCount} tags</p> <ul> {tags.map(({ slug, name }, idx) => ( <li key={idx}> <Link to={`/tag/${slug}`}>{name}</Link> </li> ))} </ul> </div>} </div> ) } } const ReduxComponent = connect(state => state.home)(Home) export default provideHooks(hooks)(ReduxComponent)
/** * Подключиться к БД * Создать проект и сохранить его идентификатор * Попробовать: * добавить к проекту не существующий email * добавить к проекту */ 'use strict'; const mongo = require('../../libs/db.js'); const config = require('../../config'); const ObjectId = require('mongodb').ObjectId; const invite = require('../../models/project/invite.js').invite; describe('invite(id, email)', function() { let db, projectId, userId; before('подключение к БД', function(done) { mongo.connect(config.get('db:url'), function(err) { if (err) { throw err; } db = mongo.get(); db.users.insertOne( { email: 'use@email.net' }, function(err, r) { if (err) { throw err; } userId = r.insertedId; done(); } ); }); }); after(function(done) { db.users.deleteOne( { _id: userId }, function(err, r) { if (err) { throw err; } done(); } ); }); beforeEach(function(done) { db.projects.insertOne( { name: 'test-project', team: [userId] }, function(err, r) { if (err) { throw err; } projectId = r.insertedId; done(); } ); }); afterEach(function(done) { db.projects.deleteOne( { _id: projectId }, function(err, r) { if (err) { throw err; } done(); } ); }); describe('вызывает колбек с ошибкой', function() { it('при некорректном адресе', function(done) { invite(projectId, 'badEmail', function(err) { if (err) { done(); } else { done(new Error('ошибка не возвращена')); } }); }); it('при незарегистрированом адресе', function(done) { invite(projectId, 'not@register', function(err) { if (err) { done(); } else { done(new Error('ошибка не возвращена')); } }); }); it('когда пользователь уже состоит в проекте', function(done) { invite(projectId, 'use@email.net', function(err) { if (err) { done(); } else { done(new Error('щшибка не возвращена')); } }); }); }); describe('добавляет пользователя в проект', function() { const email = 'user@email.net'; let userId; before('Создать пользователя', function(done) { db.users.insertOne( { email: email, projects: [] }, function(err, r) { if (err) { throw err; } userId = r.insertedId; done(); } ); }); after('Удаляет пользователя', function(done) { db.users.deleteOne( { _id: userId }, function(err, r) { if (err) { throw err; } done(); } ); }); it('когда все ок', function(done) { invite(projectId, email, function(err) { if (err) { return done(err); } db.users.findOne( { projects: projectId }, function(err, doc) { if (err) { return done(err); } if (!doc) { return done(new Error('Пользователю проект не добавлен')); } db.projects.findOne( { team: userId }, function(err, doc) { if (err) { return done(err); } if (!doc) { return done(new Error('В проект не добавлен пользователь')); } return done(); } ); } ); }); }); }); });
;(function($, crud, win){ var i18n = win.i18n; bind_events(); $.widget("crud.crud_form", { options: {}, _create: function() { console.log('form created'); var $form = this.element; var self = this; //init controls crud.trigger('form.init', {form: $form}); $form.find('.nav-tabs li').on('click', function () { crud.trigger('form.tab_click', {form: $form, tab: $(this)}); }); $("[required]", $form).each(function(){ var validator = $(this).data('crud-validator'); if (validator) { var v = validator.split(","); if ($.inArray('required', v) < 0) { v.push('required'); } validator = v.join(","); } else { validator = "required"; } $(this).removeAttr('required').attr('data-crud-validator',validator).data('crud-validator', validator); }); //submit $('input[type=submit],button[type=submit]', $form).on('click', function () { var frm = $(this).parents("form:first"); prepare_form(frm, $(this)); }); $form.on('submit', function(e){ e.preventDefault(); crud.trigger('form.before_validate', {form: $form}); if (!validate_form($form)) { return; } crud.trigger('form.before_submit', {form: $form}); $form.ajaxSubmit({ type: $form.attr('method'), url: $form.attr('action'), dataType: 'json', context: crud.doc.body, success: function(res){ crud.trigger('form.after_submit', {form: $form}); if (res.success) { if ($form.data('crud_model')) { var ref_scope = $form.data('crud_model')+'_'+$form.data('crud_scope'); var ref_model = $form.data('crud_model'); if ($form.data('close')) { crud.trigger("crud.reload", res); crud.trigger('crud.cancel_edit', {rel:$form.data('rel')}); } else { crud.trigger("crud.reload", res); var ref = $form.data('crud_model') + '_' + $form.data('crud_scope'); var table = $('*[data-list_table_ref='+ref+']'); if (table.data('form_type') == 'tabs') { crud.trigger('crud.cancel_edit', {rel:$form.data('rel')}); } crud.trigger('crud.edit_element', { id: res.crud_id, ref: ref_scope, model: ref_model}); } //$form.trigger('reset'); //crud.reset_selects(); } else { if (res.message) { alert(res.message); } if ($form.data('callback_event')) { crud.trigger($form.data('callback_event')); } crud.trigger('crud.submitted', {form_id: $form.attr('id'), res: res, frm: $form}); } if ($form.data("close")) { $form.parents(".modal:first").modal('hide'); } if ($form.data("reload")) { if (crud.loc.href.indexOf('#') > 0) { crud.loc.assign(crud.loc.href.substr(0, crud.loc.href.indexOf('#'))); } else { crud.loc.reload(); } } } else { if (typeof res.errors != "undefined") { for (var f in res.errors) { self.showError(f, res.errors[f].join('<br />')); } self.gotoError(); crud.trigger('crud.error', {form: $form, resp: res}); } else { alert(crud.format_error(res.error)); } } }, error: function(res){ //crud.trigger('form.error_submit', {form: $form}); //crud.toggle_form_progress($form); if (res.responseJSON && res.responseJSON.error && res.responseJSON.error.message) { alert(res.responseJSON.error.message) } else { alert(i18n.say('error_sending_request')); } } }); }); $('input[type=file]', $form).on('change', function (e) { var spl = $(this).val().split("\\"); var name = spl[(spl.length-1)]; var expl_name = name.split("."); name = expl_name[0]; $("input[data-title_for='"+$(this).attr('name')+"']", $form).val(name); }); $($form).on('change', 'select,input', function(e){ crud.trigger('form.change', {form: $form, elem: $(this)}); }); }, showFields: function(names) { for (var i in names) { //alert(names[i]+ ':' +$(".form-group[data-ref="+names[i]+"]", this.element).length); var c = $(".form-group[data-ref="+names[i]+"]", this.element); c.show(); //$("[data-crud-validator]", c).each(function(){ // var v = $(this).data('crud-validator'); // if ((""+v).substr(0, 1) == "~") // { // v = (""+v).substr(1); // } // $(this).attr('data-crud-validator', v).data('crud-validator', v); //}); $("[data-crud-validator]", c).data('crud-validator-disabled', '0').attr('data-crud-validator-disabled', '0'); //var e = $("[data-crud-validator]", c); //e.data('crud-validator-disabled', e.data('crud-validator')).attr('data-crud-validator', 'required'); } }, hideFields: function(names) { for (var i in names) { var c = $(".form-group[data-ref="+names[i]+"]", this.element); c.hide(); //$("[data-crud-validator]", c).each(function(){ // var v = $(this).data('crud-validator'); // if ((""+v).substr(0, 1) != "~") // { // v = "~" + (""+v); // } // $(this).attr('data-crud-validator', v).data('crud-validator', v); //}); //$("[data-crud-validator=required]", $(".row[data-ref="+names[i]+"]", this.element)).data('crud-validator', 'required-disabled').attr('data-crud-validator', 'required-disabled'); $("[data-crud-validator]", c).data('crud-validator-disabled', '1').attr('data-crud-validator-disabled', '1'); } }, resetErrors: function() { $(".has-error", this.element).removeClass("has-error").find('*[data-rel=error]').hide(); $("[data-remote-validator]", this.element).removeAttr("data-remote-validator"); }, showError: function(control, message) { var p = this.element; if (control.indexOf('.') > 0) { var segments = control.split('.'); $('[data-context-limiter]', this.element).each(function(){ var c = $(this); if (c.data('model') === segments[0] && parseInt(c.data('id')) === parseInt(segments[1])) { p = c; control = segments[2]; } }); } var row = $(".form-group[data-ref="+control+"]", p); //$(".form-group:first", row).addClass("has-error").find('*[data-rel=error]').html(message).show(); row.addClass("has-error").find('*[data-rel=error]').html(message).show(); }, gotoError: function() { var e = $('.has-error:first', this.element); if (e.length < 1) { return; } if ($("[data-toggle=tab]", this.element).length > 0) { var tab = e.parents(".tab-pane:first").attr('id'); if (tab) { $(".nav-tabs", this.element).find("a[href='#"+tab+"']").click(); } } $('html, body').animate({ scrollTop: e.offset().top }, 500); } }); function bind_events() { var crud_actions = { open_form: function(elem) { crud.init_modal(elem.data("model"), elem.data("id")); }, clone_fragment: function (elem) { var tpl_id = elem.data('fragment'); var container_id = elem.data('container'); var skip_arr = elem.data('skip_arr'); var only_children = elem.data('only_children'); if (only_children) { var $tpl = $($('#'+tpl_id, crud.getActiveTab(elem)).html()); } else { var $tpl = $('#'+tpl_id, crud.getActiveTab(elem)).clone(true).attr('id',''); } //console.log($tpl); var qtyAdded = $('#'+container_id, crud.getActiveTab(elem)).find('*[data-added]').length; $tpl = $($('<div>').append($tpl).html().replace(new RegExp("(\\[NUM\\])", 'g'),qtyAdded+1)); $tpl.find('*[name]').each(function () { $(this).attr('disabled', false); var name = $(this).attr('name'); if (!skip_arr) { if (name.indexOf('[]') > 0) { var newName = name.replace('[]', '[-' + (qtyAdded + 1) + ']'); $(this).attr('name', newName) } } }); $("*[data-delayed-widget]", $tpl).each(function(){ var meth = $(this).data('delayed-widget'); $(this)[meth](); }); $tpl.attr('data-added',1); //calc order var ord = $('#'+container_id, crud.getActiveTab(elem)).find('*[data-order]:visible').length; $tpl.find('*[data-order]').val((ord+1)); $tpl.appendTo($('#'+container_id, crud.getActiveTab(elem))).show(); } }; crud.add_actions(crud_actions); crud.bind('crud.cancel_edit', function(data){ //?? tab ?? var id = 'tab_'+data.rel; if ($('div#'+id+'.tab-pane').length) { var cont = $('div#'+id); cont.parents('div[data-tabs_container]').first().find('.nav-tabs li:first a:first').click(); var id = cont.attr('id'); cont.remove(); $('a[href="#'+id+'"]').parent().remove(); $("html, body").animate({ scrollTop: 0 }, "slow"); } else { //alert('hide'); $('form[data-rel='+data.rel+']').parents(".modal:first").modal('hide'); //alert('after hide'); //$('.modal-backdrop').remove(); } }); crud.bind('crud.edit_element', function(data){ if (data.ref) { data.table = $('*[data-list_table_ref='+data.ref+']'); } var model = data.table.data('crud_table')?data.table.data('crud_table'):data.table.data('crud_tree'); if (!model && data.model) { model = data.model; } if (data.table && data.table.data('form_type') == 'tabs') { //open edit tab crud.init_edit_tab(model, data.id, {table: data.table, scope: data.table.data('crud_scope'), rargs:data.rargs?data.rargs:{}}); } else { //init edit modal crud.init_modal(model, data.id, {scope: data.table.data('crud_scope'), rargs:data.rargs?data.rargs:{}}); } }); $(crud.doc).on('click', '.crud_submit', function (e) { e.preventDefault(); var frm = $(this).parents("form:first"); prepare_form(frm, $(this)); frm.submit(); }); crud.bind("form.before_submit", function(data) { toggle_progress(data['form']); init_progress(data['form']); }); crud.bind("form.after_submit", function(data){ toggle_progress(data['form']); }); crud.bind("form.error_submit", function(data){ toggle_progress(data['form']); }); crud.bind("form.init", function(data){ $("*[data-widget]", data['form']).each(function () { var wname = $(this).data('widget'); $(this)[wname](); }); }); } function prepare_form(frm, elem) { var attrs = ['close', 'reload']; for (var i =0; i<attrs.length; i++) { if (elem.data(attrs[i]) != undefined) { frm.data(attrs[i], elem.data(attrs[i])); } } } function validate_form(frm) { console.log("VALIDATING"); var valid = true; var remote = []; $(".has-error", frm).removeClass("has-error").find('*[data-rel=error]').hide(); $("[data-remote-validator]", frm).removeAttr("data-remote-validator"); return true; $('[data-crud-validator]', frm).each(function() { var e = $(this); if (e.is(":disabled")) { return; } if (e.data('crud-validator-disabled') == "1") { console.log(e.attr('name') + ' validation disabled'); return; } var validators = e.data('crud-validator').split(","); for (var i in validators) { //alert(validators[i]); switch (validators[i]) { case 'required': if (!e.val()) { valid = false; e.parents(".form-group:first").addClass("has-error").find('*[data-rel=error]').html('Это поле необходимо заполнить').show(); console.log("Error: " + e.attr('name')); } break; case 'slug': var row = {validator: 'slug', value: e.val()}; row = crud.addModelParams(row, e); e.attr("data-remote-validator", remote.length); remote.push(row); break; } } }); if (remote.length) { $.ajaxSetup({async: false}); var o = $.post(crud.format_setting('model_validate_url', {}), {validates: remote}, function(res) { $.ajaxSetup({async: true}); for (var i in res) { if (!res[i].valid) { var elm = $('[data-remote-validator='+i+']', frm); elm.parents(".form-group:first").addClass("has-error").find('*[data-rel=error]').html(res[i].error_message).show(); console.log("Error: " + elm.attr('name')); valid = false; } } }); } console.log(valid ? "SUCCESS" : "FAILED"); return valid; } function toggle_progress(elem) { $('.modal-footer button, .modal-footer .progress', elem).toggleClass('hide'); $('.modal-footer button', elem).each(function () { if (!$(this).hasClass('hide')) { $(this).removeAttr('disabled'); } }); } function init_progress(elem) { var bar = $('.modal-footer .progress .progress-bar', elem); bar.parent().removeClass('hide'); var current_perc = 0; bar.css('width', (current_perc)+'%'); var perc = 99; var progress = setInterval(function() { if (current_perc>=perc) { clearInterval(progress); } else { current_perc +=1; bar.css('width', (current_perc)+'%'); } }, 20); } })(jQuery, CRUD, window)
var stream = require('stream'), util = require('util'); var Channel = require('./channel'); var router = module.exports = {}; var Router = router.Router = function(fanout) { this.inputStream = new stream.Duplex(); this.outputStream = new stream.Duplex(); if(typeof fanout === 'boolean'){ this.fanout = fanout; } router.list.push(this); }; router.list = []; Router.prototype.matchers = []; Router.prototype.fanout = true; Router.prototype.handleMessage = function(message) { var matching, i; for (i = this.matchers.length - 1; i >= 0; i--) { matching = this.matchers[i]; if(matching(message)){ matching.stream.write(message); if(!this.fanout) break; } } }; Router.prototype.addMatcher = function(matcher, target ) { if (target !== null){ matcher.stream = target; } this.matchers.push(matcher); };
/// <reference path="../Interfaces/IDisposable.ts" /> /// <reference path="../Interfaces/ITyped.ts" /> var EndGate; (function (EndGate) { /** * Defines a type constrained event handler object that can maintain bound functions which take in a value T, U and V and trigger them on demand. */ var EventHandler3 = (function () { /** * Creates a new instance of the EventHandler3 object. */ function EventHandler3() { this._type = "Event"; this._actions = []; this._hasBindings = false; } /** * Binds the provided action to the EventHandler3. Trigger will execute all bound functions. * @param action Function to execute on EventHandler3 Trigger. */ EventHandler3.prototype.Bind = function (action) { this._actions.push(action); this._hasBindings = true; }; /** * Unbinds the provided action from the EventHandler3. * @param action Function to unbind. The action will no longer be executed when the EventHandler gets Triggered. */ EventHandler3.prototype.Unbind = function (action) { for (var i = 0; i < this._actions.length; i++) { if (this._actions[i] === action) { this._actions.splice(i, 1); this._hasBindings = this._actions.length > 0; return; } } }; /** * Determines if the EventHandler3 has active bindings. */ EventHandler3.prototype.HasBindings = function () { return this._hasBindings; }; /** * Executes all bound functions and passes the provided args to each. * @param val1 The first argument to pass to the bound functions. * @param val2 The second argument to pass to the bound functions. * @param val3 The third argument to pass to the bound functions. */ EventHandler3.prototype.Trigger = function (val1, val2, val3) { for (var i = 0; i < this._actions.length; i++) { this._actions[i](val1, val2, val3); } }; return EventHandler3; })(); EndGate.EventHandler3 = EventHandler3; })(EndGate || (EndGate = {}));
const path = require('path'); const file = 'file'; const file2 = 'file'; console.log(path.join(__dirname, file, file2));
// Karma configuration // Generated on Fri May 09 2014 17:05:10 GMT+0800 (SGT) module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'src/*.js' ], // list of files to exclude exclude: [ ], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port 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, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['Chrome', 'Firefox', 'Safari'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); };
// dependencies var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var mongoose = require('mongoose'); var passport = require('passport'); var LocalStrategy = require('passport-local').Strategy; // set up routes var main = require('./routes/main'); var api = require('./routes/api'); var users = require('./routes/user'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); // uncomment after placing your favicon in /public //app.use(favicon(__dirname + '/public/favicon.ico')); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(cookieParser()); app.use(require('express-session')({ secret: 'keyboard cat', resave: false, saveUninitialized: false })); app.use(passport.initialize()); app.use(passport.session()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', main); app.use('/api', api); app.use('/user', users); // passport config var Account = require('./models/account'); passport.use(new LocalStrategy(Account.authenticate())); passport.serializeUser(Account.serializeUser()); passport.deserializeUser(Account.deserializeUser()); // mongoose mongoose.connect('mongodb://localhost/strecku'); // catch 404 and forward to error handler app.use(function(req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); }); // error handlers // development error handler // will print stacktrace if (app.get('env') === 'development') { app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: err }); }); } // production error handler // no stacktraces leaked to user app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: {} }); }); module.exports = app;
/* jqPlot 1.0.7r1224 | (c) 2009-2013 Chris Leonello | jplot.com jsDate | (c) 2010-2013 Chris Leonello */(function(f){ f.jqplot.Trendline=function(){ this.show=f.jqplot.config.enablePlugins; this.color="#666666"; this.renderer=new f.jqplot.LineRenderer(); this.rendererOptions={ marker:{ show:false } }; this.label=""; this.type="linear"; this.shadow=true; this.markerRenderer={ show:false }; this.lineWidth=1.5; this.shadowAngle=45; this.shadowOffset=1; this.shadowAlpha=0.07; this.shadowDepth=3; this.isTrendline=true }; f.jqplot.postSeriesInitHooks.push(e); f.jqplot.postDrawSeriesHooks.push(g); f.jqplot.addLegendRowHooks.push(a); function a(k){ var j=null; if(k.trendline&&k.trendline.show){ var i=k.trendline.label.toString(); if(i){ j={ label:i, color:k.trendline.color } } } return j } function e(m,k,j,i,l){ if(this._type&&(this._type==="line"||this._type=="bar")){ this.trendline=new f.jqplot.Trendline(); i=i||{}; f.extend(true,this.trendline,{ color:this.color },j.trendline,i.trendline); this.trendline.renderer.init.call(this.trendline,null) } } function g(m,i){ i=f.extend(true,{},this.trendline,i); if(this.trendline&&i.show){ var k; var l=i.data||this.data; k=c(l,this.trendline.type); var j=i.gridData||this.renderer.makeGridData.call(this,k.data); this.trendline.renderer.draw.call(this.trendline,m,j,{ showLine:true, shadow:this.trendline.shadow }) } } function b(w,v,n){ var u=(n==null)?"linear":n; var s=w.length; var t; var z; var o=0; var m=0; var r=0; var q=0; var l=0; var j=[]; var k=[]; if(u=="linear"){ k=w; j=v }else{ if(u=="exp"||u=="exponential"){ for(var p=0;p<v.length;p++){ if(v[p]<=0){ s-- }else{ k.push(w[p]); j.push(Math.log(v[p])) } } } } for(var p=0;p<s;p++){ o=o+k[p]; m=m+j[p]; q=q+k[p]*j[p]; r=r+k[p]*k[p]; l=l+j[p]*j[p] } t=(s*q-o*m)/(s*r-o*o); z=(m-t*o)/s; return[t,z] } function h(k,j){ var i; i=b(k,j,"linear"); return[i[0],i[1]] } function d(o,m){ var k; var i=o; var n=m; k=b(i,n,"exp"); var l=Math.exp(k[0]); var j=Math.exp(k[1]); return[l,j] } function c(l,j){ var p=(j==null)?"linear":j; var n; var o; var r=[]; var q=[]; var m=[]; for(k=0;k<l.length;k++){ if(l[k]!=null&&l[k][0]!=null&&l[k][1]!=null){ r.push(l[k][0]); q.push(l[k][1]) } } if(p=="linear"){ n=h(r,q); for(var k=0;k<r.length;k++){ o=n[0]*r[k]+n[1]; m.push([r[k],o]) } }else{ if(p=="exp"||p=="exponential"){ n=d(r,q); for(var k=0;k<r.length;k++){ o=n[1]*Math.pow(n[0],r[k]); m.push([r[k],o]) } } } return{ data:m, slope:n[0], intercept:n[1] } } })(jQuery);
'use strict'; (() => { function toggleNavigationBar() { const navigationElements = document.querySelectorAll('.navigation'); for (const navigationElement of navigationElements) { navigationElement.classList.toggle('open'); } } // Hamburger button - toggles the navigation bar const hamburger = document.querySelector('#navigationHamburger'); hamburger.addEventListener('click', () => { toggleNavigationBar(); }); // Each link in the navigation bar - closes the navigation bar const navigationLinks = document.querySelectorAll('.navigation a'); for (const linkElement of navigationLinks) { linkElement.addEventListener('click', () => { toggleNavigationBar(); }); } })();
/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.lang['bn'] = { "editor": "Rich Text Editor", "editorPanel": "Rich Text Editor panel", "common": { "editorHelp": "Press ALT 0 for help", "browseServer": "ব্রাউজ সার্ভার", "url": "URL", "protocol": "প্রোটোকল", "upload": "আপলোড", "uploadSubmit": "ইহাকে সার্ভারে প্রেরন কর", "image": "ছবির লেবেল যুক্ত কর", "flash": "ফ্লাশ লেবেল যুক্ত কর", "form": "ফর্ম", "checkbox": "চেক বাক্স", "radio": "রেডিও বাটন", "textField": "টেক্সট ফীল্ড", "textarea": "টেক্সট এরিয়া", "hiddenField": "গুপ্ত ফীল্ড", "button": "বাটন", "select": "বাছাই ফীল্ড", "imageButton": "ছবির বাটন", "notSet": "<সেট নেই>", "id": "আইডি", "name": "নাম", "langDir": "ভাষা লেখার দিক", "langDirLtr": "বাম থেকে ডান (LTR)", "langDirRtl": "ডান থেকে বাম (RTL)", "langCode": "ভাষা কোড", "longDescr": "URL এর লম্বা বর্ণনা", "cssClass": "স্টাইল-শীট ক্লাস", "advisoryTitle": "পরামর্শ শীর্ষক", "cssStyle": "স্টাইল", "ok": "ওকে", "cancel": "বাতিল", "close": "Close", "preview": "প্রিভিউ", "resize": "Resize", "generalTab": "General", "advancedTab": "এডভান্সড", "validateNumberFailed": "This value is not a number.", "confirmNewPage": "Any unsaved changes to this content will be lost. Are you sure you want to load new page?", "confirmCancel": "You have changed some options. Are you sure you want to close the dialog window?", "options": "Options", "target": "টার্গেট", "targetNew": "New Window (_blank)", "targetTop": "Topmost Window (_top)", "targetSelf": "Same Window (_self)", "targetParent": "Parent Window (_parent)", "langDirLTR": "বাম থেকে ডান (LTR)", "langDirRTL": "ডান থেকে বাম (RTL)", "styles": "স্টাইল", "cssClasses": "স্টাইল-শীট ক্লাস", "width": "প্রস্থ", "height": "দৈর্ঘ্য", "align": "এলাইন", "alignLeft": "বামে", "alignRight": "ডানে", "alignCenter": "মাঝখানে", "alignJustify": "ব্লক জাস্টিফাই", "alignTop": "উপর", "alignMiddle": "মধ্য", "alignBottom": "নীচে", "alignNone": "None", "invalidValue": "Invalid value.", "invalidHeight": "Height must be a number.", "invalidWidth": "Width must be a number.", "invalidCssLength": "Value specified for the \"%1\" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).", "invalidHtmlLength": "Value specified for the \"%1\" field must be a positive number with or without a valid HTML measurement unit (px or %).", "invalidInlineStyle": "Value specified for the inline style must consist of one or more tuples with the format of \"name : value\", separated by semi-colons.", "cssLengthTooltip": "Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).", "unavailable": "%1<span class=\"cke_accessibility\">, unavailable</span>" }, "about": { "copy": "Copyright &copy; $1. All rights reserved.", "dlgTitle": "About CKEditor", "help": "Check $1 for help.", "moreInfo": "For licensing information please visit our web site:", "title": "About CKEditor", "userGuide": "CKEditor User's Guide" }, "basicstyles": { "bold": "বোল্ড", "italic": "ইটালিক", "strike": "স্ট্রাইক থ্রু", "subscript": "অধোলেখ", "superscript": "অভিলেখ", "underline": "আন্ডারলাইন" }, "bidi": {"ltr": "Text direction from left to right", "rtl": "Text direction from right to left"}, "blockquote": {"toolbar": "Block Quote"}, "clipboard": { "copy": "কপি", "copyError": "আপনার ব্রাউজারের সুরক্ষা সেটিংস এডিটরকে অটোমেটিক কপি করার অনুমতি দেয়নি। দয়া করে এই কাজের জন্য কিবোর্ড ব্যবহার করুন (Ctrl/Cmd+C)।", "cut": "কাট", "cutError": "আপনার ব্রাউজারের সুরক্ষা সেটিংস এডিটরকে অটোমেটিক কাট করার অনুমতি দেয়নি। দয়া করে এই কাজের জন্য কিবোর্ড ব্যবহার করুন (Ctrl/Cmd+X)।", "paste": "পেস্ট", "pasteArea": "Paste Area", "pasteMsg": "অনুগ্রহ করে নীচের বাক্সে কিবোর্ড ব্যবহার করে (<STRONG>Ctrl/Cmd+V</STRONG>) পেস্ট করুন এবং <STRONG>OK</STRONG> চাপ দিন", "securityMsg": "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", "title": "পেস্ট" }, "button": {"selectedLabel": "%1 (Selected)"}, "colorbutton": { "auto": "অটোমেটিক", "bgColorTitle": "বেকগ্রাউন্ড রং", "colors": { "000": "Black", "800000": "Maroon", "8B4513": "Saddle Brown", "2F4F4F": "Dark Slate Gray", "008080": "Teal", "000080": "Navy", "4B0082": "Indigo", "696969": "Dark Gray", "B22222": "Fire Brick", "A52A2A": "Brown", "DAA520": "Golden Rod", "006400": "Dark Green", "40E0D0": "Turquoise", "0000CD": "Medium Blue", "800080": "Purple", "808080": "Gray", "F00": "Red", "FF8C00": "Dark Orange", "FFD700": "Gold", "008000": "Green", "0FF": "Cyan", "00F": "Blue", "EE82EE": "Violet", "A9A9A9": "Dim Gray", "FFA07A": "Light Salmon", "FFA500": "Orange", "FFFF00": "Yellow", "00FF00": "Lime", "AFEEEE": "Pale Turquoise", "ADD8E6": "Light Blue", "DDA0DD": "Plum", "D3D3D3": "Light Grey", "FFF0F5": "Lavender Blush", "FAEBD7": "Antique White", "FFFFE0": "Light Yellow", "F0FFF0": "Honeydew", "F0FFFF": "Azure", "F0F8FF": "Alice Blue", "E6E6FA": "Lavender", "FFF": "White" }, "more": "আরও রং...", "panelTitle": "Colors", "textColorTitle": "টেক্স্ট রং" }, "colordialog": { "clear": "Clear", "highlight": "Highlight", "options": "Color Options", "selected": "Selected Color", "title": "Select color" }, "templates": { "button": "টেমপ্লেট", "emptyListMsg": "(কোন টেমপ্লেট ডিফাইন করা নেই)", "insertOption": "Replace actual contents", "options": "Template Options", "selectPromptMsg": "অনুগ্রহ করে এডিটরে ওপেন করার জন্য টেমপ্লেট বাছাই করুন<br>(আসল কনটেন্ট হারিয়ে যাবে):", "title": "কনটেন্ট টেমপ্লেট" }, "contextmenu": {"options": "Context Menu Options"}, "div": { "IdInputLabel": "Id", "advisoryTitleInputLabel": "Advisory Title", "cssClassInputLabel": "Stylesheet Classes", "edit": "Edit Div", "inlineStyleInputLabel": "Inline Style", "langDirLTRLabel": "Left to Right (LTR)", "langDirLabel": "Language Direction", "langDirRTLLabel": "Right to Left (RTL)", "languageCodeInputLabel": " Language Code", "remove": "Remove Div", "styleSelectLabel": "Style", "title": "Create Div Container", "toolbar": "Create Div Container" }, "toolbar": { "toolbarCollapse": "Collapse Toolbar", "toolbarExpand": "Expand Toolbar", "toolbarGroups": { "document": "Document", "clipboard": "Clipboard/Undo", "editing": "Editing", "forms": "Forms", "basicstyles": "Basic Styles", "paragraph": "Paragraph", "links": "Links", "insert": "Insert", "styles": "Styles", "colors": "Colors", "tools": "Tools" }, "toolbars": "Editor toolbars" }, "elementspath": {"eleLabel": "Elements path", "eleTitle": "%1 element"}, "find": { "find": "খোজো", "findOptions": "Find Options", "findWhat": "যা খুঁজতে হবে:", "matchCase": "কেস মিলাও", "matchCyclic": "Match cyclic", "matchWord": "পুরা শব্দ মেলাও", "notFoundMsg": "আপনার উল্লেখিত টেকস্ট পাওয়া যায়নি", "replace": "রিপ্লেস", "replaceAll": "সব বদলে দাও", "replaceSuccessMsg": "%1 occurrence(s) replaced.", "replaceWith": "যার সাথে বদলাতে হবে:", "title": "Find and Replace" }, "fakeobjects": { "anchor": "Anchor", "flash": "Flash Animation", "hiddenfield": "Hidden Field", "iframe": "IFrame", "unknown": "Unknown Object" }, "flash": { "access": "Script Access", "accessAlways": "Always", "accessNever": "Never", "accessSameDomain": "Same domain", "alignAbsBottom": "Abs নীচে", "alignAbsMiddle": "Abs উপর", "alignBaseline": "মূল রেখা", "alignTextTop": "টেক্সট উপর", "bgcolor": "বেকগ্রাউন্ড রং", "chkFull": "Allow Fullscreen", "chkLoop": "লূপ", "chkMenu": "ফ্ল্যাশ মেনু এনাবল কর", "chkPlay": "অটো প্লে", "flashvars": "Variables for Flash", "hSpace": "হরাইজন্টাল স্পেস", "properties": "ফ্লাশ প্রোপার্টি", "propertiesTab": "Properties", "quality": "Quality", "qualityAutoHigh": "Auto High", "qualityAutoLow": "Auto Low", "qualityBest": "Best", "qualityHigh": "High", "qualityLow": "Low", "qualityMedium": "Medium", "scale": "স্কেল", "scaleAll": "সব দেখাও", "scaleFit": "নিখুঁত ফিট", "scaleNoBorder": "কোনো বর্ডার নেই", "title": "ফ্ল্যাশ প্রোপার্টি", "vSpace": "ভার্টিকেল স্পেস", "validateHSpace": "HSpace must be a number.", "validateSrc": "অনুগ্রহ করে URL লিংক টাইপ করুন", "validateVSpace": "VSpace must be a number.", "windowMode": "Window mode", "windowModeOpaque": "Opaque", "windowModeTransparent": "Transparent", "windowModeWindow": "Window" }, "font": { "fontSize": {"label": "সাইজ", "voiceLabel": "Font Size", "panelTitle": "সাইজ"}, "label": "ফন্ট", "panelTitle": "ফন্ট", "voiceLabel": "ফন্ট" }, "forms": { "button": { "title": "বাটন প্রোপার্টি", "text": "টেক্সট (ভ্যালু)", "type": "প্রকার", "typeBtn": "Button", "typeSbm": "Submit", "typeRst": "Reset" }, "checkboxAndRadio": { "checkboxTitle": "চেক বক্স প্রোপার্টি", "radioTitle": "রেডিও বাটন প্রোপার্টি", "value": "ভ্যালু", "selected": "সিলেক্টেড", "required": "Required" }, "form": { "title": "ফর্ম প্রোপার্টি", "menu": "ফর্ম প্রোপার্টি", "action": "একশ্যন", "method": "পদ্ধতি", "encoding": "Encoding" }, "hidden": {"title": "গুপ্ত ফীল্ড প্রোপার্টি", "name": "নাম", "value": "ভ্যালু"}, "select": { "title": "বাছাই ফীল্ড প্রোপার্টি", "selectInfo": "তথ্য", "opAvail": "অন্যান্য বিকল্প", "value": "ভ্যালু", "size": "সাইজ", "lines": "লাইন সমূহ", "chkMulti": "একাধিক সিলেকশন এলাউ কর", "required": "Required", "opText": "টেক্সট", "opValue": "ভ্যালু", "btnAdd": "যুক্ত", "btnModify": "বদলে দাও", "btnUp": "উপর", "btnDown": "নীচে", "btnSetValue": "বাছাই করা ভ্যালু হিসেবে সেট কর", "btnDelete": "ডিলীট" }, "textarea": {"title": "টেক্সট এরিয়া প্রোপার্টি", "cols": "কলাম", "rows": "রো"}, "textfield": { "title": "টেক্সট ফীল্ড প্রোপার্টি", "name": "নাম", "value": "ভ্যালু", "charWidth": "ক্যারেক্টার প্রশস্ততা", "maxChars": "সর্বাধিক ক্যারেক্টার", "required": "Required", "type": "টাইপ", "typeText": "টেক্সট", "typePass": "পাসওয়ার্ড", "typeEmail": "Email", "typeSearch": "Search", "typeTel": "Telephone Number", "typeUrl": "URL" } }, "format": { "label": "ফন্ট ফরমেট", "panelTitle": "ফন্ট ফরমেট", "tag_address": "ঠিকানা", "tag_div": "শীর্ষক (DIV)", "tag_h1": "শীর্ষক ১", "tag_h2": "শীর্ষক ২", "tag_h3": "শীর্ষক ৩", "tag_h4": "শীর্ষক ৪", "tag_h5": "শীর্ষক ৫", "tag_h6": "শীর্ষক ৬", "tag_p": "সাধারণ", "tag_pre": "ফর্মেটেড" }, "horizontalrule": {"toolbar": "রেখা যুক্ত কর"}, "iframe": { "border": "Show frame border", "noUrl": "Please type the iframe URL", "scrolling": "Enable scrollbars", "title": "IFrame Properties", "toolbar": "IFrame" }, "image": { "alt": "বিকল্প টেক্সট", "border": "বর্ডার", "btnUpload": "ইহাকে সার্ভারে প্রেরন কর", "button2Img": "Do you want to transform the selected image button on a simple image?", "hSpace": "হরাইজন্টাল স্পেস", "img2Button": "Do you want to transform the selected image on a image button?", "infoTab": "ছবির তথ্য", "linkTab": "লিংক", "lockRatio": "অনুপাত লক কর", "menu": "ছবির প্রোপার্টি", "resetSize": "সাইজ পূর্বাবস্থায় ফিরিয়ে দাও", "title": "ছবির প্রোপার্টি", "titleButton": "ছবি বাটন প্রোপার্টি", "upload": "আপলোড", "urlMissing": "Image source URL is missing.", "vSpace": "ভার্টিকেল স্পেস", "validateBorder": "Border must be a whole number.", "validateHSpace": "HSpace must be a whole number.", "validateVSpace": "VSpace must be a whole number." }, "indent": {"indent": "ইনডেন্ট বাড়াও", "outdent": "ইনডেন্ট কমাও"}, "smiley": {"options": "Smiley Options", "title": "স্মাইলী যুক্ত কর", "toolbar": "স্মাইলী"}, "justify": { "block": "ব্লক জাস্টিফাই", "center": "মাঝ বরাবর ঘেষা", "left": "বা দিকে ঘেঁষা", "right": "ডান দিকে ঘেঁষা" }, "language": {"button": "Set language", "remove": "Remove language"}, "link": { "acccessKey": "এক্সেস কী", "advanced": "এডভান্সড", "advisoryContentType": "পরামর্শ কন্টেন্টের প্রকার", "advisoryTitle": "পরামর্শ শীর্ষক", "anchor": { "toolbar": "নোঙ্গর", "menu": "নোঙর প্রোপার্টি", "title": "নোঙর প্রোপার্টি", "name": "নোঙরের নাম", "errorName": "নোঙরের নাম টাইপ করুন", "remove": "Remove Anchor" }, "anchorId": "নোঙরের আইডি দিয়ে", "anchorName": "নোঙরের নাম দিয়ে", "charset": "লিংক রিসোর্স ক্যারেক্টর সেট", "cssClasses": "স্টাইল-শীট ক্লাস", "emailAddress": "ইমেইল ঠিকানা", "emailBody": "মেসেজের দেহ", "emailSubject": "মেসেজের বিষয়", "id": "আইডি", "info": "লিংক তথ্য", "langCode": "ভাষা লেখার দিক", "langDir": "ভাষা লেখার দিক", "langDirLTR": "বাম থেকে ডান (LTR)", "langDirRTL": "ডান থেকে বাম (RTL)", "menu": "লিংক সম্পাদন", "name": "নাম", "noAnchors": "(No anchors available in the document)", "noEmail": "অনুগ্রহ করে ইমেইল এড্রেস টাইপ করুন", "noUrl": "অনুগ্রহ করে URL লিংক টাইপ করুন", "other": "<other>", "popupDependent": "ডিপেন্ডেন্ট (Netscape)", "popupFeatures": "পপআপ উইন্ডো ফীচার সমূহ", "popupFullScreen": "পূর্ণ পর্দা জুড়ে (IE)", "popupLeft": "বামের পজিশন", "popupLocationBar": "লোকেশন বার", "popupMenuBar": "মেন্যু বার", "popupResizable": "Resizable", "popupScrollBars": "স্ক্রল বার", "popupStatusBar": "স্ট্যাটাস বার", "popupToolbar": "টুল বার", "popupTop": "ডানের পজিশন", "rel": "Relationship", "selectAnchor": "নোঙর বাছাই", "styles": "স্টাইল", "tabIndex": "ট্যাব ইন্ডেক্স", "target": "টার্গেট", "targetFrame": "<ফ্রেম>", "targetFrameName": "টার্গেট ফ্রেমের নাম", "targetPopup": "<পপআপ উইন্ডো>", "targetPopupName": "পপআপ উইন্ডোর নাম", "title": "লিংক", "toAnchor": "এই পেজে নোঙর কর", "toEmail": "ইমেইল", "toUrl": "URL", "toolbar": "লিংক যুক্ত কর", "type": "লিংক প্রকার", "unlink": "লিংক সরাও", "upload": "আপলোড" }, "list": {"bulletedlist": "বুলেট লিস্ট লেবেল", "numberedlist": "সাংখ্যিক লিস্টের লেবেল"}, "liststyle": { "armenian": "Armenian numbering", "bulletedTitle": "Bulleted List Properties", "circle": "Circle", "decimal": "Decimal (1, 2, 3, etc.)", "decimalLeadingZero": "Decimal leading zero (01, 02, 03, etc.)", "disc": "Disc", "georgian": "Georgian numbering (an, ban, gan, etc.)", "lowerAlpha": "Lower Alpha (a, b, c, d, e, etc.)", "lowerGreek": "Lower Greek (alpha, beta, gamma, etc.)", "lowerRoman": "Lower Roman (i, ii, iii, iv, v, etc.)", "none": "None", "notset": "<not set>", "numberedTitle": "Numbered List Properties", "square": "Square", "start": "Start", "type": "Type", "upperAlpha": "Upper Alpha (A, B, C, D, E, etc.)", "upperRoman": "Upper Roman (I, II, III, IV, V, etc.)", "validateStartNumber": "List start number must be a whole number." }, "magicline": {"title": "Insert paragraph here"}, "maximize": {"maximize": "Maximize", "minimize": "Minimize"}, "newpage": {"toolbar": "নতুন পেজ"}, "pagebreak": {"alt": "Page Break", "toolbar": "পেজ ব্রেক"}, "pastetext": {"button": "সাদা টেক্সট হিসেবে পেস্ট কর", "title": "সাদা টেক্সট হিসেবে পেস্ট কর"}, "pastefromword": { "confirmCleanup": "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", "error": "It was not possible to clean up the pasted data due to an internal error", "title": "পেস্ট (শব্দ)", "toolbar": "পেস্ট (শব্দ)" }, "preview": {"preview": "প্রিভিউ"}, "print": {"toolbar": "প্রিন্ট"}, "removeformat": {"toolbar": "ফরমেট সরাও"}, "save": {"toolbar": "সংরক্ষন কর"}, "selectall": {"toolbar": "সব সিলেক্ট কর"}, "showblocks": {"toolbar": "Show Blocks"}, "sourcearea": {"toolbar": "সোর্স"}, "specialchar": { "options": "Special Character Options", "title": "বিশেষ ক্যারেক্টার বাছাই কর", "toolbar": "বিশেষ অক্ষর যুক্ত কর" }, "scayt": { "btn_about": "About SCAYT", "btn_dictionaries": "Dictionaries", "btn_disable": "Disable SCAYT", "btn_enable": "Enable SCAYT", "btn_langs": "Languages", "btn_options": "Options", "text_title": "Spell Check As You Type" }, "stylescombo": { "label": "স্টাইল", "panelTitle": "Formatting Styles", "panelTitle1": "Block Styles", "panelTitle2": "Inline Styles", "panelTitle3": "Object Styles" }, "table": { "border": "বর্ডার সাইজ", "caption": "শীর্ষক", "cell": { "menu": "সেল", "insertBefore": "Insert Cell Before", "insertAfter": "Insert Cell After", "deleteCell": "সেল মুছে দাও", "merge": "সেল জোড়া দাও", "mergeRight": "Merge Right", "mergeDown": "Merge Down", "splitHorizontal": "Split Cell Horizontally", "splitVertical": "Split Cell Vertically", "title": "Cell Properties", "cellType": "Cell Type", "rowSpan": "Rows Span", "colSpan": "Columns Span", "wordWrap": "Word Wrap", "hAlign": "Horizontal Alignment", "vAlign": "Vertical Alignment", "alignBaseline": "Baseline", "bgColor": "Background Color", "borderColor": "Border Color", "data": "Data", "header": "Header", "yes": "Yes", "no": "No", "invalidWidth": "Cell width must be a number.", "invalidHeight": "Cell height must be a number.", "invalidRowSpan": "Rows span must be a whole number.", "invalidColSpan": "Columns span must be a whole number.", "chooseColor": "Choose" }, "cellPad": "সেল প্যাডিং", "cellSpace": "সেল স্পেস", "column": { "menu": "কলাম", "insertBefore": "Insert Column Before", "insertAfter": "Insert Column After", "deleteColumn": "কলাম মুছে দাও" }, "columns": "কলাম", "deleteTable": "টেবিল ডিলীট কর", "headers": "Headers", "headersBoth": "Both", "headersColumn": "First column", "headersNone": "None", "headersRow": "First Row", "invalidBorder": "Border size must be a number.", "invalidCellPadding": "Cell padding must be a positive number.", "invalidCellSpacing": "Cell spacing must be a positive number.", "invalidCols": "Number of columns must be a number greater than 0.", "invalidHeight": "Table height must be a number.", "invalidRows": "Number of rows must be a number greater than 0.", "invalidWidth": "Table width must be a number.", "menu": "টেবিল প্রোপার্টি", "row": { "menu": "রো", "insertBefore": "Insert Row Before", "insertAfter": "Insert Row After", "deleteRow": "রো মুছে দাও" }, "rows": "রো", "summary": "সারাংশ", "title": "টেবিল প্রোপার্টি", "toolbar": "টেবিলের লেবেল যুক্ত কর", "widthPc": "শতকরা", "widthPx": "পিক্সেল", "widthUnit": "width unit" }, "undo": {"redo": "রি-ডু", "undo": "আনডু"}, "wsc": { "btnIgnore": "ইগনোর কর", "btnIgnoreAll": "সব ইগনোর কর", "btnReplace": "বদলে দাও", "btnReplaceAll": "সব বদলে দাও", "btnUndo": "আন্ডু", "changeTo": "এতে বদলাও", "errorLoading": "Error loading application service host: %s.", "ieSpellDownload": "বানান পরীক্ষক ইনস্টল করা নেই। আপনি কি এখনই এটা ডাউনলোড করতে চান?", "manyChanges": "বানান পরীক্ষা শেষ: %1 গুলো শব্দ বদলে গ্যাছে", "noChanges": "বানান পরীক্ষা শেষ: কোন শব্দ পরিবর্তন করা হয়নি", "noMispell": "বানান পরীক্ষা শেষ: কোন ভুল বানান পাওয়া যায়নি", "noSuggestions": "- কোন সাজেশন নেই -", "notAvailable": "Sorry, but service is unavailable now.", "notInDic": "শব্দকোষে নেই", "oneChange": "বানান পরীক্ষা শেষ: একটি মাত্র শব্দ পরিবর্তন করা হয়েছে", "progress": "বানান পরীক্ষা চলছে...", "title": "Spell Checker", "toolbar": "বানান চেক" } };
function Spot(name){ ToolBox.call(this, name); this.name = name || 'Spot box'; this.family = "spots"; this.tool = null; } Spot.prototype = Object.create(ToolBox.prototype); Spot.prototype.init = function(){ var self = this; var html = "<button type=''class='spot-btn ' data-type='hotspot-tool'>hot spot</button>"; // html += "<button type=''class='spot-btn ' data-type='round-tool'>Round</button>"; $('.sub-tool').append(html); $('.spot-btn').on('click',function(evt){ evt.preventDefault(); self.active = true; self.tool = $(this).attr('data-type'); return self; }); }
var HelloWorldLayer = cc.LayerColor.extend({ _sprite:null, ctor:function () { ////////////////////////////// // 1. super init first this._super(); this.setColor(new cc.Color(255,255,255)); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // ask the window size var size = cc.winSize; // add a "close" icon to exit the progress. it's an autorelease object var closeItem = new cc.MenuItemImage( res.CloseNormal_png, res.CloseSelected_png, function () { cc.log("Menu is clicked!"); NetworkManager.send('abccc'); }, this); closeItem.attr({ x: size.width - 20, y: 20, anchorX: 0.5, anchorY: 0.5 }); var menu = new cc.Menu(closeItem); menu.x = 0; menu.y = 0; this.addChild(menu, 1); ///////////////////////////// // 3. add your codes below... // add a label shows "Hello World" // create and initialize a label var helloLabel = new cc.LabelTTF("Hello World", "Arial", 38); // position the label on the center of the screen helloLabel.x = size.width / 2; helloLabel.y = 0; // add the label as a child to this layer this.addChild(helloLabel, 5); // add "HelloWorld" splash screen" this._sprite = new cc.Sprite(res.Character_png); this._sprite.attr({ x: size.width / 2, y: size.height / 2, scale: 1, rotation: 0 }); this.addChild(this._sprite, 7); /*this.sprite.runAction( cc.sequence( cc.rotateTo(2, 0), cc.scaleTo(2, 1, 1) ) ); helloLabel.runAction( cc.spawn( cc.moveBy(2.5, cc.p(0, size.height - 40)), cc.tintTo(2.5,255,125,0) ) );*/ NetworkManager.send('abc'); NetworkManager.PositionHandler = this; if ('mouse' in cc.sys.capabilities) cc.eventManager.addListener({ event: cc.EventListener.MOUSE, onMouseMove: function(event){ if(event.getButton() == cc.EventMouse.BUTTON_LEFT) event.getCurrentTarget().processEvent(event); } }, this); if (cc.sys.capabilities.hasOwnProperty('touches')){ cc.eventManager.addListener({ prevTouchId: -1, event: cc.EventListener.TOUCH_ALL_AT_ONCE, onTouchesMoved:function (touches, event) { var touch = touches[0]; if (this.prevTouchId != touch.getID()) this.prevTouchId = touch.getID(); else event.getCurrentTarget().processEvent(touches[0]); } }, this); } return true; }, processEvent:function (event){ var delta = event.getDelta(); var curPos = cc.p(this._sprite.x, this._sprite.y); curPos = cc.pAdd(curPos, delta); curPos = cc.pClamp(curPos, cc.p(0, 0), cc.p(cc.winSize.width, cc.winSize.height)); //this._sprite.x = curPos.x; //this._sprite.y = curPos.y; NetworkManager.setPosition(delta, new Date().getTime()); curPos = null; }, positionHandler:function(positions){ var maxTime = positions[0].time; for(var index = 0; index < positions.length; index++) { var positionData = positions[index]; if(maxTime < positionData.time) maxTime = positionData.time; } for(var index = 0; index < positions.length; index++) { var positionData = positions[index]; if(maxTime == positionData.time) { var curPos = cc.p(this._sprite.x, this._sprite.y); curPos = cc.pAdd(curPos, positionData); curPos = cc.pClamp(curPos, cc.p(0, 0), cc.p(cc.winSize.width, cc.winSize.height)); this._sprite.x = curPos.x; this._sprite.y = curPos.y; break; } } } }); var NetworkManager = new function() { var _this = this; this.socket = io.connect(); this.messages = []; this.roster = []; this.name = ''; this.PositionHandler = null; this.socket.on('connect', function () { _this.setName(); }); this.socket.on('message', function (msg) { _this.messages.push(msg); }); this.socket.on('roster', function (names) { _this.roster = names; }); this.socket.on('position', function (positions){ _this.PositionHandler.positionHandler(positions); }) this.send = function send(text) { console.log('Sending message:', text); this.socket.emit('message', text); this.text = ''; }; this.setName = function setName() { this.socket.emit('identify', name); }; this.setPosition = function setPosition(position, time) { var positionData = {x:position.x, y:position.y, time:time}; this.socket.emit('position' , positionData); } } var HelloWorldScene = cc.Scene.extend({ onEnter:function () { this._super(); var layer = new HelloWorldLayer(); this.addChild(layer, 0); } });
/** * The var name from which the data will be retrieved in the browser * * @type {String} * @const * @default */ module.exports = 'data';
'use strict'; /* * Defining the Package */ var Module = require('meanio').Module; var MeanUser = new Module('users'); /* * All MEAN packages require registration * Dependency injection is used to define required modules */ MeanUser.register(function(app, auth, passport, database) { //We enable routing. By default the Package Object is passed to the routes MeanUser.routes(app, auth, database, passport); //We are adding a link to the main menu for all authenticated users // MeanUser.menus.add({ // title: 'meanUser example page', // link: 'meanUser example page', // roles: ['authenticated'], // menu: 'main' // }); MeanUser.aggregateAsset('js', 'meanUser.js'); MeanUser.aggregateAsset('css','/lib/general/css/style.css'); MeanUser.aggregateAsset('css','/lib/general/css/style-responsive.css'); /** //Uncomment to use. Requires meanio@0.3.7 or above // Save settings with callback // Use this for saving data from administration pages MeanUser.settings({ 'someSetting': 'some value' }, function(err, settings) { //you now have the settings object }); // Another save settings example this time with no callback // This writes over the last settings. MeanUser.settings({ 'anotherSettings': 'some value' }); // Get settings. Retrieves latest saved settings MeanUser.settings(function(err, settings) { //you now have the settings object }); */ return MeanUser; });
'use strict'; import React from 'react'; import Location from './location'; import RainImage from './rainimage'; import Data from './data'; import Shelter from './shelter'; const Main = (props) => { return ( <main className="noah-main"> <Location current={props.current} list={props.list} changeLocation={props.changeLocation} /> <RainImage data={props.data} /> <Data data={props.data} /> <Shelter data={props.data} /> </main> ); }; export default Main;
#!/usr/bin/env node 'use strict'; var repreprep = require('..') , path = require('path'); var root = process.argv.length > 2 ? path.resolve(process.argv[2]) : null; repreprep(root);
function checkLoginState() { FB.getLoginStatus(function (response) { if (response.status === 'connected') { // Logged on Facebook. console.log("Connected into facebook"); FB.api("/me/picture", function (picture) { if (picture && !picture.error) { document.getElementById('profilpicture').src = picture.data.url; } }); FB.api('/me', function (response) { // document.getElementById("profilname").innerHTML = response.name; }); getPhotos(); // FB.api( // "/me/friendlists", // function (friends) { // if (friends && !friends.error) { // console.log(friends); // } // } // ); } else { // not log in Facebook //change photo profil } }); } function FBlogin() { FB.getLoginStatus(function (response) { if (response.status !== 'connected') { FB.login(function (response) { if (response.authResponse) { location.reload(); } else { console.log('User cancelled login or did not fully authorize.'); } }, { scope: 'public_profile, email, user_friends, user_photos' }); } }); } window.fbAsyncInit = function () { FB.init({ appId: '509249155890113', cookie: true, // enable cookies to allow the server to access // the session xfbml: true, // parse social plugins on this page version: 'v2.3' }); // Now that we've initialized the JavaScript SDK, we call // FB.getLoginStatus(). This function gets the state of the // person visiting this page and can return one of three states to // the callback you provide. They can be: // // 1. Logged into your app ('connected') // 2. Logged into Facebook, but not your app ('not_authorized') // 3. Not logged into Facebook and can't tell if they are logged into // your app or not. // // These three cases are handled in the callback function. FB.getLoginStatus(function (response) { checkLoginState(response); }); }; // Load the SDK asynchronously (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "https://connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
// Players const Player = require('./players/Player'); // Cards const BlackGladiator = require('./cards/heroes/BlackGladiator'); // Battle const Battle = require('./battle/Battle'); let mockDeck = []; for (let i = 0; i < 40; i++) { mockDeck.push(new BlackGladiator); } let playerOne = new Player({ firstName: 'Cezar', lastName: 'Luiz', nickname: 'Dirtyphonicz', age: 23, deck: mockDeck.slice(mockDeck) }); let playerTwo = new Player({ firstName: 'Joao', lastName: 'Luiz', nickname: 'Joaozinho123', age: 14, deck: mockDeck.slice(mockDeck) }); let battle = new Battle({ players: [playerOne, playerTwo] }); battle.starts(); battle.buyCards(1, 0); battle.drawCard(0, 0); // P1 battle.buyCards(1, 1); battle.drawCard(0, 0); // P2 battle.buyCards(1, 0); battle.drawCard(1, 1); // P1 battle.attackTo(0, 0, 0); // Target Index Field Monster, With Monster, Using this Skill battle.closeTurn(); battle.buyCards(1, 1); battle.drawCard(1, 1); // P2 battle.attackTo(0, 1, 0); // P2 Attack battle.closeTurn(); battle.buyCards(1, 0); battle.drawCard(2, 2); // P1 battle.attackTo(1, 2, 0); // battle.buyCards(3, 0); // Buy cards to P1 battle.closeTurn(); let p1Life = battle.battle.players[0].life; let p2Life = battle.battle.players[1].life; console.log(battle.battle.players); console.log(p1Life > p2Life ? 'P1 WINNER' : p2Life > p1Life ? 'P2 WINNER' : 'WE HAVE A DRAW');
/*global Lava, Firestorm */ (function (Lava, Firestorm) { 'use strict'; Lava.define( 'Lava.widget.input.AutofocusText', /** * Helper widget, that focuses input element when it's in DOM. */ { Extends: 'Lava.widget.input.Text', broadcastInDOM: function() { this.Text$broadcastInDOM(); var element = this._input_container.getDOMElement(); element.focus(); // move cursor to the end of text Firestorm.Element.setProperty(element, 'value', this._properties.value); } }); })(Lava, Firestorm);
define(function (require, exports, module) { 'use strict'; var $ = require('jquery'); module.exports = function ($el) { $el.find('.menu').on('click', function (e) { e.preventDefault(); $(this).toggleClass('is-hidden'); $('nav.main-transparent .icon-close').toggleClass('is-hidden'); $('nav.main').addClass('open-links'); $('body').on('touchmove', function (e) { e.preventDefault(); }); // Fix #DPLAT-695 setTimeout(function () { window.scrollTo(1, 1); }, 5); }); $el.find('.icon-close').on('click', function (e) { e.preventDefault(); $(this).toggleClass('is-hidden'); $('nav.main-transparent .menu').toggleClass('is-hidden'); $('nav.main').removeClass('open-links'); $('body').off('touchmove'); }); // On Scroll, make the nav translucent. $(window).on('scroll', function () { if ($(window).scrollTop() > $('nav.main').height()) { $('nav.main').addClass('active'); } else { $('nav.main').removeClass('active'); } }); // fix for ipad position fixed on keyboard focus $('input').on('focus', function () { $('nav.main').css({position: 'absolute'}); }); $('input').on('blur', function () { $('nav.main').css({position: 'fixed'}); }); }; });
import DS from 'ember-data'; export default DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), email: DS.attr('string'), twitter: DS.attr('string'), totalArticles: DS.attr('number') });
var moment = require('moment-range'); var bLocations = [ /\bBeckham Hall\b/gi, /\bDaniel Family Commons\b/gi ]; var bEventKeywords = [ /\bPA\b/g, /\bspeakers\b/gi, /\bmicrophones\b/gi, /\btable top\b/gi, /\btable-top\b/gi ]; var cEventKeywords = [ /\bwebcast\b/gi, /\bweb-cast\b/gi, /\blive streaming\b/gi, /\blive-streaming\b/gi, /\bbroadcast\b/gi, /\bvideorecording\b/gi, /\bvideo recording\b/gi, /\brecording\b/gi, /\bvideotaping\b/gi, /\bvideo taping\b/gi ]; // hasKeywords(keywords, text) = true or false // keywords are an array of regular expressions, text is a string var hasKeywords = function (keywords, text) { return keywords.reduceRight(function (init, regexp) { return init || regexp.test(text); }, false); }; // detectCategory(event) = returns "A", "B" or "C" var detectCategory = function (event) { event.category = "A"; //B event detection if(hasKeywords(bEventKeywords, event.desc)) { event.category = "B"; } // set to B if in specific locations if(hasKeywords(bLocations, event.desc)) { event.category = "B"; } //C event detection if(hasKeywords(cEventKeywords, event.desc)) { event.category = "C"; } // Check if before 9am or after 10pm var at9am = moment(event.start).hours(9).minutes(0); var at10pm = moment(event.end).hours(22).minutes(0); if(moment(event.start).isBefore(at9am) || moment(event.end).isAfter(at10pm)) { event.category = "C"; } return event.category; }; module.exports = function(event) { event.category = detectCategory(event); return event; }; // desc is the description of the event module.exports.isVideoEvent = function(desc) { return hasKeywords(cEventKeywords, desc); };
/** * @name test-code-2 */
var React = require('React'); var AboutPage = React.createClass({ render: function() { return ( <div className="body"> <div className="body-with-sidebar"> <div className="about-header header-text">About</div> <div className="about-body"> <p> Hi! My name is Paul and I like making things. Recently, I was a UI engineer at Facebook working on product as well as UI and JavaScript infrastructure. Previous Apple intern. Computer science and HCI at Carnegie Mellon. </p> <p> Twitter <a href="https://twitter.com/_paulshen">@_paulshen</a><br /> Instagram <a href="http://instagram.com/_paulshen">_paulshen</a> </p> </div> </div> </div> ); } }); module.exports = AboutPage;
/*jshint node:true*/ 'use strict'; var path = require('path'); var utils = require('../utils/utils'); var generateChangelog = require('../utils/generate-changelog'); var EOL = require('os').EOL; var gitUser = utils.getGitUserInfo(); module.exports = { name: 'genie:changelog', description: 'Create markdown changelog', works: 'insideProject', availableOptions: [ { name: 'user', type: String, default: gitUser.username }, { name: 'repo', type: String }, { name: 'version', type: String }, { name: 'new-version', type: String }, { name: 'branch', type: String, default: 'master' }, { name: 'write', type: Boolean, default: false }, { name: 'file', type: String, default: 'CHANGELOG.md' } ], run: function(options) { var self = this; var packageJson = this.project.pkg; options.repo = options.repo || packageJson.name; options.version = options.version || packageJson.version; return generateChangelog(options.user, options.repo, options.version, options.branch).then(function(changelog) { changelog = changelog || ''; if(options.write) { var changelogMd = utils.getContents.call(self, options.file, 'md'); if(changelog.length > 0) { changelog = '### Pull Requests\n\n' + changelog; } if(options.newVersion) { changelog = '## ' + options.newVersion + '\n\n' + changelog; } changelog = EOL + changelog + EOL; changelogMd = utils.insert('after', changelogMd, '# Changelog' + EOL, changelog); utils.setContents.call(self, options.file, 'md', changelogMd); } else { return self.ui.writeLine(changelog); } return changelog; }); } };
import { storiesOf } from '@storybook/polymer'; import { document } from 'global'; import { html } from 'lit-html'; import { StringTemplateButton } from '../string-template-button'; import '../separated-button/separated-button.html'; storiesOf('Custom/Methods for rendering', module) .add('html string', () => '<div>Rendered with string</div>') .add('html with custom elements', () => '<separated-button title="Click me!"></separated-button>') .add('document.createElement', () => { const el = document.createElement('playground-button'); el.setAttribute('title', 'Rendered with document.createElement'); return el; }) .add('Polymer instance', () => new StringTemplateButton()) .add( 'Lit html', () => html` <separated-button title="yes!"></separated-button> ` );
var assert = require('assert'); var postcss = require('postcss'); var cssbyebyevaluePlugin = require('../lib/css-filter-by-value'); function cssbybyeProcess(css, opts) { return postcss([cssbyebyevaluePlugin(opts)]).process(css); }; describe('css-filter-by-value', function () { it('should remove ruleset(s) with a selector that contains any of the given selectors to remove ', function (done) { var css = 'a { font-size: $some-value; } .hello .h1 { background: $brand_color} .world { color: blue }'; var declValuesToKeep = ['$some-value', '$brand_color']; var expected = 'a { font-size: $some-value; } .hello .h1 { background: $brand_color} .world { }'; var result = cssbybyeProcess(css, {valuesToKeep: declValuesToKeep}); assert.strictEqual(result.css, expected); done(); }); it('should support regex matching', function (done) { var css = '.item {} .item .desc { background: red } .list .item { color: $some_color; border: 1px solid red; }'; var declValuesToKeep = [/\$[0-9A-Za-z-_]/]; var expected = '.item {} .item .desc { } .list .item { color: $some_color; }'; var result = cssbybyeProcess(css, {valuesToKeep: declValuesToKeep}); assert.strictEqual(result.css, expected); done(); }); it('should filter for all $ vars by default', function (done) { var css = '.item {} .item .desc { background: red } .list .item { color: $some_color; border: 1px solid $brand; }'; var expected = '.item {} .item .desc { } .list .item { color: $some_color; border: 1px solid $brand; }'; var result = cssbybyeProcess(css); assert.strictEqual(result.css, expected); done(); }); });
const LANGUAGES = { en: { confirm: 'confirm', cancel: 'cancel', close: 'close', timezonePickerTitle: 'Pick a Timezone', timezonePickerLabel: 'Closest City or Timezone', am: 'AM', pm: 'PM' }, 'zh-cn': { confirm: '确认', cancel: '取消', close: '关闭', timezonePickerTitle: '选择时区', timezonePickerLabel: '最近的城市或时区', am: '上午', pm: '下午' }, 'zh-tw': { confirm: '確認', cancel: '取消', close: '關閉', timezonePickerTitle: '選擇時區', timezonePickerLabel: '最近的城市或時區', am: '上午', pm: '下午' }, fr: { confirm: 'Confirmer', cancel: 'Annulé', close: 'Arrêter', timezonePickerTitle: 'Choisissez un Timezone', timezonePickerLabel: 'Ville la plus proche ou Timezone', am: 'AM', pm: 'PM' }, ja: { confirm: '確認します', cancel: 'キャンセル', close: 'クローズ', timezonePickerTitle: 'タイムゾーンを選択する', timezonePickerLabel: '最も近い都市またはTimezone', am: 'AM', pm: 'PM' } }; const language = (type = 'en') => { return LANGUAGES[type]; }; export default { get: language };
var MyDriver = { Driver2d: function () { var that = this; var Canvas = null; var CanvasContext = null; this.RenderCanvas = function (canvas) { if (canvas instanceof HTMLElement) { Canvas = canvas; CanvasContext = canvas.getContext("2d"); } else{ console.error("parameter 'canvas' is not a HTMLElement"); } }; this.Scene = new MyDriver.Scene(); this.RenderScene = function(){ if(that.Scene !== "undefined") { if(Canvas !== null) { CanvasContext.clearRect(0,0,Canvas.width,Canvas.height); for(var i=0;i<that.Scene.Children.length;i++) { var actObject = that.Scene.Children[i]; if(actObject.ObjectType !== "undefined" && actObject.visible) { CanvasContext.beginPath(); CanvasContext.translate((actObject.Position.x-(that.Scene.Camera.Vector.x)),(actObject.Position.y-(that.Scene.Camera.Vector.y))); CanvasContext.rotate(actObject.Rotation); if(actObject.ObjectType == "image") { CanvasContext.drawImage(actObject.Image,0,0,actObject.Image.width*actObject.Scale,actObject.Image.height*actObject.Scale); } else if(actObject.ObjectType == "shape" && actObject.shapeType != "circle") { var colorString = actObject.color.toString(16); if(colorString.length < 6) { for(var c = colorString.length;c<6;c++) { colorString = "0" + colorString; } } CanvasContext.fillStyle = "#" + colorString; CanvasContext.strokeStyle = "#" + colorString; if(actObject.verticles.length > 0) { CanvasContext.moveTo(actObject.verticles[0].x,actObject.verticles[0].y); for(var j=1;j<actObject.verticles.length;j++) { CanvasContext.lineTo(actObject.verticles[j].x*actObject.Scale,actObject.verticles[j].y*actObject.Scale); } CanvasContext.lineTo(actObject.verticles[0].x*actObject.Scale,actObject.verticles[0].y*actObject.Scale); if(actObject.bordered) { CanvasContext.lineWidth = actObject.borderSize; CanvasContext.stroke(); } else{ CanvasContext.fill(); } } else{console.error("verticles are not defided");} } else if(actObject.ObjectType == "shape" && actObject.shapeType == "circle") { CanvasContext.fillStyle = "#" + actObject.color.toString(16); CanvasContext.strokeStyle = "#" + actObject.color.toString(16); if(actObject.radius) { CanvasContext.arc(0,0,actObject.radius*actObject.Scale,0,Math.PI*2); } else{console.error("radius are not defided");} if(actObject.bordered) { console.log(Canvas.Context.strokeStyle); CanvasContext.lineWidth = actObject.borderSize; CanvasContext.stroke(); } else{ CanvasContext.fill(); } } else if(actObject.ObjectType == "text") { CanvasContext.fillStyle = "#" + actObject.color.toString(16); CanvasContext.font = actObject.FontSize + " " + actObject.Font; CanvasContext.fillText(actObject.Text,0,0); } CanvasContext.closePath(); CanvasContext.rotate(-actObject.Rotation); CanvasContext.translate(-(actObject.Position.x-(that.Scene.Camera.Vector.x)),-(actObject.Position.y-(that.Scene.Camera.Vector.y))); } } CanvasContext.save(); } else{console.error("Canvas is undefined");} }else{console.error("Scene is undefined");} } }, Scene:function(){ var that = this; this.Children = []; this.Camera = new MyDriver.Camera(new MyDriver.Vector(0,0)); this.AddToScene = function(object){ if(object.ObjectType !== null) { object.Parent = that; that.Children.push(object); } } this.SetCameraMove = function(){ st37 = false; st38 = false; st39 = false; st40 = false; document.body.onkeydown = function(e){ if(e.keyCode > 36 && e.keyCode < 41) { eval("st"+e.keyCode + " = true"); } } document.body.onkeyup = function(e){ if(e.keyCode > 36 && e.keyCode < 41) { eval("st"+e.keyCode + " = false"); } } that.MoveCamera = function () { if(st37) { that.Camera.Vector.x -= 6; } if(st38) { that.Camera.Vector.y -= 6; } if(st39) { that.Camera.Vector.x += 6; } if(st40) { that.Camera.Vector.y += 6; } } } this.RemoveAt = function(i) { if(i < that.Children.length) { RemoveFromArray(i,that.Children); } } this.Remove = function() { for(var x=0;x<=arguments.length;x++) { for(var i=0;i<that.Children.length;i++) { if(arguments[x] == that.Children[i]) { RemoveFromArray(i,that.Children); return; } } } } }, Object:function(type,params){ var that = this; this.ObjectType = type !== null ? type : "object"; this.Children = []; this.Position = new MyDriver.Vector(0,0); this.Rotation = 0; this.Scale = params.scale && typeof params.scale === "number" ? params.scale : 1; this.visible = true; switch(this.ObjectType) { case "image": if(params.image && params.image instanceof HTMLElement) { this.Image = params.image; this.verticles = [ new MyDriver.Vector(-this.Image.width/2,-this.Image.height/2), new MyDriver.Vector(this.Image.width/2,-this.Image.height/2), new MyDriver.Vector(this.Image.width/2,this.Image.height/2), new MyDriver.Vector(-this.Image.width/2,this.Image.height/2) ] this.CollRange = Math.sqrt((this.Image.width/2)*(this.Image.width/2) + (this.Image.height/2)*(this.Image.height/2)); this.Position.x += this.Image.width/2; this.Position.y += this.Image.height/2; } else{this.Image = null}; break; case "shape": if(params.shapeType) { this.shapeType = params.shapeType; this.color = params.color && typeof params.color === "number" ? params.color : 0xffffff; this.bordered = params.bordered == true ? true : false; this.borderSize = params.borderSize && typeof params.borderSize == "number" ? params.borderSize : 1; switch(this.shapeType) { case "square": if(params.side) { this.side = params.side; this.verticles = [ new MyDriver.Vector(0,0), new MyDriver.Vector(this.side,0), new MyDriver.Vector(this.side,this.side), new MyDriver.Vector(0,this.side) ] this.CollRange = Math.sqrt((this.side/2)*(this.side/2) + (this.side/2)*(this.side/2)); } else{console.error("required side count in params is not definded")}; break; case "rectangle": if(params.sideX && params.sideY) { this.sideX = params.sideX; this.sideY = params.sideY; this.verticles = [ new MyDriver.Vector(0,0), new MyDriver.Vector(this.sideX,0), new MyDriver.Vector(this.sideX,this.sideY), new MyDriver.Vector(0,this.sideY) ] this.CollRange = Math.sqrt((this.sideX/2)*(this.sideX/2) + (this.sideY/2)*(this.sideY/2)); } else{console.error("required sideX or sideY count in params is not defided")}; break; case "circle": if(params.radius) { this.radius = params.radius; this.verticles = [ new MyDriver.Vector(0,-this.radius), new MyDriver.Vector(this.radius,0), new MyDriver.Vector(0,this.radius), new MyDriver.Vector(-this.radius,0) ] this.CollRange = this.radius; } else{console.error("required radius in params is not defided")}; break; default: this.verticles = params.verticles && params.verticles instanceof Array ? params.verticles : []; break; } this.Resize = function(paramets){ switch(that.shapeType) { case "square": if(paramets.side) { that.side = paramets.side; that.verticles = [ new MyDriver.Vector(0,0), new MyDriver.Vector(that.side,0), new MyDriver.Vector(that.side,that.side), new MyDriver.Vector(0,that.side) ]; that.CollRange = Math.sqrt((that.side/2)*(that.side/2) + (that.side/2)*(that.side/2)); } break; case "rectangle": if(paramets.sideX && paramets.sideY) { that.sideX = paramets.sideX; that.sideY = paramets.sideY; that.verticles = [ new MyDriver.Vector(0,0), new MyDriver.Vector(that.sideX,0), new MyDriver.Vector(that.sideX,that.sideY), new MyDriver.Vector(0,that.sideY) ] that.CollRange = Math.sqrt((that.sideX/2)*(that.sideX/2) + (that.sideY/2)*(that.sideY/2)); } break; case "circle": if(params.radius) { that.radius = paramets.radius; that.verticles = [ new MyDriver.Vector(0,-that.radius), new MyDriver.Vector(that.radius,0), new MyDriver.Vector(0,that.radius), new MyDriver.Vector(-that.radius,0) ] that.CollRange = that.radius; } break; } } } else{console.error("params are not defided")}; break; case "text": if(params.text) { this.color = params.color && typeof params.color === "number" ? params.color : 0xffffff; this.Text = params.text; this.Font = params.font ? params.font : document.body.style.fontFamily; this.FontSize = params.fontSize ? params.fontSize : "15px"; } break; } this.AddChildren = function(object){ if(object.ObjectType !== null) { object.Parent = that; that.Children.push(object); } } }, Vector:function(x,y){ var that = this; this.x = x !== "undefined" ? x : 0; this.y = y !== "undefined" ? y : 0; this.Set = function(inX,inY){ that.x = inX !== "undefined" ? inX : that.x; that.y = inY !== "undefined" ? inY : that.y; } this.SetX = function(inX) { that.x = inX !== "undefined" ? inX : that.x; } this.SetY = function(inY){ that.y = inY !== "undefined" ? inY : that.y; } }, Camera:function (vector){ var that = this; this.Vector = vector && vector instanceof MyDriver.Vector ? vector : new MyDriver.Vector(0,0); this.SetToObject = function(object) { if(object && object instanceof MyDriver.Object){ that.Vector = new MyDriver.Vector(object.Position.x,object.Position.y); } } } }
module.exports = { entry: './public/app.jsx', output: { path: __dirname, filename: './public/bundle.js' }, resolve: { root: __dirname, alias: { Greeter: 'public/components/Greeter.jsx', GreeterMessage: 'public/components/GreeterMessage.jsx', GreeterForm: 'public/components/GreeterForm.jsx', }, extensions: ['', '.js', '.jsx'] }, module: { loaders: [ { loader: 'babel-loader', query: { presets: ['react', 'es2015'] }, test: /\.jsx?$/, exclude: /(node_modules|bower_components)/ } ] } };
import transformErrorArraysToString from './transformErrorArraysToString' describe('transformErrorArraysToString', () => { it('should join array values to a string', () => { const data = { errors: { base: ['multiple', 'values'] } } const expected = { errors: { base: 'multiple. values' } } const actual = transformErrorArraysToString(data) expect(actual).toEqual(expected) }) it('should be able to process arrays with a single value', () => { const data = { errors: { base: ['single value'] } } const expected = { errors: { base: 'single value' } } const actual = transformErrorArraysToString(data) expect(actual).toEqual(expected) }) it('should ignore values that are not arrays', () => { const data = { errors: { base: 'single value' } } const expected = { errors: { base: 'single value' } } const actual = transformErrorArraysToString(data) expect(actual).toEqual(expected) }) it('should return the data unmodified if errors are missing', () => { const data = { notErrors: {} } const expected = { notErrors: {} } const actual = transformErrorArraysToString(data) expect(actual).toEqual(expected) }) })
'use strict'; require('source-map-support').install(); const DefaultContext = require('../../build/jel/DefaultContext.js').default; const ApproximateNumber = require('../../build/jel/types/ApproximateNumber.js').default; const JelBoolean = require('../../build/jel/types/JelBoolean.js').default; const Fraction = require('../../build/jel/types/Fraction.js').default; const {JelAssert, JelPromise, JelConsole} = require('../jel-assert.js'); const jelAssert = new JelAssert(); describe('ApproximateNumber', function() { let ctx; before(function(){ return DefaultContext.get().then(dc=> { ctx = dc; jelAssert.setCtx(ctx); }); }); it('creates and serializes', function() { jelAssert.equal("ApproximateNumber(1, 2)", new ApproximateNumber(1, 2)); jelAssert.equal("ApproximateNumber(1, 0)", new ApproximateNumber(1)); jelAssert.equal("1 +- 2", new ApproximateNumber(1, 2)); jelAssert.equal("1 +- 0", new ApproximateNumber(1)); jelAssert.equal("1/2+-1/4", new ApproximateNumber(new Fraction(1, 2), new Fraction(1, 4))); jelAssert.equal("4+-1/4", new ApproximateNumber(4, new Fraction(1, 4))); jelAssert.equal("1/2+-5", new ApproximateNumber(new Fraction(1, 2), 5)); jelAssert.notEqual("ApproximateNumber(1, 3)", new ApproximateNumber(1, 2)); }); it('supports approxnumber<->approxnumber arithmetic', function() { jelAssert.equal("ApproximateNumber(1, 4) + ApproximateNumber(1, 4)", new ApproximateNumber(2, 8)); jelAssert.equal("ApproximateNumber(1, 6) + ApproximateNumber(1, 4)", new ApproximateNumber(2, 10)); jelAssert.equal("ApproximateNumber(4, 8) - ApproximateNumber(1, 16)", new ApproximateNumber(3, 24)); jelAssert.equal("ApproximateNumber(1, 2) * ApproximateNumber(1, 2)", new ApproximateNumber(1, 4)); jelAssert.equal("ApproximateNumber(2, 2) * ApproximateNumber(3, 2)", new ApproximateNumber(6, 10)); jelAssert.equal("ApproximateNumber(1, 2) / ApproximateNumber(1, 2)", new ApproximateNumber(1, 4)); jelAssert.equal("ApproximateNumber(4, 2) ^ ApproximateNumber(3, 1)", new ApproximateNumber(64,8)); jelAssert.equal("ApproximateNumber(1, 0) == ApproximateNumber(1, 0)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(1, 4) == ApproximateNumber(1, 2)", JelBoolean.TRUE); jelAssert.fuzzy("ApproximateNumber(2, 4) == ApproximateNumber(1, 2)", 0.8, 0.99); jelAssert.fuzzy("ApproximateNumber(1, 4) == ApproximateNumber(6.5, 2)", 0.5001, 0.6); jelAssert.fuzzy("ApproximateNumber(-1, 2) == ApproximateNumber(-3, 2)", 0.72, 0.78); jelAssert.fuzzy("ApproximateNumber(-1, 2) == ApproximateNumber(1, 2)", 0.72, 0.78); jelAssert.fuzzy("ApproximateNumber(7, 4) == ApproximateNumber(1, 2)", 0.4, 0.4999999); jelAssert.fuzzy("ApproximateNumber(12, 4) == ApproximateNumber(1, 2)", 0.0001, 0.1); jelAssert.fuzzy("ApproximateNumber(0, 0) == ApproximateNumber(3, 2)", 0.2, 0.4); jelAssert.equal("ApproximateNumber(0, 1) == ApproximateNumber(4, 1)", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(1, 2) == ApproximateNumber(20, 2)", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(1, 4) === ApproximateNumber(1, 2)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(1, 4) === ApproximateNumber(1, 4)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(1, 4) === ApproximateNumber(2, 4)", JelBoolean.FALSE); jelAssert.fuzzy("ApproximateNumber(2, 4) != ApproximateNumber(1, 3)", 0.00001, 0.2); jelAssert.fuzzy("ApproximateNumber(7, 4) != ApproximateNumber(1, 2)", 0.50000001, 0.6); jelAssert.fuzzy("ApproximateNumber(10, 4) != ApproximateNumber(1, 2)", 0.7, 0.8); jelAssert.equal("ApproximateNumber(1, 4) != ApproximateNumber(100, 3)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(2, 4) != ApproximateNumber(2, 3)", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(2, 4) !== ApproximateNumber(1, 3)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(2, 4) !== ApproximateNumber(2, 3)", JelBoolean.FALSE); jelAssert.fuzzy("ApproximateNumber(1, 2) > ApproximateNumber(1, 3)", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(2, 2) > ApproximateNumber(1, 3)", 0.59, 0.61); jelAssert.fuzzy("ApproximateNumber(1, 0) > ApproximateNumber(1, 2)", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(100, 0) > ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 0) > ApproximateNumber(100, 2)", 0); jelAssert.fuzzy("ApproximateNumber(1, 3) < ApproximateNumber(1, 0)", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(1, 2) < ApproximateNumber(1, 3)", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(1, 2) >= ApproximateNumber(1, 3)", 0.5, 0.51); jelAssert.fuzzy("ApproximateNumber(1, 2) >= ApproximateNumber(1, 2)", 0.5, 0.51); jelAssert.fuzzy("ApproximateNumber(-1, 3) >= ApproximateNumber(-1, 2)", 0.5, 0.51); jelAssert.fuzzy("ApproximateNumber(1, 3) <= ApproximateNumber(1, 2)", 0.5, 0.51); jelAssert.fuzzy("ApproximateNumber(2, 3) <= ApproximateNumber(1, 3)", 0.4, 0.42); jelAssert.fuzzy("ApproximateNumber(2, 2) >= ApproximateNumber(1, 0)", 0.74, 0.76); jelAssert.fuzzy("ApproximateNumber(1, 2) <= ApproximateNumber(1, 3)", 0.5, 0.51); jelAssert.fuzzy("ApproximateNumber(1, 2) >> ApproximateNumber(1, 3)", 0); jelAssert.fuzzy("ApproximateNumber(1, 3) >> ApproximateNumber(1, 2)", 0); jelAssert.fuzzy("ApproximateNumber(1, 3) << ApproximateNumber(1, 3)", 0); jelAssert.fuzzy("ApproximateNumber(1, 2) << ApproximateNumber(1, 3)", 0); jelAssert.fuzzy("ApproximateNumber(2, 2) >> ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(-1, 2) << ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) >>= ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) >>= ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 3) >>= ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 3) <<= ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 3) <<= ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) <<= ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(-1, 3) <<= ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) <<= ApproximateNumber(-1, 3)", 0); }); it('supports approxnumber<->number arithmetic', function() { jelAssert.equal("ApproximateNumber(1, 4) + 2", new ApproximateNumber(3, 4)); jelAssert.equal("ApproximateNumber(4, 8) - 1", new ApproximateNumber(3, 8)); jelAssert.equal("ApproximateNumber(1, 2) * 3", new ApproximateNumber(3, 6)); jelAssert.equal("ApproximateNumber(8, 2) / 2", new ApproximateNumber(4, 4)); jelAssert.equal("ApproximateNumber(4, 2) ^ 3", new ApproximateNumber(64, 8)); jelAssert.equal("2 + ApproximateNumber(1, 4)", new ApproximateNumber(3, 4)); jelAssert.equal("5 - ApproximateNumber(4, 8)", new ApproximateNumber(1, 8)); jelAssert.equal("3 * ApproximateNumber(1, 2)", new ApproximateNumber(3, 6)); jelAssert.equal("16 / ApproximateNumber(8, 2)", new ApproximateNumber(2, 32)); jelAssert.equal("1 == ApproximateNumber(1, 0)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(1, 0) == 1", JelBoolean.TRUE); jelAssert.equal("1 == ApproximateNumber(2, 0)", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(2, 0) == 1", JelBoolean.FALSE); jelAssert.equal("1 == ApproximateNumber(1, 2)", JelBoolean.TRUE); jelAssert.fuzzy("2 == ApproximateNumber(1, 6)", 0.8, 0.99); jelAssert.fuzzy("1 == ApproximateNumber(5.5, 5)", 0.5001, 0.6); jelAssert.fuzzy("1 == ApproximateNumber(6.5, 5)", 0.4, 0.49999); jelAssert.fuzzy("ApproximateNumber(5.5, 5) == 1", 0.5001, 0.6); jelAssert.fuzzy("-1 == ApproximateNumber(-3, 6)", 0.8, 0.9); jelAssert.fuzzy("-1 == ApproximateNumber(-3, 4)", 0.72, 0.78); jelAssert.fuzzy("-1 == ApproximateNumber(1, 4)", 0.72, 0.78); jelAssert.fuzzy("ApproximateNumber(1, 4) == -1", 0.72, 0.78); jelAssert.fuzzy("7 == ApproximateNumber(1, 5)", 0.4, 0.4999999); jelAssert.fuzzy("0 == ApproximateNumber(3, 2)", 0.2, 0.4); jelAssert.equal("0 == ApproximateNumber(4, 1)", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(4, 1) == 0", JelBoolean.FALSE); jelAssert.equal("ApproximateNumber(20, 2) == 1", JelBoolean.FALSE); jelAssert.equal("1 === ApproximateNumber(1, 2)", JelBoolean.TRUE); jelAssert.fuzzy("2 != ApproximateNumber(1, 7)", 0.00001, 0.2); jelAssert.fuzzy("7 != ApproximateNumber(1, 5)", 0.50000001, 0.6); jelAssert.fuzzy("10 != ApproximateNumber(1, 5)", 0.85, 0.95); jelAssert.equal("4 != ApproximateNumber(100, 3)", JelBoolean.TRUE); jelAssert.equal("ApproximateNumber(100, 3) != 5", JelBoolean.TRUE); jelAssert.equal("2 != ApproximateNumber(2, 3)", JelBoolean.FALSE); jelAssert.equal("2 !== ApproximateNumber(1, 3)", JelBoolean.TRUE); jelAssert.equal("2 !== ApproximateNumber(2, 3)", JelBoolean.FALSE); jelAssert.fuzzy("1 > ApproximateNumber(1, 5)", 0.4, 0.49999999); jelAssert.fuzzy("2 > ApproximateNumber(1, 5)", 0.55, 0.65); jelAssert.fuzzy("1 > ApproximateNumber(1, 2)", 0.4, 0.49999999); jelAssert.fuzzy("100 > ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) > 100", 0); jelAssert.fuzzy("1 < ApproximateNumber(1, 0)", 0); jelAssert.fuzzy("ApproximateNumber(1, 3) < 1", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(1, 2) < 1", 0.4, 0.49999999); jelAssert.fuzzy("ApproximateNumber(1, 5) <= 1", 0.5, 0.51); jelAssert.fuzzy("1 >= ApproximateNumber(1, 5)", 0.5, 0.51); jelAssert.fuzzy("-1 >= ApproximateNumber(-1, 2)", 0.5, 0.51); jelAssert.fuzzy("1 <= ApproximateNumber(1, 5)", 0.5, 0.51); jelAssert.fuzzy("2 <= ApproximateNumber(1, 5)", 0.37, 0.42); jelAssert.fuzzy("ApproximateNumber(2, 2) >= 1", 0.74, 0.76); jelAssert.fuzzy("ApproximateNumber(1, 5) <= 1", 0.5, 0.51); jelAssert.fuzzy("1 >> ApproximateNumber(1, 3)", 0); jelAssert.fuzzy("ApproximateNumber(1, 3) >> 1", 0); jelAssert.fuzzy("1 << ApproximateNumber(1, 3)", 0); jelAssert.fuzzy("ApproximateNumber(1, 2) << 1", 0); jelAssert.fuzzy("2 >> ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(2, 2) >> 1", 1); jelAssert.fuzzy("-1 << ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) >>= 1", 1); jelAssert.fuzzy("1 >>= ApproximateNumber(1, 2)", 1); jelAssert.fuzzy("ApproximateNumber(1, 2) <<= 1", 1); jelAssert.fuzzy("-1 <<= ApproximateNumber(1, 3)", 1); jelAssert.fuzzy("1 <<= ApproximateNumber(-1, 3)", 0); }); it('support single-ops', function() { jelAssert.fuzzy("!ApproximateNumber(1, 4)", 0); jelAssert.fuzzy("!ApproximateNumber(-1, 6)", 0); jelAssert.fuzzy("!ApproximateNumber(0, 8)", 1); }); it('support abs', function() { jelAssert.equal("ApproximateNumber(1, 4).abs()", "ApproximateNumber(1, 4)"); jelAssert.equal("ApproximateNumber(-1, 4).abs()", "ApproximateNumber(1, 4)"); }); });
(function() { 'use strict'; var paths = require('./package.json').paths; var gulp = require('gulp'); var es = require('event-stream'); var gutil = require('gulp-util'); var conf = require('./.conf.json'); var $ = require('gulp-load-plugins')({ pattern: [ 'gulp-*', 'gulp.*', 'del', 'mkdirp' ], rename: { 'gulp-scss-lint': 'sassLint', 'gulp-scss-lint-stylish': 'sassLintStylish' }, replaceString: /\bgulp[\-.]/ }); $.browserSync = require('browser-sync').create(); var changeEvent = function(event) { gutil.log( 'File', gutil.colors.yellow(event.path.replace(__dirname, '')), 'was', gutil.colors.blue(event.type) ); }; gulp.task('default', ['serve']); /** * Server task */ gulp.task('serve', ['build'], function() { $.browserSync.init({ server: { baseDir: paths.build.base, }, port: 1337, open: true, browser: 'default', notify: false }); gulp.watch(paths.source.styles + "**/*.scss", ['build:styles']) .on('change', changeEvent); gulp.watch(paths.source.scripts + "**/*.js", ['build:scripts']) .on('change', changeEvent); gulp.watch(paths.source.images + "**/*.(jpg|png)", ['build:assets']) .on('change', changeEvent); gulp.watch(paths.source.html + '**/*.html', ['build:html']) .on('change', changeEvent); }); /** * Watcher tasks */ gulp.task('watch', [ 'watch:scripts', 'watch:styles', 'watch:html', 'watch:images' ]); gulp.task('watch:scripts', ['build:scripts'], function(cb) { var watcher = gulp.watch(paths.source.scripts + '**/*.js', [ 'build:scripts' ]); watcher.on('change', changeEvent); cb(); }); gulp.task('watch:styles', ['build:styles'], function(cb) { var watcher = gulp.watch(paths.source.styles + '**/*.scss', [ 'build:styles' ]); watcher.on('change', changeEvent); cb(); }); gulp.task('watch:html', ['build:html'], function(cb) { var watcher = gulp.watch(paths.source.html + '**/*', [ 'build:html' ]); watcher.on('change', changeEvent); cb(); }); gulp.task('watch:images', ['build:images'], function(cb) { var watcher = gulp.watch(paths.source.images + '**/*', [ 'build:images' ]); watcher.on('change', changeEvent); cb(); }); /** * Build tasks */ gulp.task('build', [ 'build:scripts', 'build:styles', 'build:images', 'build:html' ]); gulp.task('build:scripts', ['clean:scripts', 'lint:scripts'], function(cb) { $.mkdirp(paths.build.scripts); gulp.src(paths.source.scripts + '**/*.js') .pipe($.plumber()) .pipe($.sourcemaps.init()) .pipe(gulp.dest(paths.build.scripts)) .pipe($.uglify({ preserveComments: 'some' // Should be 'license', but that's dead })) .pipe($.rename({suffix: '.min'})) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest(paths.build.scripts)) .pipe($.browserSync.stream()); cb(); }); gulp.task('build:styles', ['clean:styles', 'lint:styles'], function(cb) { $.mkdirp(paths.build.styles); gulp.src(paths.source.styles + '**/*.scss') .pipe($.plumber()) .pipe($.sourcemaps.init()) .pipe($.sass({ style: 'compressed', includePaths: require('node-bourbon').includePaths })) .pipe($.autoprefixer()) .pipe(gulp.dest(paths.build.styles)) .pipe($.minifyCss()) .pipe($.rename({suffix: '.min'})) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest(paths.build.styles)) .pipe($.browserSync.stream()); cb(); }); gulp.task('build:html', ['clean:html'], function(cb) { gulp.src(paths.source.html + '**/*.html') .pipe($.plumber()) .pipe($.replace(/{{([a-z\-]+)}}/gim, function(match, varName) { if (conf.replace.hasOwnProperty(varName)) { return conf.replace[varName]; } })) .pipe(gulp.dest(paths.build.html)) .pipe($.browserSync.stream()); cb() }); gulp.task('build:images', ['clean:images'], function() { $.mkdirp(paths.build.images); gulp.src(paths.source.images + '**/*') .pipe($.plumber()) .pipe(gulp.dest(paths.build.images)) .pipe($.browserSync.stream()); }); /** * Lint tasks */ gulp.task('lint:scripts', function(cb) { gulp.src([paths.source.scripts + '**/*.js', '!**/external/*.js']) .pipe($.plumber()) .pipe($.jshint()) .pipe($.jshint.reporter('jshint-stylish')) cb(); }); gulp.task('lint:styles', function(cb) { gulp.src(paths.source.styles + '**/*.scss') .pipe($.plumber()) .pipe($.sassLint({ config: '.scss-lint.yml', customReport: $.sassLintStylish })); cb(); }); /** * Cleanup tasks */ gulp.task('clean', function(cb) { $.del(paths.build.base); $.mkdirp(paths.build.base); cb(); }); gulp.task('clean:scripts', function(cb) { $.del([ paths.build.scripts + '**/*.js', paths.build.scripts + '**/*.js.map' ], cb); }); gulp.task('clean:styles', function(cb) { $.del([ paths.build.styles + '**/*.css', paths.build.styles + '**/*.css.map' ], cb); }); gulp.task('clean:images', function(cb) { $.del([ paths.build.images + '*' ], cb); }); gulp.task('clean:html', function(cb) { $.del([ paths.build.html + '**/*.html' ], cb); }); })();
import { createLocalVue, mount } from '@vue/test-utils' import { useI18n } from '../../__utils__/i18n' import WalletNew from '@/pages/Wallet/WalletNew' import WalletService from '@/services/wallet' const localVue = createLocalVue() const i18n = useI18n(localVue) describe('pages > WalletNew', () => { const mountPage = () => { return mount(WalletNew, { localVue, i18n, mocks: { schema: {}, session_hasDarkTheme: false, session_network: { symbol: {} }, $v: { step1: {}, step3: {}, step4: {}, step5: {}, schema: { name: {}, isSendingEnabled: {} }, model: {} } } }) } it('should have the right name', () => { const wrapper = mountPage() expect(wrapper.name()).toEqual('WalletNew') }) it('should render component', () => { const wrapper = mountPage() expect(wrapper.contains('.WalletNew')).toBeTruthy() }) describe('computed additionalSuggestions', () => { it('should mix and shuffle the words of all the passphrases', () => { const wallets = { A1: 'word1 word2 word3 word4', A2: 'first second third fourth', A3: 'lemon orange grape banana' } const words = [ ...wallets.A1.split(' '), ...wallets.A2.split(' '), ...wallets.A3.split(' ') ] const wrapper = mountPage() wrapper.setData({ wallets }) expect(wrapper.vm.additionalSuggestions).toIncludeAllMembers(words) }) }) describe('refreshAddresses', () => { it('should generate 4 wallets', async () => { const wrapper = mountPage() WalletService.generate.mockClear() wrapper.vm.refreshAddresses() // There is a delay to play an animation await setTimeout(() => { expect(WalletService.generate).toHaveBeenCalledTimes(4) }, 500) }) }) })
var db = require('../utils/mysqlDbutil'), utils = require('../utils/utils'); var Article = {}; /** * 插入文章 */ Article.insertArticle = function(articleData, callback){ var article = { title: 'test', summary: 'test', content: 'test', markdown_content: 'test', user_id: 1, create_time: utils.getNowtime(), update_time: utils.getNowtime(), is_public: 1, is_allowcomment: 1, comment_num: 0, status: 3, type: 1, options: '' }; article = utils.extend(article, articleData, true); var dataArr = []; var sqlStr = 'insert into '+ db.getTablePrefix() +'article set '; for(var key in article){ sqlStr += key + ' = ?, '; dataArr.push(article[key]); } sqlStr = sqlStr.substr(0, sqlStr.length-2); db.insert(sqlStr, dataArr, function(err, result){ callback(err, result); }); }; /** * 更新文章 */ Article.updateArticle = function(id, articleData, callback){ var dataArr = []; var sqlStr = 'update '+ db.getTablePrefix() +'article set '; for(var key in articleData){ sqlStr += key + ' = ?, '; dataArr.push(articleData[key]); } sqlStr = sqlStr.substr(0, sqlStr.length-2); sqlStr += ' where id = ' + id ; db.update(sqlStr, dataArr, function(err, result){ callback(err, result); }); }; /** * 分页查看文章信息 */ Article.selectArticleBypage = function(page, isAdmin, callback) { var countPerPage; if(isAdmin === false) { countPerPage = 5; }else { countPerPage = 10; } var start = (page - 1) * countPerPage, pagenum = 1; var sqlStr = 'select count(*) as allnum from '+ db.getTablePrefix() +'article'; db.query(sqlStr, function(err, result){ pagenum = Math.ceil(result[0]['allnum'] / countPerPage); if(page > pagenum || page < 1) { callback(true, null, null); return false; } if(isAdmin === false) { sqlStr = 'select * from '+ db.getTablePrefix() +'article where is_public != 0 order by create_time desc limit ' + start + ', '+ countPerPage +''; } else { sqlStr = 'select * from '+ db.getTablePrefix() +'article order by create_time desc limit ' + start + ', '+ countPerPage +''; } db.query(sqlStr, function(err, result){ callback(err, result, pagenum); }); }); }; /** * 查询具体文章信息 */ Article.selectArticleByid = function(postid, isAdmin, callback) { if(isAdmin == false) { var sqlStr = 'select * from '+ db.getTablePrefix() +'article where is_public != 0 and id = ' + postid; } else { var sqlStr = 'select * from '+ db.getTablePrefix() +'article where id = ' + postid; } db.query(sqlStr, function(err, result){ callback(err, result); }); } /** * 删除文章 */ Article.delPostByid = function(postid, callback) { var sqlStr = 'delete from '+ db.getTablePrefix() +'article where id = ' + postid; db.deleteData(sqlStr, function(err, result){ callback(err, result); }); } /** * 查找文章 */ Article.findPost = function(title, callback) { var sqlStr = "select * from "+ db.getTablePrefix() +"article where is_public != 0 and lower(title) like '%" + title.toLowerCase() + "%'"; db.query(sqlStr, function(err, result){ callback(err, result); }); } module.exports = Article;
/*! * Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file. */ import {WebexPlugin} from '@webex/webex-core'; /** * @class * @extends {Lyra} * @memberof Lyra */ const Device = WebexPlugin.extend({ namespace: 'Lyra', /** * Gets the audio state of the device * @param {Types~LyraSpace} space * @param {string} space.url * @returns {Promise<LyraAudioState>} {volume, microphones, url} */ getAudioState(space) { return this.webex.request({ method: 'GET', uri: `${space.url}/audio` }) .then((res) => res.body); }, /** * Updates audio state for lyra device, should be called every 10 minutes or * when mic or volume state is changed * @param {Types~LyraSpace} space * @param {string} space.url * @param {Types~LyraAudioState} audioState * @param {object} audioState.volume optional * @param {boolean} audioState.volume.level * @param {object} audioState.microphones optional * @param {boolean} audioState.microphones.muted * @param {string} audioState.deviceUrl * @returns {Promise} */ putAudioState(space, audioState = {}) { if (!audioState.deviceUrl) { return Promise.reject(new Error('audioState.deviceUrl is required')); } return this.webex.request({ method: 'PUT', uri: `${space.url}/audio`, body: audioState }) .then((res) => res.body); }, /** * Mutes lyra device * @param {Types~LyraSpace} space * @param {string} space.url * @returns {Promise} */ mute(space) { return this.webex.request({ method: 'POST', uri: `${space.url}/audio/microphones/actions/mute/invoke` }); }, /** * Unmutes lyra device * @param {Types~LyraSpace} space * @param {string} space.url * @returns {Promise} */ unmute(space) { return this.webex.request({ method: 'POST', uri: `${space.url}/audio/microphones/actions/un-mute/invoke` }); }, /** * Increases lyra device's volume * @param {Types~LyraSpace} space * @param {string} space.url * @returns {Promise} */ increaseVolume(space) { return this.webex.request({ method: 'POST', uri: `${space.url}/audio/volume/actions/increase/invoke` }); }, /** * Decreases lyra device's volume * @param {Types~LyraSpace} space * @param {string} space.url * @returns {Promise} */ decreaseVolume(space) { return this.webex.request({ method: 'POST', uri: `${space.url}/audio/volume/actions/decrease/invoke` }); }, /** * Sets lyra device's volume but should use increase and decrease api instead * @param {Types~LyraSpace} space * @param {string} space.url * @param {integer} level to be set * @returns {Promise} */ setVolume(space, level = 0) { return this.webex.request({ method: 'POST', uri: `${space.url}/audio/volume/actions/set/invoke`, body: { level } }); } }); export default Device;
var Substance = require("substance"); var _ = require("substance/helpers"); // A simple tree implementation // ------------- var Tree = function(nodes) { this.nodes = nodes; this.buildIndexes(); }; Tree.Prototype = function() { this.buildIndexes = function() { // Build a map of parents referencing their kids this.parentIndex = {}; _.each(this.nodes, function(node) { var parent = node.parent || "root"; if (!this.parentIndex[parent]) { this.parentIndex[parent] = [ node ]; } else { this.parentIndex[parent].push(node); } }, this); // Sort each leaf by node position _.each(this.parentIndex, function(leaf, parent) { this.parentIndex[parent] = _.sortBy(leaf, function(node){ return node.position; }); }, this); }; // Get a node by id this.get = function(id) { return this.nodes[id]; }; // Get children nodes for a given node using our parentIndex this.getChildren = function(nodeId) { return this.parentIndex[nodeId] || []; }; // Get parent node for a given nodeId this.getParent = function(nodeId) { var node = this.nodes[nodeId]; return this.nodes[node.parent]; }; // Collect all parent ids of a given node this.getParents = function(nodeId) { var node = this.get(nodeId); var parents = []; while (node = this.getParent(node.id)) { parents.push(node.id); } return parents; }; // Collect all child nodes of a node // returns list of ids this.getAllChildren = function(nodeId) { var childNodes = this.getChildren(nodeId); if (childNodes.length === 0) return []; var allChildren = _.pluck(childNodes, 'id'); _.each(childNodes, function(childNode) { allChildren = allChildren.concat(this.getAllChildren(childNode.id)) }, this); return allChildren; } // Walk the tree this.walkTree = function(fn, ctx) { var self = this; if (!ctx) ctx = this; function _walkTree(rootNode, fn, ctx) { if (rootNode !== "root") { fn.call(ctx, rootNode); } var children = self.getChildren(rootNode.id); Substance.each(self.getChildren(rootNode.id || rootNode), function(child) { _walkTree(child, fn, ctx); }); } return _walkTree("root", fn, ctx); }; }; Tree.prototype = new Tree.Prototype(); module.exports = Tree;
'use strict'; angular.module('bankRoll').constant('API_URL', 'https://bankroll.firebaseio.com/'); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9hc3NldHMvbWFpbi5jb25zdGFudHMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxPQUFPLENBQ0wsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUNsQixRQUFRLENBQUMsU0FBUyxFQUFFLGtDQUFrQyxDQUFDLENBQUEiLCJmaWxlIjoic3JjL2Fzc2V0cy9tYWluLmNvbnN0YW50cy5qcyIsInNvdXJjZXNDb250ZW50IjpbImFuZ3VsYXJcblx0Lm1vZHVsZSgnYmFua1JvbGwnKVxuXHQuY29uc3RhbnQoJ0FQSV9VUkwnLCAnaHR0cHM6Ly9iYW5rcm9sbC5maXJlYmFzZWlvLmNvbS8nKVxuIl19
var thuck = require('../') , stream = require('stream') describe('thuck.api.test.js', function () { describe('thuck(flag)', function () { it('should return new instance of Thuck', function () { thuck(2).should.be.an.instanceof(thuck) }) it('should be an instance of stream.Transform', function () { thuck(3).should.be.an.instanceof(stream.Transform) }) it('should throw if no flag is specified', function () { thuck.bind(this).should.throw() }) it('should throw if flag is not a number', function () { thuck.bind(this, 'throw').should.throw() }) it('should throw if flag is not a byte', function () { thuck.bind(this, 1234).should.throw() }) }) describe('thuck.flag', function () { it('should be specified by thuck(flag)', function () { thuck(152).should.have.property('flag', 152) }) it('should be a parsed integer specified by thuck(flag)', function () { thuck('92').should.have.property('flag', 92) }) }) })
/* * Copyright (c) 2017, Jeff Hlywa (jhlywa@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * *----------------------------------------------------------------------------*/ /* minified license below */ /* @license * Copyright (c) 2017, Jeff Hlywa (jhlywa@gmail.com) * Released under the BSD license * https://github.com/jhlywa/chess.js/blob/master/LICENSE */ var Chess = function(fen) { /* jshint indent: false */ var BLACK = 'b'; var WHITE = 'w'; var EMPTY = -1; var PAWN = 'p'; var KNIGHT = 'n'; var BISHOP = 'b'; var ROOK = 'r'; var QUEEN = 'q'; var KING = 'k'; var SYMBOLS = 'pnbrqkPNBRQK'; var DEFAULT_POSITION = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'; var POSSIBLE_RESULTS = ['1-0', '0-1', '1/2-1/2', '*']; var PAWN_OFFSETS = { b: [16, 32, 17, 15], w: [-16, -32, -17, -15] }; var PIECE_OFFSETS = { n: [-18, -33, -31, -14, 18, 33, 31, 14], b: [-17, -15, 17, 15], r: [-16, 1, 16, -1], q: [-17, -16, -15, 1, 17, 16, 15, -1], k: [-17, -16, -15, 1, 17, 16, 15, -1] }; var ATTACKS = [ 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20, 0, 0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0, 0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0, 0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,53, 56, 53, 2, 0, 0, 0, 0, 0, 0, 24,24,24,24,24,24,56, 0, 56,24,24,24,24,24,24, 0, 0, 0, 0, 0, 0, 2,53, 56, 53, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20, 2, 24, 2,20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20, 0, 0, 24, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0,20, 0, 0, 0, 24, 0, 0, 0,20, 0, 0, 0, 0, 0, 0,20, 0, 0, 0, 0, 24, 0, 0, 0, 0,20, 0, 0, 0, 0,20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0,20, 0, 0, 20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0,20 ]; var RAYS = [ 17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 15, 0, 0, 17, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 17, 0, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 16, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 15, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, -1, -1, -1,-1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0,-15,-16,-17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-15, 0,-16, 0,-17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-15, 0, 0,-16, 0, 0,-17, 0, 0, 0, 0, 0, 0, 0, 0,-15, 0, 0, 0,-16, 0, 0, 0,-17, 0, 0, 0, 0, 0, 0,-15, 0, 0, 0, 0,-16, 0, 0, 0, 0,-17, 0, 0, 0, 0,-15, 0, 0, 0, 0, 0,-16, 0, 0, 0, 0, 0,-17, 0, 0, -15, 0, 0, 0, 0, 0, 0,-16, 0, 0, 0, 0, 0, 0,-17 ]; var SHIFTS = { p: 0, n: 1, b: 2, r: 3, q: 4, k: 5 }; var FLAGS = { NORMAL: 'n', CAPTURE: 'c', BIG_PAWN: 'b', EP_CAPTURE: 'e', PROMOTION: 'p', KSIDE_CASTLE: 'k', QSIDE_CASTLE: 'q' }; var BITS = { NORMAL: 1, CAPTURE: 2, BIG_PAWN: 4, EP_CAPTURE: 8, PROMOTION: 16, KSIDE_CASTLE: 32, QSIDE_CASTLE: 64 }; var RANK_1 = 7; var RANK_2 = 6; var RANK_3 = 5; var RANK_4 = 4; var RANK_5 = 3; var RANK_6 = 2; var RANK_7 = 1; var RANK_8 = 0; var SQUARES = { a8: 0, b8: 1, c8: 2, d8: 3, e8: 4, f8: 5, g8: 6, h8: 7, a7: 16, b7: 17, c7: 18, d7: 19, e7: 20, f7: 21, g7: 22, h7: 23, a6: 32, b6: 33, c6: 34, d6: 35, e6: 36, f6: 37, g6: 38, h6: 39, a5: 48, b5: 49, c5: 50, d5: 51, e5: 52, f5: 53, g5: 54, h5: 55, a4: 64, b4: 65, c4: 66, d4: 67, e4: 68, f4: 69, g4: 70, h4: 71, a3: 80, b3: 81, c3: 82, d3: 83, e3: 84, f3: 85, g3: 86, h3: 87, a2: 96, b2: 97, c2: 98, d2: 99, e2: 100, f2: 101, g2: 102, h2: 103, a1: 112, b1: 113, c1: 114, d1: 115, e1: 116, f1: 117, g1: 118, h1: 119 }; var ROOKS = { w: [{square: SQUARES.a1, flag: BITS.QSIDE_CASTLE}, {square: SQUARES.h1, flag: BITS.KSIDE_CASTLE}], b: [{square: SQUARES.a8, flag: BITS.QSIDE_CASTLE}, {square: SQUARES.h8, flag: BITS.KSIDE_CASTLE}] }; var board = new Array(128); var kings = {w: EMPTY, b: EMPTY}; var turn = WHITE; var castling = {w: 0, b: 0}; var ep_square = EMPTY; var half_moves = 0; var move_number = 1; var history = []; var header = {}; /* if the user passes in a fen string, load it, else default to * starting position */ if (typeof fen === 'undefined') { load(DEFAULT_POSITION); } else { load(fen); } function clear() { board = new Array(128); kings = {w: EMPTY, b: EMPTY}; turn = WHITE; castling = {w: 0, b: 0}; ep_square = EMPTY; half_moves = 0; move_number = 1; history = []; header = {}; update_setup(generate_fen()); } function reset() { load(DEFAULT_POSITION); } function load(fen) { var tokens = fen.split(/\s+/); var position = tokens[0]; var square = 0; if (!validate_fen(fen).valid) { return false; } clear(); for (var i = 0; i < position.length; i++) { var piece = position.charAt(i); if (piece === '/') { square += 8; } else if (is_digit(piece)) { square += parseInt(piece, 10); } else { var color = (piece < 'a') ? WHITE : BLACK; put({type: piece.toLowerCase(), color: color}, algebraic(square)); square++; } } turn = tokens[1]; if (tokens[2].indexOf('K') > -1) { castling.w |= BITS.KSIDE_CASTLE; } if (tokens[2].indexOf('Q') > -1) { castling.w |= BITS.QSIDE_CASTLE; } if (tokens[2].indexOf('k') > -1) { castling.b |= BITS.KSIDE_CASTLE; } if (tokens[2].indexOf('q') > -1) { castling.b |= BITS.QSIDE_CASTLE; } ep_square = (tokens[3] === '-') ? EMPTY : SQUARES[tokens[3]]; half_moves = parseInt(tokens[4], 10); move_number = parseInt(tokens[5], 10); update_setup(generate_fen()); return true; } /* TODO: this function is pretty much crap - it validates structure but * completely ignores content (e.g. doesn't verify that each side has a king) * ... we should rewrite this, and ditch the silly error_number field while * we're at it */ function validate_fen(fen) { var errors = { 0: 'No errors.', 1: 'FEN string must contain six space-delimited fields.', 2: '6th field (move number) must be a positive integer.', 3: '5th field (half move counter) must be a non-negative integer.', 4: '4th field (en-passant square) is invalid.', 5: '3rd field (castling availability) is invalid.', 6: '2nd field (side to move) is invalid.', 7: '1st field (piece positions) does not contain 8 \'/\'-delimited rows.', 8: '1st field (piece positions) is invalid [consecutive numbers].', 9: '1st field (piece positions) is invalid [invalid piece].', 10: '1st field (piece positions) is invalid [row too large].', 11: 'Illegal en-passant square', }; /* 1st criterion: 6 space-seperated fields? */ var tokens = fen.split(/\s+/); if (tokens.length !== 6) { return {valid: false, error_number: 1, error: errors[1]}; } /* 2nd criterion: move number field is a integer value > 0? */ if (isNaN(tokens[5]) || (parseInt(tokens[5], 10) <= 0)) { return {valid: false, error_number: 2, error: errors[2]}; } /* 3rd criterion: half move counter is an integer >= 0? */ if (isNaN(tokens[4]) || (parseInt(tokens[4], 10) < 0)) { return {valid: false, error_number: 3, error: errors[3]}; } /* 4th criterion: 4th field is a valid e.p.-string? */ if (!/^(-|[abcdefgh][36])$/.test(tokens[3])) { return {valid: false, error_number: 4, error: errors[4]}; } /* 5th criterion: 3th field is a valid castle-string? */ if( !/^(KQ?k?q?|Qk?q?|kq?|q|-)$/.test(tokens[2])) { return {valid: false, error_number: 5, error: errors[5]}; } /* 6th criterion: 2nd field is "w" (white) or "b" (black)? */ if (!/^(w|b)$/.test(tokens[1])) { return {valid: false, error_number: 6, error: errors[6]}; } /* 7th criterion: 1st field contains 8 rows? */ var rows = tokens[0].split('/'); if (rows.length !== 8) { return {valid: false, error_number: 7, error: errors[7]}; } /* 8th criterion: every row is valid? */ for (var i = 0; i < rows.length; i++) { /* check for right sum of fields AND not two numbers in succession */ var sum_fields = 0; var previous_was_number = false; for (var k = 0; k < rows[i].length; k++) { if (!isNaN(rows[i][k])) { if (previous_was_number) { return {valid: false, error_number: 8, error: errors[8]}; } sum_fields += parseInt(rows[i][k], 10); previous_was_number = true; } else { if (!/^[prnbqkPRNBQK]$/.test(rows[i][k])) { return {valid: false, error_number: 9, error: errors[9]}; } sum_fields += 1; previous_was_number = false; } } if (sum_fields !== 8) { return {valid: false, error_number: 10, error: errors[10]}; } } if ((tokens[3][1] == '3' && tokens[1] == 'w') || (tokens[3][1] == '6' && tokens[1] == 'b')) { return {valid: false, error_number: 11, error: errors[11]}; } /* everything's okay! */ return {valid: true, error_number: 0, error: errors[0]}; } function generate_fen() { var empty = 0; var fen = ''; for (var i = SQUARES.a8; i <= SQUARES.h1; i++) { if (board[i] == null) { empty++; } else { if (empty > 0) { fen += empty; empty = 0; } var color = board[i].color; var piece = board[i].type; fen += (color === WHITE) ? piece.toUpperCase() : piece.toLowerCase(); } if ((i + 1) & 0x88) { if (empty > 0) { fen += empty; } if (i !== SQUARES.h1) { fen += '/'; } empty = 0; i += 8; } } var cflags = ''; if (castling[WHITE] & BITS.KSIDE_CASTLE) { cflags += 'K'; } if (castling[WHITE] & BITS.QSIDE_CASTLE) { cflags += 'Q'; } if (castling[BLACK] & BITS.KSIDE_CASTLE) { cflags += 'k'; } if (castling[BLACK] & BITS.QSIDE_CASTLE) { cflags += 'q'; } /* do we have an empty castling flag? */ cflags = cflags || '-'; var epflags = (ep_square === EMPTY) ? '-' : algebraic(ep_square); return [fen, turn, cflags, epflags, half_moves, move_number].join(' '); } function set_header(args) { for (var i = 0; i < args.length; i += 2) { if (typeof args[i] === 'string' && typeof args[i + 1] === 'string') { header[args[i]] = args[i + 1]; } } return header; } /* called when the initial board setup is changed with put() or remove(). * modifies the SetUp and FEN properties of the header object. if the FEN is * equal to the default position, the SetUp and FEN are deleted * the setup is only updated if history.length is zero, ie moves haven't been * made. */ function update_setup(fen) { if (history.length > 0) return; if (fen !== DEFAULT_POSITION) { header['SetUp'] = '1'; header['FEN'] = fen; } else { delete header['SetUp']; delete header['FEN']; } } function get(square) { var piece = board[SQUARES[square]]; return (piece) ? {type: piece.type, color: piece.color} : null; } function put(piece, square) { /* check for valid piece object */ if (!('type' in piece && 'color' in piece)) { return false; } /* check for piece */ if (SYMBOLS.indexOf(piece.type.toLowerCase()) === -1) { return false; } /* check for valid square */ if (!(square in SQUARES)) { return false; } var sq = SQUARES[square]; /* don't let the user place more than one king */ if (piece.type == KING && !(kings[piece.color] == EMPTY || kings[piece.color] == sq)) { return false; } board[sq] = {type: piece.type, color: piece.color}; if (piece.type === KING) { kings[piece.color] = sq; } update_setup(generate_fen()); return true; } function remove(square) { var piece = get(square); board[SQUARES[square]] = null; if (piece && piece.type === KING) { kings[piece.color] = EMPTY; } update_setup(generate_fen()); return piece; } function build_move(board, from, to, flags, promotion) { var move = { color: turn, from: from, to: to, flags: flags, piece: board[from].type }; if (promotion) { move.flags |= BITS.PROMOTION; move.promotion = promotion; } if (board[to]) { move.captured = board[to].type; } else if (flags & BITS.EP_CAPTURE) { move.captured = PAWN; } return move; } function generate_moves(options) { function add_move(board, moves, from, to, flags) { /* if pawn promotion */ if (board[from].type === PAWN && (rank(to) === RANK_8 || rank(to) === RANK_1)) { var pieces = [QUEEN, ROOK, BISHOP, KNIGHT]; for (var i = 0, len = pieces.length; i < len; i++) { moves.push(build_move(board, from, to, flags, pieces[i])); } } else { moves.push(build_move(board, from, to, flags)); } } var moves = []; var us = turn; var them = swap_color(us); var second_rank = {b: RANK_7, w: RANK_2}; var first_sq = SQUARES.a8; var last_sq = SQUARES.h1; var single_square = false; /* do we want legal moves? */ var legal = (typeof options !== 'undefined' && 'legal' in options) ? options.legal : true; /* are we generating moves for a single square? */ if (typeof options !== 'undefined' && 'square' in options) { if (options.square in SQUARES) { first_sq = last_sq = SQUARES[options.square]; single_square = true; } else { /* invalid square */ return []; } } for (var i = first_sq; i <= last_sq; i++) { /* did we run off the end of the board */ if (i & 0x88) { i += 7; continue; } var piece = board[i]; if (piece == null || piece.color !== us) { continue; } if (piece.type === PAWN) { /* single square, non-capturing */ var square = i + PAWN_OFFSETS[us][0]; if (board[square] == null) { add_move(board, moves, i, square, BITS.NORMAL); /* double square */ var square = i + PAWN_OFFSETS[us][1]; if (second_rank[us] === rank(i) && board[square] == null) { add_move(board, moves, i, square, BITS.BIG_PAWN); } } /* pawn captures */ for (j = 2; j < 4; j++) { var square = i + PAWN_OFFSETS[us][j]; if (square & 0x88) continue; if (board[square] != null && board[square].color === them) { add_move(board, moves, i, square, BITS.CAPTURE); } else if (square === ep_square) { add_move(board, moves, i, ep_square, BITS.EP_CAPTURE); } } } else { for (var j = 0, len = PIECE_OFFSETS[piece.type].length; j < len; j++) { var offset = PIECE_OFFSETS[piece.type][j]; var square = i; while (true) { square += offset; if (square & 0x88) break; if (board[square] == null) { add_move(board, moves, i, square, BITS.NORMAL); } else { if (board[square].color === us) break; add_move(board, moves, i, square, BITS.CAPTURE); break; } /* break, if knight or king */ if (piece.type === 'n' || piece.type === 'k') break; } } } } /* check for castling if: a) we're generating all moves, or b) we're doing * single square move generation on the king's square */ if ((!single_square) || last_sq === kings[us]) { /* king-side castling */ if (castling[us] & BITS.KSIDE_CASTLE) { var castling_from = kings[us]; var castling_to = castling_from + 2; if (board[castling_from + 1] == null && board[castling_to] == null && !attacked(them, kings[us]) && !attacked(them, castling_from + 1) && !attacked(them, castling_to)) { add_move(board, moves, kings[us] , castling_to, BITS.KSIDE_CASTLE); } } /* queen-side castling */ if (castling[us] & BITS.QSIDE_CASTLE) { var castling_from = kings[us]; var castling_to = castling_from - 2; if (board[castling_from - 1] == null && board[castling_from - 2] == null && board[castling_from - 3] == null && !attacked(them, kings[us]) && !attacked(them, castling_from - 1) && !attacked(them, castling_to)) { add_move(board, moves, kings[us], castling_to, BITS.QSIDE_CASTLE); } } } /* return all pseudo-legal moves (this includes moves that allow the king * to be captured) */ if (!legal) { return moves; } /* filter out illegal moves */ var legal_moves = []; for (var i = 0, len = moves.length; i < len; i++) { make_move(moves[i]); if (!king_attacked(us)) { legal_moves.push(moves[i]); } undo_move(); } return legal_moves; } /* convert a move from 0x88 coordinates to Standard Algebraic Notation * (SAN) * * @param {boolean} sloppy Use the sloppy SAN generator to work around over * disambiguation bugs in Fritz and Chessbase. See below: * * r1bqkbnr/ppp2ppp/2n5/1B1pP3/4P3/8/PPPP2PP/RNBQK1NR b KQkq - 2 4 * 4. ... Nge7 is overly disambiguated because the knight on c6 is pinned * 4. ... Ne7 is technically the valid SAN */ function move_to_san(move, sloppy) { var output = ''; if (move.flags & BITS.KSIDE_CASTLE) { output = 'O-O'; } else if (move.flags & BITS.QSIDE_CASTLE) { output = 'O-O-O'; } else { var disambiguator = get_disambiguator(move, sloppy); if (move.piece !== PAWN) { output += move.piece.toUpperCase() + disambiguator; } if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { if (move.piece === PAWN) { output += algebraic(move.from)[0]; } output += 'x'; } output += algebraic(move.to); if (move.flags & BITS.PROMOTION) { output += '=' + move.promotion.toUpperCase(); } } make_move(move); if (in_check()) { if (in_checkmate()) { output += '#'; } else { output += '+'; } } undo_move(); return output; } // parses all of the decorators out of a SAN string function stripped_san(move) { return move.replace(/=/,'').replace(/[+#]?[?!]*$/,''); } function attacked(color, square) { for (var i = SQUARES.a8; i <= SQUARES.h1; i++) { /* did we run off the end of the board */ if (i & 0x88) { i += 7; continue; } /* if empty square or wrong color */ if (board[i] == null || board[i].color !== color) continue; var piece = board[i]; var difference = i - square; var index = difference + 119; if (ATTACKS[index] & (1 << SHIFTS[piece.type])) { if (piece.type === PAWN) { if (difference > 0) { if (piece.color === WHITE) return true; } else { if (piece.color === BLACK) return true; } continue; } /* if the piece is a knight or a king */ if (piece.type === 'n' || piece.type === 'k') return true; var offset = RAYS[index]; var j = i + offset; var blocked = false; while (j !== square) { if (board[j] != null) { blocked = true; break; } j += offset; } if (!blocked) return true; } } return false; } function king_attacked(color) { return attacked(swap_color(color), kings[color]); } function in_check() { return king_attacked(turn); } function in_checkmate() { return in_check() && generate_moves().length === 0; } function in_stalemate() { return !in_check() && generate_moves().length === 0; } function insufficient_material() { var pieces = {}; var bishops = []; var num_pieces = 0; var sq_color = 0; for (var i = SQUARES.a8; i<= SQUARES.h1; i++) { sq_color = (sq_color + 1) % 2; if (i & 0x88) { i += 7; continue; } var piece = board[i]; if (piece) { pieces[piece.type] = (piece.type in pieces) ? pieces[piece.type] + 1 : 1; if (piece.type === BISHOP) { bishops.push(sq_color); } num_pieces++; } } /* k vs. k */ if (num_pieces === 2) { return true; } /* k vs. kn .... or .... k vs. kb */ else if (num_pieces === 3 && (pieces[BISHOP] === 1 || pieces[KNIGHT] === 1)) { return true; } /* kb vs. kb where any number of bishops are all on the same color */ else if (num_pieces === pieces[BISHOP] + 2) { var sum = 0; var len = bishops.length; for (var i = 0; i < len; i++) { sum += bishops[i]; } if (sum === 0 || sum === len) { return true; } } return false; } function in_threefold_repetition() { /* TODO: while this function is fine for casual use, a better * implementation would use a Zobrist key (instead of FEN). the * Zobrist key would be maintained in the make_move/undo_move functions, * avoiding the costly that we do below. */ var moves = []; var positions = {}; var repetition = false; while (true) { var move = undo_move(); if (!move) break; moves.push(move); } while (true) { /* remove the last two fields in the FEN string, they're not needed * when checking for draw by rep */ var fen = generate_fen().split(' ').slice(0,4).join(' '); /* has the position occurred three or move times */ positions[fen] = (fen in positions) ? positions[fen] + 1 : 1; if (positions[fen] >= 3) { repetition = true; } if (!moves.length) { break; } make_move(moves.pop()); } return repetition; } function push(move) { history.push({ move: move, kings: {b: kings.b, w: kings.w}, turn: turn, castling: {b: castling.b, w: castling.w}, ep_square: ep_square, half_moves: half_moves, move_number: move_number }); } function make_move(move) { var us = turn; var them = swap_color(us); push(move); board[move.to] = board[move.from]; board[move.from] = null; /* if ep capture, remove the captured pawn */ if (move.flags & BITS.EP_CAPTURE) { if (turn === BLACK) { board[move.to - 16] = null; } else { board[move.to + 16] = null; } } /* if pawn promotion, replace with new piece */ if (move.flags & BITS.PROMOTION) { board[move.to] = {type: move.promotion, color: us}; } /* if we moved the king */ if (board[move.to].type === KING) { kings[board[move.to].color] = move.to; /* if we castled, move the rook next to the king */ if (move.flags & BITS.KSIDE_CASTLE) { var castling_to = move.to - 1; var castling_from = move.to + 1; board[castling_to] = board[castling_from]; board[castling_from] = null; } else if (move.flags & BITS.QSIDE_CASTLE) { var castling_to = move.to + 1; var castling_from = move.to - 2; board[castling_to] = board[castling_from]; board[castling_from] = null; } /* turn off castling */ castling[us] = ''; } /* turn off castling if we move a rook */ if (castling[us]) { for (var i = 0, len = ROOKS[us].length; i < len; i++) { if (move.from === ROOKS[us][i].square && castling[us] & ROOKS[us][i].flag) { castling[us] ^= ROOKS[us][i].flag; break; } } } /* turn off castling if we capture a rook */ if (castling[them]) { for (var i = 0, len = ROOKS[them].length; i < len; i++) { if (move.to === ROOKS[them][i].square && castling[them] & ROOKS[them][i].flag) { castling[them] ^= ROOKS[them][i].flag; break; } } } /* if big pawn move, update the en passant square */ if (move.flags & BITS.BIG_PAWN) { if (turn === 'b') { ep_square = move.to - 16; } else { ep_square = move.to + 16; } } else { ep_square = EMPTY; } /* reset the 50 move counter if a pawn is moved or a piece is captured */ if (move.piece === PAWN) { half_moves = 0; } else if (move.flags & (BITS.CAPTURE | BITS.EP_CAPTURE)) { half_moves = 0; } else { half_moves++; } if (turn === BLACK) { move_number++; } turn = swap_color(turn); } function undo_move() { var old = history.pop(); if (old == null) { return null; } var move = old.move; kings = old.kings; turn = old.turn; castling = old.castling; ep_square = old.ep_square; half_moves = old.half_moves; move_number = old.move_number; var us = turn; var them = swap_color(turn); board[move.from] = board[move.to]; board[move.from].type = move.piece; // to undo any promotions board[move.to] = null; if (move.flags & BITS.CAPTURE) { board[move.to] = {type: move.captured, color: them}; } else if (move.flags & BITS.EP_CAPTURE) { var index; if (us === BLACK) { index = move.to - 16; } else { index = move.to + 16; } board[index] = {type: PAWN, color: them}; } if (move.flags & (BITS.KSIDE_CASTLE | BITS.QSIDE_CASTLE)) { var castling_to, castling_from; if (move.flags & BITS.KSIDE_CASTLE) { castling_to = move.to + 1; castling_from = move.to - 1; } else if (move.flags & BITS.QSIDE_CASTLE) { castling_to = move.to - 2; castling_from = move.to + 1; } board[castling_to] = board[castling_from]; board[castling_from] = null; } return move; } /* this function is used to uniquely identify ambiguous moves */ function get_disambiguator(move, sloppy) { var moves = generate_moves({legal: !sloppy}); var from = move.from; var to = move.to; var piece = move.piece; var ambiguities = 0; var same_rank = 0; var same_file = 0; for (var i = 0, len = moves.length; i < len; i++) { var ambig_from = moves[i].from; var ambig_to = moves[i].to; var ambig_piece = moves[i].piece; /* if a move of the same piece type ends on the same to square, we'll * need to add a disambiguator to the algebraic notation */ if (piece === ambig_piece && from !== ambig_from && to === ambig_to) { ambiguities++; if (rank(from) === rank(ambig_from)) { same_rank++; } if (file(from) === file(ambig_from)) { same_file++; } } } if (ambiguities > 0) { /* if there exists a similar moving piece on the same rank and file as * the move in question, use the square as the disambiguator */ if (same_rank > 0 && same_file > 0) { return algebraic(from); } /* if the moving piece rests on the same file, use the rank symbol as the * disambiguator */ else if (same_file > 0) { return algebraic(from).charAt(1); } /* else use the file symbol */ else { return algebraic(from).charAt(0); } } return ''; } function ascii() { var s = ' +------------------------+\n'; for (var i = SQUARES.a8; i <= SQUARES.h1; i++) { /* display the rank */ if (file(i) === 0) { s += ' ' + '87654321'[rank(i)] + ' |'; } /* empty piece */ if (board[i] == null) { s += ' . '; } else { var piece = board[i].type; var color = board[i].color; var symbol = (color === WHITE) ? piece.toUpperCase() : piece.toLowerCase(); s += ' ' + symbol + ' '; } if ((i + 1) & 0x88) { s += '|\n'; i += 8; } } s += ' +------------------------+\n'; s += ' a b c d e f g h\n'; return s; } // convert a move from Standard Algebraic Notation (SAN) to 0x88 coordinates function move_from_san(move, sloppy) { // strip off any move decorations: e.g Nf3+?! var clean_move = stripped_san(move); // if we're using the sloppy parser run a regex to grab piece, to, and from // this should parse invalid SAN like: Pe2-e4, Rc1c4, Qf3xf7 if (sloppy) { var matches = clean_move.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/); if (matches) { var piece = matches[1]; var from = matches[2]; var to = matches[3]; var promotion = matches[4]; } } var moves = generate_moves(); for (var i = 0, len = moves.length; i < len; i++) { // try the strict parser first, then the sloppy parser if requested // by the user if ((clean_move === stripped_san(move_to_san(moves[i]))) || (sloppy && clean_move === stripped_san(move_to_san(moves[i], true)))) { return moves[i]; } else { if (matches && (!piece || piece.toLowerCase() == moves[i].piece) && SQUARES[from] == moves[i].from && SQUARES[to] == moves[i].to && (!promotion || promotion.toLowerCase() == moves[i].promotion)) { return moves[i]; } } } return null; } /***************************************************************************** * UTILITY FUNCTIONS ****************************************************************************/ function rank(i) { return i >> 4; } function file(i) { return i & 15; } function algebraic(i){ var f = file(i), r = rank(i); return 'abcdefgh'.substring(f,f+1) + '87654321'.substring(r,r+1); } function swap_color(c) { return c === WHITE ? BLACK : WHITE; } function is_digit(c) { return '0123456789'.indexOf(c) !== -1; } /* pretty = external move object */ function make_pretty(ugly_move) { var move = clone(ugly_move); move.san = move_to_san(move, false); move.to = algebraic(move.to); move.from = algebraic(move.from); var flags = ''; for (var flag in BITS) { if (BITS[flag] & move.flags) { flags += FLAGS[flag]; } } move.flags = flags; return move; } function clone(obj) { var dupe = (obj instanceof Array) ? [] : {}; for (var property in obj) { if (typeof property === 'object') { dupe[property] = clone(obj[property]); } else { dupe[property] = obj[property]; } } return dupe; } function trim(str) { return str.replace(/^\s+|\s+$/g, ''); } /***************************************************************************** * DEBUGGING UTILITIES ****************************************************************************/ function perft(depth) { var moves = generate_moves({legal: false}); var nodes = 0; var color = turn; for (var i = 0, len = moves.length; i < len; i++) { make_move(moves[i]); if (!king_attacked(color)) { if (depth - 1 > 0) { var child_nodes = perft(depth - 1); nodes += child_nodes; } else { nodes++; } } undo_move(); } return nodes; } return { /*************************************************************************** * PUBLIC CONSTANTS (is there a better way to do this?) **************************************************************************/ WHITE: WHITE, BLACK: BLACK, PAWN: PAWN, KNIGHT: KNIGHT, BISHOP: BISHOP, ROOK: ROOK, QUEEN: QUEEN, KING: KING, SQUARES: (function() { /* from the ECMA-262 spec (section 12.6.4): * "The mechanics of enumerating the properties ... is * implementation dependent" * so: for (var sq in SQUARES) { keys.push(sq); } might not be * ordered correctly */ var keys = []; for (var i = SQUARES.a8; i <= SQUARES.h1; i++) { if (i & 0x88) { i += 7; continue; } keys.push(algebraic(i)); } return keys; })(), FLAGS: FLAGS, /*************************************************************************** * PUBLIC API **************************************************************************/ load: function(fen) { return load(fen); }, reset: function() { return reset(); }, moves: function(options) { /* The internal representation of a chess move is in 0x88 format, and * not meant to be human-readable. The code below converts the 0x88 * square coordinates to algebraic coordinates. It also prunes an * unnecessary move keys resulting from a verbose call. */ var ugly_moves = generate_moves(options); var moves = []; for (var i = 0, len = ugly_moves.length; i < len; i++) { /* does the user want a full move object (most likely not), or just * SAN */ if (typeof options !== 'undefined' && 'verbose' in options && options.verbose) { moves.push(make_pretty(ugly_moves[i])); } else { moves.push(move_to_san(ugly_moves[i], false)); } } return moves; }, in_check: function() { return in_check(); }, in_checkmate: function() { return in_checkmate(); }, in_stalemate: function() { return in_stalemate(); }, in_draw: function() { return half_moves >= 100 || in_stalemate() || insufficient_material() || in_threefold_repetition(); }, insufficient_material: function() { return insufficient_material(); }, in_threefold_repetition: function() { return in_threefold_repetition(); }, game_over: function() { return half_moves >= 100 || in_checkmate() || in_stalemate() || insufficient_material() || in_threefold_repetition(); }, validate_fen: function(fen) { return validate_fen(fen); }, fen: function() { return generate_fen(); }, board: function() { var output = [], row = []; for (var i = SQUARES.a8; i <= SQUARES.h1; i++) { if (board[i] == null) { row.push(null) } else { row.push({type: board[i].type, color: board[i].color}) } if ((i + 1) & 0x88) { output.push(row); row = [] i += 8; } } return output; }, pgn: function(options) { /* using the specification from http://www.chessclub.com/help/PGN-spec * example for html usage: .pgn({ max_width: 72, newline_char: "<br />" }) */ var newline = (typeof options === 'object' && typeof options.newline_char === 'string') ? options.newline_char : '\n'; var max_width = (typeof options === 'object' && typeof options.max_width === 'number') ? options.max_width : 0; var result = []; var header_exists = false; /* add the PGN header headerrmation */ for (var i in header) { /* TODO: order of enumerated properties in header object is not * guaranteed, see ECMA-262 spec (section 12.6.4) */ result.push('[' + i + ' \"' + header[i] + '\"]' + newline); header_exists = true; } if (header_exists && history.length) { result.push(newline); } /* pop all of history onto reversed_history */ var reversed_history = []; while (history.length > 0) { reversed_history.push(undo_move()); } var moves = []; var move_string = ''; /* build the list of moves. a move_string looks like: "3. e3 e6" */ while (reversed_history.length > 0) { var move = reversed_history.pop(); /* if the position started with black to move, start PGN with 1. ... */ if (!history.length && move.color === 'b') { move_string = move_number + '. ...'; } else if (move.color === 'w') { /* store the previous generated move_string if we have one */ if (move_string.length) { moves.push(move_string); } move_string = move_number + '.'; } move_string = move_string + ' ' + move_to_san(move, false); make_move(move); } /* are there any other leftover moves? */ if (move_string.length) { moves.push(move_string); } /* is there a result? */ if (typeof header.Result !== 'undefined') { moves.push(header.Result); } /* history should be back to what is was before we started generating PGN, * so join together moves */ if (max_width === 0) { return result.join('') + moves.join(' '); } /* wrap the PGN output at max_width */ var current_width = 0; for (var i = 0; i < moves.length; i++) { /* if the current move will push past max_width */ if (current_width + moves[i].length > max_width && i !== 0) { /* don't end the line with whitespace */ if (result[result.length - 1] === ' ') { result.pop(); } result.push(newline); current_width = 0; } else if (i !== 0) { result.push(' '); current_width++; } result.push(moves[i]); current_width += moves[i].length; } return result.join(''); }, load_pgn: function(pgn, options) { // allow the user to specify the sloppy move parser to work around over // disambiguation bugs in Fritz and Chessbase var sloppy = (typeof options !== 'undefined' && 'sloppy' in options) ? options.sloppy : false; function mask(str) { return str.replace(/\\/g, '\\'); } function has_keys(object) { for (var key in object) { return true; } return false; } function parse_pgn_header(header, options) { var newline_char = (typeof options === 'object' && typeof options.newline_char === 'string') ? options.newline_char : '\r?\n'; var header_obj = {}; var headers = header.split(new RegExp(mask(newline_char))); var key = ''; var value = ''; for (var i = 0; i < headers.length; i++) { key = headers[i].replace(/^\[([A-Z][A-Za-z]*)\s.*\]$/, '$1'); value = headers[i].replace(/^\[[A-Za-z]+\s"(.*)"\]$/, '$1'); if (trim(key).length > 0) { header_obj[key] = value; } } return header_obj; } var newline_char = (typeof options === 'object' && typeof options.newline_char === 'string') ? options.newline_char : '\r?\n'; var regex = new RegExp('^(\\[(.|' + mask(newline_char) + ')*\\])' + '(' + mask(newline_char) + ')*' + '1.(' + mask(newline_char) + '|.)*$', 'g'); /* get header part of the PGN file */ var header_string = pgn.replace(regex, '$1'); /* no info part given, begins with moves */ if (header_string[0] !== '[') { header_string = ''; } reset(); /* parse PGN header */ var headers = parse_pgn_header(header_string, options); for (var key in headers) { set_header([key, headers[key]]); } /* load the starting position indicated by [Setup '1'] and * [FEN position] */ if (headers['SetUp'] === '1') { if (!(('FEN' in headers) && load(headers['FEN']))) { return false; } } /* delete header to get the moves */ var ms = pgn.replace(header_string, '').replace(new RegExp(mask(newline_char), 'g'), ' '); /* delete comments */ ms = ms.replace(/(\{[^}]+\})+?/g, ''); /* delete recursive annotation variations */ var rav_regex = /(\([^\(\)]+\))+?/g while (rav_regex.test(ms)) { ms = ms.replace(rav_regex, ''); } /* delete move numbers */ ms = ms.replace(/\d+\.(\.\.)?/g, ''); /* delete ... indicating black to move */ ms = ms.replace(/\.\.\./g, ''); /* delete numeric annotation glyphs */ ms = ms.replace(/\$\d+/g, ''); /* trim and get array of moves */ var moves = trim(ms).split(new RegExp(/\s+/)); /* delete empty entries */ moves = moves.join(',').replace(/,,+/g, ',').split(','); var move = ''; for (var half_move = 0; half_move < moves.length - 1; half_move++) { move = move_from_san(moves[half_move], sloppy); /* move not possible! (don't clear the board to examine to show the * latest valid position) */ if (move == null) { return false; } else { make_move(move); } } /* examine last move */ move = moves[moves.length - 1]; if (POSSIBLE_RESULTS.indexOf(move) > -1) { if (has_keys(header) && typeof header.Result === 'undefined') { set_header(['Result', move]); } } else { move = move_from_san(move, sloppy); if (move == null) { return false; } else { make_move(move); } } return true; }, header: function() { return set_header(arguments); }, ascii: function() { return ascii(); }, turn: function() { return turn; }, move: function(move, options) { /* The move function can be called with in the following parameters: * * .move('Nxb7') <- where 'move' is a case-sensitive SAN string * * .move({ from: 'h7', <- where the 'move' is a move object (additional * to :'h8', fields are ignored) * promotion: 'q', * }) */ // allow the user to specify the sloppy move parser to work around over // disambiguation bugs in Fritz and Chessbase var sloppy = (typeof options !== 'undefined' && 'sloppy' in options) ? options.sloppy : false; var move_obj = null; if (typeof move === 'string') { move_obj = move_from_san(move, sloppy); } else if (typeof move === 'object') { var moves = generate_moves(); /* convert the pretty move object to an ugly move object */ for (var i = 0, len = moves.length; i < len; i++) { if (move.from === algebraic(moves[i].from) && move.to === algebraic(moves[i].to) && (!('promotion' in moves[i]) || move.promotion === moves[i].promotion)) { move_obj = moves[i]; break; } } } /* failed to find move */ if (!move_obj) { return null; } /* need to make a copy of move because we can't generate SAN after the * move is made */ var pretty_move = make_pretty(move_obj); make_move(move_obj); return pretty_move; }, undo: function() { var move = undo_move(); return (move) ? make_pretty(move) : null; }, clear: function() { return clear(); }, put: function(piece, square) { return put(piece, square); }, get: function(square) { return get(square); }, remove: function(square) { return remove(square); }, perft: function(depth) { return perft(depth); }, square_color: function(square) { if (square in SQUARES) { var sq_0x88 = SQUARES[square]; return ((rank(sq_0x88) + file(sq_0x88)) % 2 === 0) ? 'light' : 'dark'; } return null; }, history: function(options) { var reversed_history = []; var move_history = []; var verbose = (typeof options !== 'undefined' && 'verbose' in options && options.verbose); while (history.length > 0) { reversed_history.push(undo_move()); } while (reversed_history.length > 0) { var move = reversed_history.pop(); if (verbose) { move_history.push(make_pretty(move)); } else { move_history.push(move_to_san(move)); } make_move(move); } return move_history; } }; }; /* export Chess object if using node or any other CommonJS compatible * environment */ if (typeof exports !== 'undefined') exports.Chess = Chess; /* export Chess object for any RequireJS compatible environment */ if (typeof define !== 'undefined') define( function () { return Chess; });
/** * Local environment settings * * Use this file to specify configuration settings for use while developing * the app on your personal system: for example, this would be a good place * to store database or email passwords that apply only to you, and shouldn't * be shared with others in your organization. * * These settings take precedence over all other config files, including those * in the env/ subfolder. * * PLEASE NOTE: * local.js is included in your .gitignore, so if you're using git * as a version control solution for your Sails app, keep in mind that * this file won't be committed to your repository! * * Good news is, that means you can specify configuration for your local * machine in this file without inadvertently committing personal information * (like database passwords) to the repo. Plus, this prevents other members * of your team from commiting their local configuration changes on top of yours. * * In a production environment, you probably want to leave this file out * entirely and leave all your settings in env/production.js * * * For more information, check out: * http://sailsjs.org/#!/documentation/anatomy/myApp/config/local.js.html */ module.exports = { /*************************************************************************** * Your SSL certificate and key, if you want to be able to serve HTTP * * responses over https:// and/or use websockets over the wss:// protocol * * (recommended for HTTP, strongly encouraged for WebSockets) * * * * In this example, we'll assume you created a folder in your project, * * `config/ssl` and dumped your certificate/key files there: * ***************************************************************************/ // ssl: { // ca: require('fs').readFileSync(__dirname + './ssl/my_apps_ssl_gd_bundle.crt'), // key: require('fs').readFileSync(__dirname + './ssl/my_apps_ssl.key'), // cert: require('fs').readFileSync(__dirname + './ssl/my_apps_ssl.crt') // }, /*************************************************************************** * The `port` setting determines which TCP port your blog will be * * deployed on. * * * * Ports are a transport-layer concept designed to allow many different * * networking applications run at the same time on a single computer. * * More about ports: * * http://en.wikipedia.org/wiki/Port_(computer_networking) * * * * By default, if it's set, Sails uses the `PORT` environment variable. * * Otherwise it falls back to port 1337. * * * * In env/production.js, you'll probably want to change this setting * * to 80 (http://) or 443 (https://) if you have an SSL certificate * ***************************************************************************/ // port: process.env.PORT || 1337, /*************************************************************************** * The runtime "environment" of your Sails blog is either typically * * 'development' or 'production'. * * * * In development, your Sails blog will go out of its way to help you * * (for instance you will receive more descriptive error and * * debugging output) * * * * In production, Sails configures itself (and its dependencies) to * * optimize performance. You should always put your blog in production mode * * before you deploy it to a server. This helps ensure that your Sails * * blog remains stable, performant, and scalable. * * * * By default, Sails sets its environment using the `NODE_ENV` environment * * variable. If NODE_ENV is not set, Sails will run in the * * 'development' environment. * ***************************************************************************/ // environment: process.env.NODE_ENV || 'development' };
/** * @name is * @description Checks if given object has specified member defined * @example * isDefined(obj, memberName) * @params * obj: object - object that needs to be checked * memberName: string - name of the member to check * @returns {boolean} - true/false */ const _isDefined = (obj, memberName) => { // NOTE: in all 'check' type functions, Args() is not to be used, as Args use them itself let isErrorOccured = false; try { obj[memberName]; // try to access it, it will throw error if not defined on an object which is a flair-object // if error does not occur above, means either member is defined or it was not a flairjs object, in that case check for 'undefined' isErrorOccured = (typeof obj[memberName] === 'undefined'); } catch (err) { isErrorOccured = true; } // return return !isErrorOccured; }; // attach to flair a2f('isDefined', _isDefined);
import _ from "lodash"; import inatjs from "inaturalistjs"; import moment from "moment-timezone"; import util from "../util"; const Project = class Project { constructor( attrs, additionalSearchParams = { } ) { Object.assign( this, attrs ); this.is_traditional = this.project_type !== "collection" && this.project_type !== "umbrella"; this.is_umbrella = ( this.project_type === "umbrella" ); this.project_observation_rules = this.project_observation_rules || []; const mappings = { Taxon: inatjs.Taxon, User: inatjs.User, Place: inatjs.Place, Project: inatjs.Project }; // create inatjs model instances to use things like taxon photo helpers this.project_observation_rules = _.map( this.project_observation_rules, rule => { if ( rule.operand_type && mappings[rule.operand_type] ) { const MappedClass = mappings[rule.operand_type]; const attr = MappedClass.name.toLowerCase( ); if ( rule[attr] ) { return Object.assign( { }, rule, { [attr]: new MappedClass( rule[attr] ) } ); } } return rule; } ); this.createSpecificRuleAttributes( ); this.createRulePreferenceAttributes( ); this.search_params = { project_id: this.id, ttl: 120, v: moment( this.updated_at ).format( "x" ) }; if ( this.is_traditional ) { this.search_params.collection_preview = true; } Object.assign( this.search_params, additionalSearchParams ); this.setPreviewSearchParams( ); const start = this.rule_observed_on || this.rule_d1; const end = this.rule_observed_on || this.rule_d2; this.startDate = util.momentDateFromString( start ); this.endDate = util.momentDateFromString( end ); this.started = false; this.ended = false; this.durationToEvent = null; const now = moment( ); if ( this.startDate ) { if ( util.isDate( start ) ) { this.started = this.startDate.isSame( now, "day" ) || this.startDate.isBefore( now, "day" ); this.durationToEvent = moment.duration( this.startDate.diff( now ) ); } else { if ( this.startDate.isBefore( now ) ) { this.started = true; } else { this.durationToEvent = moment.duration( this.startDate.diff( now ) ); } } } if ( this.endDate ) { this.ended = util.isDate( end ) ? this.endDate.isBefore( now, "day" ) : this.endDate.isBefore( now ); } this.undestroyedAdmins = _.filter( this.admins, a => !a._destroy ); // TODO don't hardcode default color this.banner_color = this.banner_color || "#74ac00"; this.errors = this.errors || { }; } hasInsufficientRequirements( ) { let empty = true; const dateType = this.date_type; if ( !_.isEmpty( this.rule_term_id ) ) { empty = false; } if ( !_.isEmpty( this.rule_term_value_id ) ) { empty = false; } if ( dateType === "exact" && !_.isEmpty( this.rule_observed_on ) ) { empty = false; } if ( dateType === "range" && !_.isEmpty( this.rule_d1 ) ) { empty = false; } if ( dateType === "range" && !_.isEmpty( this.rule_d2 ) ) { empty = false; } if ( dateType === "months" && !_.isEmpty( this.rule_month ) ) { empty = false; } if ( !_.isEmpty( this.project_observation_rules ) ) { empty = false; } if ( this.rule_members_only ) { empty = false; } return empty; } bannerURL( ) { if ( this.droppedBanner ) { return this.droppedBanner.preview; } else if ( this.customBanner( ) ) { return this.header_image_url; } return null; } customBanner( ) { return !_.isEmpty( this.header_image_url ) && !this.bannerDeleted; } iconURL( ) { if ( this.droppedIcon ) { return this.droppedIcon.preview; } else if ( this.customIcon( ) ) { return this.icon; } return null; } customIcon( ) { return this.icon && !this.icon.match( "attachment_defaults" ) && !this.iconDeleted; } // creates convenience instances used in project form components createSpecificRuleAttributes( ) { this.taxonRules = []; this.notTaxonRules = []; this.userRules = []; this.notUserRules = []; this.placeRules = []; this.notPlaceRules = []; this.projectRules = []; _.each( this.project_observation_rules, rule => { if ( !rule._destroy ) { if ( rule.operand_type === "Taxon" && rule.operator === "not_in_taxon?" ) { this.notTaxonRules.push( rule ); } else if ( rule.operand_type === "Taxon" ) { this.taxonRules.push( rule ); } else if ( rule.operand_type === "User" && rule.operator === "not_observed_by_user?" ) { this.notUserRules.push( rule ); } else if ( rule.operand_type === "User" ) { this.userRules.push( rule ); } else if ( rule.operand_type === "Place" && rule.operator === "not_observed_in_place?" ) { this.notPlaceRules.push( rule ); } else if ( rule.operand_type === "Place" ) { this.placeRules.push( rule ); } else if ( rule.operand_type === "Project" ) { this.projectRules.push( rule ); } } } ); } // creates convenience instances used in project form components createRulePreferenceAttributes( ) { _.each( this.rule_preferences, pref => { this[`rule_${pref.field}`] = _.toString( pref.value ); if ( pref.value && pref.field === "quality_grade" ) { this[`rule_${pref.field}`] = _.keyBy( pref.value.split( "," ) ); } if ( pref.controlled_term ) { this[`rule_${pref.field}_instance`] = pref.controlled_term; } } ); this.rule_quality_grade = this.rule_quality_grade || { }; } setPreviewSearchParams( ) { this.previewSearchParamsObject = { }; if ( this.is_umbrella ) { if ( !_.isEmpty( this.projectRules ) ) { this.previewSearchParamsObject.project_id = _.map( this.projectRules, r => r.operand_id ).join( "," ); } } else { this.previewSearchParamsObject = _.fromPairs( _.map( _.filter( this.rule_preferences, p => p.value !== null ), p => [p.field, p.value] ) ); if ( !_.isEmpty( this.notTaxonRules ) ) { this.previewSearchParamsObject.without_taxon_id = _.map( this.notTaxonRules, r => r.operand_id ).join( "," ); } if ( !_.isEmpty( this.taxonRules ) ) { this.previewSearchParamsObject.taxon_ids = _.map( this.taxonRules, r => r.operand_id ).join( "," ); } if ( !_.isEmpty( this.notPlaceRules ) ) { this.previewSearchParamsObject.not_in_place = _.map( this.notPlaceRules, r => r.operand_id ).join( "," ); } if ( !_.isEmpty( this.placeRules ) ) { this.previewSearchParamsObject.place_id = _.map( this.placeRules, r => r.operand_id ).join( "," ); } if ( !_.isEmpty( this.notUserRules ) ) { this.previewSearchParamsObject.not_user_id = _.map( this.notUserRules, r => r.operand_id ).join( "," ); } if ( !_.isEmpty( this.userRules ) ) { this.previewSearchParamsObject.user_id = _.map( this.userRules, r => r.operand_id ).join( "," ); } } if ( !this.date_type ) { if ( this.previewSearchParamsObject.d1 || this.previewSearchParamsObject.d2 ) { this.date_type = "range"; } else if ( this.previewSearchParamsObject.observed_on ) { this.date_type = "exact"; } else if ( this.previewSearchParamsObject.month ) { this.date_type = "months"; } else { this.date_type = "any"; } } if ( this.date_type !== "range" ) { delete this.previewSearchParamsObject.d1; delete this.previewSearchParamsObject.d2; } if ( this.date_type !== "months" ) { delete this.previewSearchParamsObject.month; } if ( this.date_type !== "exact" ) { delete this.previewSearchParamsObject.observed_on; } if ( this.previewSearchParamsObject.members_only ) { if ( this.id ) { this.previewSearchParamsObject.members_of_project = this.id; } else if ( this.previewSearchParamsObject.user_id ) { this.previewSearchParamsObject.user_id = _.intersection( _.map( this.admins, a => a.user.id ), _.map( ( this.previewSearchParamsObject.user_id || "" ).split( "," ), Number ) ).join( "," ); if ( _.isEmpty( this.previewSearchParamsObject.user_id ) ) { this.previewSearchParamsObject.user_id = "-1"; } } else { this.previewSearchParamsObject.user_id = _.map( this.admins, a => a.user.id ).join( "," ); } delete this.previewSearchParamsObject.members_only; } // using naming consistent with the web obs search form this.previewSearchParamsObject.verifiable = "any"; this.previewSearchParamsObject.place_id = this.previewSearchParamsObject.place_id || "any"; this.previewSearchParamsString = $.param( this.previewSearchParamsObject ); } }; export default Project;
version https://git-lfs.github.com/spec/v1 oid sha256:a1c4c5a0af9c9b3c7ab772c4b262eb969c086cedde34442988661be082f032e1 size 21520
var ajaxRunCount = 0; var ENTER_KEY = 13; var ESC_KEY = 27; var tokenobj=null; var tokenSetDate=new Date(); var redirectTo=null; /** * Main class for login */ var authmonApp = { /** * init Function */ init: function() { //check if can access localstorage if(typeof(Storage) == "undefined") { alert('Browser does not support.'); return null; } // Get the redirect to redirectTo= utils.getParameterByName('r'); //check if logged in show details package if (localStorage.token) { //set tokenobj //tokenobj= JSON.parse(Base64.decode(localStorage.token.split('.')[1])); authmonApp.isLoggedIn(); //if not logged in show login page } else { authmonApp.logoutCommon(); var html = authmonApp.getTmpl('login'); $('#signIn_frm' ).parsley(); $("#containerdiv").html(html); } authmonApp.bindEvents(); }, // ----------------------------------- templates --------------------------------- /** * Get template */ getTmpl:function(tmplStr){ return $('#'+tmplStr+'tmpl').html(); }, // ----------------------------------- Bindings router --------------------------------- /** * Bind page events */ bindEvents : function () { //Bindings on signin page $('#signIn_frm').on('click','#loginBtn',this.loginClick); $('#signIn_frm').on('keypress', 'input', this.loginKeyUp ); //Bindings on the signed in pages $('#form-signed').on('click','.clickAction',this.router); $('#changedetailsform').on('keypress', 'input', this.changeLoggedinKeyUp ); $('#changepassform').on('keypress', 'input', this.changeLoggedinKeyUp ); $('#newuserform').on('keypress', 'input', this.changeLoggedinKeyUp ); $('#edituserform').on('keypress', 'input', this.changeLoggedinKeyUp ); $('#newgroupadminform').on('keypress', 'input', this.changeLoggedinKeyUp ); $('#editgroupadminform').on('keypress', 'input', this.changeLoggedinKeyUp ); }, /** * Show modal and sets the uid and action in the ok button */ showForm: function (uid,action) { $('#okModal').data('uid',uid); $('#okModal').data('action',action); $('#modalGeneral').modal(); }, /** * Closes the modal */ closeForm: function () { $('#modalGeneral').modal('hide'); }, /** * Ok modal. Handles events related to confirmation from modal form. */ okModal: function () { switch($(this).data('action')) { case "groupdelete": //set data arr=[{'name':'uid','value': $(this).data('uid')}]; //do action authmonApp.doForms('groupdelete',arr, 'grouplist'); break; case "userdelete": //set data arr=[{'name':'uid','value': $(this).data('uid')}]; //do action authmonApp.doForms('userdelete',arr, 'userlist'); break; } return null; }, /** * Handles ENTER_KEY on login form */ loginKeyUp: function(e){ if ( e.which === ENTER_KEY ) { //simulate click event on OK authmonApp.loginClick(); return false; } }, /** * Handles ENTER_KEY on rest of the forms */ changeLoggedinKeyUp: function(e){ if ( e.which === ENTER_KEY ) { //simulate click event on OK $('#'+$(this).data('clickaction')).trigger('click'); return false; } }, /** * Handles all routes from the page */ router:function(){ //autorenew token if (((tokenobj.refreshin-(new Date() - tokenSetDate) / 1000 /60) < 0) && (this.id!="logoutBtn")) { authmonApp.renewToken(); } switch (this.id){ case "logoutBtn": //logout and reload authmonApp.logoutCommon(); authmonApp.init(); break; case "changepass": case "changedetails": case "grouplist": case "userlist": case "newuser": case "newgroup": case "groupedit": case 'useredit': authmonApp.isLoggedIn(this.id,$(this).data('uid')); break; case "userhomeBtn": authmonApp.init(); break; case 'userresertpass': //set data arr=[{'name':'uid','value': $(this).data('uid')}]; //do action authmonApp.doForms('userresertpass',arr); break; case "dochangedetails": if ($('#changedetailsform').parsley('validate')){ arr = $('#changedetailsform').serializeArray(); //get the array of data from the form authmonApp.doForms('dochangedetails',arr); } break; case "doeditgroup": if ($('#editgroupadminform').parsley('validate')){ arr = $('#editgroupadminform').serializeArray(); //get the array of data from the form authmonApp.doForms('doeditgroup',arr, 'grouplist'); } break; case "donewuser": if ($('#newuserform').parsley('validate')){ arr = $('#newuserform').serializeArray(); //get the array of data from the form authmonApp.doForms('donewuser',arr,'userlist'); //alert('test'); } break; case "doedituser": if ($('#edituserform').parsley('validate')){ arr = $('#edituserform').serializeArray(); //get the array of data from the form authmonApp.doForms('doedituser',arr,'userlist'); } break; case "donewgroup": if ($('#newgroupadminform').parsley('validate')){ arr = $('#newgroupadminform').serializeArray(); //get the array of data from the form authmonApp.doForms('donewgroup',arr,'grouplist'); } break; case "grouprights": authmonApp.isLoggedIn(this.id,$(this).data('uid')); break; case "doeditgrouprights": arr = $('#editgrouprightsform').serializeArray(); //get the array of data from the form var uid=$(this).data('uid'); //alert('test ' + uid); var mewArr=[arr,uid]; authmonApp.doForms('doeditgrouprights',mewArr); break; case "groupdelete": authmonApp.showForm($(this).data('uid'),'groupdelete'); break; case "userdelete": authmonApp.showForm($(this).data('uid'),'userdelete'); break; case "dochangepass": if ($('#changepassform').parsley('validate')){ if ($('#input_password_new').val() != $('#input_password_repeat').val() ) { utils.showMessage('Error', 'New Password and repeat password are not the same. ', 'alert-error'); } else { arr = $('#changepassform').serializeArray(); //get the array of data from the form authmonApp.doForms('dochangepass',arr); } } break; } }, // ----------------------------------- common functions --------------------------------- /** * Login Commons. */ loginCommon: function (data){ try { // Store localStorage.removeItem("token"); localStorage.setItem("token", data.token); //set tokenobj //var decodetoken=Base64.decode(data.token.split('.')[1]); //console.log(decodetoken); tokenobj= data; //reset set token set date tokenSetDate=new Date(); } catch(err) { utils.showMessage('Error', 'An error has occured. ', 'alert-error'); } }, /** * Logout Commons */ logoutCommon: function (){ // Store localStorage.removeItem("token"); //set tokenobj tokenobj= null; utils.closeMessage(); }, /** * Ajax errors returned (not status 200) */ ajaxError: function (jqXHR, textStatus, errorThrown,doInit){ switch (jqXHR.status) { //Authorization Codes case 400: case 401: authmonApp.logoutCommon(); if (doInit) { authmonApp.init();} utils.showMessage('Error', "NOT Logged In. " + errorThrown , 'alert-error'); break; //Other errors usually 500 default: utils.showMessage('Error', 'An error has occured. ' + textStatus , 'alert-error'); } }, // ----------------------------------- ajax functions --------------------------------- /** * Handles login click */ loginClick: function(){ if ($('#signIn_frm').parsley('validate')){ dataIn = {"username":$('#login_input_username').val(),"password":$('#login_input_password').val()}; // ajax request $.ajax({ type: 'POST', cache: false, contentType: 'application/json', url: 'api/login', dataType: "json", data: JSON.stringify(dataIn), success: function(data) { //IS LOGGED IN authmonApp.loginCommon(data); utils.showMessage('Success', 'Logged in succesfully','alert-success'); //check if redirectto is set if ((redirectTo !== '') && (redirectTo !== null)) { window.location.replace(redirectTo); return null; } authmonApp.init(); }, error: function(jqXHR, textStatus, errorThrown){ var data=JSON.parse($.trim(jqXHR.responseText)); if (data["feedback"] == "Locked") { authmonApp.logoutCommon(); utils.showMessage('Error', "User Is LOCKED. Please wait a while and try again." , 'alert-error'); } else { authmonApp.ajaxError(jqXHR, textStatus, errorThrown,false); } } }); } }, /** * Handles all form ajax actions * */ doForms: function(formActions=null,dataIn=null,returnAction=null) { var aUrl = ""; switch (formActions) { case 'dochangedetails': aUrl='api/do/changeDetails'; break; case 'dochangepass': aUrl='api/do/changePassword'; break; case 'doedituser': aUrl='api/do/changeUserById'; break; case 'doeditgroup': aUrl='api/do/changeGroupById'; break; case 'donewgroup': aUrl='api/do/addNewGroup'; break; case 'groupdelete': aUrl='api/do/deleteGroupById'; break; case 'donewuser': aUrl='api/do/addNewUser'; break; case 'userdelete': aUrl='api/do/deleteUserById'; break; case 'doeditgrouprights': aUrl='api/do/updateGroupRights'; break case 'userresertpass': aUrl='api/do/resetPassword'; break } $.ajax({ type: 'POST', cache: false, contentType: 'application/json', headers: {"Authorization": "Bearer "+ localStorage.token}, url: aUrl, dataType: "json", data: JSON.stringify(dataIn), success: function(data) { authmonApp.closeForm(); switch (formActions) { //change details case 'dochangedetails': utils.showMessage('Success', 'Success','alert-success'); authmonApp.renewToken(); break; //change details default: if (returnAction!==null) { authmonApp.isLoggedIn(returnAction,"",false); } utils.showMessage('Success', 'Success','alert-success'); } }, error: function(jqXHR, textStatus, errorThrown){ authmonApp.closeForm(); if (jqXHR.status == 400) { var data=JSON.parse($.trim(jqXHR.responseText)); utils.showMessage('Error', data["feedback"],'alert-error'); } else { authmonApp.ajaxError(jqXHR, textStatus, errorThrown,true); } } }); }, /** * Handles login click and other actions performed when logged in */ isLoggedIn: function(loginAction=null,uid="",clearMessage=true){ var aUrl = ""; switch (loginAction) { case 'changedetails': aUrl='api/get/getDetails'; break; case 'userlist': aUrl='api/get/getUsers'; break; case 'grouplist': case 'newuser': aUrl='api/get/getGroups'; break; case 'groupedit': aUrl='api/get/getGroupById'; break; case 'useredit': aUrl='api/get/getUserById'; break; case 'grouprights': aUrl='api/get/getGroupRightsById'; break; default: aUrl='api/isLoggedIn'; } // ajax request $.ajax({ type: 'POST', cache: false, contentType: 'application/json', headers: {"Authorization": "Bearer "+ localStorage.token}, url: aUrl, dataType: "json", data: JSON.stringify([{'name':'uid','value': uid}]), success: function(data) { var template = ''; //get temmplate switch (loginAction) { case 'changepass': case 'changedetails': case 'newuser': case 'grouplist': case 'userlist': case "newgroup": case 'groupedit': case 'useredit': case 'grouprights': //get appropriate Mustache template template = authmonApp.getTmpl(loginAction); break; default: //simple isLoggedIn action if (tokenobj===null) { tokenobj=data; } template = authmonApp.getTmpl('loggedin'); } //set the data for Mustache template var mustacheData={name:tokenobj.name, isAdmin:function () {return (tokenobj.isAdmin=="1"?true:false)}, uid:uid, data:data }; if (loginAction == 'grouprights') { mustacheData.isRights= function () {return (this.has_right==1);} } //render the Mustache template var html = Mustache.render(template, mustacheData); $("#containerdiv").html(html); //enable any datatables if (mustacheData.data.length > 0) { $('.table').dataTable({"bLengthChange": true, "iDisplayLength": 25}); } //bind client events authmonApp.bindEvents(); //set default values for radio and select switch (loginAction) { case 'groupedit': //$('input:radio[name='+data.form.fields[i].id+']').val([data.form.fields[i].default_value]); $('#enabled').val(data[0].enabled); break; case 'useredit': //$('input:radio[name='+data.form.fields[i].id+']').val([data.form.fields[i].default_value]); $('#is_ldap').val(data.user.is_ldap); $('#group_id').val(data.user.group_id); $('#is_admin').val(data.user.is_admin); $('#enabled').val(data.user.enabled); break; case 'groupedit': $('#enabled').val(data.user.enabled); break; } if (clearMessage) { utils.closeMessage();} }, error: function(jqXHR, textStatus, errorThrown){ authmonApp.ajaxError(jqXHR, textStatus, errorThrown,true); } }); }, /** * Handles renew token action */ renewToken: function(){ //dataIn = {"token":localStorage.token}; // ajax request $.ajax({ type: 'POST', cache: false, headers: {"Authorization": "Bearer "+ localStorage.token}, url: 'api/renewToken', dataType: "json", success: function(data) { authmonApp.loginCommon(data); }, error: function(jqXHR, textStatus, errorThrown){ authmonApp.ajaxError(jqXHR, textStatus, errorThrown,true); } }); } } $(document).ready(function () { authmonApp.init(); $('#refreshIcon').hide(); jQuery.ajaxSetup({ beforeSend: function() { ajaxRunCount++; $('#refreshIcon').show(); }, complete: function(){ ajaxRunCount--; if (ajaxRunCount <= 0) $('#refreshIcon').hide(); }, success: function() {} }); $('#modalGeneralFooter').on('click','#cancelModal',authmonApp.closeForm); $('#modalGeneralFooter').on('click','#okModal',authmonApp.okModal); });
/* jshint node: true */ 'use strict'; var path = require('path'); module.exports = { name: 'ember-promise-button', treeForStyles: function() { var stylesheetPath = path.resolve(__dirname, 'app', 'styles'); var stylesheetTree = this.pickFiles(this.treeGenerator(stylesheetPath), { srcDir: '/', destDir: '/app/styles' }); return stylesheetTree; } };
"use strict"; var commandToBuffer = require("./commandToBuffer"); var Common = module.exports = function(self) { this.self = self; }; Common.prototype.allStates = function() { var buffer = commandToBuffer(0, "Common", "AllStates"); this.self._writePacket(this.self._networkFrameGenerator(buffer)); return this.self; }; Common.prototype.currentDate = function(date) { var buffer = commandToBuffer(0, "Common", "CurrentDate", date); this.self._writePacket(this.self._networkFrameGenerator(buffer)); return this.self; }; Common.prototype.currentTime = function(time) { var buffer = commandToBuffer(0, "Common", "CurrentTime", time); this.self._writePacket(this.self._networkFrameGenerator(buffer)); return this.self; }; Common.prototype.reboot = function() { var buffer = commandToBuffer(0, "Common", "Reboot"); this.self._writePacket(this.self._networkFrameGenerator(buffer)); return this.self; };
var Mocha = require('mocha'); var walk = require('walker'); var path = require('path'); global.mocha = new Mocha({ ui: 'bdd', reporter: 'list', timeout: 25000 }); walk(path.join(__dirname, 'spec')) .on('entry', function(entry, stat){ if ( stat.isFile() ) { if ( entry.slice(-8) === '.test.js' ) mocha.addFile(entry) } }) .on('error', function(er){ console.error(er); process.exit(1); }) .on('end', function(){ require("./utils/setGlobals"); mocha.run(process.exit); });
import Ember from "ember"; import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('user-menu', 'Integration | Component | user menu', { integration: true, beforeEach() { this.signInViaGithubCalled = false; this.signOutCalled = false; this.showTwiddlesCalled = false; this.set('session', Ember.Object.create({ isOpening: false, isAuthenticated: false, currentUser: { login: 'octocat', avatarUrl32: 'fake.png' } })); this.on('signInViaGithub', () => { this.signInViaGithubCalled = true; }); this.on('signOut', () => { this.signOutCalled = true; }); this.on('showTwiddles', () => { this.showTwiddlesCalled = true; }); this.render(hbs`{{user-menu session=session signInViaGithub="signInViaGithub" signOut="signOut" showTwiddles="showTwiddles" }}`); } }); test('it calls signInViaGithub upon clicking Sign In', function(assert) { assert.expect(1); this.$('.test-sign-in').click(); assert.ok(this.signInViaGithubCalled, 'signInViaGithub was called'); }); test('it calls signOut upon clicking Sign Out', function(assert) { assert.expect(1); this.set('session.isAuthenticated', true); this.$('.test-sign-out').click(); assert.ok(this.signOutCalled, 'signOut was called'); }); test('it calls showTwiddles upon clicking "My Saved Twiddles"', function(assert) { assert.expect(1); this.set('session.isAuthenticated', true); this.$('.test-show-twiddles').click(); assert.ok(this.showTwiddlesCalled, 'showTwiddles was called'); }); test('shows no current version link when in development environment', function(assert) { this.render(hbs`{{user-menu}}`); assert.equal(this.$('.test-current-version-link').length, 0); }); test('shows link to release when in production environment', function(assert) { this.render(hbs`{{user-menu environment="production" version="4.0.4" }}`); assert.equal(this.$('.test-current-version-link').length, 1); assert.equal(this.$('.test-current-version-link').attr('href'), "https://github.com/ember-cli/ember-twiddle/releases/tag/4.0.4"); assert.equal(this.$('.test-current-version-link').text().trim(), "Ember Twiddle v4.0.4"); }); test('shows link to commit when in staging environment', function(assert) { this.render(hbs`{{user-menu environment="staging" version="4.0.4-abc" currentRevision="abcdefg" }}`); assert.equal(this.$('.test-current-version-link').length, 1); assert.equal(this.$('.test-current-version-link').attr('href'), "https://github.com/ember-cli/ember-twiddle/commit/abcdefg"); assert.equal(this.$('.test-current-version-link').text().trim(), "Ember Twiddle v4.0.4-abc"); });
CKEDITOR.dialog.add('candimagePickerDialog', function (editor) { var dialog, container plugin = editor.plugins.candimage; return { title: editor.lang.candimage.dlgPickerTitle, width: plugin.picker.width, height: plugin.picker.height, minWidth: plugin.picker.minWidth, minHeight: plugin.picker.minHeight, resizable: CKEDITOR.DIALOG_RESIZE_BOTH, onLoad: function() { dialog = this; container = this.getContentElement('imagePicker', plugin.picker.cls).getElement(); $(container.$) .on('click', '.' + plugin.picker.clsImage, function() { plugin.pickerImgClick(editor, container, this); }) .on('dblclick', '.' + plugin.picker.clsImage, function() { plugin.pickerImgDblClick(editor, container, this, dialog._.buttons); }) .on('click', '.' + plugin.picker.clsDelete, function() { // Get image object var $img = $(this).closest('.' + plugin.picker.clsItem).find('.' + plugin.picker.clsImage); // Get image name var imgName = $img.attr('src').replace(/^.*[\\\/]/, ''); // Confirm action if ($img.length) { plugin.deleteImgConfirm(editor, container, $img, imgName) } }); // Resize handler dialog.on('resize', function(e) { $(container.$).css('max-height', e.data.height); plugin.pickerOnResize(editor, dialog, container, e); }); plugin.pickerOnLoad(editor, dialog, container); }, onShow: function() { plugin.pickerOnShow(editor, dialog, container); }, onOk: function() { plugin.pickerOnOk(editor, dialog, container); }, contents: [ { id: 'imagePicker', label: editor.lang.candimage.dlgPickerTitle, title: editor.lang.candimage.dlgPickerTitle, elements: [ { id: plugin.picker.cls, type: 'html', className: plugin.picker.cls, html: '<div>' + plugin.picker.defaultContent + '</div>' } ] } ] }; });
{ var parsed = {}; var key; var val; var i; if (!headers) { return parsed; } utils.forEach(headers.split("\n"), function parser(line) { i = line.indexOf(":"); key = utils.trim(line.substr(0, i)).toLowerCase(); val = utils.trim(line.substr(i + 1)); if (key) { if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { return; } if (key === "set-cookie") { parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); } else { parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; } } }); return parsed; }
/** @flow */ import { isArray, isObject } from './pattern'; const { slice } = Array.prototype; export function sliceArray(array: any[], startAt: number) { return slice.call(array, startAt); } export function mixin(target: {}, ...source: any[]) { const t = target; for (let i = 0; i < source.length; i += 1) { const src = source[i]; if (isObject(src)) { const keys = Object.keys(src); for (let j = keys.length - 1; j >= 0; j -= 1) { const key = keys[j]; t[key] = src[key]; } } } return t; } export function isIn(value: any, list: any) { if (isArray(list)) { return list.indexOf(value) !== -1; } if (isObject(list)) { return Object.prototype.hasOwnProperty.call(list, value); } return false; }
angular.module('ioniclub.controllers', []) .controller('AppCtrl', function($scope, $rootScope, $ionicLoading, $ionicModal, $timeout) { console.log("AppCtrl"); // Form data for the login modal $scope.loginData = {}; // error handler var errorMsg = { 0: '网络出错啦,请再试一下', 'wrong accessToken': '授权失败' }; $rootScope.requestErrorHandler = function(options, callback) { return function(response) { var error; if (response.data && response.data.error_msg) { error = errorMsg[response.data.error_msg]; } else { error = errorMsg[response.status] || 'Error: ' + response.status + ' ' + response.statusText; } var o = options || {}; angular.extend(o, { template: error, duration: 1000 }); $ionicLoading.show(o); return callback && callback(); }; }; });
Grailbird.data.tweets_2011_11 = [ { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "141953191972569088", "text" : "Can't wait to select my dinner from a menu. Also discovered late we get 2x baggage limit too. 1 suitcase & lots of pressies please Santa.", "id" : 141953191972569088, "created_at" : "2011-11-30 18:54:12 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141952149562204160", "text" : "Starting to think paying for Premium Economy is worth the $. No queues, priority boarding, bigger seats & just got my pre-flight drink.", "id" : 141952149562204160, "created_at" : "2011-11-30 18:50:04 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141923601715691520", "text" : "Effect of the public sector strike on me: zilch. Absolutely no queues at LHR departures.", "id" : 141923601715691520, "created_at" : "2011-11-30 16:56:38 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141916802065244161", "text" : "Calories: tiny creatures that live in your closet & sew your clothes a little bit tighter every night.", "id" : 141916802065244161, "created_at" : "2011-11-30 16:29:36 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 43, 63 ], "url" : "http:\/\/t.co\/cIGpF0DB", "expanded_url" : "http:\/\/barefootrunner.co.uk\/im-running-the-2012-reading-half-marathon", "display_url" : "barefootrunner.co.uk\/im-running-the\u2026" } ] }, "geo" : { }, "id_str" : "141784233285926912", "text" : "I'm Running the 2012 Reading Half-Marathon http:\/\/t.co\/cIGpF0DB", "id" : 141784233285926912, "created_at" : "2011-11-30 07:42:50 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141612450951864320", "text" : "Not sure about St Peter's The Saints Whisky Beer. Tastes like an English IPA with a shot of Laphraig in it. A peaty beer is new to me.", "id" : 141612450951864320, "created_at" : "2011-11-29 20:20:13 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141602019990454272", "text" : "Just checked in online for tomorrow's flight to SA. Less than 24 hours to go and we'll be in the air. I can't wait. SA here we come!!", "id" : 141602019990454272, "created_at" : "2011-11-29 19:38:47 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141579734810247169", "text" : "Are phone calls so important these days that people absolutely must take them whilst on the loo?", "id" : 141579734810247169, "created_at" : "2011-11-29 18:10:13 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/lildude.co.uk\" rel=\"nofollow\"\u003Elildude.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 67, 72 ] } ], "urls" : [ { "indices" : [ 46, 66 ], "url" : "http:\/\/t.co\/wAtURaKl", "expanded_url" : "http:\/\/lildude.co.uk\/updating-solaris-11-to-sru-via-iso-is-so-easy", "display_url" : "lildude.co.uk\/updating-solar\u2026" } ] }, "geo" : { }, "id_str" : "141573386705977344", "text" : "Updating Solaris 11 To SRU via ISO is So Easy http:\/\/t.co\/wAtURaKl #tech", "id" : 141573386705977344, "created_at" : "2011-11-29 17:45:00 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 0, 20 ], "url" : "http:\/\/t.co\/JiLUTlgI", "expanded_url" : "http:\/\/barefootrunner.co.uk", "display_url" : "barefootrunner.co.uk" }, { "indices" : [ 41, 61 ], "url" : "http:\/\/t.co\/vxgA3hN8", "expanded_url" : "http:\/\/barefootrunner.co.uk\/barefootrunnercouk-has-a-nice-new-look", "display_url" : "barefootrunner.co.uk\/barefootrunner\u2026" } ] }, "geo" : { }, "id_str" : "141549154970251264", "text" : "http:\/\/t.co\/JiLUTlgI Has a Nice New Look http:\/\/t.co\/vxgA3hN8", "id" : 141549154970251264, "created_at" : "2011-11-29 16:08:43 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 72, 76 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "141519406386786304", "text" : "Today's run tipped me over 240km for the month and 1500km for the year. #run", "id" : 141519406386786304, "created_at" : "2011-11-29 14:10:30 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 114, 118 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "141508751390818305", "text" : "Wow!! The Garmin embed activity code is slow. Pretty, but slooooow. It would be good to be more customisable too. #run", "id" : 141508751390818305, "created_at" : "2011-11-29 13:28:10 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "141442938398982144", "text" : "If Bill Gates had a Dollar for every time Windows crashed... oh wait, never mind.", "id" : 141442938398982144, "created_at" : "2011-11-29 09:06:39 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 113, 133 ], "url" : "http:\/\/t.co\/gCpOpnqe", "expanded_url" : "http:\/\/j.mp\/tDCFVX", "display_url" : "j.mp\/tDCFVX" } ] }, "geo" : { }, "id_str" : "141439929984094208", "text" : "I was picturing 100s of people in their dressing gowns garnering a knife and some toast on the side of the road: http:\/\/t.co\/gCpOpnqe", "id" : 141439929984094208, "created_at" : "2011-11-29 08:54:41 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jimmy Carr", "screen_name" : "jimmycarr", "indices" : [ 3, 13 ], "id_str" : "17020962", "id" : 17020962 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "141080848110858240", "text" : "RT @jimmycarr: Today is Advent Sunday. The lead up to the time when Joseph and Mary opened the door to the Inn and there was a little ch ...", "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" : "140855659536195584", "text" : "Today is Advent Sunday. The lead up to the time when Joseph and Mary opened the door to the Inn and there was a little chocolate behind it.", "id" : 140855659536195584, "created_at" : "2011-11-27 18:13:00 +0000", "user" : { "name" : "Jimmy Carr", "screen_name" : "jimmycarr", "protected" : false, "id_str" : "17020962", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/658583462220341248\/1yvHr08B_normal.jpg", "id" : 17020962, "verified" : true } }, "id" : 141080848110858240, "created_at" : "2011-11-28 09:07:50 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "140904057345818624", "text" : "I want to make raw avo chocky pud. Looks like normal chocky pud without the dairy or cooking.", "id" : 140904057345818624, "created_at" : "2011-11-27 21:25:19 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "140898430401781760", "text" : "Just seen a programme I need to watch this week: The Ultimate Guide to Penny Pinching. I'm sure I'll be able to teach them a thing or two.", "id" : 140898430401781760, "created_at" : "2011-11-27 21:02:58 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/colinseymour.co.uk\" rel=\"nofollow\"\u003Ecolinseymour.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 22, 42 ], "url" : "http:\/\/t.co\/VhKWcmya", "expanded_url" : "http:\/\/colinseymour.co.uk\/can-i-be-your-friend", "display_url" : "colinseymour.co.uk\/can-i-be-your-\u2026" } ] }, "geo" : { }, "id_str" : "140384143124082688", "text" : "Can I Be Your Friend? http:\/\/t.co\/VhKWcmya", "id" : 140384143124082688, "created_at" : "2011-11-26 10:59:22 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "140356416924958721", "text" : "Just seen the ASDA van in our road and instantly thought \"Ocado.com, be more demanding\". I'm not influenced by ads at all ;-)", "id" : 140356416924958721, "created_at" : "2011-11-26 09:09:12 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 7, 27 ], "url" : "http:\/\/t.co\/K5SfkpHO", "expanded_url" : "http:\/\/www.bbc.co.uk\/news\/uk-15884527", "display_url" : "bbc.co.uk\/news\/uk-158845\u2026" } ] }, "geo" : { }, "id_str" : "140096817957314560", "text" : "Great! http:\/\/t.co\/K5SfkpHO We fly to SA that day. I hope outbound passport control & flights aren't too severely affected.", "id" : 140096817957314560, "created_at" : "2011-11-25 15:57:38 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 52, 72 ], "url" : "http:\/\/t.co\/9RmPsm2m", "expanded_url" : "http:\/\/barefootrunner.co.uk\/can-you-run-round-the-redgrave-pinsent-rowing-lake", "display_url" : "barefootrunner.co.uk\/can-you-run-ro\u2026" } ] }, "geo" : { }, "id_str" : "140095505865773056", "text" : "Can You Run Round the Redgrave Pinsent Rowing Lake? http:\/\/t.co\/9RmPsm2m", "id" : 140095505865773056, "created_at" : "2011-11-25 15:52:26 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 31, 51 ], "url" : "http:\/\/t.co\/1AglOldH", "expanded_url" : "http:\/\/j.mp\/rxQ30G", "display_url" : "j.mp\/rxQ30G" } ] }, "geo" : { }, "id_str" : "140033072920932353", "text" : "Last Dictator Standing Advert: http:\/\/t.co\/1AglOldH Another great advert from Nandos", "id" : 140033072920932353, "created_at" : "2011-11-25 11:44:20 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "139788660072656896", "text" : "This time next week I'll be sipping an ice cold beer with a huge portion of biltong in good 'ol sunny South Africa. Can't wait.", "id" : 139788660072656896, "created_at" : "2011-11-24 19:33:08 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 24, 44 ], "url" : "http:\/\/t.co\/JiLUTlgI", "expanded_url" : "http:\/\/barefootrunner.co.uk", "display_url" : "barefootrunner.co.uk" } ] }, "geo" : { }, "id_str" : "139439742277271553", "text" : "Someone wants to buy my http:\/\/t.co\/JiLUTlgI site. Price? Hmmmmm... one meeeellion dowars. Special price for you. ;-)", "id" : 139439742277271553, "created_at" : "2011-11-23 20:26:39 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "139437621750398976", "text" : "\u201CA bad free press is preferable to a technically good, subservient one.\u201D Nelson Mandela.", "id" : 139437621750398976, "created_at" : "2011-11-23 20:18:14 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 133, 137 ] } ], "urls" : [ { "indices" : [ 112, 132 ], "url" : "http:\/\/t.co\/pEspesgz", "expanded_url" : "http:\/\/bit.ly\/uBrBLA", "display_url" : "bit.ly\/uBrBLA" } ] }, "geo" : { }, "id_str" : "139431834764316672", "text" : "Study shows elite runners have very short ground contact time suggesting that this may explain superior economy http:\/\/t.co\/pEspesgz #run", "id" : 139431834764316672, "created_at" : "2011-11-23 19:55:14 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "139430197685518336", "text" : "Newcastle Brown Ale really isn't that nice. Not sure why I bought this one. Oh yes it was one of the ales on 3 for \u00A34 @ Sainsburys", "id" : 139430197685518336, "created_at" : "2011-11-23 19:48:44 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 94, 98 ] } ], "urls" : [ { "indices" : [ 73, 93 ], "url" : "http:\/\/t.co\/nvuB5AZX", "expanded_url" : "http:\/\/birthdayshoes.com\/vibram-fivefingers-seeya-first-look", "display_url" : "birthdayshoes.com\/vibram-fivefin\u2026" } ] }, "geo" : { }, "id_str" : "138631921390469120", "text" : "Oooo, I think I might have just found my next pair of VFFs - the SeeYa : http:\/\/t.co\/nvuB5AZX #run", "id" : 138631921390469120, "created_at" : "2011-11-21 14:56:40 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 109, 113 ] } ], "urls" : [ { "indices" : [ 88, 108 ], "url" : "http:\/\/t.co\/WZnN2uQY", "expanded_url" : "http:\/\/j.mp\/vbBGTu", "display_url" : "j.mp\/vbBGTu" } ] }, "geo" : { }, "id_str" : "138618183358754817", "text" : "All 16k entries for next year's Two Ocean's Half-marathon gone in 9 days. Unbelievable! http:\/\/t.co\/WZnN2uQY #run", "id" : 138618183358754817, "created_at" : "2011-11-21 14:02:04 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Lewis Thompson", "screen_name" : "lewiz", "indices" : [ 0, 6 ], "id_str" : "18947776", "id" : 18947776 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "138417853945745408", "geo" : { }, "id_str" : "138577502074445824", "in_reply_to_user_id" : 18947776, "text" : "@lewiz Been using f.lux for a while. Def helps with my sleep if using computer late at night.", "id" : 138577502074445824, "in_reply_to_status_id" : 138417853945745408, "created_at" : "2011-11-21 11:20:25 +0000", "in_reply_to_screen_name" : "lewiz", "in_reply_to_user_id_str" : "18947776", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Simon Gear", "screen_name" : "SimonGear", "indices" : [ 0, 10 ], "id_str" : "19905619", "id" : 19905619 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "138567388206600192", "geo" : { }, "id_str" : "138577080001638400", "in_reply_to_user_id" : 19905619, "text" : "@SimonGear Walkman?! You're showing your age cuz. I concur though: no music whilst I run. It's not right. It's also one more thing to carry", "id" : 138577080001638400, "in_reply_to_status_id" : 138567388206600192, "created_at" : "2011-11-21 11:18:45 +0000", "in_reply_to_screen_name" : "SimonGear", "in_reply_to_user_id_str" : "19905619", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Mark Caudell \u0CA0_\u0CA0", "screen_name" : "GrumpyOfWindsor", "indices" : [ 0, 16 ], "id_str" : "205635293", "id" : 205635293 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "138542537815236608", "geo" : { }, "id_str" : "138544548598120448", "in_reply_to_user_id" : 205635293, "text" : "@grumpyofwindsor Ahh... that make more sense now :-)", "id" : 138544548598120448, "in_reply_to_status_id" : 138542537815236608, "created_at" : "2011-11-21 09:09:29 +0000", "in_reply_to_screen_name" : "GrumpyOfWindsor", "in_reply_to_user_id_str" : "205635293", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Mark Caudell \u0CA0_\u0CA0", "screen_name" : "GrumpyOfWindsor", "indices" : [ 0, 16 ], "id_str" : "205635293", "id" : 205635293 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "137800322214150144", "geo" : { }, "id_str" : "137803911481393152", "in_reply_to_user_id" : 205635293, "text" : "@grumpyofwindsor huh?", "id" : 137803911481393152, "in_reply_to_status_id" : 137800322214150144, "created_at" : "2011-11-19 08:06:27 +0000", "in_reply_to_screen_name" : "GrumpyOfWindsor", "in_reply_to_user_id_str" : "205635293", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "137794336480964608", "text" : "Staines in Middlesex is changing its name to, wait for it, Staines-upon-Thames. And they're worried about the damage AliG did to the town?!", "id" : 137794336480964608, "created_at" : "2011-11-19 07:28:24 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "137656757915877376", "text" : "TopGear USA is terrible!! Do people really watch this crap?", "id" : 137656757915877376, "created_at" : "2011-11-18 22:21:43 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 3, 10 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "137644196004761602", "text" : "RT @joyent Apologies to our customers for the inconvenience today. We will have a blog post up shortly with more detail and next steps.", "id" : 137644196004761602, "created_at" : "2011-11-18 21:31:48 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "137643195248029697", "text" : "I'm wearing an Ackermans jumper that is over 15 years old. I can remember wearing it in matric on cool evenings to & from running training", "id" : 137643195248029697, "created_at" : "2011-11-18 21:27:49 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 8, 15 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "137619782924115968", "text" : "Woohoo! @Joyent's co-lo has sorted their network. All up & accessible for me now.", "id" : 137619782924115968, "created_at" : "2011-11-18 19:54:47 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 3, 10 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "137617652486127616", "text" : "RT @joyent: East coast data center customers: Joyent's up, network access was down due to co-lo provider\u2019s network saturation event. Not ...", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/www.hootsuite.com\" rel=\"nofollow\"\u003EHootsuite\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "137616859183853568", "text" : "East coast data center customers: Joyent's up, network access was down due to co-lo provider\u2019s network saturation event. Not acceptable.", "id" : 137616859183853568, "created_at" : "2011-11-18 19:43:10 +0000", "user" : { "name" : "Joyent", "screen_name" : "joyent", "protected" : false, "id_str" : "666523", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000665539313\/28f20d9304c8dee54feaa616af3c7892_normal.png", "id" : 666523, "verified" : true } }, "id" : 137617652486127616, "created_at" : "2011-11-18 19:46:19 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Outage Tracker", "screen_name" : "outagetracker", "indices" : [ 0, 14 ], "id_str" : "117540093", "id" : 117540093 }, { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 15, 22 ], "id_str" : "666523", "id" : 666523 }, { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 72, 79 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "137615034519003137", "geo" : { }, "id_str" : "137615847438041088", "in_reply_to_user_id" : 117540093, "text" : "@outagetracker @Joyent corrected me. Co-lo network outage to blame. Not @Joyent.", "id" : 137615847438041088, "in_reply_to_status_id" : 137615034519003137, "created_at" : "2011-11-18 19:39:09 +0000", "in_reply_to_screen_name" : "outagetracker", "in_reply_to_user_id_str" : "117540093", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 0, 7 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "137613224483889153", "in_reply_to_user_id" : 666523, "text" : "@joyent Cheers for the correction and update.", "id" : 137613224483889153, "created_at" : "2011-11-18 19:28:44 +0000", "in_reply_to_screen_name" : "joyent", "in_reply_to_user_id_str" : "666523", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Joyent", "screen_name" : "joyent", "indices" : [ 17, 24 ], "id_str" : "666523", "id" : 666523 } ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 135, 140 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "137611860328460289", "text" : "Oops, looks like @joyent is having a major outage. All my sites are down. Please fix pronto & an apology & expl email won't go a miss #tech", "id" : 137611860328460289, "created_at" : "2011-11-18 19:23:18 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 45, 65 ], "url" : "http:\/\/t.co\/XH8LlCQx", "expanded_url" : "http:\/\/barefootrunner.co.uk\/its-super-mario-time", "display_url" : "barefootrunner.co.uk\/its-super-mari\u2026" } ] }, "geo" : { }, "id_str" : "137560228567859200", "text" : "It's Super Mario, I Mean, Fetchpoint Time!!! http:\/\/t.co\/XH8LlCQx", "id" : 137560228567859200, "created_at" : "2011-11-18 15:58:08 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "136738150528712704", "text" : "What do we want?\nA cure for ADHD! \nWhen do we want it? \nLook, squirrel!", "id" : 136738150528712704, "created_at" : "2011-11-16 09:31:30 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 91, 96 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "136725314997977090", "text" : "Woohooo!!! Corporate access to Safari Books Online is back. All registered and logged in. #tech", "id" : 136725314997977090, "created_at" : "2011-11-16 08:40:29 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "136557691815460866", "text" : "Jamie Oliver's van has a great name: A Cock in Cider. Surprisingly, no complaints that I'm aware of.", "id" : 136557691815460866, "created_at" : "2011-11-15 21:34:25 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "136365664276459520", "text" : "Finally!!! We're we're finally doing something new in today's training. We really didn't need the 40min summary of y\/day's 4 hours.", "id" : 136365664276459520, "created_at" : "2011-11-15 08:51:22 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 30, 50 ], "url" : "http:\/\/t.co\/F7N7hvcy", "expanded_url" : "http:\/\/barefootrunner.co.uk\/100-up-looks-vaguely-familiar", "display_url" : "barefootrunner.co.uk\/100-up-looks-v\u2026" } ] }, "geo" : { }, "id_str" : "136115872107462657", "text" : "100-Up Looks Vaguely Familiar http:\/\/t.co\/F7N7hvcy", "id" : 136115872107462657, "created_at" : "2011-11-14 16:18:47 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "135999954031345664", "text" : "Wow!!! I got the Webex session for my training working, with audio, on Ubuntu first time. Who'd a thunk it :-)", "id" : 135999954031345664, "created_at" : "2011-11-14 08:38:10 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/barefootrunner.co.uk\" rel=\"nofollow\"\u003Ebarefootrunner.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 13, 33 ], "url" : "http:\/\/t.co\/cTW9fwnS", "expanded_url" : "http:\/\/barefootrunner.co.uk\/bruised-toes", "display_url" : "barefootrunner.co.uk\/bruised-toes" } ] }, "geo" : { }, "id_str" : "135763386649673729", "text" : "Bruised Toes http:\/\/t.co\/cTW9fwnS", "id" : 135763386649673729, "created_at" : "2011-11-13 16:58:08 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 133, 137 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "135689023145525250", "text" : "Just got back from a fantastic 92min long run. The weather is glorious. You'd never say we're meant to be in the middle of winter. #run", "id" : 135689023145525250, "created_at" : "2011-11-13 12:02:38 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "BBC Radio 2 Factoids", "screen_name" : "bigshowfactoids", "indices" : [ 3, 19 ], "id_str" : "148303865", "id" : 148303865 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "135028622330310658", "text" : "RT @bigshowfactoids: 91% of UK homes have a microwave. Ours is one of the 9% which don't.", "id" : 135028622330310658, "created_at" : "2011-11-11 16:18:26 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 31, 51 ], "url" : "http:\/\/t.co\/00B9geox", "expanded_url" : "http:\/\/bbc.in\/tu7bHg", "display_url" : "bbc.in\/tu7bHg" } ] }, "geo" : { }, "id_str" : "134999184918056960", "text" : "Nigeria's plastic bottle house http:\/\/t.co\/00B9geox | Now this is what I call low-cost affordable housing.", "id" : 134999184918056960, "created_at" : "2011-11-11 14:21:28 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 114, 118 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "134983338330042369", "text" : "Pooooeeeeeee!!! My Vibrams Five Fingers are in a rather cheesy smelling mood today. Maybe it's time for a wash. #run", "id" : 134983338330042369, "created_at" : "2011-11-11 13:18:30 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/colinseymour.co.uk\" rel=\"nofollow\"\u003Ecolinseymour.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 24, 44 ], "url" : "http:\/\/t.co\/Q8BJuImg", "expanded_url" : "http:\/\/colinseymour.co.uk\/ill-get-the-ice-creams", "display_url" : "colinseymour.co.uk\/ill-get-the-ic\u2026" } ] }, "geo" : { }, "id_str" : "134981367602757632", "text" : "I'll Get the Ice-creams http:\/\/t.co\/Q8BJuImg", "id" : 134981367602757632, "created_at" : "2011-11-11 13:10:40 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/lildude.co.uk\" rel=\"nofollow\"\u003Elildude.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 68, 73 ] } ], "urls" : [ { "indices" : [ 47, 67 ], "url" : "http:\/\/t.co\/amNSHUFJ", "expanded_url" : "http:\/\/lildude.co.uk\/solaris-11-end-of-support-for-legacy-hardware", "display_url" : "lildude.co.uk\/solaris-11-end\u2026" } ] }, "geo" : { }, "id_str" : "134919730984271873", "text" : "Solaris 11: End of Support for Legacy Hardware http:\/\/t.co\/amNSHUFJ #tech", "id" : 134919730984271873, "created_at" : "2011-11-11 09:05:45 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "inomine", "screen_name" : "inomine", "indices" : [ 3, 11 ], "id_str" : "27512307", "id" : 27512307 } ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 68, 73 ] } ], "urls" : [ { "indices" : [ 13, 33 ], "url" : "http:\/\/t.co\/wJ91kHua", "expanded_url" : "http:\/\/www.youtube.com\/watch?v=0FacYAI6DY0", "display_url" : "youtube.com\/watch?v=0FacYA\u2026" } ] }, "geo" : { }, "id_str" : "134685151790772224", "text" : "RT @inomine: http:\/\/t.co\/wJ91kHua Larry Ellison on cloud computing. #tech", "id" : 134685151790772224, "created_at" : "2011-11-10 17:33:37 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "134635753845170177", "text" : "And then my browser refreshes and we see they're now at 29\/9. Lets see if they can beat their previous low of 36 set in 1902.", "id" : 134635753845170177, "created_at" : "2011-11-10 14:17:19 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "134635399350988800", "text" : "Oh my. Australia are 1 wicket & 4 runs short of setting the worlds lowest ever test match score. Currently 22 for 9. Come on SA.", "id" : 134635399350988800, "created_at" : "2011-11-10 14:15:55 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Delta parkrun", "screen_name" : "deltaparkrun", "indices" : [ 9, 22 ], "id_str" : "385451853", "id" : 385451853 } ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 92, 96 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "134603712441233408", "text" : "Sat 12th @deltaparkrun Delta park JHB 9:00 the very first official parkrun in South Africa! #run", "id" : 134603712441233408, "created_at" : "2011-11-10 12:10:00 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 100, 104 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "134584764945530880", "text" : "My word running half-marathons is expensive in the UK... \u00A331.50 for an affiliated athlete in the UK #run", "id" : 134584764945530880, "created_at" : "2011-11-10 10:54:43 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/lildude.co.uk\" rel=\"nofollow\"\u003Elildude.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 75, 80 ] } ], "urls" : [ { "indices" : [ 54, 74 ], "url" : "http:\/\/t.co\/2ZCDvbGl", "expanded_url" : "http:\/\/lildude.co.uk\/useful-solaris-11-posts-documents-you-should-read", "display_url" : "lildude.co.uk\/useful-solaris\u2026" } ] }, "geo" : { }, "id_str" : "134572289969758208", "text" : "Useful Solaris 11 Posts and Documents You Should Read http:\/\/t.co\/2ZCDvbGl #tech", "id" : 134572289969758208, "created_at" : "2011-11-10 10:05:08 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 82, 102 ], "url" : "http:\/\/t.co\/OCG0IDku", "expanded_url" : "http:\/\/bbc.in\/rBAqB4", "display_url" : "bbc.in\/rBAqB4" } ] }, "geo" : { }, "id_str" : "134569567027593216", "text" : "Julius Malema has been suspended from the ANC for 5 yrs & sacked as ANCYL leader. http:\/\/t.co\/OCG0IDku Finally! He did more harm than good.", "id" : 134569567027593216, "created_at" : "2011-11-10 09:54:19 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Oracle Solaris", "screen_name" : "ORCL_Solaris", "indices" : [ 3, 16 ], "id_str" : "215162951", "id" : 215162951 } ], "media" : [ ], "hashtags" : [ { "text" : "solaris", "indices" : [ 86, 94 ] }, { "text" : "tech", "indices" : [ 95, 100 ] } ], "urls" : [ { "indices" : [ 65, 85 ], "url" : "http:\/\/t.co\/Cr0n2Lzu", "expanded_url" : "http:\/\/bit.ly\/u56yJg", "display_url" : "bit.ly\/u56yJg" } ] }, "geo" : { }, "id_str" : "134318459738796033", "text" : "RT @ORCL_Solaris: Check out the Oracle Solaris 11 press release: http:\/\/t.co\/Cr0n2Lzu #solaris #tech", "id" : 134318459738796033, "created_at" : "2011-11-09 17:16:30 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/lildude.co.uk\" rel=\"nofollow\"\u003Elildude.co.uk\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 66, 71 ] } ], "urls" : [ { "indices" : [ 45, 65 ], "url" : "http:\/\/t.co\/0B3LXYDp", "expanded_url" : "http:\/\/lildude.co.uk\/howto-upgrade-from-solaris-10-to-solaris-11", "display_url" : "lildude.co.uk\/howto-upgrade-\u2026" } ] }, "geo" : { }, "id_str" : "134299333041459201", "text" : "HOWTO: Upgrade from Solaris 10 to Solaris 11 http:\/\/t.co\/0B3LXYDp #tech", "id" : 134299333041459201, "created_at" : "2011-11-09 16:00:30 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 72, 92 ], "url" : "http:\/\/t.co\/AoNGXAZ6", "expanded_url" : "http:\/\/www.southafrica.info\/services\/consumer\/bankprint-081111.htm", "display_url" : "southafrica.info\/services\/consu\u2026" } ] }, "geo" : { }, "id_str" : "133904272956985344", "text" : "Imagine the furore if they decide to introduce such a system in the UK.\nhttp:\/\/t.co\/AoNGXAZ6", "id" : 133904272956985344, "created_at" : "2011-11-08 13:50:41 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "132121392459161600", "text" : "Shows when I was last in a, news agent: you can now get FHM in the convenient handbag size.", "id" : 132121392459161600, "created_at" : "2011-11-03 15:46:09 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 68, 88 ], "url" : "http:\/\/t.co\/EHBzussS", "expanded_url" : "http:\/\/chefmag.co.za\/2011\/11\/marmite-perfume\/", "display_url" : "chefmag.co.za\/2011\/11\/marmit\u2026" } ] }, "geo" : { }, "id_str" : "132046083827306496", "text" : "I think I've got my wife's crimbo pressie sorted: Marmite Perfume | http:\/\/t.co\/EHBzussS", "id" : 132046083827306496, "created_at" : "2011-11-03 10:46:54 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Michael Bishop", "screen_name" : "miklb", "indices" : [ 3, 9 ], "id_str" : "6187652", "id" : 6187652 } ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 107, 112 ] } ], "urls" : [ { "indices" : [ 86, 106 ], "url" : "http:\/\/t.co\/MnlcWlH6", "expanded_url" : "http:\/\/html5doctor.com\/time-and-data-element\/", "display_url" : "html5doctor.com\/time-and-data-\u2026" } ] }, "geo" : { }, "id_str" : "131984504314273792", "text" : "RT @miklb html5 Doctor reasonably weighs in on the changes in &lt;time&gt; & datetime http:\/\/t.co\/MnlcWlH6 #tech", "id" : 131984504314273792, "created_at" : "2011-11-03 06:42:12 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Michael Bishop", "screen_name" : "miklb", "indices" : [ 3, 9 ], "id_str" : "6187652", "id" : 6187652 } ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 128, 133 ] } ], "urls" : [ { "indices" : [ 30, 50 ], "url" : "http:\/\/t.co\/Nb6C4ZBV", "expanded_url" : "http:\/\/whynotime.com\/", "display_url" : "whynotime.com" } ] }, "geo" : { }, "id_str" : "131981643551481856", "text" : "RT @miklb Why no &lt;time&gt; http:\/\/t.co\/Nb6C4ZBV to paraphrase a tweet I saw earlier today, why not swap it for &lt;table&gt; #tech", "id" : 131981643551481856, "created_at" : "2011-11-03 06:30:50 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 54, 58 ] } ], "urls" : [ { "indices" : [ 33, 53 ], "url" : "http:\/\/t.co\/Q6faeeR3", "expanded_url" : "http:\/\/mobile.nytimes.com\/2011\/11\/06\/magazine\/running-christopher-mcdougall.xml", "display_url" : "mobile.nytimes.com\/2011\/11\/06\/mag\u2026" } ] }, "geo" : { }, "id_str" : "131975625203388416", "text" : "The Once and Future Way to Run | http:\/\/t.co\/Q6faeeR3 #run", "id" : 131975625203388416, "created_at" : "2011-11-03 06:06:55 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 44, 49 ] } ], "urls" : [ { "indices" : [ 23, 43 ], "url" : "http:\/\/t.co\/R45sFDCT", "expanded_url" : "http:\/\/arstechnica.com\/open-source\/news\/2011\/11\/two-decades-of-productivity-vims-20th-anniversary.ars", "display_url" : "arstechnica.com\/open-source\/ne\u2026" } ] }, "geo" : { }, "id_str" : "131759474422710272", "text" : "Vim's 20th Anniversary http:\/\/t.co\/R45sFDCT #tech", "id" : 131759474422710272, "created_at" : "2011-11-02 15:48:01 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Mark Caudell \u0CA0_\u0CA0", "screen_name" : "GrumpyOfWindsor", "indices" : [ 0, 16 ], "id_str" : "205635293", "id" : 205635293 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "131720689009967104", "geo" : { }, "id_str" : "131727270560792576", "in_reply_to_user_id" : 205635293, "text" : "@grumpyofwindsor I shouldn't think so. It used to work a treat before :-)", "id" : 131727270560792576, "in_reply_to_status_id" : 131720689009967104, "created_at" : "2011-11-02 13:40:03 +0000", "in_reply_to_screen_name" : "GrumpyOfWindsor", "in_reply_to_user_id_str" : "205635293", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 127, 132 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "131711361414729728", "text" : "Why does Google think I need full width Gmail, but not Reader? Come on Google, you're wasting precious screen space in Reader. #tech", "id" : 131711361414729728, "created_at" : "2011-11-02 12:36:50 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 84, 89 ] } ], "urls" : [ { "indices" : [ 24, 44 ], "url" : "http:\/\/t.co\/yu0dXSVI", "expanded_url" : "http:\/\/blog.delphix.com\/matt\/2011\/11\/01\/zfs-10-year-anniversary\/", "display_url" : "blog.delphix.com\/matt\/2011\/11\/0\u2026" } ] }, "geo" : { }, "id_str" : "131710426009436160", "text" : "ZFS 10 year Anniversary http:\/\/t.co\/yu0dXSVI | Seems they really like halloween too #tech", "id" : 131710426009436160, "created_at" : "2011-11-02 12:33:07 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 121, 125 ] } ], "urls" : [ { "indices" : [ 61, 81 ], "url" : "http:\/\/t.co\/doTHto6A", "expanded_url" : "http:\/\/j.mp\/vS2WM5", "display_url" : "j.mp\/vS2WM5" } ] }, "geo" : { }, "id_str" : "131701725504618496", "text" : "Eddie Izzard planning 1,100-mile barefoot run through Africa http:\/\/t.co\/doTHto6A | That's gonna hurt. Good luck to him. #run", "id" : 131701725504618496, "created_at" : "2011-11-02 11:58:32 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "131388292267651072", "text" : "There are more Porsche Cayennes registered in Greece than taxpayers declaring an income of \u20AC50K+. Clearly Greeks aren\u2019t fans of paying tax.", "id" : 131388292267651072, "created_at" : "2011-11-01 15:13:04 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "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" : "131381204602732544", "text" : "Don't think I like the new Google Reader look. Too much whitespace and not enough delineation of articles and sections.", "id" : 131381204602732544, "created_at" : "2011-11-01 14:44:54 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Running Free Mag", "screen_name" : "RunningFreeMag", "indices" : [ 3, 18 ], "id_str" : "325457530", "id" : 325457530 } ], "media" : [ ], "hashtags" : [ { "text" : "run", "indices" : [ 127, 131 ] } ], "urls" : [ { "indices" : [ 68, 88 ], "url" : "http:\/\/t.co\/VHdWErCi", "expanded_url" : "http:\/\/www.runningfreemag.com", "display_url" : "runningfreemag.com" } ] }, "geo" : { }, "id_str" : "131375830436814848", "text" : "RT @RunningFreeMag: Latest issue of Running Free Magazine available http:\/\/t.co\/VHdWErCi Didn't even know this existed. Do now #run", "id" : 131375830436814848, "created_at" : "2011-11-01 14:23:33 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "tech", "indices" : [ 106, 111 ] } ], "urls" : [ { "indices" : [ 47, 67 ], "url" : "http:\/\/t.co\/KKDJaLX8", "expanded_url" : "http:\/\/j.mp\/tdo2QL", "display_url" : "j.mp\/tdo2QL" } ] }, "geo" : { }, "id_str" : "131374258743021570", "text" : "Applied Micro leaps ahead in ARM server race | http:\/\/t.co\/KKDJaLX8 Ooooo, imagine a Solaris port for ARM #tech", "id" : 131374258743021570, "created_at" : "2011-11-01 14:17:18 +0000", "user" : { "name" : "lildude", "screen_name" : "lildude", "protected" : false, "id_str" : "8812362", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/378800000841109441\/5aec21ab2289989e0f184dfd7ef4d0e2_normal.jpeg", "id" : 8812362, "verified" : false } } ]
(function() { 'use strict'; var module = angular.module('users'); module.config(function($stateProvider) { $stateProvider .state('map', { url : '/map', controller : 'SigninController', views: { 'main@' : { templateUrl : '/p/modules/map/layout/map.client.view.html' }, 'header@' : { templateUrl : '/p/modules/map/layout/header.map.view.html' } } }).state('map.search', { url : '/search', views: { 'main@map' : { templateUrl : '/p/modules/map/layout/map.client.view.html' }, 'header@map' : { templateUrl : '/p/modules/map/layout/header-search.map.view.html' } } }); }); }());
'use strict'; var TaskRunner = require('terminal-task-runner'); var Base = TaskRunner.Base; var logger = TaskRunner.logger; var isInt = function(val) { return !isNaN(parseInt(val)); }; var Task = Base.extend({ id: 'WebServiceSimulator', name: 'Launch web service simulator', command: 'simulator', options: [ { flags: '-p, --port <port>', description: 'specify the port of the static webserver' }, { flags: '-r, --routerDir <routerDir>', description: 'specify the less paths' } ], check: function(cmd) { return cmd.port && cmd.routerDir; }, run: function(cons) { var _this = this; var path = require('path'); var fs = require('fs'); this.prompt([ { type: 'input', name: 'port', message: 'Port the simualtor would listen on', default: _this.get('simulatorPort', 3000), validate: function(pass) { return isInt(pass); } }, { type: 'input', name: 'routerDir', message: 'Specify the routerDir', default: _this.get('simulatorRouterDir', './routers'), validate: function(pass) { return fs.existsSync(path.resolve('.', pass)) ? true : 'routerDir must exist'; } } ], function(answer) { _this.action(answer, cons); }); }, action: function(answer, cons) { var path = require('path'); var fs = require('fs'); if (!isInt(answer.port)) { cons('port must be int'); return; } if (!fs.existsSync(path.resolve('.', answer.routerDir))) { cons('routerDir must exist'); return; } var _this = this; var Simulator = require('webservice-simulator'); _this.put({ simulatorPort: answer.port, simulatorRouterDir: answer.routerDir }); new Simulator({ port: answer.port, routerDir: path.resolve('.', answer.routerDir) }).start(); } }); module.exports = Task;
'use strict'; /** * menu.js shall not be called directly. xxxMenu.js files shall require this file * to extend each particular menu's functionality * * e.g. * ```js * module.exports = function(client) { * return require('./menu.js')(client, menuMap); * }; */ module.exports = (client, menuMap) => { const me = {}; // put menuMap in public scope me.menuMap = menuMap; me.findLink = (text) => { const findTextRecursive = (obj) => { if (obj.text === text) { return true; } if (obj.children) { return obj.children.some(findTextRecursive); } return false; }; return menuMap.filter(findTextRecursive); }; me.clickNested = (text) => { // Get top level menu item const parent = me.findLink(text)[0]; // Ensure that top level menu item can be located if (!parent) { throw new Error(`could not locate menu item with text \`${text}\`. Was it added to the menu map file?`); } // hover over top level menu item before clicking on child return client .element(`=${parent.text}`) .scroll() .click(`=${parent.text}`) .click(`=${text}`) .waitForPaginationComplete() .click('.site-header'); // Close the menu by clicking the banne }; return me; };
function splat() { alert('splat'); } splat();
import DS from 'ember-data'; export default DS.RESTAdapter.extend({ host: 'http://10.20.1.2', namespace: 'todo' });
//Chatroom website var username = 'guest'; var chatroom = 'PublicRoom'; var messageLength = 0; var memberLength = 0; function remove(id){ $(id).find('li').remove(); } function show(id, argu1){ var arrayLength = argu1.length; for (var i = 0; i < arrayLength; i++) { $(id).find('ul').append('<li>' + argu1[i] + '</li>'); } } function updateArray_show(id, array){ var arrayLength = array.length; for (var i = 0; i < arrayLength; i++) { if (array[i] != ""){ array[i] = array[i].split(":")[0]; $(id).find('ul').append('<li>' + array[i] + '</li>'); } } } window.setInterval(function(){ $.post( "http://singleendpointchatserver.herokuapp.com/api/v1/chatroom/"+chatroom+"?username="+username+"&expireafter=300", function( json ) { var messages = json.room.messages; var newMessagesLength = messages.length; var members = json.room.members.split(","); //"test:2121," = "test:3241", "" var newMembersLength = members.length; remove('#messages'); show('#messages', messages); if (newMessagesLength > messageLength){ $("#messages").scrollTop($("#messages ul").height()); } messageLength = messages.length; remove('#members'); updateArray_show('#members', members); if (newMembersLength > memberLength){ $("#members").scrollTop($("#members ul").height()); } memberLength = members.length; }); }, 1000); $("#messageInput").keyup(function(event){ if(event.keyCode == 13){ $("#messageSubmit").click(); } }); $('#messageSubmit').on('click', function(event) { var message = $('#messageInput').val(); $('#messageInput').val(''); var encodedMessage = encodeURIComponent(message); $.post( "http://singleendpointchatserver.herokuapp.com/api/v1/chatroom/"+chatroom+"?username="+username+"&message="+encodedMessage+"&expireafter=300"); $("#messages").scrollTop($("#messages").height()*2); }); $("#usernameInput").keyup(function(event){ if(event.keyCode == 13){ $("#usernameSubmit").click(); } }); $('#usernameSubmit').on('click', function(event) { username = encodeURIComponent($('#usernameInput').val()); $('#usernameInput').val(''); }); $("#chatroomInput").keyup(function(event){ if(event.keyCode == 13){ $("#chatroomSubmit").click(); } }); $('#chatroomSubmit').on('click', function(event) { chatroom = encodeURIComponent($('#chatroomInput').val()); $('#chatroom').text(chatroom); messageLength = 0; $('#chatroomInput').val(''); });
//Protractor configuration exports.config = { /* The address of a running selenium server; if you do not want to have to run 3 command prompt just keep this comment out; left incase someone does want to try out the 3 command prompt seleniumAddress: 'http://localhost:4444/wd/hub', */ // Directory where Protractor tests is at; basically what tests to run suites: { homepage: 'spec/homepage.js', inventory: 'spec/inventory.js', kit: 'spec/kit.js', system: 'spec/system.js' }, // The timeout (in ms) for each script to run on the browser // Note: It should be longer than the maximum time the applications needs to // stabilize between tasks allScriptsTimeout: 99999, // Wait time for the homepage to load getPageTimeout: 10000, baseUrl: 'http://localhost:3000/', framework: 'jasmine', jasmineNodeOpts: { // If true, then print colors to the terminal showColors: true, // The default time (in ms) to wait before a test fails defaultTimeoutInterval: 30000, isVerbose : true, includeStackTrace : true }, // For running on different browsers, just incase someone does not have one of these browsers // install; right now just assume everyone have chrome // Note: issues with running on PhantomJS, so recommended to stick with chrome or something // else multiCapabilities: [ { 'browserName': 'chrome' }, /* { 'browserName': 'firefox' } */ ] };
"use strict"; var React = require('./react'); var tu = require('./tutils'); var EMPTY_ARR = []; var hasPromise = (window && window.Promise || global && global.Promise) !== void(0); /** * Safe chained function * * Will only create a new function if needed, * otherwise will pass back existing functions or null. * * @param {function} one * @param {function} two * @returns {function|null} */ function applyFuncs(one, two) { let hasOne = typeof one === 'function'; let hasTwo = typeof two === 'function'; if (!hasOne && !hasTwo) { return null; } if (!hasOne) { return two; } if (!hasTwo) { return one; } return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; } function initValidators(v) { //If it has a type init it if (v.type) { var validator = this.loadValidator(v.type); return validator(v); } //If it is a RegExp than init ReExp if (tu.isRegExp(v)) { return this.loadValidator('regexp')({ regexp: v }); } //If its a function just return it. if (tu.isFunction(v)) { return v; } //otherwise lets try initing it. return this.loadValidator(v)(); } var Editor = React.createClass({ displayName: 'Editor', mixins: [require('./LoaderMixin')], getDefaultProps() { return { field: { type: 'Text' }, /*onValueChange() { },*/ onValidate() { }, template: 'EditorTemplate' } }, getInitialState(){ return { hasChanged: false, isValid: false } }, setValue(value){ this.refs.field.setValue(value); }, componentWillMount(){ var validators = this.props.field.validators; this.validators = validators ? validators.map(initValidators, this.props.loader) : EMPTY_ARR; this.props.valueManager.addListener(this.props.path, this.handleChange, this, true); this.props.valueManager.addValidateListener(this.props.path, this._validate, this); }, componentWillUnmount(){ this.props.valueManager.removeListener(this.props.path, this.handleChange); this.props.valueManager.removeValidateListener(this.props.path, this._validate); }, handleValidate(value, component, e) { this.state.hasValidated = true; this.validate(); }, handleChange(newValue, oldValue, name) { var hasChanged = newValue != oldValue; if (!hasChanged) { return; } this.state.hasChanged = true; var errors = this.getErrorMessages(newValue); if (!this.state.hasValidated) { if (!errors || errors.length === 0) { this.state.hasValidated = true; } } else { this.validate(newValue, errors); } }, getValue(){ return this.props.valueManager.path(this.props.path); }, /** * Runs validation and updates empty fields. * */ validate(value, errors){ value = arguments.length === 0 ? this.getValue() : value; errors = errors || this.getErrorMessages(value); this.props.valueManager.updateErrors(this.props.path, errors, value); this.setState({ hasValidated: true }); return errors; }, _validate: function () { this.validate(this.getValue()); }, getErrorMessages(value){ var vm = this.props.valueManager; value = arguments.length === 0 ? this.getValue() : value; var msgs = this.validators.map((v)=> { return v(value, vm); }).filter(tu.nullCheck); return msgs; }, title: function () { var field = this.props.field || {}; if (field.title === false) { return null; } if (field.title != null) { return field.title; } //Add spaces return tu.titlelize(this.props.name); }, handleValid: function (valid) { this.setState({valid}) }, render() { var {field, onValueChange, template, onValidate, ...props} = this.props; var {type,fieldClass, editorClass, errorClassName, ...rfield} = field; //err = errors, //&& errors[path] && errors[path][0] && errors[path], var Component = this.props.loader.loadType(type), title = this.title(), errorClassName = errorClassName == null ? 'has-error' : errorClassName; var Template; if (template === false || field.template === false || type === 'Hidden') { Template = null; } else { Template = this.template(); } var child; if (hasPromise && Component instanceof Promise) { var Lazy = this.props.loader.loadType('LazyType'); child = <Lazy ref="field" {...props} {...field} field={rfield} editorClass={editorClass} onValidate={this.handleValidate} promise={Component}/> } else { child = <Component ref="field" {...props} {...field} field={rfield} editorClass={editorClass} onValidate={this.handleValidate}/>; } /*if (onValid) { onValid = applyFuncs(this.handleValid, onValid); }*/ //errMessage, errorClassName, name, fieldClass, title, help return Template ? <Template field={rfield} {...props} fieldClass={fieldClass} title={title} errorClassName={errorClassName} help={!this.state.valid && (props.help || rfield.help)} onValidate={this.handleValidate} > {child} </Template> : child; } }); module.exports = Editor;
window.zinger=window.zinger||{}; (function(window) { var common= { } common.curry=function(scope,fn) { //var scope = scope || {}; var args = []; for (var i=2, l = arguments.length; i < l; ++i) { args.push(arguments[i]); }; return function() { fn.apply(scope, args); }; }; common.chain=function() { return { calls: [], start: function() { return this; }, createCallback: function() { var cbo= { fn: function() { var next = true; //if (arguments[0] instanceof Error) if (arguments[0]) { if(cbo.callScope.onerror) next = cbo.callScope.onerror.apply(cbo.callScope,arguments); } cbo.callScope.returns[cbo.step]=arguments; if(next && cbo.next) cbo.next(); } }; return cbo; }, createArgs: function(callArgs) { var args = []; for(var j=0, l=callArgs.length; j<l ;j++) args.push(callArgs[j]); return args; }, invoke: function(onerror,onend) { var callScope = {}; callScope.onerror = onerror; callScope.returns = []; var calls = this.calls; var next=common.curry.apply(null,[callScope,onend]); for(var i=calls.length-1 ; i>=0 ; i--) { callScope.returns.push({}); var callArgs = calls[i]; //console.log('>>'+i+':'+callArgs); var args = this.createArgs(callArgs); var callback = this.createCallback(); callback.next = next; callback.step = i; callback.callScope = callScope; args.push(callback.fn); next = common.curry.apply(null,args); } next(); }, add: function() { this.calls.push(arguments); return this; } } }; common.findMethod=function(fullname) { var parts = fullname.split("."); var obj = window; for(var i=0, l=parts.length; i<l && obj!=null; i++) { obj = obj[parts[i]]; } return obj; }; common.setProperty=function(fullname,value) { if(fullname==null) return; var parts=fullname.split("."); var obj=window; for(var i=0,l=parts.length-1;i<l&&obj!=null;i++) { obj=obj[parts[i]]; } if(obj!=null) obj[parts[parts.length-1]]=value; }; common.getProperty=function(fullname) { if(fullname==null) return; var parts=fullname.split("."); var obj=window; for(var i=0,l=parts.length-1;i<l&&obj!=null;i++) { obj=obj[parts[i]]; } var rval=null; if(obj!=null) rval=obj[parts[parts.length-1]]; return rval; }; common.fileSize=function(x) { if(x<1024) return x+" B"; x=Math.round(x/1024*100)/100; if(x<1024) return x+" KB"; x=Math.round(x/1024*100)/100; if(x<1024) return x+" MB"; return x+" GB"; }; common.arr2obj=function(arr,key) { var rval={}; for(var i=0,l=arr.length;i<l;i++) { if(key) { var current=rval[arr[i][key]]; if(current==null) rval[arr[i][key]]=arr[i]; else if(current.constructor === Array) current.push(arr[i]) else rval[arr[i][key]]=[current,arr[i]]; } else rval[""+arr[i]]=arr[i]; } return rval; }; window.zinger.common=common; })(window);
"use strict"; var DirectoryHelper = (function () { function DirectoryHelper() { } DirectoryHelper.prototype.GetAutodiscoverScpUrlsForDomain = function (domainName) { throw new Error("DirectoryHelper.ts - GetAutodiscoverScpUrlsForDomain : Not implemented."); }; DirectoryHelper.prototype.GetScpUrlList = function (domainName, ldapPath, maxHops) { throw new Error("DirectoryHelper.ts - GetScpUrlList : Not implemented."); }; DirectoryHelper.prototype.GetSiteName = function () { throw new Error("DirectoryHelper.ts - GetSiteName : Not implemented."); }; DirectoryHelper.prototype.TraceMessage = function (message) { throw new Error("DirectoryHelper.ts - TraceMessage : Not implemented."); }; //private service: ExchangeServiceBase; DirectoryHelper.AutodiscoverMaxScpHops = 10; DirectoryHelper.ScpUrlGuidString = "77378F46-2C66-4aa9-A6A6-3E7A48B19596"; DirectoryHelper.ScpPtrGuidString = "67661d7F-8FC4-4fa7-BFAC-E1D7794C1F68"; DirectoryHelper.ScpFilterString = "(&(objectClass=serviceConnectionPoint)(|(keywords=67661d7F-8FC4-4fa7-BFAC-E1D7794C1F68)(keywords=77378F46-2C66-4aa9-A6A6-3E7A48B19596)))"; return DirectoryHelper; }()); exports.DirectoryHelper = DirectoryHelper;
import React, { PropTypes } from 'react'; import { List, ListItem } from 'material-ui/List'; import Toggle from 'material-ui/Toggle'; import { grey50 } from 'material-ui/styles/colors'; const VideoInfoList = ({ video, toggleVideo }) => ( <List style={{ backgroundColor: grey50, }} > <ListItem primaryText="Title" secondaryText={video.name} /> <ListItem primaryText="Location" secondaryText={video.location} /> <ListItem primaryText="Date" secondaryText={video.date} /> <ListItem primaryText="Flagged" rightToggle={<Toggle toggled={video.flagged} onToggle={() => toggleVideo(video)} />} /> </List> ); VideoInfoList.propTypes = { video: PropTypes.shape({ name: PropTypes.string, location: PropTypes.location, date: PropTypes.date, flagged: PropTypes.bool, }), toggleVideo: PropTypes.func.isRequired, }; export default VideoInfoList;
import {protocol,metadata} from 'aurelia-metadata'; import {AggregateError} from 'aurelia-pal'; /** * Decorator: Indicates that the decorated class/object is a custom resolver. */ export const resolver: Function & { decorates?: any } = protocol.create('aurelia:resolver', function(target): string | boolean { if (!(typeof target.get === 'function')) { return 'Resolvers must implement: get(container: Container, key: any): any'; } return true; }); /** * Used to allow functions/classes to specify custom dependency resolution logic. */ export interface Resolver { /** * Called by the container to allow custom resolution of dependencies for a function/class. * @param container The container to resolve from. * @param key The key that the resolver was registered as. * @return Returns the resolved object. */ get(container: Container, key: any): any; } /** * Used to allow functions/classes to specify lazy resolution logic. */ @resolver() export class Lazy { /** @internal */ _key: any; /** * Creates an instance of the Lazy class. * @param key The key to lazily resolve. */ constructor(key: any) { this._key = key; } /** * Called by the container to lazily resolve the dependency into a lazy locator function. * @param container The container to resolve from. * @return Returns a function which can be invoked at a later time to obtain the actual dependency. */ get(container: Container): any { return () => container.get(this._key); } /** * Creates a Lazy Resolver for the supplied key. * @param key The key to lazily resolve. * @return Returns an instance of Lazy for the key. */ static of(key: any): Lazy { return new Lazy(key); } } /** * Used to allow functions/classes to specify resolution of all matches to a key. */ @resolver() export class All { /** @internal */ _key: any; /** * Creates an instance of the All class. * @param key The key to lazily resolve all matches for. */ constructor(key: any) { this._key = key; } /** * Called by the container to resolve all matching dependencies as an array of instances. * @param container The container to resolve from. * @return Returns an array of all matching instances. */ get(container: Container): any[] { return container.getAll(this._key); } /** * Creates an All Resolver for the supplied key. * @param key The key to resolve all instances for. * @return Returns an instance of All for the key. */ static of(key: any): All { return new All(key); } } /** * Used to allow functions/classes to specify an optional dependency, which will be resolved only if already registred with the container. */ @resolver() export class Optional { /** @internal */ _key: any; /** @internal */ _checkParent: boolean; /** * Creates an instance of the Optional class. * @param key The key to optionally resolve for. * @param checkParent Indicates whether or not the parent container hierarchy should be checked. */ constructor(key: any, checkParent: boolean = true) { this._key = key; this._checkParent = checkParent; } /** * Called by the container to provide optional resolution of the key. * @param container The container to resolve from. * @return Returns the instance if found; otherwise null. */ get(container: Container): any { if (container.hasResolver(this._key, this._checkParent)) { return container.get(this._key); } return null; } /** * Creates an Optional Resolver for the supplied key. * @param key The key to optionally resolve for. * @param [checkParent=true] Indicates whether or not the parent container hierarchy should be checked. * @return Returns an instance of Optional for the key. */ static of(key: any, checkParent: boolean = true): Optional { return new Optional(key, checkParent); } } /** * Used to inject the dependency from the parent container instead of the current one. */ @resolver() export class Parent { /** @internal */ _key: any; /** * Creates an instance of the Parent class. * @param key The key to resolve from the parent container. */ constructor(key: any) { this._key = key; } /** * Called by the container to load the dependency from the parent container * @param container The container to resolve the parent from. * @return Returns the matching instance from the parent container */ get(container: Container): any { return container.parent ? container.parent.get(this._key) : null; } /** * Creates a Parent Resolver for the supplied key. * @param key The key to resolve. * @return Returns an instance of Parent for the key. */ static of(key: any) : Parent { return new Parent(key); } } @resolver() export class StrategyResolver { strategy: StrategyResolver | number; state: any; /** * Creates an instance of the StrategyResolver class. * @param strategy The type of resolution strategy. * @param state The state associated with the resolution strategy. */ constructor(strategy, state) { this.strategy = strategy; this.state = state; } /** * Called by the container to allow custom resolution of dependencies for a function/class. * @param container The container to resolve from. * @param key The key that the resolver was registered as. * @return Returns the resolved object. */ get(container: Container, key: any): any { switch (this.strategy) { case 0: //instance return this.state; case 1: //singleton let singleton = container.invoke(this.state); this.state = singleton; this.strategy = 0; return singleton; case 2: //transient return container.invoke(this.state); case 3: //function return this.state(container, key, this); case 4: //array return this.state[0].get(container, key); case 5: //alias return container.get(this.state); default: throw new Error('Invalid strategy: ' + this.strategy); } } } /** * Used to allow injecting dependencies but also passing data to the constructor. */ @resolver() export class Factory { /** @internal */ _key: any; /** * Creates an instance of the Factory class. * @param key The key to resolve from the parent container. */ constructor(key: any) { this._key = key; } /** * Called by the container to pass the dependencies to the constructor. * @param container The container to invoke the constructor with dependencies and other parameters. * @return Returns a function that can be invoked to resolve dependencies later, and the rest of the parameters. */ get(container: Container): any { return (...rest) => container.invoke(this._key, rest); } /** * Creates a Factory Resolver for the supplied key. * @param key The key to resolve. * @return Returns an instance of Factory for the key. */ static of(key: any): Factory { return new Factory(key); } } /** * Used to inject a new instance of a dependency, without regard for existing * instances in the container. Instances can optionally be registered in the container * under a different key by supplying a key using the `as` method. */ @resolver() export class NewInstance { key; asKey; /** * Creates an instance of the NewInstance class. * @param key The key to resolve/instantiate. * @param dynamicDependencies An optional list of dynamic dependencies. */ constructor(key, ...dynamicDependencies: any[]) { this.key = key; this.asKey = key; this.dynamicDependencies = dynamicDependencies; } /** * Called by the container to instantiate the dependency and potentially register * as another key if the `as` method was used. * @param container The container to resolve the parent from. * @return Returns the matching instance from the parent container */ get(container) { let dynamicDependencies = this.dynamicDependencies.length > 0 ? this.dynamicDependencies.map(dependency => dependency['protocol:aurelia:resolver'] ? dependency.get(container) : container.get(dependency)) : undefined; const instance = container.invoke(this.key, dynamicDependencies); container.registerInstance(this.asKey, instance); return instance; } /** * Instructs the NewInstance resolver to register the resolved instance using the supplied key. * @param key The key to register the instance with. * @return Returns the NewInstance resolver. */ as(key) { this.asKey = key; return this; } /** * Creates an NewInstance Resolver for the supplied key. * @param key The key to resolve/instantiate. * @param dynamicDependencies An optional list of dynamic dependencies. * @return Returns an instance of NewInstance for the key. */ static of(key, ...dynamicDependencies: any[]) { return new NewInstance(key, ...dynamicDependencies); } } export function getDecoratorDependencies(target, name) { let dependencies = target.inject; if (typeof dependencies === 'function') { throw new Error('Decorator ' + name + ' cannot be used with "inject()". Please use an array instead.'); } if (!dependencies) { dependencies = metadata.getOwn(metadata.paramTypes, target).slice(); target.inject = dependencies; } return dependencies; } /** * Decorator: Specifies the dependency should be lazy loaded */ export function lazy(keyValue: any) { return function(target, key, index) { let params = getDecoratorDependencies(target, 'lazy'); params[index] = Lazy.of(keyValue); }; } /** * Decorator: Specifies the dependency should load all instances of the given key. */ export function all(keyValue: any) { return function(target, key, index) { let params = getDecoratorDependencies(target, 'all'); params[index] = All.of(keyValue); }; } /** * Decorator: Specifies the dependency as optional */ export function optional(checkParentOrTarget: boolean = true) { let deco = function(checkParent: boolean) { return function(target, key, index) { let params = getDecoratorDependencies(target, 'optional'); params[index] = Optional.of(params[index], checkParent); }; }; if (typeof checkParentOrTarget === 'boolean') { return deco(checkParentOrTarget); } return deco(true); } /** * Decorator: Specifies the dependency to look at the parent container for resolution */ export function parent(target, key, index) { let params = getDecoratorDependencies(target, 'parent'); params[index] = Parent.of(params[index]); } /** * Decorator: Specifies the dependency to create a factory method, that can accept optional arguments */ export function factory(keyValue: any, asValue?: any) { return function(target, key, index) { let params = getDecoratorDependencies(target, 'factory'); let factory = Factory.of(keyValue); params[index] = asValue ? factory.as(asValue) : factory; }; } /** * Decorator: Specifies the dependency as a new instance */ export function newInstance(asKeyOrTarget?: any, ...dynamicDependencies: any[]) { let deco = function(asKey?: any) { return function(target, key, index) { let params = getDecoratorDependencies(target, 'newInstance'); params[index] = NewInstance.of(params[index], ...dynamicDependencies); if (!!asKey) { params[index].as(asKey); } }; }; if (arguments.length >= 1) { return deco(asKeyOrTarget); } return deco(); } /** * Decorator: Specifies a custom Invoker for the decorated item. */ export function invoker(value: Invoker): any { return function(target) { metadata.define(metadata.invoker, value, target); }; } /** * Decorator: Specifies that the decorated item should be called as a factory function, rather than a constructor. */ export function invokeAsFactory(potentialTarget?: any): any { let deco = function(target) { metadata.define(metadata.invoker, FactoryInvoker.instance, target); }; return potentialTarget ? deco(potentialTarget) : deco; } /** * A strategy for invoking a function, resulting in an object instance. */ export interface Invoker { /** * Invokes the function with the provided dependencies. * @param fn The constructor or factory function. * @param dependencies The dependencies of the function call. * @return The result of the function invocation. */ invoke(container: Container, fn: Function, dependencies: any[]): any; /** * Invokes the function with the provided dependencies. * @param fn The constructor or factory function. * @param staticDependencies The static dependencies of the function. * @param dynamicDependencies Additional dependencies to use during invocation. * @return The result of the function invocation. */ invokeWithDynamicDependencies(container: Container, fn: Function, staticDependencies: any[], dynamicDependencies: any[]): any; } /** * An Invoker that is used to invoke a factory method. */ export class FactoryInvoker { /** * The singleton instance of the FactoryInvoker. */ static instance: FactoryInvoker; /** * Invokes the function with the provided dependencies. * @param container The calling container. * @param fn The constructor or factory function. * @param dependencies The dependencies of the function call. * @return The result of the function invocation. */ invoke(container: Container, fn: Function, dependencies: any[]): any { let i = dependencies.length; let args = new Array(i); while (i--) { args[i] = container.get(dependencies[i]); } return fn.apply(undefined, args); } /** * Invokes the function with the provided dependencies. * @param container The calling container. * @param fn The constructor or factory function. * @param staticDependencies The static dependencies of the function. * @param dynamicDependencies Additional dependencies to use during invocation. * @return The result of the function invocation. */ invokeWithDynamicDependencies(container: Container, fn: Function, staticDependencies: any[], dynamicDependencies: any[]): any { let i = staticDependencies.length; let args = new Array(i); while (i--) { args[i] = container.get(staticDependencies[i]); } if (dynamicDependencies !== undefined) { args = args.concat(dynamicDependencies); } return fn.apply(undefined, args); } } FactoryInvoker.instance = new FactoryInvoker(); /** * Decorator: Specifies a custom registration strategy for the decorated class/function. */ export function registration(value: Registration): any { return function(target) { metadata.define(metadata.registration, value, target); }; } /** * Decorator: Specifies to register the decorated item with a "transient" lifetime. */ export function transient(key?: any): any { return registration(new TransientRegistration(key)); } /** * Decorator: Specifies to register the decorated item with a "singleton" lifetime. */ export function singleton(keyOrRegisterInChild?: any, registerInChild: boolean = false): any { return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild)); } /** * Customizes how a particular function is resolved by the Container. */ export interface Registration { /** * Called by the container to register the resolver. * @param container The container the resolver is being registered with. * @param key The key the resolver should be registered as. * @param fn The function to create the resolver for. * @return The resolver that was registered. */ registerResolver(container: Container, key: any, fn: Function): Resolver; } /** * Used to allow functions/classes to indicate that they should be registered as transients with the container. */ export class TransientRegistration { /** @internal */ _key: any; /** * Creates an instance of TransientRegistration. * @param key The key to register as. */ constructor(key?: any) { this._key = key; } /** * Called by the container to register the resolver. * @param container The container the resolver is being registered with. * @param key The key the resolver should be registered as. * @param fn The function to create the resolver for. * @return The resolver that was registered. */ registerResolver(container: Container, key: any, fn: Function): Resolver { let existingResolver = container.getResolver(this._key || key); return existingResolver === undefined ? container.registerTransient(this._key || key, fn) : existingResolver; } } /** * Used to allow functions/classes to indicate that they should be registered as singletons with the container. */ export class SingletonRegistration { /** @internal */ _registerInChild: any; /** @internal */ _key: any; /** * Creates an instance of SingletonRegistration. * @param key The key to register as. */ constructor(keyOrRegisterInChild?: any, registerInChild: boolean = false) { if (typeof keyOrRegisterInChild === 'boolean') { this._registerInChild = keyOrRegisterInChild; } else { this._key = keyOrRegisterInChild; this._registerInChild = registerInChild; } } /** * Called by the container to register the resolver. * @param container The container the resolver is being registered with. * @param key The key the resolver should be registered as. * @param fn The function to create the resolver for. * @return The resolver that was registered. */ registerResolver(container: Container, key: any, fn: Function): Resolver { let targetContainer = this._registerInChild ? container : container.root; let existingResolver = targetContainer.getResolver(this._key || key); return existingResolver === undefined ? targetContainer.registerSingleton(this._key || key, fn) : existingResolver; } } function validateKey(key: any) { if (key === null || key === undefined) { throw new Error('key/value cannot be null or undefined. Are you trying to inject/register something that doesn\'t exist with DI?'); } } export const _emptyParameters = Object.freeze([]); metadata.registration = 'aurelia:registration'; metadata.invoker = 'aurelia:invoker'; let resolverDecorates = resolver.decorates; /** * Stores the information needed to invoke a function. */ export class InvocationHandler { /** * The function to be invoked by this handler. */ fn: Function; /** * The invoker implementation that will be used to actually invoke the function. */ invoker: Invoker; /** * The statically known dependencies of this function invocation. */ dependencies: any[]; /** * Instantiates an InvocationDescription. * @param fn The Function described by this description object. * @param invoker The strategy for invoking the function. * @param dependencies The static dependencies of the function call. */ constructor(fn: Function, invoker: Invoker, dependencies: any[]) { this.fn = fn; this.invoker = invoker; this.dependencies = dependencies; } /** * Invokes the function. * @param container The calling container. * @param dynamicDependencies Additional dependencies to use during invocation. * @return The result of the function invocation. */ invoke(container: Container, dynamicDependencies?: any[]): any { return dynamicDependencies !== undefined ? this.invoker.invokeWithDynamicDependencies(container, this.fn, this.dependencies, dynamicDependencies) : this.invoker.invoke(container, this.fn, this.dependencies); } } /** * Used to configure a Container instance. */ export interface ContainerConfiguration { /** * An optional callback which will be called when any function needs an InvocationHandler created (called once per Function). */ onHandlerCreated?: (handler: InvocationHandler) => InvocationHandler; handlers?: Map<any, any>; } function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) { let i = staticDependencies.length; let args = new Array(i); while (i--) { args[i] = container.get(staticDependencies[i]); } if (dynamicDependencies !== undefined) { args = args.concat(dynamicDependencies); } return Reflect.construct(fn, args); } let classInvokers = { [0]: { invoke(container, Type) { return new Type(); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, [1]: { invoke(container, Type, deps) { return new Type(container.get(deps[0])); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, [2]: { invoke(container, Type, deps) { return new Type(container.get(deps[0]), container.get(deps[1])); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, [3]: { invoke(container, Type, deps) { return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2])); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, [4]: { invoke(container, Type, deps) { return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3])); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, [5]: { invoke(container, Type, deps) { return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3]), container.get(deps[4])); }, invokeWithDynamicDependencies: invokeWithDynamicDependencies }, fallback: { invoke: invokeWithDynamicDependencies, invokeWithDynamicDependencies: invokeWithDynamicDependencies } }; function getDependencies(f) { if (!f.hasOwnProperty('inject')) { return []; } if (typeof f.inject === 'function') { return f.inject(); } return f.inject; } /** * A lightweight, extensible dependency injection container. */ export class Container { /** * The global root Container instance. Available if makeGlobal() has been called. Aurelia Framework calls makeGlobal(). */ static instance: Container; /** * The parent container in the DI hierarchy. */ parent: Container; /** * The root container in the DI hierarchy. */ root: Container; /** @internal */ _configuration: ContainerConfiguration; /** @internal */ _onHandlerCreated: (handler: InvocationHandler) => InvocationHandler; /** @internal */ _handlers: Map<any, any>; /** @internal */ _resolvers: Map<any, any>; /** * Creates an instance of Container. * @param configuration Provides some configuration for the new Container instance. */ constructor(configuration?: ContainerConfiguration) { if (configuration === undefined) { configuration = {}; } this._configuration = configuration; this._onHandlerCreated = configuration.onHandlerCreated; this._handlers = configuration.handlers || (configuration.handlers = new Map()); this._resolvers = new Map(); this.root = this; this.parent = null; } /** * Makes this container instance globally reachable through Container.instance. */ makeGlobal(): Container { Container.instance = this; return this; } /** * Sets an invocation handler creation callback that will be called when new InvocationsHandlers are created (called once per Function). * @param onHandlerCreated The callback to be called when an InvocationsHandler is created. */ setHandlerCreatedCallback(onHandlerCreated: (handler: InvocationHandler) => InvocationHandler) { this._onHandlerCreated = onHandlerCreated; this._configuration.onHandlerCreated = onHandlerCreated; } /** * Registers an existing object instance with the container. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param instance The instance that will be resolved when the key is matched. This defaults to the key value when instance is not supplied. * @return The resolver that was registered. */ registerInstance(key: any, instance?: any): Resolver { return this.registerResolver(key, new StrategyResolver(0, instance === undefined ? key : instance)); } /** * Registers a type (constructor function) such that the container always returns the same instance for each request. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param fn The constructor function to use when the dependency needs to be instantiated. This defaults to the key value when fn is not supplied. * @return The resolver that was registered. */ registerSingleton(key: any, fn?: Function): Resolver { return this.registerResolver(key, new StrategyResolver(1, fn === undefined ? key : fn)); } /** * Registers a type (constructor function) such that the container returns a new instance for each request. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param fn The constructor function to use when the dependency needs to be instantiated. This defaults to the key value when fn is not supplied. * @return The resolver that was registered. */ registerTransient(key: any, fn?: Function): Resolver { return this.registerResolver(key, new StrategyResolver(2, fn === undefined ? key : fn)); } /** * Registers a custom resolution function such that the container calls this function for each request to obtain the instance. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param handler The resolution function to use when the dependency is needed. * @return The resolver that was registered. */ registerHandler(key: any, handler: (container?: Container, key?: any, resolver?: Resolver) => any): Resolver { return this.registerResolver(key, new StrategyResolver(3, handler)); } /** * Registers an additional key that serves as an alias to the original DI key. * @param originalKey The key that originally identified the dependency; usually a constructor function. * @param aliasKey An alternate key which can also be used to resolve the same dependency as the original. * @return The resolver that was registered. */ registerAlias(originalKey: any, aliasKey: any): Resolver { return this.registerResolver(aliasKey, new StrategyResolver(5, originalKey)); } /** * Registers a custom resolution function such that the container calls this function for each request to obtain the instance. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param resolver The resolver to use when the dependency is needed. * @return The resolver that was registered. */ registerResolver(key: any, resolver: Resolver): Resolver { validateKey(key); let allResolvers = this._resolvers; let result = allResolvers.get(key); if (result === undefined) { allResolvers.set(key, resolver); } else if (result.strategy === 4) { result.state.push(resolver); } else { allResolvers.set(key, new StrategyResolver(4, [result, resolver])); } return resolver; } /** * Registers a type (constructor function) by inspecting its registration annotations. If none are found, then the default singleton registration is used. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param fn The constructor function to use when the dependency needs to be instantiated. This defaults to the key value when fn is not supplied. */ autoRegister(key: any, fn?: Function): Resolver { fn = fn === undefined ? key : fn; if (typeof fn === 'function') { let registration = metadata.get(metadata.registration, fn); if (registration === undefined) { return this.registerResolver(key, new StrategyResolver(1, fn)); } return registration.registerResolver(this, key, fn); } return this.registerResolver(key, new StrategyResolver(0, fn)); } /** * Registers an array of types (constructor functions) by inspecting their registration annotations. If none are found, then the default singleton registration is used. * @param fns The constructor function to use when the dependency needs to be instantiated. */ autoRegisterAll(fns: any[]): void { let i = fns.length; while (i--) { this.autoRegister(fns[i]); } } /** * Unregisters based on key. * @param key The key that identifies the dependency at resolution time; usually a constructor function. */ unregister(key: any) : void { this._resolvers.delete(key); } /** * Inspects the container to determine if a particular key has been registred. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @param checkParent Indicates whether or not to check the parent container hierarchy. * @return Returns true if the key has been registred; false otherwise. */ hasResolver(key: any, checkParent: boolean = false): boolean { validateKey(key); return this._resolvers.has(key) || (checkParent && this.parent !== null && this.parent.hasResolver(key, checkParent)); } /** * Gets the resolver for the particular key, if it has been registered. * @param key The key that identifies the dependency at resolution time; usually a constructor function. * @return Returns the resolver, if registred, otherwise undefined. */ getResolver(key: any) { return this._resolvers.get(key); } /** * Resolves a single instance based on the provided key. * @param key The key that identifies the object to resolve. * @return Returns the resolved instance. */ get(key: any): any { validateKey(key); if (key === Container) { return this; } if (resolverDecorates(key)) { return key.get(this, key); } let resolver = this._resolvers.get(key); if (resolver === undefined) { if (this.parent === null) { return this.autoRegister(key).get(this, key); } let registration = metadata.get(metadata.registration, key); if (registration === undefined) { return this.parent._get(key); } return registration.registerResolver(this, key, key).get(this, key); } return resolver.get(this, key); } _get(key) { let resolver = this._resolvers.get(key); if (resolver === undefined) { if (this.parent === null) { return this.autoRegister(key).get(this, key); } return this.parent._get(key); } return resolver.get(this, key); } /** * Resolves all instance registered under the provided key. * @param key The key that identifies the objects to resolve. * @return Returns an array of the resolved instances. */ getAll(key: any): any[] { validateKey(key); let resolver = this._resolvers.get(key); if (resolver === undefined) { if (this.parent === null) { return _emptyParameters; } return this.parent.getAll(key); } if (resolver.strategy === 4) { let state = resolver.state; let i = state.length; let results = new Array(i); while (i--) { results[i] = state[i].get(this, key); } return results; } return [resolver.get(this, key)]; } /** * Creates a new dependency injection container whose parent is the current container. * @return Returns a new container instance parented to this. */ createChild(): Container { let child = new Container(this._configuration); child.root = this.root; child.parent = this; return child; } /** * Invokes a function, recursively resolving its dependencies. * @param fn The function to invoke with the auto-resolved dependencies. * @param dynamicDependencies Additional function dependencies to use during invocation. * @return Returns the instance resulting from calling the function. */ invoke(fn: Function & { name?: string }, dynamicDependencies?: any[]) { try { let handler = this._handlers.get(fn); if (handler === undefined) { handler = this._createInvocationHandler(fn); this._handlers.set(fn, handler); } return handler.invoke(this, dynamicDependencies); } catch (e) { throw new AggregateError(`Error invoking ${fn.name}. Check the inner error for details.`, e, true); } } _createInvocationHandler(fn: Function & { inject?: any }): InvocationHandler { let dependencies; if (fn.inject === undefined) { dependencies = metadata.getOwn(metadata.paramTypes, fn) || _emptyParameters; } else { dependencies = []; let ctor = fn; while (typeof ctor === 'function') { dependencies.push(...getDependencies(ctor)); ctor = Object.getPrototypeOf(ctor); } } let invoker = metadata.getOwn(metadata.invoker, fn) || classInvokers[dependencies.length] || classInvokers.fallback; let handler = new InvocationHandler(fn, invoker, dependencies); return this._onHandlerCreated !== undefined ? this._onHandlerCreated(handler) : handler; } } /** * Decorator: Directs the TypeScript transpiler to write-out type metadata for the decorated class. */ export function autoinject(potentialTarget?: any): any { let deco = function(target) { let previousInject = target.inject ? target.inject.slice() : null; //make a copy of target.inject to avoid changing parent inject let autoInject: any = metadata.getOwn(metadata.paramTypes, target) || _emptyParameters; if (!previousInject) { target.inject = autoInject; } else { for (let i = 0; i < autoInject.length; i++) { //check if previously injected. if (previousInject[i] && previousInject[i] !== autoInject[i]) { const prevIndex = previousInject.indexOf(autoInject[i]); if (prevIndex > -1) { previousInject.splice(prevIndex, 1); } previousInject.splice((prevIndex > -1 && prevIndex < i) ? i - 1 : i, 0, autoInject[i]); } else if (!previousInject[i]) {//else add previousInject[i] = autoInject[i]; } } target.inject = previousInject; } }; return potentialTarget ? deco(potentialTarget) : deco; } /** * Decorator: Specifies the dependencies that should be injected by the DI Container into the decoratored class/function. */ export function inject(...rest: any[]): any { return function(target, key, descriptor) { // handle when used as a parameter if (typeof descriptor === 'number' && rest.length === 1) { let params = target.inject; if (typeof params === 'function') { throw new Error('Decorator inject cannot be used with "inject()". Please use an array instead.'); } if (!params) { params = metadata.getOwn(metadata.paramTypes, target).slice(); target.inject = params; } params[descriptor] = rest[0]; return; } // if it's true then we injecting rest into function and not Class constructor if (descriptor) { const fn = descriptor.value; fn.inject = rest; } else { target.inject = rest; } }; }
'use strict'; var app = angular.module('com.module.protocols'); app.service('ProtocolsService', ['CoreService', 'gettextCatalog', 'Protocol', function( CoreService, gettextCatalog, Protocol) { this.getProtocols = function() { return Protocol.find({ filter: { order: 'created DESC', include: { relation: 'usedBy', // include the owner object scope: { // further filter the owner object fields: ['userId'], // only show two fields } }, } }).$promise; }; this.getProtocol = function(id) { return Protocol.findById({ id: id }).$promise; }; this.deleteProtocol = function(id, cb) { CoreService.confirm(gettextCatalog.getString('Are you sure?'), gettextCatalog.getString('Deleting this cannot be undone'), function() { Protocol.deleteById(id, function() { CoreService.toastSuccess(gettextCatalog.getString( 'Item deleted'), gettextCatalog.getString( 'Your item has been deleted!')); cb(); }, function(err) { CoreService.toastError(gettextCatalog.getString('Oops'), gettextCatalog.getString('Error deleting item: ') + err); cb(); }); }, function() { return false; }); }; }]);