commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
7b6ba59b367e90de2137c5300b264578d67e85e1
src/sprites/Turret.js
src/sprites/Turret.js
import Obstacle from './Obstacle' export default class extends Obstacle { constructor (game, player, x, y, frame, bulletFrame) { super(game, player, x, y, frame) this.weapon = this.game.plugins.add(Phaser.Weapon) this.weapon.trackSprite(this) this.weapon.createBullets(50, 'chars_small', bulletFrame) this.weapon.bulletSpeed = 600 this.weapon.fireRate = 200 this.target = null } update () { super.update() this.game.physics.arcade.overlap(this.player, this.weapon.bullets, this.onCollision, null, this) if (!this.inCamera) { return } if (this.target != null) { this.weapon.fireAtSprite(this.target) } else if (this.weapon.fire()) { this.weapon.fireAngle += 30 } } onCollision () { super.onCollision() const saved = this.target this.target = null setTimeout(() => this.target = saved, 1000) } }
import Obstacle from './Obstacle' export default class extends Obstacle { constructor (game, player, x, y, frame, bulletFrame) { super(game, player, x, y, frame) this.weapon = this.game.plugins.add(Phaser.Weapon) this.weapon.trackSprite(this) this.weapon.createBullets(50, 'chars_small', bulletFrame) this.weapon.bulletSpeed = 600 this.weapon.fireRate = 200 this.target = null } update () { super.update() this.game.physics.arcade.overlap(this.player, this.weapon.bullets, this.onCollision, null, this) if (!this.inCamera) { return } if (this.target != null) { this.weapon.fireAtSprite(this.target) } else if (this.weapon.fire()) { this.weapon.fireAngle += 30 } } onCollision () { super.onCollision() if (this.target != null) { const saved = this.target this.target = null setTimeout(() => this.target = saved, 1000) } } }
Fix reaggroing when player gets hit while deaggrod.
Fix reaggroing when player gets hit while deaggrod.
JavaScript
mit
mikkpr/LD38,mikkpr/LD38
--- +++ @@ -31,8 +31,10 @@ onCollision () { super.onCollision() - const saved = this.target - this.target = null - setTimeout(() => this.target = saved, 1000) + if (this.target != null) { + const saved = this.target + this.target = null + setTimeout(() => this.target = saved, 1000) + } } }
ae1be9535929473c219b16e7710d6b2fb969859d
lib/npmrel.js
lib/npmrel.js
var fs = require('fs'); var path = require('path'); var exec = require('child_process').exec; var semver = require('semver'); var sh = require('execSync'); var packageJSONPath = path.join(process.cwd(), 'package.json'); var packageJSON = require(packageJSONPath); module.exports = function(newVersion, commitMessage){ var newSemver = packageJSON.version = getNewSemver(newVersion); fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 2)); commitMessage = (commitMessage || 'Release v%s').replace(/%s/g, newSemver); runCommand('git commit -am "' + commitMessage + '"'); runCommand('git tag v' + newSemver); runCommand('git push origin --all'); runCommand('git push origin --tags'); if (!packageJSON.private) runCommand('npm publish'); }; function getNewSemver(newVersion) { var newSemver = semver.valid(newVersion); if (!newSemver) newSemver = semver.inc(packageJSON.version, newVersion); if (!newSemver) throw new Error('Invalid new version'); return newSemver; } function getCommitMessage(commitMessage, newSemver) { commitMessage = commitMessage || 'Release v%s'; return commitMessage.replace(/%s/g, newSemver); } function runCommand(cmd) { if (!sh.run(cmd)) throw new Error('[' + command + '] failed'); }
var fs = require('fs'); var path = require('path'); var exec = require('child_process').exec; var semver = require('semver'); var sh = require('execSync'); var packageJSONPath = path.join(process.cwd(), 'package.json'); var packageJSON = require(packageJSONPath); module.exports = function(newVersion, commitMessage){ var newSemver = packageJSON.version = getNewSemver(newVersion); fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 2)); commitMessage = (commitMessage || 'Release v%s').replace(/%s/g, newSemver); runCommand('git commit -am "' + commitMessage + '"'); runCommand('git tag v' + newSemver); runCommand('git push origin --all'); runCommand('git push origin --tags'); if (!packageJSON.private) runCommand('npm publish'); }; function getNewSemver(newVersion) { var newSemver = semver.valid(newVersion); if (!newSemver) newSemver = semver.inc(packageJSON.version, newVersion); if (!newSemver) throw new Error('Invalid new version'); return newSemver; } function getCommitMessage(commitMessage, newSemver) { commitMessage = commitMessage || 'Release v%s'; return commitMessage.replace(/%s/g, newSemver); } function runCommand(cmd) { if (sh.run(cmd)) throw new Error('[' + command + '] failed'); }
Throw errors on non-zero cmd exit codes
Throw errors on non-zero cmd exit codes
JavaScript
mit
tanem/npmrel
--- +++ @@ -30,5 +30,5 @@ } function runCommand(cmd) { - if (!sh.run(cmd)) throw new Error('[' + command + '] failed'); + if (sh.run(cmd)) throw new Error('[' + command + '] failed'); }
c08b8593ffbd3762083af29ea452a09ba5180832
.storybook/webpack.config.js
.storybook/webpack.config.js
const genDefaultConfig = require('@storybook/vue/dist/server/config/defaults/webpack.config.js') const merge = require('webpack-merge') module.exports = (baseConfig, env) => { const storybookConfig = genDefaultConfig(baseConfig, env) const quasarConfig = require('../build/webpack.dev.conf.js') /* when building with storybook we do not want to extract css as we normally do in production */ process.env.DISABLE_EXTRACT_CSS = true const quasarBasePlugins = require('../build/webpack.base.conf.js').plugins // use Quasar config as default let mergedConfig = merge(quasarConfig, storybookConfig) // set Storybook entrypoint mergedConfig.entry = storybookConfig.entry // allow relative module resolution as used in Storybook mergedConfig.resolve.modules = storybookConfig.resolve.modules // only use Quasars loaders mergedConfig.module.rules = quasarConfig.module.rules // enable Storybook http server mergedConfig.plugins = storybookConfig.plugins // get Quasar's DefinePlugin and PostCSS settings mergedConfig.plugins.unshift(quasarBasePlugins[0], quasarBasePlugins[1]) return mergedConfig }
const genDefaultConfig = require('@storybook/vue/dist/server/config/defaults/webpack.config.js') const merge = require('webpack-merge') module.exports = (baseConfig, env) => { /* when building with storybook we do not want to extract css as we normally do in production */ process.env.DISABLE_EXTRACT_CSS = true const storybookConfig = genDefaultConfig(baseConfig, env) const quasarConfig = require('../build/webpack.dev.conf.js') const quasarBasePlugins = require('../build/webpack.base.conf.js').plugins // use Quasar config as default let mergedConfig = merge(quasarConfig, storybookConfig) // set Storybook entrypoint mergedConfig.entry = storybookConfig.entry // allow relative module resolution as used in Storybook mergedConfig.resolve.modules = storybookConfig.resolve.modules // only use Quasars loaders mergedConfig.module.rules = quasarConfig.module.rules // enable Storybook http server mergedConfig.plugins = storybookConfig.plugins // get Quasar's DefinePlugin and PostCSS settings mergedConfig.plugins.unshift(quasarBasePlugins[0], quasarBasePlugins[1]) return mergedConfig }
Set DISABLE_EXTRACT_CSS in correct place
Set DISABLE_EXTRACT_CSS in correct place
JavaScript
mit
yunity/foodsaving-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/foodsaving-frontend,yunity/karrot-frontend,yunity/karrot-frontend
--- +++ @@ -2,11 +2,12 @@ const merge = require('webpack-merge') module.exports = (baseConfig, env) => { - const storybookConfig = genDefaultConfig(baseConfig, env) - const quasarConfig = require('../build/webpack.dev.conf.js') /* when building with storybook we do not want to extract css as we normally do in production */ process.env.DISABLE_EXTRACT_CSS = true + + const storybookConfig = genDefaultConfig(baseConfig, env) + const quasarConfig = require('../build/webpack.dev.conf.js') const quasarBasePlugins = require('../build/webpack.base.conf.js').plugins // use Quasar config as default @@ -24,7 +25,7 @@ // enable Storybook http server mergedConfig.plugins = storybookConfig.plugins // get Quasar's DefinePlugin and PostCSS settings - mergedConfig.plugins.unshift(quasarBasePlugins[0], quasarBasePlugins[1]) + mergedConfig.plugins.unshift(quasarBasePlugins[0], quasarBasePlugins[1]) return mergedConfig }
e30668139c173653ff962d393311f36cb64ab08f
test/components/Post.spec.js
test/components/Post.spec.js
import { expect } from 'chai'; import { mount } from 'enzyme'; import React from 'react'; import Post from '../../src/js/components/Post'; describe('<Post/>', () => { const post = { id: 0, title: 'Test Post', content: 'empty', description: 'empty', author: 'bot', slug: 'test-post', tags: ['test', 'react'], }; it('renders post title', () => { const result = mount(<Post post={post} />); expect(result.find('.post__title').text()).to.eq('Test Post'); }); it('renders post metadata', () => { const result = mount(<Post post={post} />); expect(result.find('.post__meta').text()).to.eq(' a few seconds ago'); }); it('renders post image', () => { const postWithImage = { ...post, img: 'image.png' }; const result = mount(<Post post={postWithImage} />); expect(result.find('.post__image').length).to.eq(1); }); it('renders no image if missing', () => { const result = mount(<Post post={post} />); expect(result.find('.post__image').length).to.eq(0); }); });
import { expect } from 'chai'; import { mount, shallow } from 'enzyme'; import React from 'react'; import Post from '../../src/js/components/Post'; describe('<Post/>', () => { const post = { id: 0, title: 'Test Post', content: 'empty', description: 'empty', author: 'bot', slug: 'test-post', tags: ['test', 'react'], }; it('renders post title', () => { const result = shallow(<Post post={post} />); expect(result.find('.post__title').text()).to.eq('Test Post'); }); it('renders post metadata', () => { const result = mount(<Post post={post} />); expect(result.find('.post__meta').text()).to.eq(' a few seconds ago'); }); it('renders post image', () => { const postWithImage = { ...post, img: 'image.png' }; const result = shallow(<Post post={postWithImage} />); expect(result.find('.post__image').length).to.eq(1); }); it('renders no image if missing', () => { const result = mount(<Post post={post} />); expect(result.find('.post__image').length).to.eq(0); }); });
Replace `mount` calls with `shallow` in <Post> tests
Replace `mount` calls with `shallow` in <Post> tests
JavaScript
mit
slavapavlutin/pavlutin-node,slavapavlutin/pavlutin-node
--- +++ @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { mount } from 'enzyme'; +import { mount, shallow } from 'enzyme'; import React from 'react'; import Post from '../../src/js/components/Post'; @@ -15,7 +15,7 @@ }; it('renders post title', () => { - const result = mount(<Post post={post} />); + const result = shallow(<Post post={post} />); expect(result.find('.post__title').text()).to.eq('Test Post'); }); @@ -26,7 +26,7 @@ it('renders post image', () => { const postWithImage = { ...post, img: 'image.png' }; - const result = mount(<Post post={postWithImage} />); + const result = shallow(<Post post={postWithImage} />); expect(result.find('.post__image').length).to.eq(1); });
4f1c3887f77927ac93daa825357b4bf94914d9f1
test/remove.js
test/remove.js
#!/usr/bin/env node 'use strict'; /** Load modules. */ var fs = require('fs'), path = require('path'); /** Resolve program params. */ var args = process.argv.slice(process.argv[0] === process.execPath ? 2 : 0), filePath = path.resolve(args[1]); var pattern = (function() { var result = args[0], delimiter = result.charAt(0), lastIndex = result.lastIndexOf(delimiter); return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1)); }()); /** Used to match lines of code. */ var reLine = /.*/gm; /*----------------------------------------------------------------------------*/ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf-8').replace(pattern, function(match) { return match.replace(reLine, ''); }), 'utf-8');
#!/usr/bin/env node 'use strict'; /** Load modules. */ var fs = require('fs'), path = require('path'); /** Resolve program params. */ var args = process.argv.slice(process.argv[0] === process.execPath ? 2 : 0), filePath = path.resolve(args[1]); var pattern = (function() { var result = args[0], delimiter = result.charAt(0), lastIndex = result.lastIndexOf(delimiter); return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1)); }()); /** Used to match lines of code. */ var reLine = /.*/gm; /*----------------------------------------------------------------------------*/ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf-8').replace(pattern, function(match) { return match.replace(reLine, ''); }));
Remove 'utf-8' option because it's the default.
Remove 'utf-8' option because it's the default.
JavaScript
mit
steelsojka/lodash,msmorgan/lodash,steelsojka/lodash,beaugunderson/lodash,boneskull/lodash,msmorgan/lodash,boneskull/lodash,rlugojr/lodash,beaugunderson/lodash,rlugojr/lodash
--- +++ @@ -24,4 +24,4 @@ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf-8').replace(pattern, function(match) { return match.replace(reLine, ''); -}), 'utf-8'); +}));
2b0dd27492594ee525eab38f6f4428d596d31207
tests/tests.js
tests/tests.js
QUnit.test( "hello test", function( assert ) { assert.ok( 1 == "1", "Passed!" ); });
QUnit.test( "getOptions default", function( assert ) { var options = $.fn.inputFileText.getOptions(); assert.equal(options.text, 'Choose File', 'Should return default text option when no text option is provided.'); assert.equal(options.remove, false, 'Should return default remove option when no text option is provided.'); });
Test that getOptions returns default options when none are provided
Test that getOptions returns default options when none are provided
JavaScript
mit
datchung/jquery.inputFileText,datchung/jquery.inputFileText
--- +++ @@ -1,3 +1,12 @@ -QUnit.test( "hello test", function( assert ) { - assert.ok( 1 == "1", "Passed!" ); +QUnit.test( "getOptions default", function( assert ) { + + var options = $.fn.inputFileText.getOptions(); + + assert.equal(options.text, + 'Choose File', + 'Should return default text option when no text option is provided.'); + + assert.equal(options.remove, + false, + 'Should return default remove option when no text option is provided.'); });
05f554d4bdd9f5e5af4959e97c29d6566f8824e0
app/scripts/directives/clojurepipeline.js
app/scripts/directives/clojurepipeline.js
'use strict'; /** * @ngdoc directive * @name grafterizerApp.directive:clojurePipeline * @description * # clojurePipeline */ angular.module('grafterizerApp') .directive('clojurePipeline', function (generateClojure) { return { template: '<div ui-codemirror="editorOptions" ng-model="clojure"></div>', restrict: 'E', scope: { transformation: '=', }, link: { pre: function(scope) { scope.editorOptions = { lineWrapping : true, // lineNumbers: true, mode: 'clojure', readOnly: true }; }, post: function(scope, element, attrs) { scope.$watch('transformation', function(){ if (!scope.transformation) { return; } // console.log(scope.transformation) scope.clojure = generateClojure.fromTransformation(scope.transformation); }, true); } } }; });
'use strict'; /** * @ngdoc directive * @name grafterizerApp.directive:clojurePipeline * @description * # clojurePipeline */ angular.module('grafterizerApp') .directive('clojurePipeline', function (generateClojure) { return { template: '<div ui-codemirror="editorOptions" ng-model="clojure"></div>', restrict: 'E', scope: { transformation: '=', }, link: { pre: function(scope) { scope.editorOptions = { lineWrapping : true, // lineNumbers: true, mode: 'clojure', readOnly: true }; }, post: function(scope, element, attrs) { scope.$watch('transformation', function(){ if (!scope.transformation) { return; } // console.log(scope.transformation) scope.clojure = generateClojure.fromTransformation(scope.transformation); }, true); // TODO workaround random bug scope.$watch("$parent.selectedTabIndex", function(){ if (scope['$parent'].selectedTabIndex) { window.setTimeout(function(){ try { element.children().children()[0].CodeMirror.refresh(); }catch(e){} }, 1); } }); } } }; });
Refresh the CodeMirror view if it's inside a md-tabs
Refresh the CodeMirror view if it's inside a md-tabs Featuring a setTimeout
JavaScript
epl-1.0
datagraft/grafterizer,dapaas/grafterizer,dapaas/grafterizer,datagraft/grafterizer
--- +++ @@ -31,6 +31,17 @@ // console.log(scope.transformation) scope.clojure = generateClojure.fromTransformation(scope.transformation); }, true); + + // TODO workaround random bug + scope.$watch("$parent.selectedTabIndex", function(){ + if (scope['$parent'].selectedTabIndex) { + window.setTimeout(function(){ + try { + element.children().children()[0].CodeMirror.refresh(); + }catch(e){} + }, 1); + } + }); } } };
a8b64f852c6e223b21a4052fa9af885e79f6692e
app/server/shared/api-server/api-error.js
app/server/shared/api-server/api-error.js
/** * Copyright © 2017 Highpine. All rights reserved. * * @author Max Gopey <gopeyx@gmail.com> * @copyright 2017 Highpine * @license https://opensource.org/licenses/MIT MIT License */ class ApiError { constructor(message) { this.message = message; this.stack = Error().stack; } static withStatusCode (statusCode, message) { let apiError = new ApiError(message); apiError.status = statusCode; return apiError; }; } module.exports = ApiError;
/** * Copyright © 2017 Highpine. All rights reserved. * * @author Max Gopey <gopeyx@gmail.com> * @copyright 2017 Highpine * @license https://opensource.org/licenses/MIT MIT License */ class ApiError extends Error { constructor(message, id) { super(message, id); this.message = message; this.stack = Error().stack; } static withStatusCode (statusCode, message) { let apiError = new ApiError(message); apiError.status = statusCode; return apiError; }; } module.exports = ApiError;
Add inheritance from Error for ApiError
Add inheritance from Error for ApiError
JavaScript
mit
highpine/highpine,highpine/highpine,highpine/highpine
--- +++ @@ -6,8 +6,9 @@ * @license https://opensource.org/licenses/MIT MIT License */ -class ApiError { - constructor(message) { +class ApiError extends Error { + constructor(message, id) { + super(message, id); this.message = message; this.stack = Error().stack; }
fbb7654967bb83d7c941e9eef6a87162fbff676b
src/actions/index.js
src/actions/index.js
// import axios from 'axios'; export const FETCH_SEARCH_RESULTS = 'fetch_search_results'; // const ROOT_URL = 'http://herokuapp.com/'; export function fetchSearchResults(term, location) { // const request = axios.get(`${ROOT_URL}/${term}/${location}`); const testJSON = { data: [ { name: 'Michael Mina', url: 'yelp.com/michaelminna' }, { name: 'Sushi', url: 'yelp.com/sushi' }, { name: 'Thai', url: 'yelp.com/thai' }, { name: 'Chinese', url: 'yelp.com/chinese' } ] }; return { type: FETCH_SEARCH_RESULTS, payload: testJSON } }
import axios from 'axios'; export const FETCH_SEARCH_RESULTS = 'fetch_search_results'; const ROOT_URL = 'https://earlybirdsearch.herokuapp.com/?'; export function fetchSearchResults(term, location) { const request = axios.get(`${ROOT_URL}business=${term}&location=${location}`); console.log(request); // const testJSON = { // data: [ // { name: 'Michael Mina', url: 'yelp.com/michaelminna' }, // { name: 'Sushi', url: 'yelp.com/sushi' }, // { name: 'Thai', url: 'yelp.com/thai' }, // { name: 'Chinese', url: 'yelp.com/chinese' } // ] // }; return { type: FETCH_SEARCH_RESULTS, payload: request } }
Add heroku url to axios request
Add heroku url to axios request
JavaScript
mit
EarlyRavens/ReactJSFrontEnd,EarlyRavens/ReactJSFrontEnd
--- +++ @@ -1,23 +1,25 @@ -// import axios from 'axios'; +import axios from 'axios'; export const FETCH_SEARCH_RESULTS = 'fetch_search_results'; -// const ROOT_URL = 'http://herokuapp.com/'; +const ROOT_URL = 'https://earlybirdsearch.herokuapp.com/?'; export function fetchSearchResults(term, location) { - // const request = axios.get(`${ROOT_URL}/${term}/${location}`); + const request = axios.get(`${ROOT_URL}business=${term}&location=${location}`); - const testJSON = { - data: [ - { name: 'Michael Mina', url: 'yelp.com/michaelminna' }, - { name: 'Sushi', url: 'yelp.com/sushi' }, - { name: 'Thai', url: 'yelp.com/thai' }, - { name: 'Chinese', url: 'yelp.com/chinese' } - ] - }; + console.log(request); + + // const testJSON = { + // data: [ + // { name: 'Michael Mina', url: 'yelp.com/michaelminna' }, + // { name: 'Sushi', url: 'yelp.com/sushi' }, + // { name: 'Thai', url: 'yelp.com/thai' }, + // { name: 'Chinese', url: 'yelp.com/chinese' } + // ] + // }; return { type: FETCH_SEARCH_RESULTS, - payload: testJSON + payload: request } }
c6dc037de56ebc5b1beb853cc89478c1228f95b9
lib/repositories/poets_repository.js
lib/repositories/poets_repository.js
var _ = require('underscore'); module.exports = function(dbConfig) { var db = require('./poemlab_database')(dbConfig); return { create: function(user_data, callback) { var params = _.values(_.pick(user_data, ["name", "email", "password"])); db.query("insert into poets (name, email, password) values ($1, $2, $3) returning id", params, function(err, result) { if (err) { return callback(err); } var user = { id: result.rows[0].id }; callback(null, user); } ); }, read: function(user_id, callback) { db.query("select * from poets where id = $1", [user_id], function(err, result) { if (err) { return callback(err); } callback(null, result.rows[0]); }); }, destroy: function(user_id, callback) { db.query("delete from poets where id = $1", [user_id], function(err, result) { callback(err); }); }, all: function(callback) { db.query("select * from poets", [], function(err, result) { if (err) { return callback(err); } callback(null, result.rows); }); } }; };
var _ = require('underscore'); module.exports = function(dbConfig) { var db = require('./poemlab_database')(dbConfig); return { create: function(user_data, callback) { var params = _.values(_.pick(user_data, ["name", "email", "password"])); db.query("insert into poets (name, email, password) values ($1, $2, $3) " + "returning id, name, email", params, function(err, result) { if (err) { return callback(err); } callback(null, result.rows[0]); } ); }, read: function(user_id, callback) { db.query("select * from poets where id = $1", [user_id], function(err, result) { if (err) { return callback(err); } callback(null, result.rows[0]); }); }, destroy: function(user_id, callback) { db.query("delete from poets where id = $1", [user_id], function(err, result) { callback(err); }); }, all: function(callback) { db.query("select * from poets", [], function(err, result) { if (err) { return callback(err); } callback(null, result.rows); }); } }; };
Return all poet attributes except password from create method
Return all poet attributes except password from create method
JavaScript
mit
jimguys/poemlab,jimguys/poemlab
--- +++ @@ -8,11 +8,11 @@ create: function(user_data, callback) { var params = _.values(_.pick(user_data, ["name", "email", "password"])); - db.query("insert into poets (name, email, password) values ($1, $2, $3) returning id", params, + db.query("insert into poets (name, email, password) values ($1, $2, $3) " + + "returning id, name, email", params, function(err, result) { if (err) { return callback(err); } - var user = { id: result.rows[0].id }; - callback(null, user); + callback(null, result.rows[0]); } ); },
f620f2919897b40b9f960a3e147c54be0d0d6549
src/cssrelpreload.js
src/cssrelpreload.js
/*! CSS rel=preload polyfill. Depends on loadCSS function. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */ (function( w ){ // rel=preload support test if( !w.loadCSS ){ return; } var rp = loadCSS.relpreload = {}; rp.support = function(){ try { return w.document.createElement( "link" ).relList.supports( "preload" ); } catch (e) { return false; } }; // loop preload links and fetch using loadCSS rp.poly = function(){ var links = w.document.getElementsByTagName( "link" ); for( var i = 0; i < links.length; i++ ){ var link = links[ i ]; if( link.rel === "preload" && link.getAttribute( "as" ) === "style" ){ w.loadCSS( link.href, link ); link.rel = null; } } }; // if link[rel=preload] is not supported, we must fetch the CSS manually using loadCSS if( !rp.support() ){ rp.poly(); var run = w.setInterval( rp.poly, 300 ); if( w.addEventListener ){ w.addEventListener( "load", function(){ w.clearInterval( run ); } ); } if( w.attachEvent ){ w.attachEvent( "onload", function(){ w.clearInterval( run ); } ) } } }( this ));
/*! CSS rel=preload polyfill. Depends on loadCSS function. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */ (function( w ){ // rel=preload support test if( !w.loadCSS ){ return; } var rp = loadCSS.relpreload = {}; rp.support = function(){ try { return w.document.createElement( "link" ).relList.supports( "preload" ); } catch (e) { return false; } }; // loop preload links and fetch using loadCSS rp.poly = function(){ var links = w.document.getElementsByTagName( "link" ); for( var i = 0; i < links.length; i++ ){ var link = links[ i ]; if( link.rel === "preload" && link.getAttribute( "as" ) === "style" ){ w.loadCSS( link.href, link ); link.rel = null; } } }; // if link[rel=preload] is not supported, we must fetch the CSS manually using loadCSS if( !rp.support() ){ rp.poly(); var run = w.setInterval( rp.poly, 300 ); if( w.addEventListener ){ w.addEventListener( "load", function(){ rp.poly(); w.clearInterval( run ); } ); } if( w.attachEvent ){ w.attachEvent( "onload", function(){ w.clearInterval( run ); } ) } } }( this ));
Fix for bug where script might not be called
Fix for bug where script might not be called Firefox and IE/Edge won't load links that appear after the polyfill. What I think has been happening is the w.load event fires and clears the "run" interval before it has a chance to load styles that occur in between the last interval. This addition calls the rp.poly function one last time to make sure it catches any that occur within that interval gap. Original demo with link after polyfill (non-working in Firefox, IE, Edge): http://s.codepen.io/fatjester/debug/gMMrxv Modified version with link after polyfill (is working in Firefox, IE, Edge): http://s.codepen.io/fatjester/debug/gMMrxv #180
JavaScript
mit
filamentgroup/loadCSS,filamentgroup/loadCSS
--- +++ @@ -31,6 +31,7 @@ var run = w.setInterval( rp.poly, 300 ); if( w.addEventListener ){ w.addEventListener( "load", function(){ + rp.poly(); w.clearInterval( run ); } ); }
dc706a5bc91d647fade86d3f9d948a95e447be35
javascript/signup.js
javascript/signup.js
function submitEmail() { var button = document.getElementById('submit'); button.onclick = function() { var parent = document.getElementById('parent').value; var phone = document.getElementById('phone-number').value; var student = document.getElementById('student').value; var age = document.getElementById('age').value; var allergies = document.getElementById('allergies').value; var comments = document.getElementById('comments').value; var mailto = 'mailto:gpizarro@javaman.net'; var subject = '&subject=I%20Would%20Like%20To%20Sign%20My%20Child%20Up'; var body = '&body='; body += 'I would like to sign ' + student + ' up for Code Reboot 2017.'; body += ' ' + student + ' is ' + age + ' years old.'; if(allergies != '') { body += '%0A %0AAllergies: %0A' + allergies; } if(comments != '') { body += '%0A %0AMy Comments: %0A' + comments; } body += '%0A %0AThank you, %0A' + parent + ' %0A' + phone; console.log(mailto + subject + body); window.location.replace(mailto + subject + body); } }
function submitEmail() { var button = document.getElementById('submit'); button.onclick = function() { var parent = document.getElementById('parent').value; var phone = document.getElementById('phone-number').value; var student = document.getElementById('student').value; var age = document.getElementById('age').value; var allergies = document.getElementById('allergies').value; var comments = document.getElementById('comments').value; var mailto = 'mailto:gpizarro@javaman.net'; var subject = '?subject=I%20Would%20Like%20To%20Sign%20My%20Child%20Up'; var body = '&body='; body += 'I would like to sign ' + student + ' up for Code Reboot 2017.'; body += ' ' + student + ' is ' + age + ' years old.'; if(allergies != '') { body += '%0A %0AAllergies: %0A' + allergies; } if(comments != '') { body += '%0A %0AMy Comments: %0A' + comments; } body += '%0A %0AThank you, %0A' + parent + ' %0A' + phone; console.log(mailto + subject + body); window.location.replace(mailto + subject + body); } }
Change & to ? | FIXED
Change & to ? | FIXED
JavaScript
apache-2.0
Coding-Camp-2017/website,Coding-Camp-2017/website
--- +++ @@ -9,7 +9,7 @@ var comments = document.getElementById('comments').value; var mailto = 'mailto:gpizarro@javaman.net'; - var subject = '&subject=I%20Would%20Like%20To%20Sign%20My%20Child%20Up'; + var subject = '?subject=I%20Would%20Like%20To%20Sign%20My%20Child%20Up'; var body = '&body='; body += 'I would like to sign ' + student + ' up for Code Reboot 2017.'; body += ' ' + student + ' is ' + age + ' years old.';
c3609cbe9d33222f2bd5c466b874f4943094143f
src/middleware/authenticate.js
src/middleware/authenticate.js
export default (config) => { if ( ! config.enabled) return (req, res, next) => { next() } var header = (config.header || 'Authorization').toLowerCase() var tokenLength = 32 var tokenRegExp = new RegExp(`^Token ([a-zA-Z0-9]{${tokenLength}})$`) return (req, res, next) => { var value = req.headers[header] var err req.auth = { header: value } if ( ! req.auth.header) { err = new Error(`Missing ${config.header} header.`) err.statusCode = 401 return next(err) } if (config.byToken) { var token = value.replace(tokenRegExp, '$1') if (token.length !== tokenLength) { err = new Error('Invalid token.') err.statusCode = 401 return next(err) } req.auth.token = token } if ( ! config.method) return next() config.method(req, config, req.data, (err, user) => { if (err) { err = new Error(err) err.statusCode = 401 return next(err) } req.user = user next() }) } }
export default (config) => { if ( ! config.enabled) return (req, res, next) => { next() } var verifyHeader = ( !! config.header) var header = (config.header || '').toLowerCase() var tokenLength = 32 var tokenRegExp = new RegExp(`^Token ([a-zA-Z0-9]{${tokenLength}})$`) return (req, res, next) => { var err req.auth = {} if (verifyHeader) { var value = req.auth.header = req.headers[header] if ( ! value) { err = new Error(`Missing ${config.header} header.`) err.statusCode = 401 return next(err) } if (config.byToken) { var token = value.replace(tokenRegExp, '$1') if (token.length !== tokenLength) { err = new Error('Invalid token.') err.statusCode = 401 return next(err) } req.auth.token = token } } if ( ! config.method) return next() config.method(req, config, req.data, (err, user) => { if (err) { err = new Error(err) err.statusCode = 401 return next(err) } req.user = user next() }) } }
Make request header optional in authentication middleware.
Make request header optional in authentication middleware.
JavaScript
mit
kukua/concava
--- +++ @@ -1,31 +1,36 @@ export default (config) => { if ( ! config.enabled) return (req, res, next) => { next() } - var header = (config.header || 'Authorization').toLowerCase() + var verifyHeader = ( !! config.header) + var header = (config.header || '').toLowerCase() var tokenLength = 32 var tokenRegExp = new RegExp(`^Token ([a-zA-Z0-9]{${tokenLength}})$`) return (req, res, next) => { - var value = req.headers[header] var err - req.auth = { header: value } - if ( ! req.auth.header) { - err = new Error(`Missing ${config.header} header.`) - err.statusCode = 401 - return next(err) - } + req.auth = {} - if (config.byToken) { - var token = value.replace(tokenRegExp, '$1') + if (verifyHeader) { + var value = req.auth.header = req.headers[header] - if (token.length !== tokenLength) { - err = new Error('Invalid token.') + if ( ! value) { + err = new Error(`Missing ${config.header} header.`) err.statusCode = 401 return next(err) } - req.auth.token = token + if (config.byToken) { + var token = value.replace(tokenRegExp, '$1') + + if (token.length !== tokenLength) { + err = new Error('Invalid token.') + err.statusCode = 401 + return next(err) + } + + req.auth.token = token + } } if ( ! config.method) return next()
983c7b9e42902589a4d893b8d327a49650a761c9
src/fuzzy-wrapper.js
src/fuzzy-wrapper.js
import React from 'react'; import PropTypes from "prop-types"; export default class FuzzyWrapper extends React.Component { constructor(props) { super(); this.state = { isOpen: false, }; // create a bound function to invoke when keys are pressed on the body. this.keyEvent = (function(event) { if (this.props.isKeyPressed(event)) { event.preventDefault(); this.setState({isOpen: !this.state.isOpen}); } }).bind(this); } componentDidMount() { document.body.addEventListener('keydown', this.keyEvent); } componentWillUnmount() { document.body.removeEventListener('keydown', this.keyEvent); } // Called by the containing fuzzysearcher to close itself. onClose() { this.setState({isOpen: false}); } render() { return this.props.popup( this.state.isOpen, this.onClose.bind(this), ); } } FuzzyWrapper.PropTypes = { isKeyPressed: PropTypes.func.isRequired, popup: PropTypes.func.isRequired, }; FuzzyWrapper.defaultProps = { isKeyPressed: () => false, popup: () => null, };
import React from 'react'; import PropTypes from "prop-types"; export default class FuzzyWrapper extends React.Component { constructor(props) { super(); this.state = { isOpen: false, }; // create a bound function to invoke when keys are pressed on the body. this.keyEvent = (function(event) { if (this.props.isKeyPressed(event)) { event.preventDefault(); this.setState({isOpen: !this.state.isOpen}); } }).bind(this); } componentDidMount() { document.body.addEventListener('keydown', this.keyEvent); } componentWillUnmount() { document.body.removeEventListener('keydown', this.keyEvent); } // Called by the containing fuzzysearcher to close itself. onClose() { this.setState({isOpen: false}); } render() { return this.props.popup( this.state.isOpen, this.onClose.bind(this), ); } } FuzzyWrapper.propTypes = { isKeyPressed: PropTypes.func.isRequired, popup: PropTypes.func.isRequired, }; FuzzyWrapper.defaultProps = { isKeyPressed: () => false, popup: () => null, };
Fix propTypes warning in FuzzyWrapper
Fix propTypes warning in FuzzyWrapper
JavaScript
mit
1egoman/fuzzy-picker
--- +++ @@ -34,7 +34,7 @@ ); } } -FuzzyWrapper.PropTypes = { +FuzzyWrapper.propTypes = { isKeyPressed: PropTypes.func.isRequired, popup: PropTypes.func.isRequired, };
365e1016f05fab1b739b318d5bfacaa926bc8f96
src/lib/getIssues.js
src/lib/getIssues.js
const Request = require('request'); module.exports = (user, cb) => { Request.get({ url: `https://api.github.com/users/${user}/repos`, headers: { 'User-Agent': 'GitPom' } }, cb); };
const Request = require('request'); module.exports = (options, cb) => { Request.get({ url: `https://api.github.com/repos/${options.repoOwner}/${options.repoName}/issues`, headers: { 'User-Agent': 'GitPom', Accept: `application/vnd.github.v3+json`, Authorization: `token ${options.access_token}` } }, cb); };
Build module to fetch issues for a selected repo
Build module to fetch issues for a selected repo
JavaScript
mit
The-Authenticators/gitpom,The-Authenticators/gitpom
--- +++ @@ -1,10 +1,12 @@ const Request = require('request'); -module.exports = (user, cb) => { +module.exports = (options, cb) => { Request.get({ - url: `https://api.github.com/users/${user}/repos`, + url: `https://api.github.com/repos/${options.repoOwner}/${options.repoName}/issues`, headers: { - 'User-Agent': 'GitPom' + 'User-Agent': 'GitPom', + Accept: `application/vnd.github.v3+json`, + Authorization: `token ${options.access_token}` } }, cb); };
07b845fc27fdd3ef75f517e6554a1fef762233b7
client/js/helpers/rosetexmanager.js
client/js/helpers/rosetexmanager.js
'use strict'; function _RoseTextureManager() { this.textures = {}; } _RoseTextureManager.prototype.normalizePath = function(path) { return path; }; _RoseTextureManager.prototype._load = function(path, callback) { var tex = DDS.load(path, function() { if (callback) { callback(); } }); tex.minFilter = tex.magFilter = THREE.LinearFilter; return tex; }; _RoseTextureManager.prototype.load = function(path, callback) { var normPath = this.normalizePath(path); var foundTex = this.textures[normPath]; if (foundTex) { if (callback) { callback(); } return foundTex; } var newTex = this._load(path, callback); this.textures[normPath] = newTex; return newTex; }; var RoseTextureManager = new _RoseTextureManager();
'use strict'; function _RoseTextureManager() { this.textures = {}; } _RoseTextureManager.prototype._load = function(path, callback) { var tex = DDS.load(path, function() { if (callback) { callback(); } }); tex.minFilter = tex.magFilter = THREE.LinearFilter; return tex; }; _RoseTextureManager.prototype.load = function(path, callback) { var normPath = normalizePath(path); var foundTex = this.textures[normPath]; if (foundTex) { if (callback) { callback(); } return foundTex; } var newTex = this._load(path, callback); this.textures[normPath] = newTex; return newTex; }; var RoseTextureManager = new _RoseTextureManager();
Make RoseTexManager use global normalizePath.
Make RoseTexManager use global normalizePath.
JavaScript
agpl-3.0
brett19/rosebrowser,brett19/rosebrowser,Jiwan/rosebrowser,exjam/rosebrowser,Jiwan/rosebrowser,exjam/rosebrowser
--- +++ @@ -3,10 +3,6 @@ function _RoseTextureManager() { this.textures = {}; } - -_RoseTextureManager.prototype.normalizePath = function(path) { - return path; -}; _RoseTextureManager.prototype._load = function(path, callback) { var tex = DDS.load(path, function() { @@ -19,7 +15,7 @@ }; _RoseTextureManager.prototype.load = function(path, callback) { - var normPath = this.normalizePath(path); + var normPath = normalizePath(path); var foundTex = this.textures[normPath]; if (foundTex) {
fa40d7c3a2bdb01a72855103fa72095667fddb71
js/application.js
js/application.js
// View $(document).ready(function() { console.log("Ready!"); // initialize the game and create a board var game = new Game(); PopulateBoard(game.flattenBoard()); //Handles clicks on the checkers board $(".board").on("click", function(e){ e.preventDefault(); game.test(game); }) // .board on click, a funciton }) // end (document).ready var PopulateBoard = function(board){ board.forEach(function(value, index){ if (value == "green"){ console.log("GREEN"); console.log(index); $(".board").append($.parseHTML('<a href="'+(index+1)+'" id="square'+(index+1)+'" class="green"></a>')); } else if (value == "blue"){ console.log("blue"); // $(".board").append($.parseHTML('<a href="'+(index+1)+'" id="square'+(index+1)+'" class="blue"></a>')); } else if (value == "empty"){ console.log("Empty"); } }) }
// View $(document).ready(function() { console.log("Ready!"); // initialize the game and create a board var game = new Game(); PopulateBoard(game.flattenBoard()); //Handles clicks on the checkers board $(".board").on("click", function(e){ e.preventDefault(); game.test(game); }) // .board on click, a funciton }) // end (document).ready var PopulateBoard = function(board){ board.forEach(function(value, index){ if (value == "green"){ console.log("GREEN"); console.log(index); $(".board").append($.parseHTML('<a href="'+(index+1)+'" id="square'+(index+1)+'" class="green"></a>')); } else if (value == "blue"){ console.log("blue"); // $(".board").append($.parseHTML('<a href="'+(index+1)+'" id="square'+(index+1)+'" class="blue"></a>')); } else if (value == "empty"){ console.log("Empty"); } else { $(".board").append($.parseHTML('<div class="null"></div>')); } }) }
Add else to into populate board to create a div elemento for the not used squares
Add else to into populate board to create a div elemento for the not used squares
JavaScript
mit
RenanBa/checkers-v1,RenanBa/checkers-v1
--- +++ @@ -27,6 +27,9 @@ // $(".board").append($.parseHTML('<a href="'+(index+1)+'" id="square'+(index+1)+'" class="blue"></a>')); } else if (value == "empty"){ console.log("Empty"); + } else { + $(".board").append($.parseHTML('<div class="null"></div>')); } + }) }
87cf25bf581b4c96562f884d4b9c329c3c36a469
lib/config.js
lib/config.js
'use strict'; var _ = require('lodash') , defaultConf, developmentConf, env, extraConf, productionConf, testConf; env = process.env.NODE_ENV || 'development'; defaultConf = { logger: 'dev', port: process.env.PORT || 3000, mongoUri: 'mongodb://localhost/SecureChat' }; developmentConf = {}; productionConf = { mongoUri: process.env.MONGOLAB_URI }; testConf = { mongoUri: 'mongodb://localhost/SecureChatTest' }; extraConf = { development: developmentConf, production: productionConf, test: testConf }[env]; module.exports = _.merge(defaultConf, extraConf);
'use strict'; var _ = require('lodash') , defaultConf, developmentConf, env, extraConf, productionConf, testConf; env = process.env.NODE_ENV || 'development'; defaultConf = { port: process.env.PORT || 3000, }; developmentConf = { logger: 'dev', mongoUri: 'mongodb://localhost/SecureChat' }; productionConf = { logger: 'default', mongoUri: process.env.MONGOLAB_URI }; testConf = { logger: function () {}, mongoUri: 'mongodb://localhost/SecureChatTest' }; extraConf = { development: developmentConf, production: productionConf, test: testConf }[env]; module.exports = _.merge(defaultConf, extraConf);
Change loggers and move some options
Change loggers and move some options
JavaScript
mit
Hilzu/SecureChat
--- +++ @@ -6,18 +6,21 @@ env = process.env.NODE_ENV || 'development'; defaultConf = { + port: process.env.PORT || 3000, +}; + +developmentConf = { logger: 'dev', - port: process.env.PORT || 3000, mongoUri: 'mongodb://localhost/SecureChat' }; -developmentConf = {}; - productionConf = { + logger: 'default', mongoUri: process.env.MONGOLAB_URI }; testConf = { + logger: function () {}, mongoUri: 'mongodb://localhost/SecureChatTest' };
028b0c515a4d5e0bf26ca76cb101272b49f25219
client/index.js
client/index.js
// client start file const Display = require('./interface.js'); const network = require('./network.js'); let dis = new Display(); // TODO: placeholder nick let nick = "Kneelawk"; // TODO: placeholder server let server = "http://localhost:8080"; let session; network.login(server, nick).on('login', (body) => { session = body; }).on('error', (error) => { // TODO: error handling }); let lastTime = 0; let updateLoopId = setInterval(() => { network.update(server, lastTime).on('response', (messages) => { if (messages && messages.length > 0) { messages.sort((a, b) => { if (a.timestamp > b.timestamp) return 1; else if (a.timestamp < b.timestamp) return -1; else return 0; }); messages.forEach((element) => { dis.recieve(element.timestamp, element.nick, element.body); }); lastTime = messages[messages.length - 1].timestamp; } }).on('error', (error) => { // TODO: error handling }); }, 1000); // checking every second should be good enough // TODO: get input from user // TODO: stopping the client and disconnecting
// client start file const Display = require('./interface.js'); const network = require('./network.js'); let dis = new Display(); // TODO: placeholder nick let nick = "Kneelawk"; // TODO: placeholder server let server = "http://localhost:8080"; let session; network.login(server, nick).on('login', (body) => { if (!body) { // TODO: more error handling } session = body; }).on('error', (error) => { // TODO: error handling }); let lastTime = 0; let updateLoopId = setInterval(() => { network.update(server, lastTime).on('response', (messages) => { if (messages && messages.length > 0) { messages.sort((a, b) => { if (a.timestamp > b.timestamp) return 1; else if (a.timestamp < b.timestamp) return -1; else return 0; }); messages.forEach((element) => { dis.recieve(element.timestamp, element.nick, element.body); }); lastTime = messages[messages.length - 1].timestamp; } }).on('error', (error) => { // TODO: error handling }); }, 1000); // checking every second should be good enough // TODO: get input from user // TODO: stopping the client and disconnecting
Add check for invalid connection
Add check for invalid connection
JavaScript
mit
PokerDaddy/scaling-potato,PokerDaddy/scaling-potato
--- +++ @@ -12,6 +12,9 @@ let session; network.login(server, nick).on('login', (body) => { + if (!body) { + // TODO: more error handling + } session = body; }).on('error', (error) => { // TODO: error handling
beb7349f523e7087979260698c9e799684ecc531
scripts/components/button-group.js
scripts/components/button-group.js
'use strict'; var VNode = require('virtual-dom').VNode; var VText = require('virtual-dom').VText; /** * Button. * * @param {object} props * @param {string} props.text * @param {function} [props.onClick] * @param {string} [props.style=primary] * @param {string} [props.type=button] * @returns {VNode} */ function button(props) { var className = 'coins-logon-widget-button'; var onClick = props.onClick; var style = props.style || 'primary'; var text = props.text; var type = props.type || 'button'; className += ' coins-logon-widget-button-' + style; var properties = { className: className, type: type, }; if (onClick) { properties.onclick = onClick; } return new VNode('button', properties, [new VText(text)]); } /** * Button group. * * @see button * * @{param} {...object} props Properties passed to `button` * @returns {VNode} */ function buttonGroup(props) { var children = arguments.length > 1 ? [].slice.call(arguments).map(button) : [button(props)]; var className = 'coins-logon-widget-button-group'; return new VNode('div', { className: className }, children); } module.exports = buttonGroup;
'use strict'; var VNode = require('virtual-dom').VNode; var VText = require('virtual-dom').VText; /** * Button. * @private * * @param {object} props * @param {string} props.text * @param {function} [props.onClick] * @param {string} [props.style=primary] * @param {string} [props.type=button] * @returns {VNode} */ function _button(props) { var className = 'coins-logon-widget-button'; var onClick = props.onClick; var style = props.style || 'primary'; var text = props.text; var type = props.type || 'button'; className += ' coins-logon-widget-button-' + style; var properties = { className: className, type: type, }; if (onClick) { properties.onclick = onClick; } return new VNode('button', properties, [new VText(text)]); } /** * Button group. * * @see button * * @{param} {...object} props Properties passed to `button` * @returns {VNode} */ function buttonGroup(props) { var children = arguments.length > 1 ? [].slice.call(arguments).map(_button) : [_button(props)]; var className = 'coins-logon-widget-button-group'; return new VNode('div', { className: className }, children); } module.exports = buttonGroup;
Make 'button' component more obviously private.
Make 'button' component more obviously private.
JavaScript
mit
MRN-Code/coins-logon-widget,MRN-Code/coins-logon-widget
--- +++ @@ -5,6 +5,7 @@ /** * Button. + * @private * * @param {object} props * @param {string} props.text @@ -13,7 +14,7 @@ * @param {string} [props.type=button] * @returns {VNode} */ -function button(props) { +function _button(props) { var className = 'coins-logon-widget-button'; var onClick = props.onClick; var style = props.style || 'primary'; @@ -44,8 +45,8 @@ */ function buttonGroup(props) { var children = arguments.length > 1 ? - [].slice.call(arguments).map(button) : - [button(props)]; + [].slice.call(arguments).map(_button) : + [_button(props)]; var className = 'coins-logon-widget-button-group'; return new VNode('div', { className: className }, children);
b8864dc79530a57b5974bed932adb0e4c6ccf73c
server/api/nodes/nodeController.js
server/api/nodes/nodeController.js
var Node = require('./nodeModel.js'), handleError = require('../../util.js').handleError, handleQuery = require('../queryHandler.js'); module.exports = { createNode : function (req, res, next) { var newNode = req.body; // Support /nodes and /roadmaps/roadmapID/nodes newNode.parentRoadmap = newNode.parentRoadmap || req.params.roadmapID; Node(newNode).save() .then(function(dbResults){ res.status(201).json(dbResults); }) .catch(handleError(next)); }, getNodeByID : function (req, res, next) { var _id = req.params.nodeID; Node.findById(_id) .then(function(dbResults){ res.json(dbResults); }) .catch(handleError(next)); }, updateNode : function (req, res, next) { var _id = req.params.nodeID; var updateCommand = req.body; Node.findByIdAndUpdate(_id, updateCommand) .then(function(dbResults){ res.json(dbResults); }) .catch(handleError(next)); }, deleteNode : function (req, res, next) { } };
var Node = require('./nodeModel.js'), handleError = require('../../util.js').handleError, handleQuery = require('../queryHandler.js'); module.exports = { createNode : function (req, res, next) { var newNode = req.body; // Support /nodes and /roadmaps/roadmapID/nodes newNode.parentRoadmap = newNode.parentRoadmap || req.params.roadmapID; Node(newNode).save() .then(function(dbResults){ res.status(201).json(dbResults); }) .catch(handleError(next)); }, getNodeByID : function (req, res, next) { var _id = req.params.nodeID; Node.findById(_id) .then(function(dbResults){ res.json(dbResults); }) .catch(handleError(next)); }, updateNode : function (req, res, next) { var _id = req.params.nodeID; var updateCommand = req.body; Node.findByIdAndUpdate(_id, updateCommand) .then(function(dbResults){ res.json(dbResults); }) .catch(handleError(next)); }, deleteNode : function (req, res, next) { var _id = req.params.nodeID; Node.findByIdAndRemove(_id) .then(function(dbResults){ res.json(dbResults); }) .catch(handleError(next)); } };
Add route handler for DELETE /api/nodes/:nodeID
Add route handler for DELETE /api/nodes/:nodeID
JavaScript
mit
sreimer15/RoadMapToAnything,GMeyr/RoadMapToAnything,delventhalz/RoadMapToAnything,cyhtan/RoadMapToAnything,sreimer15/RoadMapToAnything,cyhtan/RoadMapToAnything,RoadMapToAnything/RoadMapToAnything,GMeyr/RoadMapToAnything,RoadMapToAnything/RoadMapToAnything,delventhalz/RoadMapToAnything
--- +++ @@ -35,7 +35,12 @@ }, deleteNode : function (req, res, next) { - + var _id = req.params.nodeID; + Node.findByIdAndRemove(_id) + .then(function(dbResults){ + res.json(dbResults); + }) + .catch(handleError(next)); } };
2cbe06fdf4fa59605cb41a5f6bfb9940530989b5
src/schemas/index.js
src/schemas/index.js
import {header} from './header'; import {mime} from './mime'; import {security} from './security'; import {tags} from './tags'; import {paths} from './paths'; import {types} from './types'; export const fieldsToShow = { 'header': [ 'info', 'contact', 'license', 'host', 'basePath' ], 'types': ['definitions'], 'mime': ['consumes', 'produces'] }; export const schema = { 'type': 'object', 'children': { header, mime, security, tags, paths, types, 'definitions': { 'type': 'link', 'target': '/types' }, 'info': { 'type': 'link', 'target': '/header/info' }, 'contact': { 'type': 'link', 'target': '/header/contact' }, 'license': { 'type': 'link', 'target': '/header/license' }, 'host': { 'type': 'link', 'target': '/header/host/host' }, 'basePath': { 'type': 'link', 'target': '/header/host/basePath' }, 'schemes': { 'type': 'link', 'target': '/header/host/schemes' }, 'consumes': { 'type': 'link', 'target': '/mime/consumes' }, 'produces': { 'type': 'link', 'target': '/mime/produces' } } };
import {header} from './header'; import {mime} from './mime'; import {security} from './security'; import {tags} from './tags'; import {paths} from './paths'; import {types} from './types'; export const fieldsToShow = { 'header': [ 'info', 'contact', 'license', 'host', 'basePath', 'schemes' ], 'types': ['definitions'], 'mime': ['consumes', 'produces'] }; export const schema = { 'type': 'object', 'children': { header, mime, security, tags, paths, types, 'definitions': { 'type': 'link', 'target': '/types' }, 'info': { 'type': 'link', 'target': '/header/info' }, 'contact': { 'type': 'link', 'target': '/header/contact' }, 'license': { 'type': 'link', 'target': '/header/license' }, 'host': { 'type': 'link', 'target': '/header/host/host' }, 'basePath': { 'type': 'link', 'target': '/header/host/basePath' }, 'schemes': { 'type': 'link', 'target': '/header/host/schemes' }, 'consumes': { 'type': 'link', 'target': '/mime/consumes' }, 'produces': { 'type': 'link', 'target': '/mime/produces' } } };
Add Schemes to JSON preview
Add Schemes to JSON preview
JavaScript
mit
apinf/open-api-designer,apinf/openapi-designer,apinf/openapi-designer,apinf/open-api-designer
--- +++ @@ -11,7 +11,8 @@ 'contact', 'license', 'host', - 'basePath' + 'basePath', + 'schemes' ], 'types': ['definitions'], 'mime': ['consumes', 'produces']
2f63b0d6c9f16e4820d969532e8f9ae00ab66bdd
eslint-rules/no-primitive-constructors.js
eslint-rules/no-primitive-constructors.js
/** * Copyright 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ 'use strict'; module.exports = function(context) { function report(node, name, msg) { context.report(node, `Do not use the ${name} constructor. ${msg}`); } function check(node) { const name = node.callee.name; switch (name) { case 'Boolean': report( node, name, 'To cast a value to a boolean, use double negation: !!value' ); break; case 'String': report( node, name, 'To cast a value to a string, concat it with the empty string ' + '(unless it\'s a symbol, which have different semantics): ' + '\'\' + value' ); break; } } return { CallExpression: check, NewExpression: check, }; };
/** * Copyright 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @emails react-core */ 'use strict'; module.exports = function(context) { function report(node, name, msg) { context.report(node, `Do not use the ${name} constructor. ${msg}`); } function check(node) { const name = node.callee.name; switch (name) { case 'Boolean': report( node, name, 'To cast a value to a boolean, use double negation: !!value' ); break; case 'String': report( node, name, 'To cast a value to a string, concat it with the empty string ' + '(unless it\'s a symbol, which have different semantics): ' + '\'\' + value' ); break; case 'Number': report( node, name, 'To cast a value to a number, use the plus operator: +value' ); break; } } return { CallExpression: check, NewExpression: check, }; };
Add error for number constructor, too
Add error for number constructor, too
JavaScript
mit
aickin/react,jquense/react,billfeller/react,mhhegazy/react,nhunzaker/react,silvestrijonathan/react,brigand/react,trueadm/react,kaushik94/react,prometheansacrifice/react,cpojer/react,mosoft521/react,joecritch/react,yungsters/react,glenjamin/react,jdlehman/react,facebook/react,roth1002/react,edvinerikson/react,TheBlasfem/react,mjackson/react,edvinerikson/react,jdlehman/react,kaushik94/react,roth1002/react,camsong/react,syranide/react,silvestrijonathan/react,jorrit/react,yiminghe/react,mhhegazy/react,anushreesubramani/react,trueadm/react,jordanpapaleo/react,maxschmeling/react,ericyang321/react,pyitphyoaung/react,glenjamin/react,camsong/react,silvestrijonathan/react,apaatsio/react,yungsters/react,tomocchino/react,pyitphyoaung/react,camsong/react,yungsters/react,wmydz1/react,jameszhan/react,maxschmeling/react,nhunzaker/react,aickin/react,Simek/react,apaatsio/react,jameszhan/react,pyitphyoaung/react,roth1002/react,terminatorheart/react,facebook/react,nhunzaker/react,jzmq/react,anushreesubramani/react,acdlite/react,edvinerikson/react,wmydz1/react,yangshun/react,shergin/react,apaatsio/react,jdlehman/react,roth1002/react,ArunTesco/react,mjackson/react,joecritch/react,camsong/react,kaushik94/react,yangshun/react,prometheansacrifice/react,VioletLife/react,empyrical/react,cpojer/react,trueadm/react,rricard/react,rricard/react,VioletLife/react,mhhegazy/react,VioletLife/react,rickbeerendonk/react,jorrit/react,mjackson/react,aickin/react,jorrit/react,jameszhan/react,mjackson/react,flarnie/react,sekiyaeiji/react,STRML/react,jordanpapaleo/react,mosoft521/react,yungsters/react,ericyang321/react,yiminghe/react,jordanpapaleo/react,empyrical/react,dilidili/react,rricard/react,krasimir/react,chenglou/react,edvinerikson/react,billfeller/react,mhhegazy/react,leexiaosi/react,jzmq/react,Simek/react,quip/react,terminatorheart/react,Simek/react,acdlite/react,anushreesubramani/react,jquense/react,silvestrijonathan/react,joecritch/react,ericyang321/react,trueadm/react,STRML/react,jdlehman/react,jameszhan/react,brigand/react,chicoxyzzy/react,cpojer/react,empyrical/react,yangshun/react,cpojer/react,tomocchino/react,leexiaosi/react,mhhegazy/react,flarnie/react,jordanpapaleo/react,camsong/react,rickbeerendonk/react,STRML/react,TheBlasfem/react,TheBlasfem/react,mhhegazy/react,jdlehman/react,mjackson/react,chicoxyzzy/react,trueadm/react,shergin/react,acdlite/react,AlmeroSteyn/react,AlmeroSteyn/react,quip/react,empyrical/react,yangshun/react,ericyang321/react,kaushik94/react,rickbeerendonk/react,quip/react,billfeller/react,aickin/react,syranide/react,rickbeerendonk/react,wmydz1/react,apaatsio/react,jdlehman/react,tomocchino/react,ericyang321/react,nhunzaker/react,AlmeroSteyn/react,STRML/react,jameszhan/react,maxschmeling/react,krasimir/react,edvinerikson/react,jquense/react,AlmeroSteyn/react,flarnie/react,tomocchino/react,quip/react,jquense/react,shergin/react,leexiaosi/react,billfeller/react,sekiyaeiji/react,syranide/react,yangshun/react,VioletLife/react,krasimir/react,tomocchino/react,dilidili/react,VioletLife/react,dilidili/react,silvestrijonathan/react,prometheansacrifice/react,brigand/react,aickin/react,jdlehman/react,sekiyaeiji/react,jzmq/react,glenjamin/react,camsong/react,dilidili/react,silvestrijonathan/react,VioletLife/react,pyitphyoaung/react,anushreesubramani/react,anushreesubramani/react,rricard/react,facebook/react,glenjamin/react,chicoxyzzy/react,flipactual/react,prometheansacrifice/react,STRML/react,jquense/react,maxschmeling/react,billfeller/react,acdlite/react,krasimir/react,apaatsio/react,dilidili/react,ArunTesco/react,nhunzaker/react,empyrical/react,jameszhan/react,mosoft521/react,mjackson/react,flarnie/react,dilidili/react,ArunTesco/react,shergin/react,TheBlasfem/react,jordanpapaleo/react,quip/react,terminatorheart/react,mosoft521/react,ericyang321/react,yungsters/react,brigand/react,AlmeroSteyn/react,empyrical/react,joecritch/react,mjackson/react,Simek/react,kaushik94/react,wmydz1/react,Simek/react,flarnie/react,aickin/react,yungsters/react,silvestrijonathan/react,flarnie/react,chenglou/react,glenjamin/react,terminatorheart/react,syranide/react,tomocchino/react,chicoxyzzy/react,quip/react,yangshun/react,maxschmeling/react,STRML/react,ericyang321/react,chicoxyzzy/react,chenglou/react,pyitphyoaung/react,pyitphyoaung/react,AlmeroSteyn/react,shergin/react,roth1002/react,dilidili/react,facebook/react,shergin/react,jorrit/react,glenjamin/react,jzmq/react,yungsters/react,nhunzaker/react,VioletLife/react,chenglou/react,tomocchino/react,flipactual/react,anushreesubramani/react,terminatorheart/react,camsong/react,rickbeerendonk/react,wmydz1/react,maxschmeling/react,wmydz1/react,facebook/react,nhunzaker/react,brigand/react,yiminghe/react,chicoxyzzy/react,jorrit/react,jquense/react,edvinerikson/react,TheBlasfem/react,jquense/react,mhhegazy/react,krasimir/react,kaushik94/react,acdlite/react,brigand/react,rickbeerendonk/react,prometheansacrifice/react,jorrit/react,terminatorheart/react,TheBlasfem/react,jorrit/react,AlmeroSteyn/react,acdlite/react,krasimir/react,facebook/react,krasimir/react,joecritch/react,chenglou/react,joecritch/react,cpojer/react,jzmq/react,yiminghe/react,acdlite/react,flipactual/react,STRML/react,edvinerikson/react,trueadm/react,facebook/react,chenglou/react,wmydz1/react,billfeller/react,apaatsio/react,roth1002/react,shergin/react,prometheansacrifice/react,billfeller/react,prometheansacrifice/react,rricard/react,mosoft521/react,mosoft521/react,roth1002/react,empyrical/react,jordanpapaleo/react,quip/react,pyitphyoaung/react,flarnie/react,yangshun/react,kaushik94/react,brigand/react,rickbeerendonk/react,rricard/react,chicoxyzzy/react,yiminghe/react,Simek/react,jordanpapaleo/react,apaatsio/react,maxschmeling/react,mosoft521/react,jzmq/react,aickin/react,trueadm/react,anushreesubramani/react,yiminghe/react,jameszhan/react,joecritch/react,yiminghe/react,chenglou/react,jzmq/react,glenjamin/react,cpojer/react,cpojer/react,Simek/react
--- +++ @@ -35,6 +35,13 @@ '\'\' + value' ); break; + case 'Number': + report( + node, + name, + 'To cast a value to a number, use the plus operator: +value' + ); + break; } }
d40bead054b0883ff59ae6ddd311bf93c5da6de3
public/js/scripts.js
public/js/scripts.js
$(document).ready(function(){ $('.datepicker').pickadate({ onSet: function (ele) { if(ele.select){ this.close(); } } }); $('.timepicker').pickatime({ min: [7,30], max: [19,0], interval: 15, onSet: function (ele) { if(ele.select){ this.close(); } } }); $('select').material_select(); });
$(document).ready(function(){ $('.datepicker').pickadate({ onSet: function (ele) { if(ele.select){ this.close(); } }, min: true }); $('.timepicker').pickatime({ min: [7,30], max: [19,0], interval: 15, onSet: function (ele) { if(ele.select){ this.close(); } } }); $('select').material_select(); });
Disable the selection of past dates
Disable the selection of past dates
JavaScript
mit
warrenca/silid,warrenca/silid,warrenca/silid,warrenca/silid
--- +++ @@ -4,7 +4,8 @@ if(ele.select){ this.close(); } - } + }, + min: true }); $('.timepicker').pickatime({ min: [7,30],
fe14355e054947a6ef00b27884d6c3efc8a3fb62
server.js
server.js
var express = require('express'); var _ = require('lodash'); var app = express(); app.use(express.favicon('public/img/favicon.ico')); app.use(express.static('public')); app.use(express.logger('dev')); app.use(express.bodyParser()); app.set('view engine', 'jade'); app.set('views', __dirname + '/views'); var Situation = require('./lib/situation'); app.post('/process', function(req, res) { var situ = new Situation(req.body.situation); var resp = situ.get('simulation'); res.send({ params: req.body.situation, situation: _.extend({}, situ.computedValues, situ.userValues), response: resp, claimedValues: situ.claimedValues }); }); app.get('/', function(req, res){ res.render('index'); }); app.listen(process.env.PORT || 5000);
var express = require('express'); var _ = require('lodash'); var app = express(); app.use(express.favicon('public/img/favicon.ico')); app.use(express.static('public')); app.use(express.logger('dev')); app.use(express.json()); app.set('view engine', 'jade'); app.set('views', __dirname + '/views'); var Situation = require('./lib/situation'); app.post('/process', function(req, res) { var situ = new Situation(req.body.situation); var resp = situ.get('simulation'); res.send({ params: req.body.situation, situation: _.extend({}, situ.computedValues, situ.userValues), response: resp, claimedValues: situ.claimedValues }); }); app.get('/', function(req, res){ res.render('index'); }); app.listen(process.env.PORT || 5000);
Replace bodyParser by json middleware
Replace bodyParser by json middleware
JavaScript
agpl-3.0
sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui
--- +++ @@ -6,7 +6,7 @@ app.use(express.favicon('public/img/favicon.ico')); app.use(express.static('public')); app.use(express.logger('dev')); -app.use(express.bodyParser()); +app.use(express.json()); app.set('view engine', 'jade'); app.set('views', __dirname + '/views');
55ac0e6be4b8a286c095a1a009777e336bc315cf
node_scripts/run_server.js
node_scripts/run_server.js
require('../lib/fin/lib/js.io/packages/jsio') jsio.addPath('./lib/fin/js', 'shared') jsio.addPath('./lib/fin/js', 'server') jsio.addPath('.', 'fan') jsio('import fan.Server') jsio('import fan.Connection') var redisEngine = require('../lib/fin/engines/redis') var fanServer = new fan.Server(fan.Connection, redisEngine) fanServer.listen('csp', { port: 5555 }) // for browser clients fanServer.listen('tcp', { port: 5556, timeout: 0 }) // for robots
require('../lib/fin/lib/js.io/packages/jsio') jsio.addPath('./lib/fin/js', 'shared') jsio.addPath('./lib/fin/js', 'server') jsio.addPath('.', 'fan') jsio('import fan.Server') jsio('import fan.Connection') var redisEngine = require('../lib/fin/engines/node') var fanServer = new fan.Server(fan.Connection, redisEngine) fanServer.listen('csp', { port: 5555 }) // for browser clients fanServer.listen('tcp', { port: 5556, timeout: 0 }) // for robots
Use the node engine by default
Use the node engine by default
JavaScript
mit
marcuswestin/Focus
--- +++ @@ -7,7 +7,7 @@ jsio('import fan.Server') jsio('import fan.Connection') -var redisEngine = require('../lib/fin/engines/redis') +var redisEngine = require('../lib/fin/engines/node') var fanServer = new fan.Server(fan.Connection, redisEngine) fanServer.listen('csp', { port: 5555 }) // for browser clients
6754468b9a1821993d5980c39e09f6eb772ecd41
examples/analyzer-inline.spec.js
examples/analyzer-inline.spec.js
'use strict'; var codeCopter = require('../'); /** * A pretty harsh analyzer that passes NO files for the reason that "it sucks" starting on line 1. * * @returns {Object} An object consistent with a code-copter Analysis object bearing the inevitable message that the code in the analyzed file sucks. */ function itSucks () { return { errors: [{ line: 1, message: 'It sucks. Starting here.' }], pass: false }; } codeCopter.configure({ analyzers: { itSucks: itSucks } }); describe('Inline Analyzer Example', codeCopter);
'use strict'; var codeCopter = require('../'); /** * A pretty harsh analyzer that passes NO files for the reason that "it sucks" starting on line 1. * * @param {FileSourceData} fileSourceData - The file source data to analyze. * @returns {Object} An object consistent with a code-copter Analysis object bearing the inevitable message that the code in the analyzed file sucks. */ function itSucks (fileSourceData) { // OPTIMIZATION: Skip analysis loop and just tell them their code sucks. // //for (let sample of fileSourceData) { // // TODO: Test sample.text to see if it sucks, add error message for sample.line //} return { errors: [{ line: 1, message: 'It sucks. Starting here.' }], pass: false }; } codeCopter.configure({ analyzers: { itSucks: itSucks } }); describe('Inline Analyzer Example', codeCopter);
Include reference to parameter received by analyzers
Include reference to parameter received by analyzers
JavaScript
isc
jtheriault/code-copter,jtheriault/code-copter
--- +++ @@ -4,9 +4,16 @@ /** * A pretty harsh analyzer that passes NO files for the reason that "it sucks" starting on line 1. * + * @param {FileSourceData} fileSourceData - The file source data to analyze. * @returns {Object} An object consistent with a code-copter Analysis object bearing the inevitable message that the code in the analyzed file sucks. */ -function itSucks () { +function itSucks (fileSourceData) { + // OPTIMIZATION: Skip analysis loop and just tell them their code sucks. + // + //for (let sample of fileSourceData) { + // // TODO: Test sample.text to see if it sucks, add error message for sample.line + //} + return { errors: [{ line: 1,
e5b67dcf51ee97b6890b06a5d17b890bbf616081
bin/index.js
bin/index.js
#!/usr/bin/env node const fs = require('fs') const path = require('path') const concise = require('../src/index') const command = { name: process.argv[2], input: process.argv[3], output: process.argv[4] } const build = (input, output) => { concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then(css => { // Create all the parent directories if required fs.mkdirSync(path.dirname(output), { recursive: true }) // Write the CSS fs.writeFile(output, css, err => { if (err) throw err console.log(`File written: ${output}\nFrom: ${input}`); }) }); }; const watch = path => { console.log(`Currently watching for changes in: ${path}`); fs.watch(path, {recursive: true}, (eventType, filename) => { console.log(`${eventType.charAt(0).toUpperCase() + eventType.slice(1)} in: ${filename}`); build(); }); }; switch (command.name) { case 'compile': build(command.input, command.output); break case 'watch': build(command.input, command.output); watch(path.dirname(command.input)); break default: console.log('Unknown command') break }
#!/usr/bin/env node const fs = require('fs') const path = require('path') const concise = require('../src/index') const command = { name: process.argv[2], input: process.argv[3], output: process.argv[4] } const build = (input, output) => { concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then(result => { // Create all the parent directories if required fs.mkdirSync(path.dirname(output), { recursive: true }) // Write the CSS fs.writeFile(output, result.css, err => { if (err) throw err console.log(`File written: ${output}\nFrom: ${input}`); }) }); }; const watch = path => { console.log(`Currently watching for changes in: ${path}`); fs.watch(path, {recursive: true}, (eventType, filename) => { console.log(`${eventType.charAt(0).toUpperCase() + eventType.slice(1)} in: ${filename}`); build(); }); }; switch (command.name) { case 'compile': build(command.input, command.output); break case 'watch': build(command.input, command.output); watch(path.dirname(command.input)); break default: console.log('Unknown command') break }
Use the `css` property of `Result`
Use the `css` property of `Result`
JavaScript
mit
ConciseCSS/concise.css
--- +++ @@ -11,12 +11,12 @@ } const build = (input, output) => { - concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then(css => { + concise.process(fs.readFileSync(input, 'utf8'), { from: input }).then(result => { // Create all the parent directories if required fs.mkdirSync(path.dirname(output), { recursive: true }) // Write the CSS - fs.writeFile(output, css, err => { + fs.writeFile(output, result.css, err => { if (err) throw err console.log(`File written: ${output}\nFrom: ${input}`); })
c0747bbf0ba35c22f393d347a1b87729659031a3
src/routes/index.js
src/routes/index.js
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import $ from 'jQuery'; import CoreLayout from 'layouts/CoreLayout'; import HomeView from 'views/HomeView'; import ResumeView from 'views/ResumeView'; import UserFormView from 'views/UserFormView'; import AboutView from 'views/AboutView'; import SecretView from 'views/SecretView'; function requireAuth(nextState, replaceState) { // NOTE: will change url address when deployed $.ajax({ url: 'http://localhost:3000/authentication', async: false, type: 'POST', contentType: 'application/json', success: (data) => { if (data.Auth === false) { replaceState({ nextPathname: nextState.location.pathname }, '/'); } }, error: (xhr, status, err) => console.error(err) }); } export default ( <Route path='/' component={CoreLayout}> <IndexRoute component={ResumeView} /> <Route path='/userform' component={UserFormView} /> <Route path='/resume' component={ResumeView} /> <Route path='/about' component={AboutView} /> <Route path='/secretpage' component={SecretView} onEnter={requireAuth} /> </Route> );
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import $ from 'jQuery'; import CoreLayout from 'layouts/CoreLayout'; import HomeView from 'views/HomeView'; import ResumeView from 'views/ResumeView'; import UserFormView from 'views/UserFormView'; import AboutView from 'views/AboutView'; import SecretView from 'views/SecretView'; function requireAuth(nextState, replaceState) { // NOTE: will change url address when deployed $.ajax({ url: 'http://localhost:3000/authentication', async: false, type: 'POST', contentType: 'application/json', success: (data) => { if (data.Auth === false) { replaceState({ nextPathname: nextState.location.pathname }, '/'); } }, error: (xhr, status, err) => console.error(err) }); } export default ( <Route path='/' component={CoreLayout}> <IndexRoute component={HomeView} /> <Route path='/userform' component={UserFormView} /> <Route path='/resume' component={ResumeView} /> <Route path='/about' component={AboutView} /> <Route path='/secretpage' component={SecretView} onEnter={requireAuth} /> </Route> );
Update default view user renders due to Melody
[chore]: Update default view user renders due to Melody
JavaScript
mit
dont-fear-the-repo/fear-the-repo,sujaypatel16/fear-the-repo,AndrewTHuang/fear-the-repo,ericsonmichaelj/fear-the-repo,AndrewTHuang/fear-the-repo,ericsonmichaelj/fear-the-repo,sujaypatel16/fear-the-repo,dont-fear-the-repo/fear-the-repo
--- +++ @@ -30,7 +30,7 @@ export default ( <Route path='/' component={CoreLayout}> - <IndexRoute component={ResumeView} /> + <IndexRoute component={HomeView} /> <Route path='/userform' component={UserFormView} /> <Route path='/resume' component={ResumeView} /> <Route path='/about' component={AboutView} />
a00a62f147489141cfb7d3fb2d10e08e8f161e01
demo/js/components/workbench-new.js
demo/js/components/workbench-new.js
angular.module('yds').directive('ydsWorkbenchNew', ['$ocLazyLoad', '$timeout', '$window', 'Data', 'Basket', 'Workbench', function ($ocLazyLoad, $timeout, $window, Data, Basket, Workbench) { return { restrict: 'E', scope: { lang: '@', userId: '@' }, templateUrl: ((typeof Drupal != 'undefined') ? Drupal.settings.basePath + Drupal.settings.yds_project.modulePath + '/' : '') + 'templates/workbench-new.html', link: function (scope, element) { scope.ydsAlert = ""; var editorContainer = angular.element(element[0].querySelector('.highcharts-editor-container')); //if userId is undefined or empty, stop the execution of the directive if (_.isUndefined(scope.userId) || scope.userId.trim().length == 0) { scope.ydsAlert = "The YDS component is not properly configured." + "Please check the corresponding documentation section"; return false; } //check if the language attr is defined, else assign default value if (_.isUndefined(scope.lang) || scope.lang.trim() == "") scope.lang = "en"; // Load the required CSS & JS files for the Editor $ocLazyLoad.load([ "css/highcharts-editor.min.css", "lib/highcharts-editor.js" ]).then(function () { // Start the Highcharts Editor highed.ready(function () { highed.Editor(editorContainer[0]); }); }); } } } ]);
angular.module('yds').directive('ydsWorkbenchNew', ['$ocLazyLoad', '$timeout', '$window', 'Data', 'Basket', 'Workbench', function ($ocLazyLoad, $timeout, $window, Data, Basket, Workbench) { return { restrict: 'E', scope: { lang: '@', userId: '@' }, templateUrl: ((typeof Drupal != 'undefined') ? Drupal.settings.basePath + Drupal.settings.yds_project.modulePath + '/' : '') + 'templates/workbench-new.html', link: function (scope, element) { scope.ydsAlert = ""; var editorContainer = angular.element(element[0].querySelector('.highcharts-editor-container')); //if userId is undefined or empty, stop the execution of the directive if (_.isUndefined(scope.userId) || scope.userId.trim().length == 0) { scope.ydsAlert = "The YDS component is not properly configured." + "Please check the corresponding documentation section"; return false; } //check if the language attr is defined, else assign default value if (_.isUndefined(scope.lang) || scope.lang.trim() == "") scope.lang = "en"; var editorOptions = { features: "import templates customize export" }; // Load the required CSS & JS files for the Editor $ocLazyLoad.load([ "css/highcharts-editor.min.css", "lib/highcharts-editor.js" ]).then(function () { // Start the Highcharts Editor highed.ready(function () { highed.Editor(editorContainer[0], editorOptions); }); }); } } } ]);
Disable steps that are not needed in Highcharts Editor
Disable steps that are not needed in Highcharts Editor
JavaScript
apache-2.0
YourDataStories/components-visualisation,YourDataStories/components-visualisation,YourDataStories/components-visualisation
--- +++ @@ -22,6 +22,10 @@ if (_.isUndefined(scope.lang) || scope.lang.trim() == "") scope.lang = "en"; + var editorOptions = { + features: "import templates customize export" + }; + // Load the required CSS & JS files for the Editor $ocLazyLoad.load([ "css/highcharts-editor.min.css", @@ -29,7 +33,7 @@ ]).then(function () { // Start the Highcharts Editor highed.ready(function () { - highed.Editor(editorContainer[0]); + highed.Editor(editorContainer[0], editorOptions); }); }); }
7b1ee57b1fc73b6bf75818561a2f5bba39b50344
src/scripts/main.js
src/scripts/main.js
console.log('main.js'); // Load Css async w LoadCSS & +1 polyfill / https://www.npmjs.com/package/fg-loadcss?notice=MIvGLZ2qXNAEF8AM1kvyFWL8p-1MwaU7UpJd8jcG var stylesheet = loadCSS( "styles/main.css" ); onloadCSS( stylesheet, function() { console.log( "LoadCSS > Stylesheet has loaded. Yay !" ); $('.no-fouc').fadeIn(); // Jquery animation }); // Load Hyphenopoly plugins, manage font césure & text FOUC // Need to be loaded beofre HyphenopolyLoader, cf. gulpfile paths.scripts.src var Hyphenopoly = { require: { "en-us": "hyphenation" }, paths: { patterndir: 'assets/hyphenopoly/patterns/', maindir: 'assets/hyphenopoly/' }, setup: { classnames: { "hyphenate": {} } } };
console.log('main.js'); // Load Css async w LoadCSS & +1 polyfill / https://www.npmjs.com/package/fg-loadcss?notice=MIvGLZ2qXNAEF8AM1kvyFWL8p-1MwaU7UpJd8jcG var stylesheet = loadCSS( "styles/main.css" ); onloadCSS( stylesheet, function() { console.log( "LoadCSS > Stylesheet has loaded. Yay !" ); // + No Fouc management $('.no-fouc').fadeIn(); // Lovely Jquery animation on load // Fouc out management $('a').click(function(e) { e.preventDefault(); newLocation = this.href; $('body').fadeOut(200, function() { window.location = newLocation; }); }); }); // Load Hyphenopoly plugins, manage font césure & text FOUC // Need to be loaded beofre HyphenopolyLoader, cf. gulpfile paths.scripts.src var Hyphenopoly = { require: { "en-us": "hyphenation" }, paths: { patterndir: 'assets/hyphenopoly/patterns/', maindir: 'assets/hyphenopoly/' }, setup: { classnames: { "hyphenate": {} } } };
Add / Fouc out (on link clic)
Add / Fouc out (on link clic)
JavaScript
mit
youpiwaza/chaos-boilerplate,youpiwaza/chaos-boilerplate
--- +++ @@ -5,8 +5,22 @@ onloadCSS( stylesheet, function() { console.log( "LoadCSS > Stylesheet has loaded. Yay !" ); - $('.no-fouc').fadeIn(); // Jquery animation + // + No Fouc management + $('.no-fouc').fadeIn(); // Lovely Jquery animation on load + + // Fouc out management + $('a').click(function(e) { + + e.preventDefault(); + newLocation = this.href; + + $('body').fadeOut(200, function() { + window.location = newLocation; + }); + }); }); + + // Load Hyphenopoly plugins, manage font césure & text FOUC // Need to be loaded beofre HyphenopolyLoader, cf. gulpfile paths.scripts.src
3908db4cabd5193aa3798a48277369b86b786f73
tests/nock.js
tests/nock.js
/** * Copyright (c) 2015 IBM Cloudant, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ function noop() { return this; } function nock_noop() { // Return a completely inert nock-compatible object. return {head:noop, get:noop, post:noop, put:noop, 'delete':noop, reply:noop, filteringPath:noop, done:noop}; } if (process.env.NOCK_OFF) { var nock = nock_noop; } else { var nock = require('nock'); } module.exports = nock;
/** * Copyright (c) 2015 IBM Cloudant, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ function noop() { return this; } function nock_noop() { // Return a completely inert nock-compatible object. return {head:noop, get:noop, post:noop, put:noop, 'delete':noop, reply:noop, filteringPath:noop, done:noop, query:noop}; } if (process.env.NOCK_OFF) { var nock = nock_noop; } else { var nock = require('nock'); } module.exports = nock;
Add the .query() method to the Nock noop
Add the .query() method to the Nock noop
JavaScript
apache-2.0
KimStebel/nodejs-cloudant,cloudant/nodejs-cloudant,cloudant/nodejs-cloudant
--- +++ @@ -18,7 +18,7 @@ function nock_noop() { // Return a completely inert nock-compatible object. - return {head:noop, get:noop, post:noop, put:noop, 'delete':noop, reply:noop, filteringPath:noop, done:noop}; + return {head:noop, get:noop, post:noop, put:noop, 'delete':noop, reply:noop, filteringPath:noop, done:noop, query:noop}; } if (process.env.NOCK_OFF) {
ae166fa6cd8ef9c8a73ff1b9e7a1e64503e6061e
src/js/portfolio.js
src/js/portfolio.js
var observer = lozad(".lazy", { rootMargin: "25%", threshold: 0 }); observer.observe();
import IntersectionObserver from 'intersection-observer'; import Lozad from 'lozad'; let observer = Lozad('.lazy', { rootMargin: '25%', threshold: 0 }); observer.observe();
Use ES6 import for Portfolio JS dependencies
Use ES6 import for Portfolio JS dependencies
JavaScript
mit
stevecochrane/stevecochrane.com,stevecochrane/stevecochrane.com
--- +++ @@ -1,5 +1,8 @@ -var observer = lozad(".lazy", { - rootMargin: "25%", +import IntersectionObserver from 'intersection-observer'; +import Lozad from 'lozad'; + +let observer = Lozad('.lazy', { + rootMargin: '25%', threshold: 0 }); observer.observe();
a7a88cac0976c49e05fa9ea278320749f6ef1ba0
rollup.config-dev.js
rollup.config-dev.js
"use strict"; const baseConfig = require("./rollup.config"); const plugin = require("./plugin"); const path = require("path"); module.exports = baseConfig.map((config, index) => { config.plugins.push(plugin({ open: true, filename: `stats.${index}.html`, template: getTemplateType(config) })); return config; }); function getTemplateType({ input }) { const filename = path.basename(input, path.extname(input)); const [, templateType] = filename.split("-"); return templateType; }
"use strict"; const baseConfig = require("./rollup.config"); const plugin = require("./plugin"); const path = require("path"); module.exports = baseConfig.map(config => { const templateType = getTemplateType(config); config.plugins.push( plugin({ open: true, filename: `stats.${templateType}.html`, template: templateType }) ); return config; }); function getTemplateType({ input }) { const filename = path.basename(input, path.extname(input)); const [, templateType] = filename.split("-"); return templateType; }
Use template name for statts file name
Use template name for statts file name
JavaScript
mit
btd/rollup-plugin-visualizer,btd/rollup-plugin-visualizer
--- +++ @@ -4,12 +4,15 @@ const plugin = require("./plugin"); const path = require("path"); -module.exports = baseConfig.map((config, index) => { - config.plugins.push(plugin({ - open: true, - filename: `stats.${index}.html`, - template: getTemplateType(config) - })); +module.exports = baseConfig.map(config => { + const templateType = getTemplateType(config); + config.plugins.push( + plugin({ + open: true, + filename: `stats.${templateType}.html`, + template: templateType + }) + ); return config; });
0d58435c37ad66fa5bea391672cb490c13e455f7
website/mcapp.projects/src/app/models/project.model.js
website/mcapp.projects/src/app/models/project.model.js
/*@ngInject*/ function ProjectModelService(projectsAPI) { class Project { constructor(id, name, owner) { this.id = id; this.name = name; this.owner = owner; this.samples_count = 0; this.processes_count = 0; this.experiments_count = 0; this.files_count = 0; this.description = ""; this.birthtime = 0; this.mtime = 0; } static fromJSON(data) { let p = new Project(data.id, data.name, data.owner); p.samples_count = data.samples; p.processes_count = data.processes; p.experiments_count = data.experiments; p.files_counts = data.files; p.description = data.description; p.birthtime = new Date(data.birthtime * 1000); p.mtime = new Date(data.mtime * 1000); p.users = data.users; p.owner_details = data.owner_details; return p; } static get(id) { } static getProjectsForCurrentUser() { return projectsAPI.getAllProjects().then( (projects) => projects.map(p => Project.fromJSON(p)) ); } save() { } update() { } } return Project; } angular.module('materialscommons').factory('ProjectModel', ProjectModelService);
/*@ngInject*/ function ProjectModelService(projectsAPI) { class Project { constructor(id, name, owner) { this.id = id; this.name = name; this.owner = owner; this.samples_count = 0; this.processes_count = 0; this.experiments_count = 0; this.files_count = 0; this.description = ""; this.birthtime = 0; this.owner_details = {}; this.mtime = 0; } static fromJSON(data) { let p = new Project(data.id, data.name, data.owner); p.samples_count = data.samples; p.processes_count = data.processes; p.experiments_count = data.experiments; p.files_counts = data.files; p.description = data.description; p.birthtime = new Date(data.birthtime * 1000); p.mtime = new Date(data.mtime * 1000); p.users = data.users; p.owner_details = data.owner_details; return p; } static get(id) { } static getProjectsForCurrentUser() { return projectsAPI.getAllProjects().then( (projects) => projects.map(p => Project.fromJSON(p)) ); } save() { } update() { } } return Project; } angular.module('materialscommons').factory('ProjectModel', ProjectModelService);
Add default value for owner_details.
Add default value for owner_details.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -11,6 +11,7 @@ this.files_count = 0; this.description = ""; this.birthtime = 0; + this.owner_details = {}; this.mtime = 0; }
7de0b3e5e86bcd995e30f6aa953e86c7730ffa28
transform-response-to-objects.js
transform-response-to-objects.js
module.exports = ResponseToObjects; var Transform = require('readable-stream/transform'); var inherits = require('inherits'); var isArray = require('is-array'); /** * Parse written Livefyre API Responses (strings or objects) into a * readable stream of objects from response.data * If data is an array, each item of the array will be emitted separately * If an error response is written in, emit an error event */ function ResponseToObjects(opts) { opts = opts || {}; opts.objectMode = true; return Transform.call(this, opts); } inherits(ResponseToObjects, Transform); /** * Required by stream/transform */ ResponseToObjects.prototype._transform = function (response, encoding, done) { var err; if (typeof response === 'string') { response = JSON.parse(response); } if (response.status === 'error') { err = new Error('ResponseToObjects transform had an error response written in'); err.response = response; this.emit('error', err); return; } var data = response.data; if ( ! data) { err = new Error('Response has no data'); err.response = response; this.emit('error', err); return; } if ( ! isArray(data)) { data = [data]; } data.forEach(this.push.bind(this)); done(); };
module.exports = ResponseToObjects; var Transform = require('readable-stream/transform'); var inherits = require('inherits'); var isArray = require('is-array'); /** * Parse written Livefyre API Responses (strings or objects) into a * readable stream of objects from response.data * If data is an array, each item of the array will be emitted separately * If an error response is written in, emit an error event */ function ResponseToObjects(opts) { opts = opts || {}; opts.objectMode = true; Transform.call(this, opts); } inherits(ResponseToObjects, Transform); /** * Required by stream/transform */ ResponseToObjects.prototype._transform = function (response, encoding, done) { var err; if (typeof response === 'string') { response = JSON.parse(response); } if (response.status === 'error') { err = new Error('ResponseToObjects transform had an error response written in'); err.response = response; this.emit('error', err); return; } var data = response.data; if ( ! data) { err = new Error('Response has no data'); err.response = response; this.emit('error', err); return; } if ( ! isArray(data)) { data = [data]; } data.forEach(this.push.bind(this)); done(); };
Remove unnecessary return in ResponseToObjects
Remove unnecessary return in ResponseToObjects
JavaScript
mit
gobengo/chronos-stream
--- +++ @@ -13,7 +13,7 @@ function ResponseToObjects(opts) { opts = opts || {}; opts.objectMode = true; - return Transform.call(this, opts); + Transform.call(this, opts); } inherits(ResponseToObjects, Transform);
0f9b5317e5a9ce68372d62c814dfbd260b748169
JavaScriptUI-DOM-TeamWork-Kinetic/Scripts/GameEngine.js
JavaScriptUI-DOM-TeamWork-Kinetic/Scripts/GameEngine.js
 var GameEngine = ( function () { function start(){ var x, y, color, i, j, lengthBoard, lengthField; var players = []; players.push( Object.create( GameObjects.Player ).init( 'First', 'white' ) ); players.push( Object.create( GameObjects.Player ).init( 'Second', 'black' ) ); var board = GameObjects.Board.init( players ); GameDraw.background(); lengthBoard = board.length; for ( i = 0; i < lengthBoard; i += 1 ) { lengthField = board[i].length; for ( j = 0; j < lengthField; j += 1 ) { x = i; y = j; color = board[i][j].color; GameDraw.createCircle( x, y, color ); } } GameDraw.playGround(); } return{ start: start, } }() )
var GameEngine = ( function () { function start() { var x, y, color, i, j, lengthBoard, lengthField; var players = []; players.push(Object.create(GameObjects.Player).init('First', 'white')); players.push(Object.create(GameObjects.Player).init('Second', 'black')); var board = GameObjects.Board.init(players); GameDraw.background(); lengthBoard = board.length; for (i = 0; i < lengthBoard; i += 1) { lengthField = board[i].length; for (j = 0; j < lengthField; j += 1) { x = i; y = j; color = board[i][j].color; GameDraw.createCircle(x, y, color); } } GameDraw.playGround(); } function update(){ // currentPlayer = GetCurrentPlayer - depending on player.isOnTurn or isFirstPlayerOnTurn // flag hasThrownDice -> if not - throw dice(allowedMoves = diceResult, currentPlayerMoves = 0); else - continue // if (currentPlayer.hasHitPiece) -> Call function(s) to deal with this situation. // if can't put piece -> playerMoves = allowedMoves // if ((currentPlayerMoves < allowedMoves) && hasMovedPiece (sets to true when called from onDrag event on piece) // Subcases: move from position to position/ collect piece // Call function(s) to deal with this situation. -> hasMovedPiece = false, currentPlayerMoves++; // Missed logic? // if current player has no pieces on the board -> He wins. // if (playerMoves === allowedMoves) -> change player, hasThrownDice = false } return { start: start, update: update }; }()); // All events will call GameEngine.Update() and GameDraw.Update().
Add pseudo code for game update according to game state.
Add pseudo code for game update according to game state.
JavaScript
mit
Vesper-Team/JavaScriptUI-DOM-TeamWork,Vesper-Team/JavaScriptUI-DOM-TeamWork
--- +++ @@ -1,40 +1,62 @@ - -var GameEngine = ( function () { - function start(){ - var x, - y, - color, - i, - j, - lengthBoard, - lengthField; +var GameEngine = ( function () { + function start() { + var x, + y, + color, + i, + j, + lengthBoard, + lengthField; - var players = []; - players.push( Object.create( GameObjects.Player ).init( 'First', 'white' ) ); - players.push( Object.create( GameObjects.Player ).init( 'Second', 'black' ) ); + var players = []; + players.push(Object.create(GameObjects.Player).init('First', 'white')); + players.push(Object.create(GameObjects.Player).init('Second', 'black')); - var board = GameObjects.Board.init( players ); + var board = GameObjects.Board.init(players); - GameDraw.background(); + GameDraw.background(); - lengthBoard = board.length; + lengthBoard = board.length; - for ( i = 0; i < lengthBoard; i += 1 ) { - lengthField = board[i].length; + for (i = 0; i < lengthBoard; i += 1) { + lengthField = board[i].length; - for ( j = 0; j < lengthField; j += 1 ) { - x = i; - y = j; - color = board[i][j].color; + for (j = 0; j < lengthField; j += 1) { + x = i; + y = j; + color = board[i][j].color; - GameDraw.createCircle( x, y, color ); + GameDraw.createCircle(x, y, color); + } } + + GameDraw.playGround(); } - GameDraw.playGround(); - } - - return{ - start: start, - } -}() ) + function update(){ + // currentPlayer = GetCurrentPlayer - depending on player.isOnTurn or isFirstPlayerOnTurn + + // flag hasThrownDice -> if not - throw dice(allowedMoves = diceResult, currentPlayerMoves = 0); else - continue + + // if (currentPlayer.hasHitPiece) -> Call function(s) to deal with this situation. + // if can't put piece -> playerMoves = allowedMoves + + // if ((currentPlayerMoves < allowedMoves) && hasMovedPiece (sets to true when called from onDrag event on piece) + + // Subcases: move from position to position/ collect piece + // Call function(s) to deal with this situation. -> hasMovedPiece = false, currentPlayerMoves++; + + // Missed logic? + + // if current player has no pieces on the board -> He wins. + + // if (playerMoves === allowedMoves) -> change player, hasThrownDice = false + } + + return { + start: start, + update: update + }; +}()); + +// All events will call GameEngine.Update() and GameDraw.Update().
5390da989457ecff7dbfa94637c042e2d63f2841
examples/Node.js/exportTadpoles.js
examples/Node.js/exportTadpoles.js
require('../../index.js'); var scope = require('./Tadpoles'); scope.view.exportFrames({ amount: 200, directory: __dirname, onComplete: function() { console.log('Done exporting.'); }, onProgress: function(event) { console.log(event.percentage + '% complete, frame took: ' + event.delta); } });
require('../../node.js/'); var paper = require('./Tadpoles'); paper.view.exportFrames({ amount: 400, directory: __dirname, onComplete: function() { console.log('Done exporting.'); }, onProgress: function(event) { console.log(event.percentage + '% complete, frame took: ' + event.delta); } });
Clean up Node.js tadpoles example.
Clean up Node.js tadpoles example.
JavaScript
mit
0/paper.js,0/paper.js
--- +++ @@ -1,7 +1,7 @@ -require('../../index.js'); -var scope = require('./Tadpoles'); -scope.view.exportFrames({ - amount: 200, +require('../../node.js/'); +var paper = require('./Tadpoles'); +paper.view.exportFrames({ + amount: 400, directory: __dirname, onComplete: function() { console.log('Done exporting.');
8c1899b772a1083ce739e237990652b73b41a48d
src/apps/investment-projects/constants.js
src/apps/investment-projects/constants.js
const { concat } = require('lodash') const currentYear = (new Date()).getFullYear() const GLOBAL_NAV_ITEM = { path: '/investment-projects', label: 'Investment projects', permissions: [ 'investment.read_associated_investmentproject', 'investment.read_all_investmentproject', ], order: 5, } const LOCAL_NAV = [ { path: 'details', label: 'Project details', }, { path: 'team', label: 'Project team', }, { path: 'interactions', label: 'Interactions', permissions: [ 'interaction.read_associated_investmentproject_interaction', 'interaction.read_all_interaction', ], }, { path: 'evaluation', label: 'Evaluations', }, { path: 'audit', label: 'Audit history', }, { path: 'documents', label: 'Documents', permissions: [ 'investment.read_investmentproject_document', ], }, ] const DEFAULT_COLLECTION_QUERY = { estimated_land_date_after: `${currentYear}-04-05`, estimated_land_date_before: `${currentYear + 1}-04-06`, sortby: 'estimated_land_date:asc', } const APP_PERMISSIONS = concat(LOCAL_NAV, GLOBAL_NAV_ITEM) module.exports = { GLOBAL_NAV_ITEM, LOCAL_NAV, DEFAULT_COLLECTION_QUERY, APP_PERMISSIONS, }
const { concat } = require('lodash') const GLOBAL_NAV_ITEM = { path: '/investment-projects', label: 'Investment projects', permissions: [ 'investment.read_associated_investmentproject', 'investment.read_all_investmentproject', ], order: 5, } const LOCAL_NAV = [ { path: 'details', label: 'Project details', }, { path: 'team', label: 'Project team', }, { path: 'interactions', label: 'Interactions', permissions: [ 'interaction.read_associated_investmentproject_interaction', 'interaction.read_all_interaction', ], }, { path: 'evaluation', label: 'Evaluations', }, { path: 'audit', label: 'Audit history', }, { path: 'documents', label: 'Documents', permissions: [ 'investment.read_investmentproject_document', ], }, ] const DEFAULT_COLLECTION_QUERY = { sortby: 'estimated_land_date:asc', } const APP_PERMISSIONS = concat(LOCAL_NAV, GLOBAL_NAV_ITEM) module.exports = { GLOBAL_NAV_ITEM, LOCAL_NAV, DEFAULT_COLLECTION_QUERY, APP_PERMISSIONS, }
Remove preset date filters in investment collection
Remove preset date filters in investment collection
JavaScript
mit
uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend
--- +++ @@ -1,6 +1,4 @@ const { concat } = require('lodash') - -const currentYear = (new Date()).getFullYear() const GLOBAL_NAV_ITEM = { path: '/investment-projects', @@ -47,8 +45,6 @@ ] const DEFAULT_COLLECTION_QUERY = { - estimated_land_date_after: `${currentYear}-04-05`, - estimated_land_date_before: `${currentYear + 1}-04-06`, sortby: 'estimated_land_date:asc', }
ec0c70f94319a898453252d4c4a7d8020e40081b
take_screenshots.js
take_screenshots.js
var target = UIATarget.localTarget(); function captureLocalizedScreenshot(name) { var target = UIATarget.localTarget(); var model = target.model(); var rect = target.rect(); if (model.match(/iPhone/)) { if (rect.size.height > 480) model = "iphone5"; else model = "iphone"; } else { model = "ipad"; } var orientation = "portrait"; if (rect.size.height < rect.size.width) orientation = "landscape"; var language = target.frontMostApp(). preferencesValueForKey("AppleLanguages")[0]; var parts = [model, orientation, language, name]; target.captureScreenWithName(parts.join("-")); } var window = target.frontMostApp().mainWindow(); captureLocalizedScreenshot("screen1"); window.buttons()[0].tap(); target.delay(0.5); captureLocalizedScreenshot("screen2");
var target = UIATarget.localTarget(); function captureLocalizedScreenshot(name) { var target = UIATarget.localTarget(); var model = target.model(); var rect = target.rect(); if (model.match(/iPhone/)) { if (rect.size.height > 480) model = "iphone5"; else model = "iphone"; } else { model = "ipad"; } var orientation = "portrait"; if (rect.size.height < rect.size.width) orientation = "landscape"; var language = target.frontMostApp(). preferencesValueForKey("AppleLanguages")[0]; var parts = [language, model, orientation, name]; target.captureScreenWithName(parts.join("-")); } var window = target.frontMostApp().mainWindow(); captureLocalizedScreenshot("screen1"); window.buttons()[0].tap(); target.delay(0.5); captureLocalizedScreenshot("screen2");
Put the language first in the screen shot generation
Put the language first in the screen shot generation
JavaScript
mit
wordpress-mobile/ui-screen-shooter,myhanhtran1999/UIScreenShot,jonathanpenn/ui-screen-shooter,duk42111/ui-screen-shooter,myhanhtran1999/UIScreenShot,wordpress-mobile/ui-screen-shooter,jonathanpenn/ui-screen-shooter,duk42111/ui-screen-shooter,myhanhtran1999/UIScreenShot
--- +++ @@ -18,7 +18,7 @@ var language = target.frontMostApp(). preferencesValueForKey("AppleLanguages")[0]; - var parts = [model, orientation, language, name]; + var parts = [language, model, orientation, name]; target.captureScreenWithName(parts.join("-")); }
e771602c05add371bdb1d8d7082f87ae02715cae
app/commands.js
app/commands.js
var _ = require('underscore'); var util = require('util'); exports.setup = function() { global.commands = {}; }; exports.handle = function(evt, msg) { if(msg.slice(0, 1) != "!") return; var m = msg.match(/^!([A-Za-z0-9]+)(?: (.+))?$/); if(!m) return; if(global.commands[m[1].lower()]) global.commands[m[1].lower()](evt, m[2]); else console.log("[commands.js] unknown command: '!%s'", m[1]); };
var _ = require('underscore'); var util = require('util'); exports.setup = function() { global.commands = {}; }; exports.handle = function(evt, msg) { if(msg.slice(0, 1) != "!") return; var m = msg.match(/^!([A-Za-z0-9]+)(?: (.+))?$/); if(!m) return; if(global.commands[m[1].toLowerCase()]) global.commands[m[1].toLowerCase()](evt, m[2]); else console.log("[commands.js] unknown command: '!%s'", m[1]); };
Fix error. Thought this was Python for a second xD
Fix error. Thought this was Python for a second xD
JavaScript
mit
ircah/cah-js,ircah/cah-js
--- +++ @@ -11,8 +11,8 @@ var m = msg.match(/^!([A-Za-z0-9]+)(?: (.+))?$/); if(!m) return; - if(global.commands[m[1].lower()]) - global.commands[m[1].lower()](evt, m[2]); + if(global.commands[m[1].toLowerCase()]) + global.commands[m[1].toLowerCase()](evt, m[2]); else console.log("[commands.js] unknown command: '!%s'", m[1]); };
ce4db4da61560acb8536332b4092dcbf0ae1b9a8
test/case5/case5.js
test/case5/case5.js
;((rc) => { 'use strict'; var tagContent = 'router2-content'; var tagView = 'router2-view'; var div = document.createElement('div'); div.innerHTML = ` <${tagContent} id="case5-1" hash="case5-1"> Case 5-1 <div> <div> <div> <${tagContent} id="case5-11" hash="case5-11"> Case 5-11 </${tagContent}> </div> </div> </div> </${tagContent}> `; var async1 = async_test('Case 5: hash changed to content[hash="case5-1/case5-11"]'); async1.next = async1.step_func(_ => { var check_hash = async1.step_func((e) => { window.removeEventListener('hashchange', check_hash); var content1 = document.querySelector('#case5-1'); var content2 = document.querySelector('#case5-11'); //assert_false(content1.hidden); //assert_false(content2.hidden); //document.body.removeChild(div); async1.done(); rc.next(); }); window.addEventListener('hashchange', check_hash); window.location.hash = "case5-1/case5-11"; }); rc.push(_ => { async1.step(_ => { document.body.appendChild(div); async1.next(); }); }) })(window.routeCases);
;((rc) => { 'use strict'; var tagContent = 'router2-content'; var tagView = 'router2-view'; var div = document.createElement('div'); div.innerHTML = ` <${tagContent} id="case5-1" hash="case5-1"> Case 5-1 <div> <div> <div> <${tagContent} id="case5-11" hash="case5-11"> Case 5-11 </${tagContent}> </div> </div> </div> </${tagContent}> `; var async1 = async_test('Case 5: hash changed to content[hash="case5-1/case5-11"]'); async1.next = async1.step_func(_ => { var check_hash = async1.step_func((e) => { window.removeEventListener('hashchange', check_hash); var content1 = document.querySelector('#case5-1'); var content2 = document.querySelector('#case5-11'); assert_false(content1.hidden); assert_false(content2.hidden); document.body.removeChild(div); async1.done(); rc.next(); }); window.addEventListener('hashchange', check_hash); window.location.hash = "case5-1/case5-11"; }); rc.push(_ => { async1.step(_ => { document.body.appendChild(div); async1.next(); }); }) })(window.routeCases);
Fix the test 1 at case 5
Fix the test 1 at case 5
JavaScript
isc
m3co/router3,m3co/router3
--- +++ @@ -27,10 +27,10 @@ var content1 = document.querySelector('#case5-1'); var content2 = document.querySelector('#case5-11'); - //assert_false(content1.hidden); - //assert_false(content2.hidden); + assert_false(content1.hidden); + assert_false(content2.hidden); - //document.body.removeChild(div); + document.body.removeChild(div); async1.done(); rc.next();
e50a7eec7a8d1cb130da08cdae8c022b82af0e35
app/controllers/sessionobjective.js
app/controllers/sessionobjective.js
import Ember from 'ember'; export default Ember.ObjectController.extend(Ember.I18n.TranslateableProperties, { proxiedObjectives: [], session: null, course: null, actions: { addParent: function(parentProxy){ var newParent = parentProxy.get('content'); var self = this; var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ newParent.get('children').then(function(newParentChildren){ newParentChildren.addObject(sessionObjective); newParent.save().then(function(newParent){ ourParents.addObject(newParent); sessionObjective.save().then(function(sessionObjective){ self.set('model', sessionObjective); }); }); }); }); }, removeParent: function(parentProxy){ var self = this; var removingParent = parentProxy.get('content'); var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ ourParents.removeObject(removingParent); removingParent.get('children').then(function(children){ children.addObject(sessionObjective); sessionObjective.save().then(function(sessionObjective){ self.set('model', sessionObjective); removingParent.save(); }); }); }); } } });
import Ember from 'ember'; export default Ember.ObjectController.extend(Ember.I18n.TranslateableProperties, { proxiedObjectives: [], session: null, course: null, actions: { addParent: function(parentProxy){ var newParent = parentProxy.get('content'); var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ ourParents.addObject(newParent); newParent.get('children').then(function(newParentChildren){ newParentChildren.addObject(sessionObjective); newParent.save(); sessionObjective.save(); }); }); }, removeParent: function(parentProxy){ var removingParent = parentProxy.get('content'); var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ ourParents.removeObject(removingParent); removingParent.get('children').then(function(children){ children.removeObject(sessionObjective); removingParent.save(); sessionObjective.save(); }); }); } } });
Fix issue with removing parent and speed up the process
Fix issue with removing parent and speed up the process
JavaScript
mit
stopfstedt/frontend,stopfstedt/frontend,jrjohnson/frontend,thecoolestguy/frontend,gabycampagna/frontend,thecoolestguy/frontend,jrjohnson/frontend,ilios/frontend,djvoa12/frontend,gboushey/frontend,djvoa12/frontend,gboushey/frontend,ilios/frontend,dartajax/frontend,dartajax/frontend,gabycampagna/frontend
--- +++ @@ -7,32 +7,25 @@ actions: { addParent: function(parentProxy){ var newParent = parentProxy.get('content'); - var self = this; var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ + ourParents.addObject(newParent); newParent.get('children').then(function(newParentChildren){ newParentChildren.addObject(sessionObjective); - newParent.save().then(function(newParent){ - ourParents.addObject(newParent); - sessionObjective.save().then(function(sessionObjective){ - self.set('model', sessionObjective); - }); - }); + newParent.save(); + sessionObjective.save(); }); }); }, removeParent: function(parentProxy){ - var self = this; var removingParent = parentProxy.get('content'); var sessionObjective = this.get('model'); sessionObjective.get('parents').then(function(ourParents){ ourParents.removeObject(removingParent); removingParent.get('children').then(function(children){ - children.addObject(sessionObjective); - sessionObjective.save().then(function(sessionObjective){ - self.set('model', sessionObjective); - removingParent.save(); - }); + children.removeObject(sessionObjective); + removingParent.save(); + sessionObjective.save(); }); }); }
6be5d442638239436104e48cd8977a7742c86c38
bin/repl.js
bin/repl.js
#!/usr/bin/env node var repl = require('repl'); var Chrome = require('../'); Chrome(function (chrome) { var chromeRepl = repl.start({ 'prompt': 'chrome> ' }); chromeRepl.on('exit', function () { chrome.close(); }); for (var domain in chrome) { chromeRepl.context[domain] = chrome[domain]; } });
#!/usr/bin/env node var repl = require('repl'); var protocol = require('../lib/Inspector.json'); var Chrome = require('../'); Chrome(function (chrome) { var chromeRepl = repl.start({ 'prompt': 'chrome> ' }); chromeRepl.on('exit', function () { chrome.close(); }); for (var domainIdx in protocol.domains) { var domainName = protocol.domains[domainIdx].domain; chromeRepl.context[domainName] = chrome[domainName]; } });
Add protocol API only to the REPL context
Add protocol API only to the REPL context
JavaScript
mit
valaxy/chrome-remote-interface,cyrus-and/chrome-remote-interface,washtubs/chrome-remote-interface,cyrus-and/chrome-remote-interface
--- +++ @@ -1,6 +1,7 @@ #!/usr/bin/env node var repl = require('repl'); +var protocol = require('../lib/Inspector.json'); var Chrome = require('../'); Chrome(function (chrome) { @@ -12,7 +13,8 @@ chrome.close(); }); - for (var domain in chrome) { - chromeRepl.context[domain] = chrome[domain]; + for (var domainIdx in protocol.domains) { + var domainName = protocol.domains[domainIdx].domain; + chromeRepl.context[domainName] = chrome[domainName]; } });
c4d7ea7e74d0f81b6b38a6623e47ccfee3a0fab1
src/locale/index.js
src/locale/index.js
import React from 'react' import * as ReactIntl from 'react-intl' import languageResolver from './languageResolver' import messagesFetcher from './messagesFetcher' function wrappedReactIntlProvider(language, localizedMessages) { return function SanityIntlProvider(props) { return <ReactIntl.IntlProvider locale={language} messages={localizedMessages} {...props} /> } } const SanityIntlProviderPromise = languageResolver.then(language => { return messagesFetcher.fetchLocalizedMessages(language).then(localizedMessages => { // TODO: ReactIntl.addLocaleData() return { ReactIntl, SanityIntlProvider: wrappedReactIntlProvider(language, localizedMessages) } }) }) module.exports = SanityIntlProviderPromise
import React from 'react' import * as ReactIntl from 'react-intl' import languageResolver from './languageResolver' import messagesFetcher from './messagesFetcher' function wrappedReactIntlProvider(language, localizedMessages) { return function SanityIntlProvider(props) { return <ReactIntl.IntlProvider locale={language} messages={localizedMessages} {...props} /> } } const SanityIntlPromise = languageResolver.then(language => { return messagesFetcher.fetchLocalizedMessages(language).then(localizedMessages => { const languagePrexif = language.split('-')[0] const localeData = require(`react-intl/locale-data/${languagePrexif}`) ReactIntl.addLocaleData(localeData) return { ReactIntl, SanityIntlProvider: wrappedReactIntlProvider(language, localizedMessages) } }) }) module.exports = SanityIntlPromise
Add localeData for requested lanuage
Add localeData for requested lanuage
JavaScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -10,9 +10,11 @@ } } -const SanityIntlProviderPromise = languageResolver.then(language => { +const SanityIntlPromise = languageResolver.then(language => { return messagesFetcher.fetchLocalizedMessages(language).then(localizedMessages => { - // TODO: ReactIntl.addLocaleData() + const languagePrexif = language.split('-')[0] + const localeData = require(`react-intl/locale-data/${languagePrexif}`) + ReactIntl.addLocaleData(localeData) return { ReactIntl, SanityIntlProvider: wrappedReactIntlProvider(language, localizedMessages) @@ -20,4 +22,4 @@ }) }) -module.exports = SanityIntlProviderPromise +module.exports = SanityIntlPromise
38bc4c6908ef3bd56b4c9d724b218313cb3400a5
webpack.config.production.js
webpack.config.production.js
import webpack from 'webpack'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; import baseConfig from './webpack.config.base'; const config = { ...baseConfig, devtool: 'source-map', entry: './app/index', output: { ...baseConfig.output, publicPath: '../dist/' }, module: { ...baseConfig.module, loaders: [ ...baseConfig.module.loaders, { test: /\.global\.css$/, loader: ExtractTextPlugin.extract( 'style-loader', 'css-loader' ) }, { test: /^((?!\.global).)*\.css$/, loader: ExtractTextPlugin.extract( 'style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' ) } ] }, plugins: [ ...baseConfig.plugins, new webpack.optimize.OccurenceOrderPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }), new webpack.optimize.UglifyJsPlugin({ compressor: { screw_ie8: true, warnings: false } }), new ExtractTextPlugin('style.css', { allChunks: true }) ], target: 'electron-renderer' }; export default config;
import webpack from 'webpack'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; import baseConfig from './webpack.config.base'; const config = { ...baseConfig, devtool: 'source-map', entry: './app/index', output: { ...baseConfig.output, publicPath: '../dist/' }, module: { ...baseConfig.module, loaders: [ ...baseConfig.module.loaders, { test: /\.global\.css$/, loader: ExtractTextPlugin.extract( 'style-loader', 'css-loader' ) }, { test: /^((?!\.global).)*\.css$/, loader: ExtractTextPlugin.extract( 'style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' ) } ] }, plugins: [ ...baseConfig.plugins, new webpack.optimize.OccurrenceOrderPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }), new webpack.optimize.UglifyJsPlugin({ compressor: { screw_ie8: true, warnings: false } }), new ExtractTextPlugin('style.css', { allChunks: true }) ], target: 'electron-renderer' }; export default config;
Fix typo: `OccurenceOrderPlugin` to `OccurrenceOrderPlugin`
Fix typo: `OccurenceOrderPlugin` to `OccurrenceOrderPlugin`
JavaScript
mit
stefanKuijers/aw-fullstack-app,waha3/Electron-NeteaseCloudMusic,treyhuffine/tuchbase,foysalit/wallly-electron,joshuef/peruse,jenyckee/electron-virtual-midi,pahund/scenescreen,dfucci/Borrowr,mitchconquer/electron_cards,xiplias/github-browser,cosio55/app-informacion-bitso,Byte-Code/lm-digital-store-private-test,joshuef/peruse,kaunio/gloso,opensprints/opensprints-electron,kimurakenshi/caravanas,barbalex/kapla3,Andrew-Hird/bFM-desktop,irwinb/table-viewer,waha3/Electron-NeteaseCloudMusic,anthonyraymond/joal-desktop,pahund/scenescreen,kme211/srt-maker,treyhuffine/tuchbase,Byte-Code/lm-digitalstore,ACalix/sprinthub,thirdicrypto/darkwallet-electron-ui,carly-lee/electron-sleep-timer,barbalex/kapla3,eranimo/explorer,anthonyraymond/joal-desktop,chentsulin/electron-react-boilerplate,linuxing3/electron-react,eranimo/explorer,Byte-Code/lm-digital-store-private-test,UniSiegenCSCW/remotino,sdlfj/eq-roll-tracker,riccardopiola/LeagueFlash,swiecki/strigine,espenbjorkeng/Rabagast,gidich/votrient-kiosk,Andrew-Hird/bFM-desktop,sdlfj/eq-roll-tracker,kivo360/ECC-GUI,nantaphop/redd,dfucci/Borrowr,nefa/eletrcon-react-redux,kme211/srt-maker,Sebkasanzew/Electroweb,kimurakenshi/caravanas,mitchconquer/electron_cards,ThomasBaldry/mould-maker-desktop,Byte-Code/lm-digitalstore,foysalit/wallly-electron,JoaoCnh/picto-pc,anthonyraymond/joal-desktop,runandrew/memoriae,lhache/katalogz,swiecki/strigine,thirdicrypto/darkwallet-electron-ui,ACalix/sprinthub,knpwrs/electron-react-boilerplate,linuxing3/electron-react,carly-lee/electron-sleep-timer,TheCbac/MICA-Desktop,irwinb/table-viewer,baublet/lagniappe,nefa/eletrcon-react-redux,knpwrs/electron-react-boilerplate,alecholmez/crew-electron,UniSiegenCSCW/remotino,xuandeng/base_app,ycai2/visual-git-stats,nantaphop/redd,lhache/katalogz,riccardopiola/LeagueFlash,surrealroad/electron-react-boilerplate,ycai2/visual-git-stats,jaytrepka/kryci-jmena,TheCbac/MICA-Desktop,jhen0409/electron-react-boilerplate,xiplias/github-browser,xuandeng/base_app,gidich/votrient-kiosk,alecholmez/crew-electron,jenyckee/electron-virtual-midi,tw00089923/kcr_bom,Sebkasanzew/Electroweb,surrealroad/electron-react-boilerplate,UniSiegenCSCW/remotino,jhen0409/electron-react-boilerplate,eranimo/explorer,JoaoCnh/picto-pc,tw00089923/kcr_bom,espenbjorkeng/Rabagast,kivo360/ECC-GUI,bird-system/bs-label-convertor,ThomasBaldry/mould-maker-desktop,cosio55/app-informacion-bitso,zackhall/ack-chat,runandrew/memoriae,ivtpz/brancher,kaunio/gloso,stefanKuijers/aw-fullstack-app,opensprints/opensprints-electron,chentsulin/electron-react-boilerplate,jaytrepka/kryci-jmena,bird-system/bs-label-convertor,baublet/lagniappe,surrealroad/electron-react-boilerplate,zackhall/ack-chat,ivtpz/brancher
--- +++ @@ -41,7 +41,7 @@ plugins: [ ...baseConfig.plugins, - new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.OccurrenceOrderPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
fd5937050f8f97301d909beadfa3e87ef9f4aa13
src/components/forms/LinksControl.js
src/components/forms/LinksControl.js
import React, { Component, PropTypes } from 'react' import FormControl from './FormControl' /* eslint-disable react/prefer-stateless-function */ class LinksControl extends Component { static propTypes = { text: PropTypes.oneOfType([ PropTypes.string, PropTypes.array, ]), } static defaultProps = { className: 'LinksControl', id: 'external_links', label: 'Links', name: 'user[links]', placeholder: 'Links (optional)', } getLinks() { const { text } = this.props const links = text || '' if (typeof links === 'string') { return links } return links.map((link) => link.text).join(', ') } render() { return ( <FormControl { ...this.props } autoCapitalize="off" autoCorrect="off" maxLength="50" text={ this.getLinks() } type="text" /> ) } } export default LinksControl
import React, { Component, PropTypes } from 'react' import FormControl from './FormControl' /* eslint-disable react/prefer-stateless-function */ class LinksControl extends Component { static propTypes = { text: PropTypes.oneOfType([ PropTypes.string, PropTypes.array, ]), } static defaultProps = { className: 'LinksControl', id: 'external_links', label: 'Links', name: 'user[links]', placeholder: 'Links (optional)', } getLinks() { const { text } = this.props const links = text || '' if (typeof links === 'string') { return links } return links.map((link) => link.text).join(', ') } render() { return ( <FormControl { ...this.props } autoCapitalize="off" autoCorrect="off" text={ this.getLinks() } type="text" /> ) } } export default LinksControl
Remove max-length on links control
Remove max-length on links control The `max-length` attribute was inadvertently added. [Finishes: #119027729](https://www.pivotaltracker.com/story/show/119027729) [#119014219](https://www.pivotaltracker.com/story/show/119014219)
JavaScript
mit
ello/webapp,ello/webapp,ello/webapp
--- +++ @@ -34,7 +34,6 @@ { ...this.props } autoCapitalize="off" autoCorrect="off" - maxLength="50" text={ this.getLinks() } type="text" />
17bcd21bf30b3baabbacb1e45b59c7103b3cdbd3
webpack/webpack.common.config.js
webpack/webpack.common.config.js
// Common webpack configuration used by webpack.hot.config and webpack.rails.config. var path = require("path"); module.exports = { context: __dirname, // the project dir entry: [ "./assets/javascripts/example" ], // In case you wanted to load jQuery from the CDN, this is how you would do it: // externals: { // jquery: "var jQuery" // }, resolve: { root: [path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"), path.join(__dirname, "assets/stylesheets")], extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx", ".scss", ".css", "config.js"] }, module: { loaders: [ { test: require.resolve("react"), loader: "expose?React" } ] } };
// Common webpack configuration used by webpack.hot.config and webpack.rails.config. var path = require("path"); module.exports = { context: __dirname, // the project dir entry: [ "./assets/javascripts/example" ], // In case you wanted to load jQuery from the CDN, this is how you would do it: // externals: { // jquery: "var jQuery" // }, resolve: { root: [path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"), path.join(__dirname, "assets/stylesheets")], extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx", ".scss", ".css", "config.js"] }, module: { loaders: [] } };
Remove exposing React as that was fixed in the React update
Remove exposing React as that was fixed in the React update
JavaScript
mit
mscienski/stpauls,szyablitsky/react-webpack-rails-tutorial,RomanovRoman/react-webpack-rails-tutorial,crmaxx/react-webpack-rails-tutorial,roxolan/react-webpack-rails-tutorial,Rvor/react-webpack-rails-tutorial,phosphene/react-on-rails-cherrypick,jeffthemaximum/Teachers-Dont-Pay-Jeff,shakacode/react-webpack-rails-tutorial,skv-headless/react-webpack-rails-tutorial,skv-headless/react-webpack-rails-tutorial,michaelgruber/react-webpack-rails-tutorial,janklimo/react-webpack-rails-tutorial,stevecj/term_palette_maker,shakacode/react-webpack-rails-tutorial,BadAllOff/react-webpack-rails-tutorial,RomanovRoman/react-webpack-rails-tutorial,jeffthemaximum/jeffline,michaelgruber/react-webpack-rails-tutorial,CerebralStorm/workout_logger,hoffmanc/react-webpack-rails-tutorial,justin808/react-webpack-rails-tutorial,BadAllOff/react-webpack-rails-tutorial,phosphene/react-on-rails-cherrypick,csmalin/react-webpack-rails-tutorial,skv-headless/react-webpack-rails-tutorial,shilu89757/react-webpack-rails-tutorial,bronson/react-webpack-rails-tutorial,shakacode/react-webpack-rails-tutorial,jeffthemaximum/jeffline,janklimo/react-webpack-rails-tutorial,cacheflow/react-webpack-rails-tutorial,cacheflow/react-webpack-rails-tutorial,michaelgruber/react-webpack-rails-tutorial,csterritt/react-webpack-rails-tutorial,janklimo/react-webpack-rails-tutorial,szyablitsky/react-webpack-rails-tutorial,Johnnycus/react-webpack-rails-tutorial,justin808/react-webpack-rails-tutorial,BadAllOff/react-webpack-rails-tutorial,StanBoyet/react-webpack-rails-tutorial,jeffthemaximum/Teachers-Dont-Pay-Jeff,jeffthemaximum/Teachers-Dont-Pay-Jeff,thiagoc7/react-webpack-rails-tutorial,yakovenkodenis/react-webpack-rails-tutorial,CerebralStorm/workout_logger,roxolan/react-webpack-rails-tutorial,thiagoc7/react-webpack-rails-tutorial,crmaxx/react-webpack-rails-tutorial,StanBoyet/react-webpack-rails-tutorial,CerebralStorm/workout_logger,kentwilliam/react-webpack-rails-tutorial,phosphene/react-on-rails-cherrypick,csterritt/react-webpack-rails-tutorial,crmaxx/react-webpack-rails-tutorial,kentwilliam/react-webpack-rails-tutorial,shilu89757/react-webpack-rails-tutorial,roxolan/react-webpack-rails-tutorial,bsy/react-webpack-rails-tutorial,BadAllOff/react-webpack-rails-tutorial,Rvor/react-webpack-rails-tutorial,bsy/react-webpack-rails-tutorial,suzukaze/react-webpack-rails-tutorial,hoffmanc/react-webpack-rails-tutorial,Johnnycus/react-webpack-rails-tutorial,shilu89757/react-webpack-rails-tutorial,kentwilliam/react-webpack-rails-tutorial,bronson/react-webpack-rails-tutorial,stevecj/term_palette_maker,StanBoyet/react-webpack-rails-tutorial,bsy/react-webpack-rails-tutorial,shunwen/react-webpack-rails-tutorial,phosphene/react-on-rails-cherrypick,bsy/react-webpack-rails-tutorial,jeffthemaximum/jeffline,stevecj/term_palette_maker,RomanovRoman/react-webpack-rails-tutorial,StanBoyet/react-webpack-rails-tutorial,shunwen/react-webpack-rails-tutorial,csterritt/react-webpack-rails-tutorial,CerebralStorm/workout_logger,bronson/react-webpack-rails-tutorial,cacheflow/react-webpack-rails-tutorial,jeffthemaximum/Teachers-Dont-Pay-Jeff,csmalin/react-webpack-rails-tutorial,szyablitsky/react-webpack-rails-tutorial,jeffthemaximum/jeffline,suzukaze/react-webpack-rails-tutorial,thiagoc7/react-webpack-rails-tutorial,shunwen/react-webpack-rails-tutorial,Rvor/react-webpack-rails-tutorial,cacheflow/react-webpack-rails-tutorial,crmaxx/react-webpack-rails-tutorial,suzukaze/react-webpack-rails-tutorial,janklimo/react-webpack-rails-tutorial,Johnnycus/react-webpack-rails-tutorial,michaelgruber/react-webpack-rails-tutorial,yakovenkodenis/react-webpack-rails-tutorial,RomanovRoman/react-webpack-rails-tutorial,justin808/react-webpack-rails-tutorial,hoffmanc/react-webpack-rails-tutorial,shilu89757/react-webpack-rails-tutorial,yakovenkodenis/react-webpack-rails-tutorial,yakovenkodenis/react-webpack-rails-tutorial,shunwen/react-webpack-rails-tutorial,szyablitsky/react-webpack-rails-tutorial,suzukaze/react-webpack-rails-tutorial,jeffthemaximum/Teachers-Dont-Pay-Jeff,stevecj/term_palette_maker,csmalin/react-webpack-rails-tutorial,justin808/react-webpack-rails-tutorial,shakacode/react-webpack-rails-tutorial,bronson/react-webpack-rails-tutorial,hoffmanc/react-webpack-rails-tutorial,jeffthemaximum/jeffline,skv-headless/react-webpack-rails-tutorial,thiagoc7/react-webpack-rails-tutorial,Johnnycus/react-webpack-rails-tutorial,csmalin/react-webpack-rails-tutorial,roxolan/react-webpack-rails-tutorial,csterritt/react-webpack-rails-tutorial,Rvor/react-webpack-rails-tutorial,kentwilliam/react-webpack-rails-tutorial,mscienski/stpauls
--- +++ @@ -16,8 +16,6 @@ extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx", ".scss", ".css", "config.js"] }, module: { - loaders: [ - { test: require.resolve("react"), loader: "expose?React" } - ] + loaders: [] } };
255c7b47e7686650f5712fb2632d3b4c0e863d64
src/lib/substituteVariantsAtRules.js
src/lib/substituteVariantsAtRules.js
import _ from 'lodash' import postcss from 'postcss' const variantGenerators = { hover: (container, config) => { const cloned = container.clone() cloned.walkRules(rule => { rule.selector = `.hover${config.options.separator}${rule.selector.slice(1)}:hover` }) return cloned.nodes }, focus: (container, config) => { const cloned = container.clone() cloned.walkRules(rule => { rule.selector = `.focus${config.options.separator}${rule.selector.slice(1)}:focus` }) return cloned.nodes }, } export default function(config) { return function(css) { const unwrappedConfig = config() css.walkAtRules('variants', atRule => { const variants = postcss.list.comma(atRule.params) if (variants.includes('responsive')) { const responsiveParent = postcss.atRule({ name: 'responsive' }) atRule.before(responsiveParent) responsiveParent.append(atRule) } atRule.before(atRule.clone().nodes) _.forEach(['focus', 'hover'], variant => { if (variants.includes(variant)) { atRule.before(variantGenerators[variant](atRule, unwrappedConfig)) } }) atRule.remove() }) } }
import _ from 'lodash' import postcss from 'postcss' const variantGenerators = { hover: (container, config) => { const cloned = container.clone() cloned.walkRules(rule => { rule.selector = `.hover${config.options.separator}${rule.selector.slice(1)}:hover` }) container.before(cloned.nodes) }, focus: (container, config) => { const cloned = container.clone() cloned.walkRules(rule => { rule.selector = `.focus${config.options.separator}${rule.selector.slice(1)}:focus` }) container.before(cloned.nodes) }, } export default function(config) { return function(css) { const unwrappedConfig = config() css.walkAtRules('variants', atRule => { const variants = postcss.list.comma(atRule.params) if (variants.includes('responsive')) { const responsiveParent = postcss.atRule({ name: 'responsive' }) atRule.before(responsiveParent) responsiveParent.append(atRule) } atRule.before(atRule.clone().nodes) _.forEach(['focus', 'hover'], variant => { if (variants.includes(variant)) { variantGenerators[variant](atRule, unwrappedConfig) } }) atRule.remove() }) } }
Move responsibility for appending nodes into variant generators themselves
Move responsibility for appending nodes into variant generators themselves
JavaScript
mit
tailwindlabs/tailwindcss,tailwindlabs/tailwindcss,tailwindlabs/tailwindcss,tailwindcss/tailwindcss
--- +++ @@ -9,7 +9,7 @@ rule.selector = `.hover${config.options.separator}${rule.selector.slice(1)}:hover` }) - return cloned.nodes + container.before(cloned.nodes) }, focus: (container, config) => { const cloned = container.clone() @@ -18,7 +18,7 @@ rule.selector = `.focus${config.options.separator}${rule.selector.slice(1)}:focus` }) - return cloned.nodes + container.before(cloned.nodes) }, } @@ -39,7 +39,7 @@ _.forEach(['focus', 'hover'], variant => { if (variants.includes(variant)) { - atRule.before(variantGenerators[variant](atRule, unwrappedConfig)) + variantGenerators[variant](atRule, unwrappedConfig) } })
fcb2a9ecda9fe5dfb9484531ab697ef4c26ae608
test/create-test.js
test/create-test.js
var tape = require("tape"), jsdom = require("jsdom"), d3 = Object.assign(require("../"), require("d3-selection")); /************************************* ************ Components ************* *************************************/ // Leveraging create hook with selection as first argument. var checkboxHTML = ` <label class="form-check-label"> <input type="checkbox" class="form-check-input"> <span class="checkbox-label-span"></span> </label> `, checkbox = d3.component("div", "form-check") .create(function (selection){ selection.html(checkboxHTML); }) .render(function (selection, props){ if(props && props.label){ selection.select(".checkbox-label-span") .text(props.label); } }); /************************************* ************** Tests **************** *************************************/ tape("Create hook should pass selection on enter.", function(test) { var div = d3.select(jsdom.jsdom().body).append("div"); div.call(checkbox); test.equal(div.html(), `<div class="form-check">${checkboxHTML}</div>`); test.end(); }); tape("Render should have access to selection content from create hook.", function(test) { var div = d3.select(jsdom.jsdom().body).append("div"); div.call(checkbox, { label: "My Checkbox"}); test.equal(div.select(".checkbox-label-span").text(), "My Checkbox"); test.end(); });
var tape = require("tape"), jsdom = require("jsdom"), d3 = Object.assign(require("../"), require("d3-selection")); /************************************* ************ Components ************* *************************************/ // Leveraging create hook with selection as first argument. var card = d3.component("div", "card") .create(function (selection){ selection .append("div").attr("class", "card-block") .append("div").attr("class", "card-text"); }) .render(function (selection, props){ selection .select(".card-text") .text(props.text); }); /************************************* ************** Tests **************** *************************************/ tape("Create hook should pass selection on enter.", function(test) { var div = d3.select(jsdom.jsdom().body).append("div"); div.call(card, { text: "I'm in a card." }); test.equal(div.html(), [ '<div class="card">', '<div class="card-block">', '<div class="card-text">', "I\'m in a card.", "</div>", "</div>", "</div>" ].join("")); test.end(); });
Change test to use card concept
Change test to use card concept
JavaScript
bsd-3-clause
curran/d3-component
--- +++ @@ -7,21 +7,16 @@ *************************************/ // Leveraging create hook with selection as first argument. -var checkboxHTML = ` - <label class="form-check-label"> - <input type="checkbox" class="form-check-input"> - <span class="checkbox-label-span"></span> - </label> - `, - checkbox = d3.component("div", "form-check") +var card = d3.component("div", "card") .create(function (selection){ - selection.html(checkboxHTML); + selection + .append("div").attr("class", "card-block") + .append("div").attr("class", "card-text"); }) .render(function (selection, props){ - if(props && props.label){ - selection.select(".checkbox-label-span") - .text(props.label); - } + selection + .select(".card-text") + .text(props.text); }); @@ -30,14 +25,15 @@ *************************************/ tape("Create hook should pass selection on enter.", function(test) { var div = d3.select(jsdom.jsdom().body).append("div"); - div.call(checkbox); - test.equal(div.html(), `<div class="form-check">${checkboxHTML}</div>`); + div.call(card, { text: "I'm in a card." }); + test.equal(div.html(), [ + '<div class="card">', + '<div class="card-block">', + '<div class="card-text">', + "I\'m in a card.", + "</div>", + "</div>", + "</div>" + ].join("")); test.end(); }); - -tape("Render should have access to selection content from create hook.", function(test) { - var div = d3.select(jsdom.jsdom().body).append("div"); - div.call(checkbox, { label: "My Checkbox"}); - test.equal(div.select(".checkbox-label-span").text(), "My Checkbox"); - test.end(); -});
3500fe09fd8aba9d9d789f1308d57955aaeacd5d
public/javascripts/page.js
public/javascripts/page.js
$(function() { var socket = new WebSocket("ws://" + window.location.host + "/"); socket.onmessage = function(message){ console.log('got a message: ') console.log(message) } });
$(function() { var socket = new WebSocket("ws://" + window.location.host + "/"); socket.addEventListener('message', function(message){ console.log('got a message: ') console.log(message) }); });
Use addEventListener rather than onmessage
Use addEventListener rather than onmessage
JavaScript
mit
portlandcodeschool-jsi/barebones-chat,portlandcodeschool-jsi/barebones-chat
--- +++ @@ -1,9 +1,9 @@ $(function() { var socket = new WebSocket("ws://" + window.location.host + "/"); - socket.onmessage = function(message){ + socket.addEventListener('message', function(message){ console.log('got a message: ') console.log(message) - } + }); });
1a8ad6d06e5b465ee331cbc5c4957862edf31950
test/fixtures/output_server.js
test/fixtures/output_server.js
/* * grunt-external-daemon * https://github.com/jlindsey/grunt-external-daemon * * Copyright (c) 2013 Joshua Lindsey * Licensed under the MIT license. */ 'use strict'; process.stdout.write("STDOUT Message"); process.stderr.write("STDERR Message");
/* * grunt-external-daemon * https://github.com/jlindsey/grunt-external-daemon * * Copyright (c) 2013 Joshua Lindsey * Licensed under the MIT license. */ 'use strict'; process.stdout.setEncoding('utf-8'); process.stderr.setEncoding('utf-8'); process.stdout.write("STDOUT Message"); process.stderr.write("STDERR Message");
Add encoding to output server streams
Add encoding to output server streams
JavaScript
mit
jlindsey/grunt-external-daemon
--- +++ @@ -8,5 +8,8 @@ 'use strict'; +process.stdout.setEncoding('utf-8'); +process.stderr.setEncoding('utf-8'); + process.stdout.write("STDOUT Message"); process.stderr.write("STDERR Message");
ea850baf397ae98a78222691e1f38571d66d029c
db/config.js
db/config.js
//For Heroku Deployment var URI = require('urijs'); var config = URI.parse(process.env.DATABASE_URL); config['ssl'] = true; module.exports = config; // module.exports = { // database: 'sonder', // user: 'postgres', // //password: 'postgres', // port: 32769, // host: '192.168.99.100' // };
//For Heroku Deployment var URI = require('urijs'); // var config = URI.parse(process.env.DATABASE_URL); // config['ssl'] = true; var config = process.env.DATABASE_URL; module.exports = config; // module.exports = { // database: 'sonder', // user: 'postgres', // //password: 'postgres', // port: 32769, // host: '192.168.99.100' // };
Connect to PG via ENV string
Connect to PG via ENV string
JavaScript
mit
aarontrank/SonderServer,MapReactor/SonderServer,MapReactor/SonderServer,aarontrank/SonderServer
--- +++ @@ -1,8 +1,9 @@ //For Heroku Deployment var URI = require('urijs'); -var config = URI.parse(process.env.DATABASE_URL); -config['ssl'] = true; +// var config = URI.parse(process.env.DATABASE_URL); +// config['ssl'] = true; +var config = process.env.DATABASE_URL; module.exports = config; // module.exports = { // database: 'sonder',
7470675462f60a8260ca6f9d8e890f297046bee5
src/frontend/components/UserApp.js
src/frontend/components/UserApp.js
import React from "react"; import RightColumn from "./RightColumn"; const UserApp = ({ children }) => ( <div className="main-container"> <section className="who-are-we"> <h1>GBG tech</h1> </section> <section className="row center-container"> <section className="content"> {children} </section> <RightColumn/> </section> </div> ); export default UserApp;
import React from "react"; import RightColumn from "./RightColumn"; const UserApp = ({ children }) => ( <div className="main-container"> <section className="who-are-we"> <h1>#gbgtech</h1> </section> <section className="row center-container"> <section className="content"> {children} </section> <RightColumn/> </section> </div> ); export default UserApp;
Use lowercase name of gbgtech
Use lowercase name of gbgtech
JavaScript
mit
gbgtech/gbgtechWeb,gbgtech/gbgtechWeb
--- +++ @@ -4,7 +4,7 @@ const UserApp = ({ children }) => ( <div className="main-container"> <section className="who-are-we"> - <h1>GBG tech</h1> + <h1>#gbgtech</h1> </section> <section className="row center-container"> <section className="content">
588a552ce9750a70f0c80ed574c139f563d5ffcc
optimize/index.js
optimize/index.js
var eng = require('./node/engine'); var index = module.exports = { localMinimize: function(func, options, callback) { eng.runPython('local', func, options, callback); }, globalMinimize: function(func, options, callback) { eng.runPython('global', func, options, callback); }, nonNegLeastSquares: function(A, b, callback) { eng.runPython('nnls', A, b, callback); }, fitCurve: function(func, xData, yData, options, callback) { eng.runPython('fit', func, options, callback, xData, yData); }, findRoot: function(func, lower, upper, options, callback) { eng.runPython('root', func, options, callback, lower, upper); } }; index.fitCurve.linear = function(xData, yData, callback) { eng.runPython('fit', 'a * x + b', { variables: ['x', 'a', 'b'] }, callback, xData, yData); }; index.fitCurve.quadratic = function(xData, yData, callback) { eng.runPython('fit', 'a * (x**2) + b * x + c', { variables: ['x', 'a', 'b', 'c'] }, callback, xData, yData); };
var eng = require('./node/engine'); var index = module.exports = { localMinimize: function(func, options, callback) { eng.runPython('local', func, options, callback); }, globalMinimize: function(func, options, callback) { eng.runPython('global', func, options, callback); }, minimizeEuclideanNorm: function(A, b, callback) { eng.runPython('nnls', A, b, callback); }, fitCurve: function(func, xData, yData, options, callback) { eng.runPython('fit', func, options, callback, xData, yData); }, findRoot: function(func, lower, upper, options, callback) { eng.runPython('root', func, options, callback, lower, upper); }, findVectorRoot: function(func, guess, options, callback) { eng.runPython('vectorRoot', func, options, callback, guess); }, calcDerivatives: function(func, point, options, callback) { eng.runPython('derivative', func, options, callback, point); } }; index.fitCurve.linear = function(xData, yData, callback) { eng.runPython('fit', 'a * x + b', { variables: ['x', 'a', 'b'] }, callback, xData, yData); }; index.fitCurve.quadratic = function(xData, yData, callback) { eng.runPython('fit', 'a * (x**2) + b * x + c', { variables: ['x', 'a', 'b', 'c'] }, callback, xData, yData); };
Add API for derivative, vector root
Add API for derivative, vector root
JavaScript
mit
acjones617/scipy-node,acjones617/scipy-node
--- +++ @@ -7,7 +7,7 @@ globalMinimize: function(func, options, callback) { eng.runPython('global', func, options, callback); }, - nonNegLeastSquares: function(A, b, callback) { + minimizeEuclideanNorm: function(A, b, callback) { eng.runPython('nnls', A, b, callback); }, fitCurve: function(func, xData, yData, options, callback) { @@ -15,6 +15,12 @@ }, findRoot: function(func, lower, upper, options, callback) { eng.runPython('root', func, options, callback, lower, upper); + }, + findVectorRoot: function(func, guess, options, callback) { + eng.runPython('vectorRoot', func, options, callback, guess); + }, + calcDerivatives: function(func, point, options, callback) { + eng.runPython('derivative', func, options, callback, point); } };
cda7032237124def696840041c872e5fc9427ad4
delighted.js
delighted.js
var Delighted = require('./lib/delighted'); module.exports = function(key) { return new Delighted(key); };
var Delighted = require('./lib/Delighted'); module.exports = function(key) { return new Delighted(key); };
Change case for required Delighted in lib
Change case for required Delighted in lib Linux is case sensitive and fails to load the required file.
JavaScript
mit
delighted/delighted-node
--- +++ @@ -1,4 +1,4 @@ -var Delighted = require('./lib/delighted'); +var Delighted = require('./lib/Delighted'); module.exports = function(key) { return new Delighted(key);
94396993d1a0552559cb5b822f797adee09ea2b1
test/com/spinal/ioc/plugins/theme-test.js
test/com/spinal/ioc/plugins/theme-test.js
/** * com.spinal.ioc.plugins.ThemePlugin Class Tests * @author Patricio Ferreira <3dimentionar@gmail.com> **/ define(['ioc/plugins/theme'], function(ThemePlugin) { describe('com.spinal.ioc.plugins.ThemePlugin', function() { before(function() { }); after(function() { }); describe('#new()', function() { }); }); });
/** * com.spinal.ioc.plugins.ThemePlugin Class Tests * @author Patricio Ferreira <3dimentionar@gmail.com> **/ define(['ioc/plugins/theme'], function(ThemePlugin) { describe('com.spinal.ioc.plugins.ThemePlugin', function() { before(function() { this.plugin = null; }); after(function() { delete this.plugin; }); describe('#new()', function() { it('Should return an instance of ThemePlugin'); }); describe('#parse()', function() { it('Should parse themes from specified on a given spec'); }); describe('#currentTheme()', function() { it('Should return the current theme'); }); describe('#useBootstrap()', function() { it('Should inject bootstrap-core and bootstrap-theme'); it('Should inject only bootstrap-core'); it('Should inject only bootstrap-theme'); }); describe('#useDefault()', function() { it('Should inject theme flagged as default'); }); describe('#validate()', function() { it('Should return false: theme name is not a String'); it('Should return false: theme is not registered'); it('Should return false: current theme is the same as the one being validated'); }); describe('#applyTheme()', function() { it('Should inject a given theme'); }); describe('#removeTheme()', function() { it('Should remove all themes except for bootstrap core and theme'); }); describe('#resolveURI()', function() { it('Should resolve theme URI for a given theme path'); }); describe('#getTheme()', function() { it('Should retrieve a theme object registered given a theme name'); it('Should NOT retrieve a theme object registered given a theme name'); }); describe('#changeTheme()', function() { it('Should change the current theme with another one given a theme name'); }); describe('#run()', function() { it('Should executes plugin logic'); }); }); });
Test cases for ThemePlugin Class added to the unit test file.
Test cases for ThemePlugin Class added to the unit test file.
JavaScript
mit
nahuelio/boneyard,3dimention/spinal,3dimention/boneyard
--- +++ @@ -7,14 +7,92 @@ describe('com.spinal.ioc.plugins.ThemePlugin', function() { before(function() { + this.plugin = null; + }); + + after(function() { + delete this.plugin; + }); + + describe('#new()', function() { + + it('Should return an instance of ThemePlugin'); }); - after(function() { + describe('#parse()', function() { + + it('Should parse themes from specified on a given spec'); }); - describe('#new()', function() { + describe('#currentTheme()', function() { + + it('Should return the current theme'); + + }); + + describe('#useBootstrap()', function() { + + it('Should inject bootstrap-core and bootstrap-theme'); + + it('Should inject only bootstrap-core'); + + it('Should inject only bootstrap-theme'); + + }); + + describe('#useDefault()', function() { + + it('Should inject theme flagged as default'); + + }); + + describe('#validate()', function() { + + it('Should return false: theme name is not a String'); + + it('Should return false: theme is not registered'); + + it('Should return false: current theme is the same as the one being validated'); + + }); + + describe('#applyTheme()', function() { + + it('Should inject a given theme'); + + }); + + describe('#removeTheme()', function() { + + it('Should remove all themes except for bootstrap core and theme'); + + }); + + describe('#resolveURI()', function() { + + it('Should resolve theme URI for a given theme path'); + + }); + + describe('#getTheme()', function() { + + it('Should retrieve a theme object registered given a theme name'); + + it('Should NOT retrieve a theme object registered given a theme name'); + + }); + + describe('#changeTheme()', function() { + + it('Should change the current theme with another one given a theme name'); + + }); + + describe('#run()', function() { + + it('Should executes plugin logic'); });
53b76340aa614a01a206a728f14406aa1cdef1c9
test/e2e/page/create/create_result_box.js
test/e2e/page/create/create_result_box.js
'use strict'; (function (module, undefined) { function CreateResultBox(elem) { // TODO: add property 'list' and 'details' for each UI state. this.elem = elem; this.list = new TimetableList(elem); } Object.defineProperties(CreateResultBox.prototype, { 'showingList': { value: true }, 'showingDetails': { value: false } }); CreateResultBox.prototype.clickGenerateButton = function () { return this.elem.$('.btn-generate').click(); }; module.exports = CreateResultBox; function TimetableList(box) { this.ttElems = box.$$('.item-timetable'); } Object.defineProperties(TimetableList.prototype, { 'nTimetables': { get: function () { return this.ttElems.count(); } } }); TimetableList.prototype.getItemAt = function (index) { return new TimetableListItem(this.ttElems.get(index)); }; function TimetableListItem(elem) { this.elem = elem; } Object.defineProperties(TimetableListItem.prototype, { 'credits': { get: function () { return this.elem.$('.credits').getText(); } }, 'nClassDays': { get: function () { return this.elem.$('.n-class-days').getText(); } }, 'nFreeHours': { get: function () { return this.elem.$('.n-free-hours').getText(); } } }); })(module);
'use strict'; (function (module, undefined) { function CreateResultBox(elem) { // TODO: add property 'list' and 'details' for each UI state. this.elem = elem; this.list = new TimetableList(elem); } Object.defineProperties(CreateResultBox.prototype, { 'showingList': { value: true }, 'showingDetails': { value: false } }); module.exports = CreateResultBox; function TimetableList(box) { this.ttElems = box.$$('.item-timetable'); } Object.defineProperties(TimetableList.prototype, { 'nTimetables': { get: function () { return this.ttElems.count(); } } }); TimetableList.prototype.getItemAt = function (index) { return new TimetableListItem(this.ttElems.get(index)); }; function TimetableListItem(elem) { this.elem = elem; } Object.defineProperties(TimetableListItem.prototype, { 'credits': { get: function () { return this.elem.$('.credits').getText(); } }, 'nClassDays': { get: function () { return this.elem.$('.n-class-days').getText(); } }, 'nFreeHours': { get: function () { return this.elem.$('.n-free-hours').getText(); } } }); })(module);
Remove useless & wrong code for CreateResultBox
Remove useless & wrong code for CreateResultBox * Copy & paste sucks.
JavaScript
mit
kyukyukyu/dash-web,kyukyukyu/dash-web
--- +++ @@ -15,9 +15,6 @@ value: false } }); - CreateResultBox.prototype.clickGenerateButton = function () { - return this.elem.$('.btn-generate').click(); - }; module.exports = CreateResultBox;
27b391f8bdf57b9c3215ef99a29351ba55db65f5
public/main.js
public/main.js
$(function() { var formatted_string = 'hoge'; // $('#text_output').text(formatted_string); $('#text_input').bind('keyup', function(e) { var text = $('#text_input').val(); console.log(text); $.ajax({ url: 'http://localhost:9292/parse/', method: 'POST', crossDomain: true, data: {'text': text} }).error(function() { console.log('Error'); }).done(function(text) { console.log(text); update(text); }); }); }); function update(formatted_string) { $('#text_output').html(formatted_string); }
$(function() { var formatted_string = 'hoge'; // $('#text_output').text(formatted_string); $('#text_input').bind('keyup', function(e) { var text = $('#text_input').val(); console.log(text); parse(text); }); }); function update(formatted_string) { $('#text_output').html(formatted_string); } function parse(text) { $.ajax({ url: 'http://localhost:9292/parse/', method: 'POST', crossDomain: true, data: {'text': text} }).error(function() { console.log('Error'); }).done(function(text) { console.log(text); update(text); }); }
Split out to parse function
Split out to parse function
JavaScript
mit
gouf/test_sinatra_markdown_preview,gouf/test_sinatra_markdown_preview
--- +++ @@ -4,20 +4,24 @@ $('#text_input').bind('keyup', function(e) { var text = $('#text_input').val(); console.log(text); - $.ajax({ - url: 'http://localhost:9292/parse/', - method: 'POST', - crossDomain: true, - data: {'text': text} - }).error(function() { - console.log('Error'); - }).done(function(text) { - console.log(text); - update(text); - }); + parse(text); }); }); function update(formatted_string) { $('#text_output').html(formatted_string); } + +function parse(text) { + $.ajax({ + url: 'http://localhost:9292/parse/', + method: 'POST', + crossDomain: true, + data: {'text': text} + }).error(function() { + console.log('Error'); + }).done(function(text) { + console.log(text); + update(text); + }); +}
512ebaf12ea76d3613c2742d4ea5b61a257e5e04
test/templateLayout.wefTest.js
test/templateLayout.wefTest.js
/*! * templateLayout tests * Copyright (c) 2011 Pablo Escalada * MIT Licensed */ TestCase("templateLayout", { "test templateLayout registration":function () { assertNotUndefined(wef.plugins.registered.templateLayout); assertEquals("templateLayout", wef.plugins.registered["templateLayout"].name); }, "test templateLayout namespace":function () { assertNotUndefined(wef.plugins.templateLayout); assertEquals("templateLayout", wef.plugins.templateLayout.name); } }); AsyncTestCase("templateLayoutAsync", { "test templateLayout listen cssParser events":function (queue) { //requires cssParser var text = "body {display-model: \"a (intrinsic), b (intrinsic)\";} div#uno {situated: a; display-model: \"123 (intrinsic)\";}"; queue.call(function (callbacks) { var myCallback = callbacks.add(function () { wef.plugins.registered.templateLayout.templateLayout(); wef.plugins.registered.cssParser.cssParser().parse(text); }); window.setTimeout(myCallback, 5000); }); queue.call(function () { var result = wef.plugins.registered.templateLayout.getLastEvent().property; //console.log(result); assertEquals("display-model", result); }) } })
/*! * templateLayout tests * Copyright (c) 2011 Pablo Escalada * MIT Licensed */ TestCase("templateLayout", { "test templateLayout registration":function () { assertNotUndefined(wef.plugins.registered.templateLayout); assertEquals("templateLayout", wef.plugins.registered.templateLayout.name); }, "test templateLayout namespace":function () { assertNotUndefined(wef.fn.templateLayout); assertEquals("templateLayout", wef.fn.templateLayout.name); } }); AsyncTestCase("templateLayoutAsync", { "test templateLayout listen cssParser events":function (queue) { //requires cssParser var text = "body {display-model: \"a (intrinsic), b (intrinsic)\";} div#uno {situated: a; display-model: \"123 (intrinsic)\";}"; queue.call(function (callbacks) { var myCallback = callbacks.add(function () { wef.fn.templateLayout.init(); wef.fn.cssParser.init().parse(text); }); window.setTimeout(myCallback, 5000); }); queue.call(function () { var result = wef.fn.templateLayout.getLastEvent().property; //console.log(result); assertEquals("display-model", result); }) } })
Update code to pass tests
Update code to pass tests
JavaScript
mit
diesire/cssTemplateLayout,diesire/cssTemplateLayout,diesire/cssTemplateLayout
--- +++ @@ -6,11 +6,11 @@ TestCase("templateLayout", { "test templateLayout registration":function () { assertNotUndefined(wef.plugins.registered.templateLayout); - assertEquals("templateLayout", wef.plugins.registered["templateLayout"].name); + assertEquals("templateLayout", wef.plugins.registered.templateLayout.name); }, "test templateLayout namespace":function () { - assertNotUndefined(wef.plugins.templateLayout); - assertEquals("templateLayout", wef.plugins.templateLayout.name); + assertNotUndefined(wef.fn.templateLayout); + assertEquals("templateLayout", wef.fn.templateLayout.name); } }); @@ -20,14 +20,14 @@ var text = "body {display-model: \"a (intrinsic), b (intrinsic)\";} div#uno {situated: a; display-model: \"123 (intrinsic)\";}"; queue.call(function (callbacks) { var myCallback = callbacks.add(function () { - wef.plugins.registered.templateLayout.templateLayout(); - wef.plugins.registered.cssParser.cssParser().parse(text); + wef.fn.templateLayout.init(); + wef.fn.cssParser.init().parse(text); }); window.setTimeout(myCallback, 5000); }); queue.call(function () { - var result = wef.plugins.registered.templateLayout.getLastEvent().property; + var result = wef.fn.templateLayout.getLastEvent().property; //console.log(result); assertEquals("display-model", result); })
302c3434a44b3e51d84b70e801a72e9119f106f4
src/scripts/main.js
src/scripts/main.js
// ES2015 polyfill import 'babel-polyfill'; // Modernizr import './modernizr'; // Components import './components/example';
// Polyfills // Only use the polyfills you need e.g // import 'core-js/object'; // import 'js-polyfills/html'; // Modernizr import './modernizr'; // Components import './components/example';
Use core-js and js-polyfills instead of babel-polyfill
Use core-js and js-polyfills instead of babel-polyfill
JavaScript
mit
strt/strt-boilerplate,strt/strt-boilerplate
--- +++ @@ -1,5 +1,7 @@ -// ES2015 polyfill -import 'babel-polyfill'; +// Polyfills +// Only use the polyfills you need e.g +// import 'core-js/object'; +// import 'js-polyfills/html'; // Modernizr import './modernizr';
940f4f4da198335f51c2f8e76fc1c0caffb7736c
__tests__/index.js
__tests__/index.js
import config from "../" import postcss from "postcss" import stylelint from "stylelint" import test from "tape" test("basic properties of config", t => { t.ok(isObject(config.rules), "rules is object") t.end() }) function isObject(obj) { return typeof obj === "object" && obj !== null } const css = ( `a { \ttop: .2em; } `) postcss() .use(stylelint(config)) .process(css) .then(checkResult) .catch(e => console.log(e.stack)) function checkResult(result) { const { messages } = result test("expected warnings", t => { t.equal(messages.length, 1, "flags one warning") t.ok(messages.every(m => m.type === "warning"), "message of type warning") t.ok(messages.every(m => m.plugin === "stylelint"), "message of plugin stylelint") t.equal(messages[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") t.end() }) }
import config from "../" import stylelint from "stylelint" import test from "tape" test("basic properties of config", t => { t.ok(isObject(config.rules), "rules is object") t.end() }) function isObject(obj) { return typeof obj === "object" && obj !== null } const css = ( `a { \ttop: .2em; } `) stylelint.lint({ code: css, config: config, }) .then(checkResult) .catch(function (err) { console.error(err.stack) }) function checkResult(data) { const { errored, results } = data const { warnings } = results[0] test("expected warnings", t => { t.ok(errored, "errored") t.equal(warnings.length, 1, "flags one warning") t.equal(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") t.end() }) }
Use stylelint standalone API in test
Use stylelint standalone API in test
JavaScript
mit
ntwb/stylelint-config-wordpress,WordPress-Coding-Standards/stylelint-config-wordpress,GaryJones/stylelint-config-wordpress,stylelint/stylelint-config-wordpress
--- +++ @@ -1,5 +1,4 @@ import config from "../" -import postcss from "postcss" import stylelint from "stylelint" import test from "tape" @@ -19,19 +18,22 @@ `) -postcss() - .use(stylelint(config)) - .process(css) - .then(checkResult) - .catch(e => console.log(e.stack)) +stylelint.lint({ + code: css, + config: config, +}) +.then(checkResult) +.catch(function (err) { + console.error(err.stack) +}) -function checkResult(result) { - const { messages } = result +function checkResult(data) { + const { errored, results } = data + const { warnings } = results[0] test("expected warnings", t => { - t.equal(messages.length, 1, "flags one warning") - t.ok(messages.every(m => m.type === "warning"), "message of type warning") - t.ok(messages.every(m => m.plugin === "stylelint"), "message of plugin stylelint") - t.equal(messages[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") + t.ok(errored, "errored") + t.equal(warnings.length, 1, "flags one warning") + t.equal(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") t.end() }) }
fd7dda54d0586906ccd07726352ba8566176ef71
app/scripts/app.js
app/scripts/app.js
(function () { 'use strict'; /** * ngInject */ function StateConfig($urlRouterProvider) { $urlRouterProvider.otherwise('/'); } // color ramp for sectors var sectorColors = { 'School (K-12)': '#A6CEE3', 'Office': '#1F78B4', 'Warehouse': '#B2DF8A', 'College/ University': '#33A02C', 'Other': '#FB9A99', 'Retail': '#E31A1C', 'Municipal': '#FDBF6F', 'Multifamily': '#FF7F00', 'Hotel': '#CAB2D6', 'Industrial': '#6A3D9A', 'Unknown': '#DDDDDD' }; /** * @ngdoc overview * @name mos * @description * # mos * * Main module of the application. */ angular .module('mos', [ 'mos.views.charts', 'mos.views.map', 'mos.views.info', 'mos.views.detail', 'mos.views.compare', 'headroom' ]).config(StateConfig); angular.module('mos').constant('MOSColors', sectorColors); })();
(function () { 'use strict'; /** * ngInject */ function StateConfig($urlRouterProvider) { $urlRouterProvider.otherwise('/'); } // color ramp for sectors var sectorColors = { 'School (K-12)': '#A6CEE3', 'Office': '#1F78B4', 'Medical Office': '#52A634', 'Warehouse': '#B2DF8A', 'College/ University': '#33A02C', 'Other': '#FB9A99', 'Retail': '#E31A1C', 'Municipal': '#FDBF6F', 'Multifamily': '#FF7F00', 'Hotel': '#CAB2D6', 'Industrial': '#6A3D9A', 'Worship': '#9C90C4', 'Supermarket': '#E8AE6C', 'Parking': '#C9DBE6', 'Laboratory': '#3AA3FF', 'Hospital': '#C6B4FF', 'Data Center': '#B8FFA8', 'Unknown': '#DDDDDD' }; /** * @ngdoc overview * @name mos * @description * # mos * * Main module of the application. */ angular .module('mos', [ 'mos.views.charts', 'mos.views.map', 'mos.views.info', 'mos.views.detail', 'mos.views.compare', 'headroom' ]).config(StateConfig); angular.module('mos').constant('MOSColors', sectorColors); })();
Add remaining building types to MOSColors
Add remaining building types to MOSColors
JavaScript
mit
azavea/mos-energy-benchmark,azavea/mos-energy-benchmark,azavea/mos-energy-benchmark
--- +++ @@ -13,6 +13,7 @@ var sectorColors = { 'School (K-12)': '#A6CEE3', 'Office': '#1F78B4', + 'Medical Office': '#52A634', 'Warehouse': '#B2DF8A', 'College/ University': '#33A02C', 'Other': '#FB9A99', @@ -21,6 +22,12 @@ 'Multifamily': '#FF7F00', 'Hotel': '#CAB2D6', 'Industrial': '#6A3D9A', + 'Worship': '#9C90C4', + 'Supermarket': '#E8AE6C', + 'Parking': '#C9DBE6', + 'Laboratory': '#3AA3FF', + 'Hospital': '#C6B4FF', + 'Data Center': '#B8FFA8', 'Unknown': '#DDDDDD' };
dfcde972cde79fd3f354366ac3d9f3bc136a5981
app/server/grid.js
app/server/grid.js
import _ from 'underscore'; class Grid { // The state of a particular game grid constructor({ columnCount = 7, rowCount = 6, columns = _.times(columnCount, () => []), lastPlacedChip = null }) { this.columnCount = columnCount; this.rowCount = rowCount; this.columns = columns; this.lastPlacedChip = lastPlacedChip; } // Reset the grid by removing all placed chips resetGrid() { this.columns.forEach((column) => { column.length = 0; }); this.lastPlacedChip = null; } // Place the given chip into the column defined on it placeChip(chip) { if (chip.column >= 0 && chip.column < this.columnCount && (this.columns[chip.column].length + 1) < this.rowCount) { this.columns[chip.column].push(chip); this.lastPlacedChip = chip; chip.row = this.columns[chip.column].length - 1; } } toJSON() { return { columnCount: this.columnCount, rowCount: this.rowCount, columns: this.columns, lastPlacedChip: this.lastPlacedChip }; } } export default Grid;
import _ from 'underscore'; class Grid { // The state of a particular game grid constructor({ columnCount = 7, rowCount = 6, columns = _.times(columnCount, () => []), lastPlacedChip = null }) { this.columnCount = columnCount; this.rowCount = rowCount; this.columns = columns; this.lastPlacedChip = lastPlacedChip; } // Reset the grid by removing all placed chips resetGrid() { this.columns.forEach((column) => { column.length = 0; }); this.lastPlacedChip = null; } // Place the given chip into the column defined on it placeChip(chip) { if (chip.column >= 0 && chip.column < this.columnCount && this.columns[chip.column].length < this.rowCount) { this.columns[chip.column].push(chip); this.lastPlacedChip = chip; chip.row = this.columns[chip.column].length - 1; } } toJSON() { return { columnCount: this.columnCount, rowCount: this.rowCount, columns: this.columns, lastPlacedChip: this.lastPlacedChip }; } } export default Grid;
Fix bug where chip cannot be placed in last row
Fix bug where chip cannot be placed in last row
JavaScript
mit
caleb531/connect-four
--- +++ @@ -20,7 +20,7 @@ // Place the given chip into the column defined on it placeChip(chip) { - if (chip.column >= 0 && chip.column < this.columnCount && (this.columns[chip.column].length + 1) < this.rowCount) { + if (chip.column >= 0 && chip.column < this.columnCount && this.columns[chip.column].length < this.rowCount) { this.columns[chip.column].push(chip); this.lastPlacedChip = chip; chip.row = this.columns[chip.column].length - 1;
202941769bd594e31719303882df16ee6ece95c9
react/index.js
react/index.js
var deps = [ '/stdlib/tag.js', '/stdlib/observable.js' ]; function increment(x) { return String(parseInt(x, 10) + 1); } function onReady(tag, observable) { var value = observable.observe("0"); function onChange(evt) { value.set(evt.target.value); } var input = tag.tag({ name: 'input', attributes: {type: 'number', value: value}, handlers: {keyup: onChange, change: onChange} }); var inc = observable.lift(increment); var output = tag.tag({ name: 'input', attributes: {type: 'number', value: inc(value), readOnly: true} }); var div = tag.tag({name: 'div', contents: [input, output]}); yoink.define(div); } yoink.require(deps, onReady);
var deps = [ '/stdlib/tag.js', '/stdlib/observable.js' ]; function increment(x) { return String(parseInt(x, 10) + 1); } function onReady(tag, observable) { var value = observable.observe("0"); var input = tag.tag({ name: 'input', attributes: {type: 'number', value: value}, }); var inc = observable.lift(increment); var output = tag.tag({ name: 'input', attributes: {type: 'number', value: inc(value), readOnly: true} }); var div = tag.tag({name: 'div', contents: [input, output]}); yoink.define(div); } yoink.require(deps, onReady);
Add 'change' event handler if tag attribute is an observable.
Add 'change' event handler if tag attribute is an observable.
JavaScript
bsd-3-clause
garious/poochie-examples,garious/yoink-examples,garious/poochie-examples,garious/yoink-examples
--- +++ @@ -10,14 +10,9 @@ function onReady(tag, observable) { var value = observable.observe("0"); - function onChange(evt) { - value.set(evt.target.value); - } - var input = tag.tag({ name: 'input', attributes: {type: 'number', value: value}, - handlers: {keyup: onChange, change: onChange} }); var inc = observable.lift(increment);
8fae4b14a95f17adbefce5a33132c556197cadc1
riotcontrol.js
riotcontrol.js
var RiotControl = { _stores: [], addStore: function(store) { this._stores.push(store); } }; ['on','one','off','trigger'].forEach(function(api){ RiotControl[api] = function() { var args = [].slice.call(arguments); this._stores.forEach(function(el){ el[api].apply(null, args); }); }; }); if (typeof(module) !== 'undefined') module.exports = RiotControl;
var RiotControl = { _stores: [], addStore: function(store) { this._stores.push(store); } }; ['on','one','off','trigger'].forEach(function(api){ RiotControl[api] = function() { var args = [].slice.call(arguments); this._stores.forEach(function(el){ el[api].apply(el, args); }); }; }); if (typeof(module) !== 'undefined') module.exports = RiotControl;
Make riot control compatible with other observable systems
Make riot control compatible with other observable systems
JavaScript
mit
jimsparkman/RiotControl,creatorrr/RiotControl,creatorrr/RiotControl,nnjpp/RiotDispatch,geoapi/RiotControl,geoapi/RiotControl,jimsparkman/RiotControl
--- +++ @@ -9,7 +9,7 @@ RiotControl[api] = function() { var args = [].slice.call(arguments); this._stores.forEach(function(el){ - el[api].apply(null, args); + el[api].apply(el, args); }); }; });
e37ab30622a50614f226dc746d7e7b68b2afd792
lib/index.js
lib/index.js
var Keen = require('keen-tracking'); var extend = require('keen-tracking/lib/utils/extend'); // Accessor methods function readKey(str){ if (!arguments.length) return this.config.readKey; this.config.readKey = (str ? String(str) : null); return this; } function queryPath(str){ if (!arguments.length) return this.config.readPath; if (!this.projectId()) { this.emit('error', 'Keen is missing a projectId property'); return; } this.config.readPath = (str ? String(str) : ('/3.0/projects/' + this.projectId() + '/queries')); return this; } // Query method function query(){} // HTTP methods function get(){} function post(){} function put(){} function del(){} // Extend client instance extend(Keen.prototype, { 'readKey' : readKey, 'queryPath' : queryPath, 'query' : query, 'get' : get, 'post' : post, 'put' : put, 'del' : del }); module.exports = Keen;
var Keen = require('keen-tracking'); var extend = require('keen-tracking/lib/utils/extend'); // Accessor methods function readKey(str){ if (!arguments.length) return this.config.readKey; this.config.readKey = str ? String(str) : null; return this; } function queryPath(str){ if (!arguments.length) return this.config.queryPath; if (!this.projectId()) { this.emit('error', 'Keen is missing a projectId property'); return; } this.config.queryPath = str ? String(str) : ('/3.0/projects/' + this.projectId() + '/queries'); return this; } // Query method function query(){} // HTTP methods function get(){} function post(){} function put(){} function del(){} // Extend client instance extend(Keen.prototype, { 'readKey' : readKey, 'queryPath' : queryPath, 'query' : query, 'get' : get, 'post' : post, 'put' : put, 'del' : del }); // console.log(new Keen({ projectId: '123' }).queryPath('test').queryPath()); module.exports = Keen;
Clean up method names and internals
Clean up method names and internals
JavaScript
mit
keen/keen-analysis.js,keen/keen-analysis.js
--- +++ @@ -5,17 +5,17 @@ function readKey(str){ if (!arguments.length) return this.config.readKey; - this.config.readKey = (str ? String(str) : null); + this.config.readKey = str ? String(str) : null; return this; } function queryPath(str){ - if (!arguments.length) return this.config.readPath; + if (!arguments.length) return this.config.queryPath; if (!this.projectId()) { this.emit('error', 'Keen is missing a projectId property'); return; } - this.config.readPath = (str ? String(str) : ('/3.0/projects/' + this.projectId() + '/queries')); + this.config.queryPath = str ? String(str) : ('/3.0/projects/' + this.projectId() + '/queries'); return this; } @@ -45,4 +45,6 @@ 'del' : del }); +// console.log(new Keen({ projectId: '123' }).queryPath('test').queryPath()); + module.exports = Keen;
d5815ce2b68695a548b0972e6c3f5928ba887673
lib/index.js
lib/index.js
'use strict'; var rump = module.exports = require('rump'); var configs = require('./configs'); var originalAddGulpTasks = rump.addGulpTasks; // TODO remove on next major core update rump.addGulpTasks = function(options) { originalAddGulpTasks(options); require('./gulp'); return rump; }; rump.on('update:main', function() { configs.rebuild(); rump.emit('update:scripts'); }); Object.defineProperty(rump.configs, 'uglifyjs', { get: function() { return configs.uglifyjs; } }); Object.defineProperty(rump.configs, 'webpack', { get: function() { return configs.webpack; } });
'use strict'; var fs = require('fs'); var path = require('path'); var rump = module.exports = require('rump'); var ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers'); var configs = require('./configs'); var originalAddGulpTasks = rump.addGulpTasks; var protocol = process.platform === 'win32' ? 'file:///' : 'file://'; // TODO remove on next major core update rump.addGulpTasks = function(options) { originalAddGulpTasks(options); require('./gulp'); return rump; }; rump.on('update:main', function() { configs.rebuild(); rump.emit('update:scripts'); }); // Rewrite source map URL for consistency ModuleFilenameHelpers.createFilename = function(module) { var url; if(typeof module === 'string') { url = module.split('!').pop(); } else { url = module.resourcePath || module.identifier().split('!').pop(); } if(fs.existsSync(url)) { url = protocol + url.split(path.sep).join('/'); } else { return ''; } return url; }; Object.defineProperty(rump.configs, 'uglifyjs', { get: function() { return configs.uglifyjs; } }); Object.defineProperty(rump.configs, 'webpack', { get: function() { return configs.webpack; } });
Rewrite source map URLs for consistency
Rewrite source map URLs for consistency
JavaScript
mit
rumps/scripts,rumps/rump-scripts
--- +++ @@ -1,8 +1,12 @@ 'use strict'; +var fs = require('fs'); +var path = require('path'); var rump = module.exports = require('rump'); +var ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers'); var configs = require('./configs'); var originalAddGulpTasks = rump.addGulpTasks; +var protocol = process.platform === 'win32' ? 'file:///' : 'file://'; // TODO remove on next major core update rump.addGulpTasks = function(options) { @@ -16,6 +20,24 @@ rump.emit('update:scripts'); }); +// Rewrite source map URL for consistency +ModuleFilenameHelpers.createFilename = function(module) { + var url; + if(typeof module === 'string') { + url = module.split('!').pop(); + } + else { + url = module.resourcePath || module.identifier().split('!').pop(); + } + if(fs.existsSync(url)) { + url = protocol + url.split(path.sep).join('/'); + } + else { + return ''; + } + return url; +}; + Object.defineProperty(rump.configs, 'uglifyjs', { get: function() { return configs.uglifyjs;
5d674572dcce72f756d5c74704ec1d809ac864cb
lib/index.js
lib/index.js
var config = require('./config.js'); var jsonLdContext = require('./context.json'); var MetadataService = require('./metadata-service.js'); var Organism = require('./organism.js'); var Xref = require('./xref.js'); var BridgeDb = { getEntityReferenceIdentifiersIri: function(metadataForDbName, dbId, callback) { var iri = metadataForDbName.linkoutPattern.replace('$id', dbId); return iri; }, init: function(options) { console.log('BridgeDb instance'); console.log(options); this.config = Object.create(config); this.config.apiUrlStub = (!!options && options.apiUrlStub) || config.apiUrlStub; this.organism = Object.create(Organism(this)); this.xref = Object.create(Xref(this)); }, config: config, organism: Organism(this), xref: Xref(this) }; var BridgeDbInstanceCreator = function(options) { var bridgedbInstance = Object.create(BridgeDb); bridgedbInstance.init(options); return bridgedbInstance; }; module.exports = BridgeDbInstanceCreator;
var config = require('./config.js'); var jsonLdContext = require('./context.json'); var MetadataService = require('./metadata-service.js'); var Organism = require('./organism.js'); var Xref = require('./xref.js'); var BridgeDb = { getEntityReferenceIdentifiersIri: function(metadataForDbName, dbId, callback) { var iri = metadataForDbName.linkoutPattern.replace('$id', dbId); return iri; }, init: function(options) { console.log('BridgeDb instance'); console.log(options); this.config = Object.create(config); // TODO loop through properties on options.config, if any, and update the instance config values. this.config.apiUrlStub = (!!options && options.apiUrlStub) || config.apiUrlStub; this.config.datasourcesUrl = (!!options && options.datasourcesUrl) || config.datasourcesUrl; this.organism = Object.create(Organism(this)); this.xref = Object.create(Xref(this)); }, config: config, organism: Organism(this), xref: Xref(this) }; var BridgeDbInstanceCreator = function(options) { var bridgedbInstance = Object.create(BridgeDb); bridgedbInstance.init(options); return bridgedbInstance; }; module.exports = BridgeDbInstanceCreator;
Update handling of datasources.txt URL
Update handling of datasources.txt URL
JavaScript
apache-2.0
bridgedb/bridgedbjs,bridgedb/bridgedbjs,egonw/bridgedbjs,bridgedb/bridgedbjs
--- +++ @@ -13,7 +13,9 @@ console.log('BridgeDb instance'); console.log(options); this.config = Object.create(config); + // TODO loop through properties on options.config, if any, and update the instance config values. this.config.apiUrlStub = (!!options && options.apiUrlStub) || config.apiUrlStub; + this.config.datasourcesUrl = (!!options && options.datasourcesUrl) || config.datasourcesUrl; this.organism = Object.create(Organism(this)); this.xref = Object.create(Xref(this)); },
ecb93921a112556a307505aec1d249b9fcc27f1d
lib/track.js
lib/track.js
var Util = require('./util.js'); module.exports = Track = function(vid, info) { this.vid = vid; this.title = info.title; this.author = info.author; this.viewCount = info.viewCount || info.view_count; this.lengthSeconds = info.lengthSeconds || info.length_seconds; }; Track.prototype.formatViewCount = function() { return this.viewCount ? this.viewCount.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : 'unknown'; }; Track.prototype.formatTime = function() { return Util.formatTime(this.lengthSeconds); }; Track.prototype.prettyPrint = function() { return `**${this.title}** by **${this.author}** *(${this.formatViewCount()} views)* [${this.formatTime()}]`; }; Track.prototype.fullPrint = function() { return `${this.prettyPrint()}, added by <@${this.userId}>`; }; Track.prototype.saveable = function() { return { vid: this.vid, title: this.title, author: this.author, viewCount: this.viewCount, lengthSeconds: this.lengthSeconds, }; };
var Util = require('./util.js'); module.exports = Track = function(vid, info) { this.vid = vid; this.title = info.title; this.author = info.author; this.viewCount = info.viewCount || info.view_count; this.lengthSeconds = info.lengthSeconds || info.length_seconds; }; Track.prototype.formatViewCount = function() { return this.viewCount ? this.viewCount.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : 'unknown'; }; Track.prototype.formatTime = function() { return Util.formatTime(this.lengthSeconds); }; Track.prototype.prettyPrint = function() { return `**${this.title}** by **${this.author}** *(${this.formatViewCount()} views)* [${this.formatTime()}]`; }; Track.prototype.fullPrint = function() { return `${this.prettyPrint()}, added by <@${this.userId}>`; }; Track.prototype.saveable = function() { return { vid: this.vid, title: this.title, author: this.author, viewCount: this.viewCount, lengthSeconds: this.lengthSeconds, }; }; Track.prototype.getTime = function() { return this.lengthSeconds; };
Add getTime function to get remaining time
Add getTime function to get remaining time
JavaScript
mit
meew0/Lethe
--- +++ @@ -33,3 +33,7 @@ lengthSeconds: this.lengthSeconds, }; }; + +Track.prototype.getTime = function() { + return this.lengthSeconds; +};
5e41bab44fe3cdd1d160198cbe9ec3aeebf1fdcc
jupyter-js-widgets/src/embed-webpack.js
jupyter-js-widgets/src/embed-webpack.js
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. // This file must be webpacked because it contains .css imports // Load jquery and jquery-ui var $ = require('jquery'); require('jquery-ui'); window.$ = window.jQuery = $; require('jquery-ui'); // Load styling require('jquery-ui/themes/smoothness/jquery-ui.min.css'); require('../css/widgets.min.css'); const widgets = require('./index'); console.info('jupyter-js-widgets loaded successfully'); const manager = new widgets.EmbedManager(); // Magic global widget rendering function: function renderInlineWidgets(element) { var element = element || document; var tags = element.querySelectorAll('script.jupyter-widgets'); for (var i=0; i!=tags.length; ++i) { var tag = tags[i]; var widgetStateObject = JSON.parse(tag.innerHTML); var widgetContainer = document.createElement('div'); widgetContainer.className = 'widget-area'; manager.display_widget_state(widgetStateObject, widgetContainer).then(function() { tag.parentElement.insertBefore(widgetContainer, tag); }); } } // Module exports exports.manager = manager; exports.renderInlineWidgets = renderInlineWidgets; // Set window globals window.manager = manager; window.onload = renderInlineWidgets;
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. // This file must be webpacked because it contains .css imports // Load jquery and jquery-ui var $ = require('jquery'); require('jquery-ui'); window.$ = window.jQuery = $; require('jquery-ui'); // Load styling require('jquery-ui/themes/smoothness/jquery-ui.min.css'); require('../css/widgets.min.css'); const widgets = require('./index'); console.info('jupyter-js-widgets loaded successfully'); const manager = new widgets.EmbedManager(); // Magic global widget rendering function: function renderInlineWidgets(event) { var element = event.target || document; var tags = element.querySelectorAll('script.jupyter-widgets'); for (var i=0; i!=tags.length; ++i) { var tag = tags[i]; var widgetStateObject = JSON.parse(tag.innerHTML); var widgetContainer = document.createElement('div'); widgetContainer.className = 'widget-area'; manager.display_widget_state(widgetStateObject, widgetContainer).then(function() { tag.parentElement.insertBefore(widgetContainer, tag); }); } } // Module exports exports.manager = manager; exports.renderInlineWidgets = renderInlineWidgets; // Set window globals window.manager = manager; window.addEventListener('load', renderInlineWidgets);
Use addEventListener('load' instead of onload
Use addEventListener('load' instead of onload
JavaScript
bsd-3-clause
cornhundred/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,cornhundred/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,cornhundred/ipywidgets,cornhundred/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,cornhundred/ipywidgets,ipython/ipywidgets
--- +++ @@ -20,8 +20,8 @@ const manager = new widgets.EmbedManager(); // Magic global widget rendering function: -function renderInlineWidgets(element) { - var element = element || document; +function renderInlineWidgets(event) { + var element = event.target || document; var tags = element.querySelectorAll('script.jupyter-widgets'); for (var i=0; i!=tags.length; ++i) { var tag = tags[i]; @@ -41,4 +41,4 @@ // Set window globals window.manager = manager; -window.onload = renderInlineWidgets; +window.addEventListener('load', renderInlineWidgets);
18d33de0c54e64693274bc17afb1a08b9fec5ad8
app/public/panel/controllers/DashCtrl.js
app/public/panel/controllers/DashCtrl.js
var angular = require('angular'); angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => { const colorScheme = ['#2a9fd6']; let weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; for(let i = 0; i < 6 - (new Date()).getDay(); i++) { const back = weekDays.pop(); weekDays.unshift(back); } $scope.uploadColors = colorScheme; $scope.uploadLabels = weekDays; $scope.uploadSeries = ['Uploads']; $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]]; $scope.uploadOptions = { title: { display: true, text: 'Historical Uploads' }, }; $scope.viewColors = colorScheme; $scope.viewLabels = weekDays; $scope.viewSeries = ['Views']; $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]]; $scope.viewOptions = { title: { display: true, text: 'Historical Views' } }; }]); { }
var angular = require('angular'); angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => { const colorScheme = ['#2a9fd6']; // Calculate and format descending dates back one week const currentDate = new Date(); const oneDay = 1000 * 60 * 60 * 24; let dates = Array.from({length: 7}, (date, i) => new Date(currentDate - oneDay * (6 - i))); let labels = dates.map(date => date.toISOString().substr(5, 5)); $scope.uploadColors = colorScheme; $scope.uploadLabels = labels; $scope.uploadSeries = ['Uploads']; $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]]; $scope.uploadOptions = { title: { display: true, text: 'Historical Uploads' }, }; $scope.viewColors = colorScheme; $scope.viewLabels = labels; $scope.viewSeries = ['Views']; $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]]; $scope.viewOptions = { title: { display: true, text: 'Historical Views' } }; }]); { }
Fix date and label calculation
Fix date and label calculation
JavaScript
mit
Foltik/Shimapan,Foltik/Shimapan
--- +++ @@ -3,14 +3,14 @@ angular.module('DashCtrl', ['chart.js']).controller('DashController', ['$scope', $scope => { const colorScheme = ['#2a9fd6']; - let weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; - for(let i = 0; i < 6 - (new Date()).getDay(); i++) { - const back = weekDays.pop(); - weekDays.unshift(back); - } + // Calculate and format descending dates back one week + const currentDate = new Date(); + const oneDay = 1000 * 60 * 60 * 24; + let dates = Array.from({length: 7}, (date, i) => new Date(currentDate - oneDay * (6 - i))); + let labels = dates.map(date => date.toISOString().substr(5, 5)); $scope.uploadColors = colorScheme; - $scope.uploadLabels = weekDays; + $scope.uploadLabels = labels; $scope.uploadSeries = ['Uploads']; $scope.uploadData = [[10, 20, 30, 20, 15, 20, 45]]; $scope.uploadOptions = { @@ -21,7 +21,7 @@ }; $scope.viewColors = colorScheme; - $scope.viewLabels = weekDays; + $scope.viewLabels = labels; $scope.viewSeries = ['Views']; $scope.viewData = [[5, 11, 4, 3, 7, 9, 21]]; $scope.viewOptions = {
323b195642bab258001da6b0a85ca998e8697d3d
static/js/submit.js
static/js/submit.js
$(document).ready(function() { $("#invite-form").on('submit', function() { var inviteeEmail = $("#email").val(); console.log(inviteeEmail) if (!inviteeEmail || !inviteeEmail.length) { alert('Please enter an email'); return false; } $.ajax({ type: "POST", url: "/", headers: { 'X-CSRFToken': csrfToken, }, data: { email: inviteeEmail}, success: function(data) { handleResponse(data); } }); return false; }); }); function handleResponse(data) { document.data = data if (data.status === 'success') { console.log('success') } if (data.status === 'fail') { console.log('failed') } }
$(document).ready(function() { $("#invite-form").on('submit', function() { var inviteeEmail = $("#email").val(); console.log(inviteeEmail) if (!inviteeEmail || !inviteeEmail.length) { alert('Please enter an email'); return false; } $.ajax({ type: "POST", url: "/", headers: { 'X-CSRFToken': csrfToken, }, data: { email: inviteeEmail}, success: function(data) { handleResponse(data); } }); return false; }); }); function handleResponse(data) { document.data = data if (data.status === 'success') { console.log('success') Materialize.toast('Success!', 4000) } if (data.status === 'fail') { Materialize.toast(data.error, 4000) } }
Use Materialize toasts to show the status
Use Materialize toasts to show the status
JavaScript
mit
avinassh/slackipy,avinassh/slackipy,avinassh/slackipy
--- +++ @@ -29,8 +29,9 @@ document.data = data if (data.status === 'success') { console.log('success') + Materialize.toast('Success!', 4000) } if (data.status === 'fail') { - console.log('failed') + Materialize.toast(data.error, 4000) } }
63618d2180dfc52c922857eb6aabb2e195b637da
lib/helpers/redirect-to-organization.js
lib/helpers/redirect-to-organization.js
'use strict'; var url = require('url'); var getHost = require('./get-host'); module.exports = function redirectToOrganization(req, res, organization) { res.redirect(req.protocol + '://' + organization.nameKey + '.' + getHost(req) + url.parse(req.url).pathname); };
'use strict'; var url = require('url'); var getHost = require('./get-host'); module.exports = function redirectToOrganization(req, res, organization) { var uri = req.protocol + '://' + organization.nameKey + '.' + getHost(req) + url.parse(req.url).pathname; var queryParams = Object.keys(req.query); if (queryParams.length > 0) { uri += '?' + queryParams.map(function (param) { return encodeURIComponent(param) + '=' + encodeURIComponent(req.query[param]); }).join('&'); } res.redirect(uri); };
Fix behaviour for redirect with query params
Fix behaviour for redirect with query params
JavaScript
apache-2.0
stormpath/express-stormpath,stormpath/express-stormpath,stormpath/express-stormpath
--- +++ @@ -5,5 +5,21 @@ var getHost = require('./get-host'); module.exports = function redirectToOrganization(req, res, organization) { - res.redirect(req.protocol + '://' + organization.nameKey + '.' + getHost(req) + url.parse(req.url).pathname); + var uri = req.protocol + + '://' + organization.nameKey + + '.' + + getHost(req) + + url.parse(req.url).pathname; + + var queryParams = Object.keys(req.query); + + if (queryParams.length > 0) { + uri += '?' + queryParams.map(function (param) { + return encodeURIComponent(param) + + '=' + + encodeURIComponent(req.query[param]); + }).join('&'); + } + + res.redirect(uri); };
a8e03f01c9b67d6b39c627d94f1f95ee706f7284
batch/job_queue.js
batch/job_queue.js
'use strict'; function JobQueue(metadataBackend, jobPublisher) { this.metadataBackend = metadataBackend; this.jobPublisher = jobPublisher; } module.exports = JobQueue; var QUEUE = { DB: 5, PREFIX: 'batch:queue:' }; module.exports.QUEUE = QUEUE; JobQueue.prototype.enqueue = function (user, jobId, callback) { var self = this; this.metadataBackend.redisCmd(QUEUE.DB, 'LPUSH', [ QUEUE.PREFIX + user, jobId ], function (err) { if (err) { return callback(err); } self.jobPublisher.publish(user); callback(); }); }; JobQueue.prototype.size = function (user, callback) { this.metadataBackend.redisCmd(QUEUE.DB, 'LLEN', [ QUEUE.PREFIX + user ], callback); }; JobQueue.prototype.dequeue = function (user, callback) { this.metadataBackend.redisCmd(QUEUE.DB, 'RPOP', [ QUEUE.PREFIX + user ], callback); }; JobQueue.prototype.enqueueFirst = function (user, jobId, callback) { this.metadataBackend.redisCmd(QUEUE.DB, 'RPUSH', [ QUEUE.PREFIX + user, jobId ], callback); };
'use strict'; var debug = require('./util/debug')('queue'); function JobQueue(metadataBackend, jobPublisher) { this.metadataBackend = metadataBackend; this.jobPublisher = jobPublisher; } module.exports = JobQueue; var QUEUE = { DB: 5, PREFIX: 'batch:queue:' }; module.exports.QUEUE = QUEUE; JobQueue.prototype.enqueue = function (user, jobId, callback) { debug('JobQueue.enqueue user=%s, jobId=%s', user, jobId); this.metadataBackend.redisCmd(QUEUE.DB, 'LPUSH', [ QUEUE.PREFIX + user, jobId ], function (err) { if (err) { return callback(err); } this.jobPublisher.publish(user); callback(); }.bind(this)); }; JobQueue.prototype.size = function (user, callback) { this.metadataBackend.redisCmd(QUEUE.DB, 'LLEN', [ QUEUE.PREFIX + user ], callback); }; JobQueue.prototype.dequeue = function (user, callback) { this.metadataBackend.redisCmd(QUEUE.DB, 'RPOP', [ QUEUE.PREFIX + user ], function(err, jobId) { debug('JobQueue.dequeued user=%s, jobId=%s', user, jobId); return callback(err, jobId); }); }; JobQueue.prototype.enqueueFirst = function (user, jobId, callback) { debug('JobQueue.enqueueFirst user=%s, jobId=%s', user, jobId); this.metadataBackend.redisCmd(QUEUE.DB, 'RPUSH', [ QUEUE.PREFIX + user, jobId ], callback); };
Add debug information in Jobs Queue
Add debug information in Jobs Queue
JavaScript
bsd-3-clause
CartoDB/CartoDB-SQL-API,CartoDB/CartoDB-SQL-API
--- +++ @@ -1,4 +1,6 @@ 'use strict'; + +var debug = require('./util/debug')('queue'); function JobQueue(metadataBackend, jobPublisher) { this.metadataBackend = metadataBackend; @@ -14,16 +16,15 @@ module.exports.QUEUE = QUEUE; JobQueue.prototype.enqueue = function (user, jobId, callback) { - var self = this; - + debug('JobQueue.enqueue user=%s, jobId=%s', user, jobId); this.metadataBackend.redisCmd(QUEUE.DB, 'LPUSH', [ QUEUE.PREFIX + user, jobId ], function (err) { if (err) { return callback(err); } - self.jobPublisher.publish(user); + this.jobPublisher.publish(user); callback(); - }); + }.bind(this)); }; JobQueue.prototype.size = function (user, callback) { @@ -31,9 +32,13 @@ }; JobQueue.prototype.dequeue = function (user, callback) { - this.metadataBackend.redisCmd(QUEUE.DB, 'RPOP', [ QUEUE.PREFIX + user ], callback); + this.metadataBackend.redisCmd(QUEUE.DB, 'RPOP', [ QUEUE.PREFIX + user ], function(err, jobId) { + debug('JobQueue.dequeued user=%s, jobId=%s', user, jobId); + return callback(err, jobId); + }); }; JobQueue.prototype.enqueueFirst = function (user, jobId, callback) { + debug('JobQueue.enqueueFirst user=%s, jobId=%s', user, jobId); this.metadataBackend.redisCmd(QUEUE.DB, 'RPUSH', [ QUEUE.PREFIX + user, jobId ], callback); };
689b3bc608f4892686b0330f30dca188b59c04a9
playground/server.js
playground/server.js
import React from 'react'; import Playground from './index.js'; import express from 'express'; import ReactDOMServer from 'react-dom/server'; const app = express(); const port = 8000; app.get('/', function(req, resp) { const html = ReactDOMServer.renderToString( React.createElement(Playground) ); resp.send(html); }); app.listen(port, function() { console.log(`http://localhost:'${port}`); // eslint-disable-line no-console });
import React from 'react'; import Playground from './index.js'; import express from 'express'; import ReactDOMServer from 'react-dom/server'; const app = express(); const port = 8000; app.get('/', function(req, resp) { const html = ReactDOMServer.renderToString( React.createElement(Playground) ); resp.send(html); }); app.listen(port, function() { console.log(`http://localhost:${port}`); // eslint-disable-line no-console });
Fix typo in playground listen log
Fix typo in playground listen log
JavaScript
mit
benox3/react-pic
--- +++ @@ -14,5 +14,5 @@ }); app.listen(port, function() { - console.log(`http://localhost:'${port}`); // eslint-disable-line no-console + console.log(`http://localhost:${port}`); // eslint-disable-line no-console });
1c42a6e807b644a246b62c43f1494a906c130447
spec/server-pure/spec.render_png.js
spec/server-pure/spec.render_png.js
var renderPng = require('../../app/render_png'); describe('renderPng', function () { describe('getScreenshotPath', function () { it('creates the URL for the screenshot service call', function () { renderPng.screenshotServiceUrl = 'http://screenshotservice'; renderPng.screenshotTargetUrl = 'http://spotlight'; var url = '/test/path.png'; var screenshotPath = renderPng.getScreenshotPath(url); expect(screenshotPath).toEqual('http://screenshotservice?readyExpression=!!document.querySelector(".loaded")&forwardCacheHeaders=true&clipSelector=.visualisation&url=http://spotlight/test/path?raw'); }); }); });
var renderPng = require('../../app/render_png'); describe('renderPng', function () { describe('getScreenshotPath', function () { it('creates the URL for the screenshot service call', function () { renderPng.screenshotServiceUrl = 'http://screenshotservice'; renderPng.screenshotTargetUrl = 'http://spotlight'; var url = '/test/path.png'; var screenshotPath = renderPng.getScreenshotPath({ url: url, query: {} }); expect(screenshotPath).toEqual('http://screenshotservice?readyExpression=!!document.querySelector(".loaded")&forwardCacheHeaders=true&clipSelector=.visualisation-inner figure&url=http://spotlight/test/path'); }); }); });
Fix qs params in screenshot url tests
Fix qs params in screenshot url tests
JavaScript
mit
keithiopia/spotlight,alphagov/spotlight,alphagov/spotlight,keithiopia/spotlight,alphagov/spotlight,tijmenb/spotlight,keithiopia/spotlight,tijmenb/spotlight,tijmenb/spotlight
--- +++ @@ -6,8 +6,11 @@ renderPng.screenshotServiceUrl = 'http://screenshotservice'; renderPng.screenshotTargetUrl = 'http://spotlight'; var url = '/test/path.png'; - var screenshotPath = renderPng.getScreenshotPath(url); - expect(screenshotPath).toEqual('http://screenshotservice?readyExpression=!!document.querySelector(".loaded")&forwardCacheHeaders=true&clipSelector=.visualisation&url=http://spotlight/test/path?raw'); + var screenshotPath = renderPng.getScreenshotPath({ + url: url, + query: {} + }); + expect(screenshotPath).toEqual('http://screenshotservice?readyExpression=!!document.querySelector(".loaded")&forwardCacheHeaders=true&clipSelector=.visualisation-inner figure&url=http://spotlight/test/path'); }); }); });
8ffe7ba8783c85de062299f709a4a8d8a68eeef5
packages/@sanity/base/src/preview/ReferencePreview.js
packages/@sanity/base/src/preview/ReferencePreview.js
import React, {PropTypes} from 'react' import resolveRefType from './resolveRefType' import {resolver as previewResolver} from 'part:@sanity/base/preview' export default class SanityPreview extends React.PureComponent { static propTypes = { value: PropTypes.object, type: PropTypes.object.isRequired }; state = { loading: true, materialized: null, refType: null } resolveRefType(value, type) { resolveRefType(value, type).then(refType => { this.setState({ refType }) }) } componentDidMount() { const {type, value} = this.props this.resolveRefType(value, type) } componentWillReceiveProps(nextProps) { if (this.props.type !== nextProps.type || this.props.value !== nextProps.value) { this.resolveRefType(nextProps.value, nextProps.type) } } render() { const {refType} = this.state if (!refType) { return null } const Preview = previewResolver(refType) return ( <Preview {...this.props} type={refType} /> ) } }
import React, {PropTypes} from 'react' import resolveRefType from './resolveRefType' import {resolver as previewResolver} from 'part:@sanity/base/preview' export default class SanityPreview extends React.PureComponent { static propTypes = { value: PropTypes.object, type: PropTypes.object.isRequired }; state = { loading: true, materialized: null, refType: null } componentDidMount() { const {type, value} = this.props this.subscribeRefType(value, type) } componentWillUnmount() { this.unsubscribe() } subscribeRefType(value, type) { this.unsubscribe() this.subscription = resolveRefType(value, type) .subscribe(refType => { this.setState({refType}) }) } unsubscribe() { if (this.subscription) { this.subscription.unsubscribe() this.subscription = null } } componentWillReceiveProps(nextProps) { if (this.props.type !== nextProps.type || this.props.value !== nextProps.value) { this.subscribeRefType(nextProps.value, nextProps.type) } } render() { const {refType} = this.state if (!refType) { return null } const Preview = previewResolver(refType) return ( <Preview {...this.props} type={refType} /> ) } }
Fix wrong resolving of referenced type
[previews] Fix wrong resolving of referenced type
JavaScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -14,22 +14,33 @@ refType: null } - resolveRefType(value, type) { - resolveRefType(value, type).then(refType => { - this.setState({ - refType - }) - }) + componentDidMount() { + const {type, value} = this.props + this.subscribeRefType(value, type) } - componentDidMount() { - const {type, value} = this.props - this.resolveRefType(value, type) + componentWillUnmount() { + this.unsubscribe() + } + + subscribeRefType(value, type) { + this.unsubscribe() + this.subscription = resolveRefType(value, type) + .subscribe(refType => { + this.setState({refType}) + }) + } + + unsubscribe() { + if (this.subscription) { + this.subscription.unsubscribe() + this.subscription = null + } } componentWillReceiveProps(nextProps) { if (this.props.type !== nextProps.type || this.props.value !== nextProps.value) { - this.resolveRefType(nextProps.value, nextProps.type) + this.subscribeRefType(nextProps.value, nextProps.type) } }
abfd3076f555807bd43fc2733573056afda9d089
settings/index.js
settings/index.js
import _ from 'lodash'; import React from 'react'; import Settings from '@folio/stripes-components/lib/Settings'; import PermissionSets from './permissions/PermissionSets'; import PatronGroupsSettings from './PatronGroupsSettings'; import AddressTypesSettings from './AddressTypesSettings'; const pages = [ { route: 'perms', label: 'Permission sets', component: PermissionSets, perm: 'ui-users.editpermsets', }, { route: 'groups', label: 'Patron groups', component: PatronGroupsSettings, // No perm needed yet }, { route: 'addresstypes', label: 'Address Types', component: AddressTypesSettings, // No perm needed yet }, ]; export default props => <Settings {...props} pages={_.sortBy(pages, ['label'])} paneTitle="Users" />;
import _ from 'lodash'; import React from 'react'; import Settings from '@folio/stripes-components/lib/Settings'; import PermissionSets from './permissions/PermissionSets'; import PatronGroupsSettings from './PatronGroupsSettings'; import AddressTypesSettings from './AddressTypesSettings'; const pages = [ { route: 'perms', label: 'Permission sets', component: PermissionSets, perm: 'ui-users.editpermsets', }, { route: 'groups', label: 'Patron groups', component: PatronGroupsSettings, // perm: 'settings.usergroups.all', }, { route: 'addresstypes', label: 'Address Types', component: AddressTypesSettings, // perm: 'settings.addresstypes.all', }, ]; export default props => <Settings {...props} pages={_.sortBy(pages, ['label'])} paneTitle="Users" />;
Add commented-out permission guards. Part of UIU-197.
Add commented-out permission guards. Part of UIU-197.
JavaScript
apache-2.0
folio-org/ui-users,folio-org/ui-users
--- +++ @@ -17,14 +17,14 @@ route: 'groups', label: 'Patron groups', component: PatronGroupsSettings, - // No perm needed yet + // perm: 'settings.usergroups.all', }, { route: 'addresstypes', label: 'Address Types', component: AddressTypesSettings, - // No perm needed yet + // perm: 'settings.addresstypes.all', }, ];
6c3cd606ff1dd948a8a1b51eb5525da4881945d1
www/Gruntfile.js
www/Gruntfile.js
module.exports = function (grunt) { var allJSFilesInJSFolder = "js/**/*.js"; var distFolder = '../wikipedia/assets/'; grunt.loadNpmTasks( 'grunt-browserify' ); grunt.loadNpmTasks( 'gruntify-eslint' ); grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-contrib-less' ); grunt.initConfig( { browserify: { distMain: { src: ["index-main.js", allJSFilesInJSFolder, "!preview-main.js"], dest: distFolder + "index.js" }, distPreview: { src: ["preview-main.js", "js/utilities.js"], dest: distFolder + "preview.js" } }, less: { all: { options: { compress: true, yuicompress: true, optimization: 2 }, files: [ { src: ["less/**/*.less", "node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.css"], dest: distFolder + "styleoverrides.css"} ] } }, eslint: { src: [allJSFilesInJSFolder] }, copy: { main: { files: [{ src: ["*.html", "*.css", "ios.json", "languages.json", "mainpages.json", "*.png"], dest: distFolder }] } } } ); grunt.registerTask('default', ['eslint', 'browserify', 'less', 'copy']); };
module.exports = function (grunt) { var allJSFilesInJSFolder = "js/**/*.js"; var distFolder = '../wikipedia/assets/'; grunt.loadNpmTasks( 'grunt-browserify' ); grunt.loadNpmTasks( 'gruntify-eslint' ); grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-contrib-less' ); grunt.initConfig( { browserify: { distMain: { src: ["index-main.js", allJSFilesInJSFolder, "!preview-main.js"], dest: distFolder + "index.js" }, distPreview: { src: ["preview-main.js", "js/utilities.js"], dest: distFolder + "preview.js" } }, less: { all: { options: { compress: true, yuicompress: true, optimization: 2 }, files: [ { src: ["less/**/*.less", "node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.css"], dest: distFolder + "styleoverrides.css"} ] } }, eslint: { src: [allJSFilesInJSFolder], options: { fix: false } }, copy: { main: { files: [{ src: ["*.html", "*.css", "ios.json", "languages.json", "mainpages.json", "*.png"], dest: distFolder }] } } } ); grunt.registerTask('default', ['eslint', 'browserify', 'less', 'copy']); };
Add eslint 'fix' flag to config.
Add eslint 'fix' flag to config. Can be flipped to 'true' to auto-fix linting violations!
JavaScript
mit
wikimedia/apps-ios-wikipedia,josve05a/wikipedia-ios,julienbodet/wikipedia-ios,montehurd/apps-ios-wikipedia,josve05a/wikipedia-ios,wikimedia/wikipedia-ios,julienbodet/wikipedia-ios,josve05a/wikipedia-ios,wikimedia/apps-ios-wikipedia,josve05a/wikipedia-ios,wikimedia/apps-ios-wikipedia,julienbodet/wikipedia-ios,josve05a/wikipedia-ios,josve05a/wikipedia-ios,wikimedia/wikipedia-ios,montehurd/apps-ios-wikipedia,wikimedia/wikipedia-ios,montehurd/apps-ios-wikipedia,wikimedia/wikipedia-ios,julienbodet/wikipedia-ios,julienbodet/wikipedia-ios,julienbodet/wikipedia-ios,wikimedia/apps-ios-wikipedia,montehurd/apps-ios-wikipedia,josve05a/wikipedia-ios,montehurd/apps-ios-wikipedia,wikimedia/wikipedia-ios,wikimedia/wikipedia-ios,montehurd/apps-ios-wikipedia,wikimedia/apps-ios-wikipedia,julienbodet/wikipedia-ios,montehurd/apps-ios-wikipedia,wikimedia/wikipedia-ios,josve05a/wikipedia-ios,wikimedia/apps-ios-wikipedia,wikimedia/apps-ios-wikipedia,wikimedia/apps-ios-wikipedia,julienbodet/wikipedia-ios,montehurd/apps-ios-wikipedia
--- +++ @@ -35,7 +35,10 @@ }, eslint: { - src: [allJSFilesInJSFolder] + src: [allJSFilesInJSFolder], + options: { + fix: false + } }, copy: {
5eb4b643651673dac89f53b5cc016b47ff852157
src/generator-bin.js
src/generator-bin.js
#!/usr/bin/env node const generate = require('./generator') const program = require('commander') program .version('1.0.0') .option('-w, --words [num]', 'number of words [2]', 2) .option('-n, --numbers', 'use numbers') .option('-a, --alliterative', 'use alliterative') .option('-o --output [output]', 'output type', /^(raw|dashed|spaced)$/i) .parse(process.argv) let project_name = generate({words: program.words, number: program.numbers, alliterative: program.alliterative}); if (program.output == "dashed"){ console.log(project_name.dashed); } else if (program.output == "raw") { console.log(project_name.raw); } else if (program.output == "spaced") { console.log(project_name.spaced); } else { console.log(project_name); }
#!/usr/bin/env node const generate = require('./generator') const program = require('commander') program .version('1.0.0') .option('-w, --words [num]', 'number of words [2]', 2) .option('-n, --numbers', 'use numbers') .option('-a, --alliterative', 'use alliterative') .option('-o, --output [output]', 'output type [raw|dashed|spaced]', /^(raw|dashed|spaced)$/i) .parse(process.argv) let project_name = generate({words: program.words, number: program.numbers, alliterative: program.alliterative}); if (program.output == "dashed"){ console.log(project_name.dashed); } else if (program.output == "raw") { console.log(project_name.raw); } else if (program.output == "spaced") { console.log(project_name.spaced); } else { console.log(project_name); }
Update README for CLI options.
Update README for CLI options.
JavaScript
isc
aceakash/project-name-generator
--- +++ @@ -8,7 +8,7 @@ .option('-w, --words [num]', 'number of words [2]', 2) .option('-n, --numbers', 'use numbers') .option('-a, --alliterative', 'use alliterative') - .option('-o --output [output]', 'output type', /^(raw|dashed|spaced)$/i) + .option('-o, --output [output]', 'output type [raw|dashed|spaced]', /^(raw|dashed|spaced)$/i) .parse(process.argv) let project_name = generate({words: program.words, number: program.numbers, alliterative: program.alliterative});
9e77430c1f309444c1990877d237cdf991d36d72
src/dform.js
src/dform.js
function dform(formElement) { var eventEmitter = { on: function (name, handler) { this[name] = this[name] || []; this[name].push(handler); return this; }, trigger: function (name, event) { if (this[name]) { this[name].map(function (handler) { handler(event); }); } return this; } }; var submitElement = formElement.find('[type=submit]'); var inputElements = formElement.find('input, select'); formElement.submit(function (event) { event.preventDefault(); var formData = {}; $.each(inputElements, function (_, element) { element = $(element); var name = element.attr('name'); if (name) { formData[name] = element.val(); } }); submitElement.attr('disabled', 'disabled'); eventEmitter.trigger('submit'); $[formElement.attr('method')](formElement.attr('action'), formData) .always(function () { submitElement.removeAttr('disabled', 'disabled'); }) .done(function (data) { eventEmitter.trigger('done', data); }) .fail(function (jqXHR) { eventEmitter.trigger('fail', jqXHR); }); }); submitElement.removeAttr('disabled', 'disabled'); return eventEmitter; }
function dform(formElement) { var eventEmitter = { on: function (name, handler) { this[name] = this[name] || []; this[name].push(handler); return this; }, trigger: function (name, event) { if (this[name]) { this[name].map(function (handler) { handler(event); }); } return this; } }; var submitElement = formElement.find('[type=submit]'); var inputElements = formElement.find('input, select'); formElement.submit(function (event) { event.preventDefault(); submitElement.attr('disabled', 'disabled'); var formData = {}; $.each(inputElements, function (_, element) { element = $(element); var name = element.attr('name'); if (name) { formData[name] = element.val(); } }); eventEmitter.trigger('submit'); $[formElement.attr('method')](formElement.attr('action'), formData) .always(function () { submitElement.removeAttr('disabled', 'disabled'); }) .done(function (responseData) { eventEmitter.trigger('done', responseData); }) .fail(function (jqXHR) { eventEmitter.trigger('fail', jqXHR); }); }); submitElement.removeAttr('disabled', 'disabled'); return eventEmitter; }
Disable button should be the first thing to do
Disable button should be the first thing to do
JavaScript
mit
dnode/dform,dnode/dform
--- +++ @@ -18,6 +18,7 @@ var inputElements = formElement.find('input, select'); formElement.submit(function (event) { event.preventDefault(); + submitElement.attr('disabled', 'disabled'); var formData = {}; $.each(inputElements, function (_, element) { element = $(element); @@ -26,14 +27,13 @@ formData[name] = element.val(); } }); - submitElement.attr('disabled', 'disabled'); eventEmitter.trigger('submit'); $[formElement.attr('method')](formElement.attr('action'), formData) .always(function () { submitElement.removeAttr('disabled', 'disabled'); }) - .done(function (data) { - eventEmitter.trigger('done', data); + .done(function (responseData) { + eventEmitter.trigger('done', responseData); }) .fail(function (jqXHR) { eventEmitter.trigger('fail', jqXHR);
fc617bc90f25c5e7102c0e76c71d4790599ff23b
data-demo/person_udf.js
data-demo/person_udf.js
function transform(line) { var values = line.split(','); var obj = new Object(); obj.name = values[0]; obj.surname = values[1]; obj.timestamp = values[2]; var jsonString = JSON.stringify(obj); return jsonString; }
/* Copyright 2022 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function transform(line) { var values = line.split(','); var obj = new Object(); obj.name = values[0]; obj.surname = values[1]; obj.timestamp = values[2]; var jsonString = JSON.stringify(obj); return jsonString; }
Add a license header on code files
Add a license header on code files Signed-off-by: Laurent Grangeau <919068a1571bc1b5deaaf9ac4d631597f8dd629f@gmail.com>
JavaScript
apache-2.0
GoogleCloudPlatform/deploystack-gcs-to-bq-with-least-privileges
--- +++ @@ -1,3 +1,16 @@ +/* + Copyright 2022 Google LLC. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + function transform(line) { var values = line.split(',');
f7d9d0a57f691a4d9104ab00c75e1cca8cb2142f
src/history.js
src/history.js
const timetrack = require('./timetrack'); const calculateDuration = require('./calculateDuration'); module.exports = (pluginContext) => { return (project, env = {}) => { return new Promise((resolve, reject) => { timetrack.loadData(); resolve(timetrack.getHistory().map(entry => { // get the duration of the entry let duration = 'Running'; if ('stop' in entry) { duration = calculateDuration(entry.start, entry.stop); } // get the project name const project = entry.project || 'No project'; return { icon: 'fa-clock-o', title: `[${duration}] ${project}`, subtitle: `Nice work bro!` } })); }); } }
const timetrack = require('./timetrack'); const Sugar = require('sugar-date'); const calculateDuration = require('./calculateDuration'); module.exports = (pluginContext) => { return (project, env = {}) => { return new Promise((resolve, reject) => { timetrack.loadData(); resolve(timetrack.getHistory().map(entry => { try { // get the duration of the entry let duration = 'Running'; if ('stop' in entry) { // sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later duration = Sugar.Date.format(Sugar.Date.create(entry.stop - entry.start - 3600000), '%H:%M:%S'); } // get the project name const project = entry.project || 'No project'; // get the start date const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%c') return { icon: 'fa-clock-o', title: `[${duration}] ${project}`, subtitle: `started on ${startDate}` } } catch (e) { alert('fount: ' + e); } })); }); } }
Use sugarjs for date parsing
Use sugarjs for date parsing
JavaScript
mit
jnstr/zazu-timetracker
--- +++ @@ -1,4 +1,5 @@ const timetrack = require('./timetrack'); +const Sugar = require('sugar-date'); const calculateDuration = require('./calculateDuration'); module.exports = (pluginContext) => { @@ -6,19 +7,27 @@ return new Promise((resolve, reject) => { timetrack.loadData(); resolve(timetrack.getHistory().map(entry => { + try { // get the duration of the entry let duration = 'Running'; if ('stop' in entry) { - duration = calculateDuration(entry.start, entry.stop); + // sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later + duration = Sugar.Date.format(Sugar.Date.create(entry.stop - entry.start - 3600000), '%H:%M:%S'); } // get the project name const project = entry.project || 'No project'; + // get the start date + const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%c') + return { icon: 'fa-clock-o', title: `[${duration}] ${project}`, - subtitle: `Nice work bro!` + subtitle: `started on ${startDate}` + } + } catch (e) { + alert('fount: ' + e); } })); });
a39453fdbfcc397839583d1b695e0476962f9879
src/index.js
src/index.js
'use strict'; import bunyan from 'bunyan'; import http from 'http'; import { createApp } from './app.js'; const logger = bunyan.createLogger({name: "Graphql-Swapi"}); logger.info('Server initialisation...'); createApp() .then((app) => { logger.info('Starting HTTP server'); const server = http.createServer(app); server.listen(8000, ()=> { logger.info('Server is up and running'); }); }) .catch((err) => { logger.error(err); });
'use strict'; import bunyan from 'bunyan'; import http from 'http'; import { createApp } from './app.js'; import eventsToAnyPromise from 'events-to-any-promise'; const logger = bunyan.createLogger({name: "Graphql-Swapi"}); function startServer(port, app) { logger.info('Starting HTTP server'); const server = http.createServer(app); server.listen(port); return eventsToAnyPromise(server, 'listening').then(() => { logger.info('Server is up and running'); return server; }); } logger.info('Server initialisation...'); createApp() .then((app) => startServer(8000, app)) .catch((err) => { logger.error(err); });
Use my new lib events-to-any-promise
Use my new lib events-to-any-promise
JavaScript
mit
franckLdx/GraphqlSwapi,franckLdx/GraphqlSwapi
--- +++ @@ -3,14 +3,21 @@ import bunyan from 'bunyan'; import http from 'http'; import { createApp } from './app.js'; +import eventsToAnyPromise from 'events-to-any-promise'; const logger = bunyan.createLogger({name: "Graphql-Swapi"}); +function startServer(port, app) { + logger.info('Starting HTTP server'); + const server = http.createServer(app); + server.listen(port); + return eventsToAnyPromise(server, 'listening').then(() => { + logger.info('Server is up and running'); + return server; + }); +} + logger.info('Server initialisation...'); createApp() - .then((app) => { - logger.info('Starting HTTP server'); - const server = http.createServer(app); - server.listen(8000, ()=> { logger.info('Server is up and running'); }); - }) + .then((app) => startServer(8000, app)) .catch((err) => { logger.error(err); });
c6bb66a01539a85c6011eb1c6bd92fb4b7253ca4
src/index.js
src/index.js
'use strict'; const childProcess = require('child-process-promise'); const express = require('express'); const path = require('path'); const fs = require('fs'); const configPath = path.resolve(process.cwd(), process.argv.slice().pop()); const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); const app = express(); async function build (target, args) { const commands = args.commands; const options = { cwd: args.path, }; console.log(`Deploying ${ target }...`); for (let i = 0; i < commands.length; i++) { const date = (new Date()).toLocaleDateString('sv-SE', { hour: 'numeric', minute: 'numeric', second: 'numeric', }); console.log(`${ date } Running ${ commands[i] }...`); await childProcess.exec(commands[i], options); console.log('Done'); } } app.post('/', (req, res) => { const target = req.query.target; if (config.repos[target]) { if(req.get('HTTP_X_GITHUB_EVENT') && req.get('HTTP_X_GITHUB_EVENT') === 'push'){ build(target, config.repos[target]); res.status(200).send(); } else { res.status(401).send(); } } else { res.status(400).send(); } }); app.listen(config.port, config.host);
'use strict'; const childProcess = require('child-process-promise'); const express = require('express'); const path = require('path'); const fs = require('fs'); const configPath = path.resolve(process.cwd(), process.argv.slice().pop()); const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); const app = express(); async function build (target, args) { const commands = args.commands; const options = { cwd: args.path, }; console.log(`Deploying ${ target }...`); for (let i = 0; i < commands.length; i++) { const date = (new Date()).toLocaleDateString('sv-SE', { hour: 'numeric', minute: 'numeric', second: 'numeric', }); console.log(`${ date } Running ${ commands[i] }...`); await childProcess.exec(commands[i], options); console.log('Done'); } } app.post('/', (req, res) => { const target = req.query.target; if (config.repos[target]) { if (req.get('x-github-event') && req.get('x-github-event') === 'push') { build(target, config.repos[target]); res.status(200).send(); } else { res.status(401).send(); } } else { res.status(400).send(); } }); app.listen(config.port, config.host);
Use correct GitHub header name when checking requests
Use correct GitHub header name when checking requests
JavaScript
mit
jwilsson/deployy-mcdeployface
--- +++ @@ -34,7 +34,7 @@ const target = req.query.target; if (config.repos[target]) { - if(req.get('HTTP_X_GITHUB_EVENT') && req.get('HTTP_X_GITHUB_EVENT') === 'push'){ + if (req.get('x-github-event') && req.get('x-github-event') === 'push') { build(target, config.repos[target]); res.status(200).send(); } else {
e68b54812c9245304433d5799252da87db7a4074
src/reducers/intl.js
src/reducers/intl.js
import {addLocaleData} from 'react-intl'; import {updateIntl as superUpdateIntl} from 'react-intl-redux'; import languages from '../languages.json'; import messages from '../../locale/messages.json'; import {IntlProvider, intlReducer} from 'react-intl-redux'; Object.keys(languages).forEach(locale => { // TODO: will need to handle locales not in the default intl - see www/custom-locales // eslint-disable-line import/no-unresolved import(`react-intl/locale-data/${locale}`).then(data => addLocaleData(data)); }); const intlInitialState = { intl: { defaultLocale: 'en', locale: 'en', messages: messages.en } }; const updateIntl = locale => superUpdateIntl({ locale: locale, messages: messages[locale] || messages.en }); export { intlReducer as default, IntlProvider, intlInitialState, updateIntl };
import {addLocaleData} from 'react-intl'; import {updateIntl as superUpdateIntl} from 'react-intl-redux'; import languages from '../languages.json'; import messages from '../../locale/messages.json'; // eslint-disable-line import/no-unresolved import {IntlProvider, intlReducer} from 'react-intl-redux'; Object.keys(languages).forEach(locale => { // TODO: will need to handle locales not in the default intl - see www/custom-locales import(`react-intl/locale-data/${locale}`).then(data => addLocaleData(data)); }); const intlInitialState = { intl: { defaultLocale: 'en', locale: 'en', messages: messages.en } }; const updateIntl = locale => superUpdateIntl({ locale: locale, messages: messages[locale] || messages.en }); export { intlReducer as default, IntlProvider, intlInitialState, updateIntl };
Fix eslint-disable for unresolved messages line
Fix eslint-disable for unresolved messages line
JavaScript
bsd-3-clause
LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui
--- +++ @@ -1,12 +1,12 @@ import {addLocaleData} from 'react-intl'; import {updateIntl as superUpdateIntl} from 'react-intl-redux'; import languages from '../languages.json'; -import messages from '../../locale/messages.json'; +import messages from '../../locale/messages.json'; // eslint-disable-line import/no-unresolved + import {IntlProvider, intlReducer} from 'react-intl-redux'; Object.keys(languages).forEach(locale => { // TODO: will need to handle locales not in the default intl - see www/custom-locales - // eslint-disable-line import/no-unresolved import(`react-intl/locale-data/${locale}`).then(data => addLocaleData(data)); });
85b926b56baa0f29b71b5edea3e83479d1252f69
saleor/static/js/components/categoryPage/ProductItem.js
saleor/static/js/components/categoryPage/ProductItem.js
import React, { Component, PropTypes } from 'react'; import Relay from 'react-relay'; import ProductPrice from './ProductPrice'; class ProductItem extends Component { static propTypes = { product: PropTypes.object }; render() { const { product } = this.props; return ( <div className="col-6 col-md-4 product-list" itemScope itemType="https://schema.org/Product"> <a itemProp="url" href={product.url}> <div className="text-center"> <div> <img itemProp="image" className="img-responsive" src={product.thumbnailUrl} alt="" /> <span className="product-list-item-name" itemProp="name" title={product.name}>{product.name}</span> </div> <div className="panel-footer"> <ProductPrice price={product.price} availability={product.availability} /> </div> </div> </a> </div> ); } } export default Relay.createContainer(ProductItem, { fragments: { product: () => Relay.QL` fragment on ProductType { id name price { currency gross net } availability { ${ProductPrice.getFragment('availability')} } thumbnailUrl url } ` } });
import React, { Component, PropTypes } from 'react'; import Relay from 'react-relay'; import ProductPrice from './ProductPrice'; class ProductItem extends Component { static propTypes = { product: PropTypes.object }; render() { const { product } = this.props; return ( <div className="col-6 col-md-4 product-list" itemScope itemType="https://schema.org/Product"> <a itemProp="url" href={product.url}> <div className="text-center"> <div> <img itemProp="image" className="img-responsive" src={product.thumbnailUrl} alt="" /> <span className="product-list-item-name" itemProp="name" title={product.name}>{product.name}</span> </div> <div className="panel-footer"> <ProductPrice price={product.price} availability={product.availability} /> </div> </div> </a> </div> ); } } export default Relay.createContainer(ProductItem, { fragments: { product: () => Relay.QL` fragment on ProductType { id name price { currency gross grossLocalized net } availability { ${ProductPrice.getFragment('availability')} } thumbnailUrl url } ` } });
Add missing field to query
Add missing field to query
JavaScript
bsd-3-clause
jreigel/saleor,UITools/saleor,tfroehlich82/saleor,UITools/saleor,KenMutemi/saleor,UITools/saleor,tfroehlich82/saleor,HyperManTT/ECommerceSaleor,HyperManTT/ECommerceSaleor,jreigel/saleor,mociepka/saleor,KenMutemi/saleor,mociepka/saleor,maferelo/saleor,car3oon/saleor,maferelo/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,itbabu/saleor,UITools/saleor,car3oon/saleor,jreigel/saleor,itbabu/saleor,tfroehlich82/saleor,itbabu/saleor,car3oon/saleor,KenMutemi/saleor
--- +++ @@ -38,6 +38,7 @@ price { currency gross + grossLocalized net } availability {
5927b98e608128152adafed5435fd2ec47a04237
src/slide.js
src/slide.js
const DEFAULT_IN = 'fadeIn' const DEFAULT_OUT = 'fadeOut' class Slide extends BaseElement { static get observedAttributes () { return ['active', 'in', 'out'] } get active () { return this.hasAttribute('active') } set active (value) { value ? this.setAttribute('active', '') : this.removeAttribute('active') } get in () { return this.getAttribute('in') || DEFAULT_IN } get out () { return this.getAttribute('out') || DEFAULT_OUT } onConnect() { this.style.cssText = ` position: fixed; top: 0; left: 0; width: 100%; height: 100%; ` this.classList.add('animated') } renderCallback () { if (this.active) { this.classList.add(this.in) this.classList.remove(this.out) } else { this.classList.add(this.out) this.classList.remove(this.in) } } } customElements.define('x-slide', Slide)
const DEFAULT_IN = 'fadeIn' const DEFAULT_OUT = 'fadeOut' class Slide extends BaseElement { static get observedAttributes () { return ['active', 'in', 'out'] } get active () { return this.hasAttribute('active') } set active (value) { value ? this.setAttribute('active', '') : this.removeAttribute('active') } get in () { return this.getAttribute('in') || DEFAULT_IN } get out () { return this.getAttribute('out') || DEFAULT_OUT } onConnect() { this.classList.add('animated') Object.assign(this.style, this.inlineCSS()) } renderCallback () { if (this.active) { this.classList.add(this.in) this.classList.remove(this.out) } else { this.classList.add(this.out) this.classList.remove(this.in) } } inlineCSS() { return { position: 'fixed', top: 0, left: 0, display: 'flex', width: '100%', height: '100%', background: 'black', fontFamily: 'BlinkMacSystemFont, sans-serif', borderWidth: '30px', borderStyle: 'solid', padding: '100px' } } } customElements.define('x-slide', Slide)
Simplify inline styles for inheritance
Simplify inline styles for inheritance
JavaScript
mit
ricardocasares/using-custom-elements,ricardocasares/using-custom-elements
--- +++ @@ -24,15 +24,8 @@ } onConnect() { - this.style.cssText = ` - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - ` - this.classList.add('animated') + Object.assign(this.style, this.inlineCSS()) } renderCallback () { @@ -44,6 +37,22 @@ this.classList.remove(this.in) } } + + inlineCSS() { + return { + position: 'fixed', + top: 0, + left: 0, + display: 'flex', + width: '100%', + height: '100%', + background: 'black', + fontFamily: 'BlinkMacSystemFont, sans-serif', + borderWidth: '30px', + borderStyle: 'solid', + padding: '100px' + } + } } customElements.define('x-slide', Slide)
b47017282e23be837d469378e5d1ac307f8d99c1
client/app/scripts/directive/projectQuickView.js
client/app/scripts/directive/projectQuickView.js
angular .module('app') .directive('projectQuickView', function() { return { restrict: 'EA', replace: false, templateUrl: 'app/templates/partials/projectQuickView.html', link: function(scope, element, attrs) { scope.completed = attrs.completed; scope.hasDate = function() { return scope.item.end_date && scope.item.end_date !== null; }; scope.isContentFromOldSite = function(item) { return scope.item.end_date == "2012-10-20T04:00:00.000Z"; }; scope.completedStamp = function(item) { return scope.completed && !scope.isContentFromOldSite(item); }; } }; });
angular .module('app') .directive('projectQuickView', function() { return { restrict: 'EA', replace: false, templateUrl: 'app/templates/partials/projectQuickView.html', link: function(scope, element, attrs) { scope.completed = attrs.completed; scope.hasDate = function() { return scope.item && scope.item.end_date && scope.item.end_date !== null; }; scope.isContentFromOldSite = function(item) { return item && item.end_date == "2012-10-20T04:00:00.000Z"; }; scope.completedStamp = function(item) { return scope.completed && !scope.isContentFromOldSite(item); }; } }; });
Make a check if end_date exists on the project in the hasDate function
Make a check if end_date exists on the project in the hasDate function
JavaScript
mit
brettshollenberger/rootstrikers,brettshollenberger/rootstrikers
--- +++ @@ -9,11 +9,11 @@ scope.completed = attrs.completed; scope.hasDate = function() { - return scope.item.end_date && scope.item.end_date !== null; + return scope.item && scope.item.end_date && scope.item.end_date !== null; }; scope.isContentFromOldSite = function(item) { - return scope.item.end_date == "2012-10-20T04:00:00.000Z"; + return item && item.end_date == "2012-10-20T04:00:00.000Z"; }; scope.completedStamp = function(item) {
d2ba5543a42f23167628cef002e7df9be8a6b2f0
app/updateChannel.js
app/updateChannel.js
'use strict' const TelegramBot = require('node-telegram-bot-api'); const config = require('../config'); const utils = require('./utils'); const Kinospartak = require('./Kinospartak/Kinospartak'); const bot = new TelegramBot(config.TOKEN); const kinospartak = new Kinospartak(); /** * updateSchedule - update schedule and push updates to Telegram channel * * @return {Promise} */ function updateSchedule() { return kinospartak.getChanges() .then(changes => changes.length ? utils.formatSchedule(changes) : undefined) .then(messages => messages ? utils.sendInOrder(bot, config.CHANNEL, messages) : undefined) .then(() => kinospartak.commitChanges()) }; /** * updateNews - update news and push updates to Telegram channel * * @return {Promise} */ function updateNews() { return kinospartak.getLatestNews() .then(news => news.length ? utils.formatNews(news) : undefined) .then(messages => messages ? utils.sendInOrder(bot, config.CHANNEL, messages) : undefined) .then(() => kinospartak.setNewsOffset(new Date().toString())) }; function update() { return Promise.all([ updateSchedule, updateNews ]).catch((err) => { setTimeout(() => { update(); }, 1000 * 60 * 5); }) } update();
'use strict' const TelegramBot = require('node-telegram-bot-api'); const config = require('../config'); const utils = require('./utils'); const Kinospartak = require('./Kinospartak/Kinospartak'); const bot = new TelegramBot(config.TOKEN); const kinospartak = new Kinospartak(); /** * updateSchedule - update schedule and push updates to Telegram channel * * @return {Promise} */ function updateSchedule() { return kinospartak.getChanges() .then(changes => changes.length ? utils.formatSchedule(changes) : undefined) .then(messages => messages ? utils.sendInOrder(bot, config.CHANNEL, messages) : undefined) .then(() => kinospartak.commitChanges()) }; /** * updateNews - update news and push updates to Telegram channel * * @return {Promise} */ function updateNews() { return kinospartak.getLatestNews() .then(news => news.length ? utils.formatNews(news) : undefined) .then(messages => messages ? utils.sendInOrder(bot, config.CHANNEL, messages) : undefined) .then(() => kinospartak.setNewsOffset(new Date().toString())) }; function update() { return Promise.all([ updateSchedule(), updateNews() ]).catch((err) => { setTimeout(() => { update(); }, 1000 * 60 * 5); }) } update();
Fix channel updating (Well, that was dumb)
Fix channel updating (Well, that was dumb)
JavaScript
mit
TheBeastOfCaerbannog/kinospartak-bot
--- +++ @@ -48,8 +48,8 @@ function update() { return Promise.all([ - updateSchedule, - updateNews + updateSchedule(), + updateNews() ]).catch((err) => { setTimeout(() => { update();
d4f4d7bccfa64881162a1e5ee12bb38223eacbdc
api/websocket/omni-websocket.js
api/websocket/omni-websocket.js
var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile('index.html'); }); io.on('connection', function(socket){ console.log('a user connected'); socket.on('disconnect', function(){ console.log('user disconnected'); }); }); http.listen(1089, function(){ console.log('listening on *:1089'); });
var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile('index.html'); }); io.on('connection', function(socket){ console.log('a user connected'); socket.on('disconnect', function(){ console.log('user disconnected'); }); }); http.listen(1091, function(){ console.log('listening on *:1091'); });
Change port of websocket to 1091
Change port of websocket to 1091
JavaScript
agpl-3.0
achamely/omniwallet,habibmasuro/omniwallet,Nevtep/omniwallet,VukDukic/omniwallet,OmniLayer/omniwallet,achamely/omniwallet,OmniLayer/omniwallet,habibmasuro/omniwallet,habibmasuro/omniwallet,achamely/omniwallet,achamely/omniwallet,VukDukic/omniwallet,habibmasuro/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,VukDukic/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,Nevtep/omniwallet
--- +++ @@ -14,6 +14,6 @@ }); }); -http.listen(1089, function(){ - console.log('listening on *:1089'); +http.listen(1091, function(){ + console.log('listening on *:1091'); });
b0924f63b065016bfe073797c7bba4ed844268ab
packages/ember-model/lib/attr.js
packages/ember-model/lib/attr.js
var get = Ember.get, set = Ember.set, meta = Ember.meta; Ember.attr = function(type) { return Ember.computed(function(key, value) { var data = get(this, 'data'), dataValue = data && get(data, key), beingCreated = meta(this).proto === this; if (arguments.length === 2) { if (beingCreated) { if (!data) { data = {}; set(this, 'data', data); data[key] = value; } return value; } var isEqual; if (type && type.isEqual) { isEqual = type.isEqual(dataValue, value); } else { isEqual = dataValue === value; } if (!isEqual) { if (!this._dirtyAttributes) { this._dirtyAttributes = Ember.A(); } this._dirtyAttributes.push(key); } else { if (this._dirtyAttributes) { this._dirtyAttributes.removeObject(key); } } return value; } if (typeof dataValue === 'object') { dataValue = Object.create(dataValue); } return dataValue; }).property('data').meta({isAttribute: true, type: type}); };
var get = Ember.get, set = Ember.set, meta = Ember.meta; Ember.attr = function(type) { return Ember.computed(function(key, value) { var data = get(this, 'data'), dataValue = data && get(data, key), beingCreated = meta(this).proto === this; if (arguments.length === 2) { if (beingCreated) { if (!data) { data = {}; set(this, 'data', data); data[key] = value; } return value; } var isEqual; if (type && type.isEqual) { isEqual = type.isEqual(dataValue, value); } else { isEqual = dataValue === value; } if (!isEqual) { if (!this._dirtyAttributes) { this._dirtyAttributes = Ember.A(); } this._dirtyAttributes.push(key); } else { if (this._dirtyAttributes) { this._dirtyAttributes.removeObject(key); } } return value; } if (typeof dataValue === 'object') { dataValue = Ember.create(dataValue); } return dataValue; }).property('data').meta({isAttribute: true, type: type}); };
Use Ember.create vs Object.create for polyfill fix
Use Ember.create vs Object.create for polyfill fix
JavaScript
mit
julkiewicz/ember-model,ipavelpetrov/ember-model,ckung/ember-model,zenefits/ember-model,c0achmcguirk/ember-model,sohara/ember-model,GavinJoyce/ember-model,Swrve/ember-model,asquet/ember-model,gmedina/ember-model,CondeNast/ember-model,igorgoroshit/ember-model,asquet/ember-model,juggy/ember-model,greyhwndz/ember-model,ebryn/ember-model,ipavelpetrov/ember-model,intercom/ember-model
--- +++ @@ -35,7 +35,7 @@ } if (typeof dataValue === 'object') { - dataValue = Object.create(dataValue); + dataValue = Ember.create(dataValue); } return dataValue; }).property('data').meta({isAttribute: true, type: type});
ae93a807f90a0b59101443d28a88cf934e536e4e
src/Calibrator.js
src/Calibrator.js
import {VM} from 'vm2' import SensorData from './SensorData' export default class Calibrator { calibrate (data, cb) { if ( ! (data instanceof SensorData)) return cb('Invalid SensorData given.') var meta = data.getMetadata() meta.getAttributes().forEach(function (attr) { attr.getProperties().forEach(function (prop) { if (prop.name !== 'calibrate') return var vm = new VM({ timeout: 1000, sandbox: { val: data.getValue(attr.getName()) }, }) var value = vm.run('(' + decodeURI(prop.value) + ')(val)') data.setValue(attr.getName(), value) }) }) cb() } }
import {VM} from 'vm2' import SensorData from './SensorData' export default class Calibrator { calibrate (data, cb) { if ( ! (data instanceof SensorData)) return cb('Invalid SensorData given.') var meta = data.getMetadata() meta.getAttributes().forEach(function (attr) { attr.getProperties().forEach(function (prop) { if (prop.name !== 'calibrate') return var vm = new VM({ timeout: 1000, sandbox: { Math: Math, val: data.getValue(attr.getName()) }, }) var value = vm.run('(' + decodeURI(prop.value.toString()) + ')(val)') data.setValue(attr.getName(), value) }) }) cb() } }
Add Math to calibrator VM and allow use of functions (not only function strings).
Add Math to calibrator VM and allow use of functions (not only function strings).
JavaScript
mit
kukua/concava
--- +++ @@ -14,10 +14,11 @@ var vm = new VM({ timeout: 1000, sandbox: { + Math: Math, val: data.getValue(attr.getName()) }, }) - var value = vm.run('(' + decodeURI(prop.value) + ')(val)') + var value = vm.run('(' + decodeURI(prop.value.toString()) + ')(val)') data.setValue(attr.getName(), value) }) })
769ceb537eec6642fd039ea7ad0fa074029759b1
share/spice/arxiv/arxiv.js
share/spice/arxiv/arxiv.js
(function (env) { "use strict"; env.ddg_spice_arxiv = function(api_result){ if (!api_result) { return Spice.failed('arxiv'); } Spice.add({ id: "arxiv", name: "Reference", data: api_result, meta: { sourceName: "arxiv.org", sourceUrl: api_result.feed.entry.link[0].href }, normalize: function(item) { return { title: item.feed.entry.title.text, url: item.feed.entry.link[0].href, subtitle: item.feed.entry.author.map( function(e) { return e.name.text; } ).join(', '), description: item.feed.entry.summary.text }; }, templates: { group: 'info', options: { moreAt: true } } }); }; }(this));
(function (env) { "use strict"; env.ddg_spice_arxiv = function(api_result){ if (!api_result) { return Spice.failed('arxiv'); } Spice.add({ id: "arxiv", name: "Reference", data: api_result, meta: { sourceName: "arxiv.org", sourceUrl: api_result.feed.entry.link[0].href }, normalize: function(item) { return { title: sprintf( "%s (%s)", item.feed.entry.title.text, item.feed.entry.published.text.replace( /^(\d{4}).*/, "$1" ) ), url: item.feed.entry.link[0].href, subtitle: item.feed.entry.author.map( function(e) { return e.name.text; } ).join(', '), description: item.feed.entry.summary.text }; }, templates: { group: 'info', options: { moreAt: true } } }); }; }(this));
Add published year to title
Add published year to title
JavaScript
apache-2.0
bigcurl/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,levaly/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,imwally/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,soleo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,lerna/zeroclickinfo-spice,imwally/zeroclickinfo-spice,lernae/zeroclickinfo-spice,deserted/zeroclickinfo-spice,soleo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lernae/zeroclickinfo-spice,soleo/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,lerna/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,soleo/zeroclickinfo-spice,levaly/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,levaly/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,P71/zeroclickinfo-spice,imwally/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,levaly/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,deserted/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,deserted/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,imwally/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,deserted/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,P71/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,lerna/zeroclickinfo-spice,imwally/zeroclickinfo-spice,lernae/zeroclickinfo-spice,lerna/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,levaly/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,lernae/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,levaly/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,deserted/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,deserted/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice
--- +++ @@ -17,7 +17,10 @@ }, normalize: function(item) { return { - title: item.feed.entry.title.text, + title: sprintf( "%s (%s)", + item.feed.entry.title.text, + item.feed.entry.published.text.replace( /^(\d{4}).*/, "$1" ) + ), url: item.feed.entry.link[0].href, subtitle: item.feed.entry.author.map( function(e) { return e.name.text;
2897631e9330289d95ddbab0aa3b13f5d24d1d81
web/js/calendar-template.js
web/js/calendar-template.js
function cookieValueHandler() { Cookies.set(this.name, this.value, 365) window.location.reload() } function registerSpecialInputs() { $$("input").each(function(input) { if (input.getAttribute("special") == "cookie") { Event.observe(input, "click", cookieValueHandler) if (input.type == "radio" && Cookies.get(input.name) == input.value) { input.checked = true } } }); } Event.observe(window, 'load', registerSpecialInputs)
function cookieValueHandler(event) { var src = Event.element(event) Cookies.set(src.name, src.value, 365) window.location.reload() } function registerSpecialInputs() { $$("input").each(function(input) { if (input.getAttribute("special") == "cookie") { Event.observe(input, "click", cookieValueHandler) if (input.type == "radio" && Cookies.get(input.name) == input.value) { input.checked = true } } }); } Event.observe(window, 'load', registerSpecialInputs)
Fix cookieValueHandler to work with IE
Fix cookieValueHandler to work with IE git-svn-id: 4b387fe5ada7764508e2ca96c335714e4c1692c6@406 0d517254-b314-0410-acde-c619094fa49f
JavaScript
bsd-3-clause
NUBIC/psc-mirror,NUBIC/psc-mirror,NUBIC/psc-mirror,NUBIC/psc-mirror
--- +++ @@ -1,5 +1,6 @@ -function cookieValueHandler() { - Cookies.set(this.name, this.value, 365) +function cookieValueHandler(event) { + var src = Event.element(event) + Cookies.set(src.name, src.value, 365) window.location.reload() }
3ee8995af1835156d7c94a3f6480d48396884f5c
dashboard/src/store/store.js
dashboard/src/store/store.js
import Vue from "vue"; import Vuex from "vuex"; Vue.use(Vuex); export default new Vuex.Store({ state: {}, mutations: {}, actions: {}, modules: {} });
import Vue from "vue"; import Vuex from "vuex"; Vue.use(Vuex); export default new Vuex.Store({ strict: process.env.NODE_ENV !== "production", //see https://vuex.vuejs.org/guide/strict.html state: {}, mutations: {}, actions: {}, modules: {} });
Enable VueX strict mode in dev
Enable VueX strict mode in dev
JavaScript
agpl-3.0
napstr/wolfia,napstr/wolfia,napstr/wolfia
--- +++ @@ -4,6 +4,7 @@ Vue.use(Vuex); export default new Vuex.Store({ + strict: process.env.NODE_ENV !== "production", //see https://vuex.vuejs.org/guide/strict.html state: {}, mutations: {}, actions: {},
39e587b52c92c8b71bb3eed4824c2cfc10b37306
apps/files_sharing/js/public.js
apps/files_sharing/js/public.js
// Override download path to files_sharing/public.php function fileDownloadPath(dir, file) { var url = $('#downloadURL').val(); if (url.indexOf('&path=') != -1) { url += '/'+file; } return url; } $(document).ready(function() { if (typeof FileActions !== 'undefined') { var mimetype = $('#mimetype').val(); // Show file preview if previewer is available, images are already handled by the template if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') { // Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); if (typeof action === 'undefined') { $('#noPreview').show(); } else { action($('#filename').val()); } } FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function(filename) { var tr = $('tr').filterAttr('data-file', filename) if (tr.length > 0) { window.location = $(tr).find('a.name').attr('href'); } }); } });
// Override download path to files_sharing/public.php function fileDownloadPath(dir, file) { var url = $('#downloadURL').val(); if (url.indexOf('&path=') != -1) { url += '/'+file; } return url; } $(document).ready(function() { if (typeof FileActions !== 'undefined') { var mimetype = $('#mimetype').val(); // Show file preview if previewer is available, images are already handled by the template if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') { // Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); if (typeof action === 'undefined') { $('#noPreview').show(); if (mimetype != 'httpd/unix-directory') { // NOTE: Remove when a better file previewer solution exists $('#content').remove(); $('table').remove(); } } else { action($('#filename').val()); } } FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function(filename) { var tr = $('tr').filterAttr('data-file', filename) if (tr.length > 0) { window.location = $(tr).find('a.name').attr('href'); } }); } });
Remove the content and table to prevent covering the download link
Remove the content and table to prevent covering the download link
JavaScript
agpl-3.0
pollopolea/core,andreas-p/nextcloud-server,phil-davis/core,andreas-p/nextcloud-server,michaelletzgus/nextcloud-server,jbicha/server,owncloud/core,owncloud/core,whitekiba/server,owncloud/core,bluelml/core,nextcloud/server,pmattern/server,IljaN/core,lrytz/core,pmattern/server,sharidas/core,sharidas/core,Ardinis/server,andreas-p/nextcloud-server,pmattern/server,michaelletzgus/nextcloud-server,nextcloud/server,pixelipo/server,michaelletzgus/nextcloud-server,IljaN/core,pollopolea/core,bluelml/core,xx621998xx/server,endsguy/server,IljaN/core,andreas-p/nextcloud-server,jbicha/server,Ardinis/server,xx621998xx/server,pixelipo/server,whitekiba/server,endsguy/server,lrytz/core,xx621998xx/server,bluelml/core,pixelipo/server,bluelml/core,nextcloud/server,owncloud/core,IljaN/core,pmattern/server,pixelipo/server,michaelletzgus/nextcloud-server,jbicha/server,Ardinis/server,jbicha/server,pollopolea/core,pmattern/server,whitekiba/server,whitekiba/server,lrytz/core,owncloud/core,sharidas/core,endsguy/server,cernbox/core,xx621998xx/server,Ardinis/server,sharidas/core,nextcloud/server,endsguy/server,xx621998xx/server,whitekiba/server,IljaN/core,pollopolea/core,andreas-p/nextcloud-server,lrytz/core,sharidas/core,pixelipo/server,jbicha/server,Ardinis/server,bluelml/core,cernbox/core,cernbox/core,cernbox/core,pollopolea/core,lrytz/core,endsguy/server,cernbox/core
--- +++ @@ -17,6 +17,11 @@ var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); if (typeof action === 'undefined') { $('#noPreview').show(); + if (mimetype != 'httpd/unix-directory') { + // NOTE: Remove when a better file previewer solution exists + $('#content').remove(); + $('table').remove(); + } } else { action($('#filename').val()); }
b33316dba3ce7ab8dc2c99d4ba17c700c3f4da74
js/src/index.js
js/src/index.js
import $ from 'jquery' import Alert from './alert' import Button from './button' import Carousel from './carousel' import Collapse from './collapse' import Dropdown from './dropdown' import Modal from './modal' import Popover from './popover' import Scrollspy from './scrollspy' import Tab from './tab' import Tooltip from './tooltip' import Util from './util' /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-alpha.6): index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ (($) => { if (typeof $ === 'undefined') { throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') } const version = $.fn.jquery.split(' ')[0].split('.') const minMajor = 1 const ltMajor = 2 const minMinor = 9 const minPatch = 1 const maxMajor = 4 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') } })($) export { Util, Alert, Button, Carousel, Collapse, Dropdown, Modal, Popover, Scrollspy, Tab, Tooltip }
import $ from 'jquery' import Alert from './alert' import Button from './button' import Carousel from './carousel' import Collapse from './collapse' import Dropdown from './dropdown' import Modal from './modal' import Popover from './popover' import Scrollspy from './scrollspy' import Tab from './tab' import Tooltip from './tooltip' import Util from './util' /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0): index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ (($) => { if (typeof $ === 'undefined') { throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') } const version = $.fn.jquery.split(' ')[0].split('.') const minMajor = 1 const ltMajor = 2 const minMinor = 9 const minPatch = 1 const maxMajor = 4 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') } })($) export { Util, Alert, Button, Carousel, Collapse, Dropdown, Modal, Popover, Scrollspy, Tab, Tooltip }
Fix leftover reference to v4.0.0-alpha.6
Fix leftover reference to v4.0.0-alpha.6 Running `./build/change-version.js v4.0.0-alpha.6 v4.0.0` fixed this, so the version change script works fine. I'm presuming instead this change was just omitted from 35f80bb12e4e, and then wouldn't have been caught by subsequent runs of `change-version`, since it only ever replaces the exact old version string specified.
JavaScript
mit
creativewebjp/bootstrap,seanwu99/bootstrap,coliff/bootstrap,Hemphill/bootstrap-docs,stanwmusic/bootstrap,Lyricalz/bootstrap,GerHobbelt/bootstrap,peterblazejewicz/bootstrap,inway/bootstrap,stanwmusic/bootstrap,inway/bootstrap,tagliala/bootstrap,yuyokk/bootstrap,kvlsrg/bootstrap,creativewebjp/bootstrap,GerHobbelt/bootstrap,m5o/bootstrap,bardiharborow/bootstrap,creativewebjp/bootstrap,nice-fungal/bootstrap,Lyricalz/bootstrap,seanwu99/bootstrap,creativewebjp/bootstrap,bardiharborow/bootstrap,bardiharborow/bootstrap,m5o/bootstrap,Hemphill/bootstrap-docs,seanwu99/bootstrap,bootstrapbrasil/bootstrap,gijsbotje/bootstrap,twbs/bootstrap,zalog/bootstrap,nice-fungal/bootstrap,kvlsrg/bootstrap,bootstrapbrasil/bootstrap,yuyokk/bootstrap,GerHobbelt/bootstrap,bootstrapbrasil/bootstrap,joblocal/bootstrap,stanwmusic/bootstrap,fschumann1211/bootstrap,gijsbotje/bootstrap,Hemphill/bootstrap-docs,nice-fungal/bootstrap,tagliala/bootstrap,peterblazejewicz/bootstrap,Hemphill/bootstrap-docs,bardiharborow/bootstrap,zalog/bootstrap,joblocal/bootstrap,twbs/bootstrap,yuyokk/bootstrap,Lyricalz/bootstrap,fschumann1211/bootstrap,seanwu99/bootstrap,gijsbotje/bootstrap,joblocal/bootstrap,joblocal/bootstrap,tjkohli/bootstrap,fschumann1211/bootstrap,tagliala/bootstrap,coliff/bootstrap,fschumann1211/bootstrap,gijsbotje/bootstrap,inway/bootstrap,peterblazejewicz/bootstrap,Lyricalz/bootstrap,stanwmusic/bootstrap,tjkohli/bootstrap,zalog/bootstrap,yuyokk/bootstrap,kvlsrg/bootstrap
--- +++ @@ -13,7 +13,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.6): index.js + * Bootstrap (v4.0.0): index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */
1bc6d05e92432dbf503483e3f74d8a3fd456b4a6
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var $ = require('gulp-load-plugins')({ lazy: false }); var source = require('vinyl-source-stream2'); var browserify = require('browserify'); var path = require('path'); var pkg = require('./package.json'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @author <%= pkg.author %>', ' * @link <%= pkg.homepage %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); gulp.task('test', function() { return gulp.src('test/**/*.test.js', { read: false }) .pipe($.mocha({ reporter: 'mocha-better-spec-reporter' })); }); gulp.task('script', function () { var bundleStream = browserify({ entries: './lib/should.js', builtins: ['util', 'assert'] }) .bundle({ insertGlobals: false, detectGlobals: false, standalone: 'Should' }); return bundleStream .pipe(source('should.js')) .pipe($.header(banner, { pkg : pkg } )) .pipe(gulp.dest('./')) .pipe($.uglify()) .pipe($.header(banner, { pkg : pkg } )) .pipe($.rename('should.min.js')) .pipe(gulp.dest('./')); });
var gulp = require('gulp'); var $ = require('gulp-load-plugins')({ lazy: false }); var source = require('vinyl-source-stream2'); var browserify = require('browserify'); var path = require('path'); var pkg = require('./package.json'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @author <%= pkg.author %>', ' * @link <%= pkg.homepage %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); gulp.task('test', function() { return gulp.src('test/**/*.test.js', { read: false }) .pipe($.mocha({ reporter: 'mocha-better-spec-reporter' })); }); gulp.task('script', function () { var bundleStream = browserify({ entries: './lib/should.js', builtins: ['util', 'assert'], insertGlobals: false, detectGlobals: false, standalone: 'Should' }) .bundle(); return bundleStream .pipe(source('should.js')) .pipe($.header(banner, { pkg : pkg } )) .pipe(gulp.dest('./')) .pipe($.uglify()) .pipe($.header(banner, { pkg : pkg } )) .pipe($.rename('should.min.js')) .pipe(gulp.dest('./')); });
Fix bundle arguments for latest browserify
Fix bundle arguments for latest browserify
JavaScript
mit
ngot/should.js,Lucifier129/should.js,Qix-/should.js,shouldjs/should.js,shouldjs/should.js,hakatashi/wa.js,enicholson/should.js
--- +++ @@ -27,13 +27,12 @@ gulp.task('script', function () { var bundleStream = browserify({ entries: './lib/should.js', - builtins: ['util', 'assert'] + builtins: ['util', 'assert'], + insertGlobals: false, + detectGlobals: false, + standalone: 'Should' }) - .bundle({ - insertGlobals: false, - detectGlobals: false, - standalone: 'Should' - }); + .bundle(); return bundleStream .pipe(source('should.js'))