text
stringlengths
2
6.14k
import createMarkup from "../react.markup"; it("should return blank if no content", () => { const result = createMarkup({ content: { body: "false", }, }); expect(result).toEqual({ __html: "", }); }); it("should return from body prop by default", () => { const result = createMarkup({ content: { body: "<h1>test</h1>", }, }); expect(result).toEqual({ __html: "<h1>test</h1>", }); }); it("should allow setting a different prop for content", () => { const result = createMarkup({ content: { newBody: "<h1>test</h1>", }, }, "newBody"); expect(result).toEqual({ __html: "<h1>test</h1>", }); });
// Example input: [ '6', '-26 -25 -28 31 2 27' ] function largerThanNeighbours(args) { var i, count = 0, len = +args[0], myArray = args[1].split(' ').map(Number); for (i = 1; i < len - 1; i += 1) { if (myArray[i] > myArray[i - 1] && myArray[i] > myArray[i + 1]) { count += 1; } } return count; } console.log(largerThanNeighbours([ '6', '-26 -25 -28 31 2 27' ]));
"use strict"; var util = require("util"); /** * InvalidRateLimitConfiguration error triggered when passed invalid configurations. * * @param {String} description Extended description * @returns {void} */ function InvalidRateLimiterConfiguration(description) { Error.captureStackTrace(this, this.constructor); this.statusCode = 421; this.name = this.constructor.name; this.message = "Invalid rate limit configuration !!!"; if (description) { this.message += " " + description; } } util.inherits(InvalidRateLimiterConfiguration, Error); module.exports = InvalidRateLimiterConfiguration;
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function Target (x, y) { this.left = x; this.top = y; this.right = x + 100; this.bottom = y + 35; } Target.prototype.getBoundingClientRect = function () { return this; } var targets = [ new Target(0, 0), new Target(110, 0), new Target(220, 0), new Target(330, 0), new Target(440, 0), new Target(550, 0), new Target(0, 100), new Target(110, 100), new Target(220, 100), new Target(330, 100), new Target(440, 100), new Target(550, 100), ]; var fixations = [ {x: 30, y: 15, saccade: {x: 0, y: 0, newLine: false}}, {x: 130, y: 10, saccade: {x: 100, y: -5, newLine: false}}, {x: 250, y: -5, saccade: {x: 120, y: -15, newLine: false}}, {x: 370, y: 5, saccade: {x: 120, y: 10, newLine: false}}, {x: 470, y: -10, saccade: {x: 100, y: -15, newLine: false}}, {x: 490, y: 5, saccade: {x: 20, y: 15, newLine: false}}, {x: 590, y: 0, saccade: {x: 100, y: -5, newLine: false}}, {x: 200, y: 30, saccade: {x: -290, y: 30, newLine: true}}, {x: 30, y: 120, saccade: {x: -170, y: 90, newLine: true}}, {x: 130, y: 120, saccade: {x: 100, y: 0, newLine: false}}, {x: 250, y: 115, saccade: {x: 120, y: -5, newLine: false}}, {x: 370, y: 100, saccade: {x: 120, y: -15, newLine: false}}, {x: 470, y: 95, saccade: {x: 100, y: -5, newLine: false}}, {x: 490, y: 95, saccade: {x: 20, y: 0, newLine: false}}, {x: 590, y: 90, saccade: {x: 100, y: -5, newLine: false}}, ]; var model = Geometry.create( targets ); LinePredictor.init( model ); var input = fixations.map( (fix, index) => { return { fix: fix, isReading: index > 1 }; }); describe( 'LinePredictor', function() { describe( '#get( isEnteredReadingMode, currentFixation, currentLine, offset )', function () { var line = null; var results = input.map( (item) => { console.log( '\n ===== NEW FIX =====\n' ); line = LinePredictor.get( item.isReading, item.fix, line, 0 ); if (line) { line.addFixation( item.fix ); } return line; }); it( `should all fixations be mapped`, function () { let fixCount = results.reduce( (count, line) => { return count + (!line ? 1 : 0); }, 0); assert.equal( 0, fixCount ); }); it( `should 8 fixations be mapped onto line 0`, function () { let fixCount = results.reduce( (count, line) => { return count + (line && line.index === 0 ? 1 : 0); }, 0); assert.equal( 8, fixCount ); }); it( `should 7 fixations be mapped onto line 1`, function () { let fixCount = results.reduce( (count, line) => { return count + (line && line.index === 1 ? 1 : 0); }, 0); assert.equal( 7, fixCount ); }); }); });
var shovel = require('../shovel'), util = require('../util'), temp = require('temp'); module.exports.run = function run(opts, cb) { temp.track(); var racketCodeDir = temp.mkdirSync('racket'), args = ['-l', 'racket/base']; shovel.start(opts, cb, { solutionOnly: function () { if (opts.setup) { var setupFile = util.codeWriteSync('racket', opts.setup, racketCodeDir, 'setup.rkt'); args.push('-t', setupFile); } args.push('-e', opts.solution); return { name: 'racket', args: args }; }, fullProject: function () { throw 'Test framework is not supported'; } }); };
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), requirejs: { compile: { options: { paths: { requireLib: 'node_modules/requirejs/require' }, include: [ "requireLib" ], baseUrl: ".", mainConfigFile: "app.js", name: "app", optimize: "uglify2", out: "<%= pkg.name %>.min.js" } } } }); // load libs grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-exec'); // building task grunt.registerTask('build', [ 'requirejs' ]); };
var d3 = require('d3'); function true_index(arr, config) { // Series.ix[start, end].true().index; if (!config) { config = {}; } if (!config.length) { config.length = arr.length } config.start = config.start ? config.start : 0; config.end = config.end ? config.end : config.length; var valid = new Array(config.length); var j = 0; for (var i=config.start; i <= config.end; i++) { if (arr[i]) { valid[j] = i; j++; } } valid = valid.slice(0, j); return valid; } function where(arr, mask) { var data = arr.slice(0); for (var i=0; i < data.length; i++) { if (!mask[i]) { data[i] = null; } } return data; } module.exports.true_index = true_index; module.exports.where = where; mask = [true, true, false, false, true, false] series = d3.range(mask.length); res = true_index(mask, {}); res = true_index(mask, {'start':1}); res = where(series, mask);
if (process.title !== 'browser') { switch (process.env.KADOH_TRANSPORT) { default: case 'xmpp': //@browserify-ignore module.exports = require('./node-xmpp'); break; case 'udp': //@browserify-ignore module.exports = require('./udp') ; break; } } else { switch (process.env.KADOH_TRANSPORT) { default: case 'xmpp': module.exports = require('./strophe'); break; case 'simudp': module.exports = require('./simudp'); break; } }
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var MdForum = function MdForum(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm28.4 20q0 0.7-0.5 1.2t-1.3 0.4h-16.6l-6.6 6.8v-23.4q0-0.7 0.4-1.2t1.2-0.4h21.6q0.7 0 1.3 0.4t0.5 1.2v15z m6.6-10q0.7 0 1.2 0.5t0.4 1.1v25l-6.6-6.6h-18.4q-0.7 0-1.1-0.5t-0.5-1.1v-3.4h21.6v-15h3.4z' }) ) ); }; exports.default = MdForum; module.exports = exports['default'];
var cooking = require('cooking'); var path = require('path'); cooking.set({ entry: { index: path.join(__dirname, 'index.js') }, dist: path.join(__dirname, 'lib'), template: false, format: 'umd', moduleName: 'MintIndicator', extractCSS: 'style.css', extends: ['vue', 'saladcss'] }); cooking.add('resolve.alias', { 'main': path.join(__dirname, '../../src'), 'mint-ui': path.join(__dirname, '..') }); cooking.add('externals', { vue: { root: 'Vue', commonjs: 'vue', commonjs2: 'vue', amd: 'vue' } }); module.exports = cooking.resolve();
import { connect } from 'react-redux' import { helloWorld } from '../actions' import Hello from './../components/Hello' const mapStateToProps = (state) => { return { message: state.hello.message } } const mapDispatchToProps = (dispatch) => { return { onClick: () => { dispatch(helloWorld()) } } } const HelloWorld = connect( mapStateToProps, mapDispatchToProps )(Hello) export default HelloWorld
/* */ define( [ "../core" ], function( jQuery ) { "use strict"; // Cross-browser xml parsing jQuery.parseXML = function( data ) { var xml; if ( !data || typeof data !== "string" ) { return null; } // Support: IE 9 - 11 only // IE throws on parseFromString with invalid input. try { xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); } catch ( e ) { xml = undefined; } if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }; return jQuery.parseXML; } );
'use strict' exports.register = function(server, options, next){ server.route([ { method: 'GET', path: '/createuser', config: { // Uncomment for security //auth: { // strategy: 'standard', // scope: 'admin' //}, handler: function(request, reply) { return reply('<html><head><title>User Creation</title></head><body>' + '<form method="post" action="/createuser">' + 'New Username:<br><input type="text" name="create_username" ><br>' + 'New Email:<br><input type="text" name="create_email" ><br>' + 'New Password:<br><input type="password" name="create_password"><br/><br/>' + 'Scope:<br><input type="text" name="create_scope"><br/><br/>' + 'Survey:<br><input type="int" name="survey_access_number"><br/><br/>' + '<input type="submit" value="Create User"></form></body></html>') } } }, { method: 'POST', path: '/createuser', config: { // Uncomment for security //auth: { // strategy: 'standard', // scope: 'admin' //}, handler: function(request, reply) { const User = server.plugins['hapi-shelf'].model('Users') const user = new User() .save({ username: request.payload.create_username, email: request.payload.create_email, password: request.payload.create_password, scope: request.payload.create_scope, survey: request.payload.survey_access_number }) .then(function(new_user) { reply.redirect('/allusers') }) .catch() } } }, { method: 'GET', path: '/allusers', config: { handler: function(request, reply) { const User = server.plugins['hapi-shelf'].model('Users') reply(User .fetchAll() ) } } }]) next() } exports.register.attributes = { name: 'newuser' }
BASE.require([ "BASE.sqlite.Visitor" ], function () { });
// This file is part of Indico. // Copyright (C) 2002 - 2019 CERN // // Indico is free software; you can redistribute it and/or // modify it under the terms of the MIT License; see the // LICENSE file for more details. (function(global) { 'use strict'; global.setupLinkingWidget = function setupLinkingWidget(options) { options = $.extend( true, { fieldId: null, }, options ); function updateDropdownState() { var $this = $(this); if ($this.prop('checked')) { $this .closest('.i-radio') .siblings('.i-radio') .find('.i-linking-dropdown select') .prop('disabled', true); $this .siblings('.i-linking-dropdown') .find('select') .prop('disabled', false); } } var field = $('#' + options.fieldId); field .find('.i-linking > .i-linking-dropdown > select > option[value=""]') .prop('disabled', true); field .find('.i-linking.i-radio > input[type="radio"]') .off('change') .on('change', updateDropdownState) .each(updateDropdownState); }; })(window);
'use strict' var fs = require('graceful-fs') var path = require('path') var mkdirpSync = require('mkdirp').sync var rimraf = require('rimraf') var test = require('tap').test var common = require('../common-tap.js') var base = common.pkg var cruft = path.join(base, 'node_modules', 'cruuuft') var pkg = { name: 'example', version: '1.0.0', dependencies: {} } function setup () { mkdirpSync(path.dirname(cruft)) fs.writeFileSync(cruft, 'this is some cruft for sure') fs.writeFileSync(path.join(base, 'package.json'), JSON.stringify(pkg)) } function cleanup () { rimraf.sync(base) } test('setup', function (t) { cleanup() setup() t.done() }) test('cruft', function (t) { common.npm(['ls'], {cwd: base}, function (er, code, stdout, stderr) { t.is(stderr, '', 'no warnings or errors from ls') t.done() }) }) test('cleanup', function (t) { cleanup() t.done() })
var _INCLUDED = false; module.exports = function() { var BandRenderer = require('../../../core/renderers/band_renderer.js'); if (_INCLUDED) { return BandRenderer; } _INCLUDED = true; // cached state object, for quick access during rendering, populated in begin() method: BandRenderer.hasA("state"); BandRenderer.respondsTo("begin", function (context) { var state = { "context" : context, "run" : [], "linecolor" : this.getOptionValue("linecolor"), "line1color" : this.getOptionValue("line1color"), "line2color" : this.getOptionValue("line2color"), "linewidth" : this.getOptionValue("linewidth"), "line1width" : this.getOptionValue("line1width"), "line2width" : this.getOptionValue("line2width"), "fillcolor" : this.getOptionValue("fillcolor"), "fillopacity" : this.getOptionValue("fillopacity") }; this.state(state); }); // This renderer's dataPoint() method works by accumulating // and drawing one "run" of data points at a time. A "run" of // points consists of a consecutive sequence of non-missing // data points which have the same fill color. (The fill // color can change if the data line crosses the fill base // line, if the downfillcolor is different from the // fillcolor.) BandRenderer.respondsTo("dataPoint", function (datap) { var state = this.state(); if (this.isMissing(datap)) { // if this is a missing point, render and reset the current run, if any if (state.run.length > 0) { this.renderRun(); state.run = []; } } else { // otherwise, transform point to pixel coords var p = this.transformPoint(datap); // and add it to the current run state.run.push(p); } }); BandRenderer.respondsTo("end", function () { var state = this.state(); // render the current run, if any if (state.run.length > 0) { this.renderRun(); } }); /* * Private utility function to stroke line segments connecting the points of a run */ var strokeRunLine = function(context, run, whichLine, color, defaultColor, width, defaultWidth) { var i; width = (width >= 0) ? width : defaultWidth; if (width > 0) { color = (color !== null) ? color : defaultColor; context.save(); context.strokeStyle = color.getHexString("#"); context.lineWidth = width; context.beginPath(); context.moveTo(run[0][0], run[0][whichLine]); for (i = 1; i < run.length; ++i) { context.lineTo(run[i][0], run[i][whichLine]); } context.stroke(); context.restore(); } }; // Render the current run of data points. This consists of drawing the fill region // in the band between the two data lines, and connecting the points of each data line // with lines of the appropriate color. BandRenderer.respondsTo("renderRun", function () { var state = this.state(), context = state.context, run = state.run, i; // fill the run context.save(); context.globalAlpha = state.fillopacity; context.fillStyle = state.fillcolor.getHexString("#"); context.beginPath(); // trace to the right along line 1 context.moveTo(run[0][0], run[0][1]); for (i = 1; i < run.length; ++i) { context.lineTo(run[i][0], run[i][1]); } // trace back to the left along line 2 context.lineTo(run[run.length-1][0], run[run.length-1][2]); for (i = run.length-1; i >= 0; --i) { context.lineTo(run[i][0], run[i][2]); } context.fill(); context.restore(); // stroke line1 strokeRunLine(context, run, 1, state.line1color, state.linecolor, state.line1width, state.linewidth); // stroke line2 strokeRunLine(context, run, 2, state.line2color, state.linecolor, state.line2width, state.linewidth); }); BandRenderer.respondsTo("renderLegendIcon", function (context, x, y, icon) { var state = this.state(), iconWidth = icon.width(), iconHeight = icon.height(); context.save(); context.transform(1, 0, 0, 1, x, y); context.save(); // Draw icon background (with opacity) if (iconWidth < 10 || iconHeight < 10) { context.fillStyle = state.fillcolor.toRGBA(); } else { context.fillStyle = "#FFFFFF"; } context.fillRect(0, 0, iconWidth, iconHeight); context.restore(); // Draw icon graphics context.strokeStyle = (state.line2color !== null) ? state.line2color : state.linecolor; context.lineWidth = (state.line2width >= 0) ? state.line2width : state.linewidth; context.fillStyle = state.fillcolor.toRGBA(state.fillopacity); context.beginPath(); context.moveTo(0, 2*iconHeight/8); context.lineTo(0, 6*iconHeight/8); context.lineTo(iconWidth, 7*iconHeight/8); context.lineTo(iconWidth, 3*iconHeight/8); context.lineTo(0, 2*iconHeight/8); context.fill(); context.stroke(); context.restore(); }); return BandRenderer; };
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import Welcome from '../../src/js/components/Welcome'; describe('Welcome Component', () => { var welcomeComponent; beforeEach(() => { welcomeComponent = shallow(<Welcome />); }); it('renders Mikey Welcomes You! in a h1 tag', () => { expect(welcomeComponent.find('h1').text()).to.equal('Mikey Welcomes You!'); }); it('renders Use the latest web development technologies. in a h2 tag', () => { expect(welcomeComponent.find('h2').text()).to.equal('Use the latest web development technologies.'); }); });
export default { 'ACT': 'Australian Capital Territory', 'NSW': 'New South Wales', 'NT' : 'Northern Territory', 'QLD': 'Queensland', 'SA' : 'South Australia', 'TAS': 'Tasmania', 'VIC': 'Victoria', 'WA' : 'Western Australia' }
if( typeof module !== 'undefined' ) require( 'wFiles' ) var _ = wTools; /* filesCopy HardDrive -> Extract */ var hub = _.FileProvider.Hub(); var simpleStructure = _.FileProvider.Extract ({ filesTree : Object.create( null ) }); hub.providerRegister( simpleStructure ); var hdUrl = _.fileProvider.urlFromLocal( _.normalize( __dirname ) ); var ssUrl = simpleStructure.urlFromLocal( '/dir/copy/to' ); hub.filesCopy ({ dst : ssUrl, src : hdUrl, preserveTime : 0 }); var tree = _.entity.exportString( simpleStructure.filesTree, { levels : 4 } ); console.log( tree );
version https://git-lfs.github.com/spec/v1 oid sha256:e330e85aabf65a6116144dfe2e726f649a1cdfd88a33e6ce4e3a39f40ebadfbb size 153184
/** * report business validation library */ var async = require('async'); module.exports = function(services, logger) { var me = this; me.validate = function(object, callback) { var errors = []; me.done = function() { var bVal = {valid: !(errors.length), errors: errors}; callback(bVal); }; me.validateObject(object, errors, me.done); }; /** * Default messages to include with validation errors. */ me.messages = { alpha_report_id: "Alpha Report id is invalid", target_event_id: "Target Event id is invalid", profile_id: "Profile id is invalid", assertions: "Assertions are invalid" }; me.validateObject = function(object, errors, done) { var value = object.alpha_report_id; me.alphaReportExists(value, errors, function (err, found) { var property = 'alpha_report_id'; if (value !== undefined){ if (!found) { me.error(property, value, errors, "Alpha Report does not exist."); logger.debug("alphaReportExists " + value + " does not exist."); } } value = object.target_event_id; me.targetEventExists(value, errors, function(err, found) { var property = 'target_event_id'; if (value !== undefined) { if (!found){ me.error(property, value, errors, "Target Event does not exist."); logger.debug("targetEventExists " + value + " does not exist."); } } value = object.profile_id; me.profileExists(value, errors, function(err, found) { var property = 'profile_id'; if (value !== undefined) { if (!found) { me.error(property, value, errors, "Profile does not exist."); logger.debug("profileExists " + value + " does not exist"); } } value = object.assertions; me.assertionsExist(value, errors, function(err, found) { var property = 'assertions'; if (value !== undefined) { if (!found) { me.error(property, value, errors, "Assertions do not exist."); logger.info("assertionsExist " + value + " do not exist"); } } done(); }); }); }); }); }; //alpha report exists me.alphaReportExists = function(value, errors, callback) { services.alphaReportService.get(value, function(err, docs) { if (err) { me.error('alpha_report_id', value, errors, 'Error reading alpha_report_id ' + err); logger.error("Error getting alphaReport by id ", err); callback(err, false); } else if (0 !== docs.length) { logger.info("Alpha Report found for alphaReportExists" + JSON.stringify(docs)); callback(err, true); } else { logger.info("Alpha Report not found " + value); callback(err, false); } }); }; me.targetEventExists = function(value, errors, callback) { if(typeof(value) === 'undefined' || !value) { callback(null, true); } else { services.targetEventService.get(value, function(err, docs){ if (err) { me.error('target_event_id', value, errors, 'Error reading target_event_id ' + err); me.logger.error("Error getting targetEvent by id ", err); callback(err, false); } else if (0 !== docs.length) { me.logger.info("Target Event found for targetEventIsValid" + JSON.stringify(docs)); callback(err, true); } else { me.logger.info("Target Event not found " + value); callback(err, false); } }); } }; me.profileExists = function(value, errors, callback) { if(typeof(value) === 'undefined' || !value) { callback(null, true); } else { services.profileService.get(value, function(err, docs) { if (err) { me.error('profile_id', value, errors, 'Error reading profile ' + err); logger.error("Error getting profile by id ", err); callback(err, false); } else if (0 !== docs.length) { logger.info("Profile found for profile" + JSON.stringify(docs)); callback(err, true); } else { logger.info("Profile string not found " + value); callback(err, false); } }); } }; me.assertionsExist = function(value, errors, callback) { if (typeof(value) === 'undefined' || value.length === 0) { callback(null, true); } else { async.each(value, function(assertion, eachCallback) { services.assertionService.get(assertion, function(err, assertionDoc) { if (err) { me.error('assertions', value, errors, 'Error reading assertion ' + err); logger.error("Error getting assertion by id ", err); eachCallback(err); } else if (0 !== assertionDoc.length) { logger.info("Assertion found for assertionsAreValid" + JSON.stringify(assertionDoc)); eachCallback(err); } else { logger.info("Assertion not found " + value); eachCallback(err); } }); }, function (err) { if (err) { callback(err, false); } else { callback(err, true); } }); } }; me.error = function(property, actual, errors, msg) { var lookup = { property : property }; var message = msg || me.messages[property] || "no default message"; message = message.replace(/%\{([a-z]+)\}/ig, function(_, match) { var msg = lookup[match.toLowerCase()] || ""; return msg; }); errors.push({ property : property, actual : actual, message : message }); }; };
win = windows.getAll()[0] test(function() { g[0] = groups.create( [ { url: "data:text/plain,1" }, { url: "data:text/plain,2" }, { url: "data:text/plain,yay" }, ]) assert_equals(g[0].tabs.getAll().length, 3) var tab = g[0].tabs.getAll()[2] g[1] = groups.create( [ tab, // <-- throws { url: "data:text/plain,9" } ]) assert_equals( g[0].tabs.getAll().length, 2) assert_equals( g[1].tabs.getAll().length, 2) }, "Create group in default window")
// @flow import Bluebird from 'bluebird'; import type { Disposable } from 'bluebird'; const defer: Bluebird.Defer = Bluebird.defer(); const promise: Bluebird<*> = defer.promise; (promise.isFulfilled(): bool); promise.reflect().then(inspection => { (inspection.isCancelled(): bool); (inspection.pending(): bool); }); // $FlowExpectedError new Bluebird(); Bluebird.all([ new Bluebird(() => {}), ]); Bluebird.map([1], (x: number) => new Bluebird(() => {})).all(); Bluebird.map(Bluebird.resolve([1]), (x: number) => new Bluebird(() => {})).all(); Bluebird.reject('test'); Bluebird.all([ 1 ]); function mapper(x: number): Promise<number> { return Bluebird.resolve(x); } let mapResult: Promise<number[]> = Bluebird.map([1], mapper); let mapSeriesResult: Promise<number[]> = Bluebird.mapSeries([1], mapper); Bluebird.resolve([1,2,3]).then(function(arr) { let l = arr.length; // $FlowExpectedError Property not found in Array arr.then(r => r); }); let response = fetch('/').then(r => r.text()) Bluebird.resolve(response).then(function(responseBody) { let length: number = responseBody.length; // $FlowExpectedError Property not found in string responseBody.then(r => r); }); Bluebird.all([1, Bluebird.resolve(1), Promise.resolve(1)]).then(function(r: Array<number>) { }); Bluebird.all(['hello', Bluebird.resolve('world'), Promise.resolve('!')]).then(function(r: Array<string>) { }); Bluebird.join(1, Bluebird.resolve(2), function (a, b) { return a + b }).then(function (s) { return s + 1 }) Bluebird.join( 1, Bluebird.resolve(2), Promise.resolve(3), function (a, b) { return a + b }).then(function (s) { return s + 1 }) Bluebird.join(1, Bluebird.resolve(2), function (a, b) { return Bluebird.resolve(a + b) }).then(function (s) { return s + 1 }) // $FlowExpectedError Bluebird.all([1, Bluebird.resolve(1), Promise.resolve(1)]).then(function(r: Array<string>) { }); function foo(a: number, b: string) { throw new Error('oh no'); } let fooPromise = Bluebird.method(foo); fooPromise(1, 'b').catch(function(e: Error) { let m: string = e.message; }); function fooPlain (a: number, b: string) { return 1; } let fooPlainPromise = Bluebird.method(fooPlain); fooPlainPromise(1, 'a').then(function (n: number) { let n2 = n; }); function fooNative (a: number, b: string) { return Promise.resolve(2); } let fooNativePromise = Bluebird.method(fooNative); fooNativePromise(1, 'a').then(function (n: number) { let n2 = n; }); function fooBluebird (a: number, b: string) { return Bluebird.resolve(3); } let fooBluebirdPromise = Bluebird.method(fooBluebird); fooBluebirdPromise(1, 'a').then(function (n: number) { let n2 = n; }); // $FlowExpectedError fooPromise('a', 1) // $FlowExpectedError fooPromise() Bluebird.resolve(['arr', { some: 'value' }, 42]) .spread((someString: string, map: Object, answer: number) => answer) .then(answer => answer * 2); Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next); Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, 1); Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, Bluebird.resolve(1)); Bluebird.reduce([5, Bluebird.resolve(6), Promise.resolve(7)], (memo, next) => memo + next, Promise.resolve(1)); Bluebird.reduce(Promise.resolve([5, Bluebird.resolve(6), Promise.resolve(7)]), (memo, next) => memo + next); Bluebird.reduce(Bluebird.resolve([5, Bluebird.resolve(6), Promise.resolve(7)]), (memo, next) => memo + next, 1); Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Promise.resolve(prev * num)); Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Bluebird.resolve(prev * num)); //$FlowExpectedError Bluebird.reduce([1, Bluebird.resolve(2), Promise.resolve(3)], (prev, num) => Bluebird.resolve(prev * num), 'hello'); type PromiseOutput<T> = () => Promise<T>; let givePromise1: PromiseOutput<number> = () => Promise.resolve(1); let givePromise2: PromiseOutput<number> = () => Bluebird.resolve(2); // $FlowExpectedError let givePromise3: PromiseOutput<number> = () => Bluebird.resolve('hello'); type PromiseInput<T> = (input: Promise<T>) => Function let takePromise: PromiseInput<number> = (promise) => promise.then takePromise(Promise.resolve(1)); takePromise(Bluebird.resolve(1)); // $FlowExpectedError takePromise(Bluebird.resolve('hello')); Bluebird.delay(500); // $FlowExpectedError Bluebird.delay('500'); Bluebird.delay(500, 1); Bluebird.delay(500, Promise.resolve(5)); Bluebird.delay(500, Bluebird.resolve(5)); Bluebird.resolve().return(5).then((result: number) => {}); Bluebird.resolve().thenReturn(5).then((result: number) => {}); // $FlowExpectedError Bluebird.resolve().return(5).then((result: string) => {}); // $FlowExpectedError Bluebird.resolve().thenReturn(5).then((result: string) => {}); let disposable: Disposable<boolean> = Bluebird.resolve(true).disposer((value: boolean) => {}); Bluebird.using(disposable, (value: boolean) => 9).then((result: number) => {}); // $FlowExpectedError Bluebird.using(disposable, (value: number) => 9); // $FlowExpectedError Bluebird.using(disposable, (value: boolean) => 9).then((result: boolean) => {});
"use strict"; input.map(function (item) { return item + 1; }); (function (a) { return a + 1; });
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="m12 17.27l4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72 3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18-1.1 4.72c-.2.86.73 1.54 1.49 1.08l4.15-2.5z" /> , 'StarRounded');
#!/usr/bin/env node 'use strict' var fs = require('fs') var Promise = require('promise') var colors = require('colors') var _ = require('underscore') const areaNameRegex = new RegExp('^[a-zA-Z]+$') const templatesDir = process.cwd() + '/_scripts/.templates' const areasDir = process.cwd() + '/src/app/areas' var areasToCreate = _.uniq(process.argv.slice(2)) var areasPromises = [] areasToCreate.forEach(function (areaName) { if (canCreateArea(areasDir + '/' + areaName)) { areasPromises.push(createAreaDirStructure(areaName)) } else { areasToCreate = _.without(areasToCreate, areaName) } }) Promise.all(areasPromises).then(function (results) { results.forEach(function (result, i) { console.log(colors.cyan.bold('✔ Created area: ', areasToCreate[i])) result.forEach(function (file) { console.log(colors.green(' +'), file) }) }) }) function dirExists (filePath) { try { return fs.statSync(filePath).isDirectory() } catch (err) { return false } } function canCreateArea (areaName) { if (areaNameRegex.test(areaName.split('/').pop())) { if (dirExists(areaName)) { console.log(colors.yellow('! Skipping', colors.bold(areaName.split('/').pop()), ', area already exists')) return false } return true } else { console.log(colors.red('! Skipping', colors.bold(areaName.split('/').pop()), ', wrong name, you can use letters only')) return false } } function createAreaDirStructure (areaName) { try { const areaDir = areasDir + '/' + areaName const areaTestsDir = areasDir + '/' + areaName + '/' + 'test' var filePromises = [] process.chdir(areasDir) fs.mkdirSync(areaName) fs.mkdirSync(areaName + '/test') filePromises.push(createFileFromTemplate(areaDir, 'actions.js', 'actions.tmpl.js', { areaName: areaName })) filePromises.push(createFileFromTemplate(areaDir, 'reducer.js', 'reducer.tmpl.js', { areaName: areaName })) filePromises.push(createFileFromTemplate(areaTestsDir, 'reducer.spec.js', 'reducer.spec.tmpl.js', { areaName: areaName })) process.chdir(areasDir) return Promise.all(filePromises) } catch (e) { return false } } function createFileFromTemplate (dir, filename, templateName, templateData) { return new Promise(function (resolve, reject) { fs.readFile(templatesDir + '/' + templateName, function (err, data) { var fileContent = new Buffer((_.template(data.toString()))(templateData)) process.chdir(dir) fs.open(filename, 'w', function (err, fd) { if (err) { throw 'Error opening file: ' + err } fs.write(fd, fileContent, 0, fileContent.length, null, function (err) { if (err) { throw 'Error writing file: ' + err } fs.close(fd, function () { process.chdir(areasDir) resolve(dir + '/' + filename) }) }) }) }) }) }
var b2Vec2 = Box2D.Common.Math.b2Vec2; var b2Body = Box2D.Dynamics.b2Body; var b2BodyDef = Box2D.Dynamics.b2BodyDef; var b2FixtureDef = Box2D.Dynamics.b2FixtureDef; var b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape; var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape; var b2Math = Box2D.Common.Math.b2Math; function parseQueryString(str){ var dec = decodeURIComponent; var arr = []; var item; if (typeof(str) == 'undefined') { return arr; } if (str.indexOf('?', 0) > -1) { str = str.split('?')[1]; } str = str.split('&'); for (var i = 0; i < str.length; ++i){ item = str[i].split("="); if(item[0] != ''){ arr[item[0]] = typeof(item[1]) == 'undefined' ? true : dec(item[1]); } } return arr; } function inspect(dict) { var str = ''; for (var key in dict){ str += key + "=" + dict[key] + "\n"; } alert(str); } function randomPM() { return Math.random() * 2 - 1; } function color(r, g, b) { var f = function(g) { return ('0' + Math.floor(g()).toString(16)).slice(-2); }; return "#" + f(r) + f(g) + f(b); } function whitish() { return Math.random() * 64 + 192; } function light() { return Math.random() * 128 + 128; } function middle() { return Math.random() * 128 + 64; } function dark() { return Math.random() * 128 ; } function blackish() { return Math.random() * 64 ; } function updateShape(evt) { evt.body.shape.x = evt.body.GetPosition().x * ppm; evt.body.shape.y = evt.body.GetPosition().y * ppm; evt.body.shape.rotation = evt.body.GetAngle() * 360.0 / (2.0 * Math.PI) } function smooth(times, interval, func) { var i = interval; var j = times; var tick = function() { if (0 < i) { --i; } else { i = interval; if (0 < j) { --j; func(); } else { createjs.Ticker.removeEventListener("tick", tick); } } } createjs.Ticker.addEventListener("tick", tick); }
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M10 6.35V4.26c-.66.17-1.29.43-1.88.75l1.5 1.5c.13-.05.25-.11.38-.16zM20 12c0-2.21-.91-4.2-2.36-5.64L20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 .85-.19 1.65-.51 2.38l1.5 1.5C19.63 14.74 20 13.41 20 12zM4.27 4L2.86 5.41l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.24-.76.34v2.09c.8-.21 1.55-.54 2.23-.96l2.58 2.58 1.41-1.41L4.27 4z" /> , 'SyncDisabledTwoTone');
import {ColumnView} from '../scene/view'; import {ColumnModel} from './column.model'; import {TemplatePath} from '../template'; TemplatePath.register('row-number-cell', (template, column) => { return { model: template.for, resource: column.key }; }); export class RowNumberColumnModel extends ColumnModel { constructor() { super('row-number'); this.pin = 'left'; this.key = '$row.number'; this.title = 'No.'; this.canEdit = false; this.canResize = true; this.canFocus = false; this.canMove = false; this.canHighlight = false; this.canSort = false; this.canFilter = false; this.class = 'control'; } } export class RowNumberColumn extends ColumnView { constructor(model) { super(model); } static model(model) { return model ? RowNumberColumn.assign(model) : new RowNumberColumnModel(); } }
$(function (){ location.hash = "#welcome.html"; loader("welcome.html"); }); var loader = function (s) { // load content from server $.get(s, function (data){ var result = $(data); $("#content").html(result); // send event to Google Analytics ga('send', 'event', 'content', 'load', s); // process math MathJax.Hub.Queue(["Typeset", MathJax.Hub, "content"]); }); } window.onhashchange = function () { console.log(location.hash); loader(location.hash.substring(1)); }
(function() { 'use strict'; angular.module('civic.events.evidence') .config(evidenceEditConfig) .factory('EvidenceEditViewOptions', EvidenceEditViewOptions) .controller('EvidenceEditController', EvidenceEditController); // @ngInject function evidenceEditConfig($stateProvider) { $stateProvider .state('events.genes.summary.variants.summary.evidence.edit', { abstract: true, url: '/edit', templateUrl: 'app/views/events/evidence/edit/EvidenceEditView.tpl.html', controller: 'EvidenceEditController', controllerAs: 'vm', resolve: { EvidenceRevisions: 'EvidenceRevisions', initEvidenceEdit: function(Evidence, EvidenceRevisions, EvidenceHistory, $stateParams, $q) { var evidenceId = $stateParams.evidenceId; return $q.all([ EvidenceRevisions.initRevisions(evidenceId), EvidenceRevisions.getPendingFields(evidenceId), EvidenceHistory.initBase(evidenceId) ]); } }, deepStateRedirect: [ 'evidenceId' ], data: { titleExp: '"Evidence " + evidence.name + " Edit"', navMode: 'sub' } }) .state('events.genes.summary.variants.summary.evidence.edit.basic', { url: '/basic', template: '<evidence-edit-basic></evidence-edit-basic>', data: { titleExp: '"Evidence " + evidence.name + " Edit"', navMode: 'sub' } }); } // @ngInject function EvidenceEditViewOptions($state, $stateParams) { var baseUrl = ''; var baseState = ''; var styles = {}; function init() { baseState = 'events.genes.summary.evidence.edit'; baseUrl = $state.href(baseUrl, $stateParams); angular.copy({ view: { summaryBackgroundColor: 'pageBackground2', editBackgroundColor: 'pageBackground', talkBackgroundColor: 'pageBackground' }, tabs: { tabRowBackground: 'pageBackground2Gradient' } }, styles); } return { init: init, state: { baseParams: $stateParams, baseState: baseState, baseUrl: baseUrl }, styles: styles }; } // @ngInject function EvidenceEditController(Evidence, EvidenceRevisions, EvidenceEditViewOptions) { console.log('EvidenceEditController called.'); EvidenceEditViewOptions.init(); this.EvidenceEditViewModel = Evidence; // we're re-using the Evidence model here but could in the future have a EvidenceEdit model if warranted this.EvidenceRevisionsModel = EvidenceRevisions; this.EvidenceEditViewOptions = EvidenceEditViewOptions; } })();
'use strict'; const applySourceMap = require('vinyl-sourcemaps-apply'); const CleanCSS = require('clean-css'); const path = require('path'); const PluginError = require('gulp-util').PluginError; const through = require('through2'); module.exports = function gulpCleanCSS(options, callback) { options = options || {}; if (arguments.length === 1 && Object.prototype.toString.call(arguments[0]) === '[object Function]') callback = arguments[0]; let transform = function (file, enc, cb) { if (!file || !file.contents) return cb(null, file); if (file.isStream()) { this.emit('error', new PluginError('gulp-clean-css', 'Streaming not supported!')); return cb(null, file); } if (file.sourceMap) options.sourceMap = JSON.parse(JSON.stringify(file.sourceMap)); if(!options.rebaseTo) options.rebase = false; let style = { [file.path]: { styles: file.contents ? file.contents.toString() : '' } }; new CleanCSS(options).minify(style, function (errors, css) { if (errors) return cb(errors.join(' ')); if (typeof callback === 'function') { let details = { 'stats': css.stats, 'errors': css.errors, 'warnings': css.warnings, 'path': file.path, 'name': file.path.split(file.base)[1] }; if (css.sourceMap) details['sourceMap'] = css.sourceMap; callback(details); } file.contents = new Buffer(css.styles); if (css.sourceMap) { let map = JSON.parse(css.sourceMap); map.file = path.relative(file.base, file.path); map.sources = map.sources.map(function (src) { return path.relative(file.base, file.path) }); applySourceMap(file, map); } cb(null, file); }); }; return through.obj(transform); };
var anchor; while (anchor = schema.nextAnchor()) { if(anchor.hasMoreAttributes()) { // only do perspectives if there are attributes var knot, attribute; /*~ -- Point-in-time perspective ------------------------------------------------------------------------------------------ -- p$anchor.name viewed as it was on the given timepoint ----------------------------------------------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION $anchor.capsule\.p$anchor.name ( changingTimepoint $schema.metadata.chronon ) RETURNS TABLE ( $anchor.identityColumnName $anchor.identity, $(schema.METADATA)? $anchor.metadataColumnName $schema.metadata.metadataType,~*/ while (attribute = anchor.nextAttribute()) { /*~ $(schema.IMPROVED)? $attribute.anchorReferenceName $anchor.identity, $(schema.METADATA)? $attribute.metadataColumnName $schema.metadata.metadataType, $(attribute.timeRange)? $attribute.changingColumnName $attribute.timeRange, $(attribute.isEquivalent())? $attribute.equivalentColumnName $schema.metadata.equivalentRange, ~*/ if(attribute.isKnotted()) { knot = attribute.knot; /*~ $(knot.hasChecksum())? $attribute.knotChecksumColumnName bytea, $(knot.isEquivalent())? $attribute.knotEquivalentColumnName $schema.metadata.equivalentRange, $attribute.knotValueColumnName $knot.dataRange, $(schema.METADATA)? $attribute.knotMetadataColumnName $schema.metadata.metadataType, ~*/ } /*~ $(attribute.hasChecksum())? $attribute.checksumColumnName bytea, $attribute.valueColumnName $(attribute.isKnotted())? $knot.identity: $attribute.dataRange~*/ /*~$(anchor.hasMoreAttributes())?, ~*/ } /*~ ) AS ' SELECT $anchor.mnemonic\.$anchor.identityColumnName, $(schema.METADATA)? $anchor.mnemonic\.$anchor.metadataColumnName, ~*/ while (attribute = anchor.nextAttribute()) { /*~ $(schema.IMPROVED)? $attribute.mnemonic\.$attribute.anchorReferenceName, $(schema.METADATA)? $attribute.mnemonic\.$attribute.metadataColumnName, $(attribute.timeRange)? $attribute.mnemonic\.$attribute.changingColumnName, $(attribute.isEquivalent())? $attribute.mnemonic\.$attribute.equivalentColumnName, ~*/ if(attribute.isKnotted()) { knot = attribute.knot; /*~ $(knot.hasChecksum())? k$attribute.mnemonic\.$knot.checksumColumnName AS $attribute.knotChecksumColumnName, $(knot.isEquivalent())? k$attribute.mnemonic\.$knot.equivalentColumnName AS $attribute.knotEquivalentColumnName, k$attribute.mnemonic\.$knot.valueColumnName AS $attribute.knotValueColumnName, $(schema.METADATA)? k$attribute.mnemonic\.$knot.metadataColumnName AS $attribute.knotMetadataColumnName, ~*/ } /*~ $(attribute.hasChecksum())? $attribute.mnemonic\.$attribute.checksumColumnName, $attribute.mnemonic\.$attribute.valueColumnName$(anchor.hasMoreAttributes())?, ~*/ } /*~ FROM $anchor.capsule\.$anchor.name $anchor.mnemonic ~*/ while (attribute = anchor.nextAttribute()) { if(attribute.isHistorized()) { if(attribute.isEquivalent()) { /*~ LEFT JOIN $attribute.capsule\.r$attribute.name(0, CAST(changingTimepoint AS $attribute.timeRange)) $attribute.mnemonic ~*/ } else { /*~ LEFT JOIN $attribute.capsule\.r$attribute.name(CAST(changingTimepoint AS $attribute.timeRange)) $attribute.mnemonic ~*/ } /*~ ON $attribute.mnemonic\.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName AND $attribute.mnemonic\.$attribute.changingColumnName = ( SELECT max(sub.$attribute.changingColumnName) FROM $(attribute.isEquivalent())? $attribute.capsule\.r$attribute.name(0, CAST(changingTimepoint AS $attribute.timeRange)) sub : $attribute.capsule\.r$attribute.name(CAST(changingTimepoint AS $attribute.timeRange)) sub WHERE sub.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName )~*/ } else { if(attribute.isEquivalent()) { /*~ LEFT JOIN $attribute.capsule\.e$attribute.name(0) $attribute.mnemonic ~*/ } else { /*~ LEFT JOIN $attribute.capsule\.$attribute.name $attribute.mnemonic ~*/ } /*~ ON $attribute.mnemonic\.$attribute.anchorReferenceName = $anchor.mnemonic\.$anchor.identityColumnName~*/ } if(attribute.isKnotted()) { knot = attribute.knot; if(knot.isEquivalent()) { /*~ LEFT JOIN $knot.capsule\.e$knot.name(0) k$attribute.mnemonic ~*/ } else { /*~ LEFT JOIN $knot.capsule\.$knot.name k$attribute.mnemonic ~*/ } /*~ ON k$attribute.mnemonic\.$knot.identityColumnName = $attribute.mnemonic\.$attribute.knotReferenceName~*/ } if(!anchor.hasMoreAttributes()) { /*~;~*/ } } /*~ ' LANGUAGE SQL;~*/ } }
'use strict'; // Use local.env.js for environment variables that grunt will set when the server starts locally. // Use for your api keys, secrets, etc. This file should not be tracked by git. // // You will need to set these on the server you deploy to. module.exports = { DOMAIN: 'http://localhost:9000', SESSION_SECRET: "jogging-secret", FACEBOOK_ID: 'app-id', FACEBOOK_SECRET: 'secret', TWITTER_ID: 'app-id', TWITTER_SECRET: 'secret', GOOGLE_ID: 'app-id', GOOGLE_SECRET: 'secret', // Control debug level for modules using visionmedia/debug DEBUG: '' };
"use strict"; module.exports = MapField; // extends Field var Field = require("./field"); ((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; var types = require("./types"), util = require("./util"); /** * Constructs a new map field instance. * @classdesc Reflected map field. * @extends FieldBase * @constructor * @param {string} name Unique name within its namespace * @param {number} id Unique id within its namespace * @param {string} keyType Key type * @param {string} type Value type * @param {Object.<string,*>} [options] Declared options */ function MapField(name, id, keyType, type, options) { Field.call(this, name, id, type, options); /* istanbul ignore if */ if (!util.isString(keyType)) throw TypeError("keyType must be a string"); /** * Key type. * @type {string} */ this.keyType = keyType; // toJSON, marker /** * Resolved key type if not a basic type. * @type {ReflectionObject|null} */ this.resolvedKeyType = null; // Overrides Field#map this.map = true; } /** * Map field descriptor. * @interface IMapField * @extends {IField} * @property {string} keyType Key type */ /** * Extension map field descriptor. * @interface IExtensionMapField * @extends IMapField * @property {string} extend Extended type */ /** * Constructs a map field from a map field descriptor. * @param {string} name Field name * @param {IMapField} json Map field descriptor * @returns {MapField} Created map field * @throws {TypeError} If arguments are invalid */ MapField.fromJSON = function fromJSON(name, json) { return new MapField(name, json.id, json.keyType, json.type, json.options); }; /** * Converts this map field to a map field descriptor. * @returns {IMapField} Map field descriptor */ MapField.prototype.toJSON = function toJSON() { return util.toObject([ "keyType" , this.keyType, "type" , this.type, "id" , this.id, "extend" , this.extend, "options" , this.options ]); }; /** * @override */ MapField.prototype.resolve = function resolve() { if (this.resolved) return this; // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" if (types.mapKey[this.keyType] === undefined) throw Error("invalid key type: " + this.keyType); return Field.prototype.resolve.call(this); }; /** * Map field decorator (TypeScript). * @name MapField.d * @function * @param {number} fieldId Field id * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type * @returns {FieldDecorator} Decorator function * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } */ MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { // submessage value: decorate the submessage and use its name as the type if (typeof fieldValueType === "function") fieldValueType = util.decorateType(fieldValueType).name; // enum reference value: create a reflected copy of the enum and keep reuseing it else if (fieldValueType && typeof fieldValueType === "object") fieldValueType = util.decorateEnum(fieldValueType).name; return function mapFieldDecorator(prototype, fieldName) { util.decorateType(prototype.constructor) .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); }; };
/** Represents a bullet bill enemy. Code by Rob Kleffner, 2011 */ Mario.BulletBill = function(world, x, y, dir) { this.Image = Enjine.Resources.Images["enemies"]; this.World = world; this.X = x; this.Y = y; this.Facing = dir; this.XPicO = 8; this.YPicO = 31; this.Height = 12; this.Width = 4; this.PicWidth = 16; this.YPic = 5; this.XPic = 0; this.Ya = -5; this.DeadTime = 0; this.Dead = false; this.Anim = 0; }; Mario.BulletBill.prototype = new Mario.NotchSprite(); Mario.BulletBill.prototype.CollideCheck = function() { if (this.Dead) { return; } var xMarioD = Mario.MarioCharacter.X - this.X, yMarioD = Mario.MarioCharacter.Y - this.Y; if (xMarioD > -16 && xMarioD < 16) { if (yMarioD > -this.Height && yMarioD < this.World.Mario.Height) { if (Mario.MarioCharacter.Y > 0 && yMarioD <= 0 && (!Mario.MarioCharacter.OnGround || !Mario.MarioCharacter.WasOnGround)) { Mario.MarioCharacter.Stomp(this); this.Dead = true; this.Xa = 0; this.Ya = 1; this.DeadTime = 100; } else { Mario.MarioCharacter.GetHurt(); } } } }; Mario.BulletBill.prototype.Move = function() { var i = 0, sideWaysSpeed = 4; if (this.DeadTime > 0) { this.DeadTime--; if (this.DeadTime === 0) { this.DeadTime = 1; for (i = 0; i < 8; i++) { this.World.AddSprite(new Mario.Sparkle(((this.X + Math.random() * 16 - 8) | 0) + 4, ((this.Y + Math.random() * 8) | 0) + 4, Math.random() * 2 - 1, Math.random() * -1, 0, 1, 5)); } this.World.RemoveSprite(this); } this.X += this.Xa; this.Y += this.Ya; this.Ya *= 0.95; this.Ya += 1; return; } this.Xa = this.Facing * sideWaysSpeed; this.XFlip = this.Facing === -1; this.Move(this.Xa, 0); }; Mario.BulletBill.prototype.SubMove = function(xa, ya) { this.X += xa; return true; }; Mario.BulletBill.prototype.FireballCollideCheck = function(fireball) { if (this.DeadTime !== 0) { return false; } var xD = fireball.X - this.X, yD = fireball.Y - this.Y; if (xD > -16 && xD < 16) { if (yD > -this.Height && yD < fireball.Height) { return true; } } return false; }; Mario.BulletBill.prototype.ShellCollideCheck = function(shell) { if (this.DeadTime !== 0) { return false; } var xD = shell.X - this.X, yD = shell.Y - this.Y; if (xD > -16 && xD < 16) { if (yD > -this.Height && yD < shell.Height) { Enjine.Resources.PlaySound("kick"); this.Dead = true; this.Xa = 0; this.Ya = 1; this.DeadTime = 100; return true; } } return false; };
'use strict'; var assert = require('assert'); it('throws after timeout', function (done) { setTimeout(function () { throw new Error('Exception in delayed function'); }, 10); });
/* * mocaccino.js * * Copyright (c) 2014 Maximilian Antoni <mail@maxantoni.de> * * @license MIT */ /*globals describe, it*/ 'use strict'; describe('cover', function () { function called() { return 42; } function test(a) { return a || called(); } it('yields', function (done) { setTimeout(done, 50); }); it('passes', function () { test(false); }); });
var _curry2 = require('./internal/_curry2'); var _map = require('./internal/_map'); var curryN = require('./curryN'); var pluck = require('./pluck'); /** * Accepts a converging function and a list of branching functions and returns a new function. * When invoked, this new function is applied to some arguments, each branching * function is applied to those same arguments. The results of each branching * function are passed as arguments to the converging function to produce the return value. * * @func * @memberOf R * @since v0.4.2 * @category Function * @sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z) * @param {Function} after A function. `after` will be invoked with the return values of * `fn1` and `fn2` as its arguments. * @param {Array} functions A list of functions. * @return {Function} A new function. * @example * * var add = (a, b) => a + b; * var multiply = (a, b) => a * b; * var subtract = (a, b) => a - b; * * //≅ multiply( add(1, 2), subtract(1, 2) ); * R.converge(multiply, [add, subtract])(1, 2); //=> -3 * * var add3 = (a, b, c) => a + b + c; * R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4 */ module.exports = _curry2(function converge(after, fns) { return curryN(Math.max.apply(Math, pluck('length', fns)), function() { var args = arguments; var context = this; return after.apply(context, _map(function(fn) { return fn.apply(context, args); }, fns)); }); });
import { MISC_SELECTEDPLAYLIST_SET, MISC_SELECTEDPLAYLIST_CLEAR, MISC_SONGNAVSELECTION_SET, } from '../constants'; export function setActivePlaylist(playlistId) { return { type: MISC_SELECTEDPLAYLIST_SET, payload: { playlistId }, }; } export function clearActivePlaylist() { return { type: MISC_SELECTEDPLAYLIST_CLEAR, }; } export function setSongNavSelectionType(songNavSelection) { return { type: MISC_SONGNAVSELECTION_SET, payload: { songNavSelection, }, }; }
angular.module('dialogDemo1', ['ngMaterial']) .controller('AppCtrl', function($scope, $mdDialog) { $scope.alert = ''; $scope.showAlert = function(ev) { // Appending dialog to document.body to cover sidenav in docs app // Modal dialogs should fully cover application // to prevent interaction outside of dialog $mdDialog.show( $mdDialog.alert() .parent(angular.element(document.body)) .clickOutsideToClose(true) .title('This is an alert title') .content('You can specify some description text in here.') .ariaLabel('Alert Dialog Demo') .ok('Got it!') .targetEvent(ev) ); }; $scope.showConfirm = function(ev) { // Appending dialog to document.body to cover sidenav in docs app var confirm = $mdDialog.confirm() .parent(angular.element(document.body)) .title('Would you like to delete your debt?') .content('All of the banks have agreed to forgive you your debts.') .ariaLabel('Lucky day') .ok('Please do it!') .cancel('Sounds like a scam') .targetEvent(ev); $mdDialog.show(confirm).then(function() { $scope.alert = 'You decided to get rid of your debt.'; }, function() { $scope.alert = 'You decided to keep your debt.'; }); }; $scope.showAdvanced = function(ev) { $mdDialog.show({ controller: DialogController, templateUrl: 'dialog1.tmpl.html', parent: angular.element(document.body), targetEvent: ev, }) .then(function(answer) { $scope.alert = 'You said the information was "' + answer + '".'; }, function() { $scope.alert = 'You cancelled the dialog.'; }); }; }); function DialogController($scope, $mdDialog) { $scope.hide = function() { $mdDialog.hide(); }; $scope.cancel = function() { $mdDialog.cancel(); }; $scope.answer = function(answer) { $mdDialog.hide(answer); }; }
import Route from '@ember/routing/route'; export default class Index extends Route { async model() { return await this.modelFor('blog'); } resetController(controller, isExiting, transition) { if (isExiting && transition.targetName !== 'error') { controller.set('page', 1); } } }
/* global describe, it */ var assert = require('assert'); var jsdom = require('mocha-jsdom'); var React = require('react/addons'); var TestUtils = React.addons.TestUtils; var stubContext = require('react-stub-context'); var Three = require('../src/Three'); describe('Three', function () { jsdom(); var levels, content, render; it('renders one level deep', function () { render = TestUtils.renderIntoDocument( React.createElement(Three) ); levels = TestUtils.scryRenderedDOMComponentsWithTag(render, 'div'); assert.equal(levels.length, 1); }); describe('without context', function () { it('renders nothing without context from parents at one level deep', function () { render = TestUtils.renderIntoDocument( React.createElement(Three) ); content = render.getDOMNode().textContent; assert.notEqual(content.indexOf('Three (, )'), -1); }); }); describe('with context', function () { it('renders context from parents at one level deep', function () { Three = stubContext(Three, { a: 'Aye', b: 'Bee' }); render = TestUtils.renderIntoDocument( React.createElement(Three) ); content = render.getDOMNode().textContent; assert.notEqual(content.indexOf('Three (Aye, Bee)'), -1); }); }); });
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./app.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./app.ts": /*!****************!*\ !*** ./app.ts ***! \****************/ /*! no static exports found */ /***/ (function(module, exports) { eval("throw new Error(\"Module parse failed: Unexpected token (2:1)/nYou may need an appropriate loader to handle this file type./n| var a;/n| == 0;/n| \");\n\n//# sourceURL=webpack:///./app.ts?"); /***/ }) /******/ });
var searchData= [ ['addra',['addrA',['../a00028.html#a3cae9d5d9bef65c080151c7a068aba59',1,'ip_addr']]], ['addrb',['addrB',['../a00028.html#affc4950defbac0add14648c302d1cca3',1,'ip_addr']]], ['addrc',['addrC',['../a00028.html#a2965c835c1e5f0a593e0ce78a9e22596',1,'ip_addr']]], ['addrd',['addrD',['../a00028.html#a46e67573cf0c4c6cc8fcaf4573a441c5',1,'ip_addr']]], ['adv',['adv',['../a00043.html#aa0b33ec0b236628dd65628a7aa238b03',1,'utils_temperature']]], ['aitc',['aitc',['../a00046.html#a4ef06d5c9fc774f79cf065ec4d971518',1,'aitc.c']]], ['all_5fships',['all_ships',['../a00101.html#af4ba9abb0410a1ddc659f565de7a0e00',1,'model_battleship.c']]], ['apprunning',['appRunning',['../a00099.html#a2c9ae8a4de631e631a531446605ee47d',1,'model.c']]], ['apptext',['appText',['../a00099.html#acb5bd952a87114eb0c59dcba58e5f782',1,'model.c']]], ['arpcache',['arpcache',['../a00108.html#a7489612cbdbbec7ea6dc20811cafd90f',1,'network.h']]] ];
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("widget","en-gb",{move:"Click and drag to move"});
import { initialize } from 'ember-off-canvas-components/initializers/custom-events'; export default { name: 'eoc-custom-events', initialize: initialize };
import React, { PropTypes, Component } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router'; import NoteAdd from 'material-ui/svg-icons/action/note-add'; import Delete from 'material-ui/svg-icons/action/delete'; import IconMenu from 'material-ui/IconMenu'; import ShowChart from 'material-ui/svg-icons/editor/show-chart'; import MenuItem from 'material-ui/MenuItem'; import History from 'material-ui/svg-icons/action/history'; import IconButtonElement from 'components/utils/IconButtonElement'; import { openKeyDialog, openConfirmDeleteNamespaceDialog } from 'actions/dialogActions'; const anchorOrigin = { vertical: 'bottom', horizontal: 'left', }; const targetOrigin = { vertical: 'top', horizontal: 'left', }; export class NamespaceItemMenu extends Component { createKey(name) { this.props.newKey(name); } deleteNamespace(name) { this.props.deleteNamespace(name); } render() { const { name, ...props } = this.props; return ( <IconMenu disableAutoFocus iconButtonElement={ <IconButtonElement /> } anchorOrigin={ anchorOrigin } targetOrigin={ targetOrigin } {...props} > <MenuItem leftIcon={<NoteAdd />} onTouchTap={ this.createKey.bind(this, name) }> New key </MenuItem> <MenuItem leftIcon={<ShowChart />} containerElement={<Link to={`/stats/${name}`} />}> Statistics </MenuItem> <MenuItem containerElement={<Link to={`/history/${name}`} />} leftIcon={<History />}> History </MenuItem> <MenuItem leftIcon={<Delete />} onTouchTap={ this.deleteNamespace.bind(this, name) }> Delete </MenuItem> </IconMenu> ); } } NamespaceItemMenu.propTypes = { name: PropTypes.string, deleteNamespace: PropTypes.func, newKey: PropTypes.func, }; const mapDispatchToProps = (dispatch) => ({ deleteNamespace(namespace) { dispatch(openConfirmDeleteNamespaceDialog({ namespace })); }, newKey(namespace) { dispatch(openKeyDialog({ namespace })); }, }); export default connect( null, mapDispatchToProps )(NamespaceItemMenu);
const ClientCommand = require('./_base-command.js'); /** * Maximizes the current window. * * @example * this.demoTest = function (browser) { * browser.maximizeWindow(); * }; * * * @method maximizeWindow * @param {function} [callback] Optional callback function to be called when the command finishes. * @see windowMaximize * @api protocol.contexts */ class WindowMaximize extends ClientCommand { performAction(callback) { this.api.windowMaximize('current', callback); } } module.exports = WindowMaximize;
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var IoIonic = function IoIonic(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm32.9 10.4c1.9 2.6 3.1 6 3.1 9.6 0 9-7.3 16.3-16.2 16.3s-16.3-7.3-16.3-16.3 7.3-16.2 16.3-16.2c3.5 0 6.9 1.1 9.6 3.1 0.4-0.3 0.8-0.4 1.4-0.4 1.4 0 2.5 1.1 2.5 2.5 0 0.5-0.2 1-0.4 1.4z m-2.5 20.2c1.4-1.4 2.4-2.9 3.2-4.7 0.8-1.9 1.2-3.9 1.2-5.9s-0.4-4-1.2-5.9c-0.5-1-1-2-1.7-2.9-0.3 0.1-0.7 0.3-1.1 0.3-1.4 0-2.5-1.1-2.5-2.5 0-0.4 0.1-0.9 0.3-1.2-1-0.6-2-1.2-3-1.6-1.9-0.8-3.8-1.2-5.8-1.2s-4 0.4-5.9 1.2c-1.8 0.8-3.4 1.8-4.8 3.2s-2.4 2.9-3.2 4.7c-0.8 1.9-1.1 3.9-1.1 5.9s0.3 4 1.1 5.9c0.8 1.8 1.8 3.3 3.2 4.7s3 2.4 4.8 3.2c1.9 0.8 3.8 1.2 5.9 1.2s3.9-0.4 5.8-1.2c1.8-0.8 3.4-1.8 4.8-3.2z m-18.1-10.6c0-5 2.5-7.5 7.5-7.5s7.5 2.5 7.5 7.5-2.5 7.5-7.5 7.5-7.5-2.5-7.5-7.5z' }) ) ); }; exports.default = IoIonic; module.exports = exports['default'];
$(function () { if (!Modernizr.json) { alert('Navegador muy antiguo, por favor actualícelo'); window.location = "http://whatbrowser.org/" } });
var baseDifference = require('../internal/baseDifference'), baseFlatten = require('../internal/baseFlatten'), isArguments = require('../lang/isArguments'), isArray = require('../lang/isArray'), restParam = require('../function/restParam'); /** * Creates an array excluding all values of the provided arrays using * `SameValueZero` for equality comparisons. * * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * comparisons are like strict equality comparisons, e.g. `===`, except that * `NaN` matches `NaN`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The arrays of values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.difference([1, 2, 3], [4, 2]); * // => [1, 3] */ var difference = restParam(function(array, values) { return (isArray(array) || isArguments(array)) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); module.exports = difference;
// class HandleDeleteApplication { // constructor() { // this.ui = {}; // // this.applications_page = $('div#third_party_applications_page'); // // //Delete aplication modal // this.modal_delete_application = $('div#delete_application_modal'); // this.button_delete_application = $( // 'button#delete_application', // this.applications_page // ); // this.form_delete_application = $( // 'form#delete_application_form', // this.modal_delete_application // ); // } // }
var block = { "tags":["video-tag"], "videos":["https:\/\/www.youtube.com\/v\/YigKNDHhjTA?version=3&f=videos&app=youtube_gdata"], "liked":false, "notebooks":["47307eb6-cd32-4544-9677-1ba276b54dd3"], "image":"https:\/\/i1.ytimg.com\/vi\/YigKNDHhjTA\/0.jpg", "type":"Video", "url":"https:\/\/www.youtube.com\/watch?v=YigKNDHhjTA&feature=youtube_gdata_player", "modified":"2014-05-19T14:08:05+0000", "created":"2014-05-19T14:07:57+0000", "complete":false, "description":"FREE Download: http:\/\/www.mediafire.com\/?oj4x2qokmsner8u\n\nCover \/ Remix of \"All of the Lights\" (originally by Kanye West) performed by The Northern Lights. The Northern Lights is: Kyle Lampert, producer; Riki Lavi, vocalist; and MCs Jahizzi and Sheck, also of Divine Rhyme.\n\nOur 2010 album on iTunes:\nhttp:\/\/itunes.apple.com\/us\/album\/journey-through-your-minds\/id353700260\n\nFree ALBUM downloads from The Northern Lights and Divine Rhyme available at\nhttp:\/\/www.TheNorthernLights.bandcamp.com\nhttp:\/\/www.DivineRhyme.bandcamp.com\n\nFollow us on Facebook: http:\/\/www.facebook.com\/TNLexperience", "name":"All of the Lights - kanye west cover (by The Northern Lights)", "uuid":"473d3867-e3b6-4fc4-8f51-fa27aab65c28", "rating":0.0, "public":true, "comments":[ { "commenter":"klmprt", "date":"2014-05-19T14:07:58+0000", "comment":"VIdeo comment" }] };
$(document).ready(function() { //WAYPOINT - JQUERY COUNTTO PROGRESS BAR// $('#count-wrapper').waypoint(function() { $('.title-count').countTo(); }, { offset: '80%', triggerOnce: true }); // MIXITUP PORTFOLIO $(function() { $('#container-mixitup').mixItUp(); }); // MAGNIFIC POPUP $('#container-mixitup').magnificPopup({ delegate: 'a', // child items selector, by clicking on it popup will open type: 'image' // other options }); //GOOGLE MAPS // var myLatlng = new google.maps.LatLng(40.6700, -73.9400); var mapOptions = { zoom: 11, scrollwheel: false, center: myLatlng, styles: [{ featureType: "landscape", stylers: [{ saturation: -100 }, { lightness: 65 }, { visibility: "on" }] }, { featureType: "poi", stylers: [{ saturation: -100 }, { lightness: 51 }, { visibility: "simplified" }] }, { featureType: "road.highway", stylers: [{ saturation: -100 }, { visibility: "simplified" }] }, { featureType: "road.arterial", stylers: [{ saturation: -100 }, { lightness: 30 }, { visibility: "on" }] }, { featureType: "road.local", stylers: [{ saturation: -100 }, { lightness: 40 }, { visibility: "on" }] }, { featureType: "transit", stylers: [{ saturation: -100 }, { visibility: "simplified" }] }, { featureType: "administrative.province", stylers: [{ visibility: "off" }] /**/ }, { featureType: "administrative.locality", stylers: [{ visibility: "off" }] }, { featureType: "administrative.neighborhood", stylers: [{ visibility: "on" }] /**/ }, { featureType: "water", elementType: "labels", stylers: [{ visibility: "on" }, { lightness: -25 }, { saturation: -100 }] }, { featureType: "water", elementType: "geometry", stylers: [{ hue: "#ffff00" }, { lightness: -25 }, { saturation: -97 }] }] }; var map = new google.maps.Map(document.getElementById("map"), mapOptions); // To add the marker to the map, use the 'map' property var marker = new google.maps.Marker({ position: myLatlng, map: map, title: "Hello World!" }); // Clients Slider $("#owl-clients").owlCarousel({ autoPlay: 4500, items: 4, pagination: false, itemsCustom: [ [0, 3], [450, 4] ] }); // validate contact form $(function() { $('#contact').validate({ rules: { name: { required: true, minlength: 2 }, email: { required: true, email: true }, message: { required: true } }, messages: { name: { required: "Please enter your name", minlength: "your name must consist of at least 2 characters" }, email: { required: "Please enter your email address" }, message: { required: "Please enter your message", minlength: "thats all? really?" } }, submitHandler: function(form) { $(form).ajaxSubmit({ type:"POST", data: $(form).serialize(), url:"contact.php", success: function() { $('#contact').css( "display", 'none'); $('#contact :input').attr('disabled', 'disabled'); $('#success').fadeIn(); }, error: function() { $('#contact').css( "display", 'none'); $('#contact :input').attr('disabled', 'disabled'); $('#error').fadeIn(); } }); } }); }); $(function () { $('[data-toggle="tooltip"]').tooltip(); }); });
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S12.14_A10_T1; * @section: 12.14; * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; * @description: Throwing exception while executing iteration statement placed into try Block; */ // CHECK#1 var i=0; try{ while(i<10){ if(i===5) throw i; i++; } } catch(e){ if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); }
'use strict'; var chai = require('chai'), chaiAsPromised = require('chai-as-promised'); if (!global.Promise) { global.Promise = require('promise-polyfill'); } chai.use(chaiAsPromised); chai.should(); var async = require('../../lib/async-as-promised'); describe('aplus', function () { describe('setPromise()', function () { afterEach(function () { async.resetPromise(); }); it('should set async.Promise', function () { var value = Math.random(); async.setPromise(value); async.Promise.should.equal(value); }); }); describe('resetPromise()', function () { afterEach(function () { async.resetPromise(); }); it('should restore async.Promise', function () { var value = async.Promise; async.Promise = Math.random(); async.resetPromise(); async.Promise.should.equal(value); }); }); }); describe('async.constant()', function () { it('should return a Promise', function () { async.constant(5).should.be.an.instanceOf(Promise); }); it('should resolve to provided value', function () { return async.constant(5).should.eventually.equal(5); }); }); describe('async.fail()', function () { it('should return a Promise', function () { async.fail('boo!').should.be.an.instanceOf(Promise); }); it('should resolve to provided value', function () { return async.fail('boo!').should.eventually.be.rejectedWith('boo!'); }); }); describe('async.delay()', function () { it('should alias async.later to async.delay', function () { async.later.should.equal(async.delay); }); it('should return a promise', function () { async.delay(1).should.be.an.instanceOf(Promise); }); it('should resolve after delay', function () { var now = Date.now(); return async.delay(500).then(function () { (Date.now() - now).should.be.at.least(499); }); }); it('should resolve using default delay if not specified', function () { var now = Date.now(); return async.delay().then(function () { (Date.now() - now).should.be.at.least(99); }); }); it('should resolve using default delay when no parameters specified', function () { var now = Date.now(); return async.delay().then(function () { (Date.now() - now).should.be.at.least(99); }); }); it('should resolve to `undefined` when no parameters specified', function () { return async.delay().then(function (value) { chai.expect(value).to.equal(undefined); }); }); it('should resolve using default delay when only value specified', function () { var now = Date.now(); return async.delay('hi!').then(function () { (Date.now() - now).should.be.at.least(99); }); }); it('should resolve to value when only value specified', function () { return async.delay('hi!').then(function (value) { value.should.equal('hi!'); }); }); it('should resolve using provided delay when delay and value specified', function () { var now = Date.now(); return async.delay(200, 'bye!').then(function () { (Date.now() - now).should.be.at.least(199); }); }); it('should resolve to value when delay and value specified', function () { return async.delay(50, 'bye').then(function (value) { value.should.equal('bye'); }); }); it('should throw exception when non number provided as delay and value is specified', function () { function test() { return async.delay('five seconds', 'hi!'); } chai.expect(test).to.throw(TypeError); }); it('should throw expected message for invalid delay', function () { function test() { return async.delay('five seconds', 'hi!'); } chai.expect(test).to.throw('parameter ms must be a number, string was provided instead'); }); });
'use strict'; var ssacl = require('../lib') , chai = require('chai') , expect = chai.expect , helper = require('./helper') , Sequelize = require('sequelize') , Promise = helper.Promise; Promise.longStackTraces(); chai.use(require('chai-as-promised')); describe('writer', function () { beforeEach(function () { this.Post = this.sequelize.define('Post', { title: { type: Sequelize.STRING }, userId: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 } }); this.User = this.sequelize.define('User', { }); return Promise.join( this.Post.sync({force: true}), this.User.sync({force: true}) ).bind(this).then(function () { return this.User.create(); }).then(function (user) { this.user = user; return this.Post.create({ title: 'Super Awesome Post', userId: this.user.get('id') }); }).then(function (post) { this.post = post; }); }); describe('Instance.update', function () { beforeEach(function () { ssacl(this.Post, { write: { attribute: 'userId' } }); }); it('should reject update without actor', function () { return expect(this.post.update({ title: 'Less Awesome Post' })).be.rejectedWith(ssacl.ParanoiaError); }); it('should reject update with wrong actor', function () { return expect(this.post.update({ title: 'Less Awesome Post' }, { actor: this.User.build({ id: this.user.get('id')+13 }) })).be.rejectedWith(ssacl.WrongActorError); }); it('should allow update when correct actor', function () { return this.post.update({ title: 'Super Duper Awesome Post' }, { actor: this.user }); }); it('should allow update when omnipotent actor', function () { return this.post.update({ title: 'Super Duper Awesome Post' }, { actor: new ssacl.Omnipotent() }); }); }); describe('Model.update', function () { beforeEach(function () { ssacl(this.Post, { write: { attribute: 'userId' } }); }); it('should reject update without actor', function () { return expect(this.Post.update({ title: 'Less Awesome Post' }, { where: {} })).be.rejectedWith(ssacl.ParanoiaError); }); it('should filter update to actor', function () { return this.Post.update({ title: 'Less Awesome Post', }, { where: {}, actor: this.User.build({ id: this.user.get('id')+13 }) }).bind(this).spread(function (affected) { expect(affected).to.equal(0); return this.Post.findAll({ paranoia: false }).then(function (posts) { expect(posts[0].get('title')).to.equal('Super Awesome Post'); }); }).then(function () { return this.Post.update({ title: 'Super Duper Awesome Post', }, { where: {}, actor: this.user }).bind(this).spread(function (affected) { expect(affected).to.equal(1); return this.Post.findAll({ paranoia: false }).then(function (posts) { expect(posts[0].get('title')).to.equal('Super Duper Awesome Post'); }); }); }); }); }); describe('Instance.destroy', function () { beforeEach(function () { ssacl(this.Post, { write: { attribute: 'userId' } }); }); it('should reject destroy without actor', function () { return expect(this.post.destroy()).be.rejectedWith(ssacl.ParanoiaError); }); it('should reject destroy with wrong actor', function () { return expect(this.post.destroy({ actor: this.User.build({ id: this.user.get('id')+13 }) })).be.rejectedWith(ssacl.WrongActorError); }); it('should allow destroy when correct actor', function () { return this.post.destroy({ actor: this.user }); }); it('should allow destroy when omnipotent actor', function () { return this.post.destroy({ actor: new ssacl.Omnipotent() }); }); }); describe('Model.destroy', function () { beforeEach(function () { ssacl(this.Post, { write: { attribute: 'userId' } }); }); it('should reject destroy without actor', function () { return expect(this.Post.destroy({ where: {} })).be.rejectedWith(ssacl.ParanoiaError); }); it('should filter destroy to actor', function () { return this.Post.destroy({ where: {}, actor: this.User.build({ id: this.user.get('id')+13 }) }).bind(this).then(function (affected) { expect(affected).to.equal(0); return this.Post.findAll({ paranoia: false }).then(function (posts) { expect(posts.length).to.equal(1); }); }).then(function () { return this.Post.destroy({ where: {}, actor: this.user }).bind(this).then(function (affected) { expect(affected).to.equal(1); return this.Post.findAll({ paranoia: false }).then(function (posts) { expect(posts.length).to.equal(0); }); }); }); }); }); });
/** * Custom error types to differentiate eBay response errors and client-level errors. * * @see http://developer.ebay.com/devzone/xml/docs/Reference/ebay/Errors/ErrorMessages.htm */ var inherits = require('util').inherits, _ = require('lodash'); function EbayClientError(message, extraProps) { Error.apply(this, arguments); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; this.message = message; _.defaults(this, extraProps); } inherits(EbayClientError, Error); function EbaySystemError(message, extraProps) { EbayClientError.apply(this, arguments); this.name = this.constructor.name; } inherits(EbaySystemError, EbayClientError); function EbayRequestError(message) { EbayClientError.apply(this, arguments); this.name = this.constructor.name; } inherits(EbayRequestError, EbayClientError); function EbayAuthenticationError(message) { EbayClientError.apply(this, arguments); this.name = this.constructor.name; } inherits(EbayAuthenticationError, EbayClientError); module.exports = { EbayClientError: EbayClientError, EbaySystemError: EbaySystemError, EbayRequestError: EbayRequestError, EbayAuthenticationError: EbayAuthenticationError, };
var util = require('util'); var wolfram = require('wolfram'); var BaseTrigger = require('./baseTrigger.js').BaseTrigger; /* Trigger that responds to messages using Wolfram Alpha. command = string - a message must start with this + a space before a response will be given appId = string - the app ID to use when creating a new client OR client = wolfram client - use this as the client if it is passed as an option */ var WolframAlphaTrigger = function() { WolframAlphaTrigger.super_.apply(this, arguments); }; util.inherits(WolframAlphaTrigger, BaseTrigger); var type = "WolframAlphaTrigger"; exports.triggerType = type; exports.create = function(name, chatBot, options) { var trigger = new WolframAlphaTrigger(type, name, chatBot, options); trigger.client = trigger.options.client || wolfram.createClient(trigger.options.appId); return trigger; }; // Return true if a message was sent WolframAlphaTrigger.prototype._respondToFriendMessage = function(userId, message) { return this._respond(userId, message); } // Return true if a message was sent WolframAlphaTrigger.prototype._respondToChatMessage = function(roomId, chatterId, message) { return this._respond(roomId, message); } WolframAlphaTrigger.prototype._respond = function(toId, message) { var question = this._stripCommand(message); if (question) { var that = this; this.client.query(question, function(err, result) { if (err) { that._sendMessageAfterDelay(toId, "¯\\_(ツ)_/¯"); return; } var bestResult = that._getBestResult(result); if (bestResult) { that._sendMessageAfterDelay(toId, bestResult); } else { that._sendMessageAfterDelay(toId, "¯\\_(ツ)_/¯"); } }); return true; } return false; } WolframAlphaTrigger.prototype._stripCommand = function(message) { if (this.options.command && message && message.toLowerCase().indexOf(this.options.command.toLowerCase() + " ") == 0) { return message.substring(this.options.command.length + 1); } return null; } WolframAlphaTrigger.prototype._getBestResult = function(results) { if (results) { // Look for primary result first for (var i=0; i < results.length; i++) { if (results[i].primary) { var text = _extractResult(results[i]); if (text) { return text; } } } // Otherwise just get the 2nd result (1st is the input interpretation) if (results.length > 1) { var text = _extractResult(results[1]); if (text) { return text; } } } return null; } var _extractResult = function(result) { if (result.subpods[0] && result.subpods[0].value) { return result.subpods[0].value; } else if (result.subpods[0] && result.subpods[0].image) { return result.subpods[0].image; } return null; }
define(function() { return { blank_function: function(){}, }; });
'use strict'; angular.module('nachosSettingsApp') .controller('Packages', function ($scope, $timeout, $state) { var packages = require('nachos-packages'); var _ = require('lodash'); $scope.types = packages.Packages.TYPES; $scope.view = function (item) { $state.go('main.package-settings', {item: item}) }; $scope.getItems = function (type) { return $scope[type]; }; packages.getAll(true) .then(function (packages) { $timeout(function () { var packageTypes = Object.keys(packages); packageTypes.forEach(function (type) { packages[type] = _.filter(packages[type], function (pkg) { return pkg.config.settings; }); }); _.merge($scope, packages); }); }); });
/* * JScript Render - Javascript renderization tools * http://www.pleets.org * Copyright 2014, Pleets Apps * Free to use under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Date: 2015-01-22 */ /* JScriptRender alias */ if (!window.hasOwnProperty('JScriptRender')) JScriptRender = {}; /* relative path to the element whose script is currently being processed.*/ if (typeof document.currentScript != "undefined" && document.currentScript != null) { var str = document.currentScript.src; JScriptRender.PATH = (str.lastIndexOf("/") == -1) ? "." : str.substring(0, str.lastIndexOf("/")); } else { /* alternative method to get the currentScript (older browsers) */ // ... /* else get the URL path */ JScriptRender.PATH = '.'; } JScriptRender.STATE = 'loading'; /* Standard class */ JScriptRender.StdClass = { include: function(url, ajax, callback) { callback = callback || new Function(); url = JScriptRender.PATH + '/' + url; if (typeof ajax == "undefined" || ajax == false) { var script = document.createElement("script"); script.src = url; script.type = 'text/javascript'; script.id = 'JScriptRender-module'; /* IE */ if (script.readyState) { script.onreadystatechange = function() { if (this.readyState == 'complete') { var scriptTag = document.querySelector('#' + script.id); scriptTag.parentNode.removeChild(scriptTag); callback(); } } } /* Others */ else { script.onload = function() { var scriptTag = document.querySelector('#' + script.id); scriptTag.parentNode.removeChild(scriptTag); callback(); } } var head = document.querySelector('head'); head.appendChild(script); } else { var xhr = new XMLHttpRequest(); // To prevent 412 (Precondition Failed) use GET method instead of POST // Set async to false to can use xhr.status after xhr.send() xhr.open("GET", url, false); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) eval(xhr.responseText); if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 404)) { callback(); } } xhr.send(); if (xhr.status == 404) return false; } return true; }, require: function(url, callback) { if (!this.include(url, true, callback)) alert('The resource ' + url + ' probably does not exists'); }, array_include: function(urlArray, callback) { var that = this; var resource = urlArray[0]; callback = callback || new Function(); if (urlArray.length > 0) this.include(resource, false, function(){ urlArray = urlArray.splice(1, urlArray.length); that.array_include(urlArray, callback); }); else callback(); }, ready: function(handler) { handler = handler || new Function(); var libReady = function(handler) { setTimeout(function(){ if (JScriptRender.STATE == "complete") handler(); else return libReady(handler); }, 100); } if (document.readyState == "complete") libReady(handler); else { document.onreadystatechange = function () { if (document.readyState == "complete") { libReady(handler); } } } } } /* Short alias */ var $jS = JScriptRender; for (var f in $jS.StdClass) { $jS[f] = $jS.StdClass[f]; }; /* Load classes */ try { $jS.array_include([ // Languages 'language/en_US.js', 'language/es_ES.js', // General settings 'settings/general.js', // Validators 'validator/MathExpression.js', 'validator/StringLength.js', 'validator/Digits.js', 'validator/Alnum.js', 'validator/Date.js', 'validator/FileFormat.js', // Filters 'filter/InputFilter.js', // Html 'html/Overlay.js', 'html/Loader.js', 'html/Dialog.js', 'html/Form.js', 'html/FormValidator.js', // Exceptions 'exception/Exception.js', // Readers 'readers/File.js', // jQuery utils 'jquery/Ajax.js', 'jquery/UI.js', 'jquery/Debug.js', 'jquery/Animation.js', // Utils 'utils/DateControl.js', ], function(){ JScriptRender.STATE = 'complete'; }); } catch (e) { JScriptRender.STATE = 'error'; }
const React = require('react') const { shell } = require('electron') const ModalOKCancel = require('./modal-ok-cancel') const { dispatch } = require('../lib/dispatcher') module.exports = class UpdateAvailableModal extends React.Component { render () { const state = this.props.state return ( <div className='update-available-modal'> <p><strong>A new version of WebTorrent is available: v{state.modal.version}</strong></p> <p> We have an auto-updater for Windows and Mac. We don't have one for Linux yet, so you'll have to download the new version manually. </p> <ModalOKCancel cancelText='SKIP THIS RELEASE' onCancel={handleSkip} okText='SHOW DOWNLOAD PAGE' onOK={handleShow} /> </div> ) function handleShow () { // TODO: use the GitHub urls from config.js shell.openExternal('https://github.com/webtorrent/webtorrent-desktop/releases') dispatch('exitModal') } function handleSkip () { dispatch('skipVersion', state.modal.version) dispatch('exitModal') } } }
'use strict' /** * OAuth 2.0 Authentication Protocol * * OAuth 2.0 is the successor to OAuth 1.0, and is designed to overcome * perceived shortcomings in the earlier version. The authentication flow is * essentially the same. The user is first redirected to the service provider * to authorize access. After authorization has been granted, the user is * redirected back to the application with a code that can be exchanged for an * access token. The application requesting access, known as a client, is iden- * tified by an ID and secret. * * For more information on OAuth in Passport.js, check out: * http://passportjs.org/guide/oauth/ * * @param {Object} req * @param {string} accessToken * @param {string} refreshToken * @param {Object} profile * @param {Function} next */ module.exports = module.exports = (app) => { const passport = app.services.PassportService.passport return (req, accessToken, refreshToken, profile, next) => { const query = { identifier: profile.id, protocol: 'oauth2', tokens: {accessToken: accessToken} } if (refreshToken !== undefined) { query.tokens.refreshToken = refreshToken } passport.connect(req, query, profile, next) } }
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import pageComponent from 'code-corps-ember/tests/pages/components/submittable-textarea'; import PageObject from 'ember-cli-page-object'; let page = PageObject.create(pageComponent); function setHandler(context, modifiedSubmitHandler = () => {}) { context.set('modifiedSubmitHandler', modifiedSubmitHandler); } moduleForComponent('submittable-textarea', 'Integration | Component | submittable textarea', { integration: true, beforeEach() { page.setContext(this); setHandler(this); }, afterEach() { page.removeContext(); } }); // This test is necessary because a new line after yield in the file will // cause a new line in the textarea itself test('it has no extra content when created', function(assert) { this.render(hbs`{{submittable-textarea modifiedSubmit=modifiedSubmitHandler}}`); assert.equal(page.value, '', 'Element is blank.'); }); test('it sends the modifiedSubmit action on command/ctrl + enter', function(assert) { assert.expect(1); setHandler(this, () => { assert.equal(page.value, '', 'Action was called. Input content was unchanged.'); }); this.render(hbs`{{submittable-textarea modifiedSubmit=modifiedSubmitHandler}}`); page.keySubmit(); });
"use strict"; var patient = (function () { function patient() { } return patient; }()); exports.patient = patient; //# sourceMappingURL=character.model.js.map
/** * @author Chong-U Lim <me@chongdashu.com> * @copyright 2015 Chong-U Lim * @module Core */ this.chongdashu = this.chongdashu||{}; (function() { "use strict"; /** * System represents a System of the Entity-Component-System Design * paradigm. * * @class Core.System * @constructor **/ var System = function(nodeType) { this.init(nodeType); }; var p = System.prototype; System.prototype.constructor = System; /** * Indicates if the system is currently enabled or not. * If not enabled, no system or node updates will be performed. * @property enabled * * @type boolean * @default true */ p.enabled = false; /** * The priority of the current system. This is used by the * {{#crossLink "Core.Engine"}}{{/crossLink}} to order the sequence of systems * that it processes. Lower priority numbers are executed first. * * @property priority * @type {integer} * @default 0 */ p.priority = 0; /** * An array of {{#crossLink "Core.Node"}}{{/crossLink}} objects that * this system manages based on the {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}} * @property nodes * @type {Array} */ p.nodes = null; /** * The {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}} that this system * will be responsible for. * @property String * @type Core.Node.TYPE */ p.nodeType = null; p.engine = null; /** * The initialization method is called when the object is constructor. * * @method init * @param {string} nodeType The type of the node. See {{#crossLink "Core.Node/Core.Node.TYPE:property"}}{{/crossLink}}. */ p.init = function(nodeType) { // console.log("[System], init()"); this.priority = 0; this.enabled = true; this.nodeType = nodeType; }; /** * The update loop of this system, as called by a given * {{#crossLink "Core.Engine"}}{{/crossLink}}'s update loop. * All related {{#crossLink "Core.Node"}}{{/crossLink}} objects are * updated. Handling of each node individually can be performed * by overriding the {{#crossLink "Core.System/updateNode:method"}}{{/crossLink}} method. * * * @method update */ p.update = function(elapsed) { var nodes = this.engine.getNodes(this.nodeType); if (nodes) { for (var i=0; i < nodes.length; i++) { this.updateNode(nodes[i], elapsed); } } }; /** * @method updateNode * @param {Core.Node} node The node to be updated */ p.updateNode = function(node) { }; /** * Callback method when this system is added to the engine. * * @method onEngineAdd * @param {Core.Engine} engine reference to the {{#crossLink "Core.Engine"}}{{/crossLink}} object. */ p.onEngineAdd = function(engine) { this.engine = engine; }; /** * Callback method when this system is removed from the engine. * * @method onEngineRemove * @param {Core.Engine} engine reference to the {{#crossLink "Core.Engine"}}{{/crossLink}} object. */ p.onEngineRemove = function(engine) { this.engine = null; }; p.getType = function() { return this.constructor.name; }; // Link // ---- chongdashu.System = System; }());
var CoreObject = require('core-object'); var Promise = require('ember-cli/lib/ext/promise'); var SilentError = require('silent-error'); var chalk = require('chalk'); var white = chalk.white; var green = chalk.green; var EXPIRE_IN_2030 = new Date('2030'); var TWO_YEAR_CACHE_PERIOD_IN_SEC = 60 * 60 * 24 * 365 * 2; module.exports = CoreObject.extend({ init: function() { if (!this.config) { return Promise.reject(new SilentError('You have to pass a config!')); } this.s3 = this.s3 || require('s3'); this.client = this.s3.createClient({ maxAsyncS3: 1, s3Options: this.config.assets }); }, upload: function() { var client = this.client; var _this = this; if (!this.ui) { var message = 'You have to pass a UI to an adapter.'; return Promise.reject(new SilentError(message)); } this.ui.pleasantProgress.start(green('Uploading assets'), green('.')); return new Promise(function(resolve, reject) { var uploader = client.uploadDir(_this.getUploadParams()); uploader.on('error', _this.logUploadError.bind(_this, reject)); uploader.on('end', _this.logUploadSuccess.bind(_this, resolve)); uploader.on('fileUploadStart', _this.logFileUpload.bind(_this)); uploader.on('fileUploadEnd', _this.logFileUploadEnd.bind(_this, resolve)); }); }, getUploadParams: function() { return { localDir: 'tmp/assets-sync', s3Params: { ACL: 'public-read', Bucket: this.config.assets.bucket, Prefix: this.config.assets.prefix || '', CacheControl: 'max-age='+TWO_YEAR_CACHE_PERIOD_IN_SEC+', public', Expires: EXPIRE_IN_2030 }, getS3Params: this.getS3Params.bind(this) } }, getS3Params: function(localFile, stat, callback) { if (this.config.assets.gzip === false) { return callback(null, {}); } var gzipExtensions = this.config.assets.gzipExtensions ? this.config.assets.gzipExtensions : ['js', 'css', 'svg']; var ext = localFile.replace(/.*[\.\/\\]/, '').toLowerCase(); var isGzippedContent = gzipExtensions.indexOf(ext) != -1; var additionalParams = isGzippedContent ? { ContentEncoding: 'gzip' } : {}; callback(null, additionalParams); }, logFileUpload: function(fullPath, _) { var fileNameMatches = fullPath.match(/\/((\w*[-]\w*||\w*)[.]\w*)/); if (fileNameMatches) { this.ui.writeLine('Uploading: ' + green(fileNameMatches[1])); } this.fileUploadPending = true; }, logFileUploadEnd: function(resolve, localFilePath, _s3Key) { this.fileUploadPending = false; if (this.s3ThinksWeAreFinished) { this.printEndMessage(); resolve(); } }, logUploadError: function(reject, error) { var errorMessage = 'Unable to sync: ' + error.stack; reject(new SilentError(errorMessage)); }, logUploadSuccess: function(resolve) { if (this.fileUploadPending) { // s3 screws up some times when only uploading one image this.s3ThinksWeAreFinished = true; } else { this.printEndMessage(); resolve(); } }, printEndMessage: function() { this.ui.writeLine('Assets upload successful. Done uploading.'); this.ui.pleasantProgress.stop(); } });
'use strict'; exports.xmlns = 'http://www.w3.org/2000/xmlns/'; exports.svg = 'http://www.w3.org/2000/svg'; exports.xlink = 'http://www.w3.org/1999/xlink'; // the 'old' d3 quirk got fix in v3.5.7 // https://github.com/mbostock/d3/commit/a6f66e9dd37f764403fc7c1f26be09ab4af24fed exports.svgAttrs = { xmlns: exports.svg, 'xmlns:xlink': exports.xlink };
import { window, document } from 'ssr-window'; import $ from '../../utils/dom'; import Utils from '../../utils/utils'; const HashNavigation = { onHashCange() { const swiper = this; const newHash = document.location.hash.replace('#', ''); const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); if (newHash !== activeSlideHash) { const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); if (typeof newIndex === 'undefined') return; swiper.slideTo(newIndex); } }, setHash() { const swiper = this; if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) return; if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { window.history.replaceState(null, null, (`#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || '')); } else { const slide = swiper.slides.eq(swiper.activeIndex); const hash = slide.attr('data-hash') || slide.attr('data-history'); document.location.hash = hash || ''; } }, init() { const swiper = this; if (!swiper.params.hashNavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) return; swiper.hashNavigation.initialized = true; const hash = document.location.hash.replace('#', ''); if (hash) { const speed = 0; for (let i = 0, length = swiper.slides.length; i < length; i += 1) { const slide = swiper.slides.eq(i); const slideHash = slide.attr('data-hash') || slide.attr('data-history'); if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { const index = slide.index(); swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); } } } if (swiper.params.hashNavigation.watchState) { $(window).on('hashchange', swiper.hashNavigation.onHashCange); } }, destroy() { const swiper = this; if (swiper.params.hashNavigation.watchState) { $(window).off('hashchange', swiper.hashNavigation.onHashCange); } }, }; export default { name: 'hash-navigation', params: { hashNavigation: { enabled: false, replaceState: false, watchState: false, }, }, create() { const swiper = this; Utils.extend(swiper, { hashNavigation: { initialized: false, init: HashNavigation.init.bind(swiper), destroy: HashNavigation.destroy.bind(swiper), setHash: HashNavigation.setHash.bind(swiper), onHashCange: HashNavigation.onHashCange.bind(swiper), }, }); }, on: { init() { const swiper = this; if (swiper.params.hashNavigation.enabled) { swiper.hashNavigation.init(); } }, destroy() { const swiper = this; if (swiper.params.hashNavigation.enabled) { swiper.hashNavigation.destroy(); } }, transitionEnd() { const swiper = this; if (swiper.hashNavigation.initialized) { swiper.hashNavigation.setHash(); } }, }, };
'use strict'; describe("Schema.SchemaDefinition", function () { var SchemaDefinition = Divhide.SubModules.Schema.SchemaDefinition; beforeEach(function () { jasmine.addMatchers(window.JasmineCustomMatchers); }); it(".ctor(Array)", function () { var c = new SchemaDefinition({ schema : [ 1, 2 ], default: [], required: true, repeatable: false }); var schema = new SchemaDefinition({ schema : [ new SchemaDefinition({ schema: 2, required: true }), new SchemaDefinition({ schema: 1, required: true }) ], default: [], required: true, repeatable: false }); expect(schema).equals(c); }); it(".ctor(Object)", function () { var c = new SchemaDefinition({ schema : { one: 1, two: 2 }, required: true, repeatable: false }); var schema = new SchemaDefinition({ schema : { "one": new SchemaDefinition({ schema: 0, required: true }), "two": new SchemaDefinition({ schema: 0, required: true }) }, required: true, repeatable: false }); expect(schema).equals(c); }); it(".ctor(String)", function () { var expected = new SchemaDefinition({ schema : '', required: true, repeatable: false }); var schema = new SchemaDefinition({ schema: '0' }); expect(schema).equals(expected); }); it(".ctor(Number)", function () { var expected = new SchemaDefinition({ schema : 0, required: true, repeatable: false }); var schema = new SchemaDefinition({ schema: 1 }); expect(schema).equals(expected); }); });
'use strict'; const gulp = require('gulp'); const gulpif = require('gulp-if'); const jscs = require('gulp-jscs'); const stylish = require('jscs-stylish'); module.exports = (src, opts) => { opts = Object.assign({ configPath: './node_modules/habanero-code-style/js/.jscsrc', reporter: stylish.path, watch: false }, opts); return gulp.src(src) .pipe(jscs(opts)) .pipe(jscs.reporter()) .pipe(gulpif(!opts.watch, jscs.reporter('fail'))); };
$(document).ready(function() { vis.createBreadcrumbs($(".container.full").first()); }); // namespace var vis = {}; /** * Adds a breadcrumb as first child to the specified container. * * @author felixhayashi */ vis.createBreadcrumbs = function(container) { // use the url to infer the path var crumbs = location.pathname.split('/'); // number of ancestor directories var stepbackIndex = crumbs.length-1; var breadcrumbs = $.map(crumbs, function(crumb, i) { // first and last element of the split if(!crumb) return; stepbackIndex--; if(/\.html$/.test(crumb)) { // strip the .html to make it look prettier return "<span>" + crumb.replace(/\.html$/, "") + "</span>"; } else { // calculate the relative url for(var ref=crumb+"/", j=0; j<stepbackIndex; j++, ref="../"+ref); return "<a href='" + ref + "'>" + crumb + "</a>"; } }).join("") || "Home"; // insert into the container at the beginning. $(container).prepend("<div id=\"breadcrumbs\">" + breadcrumbs + "</div>"); };
import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' import { addUserRequest, getUserRequest, updateUserRequest } from 'App/actions/users' import { USER_TYPE_USER } from 'Server/constants' import EditView from '../components/EditView' class EditContainer extends Component { static propTypes = { addUserRequest: PropTypes.func.isRequired, updateUserRequest: PropTypes.func.isRequired, getUserRequest: PropTypes.func.isRequired, user: PropTypes.object.isRequired, params: PropTypes.object.isRequired, } constructor(props) { super(props) this.isAdding = props.params.id === undefined this.handleSubmit = this.handleSubmit.bind(this) } componentDidMount() { if (!this.isAdding) { this.props.getUserRequest(this.props.params.id) } } handleSubmit(user) { if (this.isAdding) { this.props.addUserRequest(user) } else { this.props.updateUserRequest(this.props.params.id, user) } } render() { const { user } = this.props return ( <div> <div className="page-header"> <h2> {this.isAdding ? 'Add New User' : `Edit User - ${user.username}`} </h2> </div> <EditView isAdding={this.isAdding} user={user} onSubmit={this.handleSubmit} /> </div> ) } } const mapStateToProps = (state, ownProps) => { let user if (ownProps.params.id === undefined) { user = { username: '', password: '', type: USER_TYPE_USER, } } else { user = state.users.find(_user => _user._id === ownProps.params.id) user.password = '' } return { user, } } const mapDispatchToProps = { addUserRequest, updateUserRequest, getUserRequest, } export default connect(mapStateToProps, mapDispatchToProps)(EditContainer)
import { Universal } from '../../../src/types'; const { Set } = Universal; const emptySet = new Set(); export default emptySet;
$(document).ready(function () { /* $('.sign-up-submit').click(function(e) { var $button = $(e.target); var $input = $button.closest(".sign-up-form").find(".mdl-textfield__input"); var $warning = $button.closest(".sign-up-form").find(".warning-message"); buttonAnimate($button, $input, $warning); }); $('.sign-up-form .mdl-textfield__input').keypress(function(e) { if (e.which === 13) { var $input = $(e.target); var $button = $input.closest(".sign-up-form").find(".mdl-button"); var $warning = $button.closest(".sign-up-form").find(".warning-message"); buttonAnimate($button, $input, $warning); } }); */ var envSlug = getEnvironmentSlug(); intercomLauncher(envSlug, true, '#intercom-launcher'); initializeGoogleAnalytics(envSlug); }); // returns true if email contains an @ that is not at either end of the string function simpleEmailCheck(email) { var atSignLocation = email.indexOf("@"); return (atSignLocation > 0) && (atSignLocation < (email.length - 1)); } function buttonAnimate($button, $input, $warning) { var email = $input.val(); var $area = $input.closest(".sign-up-area"); if (simpleEmailCheck(email)) { $warning.css("visibility", "hidden"); $area.removeClass("warning"); $button.animate({ opacity: 0.7, }); $button.attr("disabled", "disabled"); $input.animate({ opacity: 0.5, }); $input.attr("disabled", "disabled"); setTimeout(function() { $button.text("Email Sent!"); }, 200); } else { $warning.css("visibility", "visible"); $area.addClass("warning"); } }
import styled from 'styled-components'; export const Wrapper = styled.section` margin: 0 auto; width: 100%; max-width: 1170px; `; export const VerticalListView = styled.ul` margin: var(--topbar-height) 0; padding: 0; list-style-type: none; `; export const VerticalListSection = styled.li` margin-bottom: var(--padding); &:last-child { position: relative; padding-bottom: calc(var(--topbar-height) * 1.5); } h4, ul:not(.slider-list) { padding-left: var(--padding); } `; export const HorizontalListView = styled.ul` margin: 0; padding: var(--padding); padding-left: 0; display: flex; flex-flow: row no-wrap; list-style-type: none; overflow-x: auto; align-items: center; `; export const HorizontalListItem = styled.li` margin-right: var(--padding); &:last-child { position: relative; padding-right: calc(var(--topbar-height) * 0.5); } `; export const TagButton = styled.button` padding: calc(var(--padding) * 0.5) calc(var(--padding) * 2); background: var(--primary-accent-color); color: var(--background-color); border-radius: 50px; white-space: nowrap; `; export const FacilityButton = styled.button` background: var(--foreground-color); color: var(--background-color); padding: var(--padding); border-radius: 4px; white-space: nowrap; `; export const FacilityIcon = styled.img` display: block; margin: 0 auto; height: 24px; margin-bottom: calc(var(--padding) / 2); `; export const SearchContainer = styled.section` position: relative; margin: auto; width: 100%; max-width: 1170px; display: flex; align-items: center; `; export const SearchLabel = styled.label` // padding: calc(var(--padding) / 1); padding-left: calc(var(--padding) / 2); border-radius: 4px 0 0 4px; `; export const SearchBox = styled.input` display: block; flex: 2; // padding: calc(var(--padding) / 1); font-size: 16px; &:focus { outline: 0; } `; export const List = styled.ul` margin: var(--topbar-height) 0 calc(var(--topbar-height) * 1.5) 0; padding: 0; list-style-type: 0; `; export const Item = styled.li` border-bottom: 1px solid var(--light-gray); `; export const SlideList = styled.section` padding: var(--padding); `;
var hub = require('..') , cluster = require('cluster') , assert = require('assert') , WORKERS = 2 if (cluster.isMaster) { var workers = []; for (var i = 0; i < WORKERS; i++) { workers.push(cluster.fork()); } var n = WORKERS; hub.on('imready', function() { if (--n === 0) hub.emit('allready'); }); describe('Master', function() { it('Waits for workers to exit', function(done) { var n = WORKERS; function exit() { if (--n === 0) done(); } cluster.on('exit', exit); }); }); } else { describe('Worker', function() { describe('Emit message to other worker', function() { it('Respond when all workers are listening', function(done) { hub.on('fromworker', done); hub.on('allready', function() { hub.emitRemote('fromworker'); }); hub.emit('imready'); }); }); describe('Calls hub method', function() { it('Data should be shared amongst workers', function(done) { var n = 0; hub.on('incr work', function() { if (++n === WORKERS) { done(); } }); hub.ready(function() { setTimeout(function() { hub.incr('work'); }, 100); }); }); }); }); }
import addOptionsToOrdinalScale from 'ember-d3-helpers/utils/add-options-to-ordinal-scale'; import { module, test } from 'qunit'; module('Unit | Utility | add options to ordinal scale'); // Replace this with your real tests. test('works supporting paddingInner/Outer', function(assert) { let callCounts = {}; let lastArgs = {}; let scale = ['align', 'padding', 'paddingInner', 'paddingOuter'].reduce((hash, prop) => { callCounts[prop] = 0; lastArgs[prop] = []; hash[prop] = (...args) => { lastArgs[prop] = args; callCounts[prop]++; }; return hash; }, { domain() {}, range() {}, rangeRound() {} }); addOptionsToOrdinalScale(scale, [], [], {}); assert.deepEqual(callCounts, { align: 0, padding: 0, paddingInner: 0, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [], paddingInner: [], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { padding: 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 0, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { 'padding-inner': 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 1, paddingOuter: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [10], paddingOuter: [] }); addOptionsToOrdinalScale(scale, [], [], { 'padding-outer': 10 }); assert.deepEqual(callCounts, { align: 0, padding: 1, paddingInner: 1, paddingOuter: 1 }); assert.deepEqual(lastArgs, { align: [], padding: [10], paddingInner: [10], paddingOuter: [10] }); addOptionsToOrdinalScale(scale, [], [], { align: 0 }); assert.deepEqual(callCounts, { align: 1, padding: 1, paddingInner: 1, paddingOuter: 1 }); assert.deepEqual(lastArgs, { align: [0], padding: [10], paddingInner: [10], paddingOuter: [10] }); }); test('works without supporting paddingInner/Outer', function(assert) { let callCounts = {}; let lastArgs = {}; let scale = ['align', 'padding'].reduce((hash, prop) => { callCounts[prop] = 0; lastArgs[prop] = []; hash[prop] = (...args) => { lastArgs[prop] = args; callCounts[prop]++; }; return hash; }, {}); assert.throws(() => { addOptionsToOrdinalScale(scale, { 'padding-inner': 10 }); }, 'padding inner without support throws'); assert.deepEqual(callCounts, { align: 0, padding: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [] }); assert.throws(() => { addOptionsToOrdinalScale(scale, { 'padding-outer': 10 }); }, 'padding outer without support throws'); assert.deepEqual(callCounts, { align: 0, padding: 0 }); assert.deepEqual(lastArgs, { align: [], padding: [] }); });
/** * UserController * * @description :: Server-side logic for managing users * @help :: See http://links.sailsjs.org/docs/controllers */ module.exports = { notes: function(req, res) { EvernoteService.listNotes(function(err, notes) { if(err){ console.log(err); return res.serverError(err); } return res.json({ notes: notes }); }); }, notebooks: function (req, res) { EvernoteService.listNotebooks(function(err, notes) { if(err){ console.log(err); return res.serverError(err); } return res.json({ notebooks: notes }); }); } };
import React from 'react'; import PropTypes from 'prop-types'; import { FetchedData, Param } from '../fetched'; import * as globals from '../globals'; import { ObjectPicker } from '../inputs'; const ItemBlockView = (props) => { const ViewComponent = globals.contentViews.lookup(props.context); return <ViewComponent {...props} />; }; ItemBlockView.propTypes = { context: PropTypes.object, }; ItemBlockView.defaultProps = { context: null, }; export default ItemBlockView; class FetchedItemBlockView extends React.Component { shouldComponentUpdate(nextProps) { return (nextProps.value.item !== this.props.value.item); } render() { const context = this.props.value.item; if (typeof context === 'object') { return <ItemBlockView context={context} />; } if (typeof context === 'string') { return ( <FetchedData> <Param name="context" url={context} /> <ItemBlockView /> </FetchedData> ); } return null; } } FetchedItemBlockView.propTypes = { value: PropTypes.object, }; FetchedItemBlockView.defaultProps = { value: null, }; globals.blocks.register({ label: 'item block', icon: 'icon icon-paperclip', schema: { type: 'object', properties: { item: { title: 'Item', type: 'string', formInput: <ObjectPicker />, }, className: { title: 'CSS Class', type: 'string', }, }, }, view: FetchedItemBlockView, }, 'itemblock');
var assert = require('assert'); var createTestConfig = require('./test-util').createTestConfig; var createTestServicesWithStubs = require('./test-util').createTestServicesWithStubs; var FileServer = require('../braid-file-server').FileServer; var request = require('request'); var fs = require('fs'); var path = require('path'); var config1; var config2; var services1; var services2; var fileServer1; var fileServer2; describe('file-server:', function() { before(function(done) { config1 = createTestConfig('test.26111', 'test1', 26101, 26111); createTestServicesWithStubs(config1, function(err, svcs) { assert(!err, err); services1 = svcs; fileServer1 = new FileServer(); fileServer1.initialize(config1, services1); config2 = createTestConfig('test.26211', 'test2', 26201, 26211); createTestServicesWithStubs(config2, function(err, svcs) { assert(!err, err); services2 = svcs; fileServer2 = new FileServer(); fileServer2.initialize(config2, services2); done(); }); }); }); after(function(done) { fileServer1.close(); fileServer2.close(); services1.braidDb.close(done); services2.braidDb.close(done); }); it('put and retrieve file', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26121', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26111'); assert.equal(details.contentType, 'image/png'); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId, encoding : null }, function(error, response, body) { assert.equal(response.body.length, 65048) assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.statusCode, 200); done(); }); }).on('error', function(err) { throw err; })); }); it('using encryption', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26121?encrypt=true', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26111'); assert.equal(details.contentType, 'image/png'); assert(details.encryptionKey !== null); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId + "?decrypt=true&key=" + details.encryptionKey, encoding : null }, function(error, response, body) { assert.equal(response.body.length, 65048) assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.statusCode, 200); done(); }); }).on('error', function(err) { throw err; })); }); it('files on remote domains', function(done) { fs.createReadStream(path.join(__dirname, 'braid.png')).pipe(request.put({ uri : 'http://localhost:26221', headers : [ { name : 'Content-Type', value : 'image/png' } ] }, function(error, response, body) { assert.equal(response.statusCode, 200); var details = JSON.parse(body); assert.equal(details.domain, 'test.26211'); assert.equal(details.contentType, 'image/png'); request.get({ uri : 'http://localhost:26121/' + details.domain + "/" + details.fileId, encoding : null }, function(error, response, body) { assert.equal(response.statusCode, 200); assert.equal(response.headers['content-type'], 'image/png'); assert.equal(response.body.length, 65048) done(); }); }).on('error', function(err) { throw err; })); }); });
version https://git-lfs.github.com/spec/v1 oid sha256:7f9cbfb4555e04b948aae3356d710f479a41b7a1c0b5a605beeefce843edd9e6 size 2675
define([ 'angular', '../module', '../service', 'common/services/bootstrap', ], function(angular, lazyModule, service, bootstrapService) { 'use strict'; /** * [homeController description] * @param {[type]} $scope [description] * @param {[type]} homeService [description] * @return {[type]} [description] */ lazyModule.controller('ContentController', ['$scope', '$modal', '$rootScope', 'HomeService', 'ModalService', function($scope, $modal, $rootScope, homeService, modalService) { var self = this; $rootScope.pageTitle = 'home'; /** * [pageLoad description] * @return {[type]} [description] */ self.pageLoad = function() { homeService.getData().success(function(response) { $scope.awesomeThings = response.data; }); }; self.pageLoad(); } ]); });
var fs = require('fs'); var path = require('path'); var gulp = require('gulp'); var plugins = require('gulp-load-plugins')(); // Load all gulp plugins // automatically and attach // them to the `plugins` object var runSequence = require('run-sequence'); // Temporary solution until gulp 4 // https://github.com/gulpjs/gulp/issues/355 var pkg = require('./package.json'); var dirs = pkg['h5bp-configs'].directories; // --------------------------------------------------------------------- // | Helper tasks | // --------------------------------------------------------------------- gulp.task('archive:create_archive_dir', function () { fs.mkdirSync(path.resolve(dirs.archive), '0755'); }); gulp.task('archive:zip', function (done) { var archiveName = path.resolve(dirs.archive, pkg.name + '_v' + pkg.version + '.zip'); var archiver = require('archiver')('zip'); var files = require('glob').sync('**/*.*', { 'cwd': dirs.dist, 'dot': true // include hidden files }); var output = fs.createWriteStream(archiveName); archiver.on('error', function (error) { done(); throw error; }); output.on('close', done); files.forEach(function (file) { var filePath = path.resolve(dirs.dist, file); // `archiver.bulk` does not maintain the file // permissions, so we need to add files individually archiver.append(fs.createReadStream(filePath), { 'name': file, 'mode': fs.statSync(filePath) }); }); archiver.pipe(output); archiver.finalize(); }); gulp.task('clean', function (done) { require('del')([ dirs.archive, dirs.dist ], done); }); gulp.task('copy', [ 'copy:.htaccess', 'copy:index.html', 'copy:jquery', 'copy:license', 'copy:main.css', 'copy:misc', 'copy:normalize' ]); gulp.task('copy:.htaccess', function () { return gulp.src('node_modules/apache-server-configs/dist/.htaccess') .pipe(plugins.replace(/# ErrorDocument/g, 'ErrorDocument')) .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:index.html', function () { return gulp.src(dirs.src + '/index.html') .pipe(plugins.replace(/{{JQUERY_VERSION}}/g, pkg.devDependencies.jquery)) .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:jquery', function () { return gulp.src(['node_modules/jquery/dist/jquery.min.js']) .pipe(plugins.rename('jquery-' + pkg.devDependencies.jquery + '.min.js')) .pipe(gulp.dest(dirs.dist + '/js/vendor')); }); gulp.task('copy:license', function () { return gulp.src('LICENSE.txt') .pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:main.css', function () { var banner = '/*! HTML5 Boilerplate v' + pkg.version + ' | ' + pkg.license.type + ' License' + ' | ' + pkg.homepage + ' */\n\n'; return gulp.src(dirs.src + '/css/main.css') .pipe(plugins.header(banner)) .pipe(plugins.autoprefixer({ browsers: ['last 2 versions', 'ie >= 8', '> 1%'], cascade: false })) .pipe(gulp.dest(dirs.dist + '/css')); }); gulp.task('copy:misc', function () { return gulp.src([ // Copy all files dirs.src + '/**/*', // Exclude the following files // (other tasks will handle the copying of these files) '!' + dirs.src + '/css/main.css', '!' + dirs.src + '/index.html' ], { // Include hidden files by default dot: true }).pipe(gulp.dest(dirs.dist)); }); gulp.task('copy:normalize', function () { return gulp.src('node_modules/normalize.css/normalize.css') .pipe(gulp.dest(dirs.dist + '/css')); }); gulp.task('lint:js', function () { return gulp.src([ 'gulpfile.js', dirs.src + '/js/*.js', dirs.test + '/*.js' ]).pipe(plugins.jscs()) .pipe(plugins.jshint()) .pipe(plugins.jshint.reporter('jshint-stylish')) .pipe(plugins.jshint.reporter('fail')); }); // --------------------------------------------------------------------- // | Main tasks | // --------------------------------------------------------------------- gulp.task('archive', function (done) { runSequence( 'build', 'archive:create_archive_dir', 'archive:zip', done); }); gulp.task('build', function (done) { runSequence( ['clean', 'lint:js'], 'copy', done); }); gulp.task('default', ['build']); gulp.task('autoprefixer', function () { var postcss = require('gulp-postcss'); var autoprefixer = require('autoprefixer'); return gulp.src('./src/css/*.css') .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ])) .pipe(gulp.dest('./dest')); });
module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: 'src/main/javascript/app', frameworks: ['jasmine'], files: [ 'lib/lodash/dist/lodash.js', 'lib/angular/angular.js', 'lib/angular-resource/angular-resource.js', 'lib/restangular/dist/restangular.js' ], // list of files / patterns to exclude exclude: [], plugins: [ 'karma-jasmine', 'karma-coverage', 'karma-chrome-launcher', 'karma-phantomjs-launcher' ], // test results reporter to use // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' reporters: ['progress', 'coverage'], // 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: false, // Start these browsers, currently available: // - Chrome // - ChromeCanary // - Firefox // - Opera // - Safari (only Mac) // - PhantomJS // - IE (only Windows) browsers: ['PhantomJS'], // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun: false, // Coverage reporter generates the coverage coverageReporter: { reporters: [ { type: 'lcov', dir: 'build/coverage/' }, { type: 'text-summary', dir: 'build/coverage/' } ] } }); };
/* eslint-disable react/no-array-index-key */ /* @flow */ import React from 'react'; import type { Node } from 'react'; import cn from 'classnames'; import { Dropdown, DropdownOption } from '../../Dropdown'; import type { FontFamilyConfig } from '../../../core/config'; export type Props = { expanded: boolean, onExpandEvent: Function, doExpand: Function, doCollapse: Function, onChange: Function, config: FontFamilyConfig, currentState: any, }; type State = { defaultFontFamily: string, }; class FontFamilyLayout extends React.Component<Props, State> { state = { defaultFontFamily: undefined, }; componentDidMount(): void { const editorElm = document.getElementsByClassName('DraftEditor-root'); if (editorElm && editorElm.length > 0) { const styles = window.getComputedStyle(editorElm[0]); const defaultFontFamily = styles.getPropertyValue('font-family'); this.setDefaultFam(defaultFontFamily); } } setDefaultFam = defaultFont => { this.setState({ defaultFontFamily: defaultFont, }); }; props: Props; render(): Node { const { defaultFontFamily } = this.state; const { config: { options, title }, onChange, expanded, doCollapse, onExpandEvent, doExpand, } = this.props; let { currentState: { fontFamily: currentFontFamily } } = this.props; currentFontFamily = currentFontFamily || (options && defaultFontFamily && options.some(opt => opt.toLowerCase() === defaultFontFamily.toLowerCase()) && defaultFontFamily); return ( <div className={cn('be-ctrl__group')} aria-label="be-fontfamily-control"> <Dropdown onChange={onChange} expanded={expanded} doExpand={doExpand} ariaLabel="be-dropdown-fontfamily-control" doCollapse={doCollapse} onExpandEvent={onExpandEvent} title={title}> <span className={cn('be-fontfamily__ph')}>{currentFontFamily || 'Font Family'}</span> {options.map((family, index) => ( <DropdownOption active={currentFontFamily === family} value={family} key={index}> {family} </DropdownOption> ))} </Dropdown> </div> ); } } export default FontFamilyLayout;
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var common = require('../common'); var assert = require('assert'); console.log('process.pid: ' + process.pid); var first = 0, second = 0; var sighup = false; process.addListener('SIGUSR1', function() { console.log('Interrupted by SIGUSR1'); first += 1; }); process.addListener('SIGUSR1', function() { second += 1; setTimeout(function() { console.log('End.'); process.exit(0); }, 5); }); var i = 0; setInterval(function() { console.log('running process...' + ++i); if (i == 5) { process.kill(process.pid, 'SIGUSR1'); } }, 1); // Test addListener condition where a watcher for SIGNAL // has been previously registered, and `process.listeners(SIGNAL).length === 1` process.addListener('SIGHUP', function () {}); process.removeAllListeners('SIGHUP'); process.addListener('SIGHUP', function () { sighup = true }); process.kill(process.pid, 'SIGHUP'); process.addListener('exit', function() { assert.equal(1, first); assert.equal(1, second); assert.equal(true, sighup); });
import Logger, { configure, levels } from '..'; import ConsoleHandler from 'nightingale-console'; import errorProcessor from 'nightingale-error-processor'; configure([ { processors: [errorProcessor], handlers: [new ConsoleHandler(levels.ALL)], }, ]); const logger = new Logger('app'); logger.error(new Error('test')); logger.error('test', { error: new Error('test') });
/*global module, require*/ 'use strict'; function FtpMock() { this.actions = {}; } FtpMock.prototype.on = function (action, fn) { this.actions[action] = fn; }; FtpMock.prototype.connect = function (params) { if (params.host !== 'rozklady.ztm.waw.pl') { this.actions.error(new Error('Wrong address')); } else { this.actions.ready(); } }; FtpMock.prototype.list = function (callback) { callback(null, [{date: new Date(), name: 'RA123456.7z'}]); }; FtpMock.prototype.end = function () { }; module.exports = FtpMock;
'use strict' /** * Protobuf interface * from go-ipfs/pin/internal/pb/header.proto */ module.exports = ` syntax = "proto2"; package ipfs.pin; option go_package = "pb"; message Set { optional uint32 version = 1; optional uint32 fanout = 2; optional fixed32 seed = 3; } `
'use strict'; module.exports = require('./CodeSlide');
'use strict'; var mongoose = require('mongoose'), Schema = mongoose.Schema, archive = require('./archive.js'), modelUtils = require('./modelUtils'), config = require('meanio').loadConfig() ; var FolderSchema = new Schema({ created: { type: Date, default: Date.now }, updated: { type: Date }, recycled: { type: Date, }, title: { type: String }, office: { type: Schema.ObjectId, ref: 'Office' }, discussion: { type: Schema.ObjectId, ref: 'Discussion' }, creator: { type: Schema.ObjectId, ref: 'User' }, manager: { type: Schema.ObjectId, ref: 'User' }, signature: { circles: {}, codes: {} }, color: { type: String, required: true }, status: { type: String, enum: ['new', 'in-progress', 'canceled', 'done', 'archived'], default: 'new' }, tags: [String], description: { type: String }, //should we maybe have finer grain control on this watchers: [ { type: Schema.ObjectId, ref: 'User' } ], bolded: [ { _id: false, id: {type: Schema.ObjectId, ref: 'User'}, bolded: Boolean, lastViewed: Date } ], permissions: [ { _id: false, id: {type: Schema.ObjectId, ref: 'User'}, level: { type: String, enum: ['viewer', 'commenter', 'editor'], default: 'viewer' } } ], parent: { type: Schema.ObjectId, ref: 'Folder' }, room: { type: String }, hasRoom: { type: Boolean, default: false }, sources: [String], circles: { type: Schema.Types.Mixed }, WantRoom: { type: Boolean, default: false }, roomName: { type: String } }); var starVirtual = FolderSchema.virtual('star'); starVirtual.get(function() { return this._star; }); starVirtual.set(function(value) { this._star = value; }); FolderSchema.set('toJSON', { virtuals: true }); FolderSchema.set('toObject', { virtuals: true }); /** * Validations */ FolderSchema.path('color').validate(function(color) { return /^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(color); }, 'Invalid HEX color.'); /** * Statics */ FolderSchema.statics.load = function(id, cb) { this.findOne({ _id: id }).populate('creator', 'name username').exec(cb); }; FolderSchema.statics.office = function(id, cb) { require('./office'); var Office = mongoose.model('Office'); Office.findById(id, function(err, office) { cb(err, office || {}); }); }; /** * Post middleware */ var elasticsearch = require('../controllers/elasticsearch'); FolderSchema.post('save', function(req, next) { var task = this; FolderSchema.statics.office(this.office, function(err, office) { if(err) { return err; } elasticsearch.save(task, 'folder'); }); next(); }); FolderSchema.pre('remove', function(next) { var task = this; FolderSchema.statics.office(this.office, function(err, office) { if(err) { return err; } elasticsearch.delete(task, 'task', next); }); next(); }); /** * middleware */ // Will not execute until the first middleware calls `next()` FolderSchema.pre('save', function(next) { let entity = this ; config.superSeeAll ? modelUtils.superSeeAll(entity,next) : next() ; }); FolderSchema.post('save', function(req, next) { elasticsearch.save(this, 'folder'); next(); }); FolderSchema.pre('remove', function(next) { elasticsearch.delete(this, 'folder', next); next(); }); FolderSchema.plugin(archive, 'folder'); module.exports = mongoose.model('Folder', FolderSchema);
// import path from 'path'; // import {isCI} from '../lib/ci'; module.exports = { // // - - - - CHIMP - - - - // watch: false, // watchTags: '@watch,@focus', // domainSteps: null, // e2eSteps: null, // fullDomain: false, // domainOnly: false, // e2eTags: '@e2e', // watchWithPolling: false, // server: false, // serverPort: 8060, // serverHost: 'localhost', // sync: true, // offline: false, // showXolvioMessages: true, // // - - - - CUCUMBER - - - - path: 'tests/end-to-end', // format: 'pretty', // tags: '~@ignore', // singleSnippetPerFile: true, // recommendedFilenameSeparator: '_', // chai: false, // screenshotsOnError: isCI(), // screenshotsPath: '.screenshots', // captureAllStepScreenshots: false, // saveScreenshotsToDisk: true, // // Note: With a large viewport size and captureAllStepScreenshots enabled, // // you may run out of memory. Use browser.setViewportSize to make the // // viewport size smaller. // saveScreenshotsToReport: false, // jsonOutput: null, // compiler: 'js:' + path.resolve(__dirname, '../lib/babel-register.js'), // conditionOutput: true, // // - - - - SELENIUM - - - - // browser: null, // platform: 'ANY', // name: '', // user: '', // key: '', // port: null, // host: null, // // deviceName: null, // // - - - - WEBDRIVER-IO - - - - // webdriverio: { // desiredCapabilities: {}, // logLevel: 'silent', // // logOutput: null, // host: '127.0.0.1', // port: 4444, // path: '/wd/hub', // baseUrl: null, // coloredLogs: true, // screenshotPath: null, // waitforTimeout: 500, // waitforInterval: 250, // }, // // - - - - SELENIUM-STANDALONE // seleniumStandaloneOptions: { // // check for more recent versions of selenium here: // // http://selenium-release.storage.googleapis.com/index.html // version: '2.53.1', // baseURL: 'https://selenium-release.storage.googleapis.com', // drivers: { // chrome: { // // check for more recent versions of chrome driver here: // // http://chromedriver.storage.googleapis.com/index.html // version: '2.25', // arch: process.arch, // baseURL: 'https://chromedriver.storage.googleapis.com' // }, // ie: { // // check for more recent versions of internet explorer driver here: // // http://selenium-release.storage.googleapis.com/index.html // version: '2.50.0', // arch: 'ia32', // baseURL: 'https://selenium-release.storage.googleapis.com' // }, // firefox: { // // check for more recent versions of gecko driver here: // // https://github.com/mozilla/geckodriver/releases // version: '0.11.1', // arch: process.arch, // baseURL: 'https://github.com/mozilla/geckodriver/releases/download' // } // } // }, // // - - - - SESSION-MANAGER - - - - // noSessionReuse: false, // // - - - - SIMIAN - - - - // simianResultEndPoint: 'api.simian.io/v1.0/result', // simianAccessToken: false, // simianResultBranch: null, // simianRepositoryId: null, // // - - - - MOCHA - - - - mocha: true, mochaCommandLineOptions: ['--color'], mochaConfig: { // tags and grep only work when watch mode is false tags: '', grep: null, timeout: 40000, reporter: 'min', slow: 100, retries: 3, bail: false // bail after first test failure }, // // - - - - JASMINE - - - - // jasmine: false, // jasmineConfig: { // specDir: '.', // specFiles: [ // '**/*@(_spec|-spec|Spec).@(js|jsx)', // ], // helpers: [ // 'support/**/*.@(js|jsx)', // ], // stopSpecOnExpectationFailure: false, // random: false, // }, // jasmineReporterConfig: { // // This options are passed to jasmine.configureDefaultReporter(...) // // See: http://jasmine.github.io/2.4/node.html#section-Reporters // }, // // - - - - METEOR - - - - ddp: 'http://localhost:3000' // serverExecuteTimeout: 10000, // // - - - - PHANTOM - - - - // phantom_w: 1280, // phantom_h: 1024, // phantom_ignoreSSLErrors: false, // // - - - - DEBUGGING - - - - // log: 'info', // debug: false, // seleniumDebug: null, // debugCucumber: null, // debugBrkCucumber: null, // debugMocha: null, // debugBrkMocha: null, };
version https://git-lfs.github.com/spec/v1 oid sha256:3fe2372bec3008f9cab29eec1d438c62ef2cc056aacfc8f70c533ec50ba9b7f5 size 4224
'use strict'; /** This file should be loaded via `import()` to be code-split into separate bundle. */ import { HiGlassComponent } from 'higlass/dist/hglib'; // import from just 'higlass-register' itself don't work, should update its package.json to have `"module": "src/index.js",` (or 'esm' or w/e it is) for that. import { default as higlassRegister } from 'higlass-register/dist/higlass-register'; import { default as StackedBarTrack } from 'higlass-multivec/es/StackedBarTrack'; export { HiGlassComponent, higlassRegister, StackedBarTrack };
var exports = module.exports; exports.setup = function(callback) { var write = process.stdout.write; process.stdout.write = (function(stub) { return function(string, encoding, fd) { stub.apply(process.stdout, arguments); callback(string, encoding, fd); }; })(process.stdout.write); return function() { process.stdout.write = write; }; };
import React from 'react' class Shortest extends React.Component { render() { return ( <div>Shortest</div> ) } } export default Shortest