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
106d0c0f3d824631fc6decd139dd9d6e7d3aca88
tools/fake-database-service.js
tools/fake-database-service.js
'use strict'; function FakeDatabaseService() { } module.exports = FakeDatabaseService; FakeDatabaseService.prototype = { run: function(query, callback) { return callback(null, {}); }, createTable: function(targetTableName, query, callback) { return callback(null, {}); }, getColumnNames: function(query, callback) { return callback(null, []); }, getColumns: function(query, callback) { return callback(null, []); }, enqueue: function(query, callback) { return callback(null, {status: 'ok'}); }, registerNodesInCatalog: function(nodes, callback) { return callback(null); }, trackNode: function(node, callback) { return callback(null); } };
'use strict'; function FakeDatabaseService() { } module.exports = FakeDatabaseService; FakeDatabaseService.prototype = { run: function(query, callback) { return callback(null, {}); }, createTable: function(targetTableName, query, callback) { return callback(null, {}); }, createTableIfNotExists: function(targetTableName, outputQuery, callback) { return callback(null, true); }, setUpdatedAtForSources: function(analysis, callback) { return callback(null); }, registerAnalysisInCatalog: function(analysis, callback) { return callback(null); }, queueAnalysisOperations: function(analysis, callback) { return callback(null); }, trackAnalysis: function(analysis, callback) { return callback(null); }, getColumnNames: function(query, callback) { return callback(null, []); }, getColumns: function(query, callback) { return callback(null, []); }, enqueue: function(query, callback) { return callback(null, {status: 'ok'}); }, registerNodesInCatalog: function(nodes, callback) { return callback(null); }, trackNode: function(node, callback) { return callback(null); } };
Complete fake database service with missing stubs
Complete fake database service with missing stubs
JavaScript
bsd-3-clause
CartoDB/camshaft
--- +++ @@ -13,6 +13,26 @@ createTable: function(targetTableName, query, callback) { return callback(null, {}); + }, + + createTableIfNotExists: function(targetTableName, outputQuery, callback) { + return callback(null, true); + }, + + setUpdatedAtForSources: function(analysis, callback) { + return callback(null); + }, + + registerAnalysisInCatalog: function(analysis, callback) { + return callback(null); + }, + + queueAnalysisOperations: function(analysis, callback) { + return callback(null); + }, + + trackAnalysis: function(analysis, callback) { + return callback(null); }, getColumnNames: function(query, callback) {
814947e84a55a47a076be389579e458c556ec259
test/services/helpers/services/testSystem.js
test/services/helpers/services/testSystem.js
let createdSystemIds = []; const createTestSystem = app => ({ url, type = 'moodle' }) => app.service('systems').create({ url, type }) .then((system) => { createdSystemIds.push(system._id.toString()); return system; }); const cleanup = app => () => { const ids = createdSystemIds; createdSystemIds = []; return ids.map(id => app.service('systems').remove(id)); }; module.exports = app => ({ create: createTestSystem(app), cleanup: cleanup(app), info: createdSystemIds, });
let createdSystemIds = []; const createTestSystem = app => async (options = { url: '', type: 'moodle' }) => { const system = await app.service('systems').create(options); createdSystemIds.push(system._id.toString()); return system; }; const cleanup = app => () => { const ids = createdSystemIds; createdSystemIds = []; return ids.map(id => app.service('systems').remove(id)); }; module.exports = app => ({ create: createTestSystem(app), cleanup: cleanup(app), info: createdSystemIds, });
Refactor and improve test systems
Refactor and improve test systems
JavaScript
agpl-3.0
schul-cloud/schulcloud-server,schul-cloud/schulcloud-server,schul-cloud/schulcloud-server
--- +++ @@ -1,11 +1,10 @@ let createdSystemIds = []; -const createTestSystem = app => ({ url, type = 'moodle' }) => app.service('systems').create({ url, type }) - .then((system) => { - createdSystemIds.push(system._id.toString()); - return system; - }); - +const createTestSystem = app => async (options = { url: '', type: 'moodle' }) => { + const system = await app.service('systems').create(options); + createdSystemIds.push(system._id.toString()); + return system; +}; const cleanup = app => () => { const ids = createdSystemIds;
a2f85d74c83803ed4b6155f7c1f54b2fe0a1e276
index.js
index.js
'use strict'; var assert = require('assert'); var WM = require('es6-weak-map'); var hasNativeWeakmap = require('es6-weak-map/is-native-implemented'); var defaultResolution = require('default-resolution'); var runtimes = new WM(); function isFunction(fn){ return (typeof fn === 'function'); } function isExtensible(fn){ if(hasNativeWeakmap){ // native weakmap doesn't care about extensible return true; } return Object.isExtensible(fn); } function lastRun(fn, timeResolution){ assert(isFunction(fn), 'Only functions can check lastRun'); assert(isExtensible(fn), 'Only extensible functions can check lastRun'); var time = runtimes.get(fn); if(time == null){ return; } if(timeResolution == null){ timeResolution = defaultResolution(); } if(timeResolution){ return time - (time % timeResolution); } return time; } function capture(fn){ assert(isFunction(fn), 'Only functions can be captured'); assert(isExtensible(fn), 'Only extensible functions can be captured'); runtimes.set(fn, Date.now()); } lastRun.capture = capture; module.exports = lastRun;
'use strict'; var assert = require('assert'); var WM = require('es6-weak-map'); var hasWeakMap = require('es6-weak-map/is-implemented'); var defaultResolution = require('default-resolution'); var runtimes = new WM(); function isFunction(fn){ return (typeof fn === 'function'); } function isExtensible(fn){ if(hasWeakMap()){ // native weakmap doesn't care about extensible return true; } return Object.isExtensible(fn); } function lastRun(fn, timeResolution){ assert(isFunction(fn), 'Only functions can check lastRun'); assert(isExtensible(fn), 'Only extensible functions can check lastRun'); var time = runtimes.get(fn); if(time == null){ return; } if(timeResolution == null){ timeResolution = defaultResolution(); } if(timeResolution){ return time - (time % timeResolution); } return time; } function capture(fn){ assert(isFunction(fn), 'Only functions can be captured'); assert(isExtensible(fn), 'Only extensible functions can be captured'); runtimes.set(fn, Date.now()); } lastRun.capture = capture; module.exports = lastRun;
Improve native WeakMap check for newer node versions
Fix: Improve native WeakMap check for newer node versions
JavaScript
mit
gulpjs/last-run,phated/last-run
--- +++ @@ -3,7 +3,7 @@ var assert = require('assert'); var WM = require('es6-weak-map'); -var hasNativeWeakmap = require('es6-weak-map/is-native-implemented'); +var hasWeakMap = require('es6-weak-map/is-implemented'); var defaultResolution = require('default-resolution'); var runtimes = new WM(); @@ -13,7 +13,7 @@ } function isExtensible(fn){ - if(hasNativeWeakmap){ + if(hasWeakMap()){ // native weakmap doesn't care about extensible return true; }
f4fd796e83fe52aea37ce7335f85352e5cef9879
index.js
index.js
'use strict'; var normalizeOptions = require('es5-ext/object/normalize-options') , setPrototypeOf = require('es5-ext/object/set-prototype-of') , ensureObject = require('es5-ext/object/valid-object') , ensureStringifiable = require('es5-ext/object/validate-stringifiable-value') , d = require('d') , htmlToDom = require('html-template-to-dom') , SiteTree = require('site-tree') , defineProperty = Object.defineProperty, defineProperties = Object.defineProperties; var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts) { if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts); SiteTree.call(this, document); defineProperty(this, 'inserts', d(ensureObject(inserts))); }, SiteTree), { ensureTemplate: d(ensureStringifiable) }); HtmlSiteTree.prototype = Object.create(SiteTree.prototype, { constructor: d(HtmlSiteTree), resolveTemplate: d(function (tpl, context) { return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context)); }) }); module.exports = HtmlSiteTree;
'use strict'; var normalizeOptions = require('es5-ext/object/normalize-options') , setPrototypeOf = require('es5-ext/object/set-prototype-of') , ensureObject = require('es5-ext/object/valid-object') , ensureStringifiable = require('es5-ext/object/validate-stringifiable-value') , d = require('d') , htmlToDom = require('html-template-to-dom') , SiteTree = require('site-tree') , defineProperty = Object.defineProperty, defineProperties = Object.defineProperties; var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts) { if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts); SiteTree.call(this, document); defineProperty(this, 'inserts', d(ensureObject(inserts))); }, SiteTree), { ensureTemplate: d(ensureStringifiable) }); HtmlSiteTree.prototype = Object.create(SiteTree.prototype, { constructor: d(HtmlSiteTree), _resolveTemplate: d(function (tpl, context) { return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context)); }) }); module.exports = HtmlSiteTree;
Update up to changes to site-tree
Update up to changes to site-tree
JavaScript
mit
medikoo/html-site-tree
--- +++ @@ -20,7 +20,7 @@ HtmlSiteTree.prototype = Object.create(SiteTree.prototype, { constructor: d(HtmlSiteTree), - resolveTemplate: d(function (tpl, context) { + _resolveTemplate: d(function (tpl, context) { return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context)); }) });
5c56820c7e925951d98a83258afbbca9de235b5a
test/create.js
test/create.js
import test from 'ava'; import { create } from '../lib'; test('"create" function.', ({is, true: isTrue}) => { // Create object. let Test = create(function(a){ this.a = a; }, { foo: function(a){ this.a = a; } }); // Initialize object. let foo = new Test('baz'); // Check construction value. is(foo.a, 'baz'); // Change value foo.foo('qux'); // Haha, foofoo // Test new value is(foo.a, 'qux'); // Construction without "new" // jshint newcap: false let bar = Test('qux'); isTrue(bar instanceof Test); });
import test from 'ava'; import { create } from '../lib'; test('"create" function', ({is, true: isTrue}) => { // Create object. let Test = create(function(a){ this.a = a; }, { foo: function(a){ this.a = a; } }); // Initialize object. let foo = new Test('baz'); // Check construction value. is(foo.a, 'baz'); // Change value foo.foo('qux'); // Haha, foofoo // Test new value is(foo.a, 'qux'); // Construction without "new" // jshint newcap: false let bar = Test('qux'); isTrue(bar instanceof Test); });
Remove period from test name
Remove period from test name
JavaScript
mit
jamen/rpv
--- +++ @@ -1,7 +1,7 @@ import test from 'ava'; import { create } from '../lib'; -test('"create" function.', ({is, true: isTrue}) => { +test('"create" function', ({is, true: isTrue}) => { // Create object. let Test = create(function(a){ this.a = a;
c90aeb8628b2a6a7c4d58954786c011f17ee743b
Tools/buildTasks/createGalleryList.js
Tools/buildTasks/createGalleryList.js
/*global importClass,project,attributes,elements,java,Packages*/ importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/ Main.exec(['-e', '{}']); var load = Main.global.load; load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ var demos = []; forEachFile('demos', function(relativePath, file) { "use strict"; var demo = relativePath.substring(0, relativePath.lastIndexOf('.')).replace('\\', '/'); var demoObject = { name : String(demo), date : file.lastModified() }; if (new File(file.getParent(), demo + '.jpg').exists()) { demoObject.img = demo + '.jpg'; } demos.push(JSON.stringify(demoObject, null, 2)); }); var contents = '\ // This file is automatically rebuilt by the Cesium build process.\n\ var gallery_demos = [' + demos.join(', ') + '];'; writeFileContents(attributes.get('output'), contents);
/*global importClass,project,attributes,elements,java,Packages*/ importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/ Main.exec(['-e', '{}']); var load = Main.global.load; load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ var demos = []; var output = attributes.get('output'); forEachFile('demos', function(relativePath, file) { "use strict"; var demo = relativePath.substring(0, relativePath.lastIndexOf('.')).replace('\\', '/'); var demoObject = { name : String(demo), date : file.lastModified() }; if (new File(new File(output).getParent(), demo + '.jpg').exists()) { demoObject.img = demo + '.jpg'; } demos.push(JSON.stringify(demoObject, null, 2)); }); var contents = '\ // This file is automatically rebuilt by the Cesium build process.\n\ var gallery_demos = [' + demos.join(', ') + '];'; writeFileContents(output, contents);
Fix gallery images for dev-only Sandcastle demos.
Fix gallery images for dev-only Sandcastle demos.
JavaScript
apache-2.0
kiselev-dv/cesium,soceur/cesium,AnimatedRNG/cesium,esraerik/cesium,CesiumGS/cesium,omh1280/cesium,kiselev-dv/cesium,kaktus40/cesium,NaderCHASER/cesium,jason-crow/cesium,omh1280/cesium,denverpierce/cesium,likangning93/cesium,emackey/cesium,NaderCHASER/cesium,geoscan/cesium,kaktus40/cesium,kiselev-dv/cesium,jason-crow/cesium,AnimatedRNG/cesium,josh-bernstein/cesium,wallw-bits/cesium,AnimatedRNG/cesium,esraerik/cesium,kiselev-dv/cesium,esraerik/cesium,jason-crow/cesium,progsung/cesium,ggetz/cesium,ggetz/cesium,CesiumGS/cesium,likangning93/cesium,oterral/cesium,likangning93/cesium,jasonbeverage/cesium,YonatanKra/cesium,wallw-bits/cesium,oterral/cesium,aelatgt/cesium,omh1280/cesium,wallw-bits/cesium,CesiumGS/cesium,CesiumGS/cesium,progsung/cesium,likangning93/cesium,soceur/cesium,aelatgt/cesium,ggetz/cesium,hodbauer/cesium,jasonbeverage/cesium,geoscan/cesium,emackey/cesium,wallw-bits/cesium,josh-bernstein/cesium,AnalyticalGraphicsInc/cesium,CesiumGS/cesium,YonatanKra/cesium,AnimatedRNG/cesium,AnalyticalGraphicsInc/cesium,aelatgt/cesium,denverpierce/cesium,likangning93/cesium,emackey/cesium,ggetz/cesium,soceur/cesium,hodbauer/cesium,denverpierce/cesium,emackey/cesium,aelatgt/cesium,YonatanKra/cesium,hodbauer/cesium,omh1280/cesium,jason-crow/cesium,esraerik/cesium,NaderCHASER/cesium,oterral/cesium,denverpierce/cesium,YonatanKra/cesium
--- +++ @@ -6,6 +6,7 @@ load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/ var demos = []; +var output = attributes.get('output'); forEachFile('demos', function(relativePath, file) { "use strict"; @@ -16,7 +17,7 @@ date : file.lastModified() }; - if (new File(file.getParent(), demo + '.jpg').exists()) { + if (new File(new File(output).getParent(), demo + '.jpg').exists()) { demoObject.img = demo + '.jpg'; } @@ -27,4 +28,4 @@ // This file is automatically rebuilt by the Cesium build process.\n\ var gallery_demos = [' + demos.join(', ') + '];'; -writeFileContents(attributes.get('output'), contents); +writeFileContents(output, contents);
e0ada96ceab737926231ef0bc8cb40c4ee753fd4
examples/navigation/reducers/reposByUser.js
examples/navigation/reducers/reposByUser.js
import * as ActionTypes from '../ActionTypes'; export default function reposByUser(state = {}, action) { switch (action.type) { case ActionTypes.REQUESTED_USER_REPOS: return { ...state, [action.payload.user]: undefined }; case ActionTypes.RECEIVED_USER_REPOS: return { ...state, [action.payload.user]: action.payload.repos }; default: return state; } }
import * as ActionTypes from '../ActionTypes'; export default function reposByUser(state = {}, action) { switch (action.type) { case ActionTypes.REQUESTED_USER_REPOS: return Object.assign({}, state, { [action.payload.user]: undefined }); case ActionTypes.RECEIVED_USER_REPOS: return Object.assign({}, state, { [action.payload.user]: action.payload.repos }); default: return state; } }
Use Object.assign instead of object spread
chore(examples): Use Object.assign instead of object spread
JavaScript
mit
jesinity/redux-observable,jesinity/redux-observable,redux-observable/redux-observable,blesh/redux-observable,jesinity/redux-observable,redux-observable/redux-observable,blesh/redux-observable,redux-observable/redux-observable
--- +++ @@ -3,15 +3,13 @@ export default function reposByUser(state = {}, action) { switch (action.type) { case ActionTypes.REQUESTED_USER_REPOS: - return { - ...state, + return Object.assign({}, state, { [action.payload.user]: undefined - }; + }); case ActionTypes.RECEIVED_USER_REPOS: - return { - ...state, + return Object.assign({}, state, { [action.payload.user]: action.payload.repos - }; + }); default: return state; }
7af36c6a2875aeb49609149eaaed25b3c69ace03
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . // Toggles More Info / Hide Info on Experiment show page $(document).ready(function() { $('#reveal-info').on('click', function(event){ $('.reveal-down').slideToggle(200); $(this).text(function(i, text){ return text === "More Information" ? "Hide Information" : "More Information"; }) }) });
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . // Toggles More Info / Hide Info on Experiment $(document).ready(function() { $(document).on('click','#reveal-info', function(event){ $('.reveal-down').slideToggle(150); $(this).text(function(i, text){ return text === "More Information" ? "Hide Information" : "More Information"; }) }) });
Use event delegation for reveal button
Use event delegation for reveal button
JavaScript
mit
njarin/earp,njarin/earp,njarin/earp
--- +++ @@ -15,10 +15,10 @@ //= require turbolinks //= require_tree . -// Toggles More Info / Hide Info on Experiment show page +// Toggles More Info / Hide Info on Experiment $(document).ready(function() { - $('#reveal-info').on('click', function(event){ - $('.reveal-down').slideToggle(200); + $(document).on('click','#reveal-info', function(event){ + $('.reveal-down').slideToggle(150); $(this).text(function(i, text){ return text === "More Information" ? "Hide Information" : "More Information"; })
859ce78bbc41f14c233b700dd1836ac6fa5a553c
api/src/routes/data/cashflow/updateBalance.js
api/src/routes/data/cashflow/updateBalance.js
/** * Update cash flow data */ const { DateTime } = require('luxon'); const joi = require('joi'); const { balanceSchema } = require('../../../schema'); function updateQuery(db, user, value) { const { year, month, balance } = value; const date = DateTime.fromObject({ year, month }) .endOf('month') .toISODate(); return db.raw(` INSERT INTO balance (uid, date, value) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE uid = ?, value = ? `, [user.uid, date, balance, user.uid, balance]); } function updateData(config, db, post = true) { return async (req, res) => { const { error, value } = joi.validate(req.body, balanceSchema); if (error) { return res.status(400) .json({ errorMessage: error.message }); } await updateQuery(db, req.user, value); const statusCode = post ? 201 : 200; return res.status(statusCode) .json({ success: true }); }; } module.exports = { updateQuery, updateData };
/** * Update cash flow data */ const { DateTime } = require('luxon'); const joi = require('joi'); const { balanceSchema } = require('../../../schema'); function updateQuery(db, user, value) { const { year, month, balance } = value; const date = DateTime.fromObject({ year, month }) .endOf('month') .toISODate(); return db.transaction(async trx => { await trx('balance') .whereRaw('YEAR(balance.date) = ?', year) .whereRaw('MONTH(balance.date) = ?', month) .where({ uid: user.uid }) .del(); await trx.insert({ date, value: balance, uid: user.uid }) .into('balance'); }); } function updateData(config, db, post = true) { return async (req, res) => { const { error, value } = joi.validate(req.body, balanceSchema); if (error) { return res.status(400) .json({ errorMessage: error.message }); } await updateQuery(db, req.user, value); const statusCode = post ? 201 : 200; return res.status(statusCode) .json({ success: true }); }; } module.exports = { updateQuery, updateData };
Fix replacement of balance items based on month
Fix replacement of balance items based on month
JavaScript
mit
felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget,felamaslen/budget
--- +++ @@ -12,11 +12,16 @@ .endOf('month') .toISODate(); - return db.raw(` - INSERT INTO balance (uid, date, value) - VALUES (?, ?, ?) - ON DUPLICATE KEY UPDATE uid = ?, value = ? - `, [user.uid, date, balance, user.uid, balance]); + return db.transaction(async trx => { + await trx('balance') + .whereRaw('YEAR(balance.date) = ?', year) + .whereRaw('MONTH(balance.date) = ?', month) + .where({ uid: user.uid }) + .del(); + + await trx.insert({ date, value: balance, uid: user.uid }) + .into('balance'); + }); } function updateData(config, db, post = true) {
d3d6e597f017e3b31529dffa14810c4d5e1e8584
app/js/arethusa.sg/directives/sg_ancestors.js
app/js/arethusa.sg/directives/sg_ancestors.js
"use strict"; angular.module('arethusa.sg').directive('sgAncestors', [ 'sg', function(sg) { return { restrict: 'A', scope: { obj: '=sgAncestors' }, link: function(scope, element, attrs) { scope.requestGrammar = function(el) { if (el.sections) { sg.readerRequested = el; } }; scope.$watchCollection('obj.ancestors', function(newVal, oldVal) { scope.hierarchy = scope.obj.definingAttrs.concat(newVal); }); }, templateUrl: './templates/arethusa.sg/ancestors.html' }; } ]);
"use strict"; angular.module('arethusa.sg').directive('sgAncestors', [ 'sg', function(sg) { return { restrict: 'A', scope: { obj: '=sgAncestors' }, link: function(scope, element, attrs) { scope.requestGrammar = function(el) { if (el.sections) { if (sg.readerRequested === el) { sg.readerRequested = false; } else { sg.readerRequested = el; } } }; scope.$watchCollection('obj.ancestors', function(newVal, oldVal) { scope.hierarchy = scope.obj.definingAttrs.concat(newVal); }); }, templateUrl: './templates/arethusa.sg/ancestors.html' }; } ]);
Make sg label clicking act like a toggle
Make sg label clicking act like a toggle
JavaScript
mit
Masoumeh/arethusa,PonteIneptique/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,latin-language-toolkit/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,PonteIneptique/arethusa
--- +++ @@ -11,7 +11,11 @@ link: function(scope, element, attrs) { scope.requestGrammar = function(el) { if (el.sections) { - sg.readerRequested = el; + if (sg.readerRequested === el) { + sg.readerRequested = false; + } else { + sg.readerRequested = el; + } } };
36c1441fc5fb4e4beb6130d4c1567c8e484f7517
webpack.generate.umd.config.js
webpack.generate.umd.config.js
'use strict'; var webpack = require('webpack'); var kitchensinkExternals = { root: 'Kitchensink', commonjs2: 'kitchensink', commonjs: 'kitchensink', amd: 'kitchensink' }; module.exports = { externals: { 'kitchensink': kitchensinkExternals }, module: { loaders: [ { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }, { test: /\.jsx$/, loaders: ['babel-loader'], exclude: /node_modules/ } ] }, output: { library: 'Kitchensink', libraryTarget: 'umd', }, resolve: { extensions: ['', '.js', '.jsx'] } };
'use strict'; var webpack = require('webpack'); var kitchensinkExternals = { root: 'Kitchensink', commonjs2: 'kitchensink', commonjs: 'kitchensink', amd: 'kitchensink' }; module.exports = { externals: { 'kitchensink': kitchensinkExternals }, module: { loaders: [ { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }, { test: /\.jsx$/, loaders: ['babel-loader'], exclude: /node_modules/ }, { test: /\.css$/, loaders: ['css-loader'], exclude: /node_modules/ }, ] }, output: { library: 'Kitchensink', libraryTarget: 'umd', }, resolve: { extensions: ['', '.js', '.jsx'] } };
Update umd bundle to use css loader for css files
Update umd bundle to use css loader for css files
JavaScript
mit
DispatchMe/kitchen
--- +++ @@ -16,7 +16,8 @@ module: { loaders: [ { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }, - { test: /\.jsx$/, loaders: ['babel-loader'], exclude: /node_modules/ } + { test: /\.jsx$/, loaders: ['babel-loader'], exclude: /node_modules/ }, + { test: /\.css$/, loaders: ['css-loader'], exclude: /node_modules/ }, ] }, output: {
e307faf42079076b9f4be177e21fb73214a25866
lib/fiber-utils.js
lib/fiber-utils.js
var Fiber = require('fibers'); var Future = require('fibers/future'); var _ = require('underscore'); var assert = require('assert'); // Makes a function that returns a promise or takes a callback synchronous exports.wrapAsync = function (fn, context) { return function (/* arguments */) { var self = context || this; var newArgs = _.toArray(arguments); var callback; for (var i = newArgs.length - 1; i >= 0; --i) { var arg = newArgs[i]; var type = typeof arg; if (type !== "undefined") { if (type === "function") { callback = arg; } break; } } if (!callback) { var future = new Future(); callback = future.resolver(); ++i; // Insert the callback just after arg. } newArgs[i] = callback; var result = fn.apply(self, newArgs); return future ? future.wait() : result; }; };
var Fiber = require('fibers'); var Future = require('fibers/future'); var _ = require('underscore'); var assert = require('assert'); // Makes a function that returns a promise or takes a callback synchronous exports.wrapAsync = function (fn, context) { return function (/* arguments */) { var self = context || this; var newArgs = _.toArray(arguments); var callback; for (var i = newArgs.length - 1; i >= 0; --i) { var arg = newArgs[i]; var type = typeof arg; if (type !== "undefined") { if (type === "function") { callback = arg; } break; } } if (!callback) { var future = new Future(); callback = _.once(future.resolver()); ++i; // Insert the callback just after arg. } newArgs[i] = callback; var result = fn.apply(self, newArgs); if (result && _.isFunction(result.then)) { result.then( function (result) { callback(null, result); }, function (error) { callback(error); } ); } return future ? future.wait() : result; }; };
Make wrapAsync support wrapping async functions that return a promise
Make wrapAsync support wrapping async functions that return a promise
JavaScript
mit
boom-fantasy/chimp,intron/chimp,boom-fantasy/chimp,intron/chimp
--- +++ @@ -23,12 +23,22 @@ if (!callback) { var future = new Future(); - callback = future.resolver(); + callback = _.once(future.resolver()); ++i; // Insert the callback just after arg. } newArgs[i] = callback; var result = fn.apply(self, newArgs); + if (result && _.isFunction(result.then)) { + result.then( + function (result) { + callback(null, result); + }, + function (error) { + callback(error); + } + ); + } return future ? future.wait() : result; }; };
0a290abdfe42e4a80c676294f21d8f1f4f73f8a2
test/end-to-end/health.spec.js
test/end-to-end/health.spec.js
describe('/health', () => { it('displays the health status of the app', () => { browser.url('/health'); expect(browser.getText('body')).contain('"staatus":"OK"'); }); });
describe('/health', () => { it('displays the health status of the app', () => { browser.url('/health'); expect(browser.getText('body')).contain('"status":"OK"'); }); });
Fix broken tests to restore green build
CSRA-000: Fix broken tests to restore green build
JavaScript
mit
noms-digital-studio/csra-app,noms-digital-studio/csra-app,noms-digital-studio/csra-app
--- +++ @@ -1,6 +1,6 @@ describe('/health', () => { it('displays the health status of the app', () => { browser.url('/health'); - expect(browser.getText('body')).contain('"staatus":"OK"'); + expect(browser.getText('body')).contain('"status":"OK"'); }); });
92cdfc7c3656c760488c2f79fe6621b7da8f5e9c
examples/play_soundfile/sketch.js
examples/play_soundfile/sketch.js
// ==================== // DEMO: play a sound at a random speed/pitch when the ball hits the edge // ==================== // create a variable for the sound file var soundFile; function setup() { createCanvas(400, 400); background(0); // create a SoundFile soundFile = loadSound( ['../_files/beatbox.ogg', '../_files/beatbox.mp3'] ); createP('Press any key to play the sound'); } // when a key is pressed... function keyPressed() { // play the sound file soundFile.play(1,1); // also make the background yellow background(255, 255, 0); } function keyReleased() { // make the background black again when the key is released background(0); }
// ==================== // DEMO: play a sound when the user presses a key // ==================== // create a variable for the sound file var soundFile; function setup() { createCanvas(400, 400); background(0); // create a SoundFile soundFile = loadSound( ['../_files/beatbox.ogg', '../_files/beatbox.mp3'] ); createP('Press any key to play the sound'); } // when a key is pressed... function keyPressed() { // play the sound file soundFile.play(1,1); // also make the background yellow background(255, 255, 0); } function keyReleased() { // make the background black again when the key is released background(0); }
Fix top description. Probably copied from another file.
Fix top description. Probably copied from another file.
JavaScript
mit
polyrhythmatic/p5.js-sound,therewasaguy/p5.js-sound,chelliah/p5.js-sound,processing/p5.js-sound,chelliah/p5.js-sound,therewasaguy/p5.js-sound,polyrhythmatic/p5.js-sound,processing/p5.js-sound
--- +++ @@ -1,5 +1,5 @@ // ==================== -// DEMO: play a sound at a random speed/pitch when the ball hits the edge +// DEMO: play a sound when the user presses a key // ==================== // create a variable for the sound file
d54a0ab97ee7c4cbe5952d4a0d4edd9cd5464a72
panthrMath/polynomial.js
panthrMath/polynomial.js
(function(define) {'use strict'; define(function(require) { // creates a polynomial function from the array of coefficients // for example, if the function is ax^3 + bx^2 + cx + d // the array is [a, b, c, d], that is, the array indexing is // the reverse of the usual coefficient indexing function Polynomial(coefs) { if (coefs instanceof Polynomial) { return coefs; } this.coefs = coefs; } Polynomial.prototype.evalAt = function evalAt(x) { return this.coefs.reduce(function(acc, coef) { return acc * x + coef; }, 0); }; return Polynomial; }); }(typeof define === 'function' && define.amd ? define : function(factory) { 'use strict'; module.exports = factory(require); }));
(function(define) {'use strict'; define(function(require) { // creates a polynomial function from the array of coefficients // for example, if the function is ax^3 + bx^2 + cx + d // the array is [a, b, c, d], that is, the array indexing is // the reverse of the usual coefficient indexing function Polynomial(coefs) { if (coefs instanceof Polynomial) { return coefs; } this.coefs = coefs; } Polynomial.new = function(coefs) { return new Polynomial(coefs); }; Polynomial.prototype.evalAt = function evalAt(x) { return this.coefs.reduce(function(acc, coef) { return acc * x + coef; }, 0); }; return Polynomial; }); }(typeof define === 'function' && define.amd ? define : function(factory) { 'use strict'; module.exports = factory(require); }));
Add "new" constructor wrapper to Polynomial.
Add "new" constructor wrapper to Polynomial.
JavaScript
mit
PanthR/panthrMath,PanthR/panthrMath
--- +++ @@ -9,6 +9,10 @@ if (coefs instanceof Polynomial) { return coefs; } this.coefs = coefs; } + + Polynomial.new = function(coefs) { + return new Polynomial(coefs); + }; Polynomial.prototype.evalAt = function evalAt(x) { return this.coefs.reduce(function(acc, coef) {
b51782f687e45449841d310c5727481dab31853e
src/about/about.js
src/about/about.js
// about.js "use strict"; import { welcome } from "../welcome/welcome"; if (NODE_ENV == DEV_ENV) { welcome("about"); console.log(NODE_ENV); } export { welcome };
// about.js "use strict"; import { welcome } from "../welcome/welcome"; if (NODE_ENV == DEV_ENV) { welcome("about"); console.log(NODE_ENV); } $.when( $.ready ).then(function() { let $jqButton = $("#testJQuery"); function testJQueryHandler(e) { e.preventDefault(); let $listItems = $("ul > li"); alert($listItems); console.log($listItems); } $jqButton.on("click", testJQueryHandler); }); export { welcome };
Add code for jquery test
Add code for jquery test
JavaScript
mit
var-bin/webpack-training,var-bin/webpack-training,var-bin/webpack-training,var-bin/webpack-training
--- +++ @@ -9,4 +9,20 @@ console.log(NODE_ENV); } +$.when( $.ready ).then(function() { + let $jqButton = $("#testJQuery"); + + function testJQueryHandler(e) { + e.preventDefault(); + + let $listItems = $("ul > li"); + + alert($listItems); + + console.log($listItems); + } + + $jqButton.on("click", testJQueryHandler); +}); + export { welcome };
d2770b64828741f5cb6234e838238cd1fa8cc7d4
extensions/php/build/update-grammar.js
extensions/php/build/update-grammar.js
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; var updateGrammar = require('../../../build/npm/update-grammar'); function adaptInjectionScope(grammar) { // we're using the HTML grammar from https://github.com/textmate/html.tmbundle which has moved away from source.js.embedded.html let oldInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:source.js.embedded.html"; let newInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:text.html.php source.js"; var injections = grammar.injections; var injection = injections[oldInjectionKey]; if (!injections) { throw "Can not find PHP injection"; } delete injections[oldInjectionKey]; injections[newInjectionKey] = injection; } updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', adaptInjectionScope);
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; var updateGrammar = require('../../../build/npm/update-grammar'); function adaptInjectionScope(grammar) { // we're using the HTML grammar from https://github.com/textmate/html.tmbundle which has moved away from source.js.embedded.html let oldInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:source.js.embedded.html"; let newInjectionKey = "text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:text.html.php source.js"; var injections = grammar.injections; var injection = injections[oldInjectionKey]; if (!injections) { throw new Error("Can not find PHP injection"); } delete injections[oldInjectionKey]; injections[newInjectionKey] = injection; } updateGrammar.update('atom/language-php', 'grammars/php.cson', './syntaxes/php.tmLanguage.json', adaptInjectionScope);
Fix all string throw statements
Fix all string throw statements
JavaScript
mit
eamodio/vscode,DustinCampbell/vscode,cleidigh/vscode,gagangupt16/vscode,rishii7/vscode,microsoft/vscode,KattMingMing/vscode,gagangupt16/vscode,0xmohit/vscode,gagangupt16/vscode,mjbvz/vscode,Microsoft/vscode,hoovercj/vscode,mjbvz/vscode,KattMingMing/vscode,the-ress/vscode,the-ress/vscode,hoovercj/vscode,microsoft/vscode,the-ress/vscode,Zalastax/vscode,microsoft/vscode,eamodio/vscode,Zalastax/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,rishii7/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,DustinCampbell/vscode,0xmohit/vscode,KattMingMing/vscode,hoovercj/vscode,microlv/vscode,0xmohit/vscode,cleidigh/vscode,microlv/vscode,landonepps/vscode,eamodio/vscode,rishii7/vscode,rishii7/vscode,KattMingMing/vscode,microsoft/vscode,gagangupt16/vscode,microlv/vscode,stringham/vscode,microlv/vscode,cleidigh/vscode,stringham/vscode,joaomoreno/vscode,cleidigh/vscode,Zalastax/vscode,gagangupt16/vscode,DustinCampbell/vscode,the-ress/vscode,rishii7/vscode,microsoft/vscode,microsoft/vscode,veeramarni/vscode,mjbvz/vscode,Zalastax/vscode,0xmohit/vscode,rishii7/vscode,cleidigh/vscode,DustinCampbell/vscode,mjbvz/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,veeramarni/vscode,landonepps/vscode,gagangupt16/vscode,gagangupt16/vscode,Krzysztof-Cieslak/vscode,cra0zy/VSCode,mjbvz/vscode,KattMingMing/vscode,microsoft/vscode,hoovercj/vscode,the-ress/vscode,Microsoft/vscode,Microsoft/vscode,Zalastax/vscode,joaomoreno/vscode,eamodio/vscode,landonepps/vscode,stringham/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,mjbvz/vscode,landonepps/vscode,the-ress/vscode,stringham/vscode,the-ress/vscode,joaomoreno/vscode,landonepps/vscode,eamodio/vscode,veeramarni/vscode,veeramarni/vscode,veeramarni/vscode,cleidigh/vscode,microlv/vscode,stringham/vscode,hoovercj/vscode,gagangupt16/vscode,hoovercj/vscode,microlv/vscode,veeramarni/vscode,microlv/vscode,microsoft/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,stringham/vscode,eamodio/vscode,mjbvz/vscode,landonepps/vscode,KattMingMing/vscode,microlv/vscode,KattMingMing/vscode,mjbvz/vscode,gagangupt16/vscode,stringham/vscode,cleidigh/vscode,stringham/vscode,Microsoft/vscode,landonepps/vscode,landonepps/vscode,cleidigh/vscode,Zalastax/vscode,Microsoft/vscode,0xmohit/vscode,landonepps/vscode,Microsoft/vscode,Zalastax/vscode,hoovercj/vscode,hoovercj/vscode,veeramarni/vscode,gagangupt16/vscode,DustinCampbell/vscode,microsoft/vscode,rishii7/vscode,rishii7/vscode,Microsoft/vscode,Microsoft/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,Zalastax/vscode,mjbvz/vscode,veeramarni/vscode,rishii7/vscode,mjbvz/vscode,mjbvz/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,stringham/vscode,Microsoft/vscode,veeramarni/vscode,microlv/vscode,0xmohit/vscode,DustinCampbell/vscode,mjbvz/vscode,KattMingMing/vscode,cleidigh/vscode,the-ress/vscode,rishii7/vscode,joaomoreno/vscode,mjbvz/vscode,KattMingMing/vscode,veeramarni/vscode,landonepps/vscode,rishii7/vscode,stringham/vscode,stringham/vscode,microsoft/vscode,rishii7/vscode,gagangupt16/vscode,cleidigh/vscode,joaomoreno/vscode,landonepps/vscode,Microsoft/vscode,veeramarni/vscode,Zalastax/vscode,Zalastax/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,cleidigh/vscode,hoovercj/vscode,Microsoft/vscode,0xmohit/vscode,gagangupt16/vscode,veeramarni/vscode,hoovercj/vscode,cleidigh/vscode,the-ress/vscode,rishii7/vscode,Microsoft/vscode,rishii7/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,0xmohit/vscode,joaomoreno/vscode,the-ress/vscode,joaomoreno/vscode,microsoft/vscode,landonepps/vscode,KattMingMing/vscode,Zalastax/vscode,stringham/vscode,joaomoreno/vscode,KattMingMing/vscode,0xmohit/vscode,cleidigh/vscode,gagangupt16/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,mjbvz/vscode,KattMingMing/vscode,the-ress/vscode,rishii7/vscode,microlv/vscode,veeramarni/vscode,landonepps/vscode,mjbvz/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,0xmohit/vscode,hoovercj/vscode,eamodio/vscode,Microsoft/vscode,landonepps/vscode,veeramarni/vscode,0xmohit/vscode,eamodio/vscode,stringham/vscode,veeramarni/vscode,veeramarni/vscode,eamodio/vscode,landonepps/vscode,0xmohit/vscode,0xmohit/vscode,gagangupt16/vscode,the-ress/vscode,KattMingMing/vscode,0xmohit/vscode,microsoft/vscode,microsoft/vscode,microlv/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,cleidigh/vscode,eamodio/vscode,DustinCampbell/vscode,gagangupt16/vscode,joaomoreno/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,joaomoreno/vscode,KattMingMing/vscode,rishii7/vscode,cleidigh/vscode,Zalastax/vscode,microlv/vscode,microsoft/vscode,stringham/vscode,hoovercj/vscode,joaomoreno/vscode,mjbvz/vscode,hoovercj/vscode,veeramarni/vscode,gagangupt16/vscode,microlv/vscode,Microsoft/vscode,DustinCampbell/vscode,the-ress/vscode,microlv/vscode,stringham/vscode,joaomoreno/vscode,the-ress/vscode,KattMingMing/vscode,0xmohit/vscode,the-ress/vscode,DustinCampbell/vscode,stringham/vscode,eamodio/vscode,Zalastax/vscode,eamodio/vscode,microsoft/vscode,Zalastax/vscode,stringham/vscode,DustinCampbell/vscode,microlv/vscode,rishii7/vscode,joaomoreno/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,gagangupt16/vscode,cleidigh/vscode,Zalastax/vscode,KattMingMing/vscode,microsoft/vscode,mjbvz/vscode,eamodio/vscode,0xmohit/vscode,Microsoft/vscode,Zalastax/vscode,DustinCampbell/vscode,cleidigh/vscode,0xmohit/vscode,Zalastax/vscode,DustinCampbell/vscode,landonepps/vscode,hoovercj/vscode,eamodio/vscode,microlv/vscode,microlv/vscode,joaomoreno/vscode,DustinCampbell/vscode,eamodio/vscode
--- +++ @@ -14,7 +14,7 @@ var injections = grammar.injections; var injection = injections[oldInjectionKey]; if (!injections) { - throw "Can not find PHP injection"; + throw new Error("Can not find PHP injection"); } delete injections[oldInjectionKey]; injections[newInjectionKey] = injection;
801f00141ccd1f1a2314566a6778ce45fc2cf83f
src/stores/GeoObjectsStore.js
src/stores/GeoObjectsStore.js
'use strict'; var AbstractStore = require('stores/AbstractStore'); var assign = require('object-assign'); var GeoAppDispatcher = require('../dispatcher/GeoAppDispatcher'); var GeoAppActionsConstants = require('constants/GeoAppActions'); var LocalStoreDataProvider = require('stores/LocalStorageDataProvider'); var GeoObjectsStore = assign({}, AbstractStore, { /** * Get all objects from store * @returns {*} */ getAllGeoObjects: function () { return LocalStoreDataProvider.read(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION); } }); GeoObjectsStore.dispatchToken = GeoAppDispatcher.register(function (action) { switch (action.actionType) { case GeoAppActionsConstants.GEO_OBJECTS_CREATE: LocalStoreDataProvider.addCollectionItem(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION, action.rawData); GeoObjectsStore.emitChange(); break; default: } }); module.exports = GeoObjectsStore;
'use strict'; var AbstractStore = require('stores/AbstractStore'); var assign = require('object-assign'); var GeoAppDispatcher = require('../dispatcher/GeoAppDispatcher'); var GeoAppActionsConstants = require('constants/GeoAppActions'); var LocalStoreDataProvider = require('stores/LocalStorageDataProvider'); var GeoObjectsStore = assign({}, AbstractStore, { /** * Get all objects from store * @returns {*} */ getAllGeoObjects: function () { return LocalStoreDataProvider.read(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION); } }); GeoObjectsStore.dispatchToken = GeoAppDispatcher.register(function (action) { switch (action.actionType) { case GeoAppActionsConstants.GEO_OBJECTS_CREATE: LocalStoreDataProvider.addCollectionItem(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION, action.rawData); GeoObjectsStore.emitChange(); break; case GeoAppActionsConstants.GEO_OBJECTS_DELETE: LocalStoreDataProvider.deleteCollectionItem(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION, action.rawData); GeoObjectsStore.emitChange(); break; default: } }); module.exports = GeoObjectsStore;
Remove object from local storage hook
Remove object from local storage hook
JavaScript
apache-2.0
NVBespalov/Geo,NVBespalov/Geo
--- +++ @@ -22,6 +22,10 @@ LocalStoreDataProvider.addCollectionItem(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION, action.rawData); GeoObjectsStore.emitChange(); break; + case GeoAppActionsConstants.GEO_OBJECTS_DELETE: + LocalStoreDataProvider.deleteCollectionItem(GeoAppActionsConstants.GEO_OBJECTS_COLLECTION, action.rawData); + GeoObjectsStore.emitChange(); + break; default: }
74ea5c4200e3fd8fde5a8ccb310f526a08591baf
routes.js
routes.js
var Backbone = require('backbone'); var $ = require('jquey'); Backbone.$ = $; module.exports = function(app) { // app.get('/', function(req, res) { // res.send('Hello, world!'); // }); };
'use strict'; var YelpAPI = require('./lib/yelp-api'); var yelpAPI = new YelpAPI({ // To do: un-hard-code keys for Heroku consumerKey: 'LF09pfePJ5IAB7MYcnRkaQ', consumerSecret: '8QABPQRA-VZpVtCk6gXmPc-rojg', token: 'dPrd7L96SseVYeQGvoyVtf1Dy9n3mmrT', tokenSecret: 'W9Br5z5nKGHkScKBik9XljJEAoE', }); module.exports = function(app) { var api = '/api/0_0_1'; app.get(api, function(req, res) { var location = req.searchLocation || 'Seattle'; var params = req.params || {}; yelpAPI.searchLocation(location, params, function(err, data) { return res.status(200).json(data); }); }); };
Add API endpoint for Yelp queries
Add API endpoint for Yelp queries
JavaScript
mit
Localhost3000/along-the-way
--- +++ @@ -1,10 +1,23 @@ -var Backbone = require('backbone'); -var $ = require('jquey'); -Backbone.$ = $; +'use strict'; +var YelpAPI = require('./lib/yelp-api'); +var yelpAPI = new YelpAPI({ + // To do: un-hard-code keys for Heroku + consumerKey: 'LF09pfePJ5IAB7MYcnRkaQ', + consumerSecret: '8QABPQRA-VZpVtCk6gXmPc-rojg', + token: 'dPrd7L96SseVYeQGvoyVtf1Dy9n3mmrT', + tokenSecret: 'W9Br5z5nKGHkScKBik9XljJEAoE', +}); module.exports = function(app) { - // app.get('/', function(req, res) { - // res.send('Hello, world!'); - // }); + + var api = '/api/0_0_1'; + + app.get(api, function(req, res) { + var location = req.searchLocation || 'Seattle'; + var params = req.params || {}; + yelpAPI.searchLocation(location, params, function(err, data) { + return res.status(200).json(data); + }); + }); };
0cc1f93997d3d0789f52671cc161318badf11040
javascript/generator/test/summarizer.js
javascript/generator/test/summarizer.js
(function () { 'use strict'; var assert = require('assert'); var _ = require('underscore'); var summarizer = require('../src/summarizer'); var sha1 = require('../src/sha1'); var utils = require('./utils_typedarrays'); function assertThatSetOfArrayEquals(arr1, arr2) { assert.equal(arr1.lenght, arr2.lenght); assert.ok(_(arr1).every(function (item1) { return _(arr2).some(function (item2) { return utils.isEqual(item1, item2); }); })); } function testSummarizer(builder) { it('generate summary with input items', function(done) { function serialize(value) { return new Int8Array(value).buffer; } builder([[1, 2], [2, 2], [3, 2]], serialize)(5).then(function (summary) { var diff = summary._asDifference(); assertThatSetOfArrayEquals(diff.added, [[1, 2], [2, 2], [3, 2]]); assert.equal(0, diff.removed.length); done(); }, function (err) { done(err); }); }); } describe('Summarizer', function() { describe('fromGenerator', function() { testSummarizer(function (array, serialize) { function* generator() { for (var i = 0; i < array.length; i++) { yield array[i]; } } return summarizer.fromGenerator(generator, serialize, sha1, 4); }); }); }); })();
(function () { 'use strict'; var assert = require('assert'); var _ = require('underscore'); var summarizer = require('../src/summarizer'); var sha1 = require('mathsync/src/sha1'); var utils = require('./utils_typedarrays'); function assertThatSetOfArrayEquals(arr1, arr2) { assert.equal(arr1.lenght, arr2.lenght); assert.ok(_(arr1).every(function (item1) { return _(arr2).some(function (item2) { return utils.isEqual(item1, item2); }); })); } function testSummarizer(builder) { it('generate summary with input items', function(done) { function serialize(value) { return new Int8Array(value).buffer; } builder([[1, 2], [2, 2], [3, 2]], serialize)(5).then(function (summary) { var diff = summary._asDifference(); assertThatSetOfArrayEquals(diff.added, [[1, 2], [2, 2], [3, 2]]); assert.equal(0, diff.removed.length); done(); }, function (err) { done(err); }); }); } describe('Summarizer', function() { describe('fromGenerator', function() { testSummarizer(function (array, serialize) { function* generator() { for (var i = 0; i < array.length; i++) { yield array[i]; } } return summarizer.fromGenerator(generator, serialize, sha1, 4); }); }); }); })();
Use sha1 module from core in generator package
Use sha1 module from core in generator package
JavaScript
apache-2.0
3musket33rs/mathsync,3musket33rs/mathsync,3musket33rs/mathsync
--- +++ @@ -4,7 +4,7 @@ var assert = require('assert'); var _ = require('underscore'); var summarizer = require('../src/summarizer'); - var sha1 = require('../src/sha1'); + var sha1 = require('mathsync/src/sha1'); var utils = require('./utils_typedarrays'); function assertThatSetOfArrayEquals(arr1, arr2) {
54bc8ccb16e3f9578ccbbf937d2b6097504bd7ca
src/web/helpers/serveBuild.js
src/web/helpers/serveBuild.js
const path = require('path'); const mime = require('mime'); function serveBuild(registry) { return async function(req, res, next) { const username = req.user && req.user.username; const branchId = await registry.models.user.getBranch(username); const {bucketId, overlays} = await registry.models.branch.getLatestBuild(branchId); const filePath = req.path.replace(/^\//, ''); const filePathSegments = filePath.split('/'); let relevantBucketId = bucketId; let relevantFilePath = filePath; if (filePathSegments.length && overlays[filePathSegments[0]]) { relevantBucketId = overlays[filePathSegments[0]]; relevantFilePath = filePathSegments.slice(1).join('/'); } const file = await registry.models.bucket.get(relevantBucketId, relevantFilePath); if (file === null) { next(); return; } res.set('ETag', file.digest); res.set('Content-Type', mime.lookup(filePath)); res.send(file.buffer); } } module.exports = serveBuild;
const path = require('path'); const mime = require('mime'); function serveBuild(registry) { return async function(req, res, next) { const username = req.user && req.user.username; const branchId = await registry.models.user.getBranch(username); const {bucketId, overlays} = await registry.models.branch.getLatestBuild(branchId); const filePath = req.path.replace(/^\//, ''); const filePathSegments = filePath.split('/').reduce((valid, seg) => { return seg.length > 0 ? valid.concat(seg) : valid; }, []); let relevantBucketId = bucketId; let relevantFilePath = filePathSegments.join('/'); if (filePathSegments.length && overlays[filePathSegments[0]]) { relevantBucketId = overlays[filePathSegments[0]]; relevantFilePath = filePathSegments.slice(1).join('/'); } const file = await registry.models.bucket.get(relevantBucketId, relevantFilePath); if (file === null) { next(); return; } res.set('ETag', file.digest); res.set('Content-Type', mime.lookup(filePath)); res.send(file.buffer); } } module.exports = serveBuild;
Make sure that we normalize paths.
Make sure that we normalize paths.
JavaScript
mpl-2.0
hellojwilde/gossamer-server
--- +++ @@ -8,10 +8,12 @@ const {bucketId, overlays} = await registry.models.branch.getLatestBuild(branchId); const filePath = req.path.replace(/^\//, ''); - const filePathSegments = filePath.split('/'); + const filePathSegments = filePath.split('/').reduce((valid, seg) => { + return seg.length > 0 ? valid.concat(seg) : valid; + }, []); let relevantBucketId = bucketId; - let relevantFilePath = filePath; + let relevantFilePath = filePathSegments.join('/'); if (filePathSegments.length && overlays[filePathSegments[0]]) { relevantBucketId = overlays[filePathSegments[0]];
60758057ddffc61b4cf215581f7cbb94ff1bba77
client/js/controllers/photo-stream-controller.js
client/js/controllers/photo-stream-controller.js
"use strict"; var PhotoStreamController = function($scope, $http, $log, $timeout, analytics, resourceCache) { $http({method: "GET", url: "/api/v1/hikes?fields=distance,locality,name,photo_facts,photo_preview,string_id", cache: resourceCache}). success(function(data, status, headers, config) { var hikes = jQuery.grep(data, function(hike){ // Quick and dirty way of checking whether the entry is good enough to show on the /discover page, // Maybe want them to go through a curation process some day. return hike.photo_landscape && hike.photo_facts && hike.description && hike.description.length > 200; }); $scope.hikes = hikes; }). error(function(data, status, headers, config) { $log.error(config); }); $scope.hikes = []; $scope.htmlReady(); }; PhotoStreamController.$inject = ["$scope", "$http", "$log", "$timeout", "analytics", "resourceCache"];
"use strict"; var PhotoStreamController = function($scope, $http, $log, $timeout, analytics, resourceCache) { $http({method: "GET", url: "/api/v1/hikes?fields=distance,locality,name,photo_facts,photo_preview,string_id", cache: resourceCache}). success(function(data, status, headers, config) { // Only show the hikes that have photo previews or facts photo, which is a backup option var hikes = jQuery.grep(data, function(hike){ return hike.photo_preview || hike.photo_facts; }); $scope.hikes = hikes; }). error(function(data, status, headers, config) { $log.error(config); }); $scope.hikes = []; $scope.htmlReady(); }; PhotoStreamController.$inject = ["$scope", "$http", "$log", "$timeout", "analytics", "resourceCache"];
Undo changes to /discover page.
Undo changes to /discover page.
JavaScript
mit
zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io
--- +++ @@ -3,10 +3,9 @@ $http({method: "GET", url: "/api/v1/hikes?fields=distance,locality,name,photo_facts,photo_preview,string_id", cache: resourceCache}). success(function(data, status, headers, config) { + // Only show the hikes that have photo previews or facts photo, which is a backup option var hikes = jQuery.grep(data, function(hike){ - // Quick and dirty way of checking whether the entry is good enough to show on the /discover page, - // Maybe want them to go through a curation process some day. - return hike.photo_landscape && hike.photo_facts && hike.description && hike.description.length > 200; + return hike.photo_preview || hike.photo_facts; }); $scope.hikes = hikes; }).
cb5eed88e490fe90881be7310caaf0593f99aa8f
server.js
server.js
var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var config = require('./webpack.config'); var port = process.env.PORT || 3000; new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, hot: true, historyApiFallback: true }).listen(port, 'localhost', function (err, result) { if (err) { console.log(err); } console.log('Listening at localhost:' + port); });
var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var config = require('./webpack.config'); var port = process.env.PORT || 3000; new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, hot: true, historyApiFallback: true }).listen(port, function (err, result) { if (err) { console.log(err); } console.log('Listening at localhost:' + port); });
Allow to bind to any port
Allow to bind to any port
JavaScript
mit
macilry/technozaure-graphql,jjbohn/graphql-blog-schema,abdulhannanali/graphql-sandbox,kadirahq/graphql-blog-schema,macilry/technozaure-graphql,kadirahq/graphql-blog-schema,jjbohn/graphql-blog-schema,kadirahq/graphql-blog-schema,macilry/technozaure-graphql,jjbohn/graphql-blog-schema,abdulhannanali/graphql-sandbox,abdulhannanali/graphql-sandbox
--- +++ @@ -7,7 +7,7 @@ publicPath: config.output.publicPath, hot: true, historyApiFallback: true -}).listen(port, 'localhost', function (err, result) { +}).listen(port, function (err, result) { if (err) { console.log(err); }
b267607732ba521ec771152a5a07ec73f7174dfc
weighthub/actionhandlers/calibrateHandler.js
weighthub/actionhandlers/calibrateHandler.js
const quantize = require('../quantizer'); const TARGETS = ['zero', 'full', 'empty']; function calibrate(weightsRef, sensorsRef, action) { const {id, target} = action; let valRef = sensorsRef.child(id + '/value'); let weightRef = weightsRef.child(id); if(TARGETS.includes(target)) { weightRef.once('value', weightSnap => { const current = weightSnap.val().current; console.log('Calibrating ' + id + ' ' + target + ' as: ' + current); weightRef.child(target).set(current); }); } else { console.log('Unknown calibration target: ' + target); } } module.exports = calibrate;
const quantize = require('../quantizer'); const TARGETS = ['zero', 'full', 'empty']; function calibrate(weightsRef, sensorsRef, action) { const {id, target} = action; let valRef = sensorsRef.child(id + '/value'); let weightRef = weightsRef.child(id); if(TARGETS.includes(target)) { weightRef.once('value', weightSnap => { const current = weightSnap.val().current; console.log('Calibrating ' + id + ' ' + target + ' as: ' + current); if (current) { weightRef.child(target).set(current); } }); } else { console.log('Unknown calibration target: ' + target); } } module.exports = calibrate;
Fix calibration to not crash on undefined
Fix calibration to not crash on undefined
JavaScript
mit
mapster/WeightyBeer,mapster/WeightyBeer,mapster/WeightyBeer,mapster/WeightyBeer
--- +++ @@ -10,7 +10,9 @@ weightRef.once('value', weightSnap => { const current = weightSnap.val().current; console.log('Calibrating ' + id + ' ' + target + ' as: ' + current); - weightRef.child(target).set(current); + if (current) { + weightRef.child(target).set(current); + } }); } else { console.log('Unknown calibration target: ' + target);
67c28b05e87e0f42c4f2e0c65ab4198eb0ada620
public/js/models/model.search.js
public/js/models/model.search.js
(function (window){ requirejs([ 'underscore', 'backbone', 'BB' ], function(_, Backbone, BB) { BB.model_definitions.search = Backbone.Model.extend({ defaults: {}, initialize: function(){ if(BB.bootstrapped.filters4){ this.set(BB.bootstrapped.filters); } else { var model = this; $.ajax({ url: '/search', dataType: 'json', contentType : 'application/json', success: function(data){ model.set(data); } }); } }, url: '/api/search' }); }); })(window);
(function (window){ requirejs([ 'underscore', 'backbone', 'BB' ], function(_, Backbone, BB) { BB.model_definitions.search = Backbone.Model.extend({ defaults: {}, initialize: function(){ if(BB.bootstrapped.filters){ this.set(BB.bootstrapped.filters); } else { var model = this; $.ajax({ url: '/search', dataType: 'json', contentType : 'application/json', success: function(data){ model.set(data); } }); } }, url: '/api/search' }); }); })(window);
Fix accidental typo that snuck in
Fix accidental typo that snuck in
JavaScript
mit
EnzoMartin/Steam-Backbone-Storefront
--- +++ @@ -8,7 +8,7 @@ defaults: {}, initialize: function(){ - if(BB.bootstrapped.filters4){ + if(BB.bootstrapped.filters){ this.set(BB.bootstrapped.filters); } else { var model = this;
11d0d52d38b68978e2c1838f7ea032bf5f4fe337
internals/testing/test-bundler.js
internals/testing/test-bundler.js
// needed for regenerator-runtime // (ES7 generator support is required by redux-saga) import 'babel-polyfill'; import sinon from 'sinon'; import chai from 'chai'; import chaiEnzyme from 'chai-enzyme'; chai.use(chaiEnzyme()); global.chai = chai; global.sinon = sinon; global.expect = chai.expect; global.should = chai.should(); // Include all .js files under `app`, except app.js, reducers.js, routes.js and // store.js. This is for isparta code coverage const context = require.context('../../app', true, /^^((?!(app|reducers|routes|store)).)*\.js$/); context.keys().forEach(context);
// needed for regenerator-runtime // (ES7 generator support is required by redux-saga) import 'babel-polyfill'; import sinon from 'sinon'; import chai from 'chai'; import chaiEnzyme from 'chai-enzyme'; chai.use(chaiEnzyme()); global.chai = chai; global.sinon = sinon; global.expect = chai.expect; global.should = chai.should(); // Include all .js files under `app`, except app.js, reducers.js, routes.js and // store.js. This is for isparta code coverage const context = require.context('../../app', true, /^^((?!(app|reducers|routes|store|config)).)*\.js$/); context.keys().forEach(context);
Exclude config.js from tests as dotenv will cause it to fail
Exclude config.js from tests as dotenv will cause it to fail
JavaScript
mit
openactive/open-sessions,openactive/open-sessions,opensessions/opensessions,opensessions/opensessions
--- +++ @@ -15,5 +15,5 @@ // Include all .js files under `app`, except app.js, reducers.js, routes.js and // store.js. This is for isparta code coverage -const context = require.context('../../app', true, /^^((?!(app|reducers|routes|store)).)*\.js$/); +const context = require.context('../../app', true, /^^((?!(app|reducers|routes|store|config)).)*\.js$/); context.keys().forEach(context);
c01eebd47c87151477bd21845efeb9578eab8e45
tasks/task-style-compile.js
tasks/task-style-compile.js
var gulp = require("gulp"); var CFG = require("./utils/config.js"); var $ = require("gulp-load-plugins")(); var path = require("path"); var pkg = require(path.join("..", CFG.FILE.config.pkg)); var argv = require("yargs").argv; var notify = require("./utils/notify-style-compile"); /** * style:compile * @see www.npmjs.org/package/gulp-compass * @see compass-style.org * @see compass-style.org/help/tutorials/configuration-reference */ gulp.task("style:compile", ["style:lint"], function() { return gulp.src([ path.join(CFG.DIR.src, "**", "*." + CFG.FILE.extension.style.scss) ]) .pipe($.compass({ bundle_exec: true, // Use the bundle'd gem instead of the global system gem to ensure that we use the version defined in our `Gemfile`. config_file: CFG.FILE.config.compass, css: path.join(CFG.DIR.dist, CFG.DIR.style), sass: path.join(CFG.DIR.src, CFG.DIR.style) })) .on("error", function(error) { if("undefined" !== typeof(process.env.UI_ELEMENTS_CI)) { // Running inside a CI environment, break the build throw new Error(error); } else { // Running inside a non-CI environment, show notifications notify(error); } }); });
var gulp = require("gulp"); var CFG = require("./utils/config.js"); var $ = require("gulp-load-plugins")(); var path = require("path"); var pkg = require(path.join("..", CFG.FILE.config.pkg)); var exec = require("child_process").exec; var argv = require("yargs").argv; var notify = require("./utils/notify-style-compile"); /** * style:compile * @see compass-style.org * @see compass-style.org/help/tutorials/configuration-reference */ gulp.task("style:compile", ["style:lint"], function(callback) { var compassProcess = exec([ "bundle", "exec", "compass", "compile", "--config", path.join(CFG.FILE.config.compass) ].join(" "), function(err, stdout, stderr) { $.util.log("[style:compile] stdout:", stdout); $.util.log("[style:compile] stderr: ", stderr); notify(stdout); if(null !== err) { $.util.log("[style:compile] err: ", err); } callback(); }); });
Remove dependency on blacklisted gem, gulp-compass.
Remove dependency on blacklisted gem, gulp-compass.
JavaScript
mit
rishabhsrao/voxel,rishabhsrao/voxel,rishabhsrao/voxel
--- +++ @@ -3,32 +3,34 @@ var $ = require("gulp-load-plugins")(); var path = require("path"); var pkg = require(path.join("..", CFG.FILE.config.pkg)); +var exec = require("child_process").exec; var argv = require("yargs").argv; var notify = require("./utils/notify-style-compile"); /** * style:compile - * @see www.npmjs.org/package/gulp-compass * @see compass-style.org * @see compass-style.org/help/tutorials/configuration-reference */ -gulp.task("style:compile", ["style:lint"], function() { - return gulp.src([ - path.join(CFG.DIR.src, "**", "*." + CFG.FILE.extension.style.scss) - ]) - .pipe($.compass({ - bundle_exec: true, // Use the bundle'd gem instead of the global system gem to ensure that we use the version defined in our `Gemfile`. - config_file: CFG.FILE.config.compass, - css: path.join(CFG.DIR.dist, CFG.DIR.style), - sass: path.join(CFG.DIR.src, CFG.DIR.style) - })) - .on("error", function(error) { - if("undefined" !== typeof(process.env.UI_ELEMENTS_CI)) { - // Running inside a CI environment, break the build - throw new Error(error); - } else { - // Running inside a non-CI environment, show notifications - notify(error); - } - }); +gulp.task("style:compile", ["style:lint"], function(callback) { + + var compassProcess = exec([ + "bundle", + "exec", + "compass", + "compile", + "--config", + path.join(CFG.FILE.config.compass) + ].join(" "), function(err, stdout, stderr) { + $.util.log("[style:compile] stdout:", stdout); + $.util.log("[style:compile] stderr: ", stderr); + + notify(stdout); + + if(null !== err) { + $.util.log("[style:compile] err: ", err); + } + + callback(); + }); });
71fd14452b4e6f584e937c17666f4e669ac8bd25
src/js/tabs/usd.js
src/js/tabs/usd.js
var util = require('util'), Tab = require('../client/tab').Tab; var UsdTab = function () { Tab.call(this); }; util.inherits(UsdTab, Tab); UsdTab.prototype.tabName = 'usd'; UsdTab.prototype.mainMenu = 'fund'; UsdTab.prototype.angularDeps = Tab.prototype.angularDeps.concat(['qr']); UsdTab.prototype.generateHtml = function () { return require('../../jade/tabs/usd.jade')(); }; UsdTab.prototype.angular = function (module) { module.controller('UsdCtrl', ['$rootScope', 'rpId', 'rpAppManager', 'rpTracker', '$routeParams', function ($scope, $id, appManager, rpTracker, $routeParams) { if(!$scope.usdAmount){ $scope.fee = 0; $scope.total = 0; } if (!$id.loginStatus) return $id.goId(); $scope.calculate = function(amount) { $scope.fee = (parseInt(amount, 10) * (1/100)) + .3; $scope.total = parseInt(amount, 10) + $scope.fee; } }]); }; module.exports = UsdTab;
var util = require('util'), Tab = require('../client/tab').Tab; var UsdTab = function () { Tab.call(this); }; util.inherits(UsdTab, Tab); UsdTab.prototype.tabName = 'usd'; UsdTab.prototype.mainMenu = 'fund'; UsdTab.prototype.angularDeps = Tab.prototype.angularDeps.concat(['qr']); UsdTab.prototype.generateHtml = function () { return require('../../jade/tabs/usd.jade')(); }; UsdTab.prototype.angular = function (module) { module.controller('UsdCtrl', ['$rootScope', 'rpId', 'rpAppManager', 'rpTracker', '$routeParams', function ($scope, $id, appManager, rpTracker, $routeParams) { if (!$id.loginStatus) return $id.goId(); $scope.calculate = function(amount) { if(!amount){ $scope.fee = 0; $scope.total = 0; return; } $scope.fee = (parseInt(amount, 10) * (1/100)) + .3; $scope.total = parseInt(amount, 10) + $scope.fee; } $scope.calculate(); }]); }; module.exports = UsdTab;
Fix total when the entered amount is blank
[FIX] Fix total when the entered amount is blank
JavaScript
isc
wangbibo/ripple-client,yongsoo/ripple-client,ripple/ripple-client,Madsn/ripple-client,yxxyun/ripple-client-desktop,bankonme/ripple-client-desktop,bsteinlo/ripple-client,MatthewPhinney/ripple-client-desktop,Madsn/ripple-client,wangbibo/ripple-client,yongsoo/ripple-client,yongsoo/ripple-client-desktop,vhpoet/ripple-client,thics/ripple-client-desktop,mrajvanshy/ripple-client-desktop,h0vhannes/ripple-client,MatthewPhinney/ripple-client,h0vhannes/ripple-client,h0vhannes/ripple-client,Madsn/ripple-client,xdv/ripple-client-desktop,wangbibo/ripple-client,mrajvanshy/ripple-client,MatthewPhinney/ripple-client-desktop,ripple/ripple-client-desktop,Madsn/ripple-client,arturomc/ripple-client,arturomc/ripple-client,ripple/ripple-client-desktop,yongsoo/ripple-client-desktop,vhpoet/ripple-client,xdv/ripple-client,darkdarkdragon/ripple-client-desktop,ripple/ripple-client,vhpoet/ripple-client,darkdarkdragon/ripple-client-desktop,bankonme/ripple-client-desktop,xdv/ripple-client,arturomc/ripple-client,yongsoo/ripple-client,darkdarkdragon/ripple-client,arturomc/ripple-client,ripple/ripple-client,mrajvanshy/ripple-client-desktop,mrajvanshy/ripple-client,dncohen/ripple-client-desktop,wangbibo/ripple-client,vhpoet/ripple-client-desktop,ripple/ripple-client,darkdarkdragon/ripple-client,thics/ripple-client-desktop,yongsoo/ripple-client,darkdarkdragon/ripple-client,darkdarkdragon/ripple-client,xdv/ripple-client-desktop,vhpoet/ripple-client,MatthewPhinney/ripple-client,mrajvanshy/ripple-client,MatthewPhinney/ripple-client,bsteinlo/ripple-client,xdv/ripple-client,MatthewPhinney/ripple-client,h0vhannes/ripple-client,vhpoet/ripple-client-desktop,mrajvanshy/ripple-client,yxxyun/ripple-client-desktop,dncohen/ripple-client-desktop,xdv/ripple-client,xdv/ripple-client-desktop
--- +++ @@ -23,19 +23,22 @@ module.controller('UsdCtrl', ['$rootScope', 'rpId', 'rpAppManager', 'rpTracker', '$routeParams', function ($scope, $id, appManager, rpTracker, $routeParams) { - if(!$scope.usdAmount){ - $scope.fee = 0; - $scope.total = 0; - } - if (!$id.loginStatus) return $id.goId(); $scope.calculate = function(amount) { + if(!amount){ + $scope.fee = 0; + $scope.total = 0; + + return; + } + $scope.fee = (parseInt(amount, 10) * (1/100)) + .3; $scope.total = parseInt(amount, 10) + $scope.fee; + } - } + $scope.calculate(); }]); };
ff1168a2e59b269486ef587018d4705dd80c75f7
src/v3.js
src/v3.js
import {reactive} from 'vue'; import Auth from './auth.js'; // NOTE: Create pseudo Vue object for Vue 2 backwards compatibility. function Vue (obj) { var data = obj.data(); this.state = reactive(data.state); } Auth.prototype.install = function (app) { app.auth = this; app.config.globalProperties.$auth = this; } // var auth; // export function createAuth(options) { if (!auth) { auth = new Auth(Vue, options); } return auth } export function useAuth() { return auth; }
import {inject } from 'vue' import {reactive} from 'vue'; import Auth from './auth.js'; const authKey = 'auth'; // NOTE: Create pseudo Vue object for Vue 2 backwards compatibility. function Vue (obj) { var data = obj.data(); this.state = reactive(data.state); } Auth.prototype.install = function (app, key) { app.provide(key || authKey, this); app.config.globalProperties.$auth = this; } // export function createAuth(options) { return new Auth(Vue, options); } export function useAuth(key) { return inject(key ? key : authKey); }
Update install / use to follow provide/inject key model.
Update install / use to follow provide/inject key model.
JavaScript
mit
websanova/vue-auth
--- +++ @@ -1,5 +1,8 @@ +import {inject } from 'vue' import {reactive} from 'vue'; -import Auth from './auth.js'; +import Auth from './auth.js'; + +const authKey = 'auth'; // NOTE: Create pseudo Vue object for Vue 2 backwards compatibility. @@ -9,26 +12,18 @@ this.state = reactive(data.state); } -Auth.prototype.install = function (app) { - app.auth = this; +Auth.prototype.install = function (app, key) { + app.provide(key || authKey, this); app.config.globalProperties.$auth = this; } // -var auth; - -// - export function createAuth(options) { - if (!auth) { - auth = new Auth(Vue, options); - } - - return auth + return new Auth(Vue, options); } -export function useAuth() { - return auth; +export function useAuth(key) { + return inject(key ? key : authKey); }
95b10d1dbf19973c00253468ee175561347a1cd0
live/tests/unit/models/snapshot-test.js
live/tests/unit/models/snapshot-test.js
import {expect} from 'chai'; import {describe, it} from 'mocha'; import {setupModelTest} from 'ember-mocha'; describe('Snapshot', function() { setupModelTest('snapshot', { // Specify the other units that are required for this test. needs: [] }); // Replace this with your real tests. it('exists', function() { const model = this.subject(); // var store = this.store(); expect(model).to.be.ok; }); });
import {expect} from 'chai'; import {describe, it} from 'mocha'; import {setupModelTest} from 'ember-mocha'; describe('Snapshot', function() { setupModelTest('snapshot', { needs: [] }); it('exists', function() { const model = this.subject(); expect(model).to.be.ok; }); });
Remove unused test in snapshot model
Remove unused test in snapshot model
JavaScript
agpl-3.0
sgmap/pix,sgmap/pix,sgmap/pix,sgmap/pix
--- +++ @@ -4,14 +4,11 @@ describe('Snapshot', function() { setupModelTest('snapshot', { - // Specify the other units that are required for this test. needs: [] }); - // Replace this with your real tests. it('exists', function() { const model = this.subject(); - // var store = this.store(); expect(model).to.be.ok; }); });
9c66ce4af30104302271ae5cc5b23c0220781b75
accel-k.js
accel-k.js
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; const windows = require("sdk/window/utils"); const tabs = require("sdk/tabs/utils"); const prefs = require("sdk/preferences/service"); require("sdk/hotkeys").Hotkey({ combo: "accel-k", onPress: function () { var tab = tabs.getActiveTab(windows.getMostRecentBrowserWindow()); var tabbrowser = tabs.getTabBrowserForTab(tab); tab = tabbrowser.duplicateTab(tab); if (!prefs.get("browser.tabs.loadInBackground", true)) tabbrowser.selectedTab = tab; } });
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; const windows = require("sdk/window/utils"); const tabs = require("sdk/tabs/utils"); const prefs = require("sdk/preferences/service"); require("sdk/hotkeys").Hotkey({ combo: "accel-k", onPress: function () { let tab = tabs.getActiveTab(windows.getMostRecentBrowserWindow()); let tabbrowser = tabs.getTabBrowserForTab(tab); tab = tabbrowser.duplicateTab(tab); if (!prefs.get("browser.tabs.loadInBackground", true)) tabbrowser.selectedTab = tab; } });
Use let instead of var
Use let instead of var
JavaScript
mpl-2.0
tynn/duplicate-tab-hotkey
--- +++ @@ -10,8 +10,8 @@ require("sdk/hotkeys").Hotkey({ combo: "accel-k", onPress: function () { - var tab = tabs.getActiveTab(windows.getMostRecentBrowserWindow()); - var tabbrowser = tabs.getTabBrowserForTab(tab); + let tab = tabs.getActiveTab(windows.getMostRecentBrowserWindow()); + let tabbrowser = tabs.getTabBrowserForTab(tab); tab = tabbrowser.duplicateTab(tab); if (!prefs.get("browser.tabs.loadInBackground", true)) tabbrowser.selectedTab = tab;
7273e0c87852e1209416c77ffee31ca4623718e0
backends/mongoose.js
backends/mongoose.js
module.exports = function(Model, options) { options || (options = {}) options.idAttribute || (options.idAttribute = '_id') var idQuery = function(model) { var query = {}; query[options.idAttribute] = model[options.idAttribute]; }; this.create = function(model, callback) { Model.create(model, function(err, doc) { if (err) { callback(err); } else { callback(null, doc); } }); }; this.read = function(model, callback) { if (model[options.idAttribute]) { Model.findById(model[options.idAttribute], callback); } else { Model.find(callback); } }; this.update = function(model, callback) { var query = idQuery(model); var id = model[options.idAttribute]; delete model[options.idAttribute]; Model.update(query, { '$set': model }, function(err) { if (err) { callback(err); } else { model[options.idAttribute] = id; callback(null, model); } }); }; this.delete = function(model, callback) { Model.findById(model[options.idAttribute], function(err, doc) { if (err) { callback(err); } else { doc.remove(); callback(null, doc); } }); }; };
module.exports = function(Model, options) { options || (options = {}) options.idAttribute || (options.idAttribute = '_id') var idQuery = function(model) { var query = {}; query[options.idAttribute] = model[options.idAttribute]; return query; }; this.create = function(model, callback) { Model.create(model, function(err, doc) { if (err) { callback(err); } else { callback(null, doc); } }); }; this.read = function(model, callback) { if (model[options.idAttribute]) { Model.findById(model[options.idAttribute], callback); } else { Model.find(callback); } }; this.update = function(model, callback) { var query = idQuery(model); var id = model[options.idAttribute]; delete model[options.idAttribute]; Model.update(query, { '$set': model }, function(err) { if (err) { callback(err); } else { model[options.idAttribute] = id; callback(null, model); } }); }; this.delete = function(model, callback) { Model.findById(model[options.idAttribute], function(err, doc) { if (err) { callback(err); } else { doc.remove(); callback(null, doc); } }); }; };
Fix typo in Mongoose backend
Fix typo in Mongoose backend
JavaScript
mit
cravler/backbone.io
--- +++ @@ -5,6 +5,7 @@ var idQuery = function(model) { var query = {}; query[options.idAttribute] = model[options.idAttribute]; + return query; }; this.create = function(model, callback) {
669e2187cbdffd7738489c758c1bf45ffeee0494
server/helpers/request-handler.js
server/helpers/request-handler.js
const util = require('./utils.js'); module.exports = { logger: (req, res, next) => { console.log(`Serving ${req.method} request @ ${req.path}`); next(); }, getNewBoard: (req, res, next) => { const newId = util.doGenerateNewId(); util.doGetNewBoard(newId); res.json(newId); }, // getBoard: (req, res, next, boardId) => { TODO: call doGetBoard util }, // archiveBoard: (req, res, next, archiveId) => { TODO: call doArchiveBoard util }, };
const util = require('./utils.js'); module.exports = { logger: (req, res, next) => { console.log(`Serving ${req.method} request @ ${req.path}`); next(); }, getNewBoard: (req, res, next) => { const newId = util.doGenerateNewId(); console.log(`Creating new board with id: #${newId}`); util.doGetNewBoard(newId); res.json(newId); }, // getBoard: (req, res, next, boardId) => { TODO: call doGetBoard util }, // archiveBoard: (req, res, next, archiveId) => { TODO: call doArchiveBoard util }, };
Add log to server console when a new room is created
Add log to server console when a new room is created
JavaScript
mit
Badcheese/Badcheese,Badcheese/Badcheese
--- +++ @@ -9,6 +9,7 @@ getNewBoard: (req, res, next) => { const newId = util.doGenerateNewId(); + console.log(`Creating new board with id: #${newId}`); util.doGetNewBoard(newId); res.json(newId); },
03d66233ff78a17e1483daed586a9623447ab453
public/config/default.js
public/config/default.js
window.config = { // default: '/' routerBasename: '/', // default: '' relativeWebWorkerScriptsPath: '', servers: { dicomWeb: [ { name: 'DCM4CHEE', wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado', qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', requestOptions: { requestFromBrowser: true, }, }, ], }, // userPreferences: [ { order: 0, title: 'preference page title', items: [ { order: 0, label: 'Scale Viewport Up', command: 'ScaleViewport', }, ], }, ], // hotkeys: { ScaleViewport: ['+'], }, };
window.config = { // default: '/' routerBasename: '/', // default: '' relativeWebWorkerScriptsPath: '', servers: { dicomWeb: [ { name: 'DCM4CHEE', wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado', qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', requestOptions: { requestFromBrowser: true, }, }, ], }, // userPreferences: [ { order: 0, title: 'preference page title', items: [ { order: 0, label: 'Scale Viewport Up', command: 'scaleUpViewport', }, ], }, ], // hotkeys: { scaleUpViewport: ['s'], }, };
Make sure we're registering a hotkey for a command that exists
Make sure we're registering a hotkey for a command that exists
JavaScript
mit
OHIF/Viewers,OHIF/Viewers,OHIF/Viewers
--- +++ @@ -28,13 +28,13 @@ { order: 0, label: 'Scale Viewport Up', - command: 'ScaleViewport', + command: 'scaleUpViewport', }, ], }, ], // hotkeys: { - ScaleViewport: ['+'], + scaleUpViewport: ['s'], }, };
7ee8937c061d4e2e6b4d34da43d2feac87d6a266
Resources/Private/Javascripts/Modules/Module.js
Resources/Private/Javascripts/Modules/Module.js
/** * Defines a dummy module * * @module Modules/Module */ var App; /** * App * @param el * @constructor */ App = function(el) { 'use strict'; this.el = el; }; /** * Function used to to render the App * * @memberof module:Modules/Module * @returns {Object} The App itself. */ App.prototype.render = function() { 'use strict'; // Return false if not 'el' was set in the app. if(!this.el) { return false; } this.el.innerHTML = 'App is rendered properly!'; return this; }; module.exports = App;
/** * Defines a dummy module * * @module Modules/Module */ var App; /** * App * @param el {HTMLELement} The el on which the App initializes itself. * @constructor */ App = function(el) { 'use strict'; this.el = el; }; /** * Function used to to render the App * * @memberof module:Modules/Module * @returns {Object} The App itself. */ App.prototype.render = function() { 'use strict'; // Return false if not 'el' was set in the app. if(!this.el) { return false; } this.el.innerHTML = 'App is rendered properly!'; return this; }; module.exports = App;
Adjust the module example documentation
[TASK] Adjust the module example documentation
JavaScript
mit
t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template
--- +++ @@ -8,7 +8,7 @@ /** * App - * @param el + * @param el {HTMLELement} The el on which the App initializes itself. * @constructor */ App = function(el) {
456115b74d44cdfe20daf09852afd78b8dbd7618
docs/examples/src/modifiers-styles.js
docs/examples/src/modifiers-styles.js
export default function Example() { const modifiers = { thusdays: { daysOfWeek: [4] }, birthday: new Date(2018, 9, 30), }; const modifiersStyles = { birthday: { color: 'white', backgroundColor: '#ffc107', }, thusdays: { color: '#ffc107', backgroundColor: '#fffdee', }, }; return ( <DayPicker month={new Date(2018, 9)} modifiers={modifiers} modifiersStyles={modifiersStyles} /> ); }
export default function Example() { const modifiers = { thursdays: { daysOfWeek: [4] }, birthday: new Date(2018, 9, 30), }; const modifiersStyles = { birthday: { color: 'white', backgroundColor: '#ffc107', }, thursdays: { color: '#ffc107', backgroundColor: '#fffdee', }, }; return ( <DayPicker month={new Date(2018, 9)} modifiers={modifiers} modifiersStyles={modifiersStyles} /> ); }
Fix day of week typo
Fix day of week typo
JavaScript
mit
saenglert/react-day-picker,gpbl/react-day-picker,gpbl/react-day-picker,gpbl/react-day-picker
--- +++ @@ -1,6 +1,6 @@ export default function Example() { const modifiers = { - thusdays: { daysOfWeek: [4] }, + thursdays: { daysOfWeek: [4] }, birthday: new Date(2018, 9, 30), }; const modifiersStyles = { @@ -8,7 +8,7 @@ color: 'white', backgroundColor: '#ffc107', }, - thusdays: { + thursdays: { color: '#ffc107', backgroundColor: '#fffdee', },
7789bbce4e4b3903c4121aa2d73c8b4b788d7fa0
app/containers/player.js
app/containers/player.js
import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import PlayerLabel from '../components/player-label' class Player extends Component { render () { const { right, color, name } = this.props return ( <div style={{ fontSize: '5vw' }}> <PlayerLabel color={color} right={right}>{name}</PlayerLabel> </div> ) } } function mapStateToProps (state, ownProps) { return { type: state[ownProps.color].type, name: state[ownProps.color].name } } function mapDispatchToProps (dispatch) { return { } } Player.propTypes = { color: PropTypes.string, // black | white type: PropTypes.string, // human | ai name: PropTypes.string, // name of the player right: PropTypes.bool // true if label should be on the right side } export default connect(mapStateToProps, mapDispatchToProps)(Player)
import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import PlayerLabel from '../components/player-label' class Player extends Component { render () { const { right, color, name } = this.props return ( <div style={{ fontSize: '5vw' }}> <PlayerLabel color={color} right={right}>{name}</PlayerLabel> </div> ) } } function mapStateToProps (state, ownProps) { return { type: state[ownProps.color].type, name: state[ownProps.color].name } } function mapDispatchToProps (dispatch) { return { } } Player.propTypes = { color: PropTypes.oneOf(['black', 'white']), type: PropTypes.oneOf(['human', 'ai']), name: PropTypes.string, // name of the player right: PropTypes.bool // true if label should be on the right side } export default connect(mapStateToProps, mapDispatchToProps)(Player)
Use proptypes instead of comments
Use proptypes instead of comments
JavaScript
mit
koscelansky/Dama,koscelansky/Dama
--- +++ @@ -29,8 +29,8 @@ } Player.propTypes = { - color: PropTypes.string, // black | white - type: PropTypes.string, // human | ai + color: PropTypes.oneOf(['black', 'white']), + type: PropTypes.oneOf(['human', 'ai']), name: PropTypes.string, // name of the player right: PropTypes.bool // true if label should be on the right side }
7cd93a605fe97858ee4c41c63ef8f95be830bcdd
karma-static-files/test-bundle.js
karma-static-files/test-bundle.js
const testsContext = require.context('../../../src', true, /\.spec\..+$/) testsContext.keys().forEach(testsContext)
/** * Sagui test bundler that finds all test files in a project * for Karma to run them. */ const testsContext = require.context('../../../src', true, /\.spec\..+$/) testsContext.keys().forEach(testsContext)
Document the test bundler 📕
Document the test bundler 📕
JavaScript
mit
saguijs/sagui,saguijs/sagui
--- +++ @@ -1,2 +1,6 @@ +/** + * Sagui test bundler that finds all test files in a project + * for Karma to run them. + */ const testsContext = require.context('../../../src', true, /\.spec\..+$/) testsContext.keys().forEach(testsContext)
3e256e09efdfded93a62c57e3078c4d66cacaaf3
eslint-rules/no-require-in-service.js
eslint-rules/no-require-in-service.js
module.exports = function(context) { return { CallExpression: function(node) { if (!context.filename.match(/^lib\/services\//)) return; if (node.callee.name === 'require' && node.arguments[0].value !== '../core') { context.report(node, 'require() is disallowed in service files'); } } }; };
module.exports = function(context) { return { CallExpression: function(node) { if (!context.getFilename().match(/^lib\/services\//)) return; if (node.callee.name === 'require' && node.arguments[0].value !== '../core') { context.report(node, 'require() is disallowed in service files'); } } }; };
Use context.getFilename() instead (eslint API change)
Use context.getFilename() instead (eslint API change)
JavaScript
apache-2.0
prembasumatary/aws-sdk-js,LiuJoyceC/aws-sdk-js,mohamed-kamal/aws-sdk-js,mapbox/aws-sdk-js,guymguym/aws-sdk-js,jmswhll/aws-sdk-js,jmswhll/aws-sdk-js,grimurjonsson/aws-sdk-js,mohamed-kamal/aws-sdk-js,ugie/aws-sdk-js,prembasumatary/aws-sdk-js,jippeholwerda/aws-sdk-js,odeke-em/aws-sdk-js,ugie/aws-sdk-js,j3tm0t0/aws-sdk-js,AdityaManohar/aws-sdk-js,GlideMe/aws-sdk-js,AdityaManohar/aws-sdk-js,MitocGroup/aws-sdk-js,michael-donat/aws-sdk-js,MitocGroup/aws-sdk-js,odeke-em/aws-sdk-js,AdityaManohar/aws-sdk-js,mohamed-kamal/aws-sdk-js,Blufe/aws-sdk-js,chrisradek/aws-sdk-js,grimurjonsson/aws-sdk-js,beni55/aws-sdk-js,dconnolly/aws-sdk-js,Blufe/aws-sdk-js,guymguym/aws-sdk-js,prestomation/aws-sdk-js,chrisradek/aws-sdk-js,MitocGroup/aws-sdk-js,chrisradek/aws-sdk-js,prembasumatary/aws-sdk-js,mapbox/aws-sdk-js,jmswhll/aws-sdk-js,misfitdavidl/aws-sdk-js,aws/aws-sdk-js,jippeholwerda/aws-sdk-js,prestomation/aws-sdk-js,misfitdavidl/aws-sdk-js,michael-donat/aws-sdk-js,beni55/aws-sdk-js,ugie/aws-sdk-js,chrisradek/aws-sdk-js,grimurjonsson/aws-sdk-js,aws/aws-sdk-js,jeskew/aws-sdk-js,guymguym/aws-sdk-js,jippeholwerda/aws-sdk-js,aws/aws-sdk-js,odeke-em/aws-sdk-js,michael-donat/aws-sdk-js,guymguym/aws-sdk-js,jeskew/aws-sdk-js,mapbox/aws-sdk-js,dconnolly/aws-sdk-js,prestomation/aws-sdk-js,GlideMe/aws-sdk-js,jeskew/aws-sdk-js,misfitdavidl/aws-sdk-js,LiuJoyceC/aws-sdk-js,j3tm0t0/aws-sdk-js,jeskew/aws-sdk-js,beni55/aws-sdk-js,j3tm0t0/aws-sdk-js,Blufe/aws-sdk-js,LiuJoyceC/aws-sdk-js,GlideMe/aws-sdk-js,aws/aws-sdk-js,dconnolly/aws-sdk-js,GlideMe/aws-sdk-js
--- +++ @@ -1,7 +1,7 @@ module.exports = function(context) { return { CallExpression: function(node) { - if (!context.filename.match(/^lib\/services\//)) return; + if (!context.getFilename().match(/^lib\/services\//)) return; if (node.callee.name === 'require' && node.arguments[0].value !== '../core') { context.report(node, 'require() is disallowed in service files'); }
01d91874f9ea689c6299de473295a6ea1feb047f
bin/repl.js
bin/repl.js
#!/usr/bin/env node var repl = require('repl'); var program = require('commander'); var defaults = require('../lib/defaults.js'); var protocol = require('../lib/protocol.json'); var Chrome = require('../'); program .option('-h, --host <host>', 'Remote Debugging Protocol host', defaults.HOST) .option('-p, --port <port>', 'Remote Debugging Protocol port', defaults.PORT) .parse(process.argv); var options = { 'host': program.host, 'port': program.port }; Chrome(options, function (chrome) { var chromeRepl = repl.start({ 'prompt': 'chrome> ', 'ignoreUndefined': true }); // disconnect on exit chromeRepl.on('exit', function () { chrome.close(); }); // add protocol API for (var domainIdx in protocol.domains) { var domainName = protocol.domains[domainIdx].domain; chromeRepl.context[domainName] = chrome[domainName]; } }).on('error', function () { console.error('Cannot connect to Chrome'); });
#!/usr/bin/env node var repl = require('repl'); var util = require('util'); var program = require('commander'); var defaults = require('../lib/defaults.js'); var protocol = require('../lib/protocol.json'); var Chrome = require('../'); program .option('-h, --host <host>', 'Remote Debugging Protocol host', defaults.HOST) .option('-p, --port <port>', 'Remote Debugging Protocol port', defaults.PORT) .parse(process.argv); var options = { 'host': program.host, 'port': program.port }; Chrome(options, function (chrome) { var chromeRepl = repl.start({ 'prompt': 'chrome> ', 'ignoreUndefined': true, 'writer': function (object) { return util.inspect(object, { 'colors': true, 'depth': null }); } }); // disconnect on exit chromeRepl.on('exit', function () { chrome.close(); }); // add protocol API for (var domainIdx in protocol.domains) { var domainName = protocol.domains[domainIdx].domain; chromeRepl.context[domainName] = chrome[domainName]; } }).on('error', function () { console.error('Cannot connect to Chrome'); });
Set the util.inspect depth to unlimited for the REPL
Set the util.inspect depth to unlimited for the REPL
JavaScript
mit
cyrus-and/chrome-remote-interface,cyrus-and/chrome-remote-interface,valaxy/chrome-remote-interface,washtubs/chrome-remote-interface
--- +++ @@ -1,6 +1,7 @@ #!/usr/bin/env node var repl = require('repl'); +var util = require('util'); var program = require('commander'); var defaults = require('../lib/defaults.js'); var protocol = require('../lib/protocol.json'); @@ -19,7 +20,13 @@ Chrome(options, function (chrome) { var chromeRepl = repl.start({ 'prompt': 'chrome> ', - 'ignoreUndefined': true + 'ignoreUndefined': true, + 'writer': function (object) { + return util.inspect(object, { + 'colors': true, + 'depth': null + }); + } }); // disconnect on exit
c2dab7e604033a1b7859e7b424a305166f7faba2
test/common.js
test/common.js
var assert = require('assert'); var whiskers = exports.whiskers = require('../lib/whiskers'); // uncomment to test minified //var whiskers = exports.whiskers = require('../dist/whiskers.min'); // in each test, declare `common.expected = n;` for n asserts expected exports.expected = 0; var count = 0; var wrapAssert = function(fn) { return function() { assert[fn].apply(this, arguments); count++; process.stdout.write('.'); }; }; // add all functions from the assert module exports.assert = {}; for (var fn in assert) { if (assert.hasOwnProperty(fn)) { exports.assert[fn] = wrapAssert(fn); } } process.on('exit', function() { process.stdout.write(' ran ' + count + ' of ' + exports.expected + ' tests.\n'); });
var assert = require('assert'); exports.whiskers = require('../dist/whiskers.min'); // uncomment to test non-minified code //exports.whiskers = require('../lib/whiskers'); // in each test, declare `common.expected = n;` for n asserts expected exports.expected = 0; var count = 0; var wrapAssert = function(fn) { return function() { assert[fn].apply(this, arguments); count++; process.stdout.write('.'); }; }; // add all functions from the assert module exports.assert = {}; for (var fn in assert) { if (assert.hasOwnProperty(fn)) { exports.assert[fn] = wrapAssert(fn); } } process.on('exit', function() { process.stdout.write(' ran ' + count + ' of ' + exports.expected + ' tests.\n'); });
Test minified code by default
Test minified code by default
JavaScript
mit
gsf/whiskers.js,gsf/whiskers.js
--- +++ @@ -1,7 +1,7 @@ var assert = require('assert'); -var whiskers = exports.whiskers = require('../lib/whiskers'); -// uncomment to test minified -//var whiskers = exports.whiskers = require('../dist/whiskers.min'); +exports.whiskers = require('../dist/whiskers.min'); +// uncomment to test non-minified code +//exports.whiskers = require('../lib/whiskers'); // in each test, declare `common.expected = n;` for n asserts expected exports.expected = 0;
4d0035386593322fc6f12c86c67af2705a8e3b9b
test/helper.js
test/helper.js
var assert = require('assert'); var hash = require('object-hash'); var Filterable = require("../lib").Filterable; global.assertObjects = function(o1, o2) { //console.log(o1, o2); assert.equal(hash.sha1(o1), hash.sha1(o2)); }; global.filter = new Filterable({ tagsFields: ["description"], fields: { "name": { type: String }, "mail": { type: String, alias: "email" }, "username": { type: String }, "followers": { type: Number }, "stars": { type: Number } } });
var assert = require('assert'); var util = require('util'); var hash = require('object-hash'); var Filterable = require("../lib").Filterable; global.assertObjects = function(o1, o2) { //console.log(o1, o2); try { assert.equal(hash.sha1(o1), hash.sha1(o2)); } catch(e) { throw ""+JSON.stringify(o1)+" != "+JSON.stringify(o2); } }; global.filter = new Filterable({ tagsFields: ["description"], fields: { "name": { type: String }, "mail": { type: String, alias: "email" }, "username": { type: String }, "followers": { type: Number }, "stars": { type: Number } } });
Improve display of error in unit tests
Improve display of error in unit tests
JavaScript
apache-2.0
GitbookIO/filterable
--- +++ @@ -1,10 +1,15 @@ var assert = require('assert'); +var util = require('util'); var hash = require('object-hash'); var Filterable = require("../lib").Filterable; global.assertObjects = function(o1, o2) { //console.log(o1, o2); - assert.equal(hash.sha1(o1), hash.sha1(o2)); + try { + assert.equal(hash.sha1(o1), hash.sha1(o2)); + } catch(e) { + throw ""+JSON.stringify(o1)+" != "+JSON.stringify(o2); + } }; global.filter = new Filterable({
56847e3691ad220a3d4b81744ce5564cbf09f1ed
lib/views/remote-selector-view.js
lib/views/remote-selector-view.js
import React from 'react'; import PropTypes from 'prop-types'; import {RemoteSetPropType, BranchPropType} from '../prop-types'; export default class RemoteSelectorView extends React.Component { static propTypes = { remotes: RemoteSetPropType.isRequired, currentBranch: BranchPropType.isRequired, selectRemote: PropTypes.func.isRequired, } render() { const {remotes, currentBranch, selectRemote} = this.props; // todo: ask Ash how to test this before merging. return ( <div className="github-RemoteSelector"> <div className="github-GitHub-LargeIcon icon icon-mirror" /> <h1>Multiple Remotes</h1> <div className="initialize-repo-description"> <span>This repository has multiple remotes hosted at GitHub.com. Select a remote to see pull requests associated with the <strong>{currentBranch.getName()}</strong> branch:</span> </div> <ul> {Array.from(remotes, remote => ( <li key={remote.getName()}> <button className="btn btn-primary" onClick={e => selectRemote(e, remote)}> {remote.getName()} ({remote.getOwner()}/{remote.getRepo()}) </button> </li> ))} </ul> </div> ); } }
import React from 'react'; import PropTypes from 'prop-types'; import {RemoteSetPropType, BranchPropType} from '../prop-types'; export default class RemoteSelectorView extends React.Component { static propTypes = { remotes: RemoteSetPropType.isRequired, currentBranch: BranchPropType.isRequired, selectRemote: PropTypes.func.isRequired, } render() { const {remotes, currentBranch, selectRemote} = this.props; // todo: ask Ash how to test this before merging. return ( <div className="github-RemoteSelector"> <div className="github-GitHub-LargeIcon icon icon-mirror" /> <h1>Select a Remote</h1> <div className="initialize-repo-description"> <span>This repository has multiple remotes hosted at GitHub.com. Select a remote to see pull requests associated with the <strong>{currentBranch.getName()}</strong> branch:</span> </div> <ul> {Array.from(remotes, remote => ( <li key={remote.getName()}> <button className="btn btn-primary" onClick={e => selectRemote(e, remote)}> {remote.getName()} ({remote.getOwner()}/{remote.getRepo()}) </button> </li> ))} </ul> </div> ); } }
Update heading on Remote Selector to use imperative tone
Update heading on Remote Selector to use imperative tone Previously the heading looked like an "error" message, however, this is really just a regular state that the user can appear in, and in future revisions this screen could be used for changing the remote directly from within the Github package, therefore an imperative tone fits better with the user's intent.
JavaScript
mit
atom/github,atom/github,atom/github
--- +++ @@ -16,7 +16,7 @@ return ( <div className="github-RemoteSelector"> <div className="github-GitHub-LargeIcon icon icon-mirror" /> - <h1>Multiple Remotes</h1> + <h1>Select a Remote</h1> <div className="initialize-repo-description"> <span>This repository has multiple remotes hosted at GitHub.com. Select a remote to see pull requests associated
91fa94ad45f52a2fd6216f9752cb432003f58d21
test/import.js
test/import.js
'use strict' const mongoose = require('mongoose'); const users = JSON.parse(require('fs').readFileSync(__dirname + '/users.json')); const domains = JSON.parse(require('fs').readFileSync(__dirname + '/domains.json')); if (mongoose.connection.readyState === 0) { mongoose.connect('mongodb://localhost/test'); } let domainId; mongoose.connection.once('open', function() { mongoose.connection.db.collection('domains', function(err, col){ if (err) { throw err; } for (var i in domains) { col.insert(domains[i], function(err, result){ if (err) { throw err; } if (!domainId) { domainId = mongoose.Types.ObjectId(result.ops[0]._id); } if (domains.length-1 == i) { mongoose.connection.db.collection('users', function(err, userCol){ if (err) { throw err; } for (var i in users) { users[i].domain = domainId; console.log(domainId); userCol.insert(users[i], function(err, result){ if (err) { throw err; } if (users.length-1 == i) { process.exit(); } }) } } ); } }) } }); });
'use strict' const mongoose = require('mongoose'); const users = JSON.parse(require('fs').readFileSync(__dirname + '/users.json')); const domains = JSON.parse(require('fs').readFileSync(__dirname + '/domains.json')); if (mongoose.connection.readyState === 0) { mongoose.connect('mongodb://localhost/test'); } let domainId; mongoose.connection.once('open', function() { mongoose.connection.db.collection('domains', function(err, col){ if (err) { throw err; } for (let i in domains) { col.insert(domains[i], function(err, result){ if (err) { throw err; } if (!domainId) { domainId = mongoose.Types.ObjectId(result.ops[0]._id); } if (domains.length-1 == i) { mongoose.connection.db.collection('users', function(err, userCol){ if (err) { throw err; } for (let i in users) { users[i].domain = domainId; console.log(domainId); userCol.insert(users[i], function(err, result){ if (err) { throw err; } if (users.length-1 == i) { process.exit(); } }) } }); } }) } }); });
Use let instead of var. Fix indentation
Use let instead of var. Fix indentation
JavaScript
mit
KodeKreatif/dovecot-log-scrapper
--- +++ @@ -11,7 +11,7 @@ if (err) { throw err; } - for (var i in domains) { + for (let i in domains) { col.insert(domains[i], function(err, result){ if (err) { throw err; @@ -21,10 +21,10 @@ } if (domains.length-1 == i) { mongoose.connection.db.collection('users', function(err, userCol){ - if (err) { + if (err) { throw err; - } - for (var i in users) { + } + for (let i in users) { users[i].domain = domainId; console.log(domainId); userCol.insert(users[i], function(err, result){ @@ -36,7 +36,7 @@ } }) } - } ); + }); } }) }
e9bdf081c80b2cf2c5b1edc1a63ea45c91454a92
app/users/users.service.js
app/users/users.service.js
{ angular.module('meganote.users') .service('UsersService', [ '$hhtp', 'API_BASE', ($http, API_BASE) => { class UsersService { create (users) { $http.get(API_BASE) .then( res => { console.log(res.data); } ); } } return new UsersService(); } ]); }
{ angular.module('meganote.users') .service('UsersService', [ '$hhtp', 'API_BASE', ($http, API_BASE) => { class UsersService { create (user) { return $http.post('${API_BASE}users', { user, }) .then( res => { console.log(res.data); } ); } } return new UsersService(); } ]); }
Make a POST request to create a user.
Make a POST request to create a user.
JavaScript
mit
zachmillikan/meganote,zachmillikan/meganote
--- +++ @@ -6,8 +6,10 @@ ($http, API_BASE) => { class UsersService { - create (users) { - $http.get(API_BASE) + create (user) { + return $http.post('${API_BASE}users', { + user, + }) .then( res => { console.log(res.data);
56f3c81553cb446fe5d3668a89f9c162ebfb4daf
lib/server/createGraphQLPublication.js
lib/server/createGraphQLPublication.js
import { Meteor } from 'meteor/meteor'; import { subscribe } from 'graphql'; import forAwaitEach from '../common/forAwaitEach'; import { DEFAULT_PUBLICATION, } from '../common/defaults'; export function createGraphQLPublication({ schema, publication = DEFAULT_PUBLICATION, } = {}) { Meteor.publish(publication, function publishGraphQL({ query, variables, operationName, } = {}) { const { userId, _subscriptionId: subId, _session: session, } = this; if (!query) { this.stop(); return; } const context = { userId }; const subscribeToQuery = async () => { const iterator = await subscribe( schema, query, {}, context, variables, operationName, ); return forAwaitEach(iterator, (graphqlData) => { // If this subscription has ended we should stop listening to the iterator const { _deactivated: done } = this; if (done) { return false; } session.socket.send(JSON.stringify({ msg: 'pong', subId, graphqlData, })); return true; }); }; this.ready(); subscribeToQuery(); }); }
import { Meteor } from 'meteor/meteor'; import { subscribe } from 'graphql'; import forAwaitEach from '../common/forAwaitEach'; import { DEFAULT_PUBLICATION, } from '../common/defaults'; export function createGraphQLPublication({ schema, publication = DEFAULT_PUBLICATION, } = {}) { if (!subscribe) { console.warn('DDP-Apollo: You need graphl@0.11 or higher for subscription support'); return; } Meteor.publish(publication, function publishGraphQL({ query, variables, operationName, } = {}) { const { userId, _subscriptionId: subId, _session: session, } = this; if (!query) { this.stop(); return; } const context = { userId }; const subscribeToQuery = async () => { const iterator = await subscribe( schema, query, {}, context, variables, operationName, ); return forAwaitEach(iterator, (graphqlData) => { // If this subscription has ended we should stop listening to the iterator const { _deactivated: done } = this; if (done) { return false; } session.socket.send(JSON.stringify({ msg: 'pong', subId, graphqlData, })); return true; }); }; this.ready(); subscribeToQuery(); }); }
Add warning when subscribe is not difined
Add warning when subscribe is not difined
JavaScript
mit
Swydo/ddp-apollo
--- +++ @@ -9,6 +9,11 @@ schema, publication = DEFAULT_PUBLICATION, } = {}) { + if (!subscribe) { + console.warn('DDP-Apollo: You need graphl@0.11 or higher for subscription support'); + return; + } + Meteor.publish(publication, function publishGraphQL({ query, variables,
01d6317de28f8b866afe771085babec4a6574ec0
ecosystem.config.js
ecosystem.config.js
module.exports = { apps : [ { name : "auction_app", script : "/usr/local/bin/npm", cwd : "/home/vagrant/apps/AuctionApp", args : "run start:prod" }, ], deploy : { production : { user : "vagrant", host : "192.168.33.10", ref : "origin/master", repo : "git@github.com:Radiet/AuctionApp.git", path : "/home/vagrant/apps" }, } }
module.exports = { apps : [ { name : "auction_app", script : "/usr/local/bin/npm", cwd : "/home/vagrant/apps/current", args : "run start:prod" }, ], deploy : { production : { user : "vagrant", host : "192.168.33.10", ref : "origin/master", repo : "git@github.com:Radiet/AuctionApp.git", path : "/home/vagrant/apps" }, } }
Fix path in ecosystem file
Fix path in ecosystem file
JavaScript
mit
Radiet/AuctionApp,Radiet/AuctionApp,Radiet/AuctionApp
--- +++ @@ -3,7 +3,7 @@ { name : "auction_app", script : "/usr/local/bin/npm", - cwd : "/home/vagrant/apps/AuctionApp", + cwd : "/home/vagrant/apps/current", args : "run start:prod" }, ],
50ac40453e85cc4315d28859962977573e2c1294
lib/generators/templates/model.js
lib/generators/templates/model.js
<%= application_name.camelize %>.<%= class_name %> = DS.Model.extend({ <% attributes.each_index do |idx| -%> <%= attributes[idx][:name].camelize(:lower) %>: <%= if %w(references belongs_to).member?(attributes[idx][:type]) "DS.belongsTo('%s.%s')" % [application_name.camelize, attributes[idx][:name].camelize] else "DS.attr('%s')" % attributes[idx][:type] end %><% if (idx < attributes.length-1) %>,<% end %> <% end -%> });
<%= application_name.camelize %>.<%= class_name %> = DS.Model.extend({ <% attributes.each_with_index do |attribute, idx| -%> <%= attribute[:name].camelize(:lower) %>: <%= if %w(references belongs_to).member?(attribute[:type]) "DS.belongsTo('%s.%s')" % [application_name.camelize, attribute[:name].camelize] else "DS.attr('%s')" % attribute[:type] end %><% if (idx < attributes.length-1) %>,<% end %> <% end -%> });
Use brock argument for simple access
Use brock argument for simple access
JavaScript
mit
tricknotes/ember-rails,bterkuile/ember-rails,kongregate/ember-rails,bcavileer/ember-rails,tricknotes/ember-rails,ipmobiletech/ember-rails,maschwenk/ember-rails,maschwenk/ember-rails,emberjs/ember-rails,kongregate/ember-rails,bterkuile/ember-rails,bcavileer/ember-rails,maschwenk/ember-rails,tricknotes/ember-rails,ipmobiletech/ember-rails,emberjs/ember-rails,emberjs/ember-rails,bterkuile/ember-rails,bcavileer/ember-rails,ipmobiletech/ember-rails
--- +++ @@ -1,10 +1,10 @@ <%= application_name.camelize %>.<%= class_name %> = DS.Model.extend({ -<% attributes.each_index do |idx| -%> - <%= attributes[idx][:name].camelize(:lower) %>: <%= - if %w(references belongs_to).member?(attributes[idx][:type]) - "DS.belongsTo('%s.%s')" % [application_name.camelize, attributes[idx][:name].camelize] +<% attributes.each_with_index do |attribute, idx| -%> + <%= attribute[:name].camelize(:lower) %>: <%= + if %w(references belongs_to).member?(attribute[:type]) + "DS.belongsTo('%s.%s')" % [application_name.camelize, attribute[:name].camelize] else - "DS.attr('%s')" % attributes[idx][:type] + "DS.attr('%s')" % attribute[:type] end %><% if (idx < attributes.length-1) %>,<% end %> <% end -%>
288df663a89979e9df524ee7d0127a537074efac
app/assets/javascripts/components/ClearInput.js
app/assets/javascripts/components/ClearInput.js
define(['jquery', 'DoughBaseComponent'], function($, DoughBaseComponent) { 'use strict'; var ClearInput, uiEvents = { 'keydown [data-dough-clear-input]' : 'updateResetButton', 'click [data-dough-clear-input-button]' : 'resetForm' }; ClearInput = function($el, config) { var _this = this; this.uiEvents = uiEvents; ClearInput.baseConstructor.call(this, $el, config); this.$resetInput = this.$el.find('[data-dough-clear-input]'); this.$resetButton = this.$el.find('[data-dough-clear-input-button]'); }; /** * Inherit from base module, for shared methods and interface */ DoughBaseComponent.extend(ClearInput); /** * Set up and populate the model from the form inputs * @param {Promise} initialised */ ClearInput.prototype.init = function(initialised) { this._initialisedSuccess(initialised); }; ClearInput.prototype.updateResetButton = function() { var fn = (this.$resetInput.val() == '') ? 'removeClass' : 'addClass'; this.$resetButton[fn]('is-active'); }; ClearInput.prototype.resetForm = function() { this.$el[0].reset(); this.updateResetButton(); }; return ClearInput; });
define(['jquery', 'DoughBaseComponent'], function($, DoughBaseComponent) { 'use strict'; var ClearInput, uiEvents = { 'keydown [data-dough-clear-input]' : 'updateResetButton', 'click [data-dough-clear-input-button]' : 'resetForm' }; ClearInput = function($el, config) { this.uiEvents = uiEvents; ClearInput.baseConstructor.call(this, $el, config); this.$resetInput = this.$el.find('[data-dough-clear-input]'); this.$resetButton = this.$el.find('[data-dough-clear-input-button]'); }; /** * Inherit from base module, for shared methods and interface */ DoughBaseComponent.extend(ClearInput); /** * Set up and populate the model from the form inputs * @param {Promise} initialised */ ClearInput.prototype.init = function(initialised) { this._initialisedSuccess(initialised); }; ClearInput.prototype.updateResetButton = function() { var fn = this.$resetInput.val() === '' ? 'removeClass' : 'addClass'; this.$resetButton[fn]('is-active'); }; // We are progressively enhancing the form with JS. The CSS button, type 'reset' // resets the form faster than the JS can run, so we need to invoke reset() to ensure the correct behaviour. ClearInput.prototype.resetForm = function() { this.$el[0].reset(); this.updateResetButton(); }; return ClearInput; });
Clean up code and add comments
Clean up code and add comments
JavaScript
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
--- +++ @@ -9,7 +9,6 @@ }; ClearInput = function($el, config) { - var _this = this; this.uiEvents = uiEvents; ClearInput.baseConstructor.call(this, $el, config); @@ -31,9 +30,12 @@ }; ClearInput.prototype.updateResetButton = function() { - var fn = (this.$resetInput.val() == '') ? 'removeClass' : 'addClass'; + var fn = this.$resetInput.val() === '' ? 'removeClass' : 'addClass'; this.$resetButton[fn]('is-active'); }; + +// We are progressively enhancing the form with JS. The CSS button, type 'reset' +// resets the form faster than the JS can run, so we need to invoke reset() to ensure the correct behaviour. ClearInput.prototype.resetForm = function() { this.$el[0].reset();
2518ce4554e1d20353c5d1d177c6cb7ee295cca5
app/assets/javascripts/views/export_csv_view.js
app/assets/javascripts/views/export_csv_view.js
// Handles getting info about bulk media thresholds ELMO.Views.ExportCsvView = class ExportCsvView extends ELMO.Views.ApplicationView { get events() { return { 'click #response_csv_export_options_download_media': 'calculateMediaSize' }; } initialize(params) { $(".calculating-info").hide(); $(".error-info").hide(); $(".media-info").hide(); } calculateMediaSize(event) { if (($(event.target)).is(':checked')) { $("input[type=submit]").prop("disabled", true); this.spaceLeft(); $(".media-info").show(); } else { $("input[type=submit]").removeAttr("disabled"); $(".media-info").hide(); $(".error-info").hide(); } } spaceLeft() { $(".calculating-info").show(); $.ajax({ url: ELMO.app.url_builder.build("media-size"), method: "get", data: "", success: (data) => { $(".calculating-info").hide(); $("#media-size").html(data.media_size + " MB"); if (data.space_on_disk) { $("input[type=submit]").removeAttr("disabled"); } else { $("#export-error").html(I18n.t("response.export_options.no_space")); $(".error-info").show(); } return data; }, error: (xhr, error) => { $("#export-error").html(I18n.t("response.export_options.try_again")); } }); } };
// Handles getting info about bulk media thresholds ELMO.Views.ExportCsvView = class ExportCsvView extends ELMO.Views.ApplicationView { get events() { return { 'click #response_csv_export_options_download_media': 'calculateMediaSize' }; } initialize(params) { $(".calculating-info").hide(); $(".error-info").hide(); $(".media-info").hide(); } async calculateMediaSize(event) { if (($(event.target)).is(':checked')) { $("input[type=submit]").prop("disabled", true); await this.spaceLeft(); $(".media-info").show(); } else { $("input[type=submit]").removeAttr("disabled"); $(".media-info").hide(); $(".error-info").hide(); } } async spaceLeft() { $(".calculating-info").show(); return $.ajax({ url: ELMO.app.url_builder.build("media-size"), method: "get", data: "", success: (data) => { $(".calculating-info").hide(); $("#media-size").html(data.media_size + " MB"); if (data.space_on_disk) { $("input[type=submit]").removeAttr("disabled"); } else { $("#export-error").html(I18n.t("response.export_options.no_space")); $(".error-info").show(); } return data; }, error: (xhr, error) => { $("#export-error").html(I18n.t("response.export_options.try_again")); } }); } };
Use async/await for ajax request
11804: Use async/await for ajax request
JavaScript
apache-2.0
thecartercenter/elmo,thecartercenter/elmo,thecartercenter/elmo
--- +++ @@ -12,10 +12,10 @@ $(".media-info").hide(); } - calculateMediaSize(event) { + async calculateMediaSize(event) { if (($(event.target)).is(':checked')) { $("input[type=submit]").prop("disabled", true); - this.spaceLeft(); + await this.spaceLeft(); $(".media-info").show(); } else { @@ -25,10 +25,10 @@ } } - spaceLeft() { + async spaceLeft() { $(".calculating-info").show(); - $.ajax({ + return $.ajax({ url: ELMO.app.url_builder.build("media-size"), method: "get", data: "",
ed2860839bc5e5d70e07e058b8fda294a1114a01
src/admin/redux/modules/labels.js
src/admin/redux/modules/labels.js
/* @flow */ import { createAction } from 'redux-actions' const { objOf, map } = require('ramda') import { compose } from 'sanctuary' import { get_body } from 'app/http' import type { Action, Reducer } from 'redux' type State = typeof initialState const initialState = { addresses: [] } const reducer: Reducer<State, Action> = (state = initialState, { type, payload }) => { switch (type) { case NEWSLETTER_LABELS: return compose(objOf('addresses'))(map(addresses))(payload.results) default: return state } } export default reducer const addresses = ( { title , first_name , last_name , initials , ...address_lines } ) => ( { addressee: `${title || ''} ${first_name || initials || ''} ${last_name}` , ...address_lines } ) const NEWSLETTER_LABELS = 'NEWSLETTER_LABELS' export const newsletter_labels = createAction(NEWSLETTER_LABELS, () => get_body('/api/newsletter-labels'))
/* @flow */ import { createAction } from 'redux-actions' const { objOf, map } = require('ramda') import { compose } from 'sanctuary' import { get_body } from 'app/http' import { PATH_UPDATE } from '../../../shared/redux/modules/route.js' import type { Action, Reducer } from 'redux' type State = typeof initialState const initialState = { addresses: [] } const reducer: Reducer<State, Action> = (state = initialState, { type, payload }) => { switch (type) { case NEWSLETTER_LABELS: return compose(objOf('addresses'))(map(addresses))(payload.results) case PATH_UPDATE: return initialState default: return state } } export default reducer const addresses = ( { title , first_name , last_name , initials , ...address_lines } ) => ( { addressee: `${title || ''} ${first_name || initials || ''} ${last_name}` , ...address_lines } ) const NEWSLETTER_LABELS = 'NEWSLETTER_LABELS' export const newsletter_labels = createAction(NEWSLETTER_LABELS, () => get_body('/api/newsletter-labels'))
Clear label state when navigating away from it.
Clear label state when navigating away from it.
JavaScript
mit
foundersandcoders/sail-back,foundersandcoders/sail-back
--- +++ @@ -2,8 +2,9 @@ import { createAction } from 'redux-actions' const { objOf, map } = require('ramda') import { compose } from 'sanctuary' +import { get_body } from 'app/http' -import { get_body } from 'app/http' +import { PATH_UPDATE } from '../../../shared/redux/modules/route.js' import type { Action, Reducer } from 'redux' @@ -17,6 +18,8 @@ switch (type) { case NEWSLETTER_LABELS: return compose(objOf('addresses'))(map(addresses))(payload.results) + case PATH_UPDATE: + return initialState default: return state }
1d1f49783873110d9cb810ec5bb2d0ce778ed6a9
src/app/Trigger/TriggerProfile.js
src/app/Trigger/TriggerProfile.js
import React from 'react'; import { Link } from 'react-router'; import classNames from 'classnames'; import Icon from '../../widgets/Icon'; const TriggerProfile = React.createClass({ render() { const { isFollowing, followingIsFetching, onClickFollow, hasFollow } = this.props; return ( <div className="actions"> <div className="triggers"> {hasFollow && <a className={classNames('trigger', { disabled: followingIsFetching })} onClick={onClickFollow}> <Icon name={isFollowing ? 'person_outline' : 'person_add'} /> </a>} <Link to={`/messages/@${this.props.username}`} className="trigger"> <Icon name="chat_bubble_outline" /> </Link> </div> </div> ); } }); module.exports = TriggerProfile;
import React from 'react'; import { Link } from 'react-router'; import classNames from 'classnames'; import Icon from '../../widgets/Icon'; const TriggerProfile = React.createClass({ render() { const { isFollowing, followingIsFetching, onClickFollow, hasFollow } = this.props; return ( <div className="actions"> <div className="triggers"> {hasFollow && <a className={classNames('trigger', { disabled: followingIsFetching })} onClick={onClickFollow}> <Icon name={isFollowing ? 'person_outline' : 'person_add'} /> </a>} </div> </div> ); } }); module.exports = TriggerProfile;
Remove chat icon from trigger profile
Remove chat icon from trigger profile
JavaScript
mit
ryanbaer/busy,ryanbaer/busy,busyorg/busy,Sekhmet/busy,Sekhmet/busy,busyorg/busy
--- +++ @@ -20,9 +20,6 @@ <a className={classNames('trigger', { disabled: followingIsFetching })} onClick={onClickFollow}> <Icon name={isFollowing ? 'person_outline' : 'person_add'} /> </a>} - <Link to={`/messages/@${this.props.username}`} className="trigger"> - <Icon name="chat_bubble_outline" /> - </Link> </div> </div> );
1a6cfc594dd1f2205a67ae4da8de02785d888c2b
src/kit/ui/CollectionComponent.js
src/kit/ui/CollectionComponent.js
import { Component } from 'substance' import ContainerEditor from './_ContainerEditor' import ValueComponent from './ValueComponent' import renderNode from './_renderNode' /** * A component that renders a CHILDREN value. * * Note: I decided to use the name Collection here as from the application point of view a CHILDREN field is a collection. */ export default class CollectionComponent extends Component { render ($$) { const props = this.props const model = props.model let renderAsContainer if (props.hasOwnProperty('container')) { renderAsContainer = Boolean(props.container) } else { renderAsContainer = model.getSchema().isContainer() } if (renderAsContainer) { return $$(EditableCollection, Object.assign({}, props, { containerPath: props.model.getPath() })) } else { return $$(ReadOnlyCollection, props) } } } class ReadOnlyCollection extends ValueComponent { // NOTE: this is less efficient than ContainerEditor as it will always render the whole collection render ($$) { let props = this.props let model = props.model let el = $$('div').addClass('sc-collection').attr('data-id', model.getPath().join('.')) let items = model.getItems() el.append( items.map(item => renderNode($$, this, item, { disabled: props.disabled }).ref(item.id)) ) return el } } class EditableCollection extends ContainerEditor { _getClassNames () { return 'sc-collection sc-container-editor sc-surface' } }
import { Component } from 'substance' import ContainerEditor from './_ContainerEditor' import ValueComponent from './ValueComponent' import renderNode from './_renderNode' /** * A component that renders a CHILDREN value. * * Note: I decided to use the name Collection here as from the application point of view a CHILDREN field is a collection. */ export default class CollectionComponent extends Component { render ($$) { const props = this.props const model = props.model let renderAsContainer if (props.hasOwnProperty('container')) { renderAsContainer = Boolean(props.container) } else { renderAsContainer = model.getSchema().isContainer() } if (renderAsContainer) { return $$(EditableCollection, Object.assign({}, props, { containerPath: props.model.getPath() })) } else { return $$(ReadOnlyCollection, props) } } } class ReadOnlyCollection extends ValueComponent { // NOTE: this is less efficient than ContainerEditor as it will always render the whole collection render ($$) { let props = this.props let model = props.model let el = $$('div').addClass('sc-collection').attr('data-id', model.getPath().join('.')) let items = model.getItems() el.append( items.map(item => renderNode($$, this, item, { disabled: props.disabled }).ref(item.id)) ) return el } } class EditableCollection extends ContainerEditor { _getClassNames () { return 'sc-collection sc-container-editor sc-surface' } isDisabled () { return this.props.disabled || this.props.readOnly } }
Allow to use 'readOnly' as configuration value for container properties.
Allow to use 'readOnly' as configuration value for container properties.
JavaScript
mit
substance/texture,substance/texture
--- +++ @@ -46,4 +46,8 @@ _getClassNames () { return 'sc-collection sc-container-editor sc-surface' } + + isDisabled () { + return this.props.disabled || this.props.readOnly + } }
b7c57b4ad3739a37d8535231578c78c1582402ec
rubyzome/api/rubyzome.js
rubyzome/api/rubyzome.js
// general action // f_ok(data, textStatus, XMLHttpRequest) // f_err(XMLHttpRequest,textStatus, errorThrown) function general_action( type, url, params, f_ok, f_err ) { $.ajax({ type: type, url: url, data: params, success: f_ok, error: f_err }); } function create(url, params, f_ok, f_err) { return general_action( "POST", url, params, f_ok, f_err); } function list(url, params, f_ok, f_err) { return general_action( "GET", url, params, f_ok, f_err); } function show(url, params, f_ok, f_err) { return general_action( "GET", url, params, f_ok, f_err); } function update(url, params, f_ok, f_err) { return general_action( "PUT", url, params, f_ok, f_err); } function rest_delete(url, params, f_ok, f_err) { return general_action( "DELETE", url, params, f_ok, f_err); }
// general action // f_ok(data, textStatus, XMLHttpRequest) // f_err(XMLHttpRequest,textStatus, errorThrown) function general_action( type, url, params, f_ok, f_err ) { $.ajax({ type: type, url: url+'.json', data: params, success: f_ok, error: f_err }); } function create(url, params, f_ok, f_err) { return general_action( "POST", url, params, f_ok, f_err); } function list(url, params, f_ok, f_err) { return general_action( "GET", url, params, f_ok, f_err); } function show(url, params, f_ok, f_err) { return general_action( "GET", url, params, f_ok, f_err); } function update(url, params, f_ok, f_err) { return general_action( "PUT", url, params, f_ok, f_err); } function rest_delete(url, params, f_ok, f_err) { return general_action( "DELETE", url, params, f_ok, f_err); }
Use json by default for js library
Use json by default for js library
JavaScript
mit
yogsototh/rubyzome_framework,yogsototh/rubyzome_framework,yogsototh/rubyzome_framework,yogsototh/rubyzome_framework
--- +++ @@ -4,7 +4,7 @@ function general_action( type, url, params, f_ok, f_err ) { $.ajax({ type: type, - url: url, + url: url+'.json', data: params, success: f_ok, error: f_err
0c1b62fef00487e1d115adc34021632d77910d9f
assets/js/components/adminbar/AdminBarZeroData.js
assets/js/components/adminbar/AdminBarZeroData.js
/** * Admin Bar Zero Data component. * * Site Kit by Google, Copyright 2021 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 * * https://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. */ /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; const AdminBarZeroData = () => { return ( <div> <p className="googlesitekit-adminbar__subtitle googlesitekit-font-weight-bold"> { __( 'No data available yet', 'google-site-kit' ) } </p> <p className="googlesitekit-adminbar__subtitle"> { __( 'There is no data available for this content yet. This could be because it was recently created or because nobody has accessed it so far.', 'google-site-kit' ) } </p> </div> ); }; export default AdminBarZeroData;
/** * Admin Bar Zero Data component. * * Site Kit by Google, Copyright 2021 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 * * https://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. */ /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; const AdminBarZeroData = () => { return ( <div> <div className="googlesitekit-adminbar__subtitle googlesitekit-font-weight-bold"> { __( 'No data available yet', 'google-site-kit' ) } </div> <div className="googlesitekit-adminbar__subtitle"> { __( 'There is no data available for this content yet. This could be because it was recently created or because nobody has accessed it so far.', 'google-site-kit' ) } </div> </div> ); }; export default AdminBarZeroData;
Use divs to avoid inheriting paragraph styles.
Use divs to avoid inheriting paragraph styles.
JavaScript
apache-2.0
google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp
--- +++ @@ -24,12 +24,12 @@ const AdminBarZeroData = () => { return ( <div> - <p className="googlesitekit-adminbar__subtitle googlesitekit-font-weight-bold"> + <div className="googlesitekit-adminbar__subtitle googlesitekit-font-weight-bold"> { __( 'No data available yet', 'google-site-kit' ) } - </p> - <p className="googlesitekit-adminbar__subtitle"> + </div> + <div className="googlesitekit-adminbar__subtitle"> { __( 'There is no data available for this content yet. This could be because it was recently created or because nobody has accessed it so far.', 'google-site-kit' ) } - </p> + </div> </div> ); };
292d030fbc3048bf2c98c4d414537681f5d3493a
src/routes.js
src/routes.js
import React from 'react'; import {IndexRoute, Route} from 'react-router'; import { isLoaded as isAuthLoaded, load as loadAuth } from 'redux/modules/auth'; import { App, Chat, Home, Widgets, About, Login, LoginSuccess, Survey, NotFound, } from 'containers'; export default (store) => { const requireLogin = (nextState, replaceState, cb) => { function checkAuth() { const { auth: { user }} = store.getState(); if (!user) { // oops, not logged in, so can't be here! replaceState(null, '/'); } cb(); } if (!isAuthLoaded(store.getState())) { store.dispatch(loadAuth()).then(checkAuth); } else { checkAuth(); } }; return ( <Route path="/" component={App}> <IndexRoute component={Home}/> <Route path="widgets" component={Widgets}/> <Route path="about" component={About}/> <Route path="login" component={Login}/> <Route onEnter={requireLogin}> <Route path="chat" component={Chat}/> <Route path="loginSuccess" component={LoginSuccess}/> </Route> <Route path="survey" component={Survey}/> <Route path="*" component={NotFound} status={404} /> </Route> ); };
import React from 'react'; import {IndexRoute, Route} from 'react-router'; import { isLoaded as isAuthLoaded, load as loadAuth } from 'redux/modules/auth'; import { App, Chat, Home, Widgets, About, Login, LoginSuccess, Survey, NotFound, } from 'containers'; export default (store) => { const requireLogin = (nextState, replaceState, cb) => { function checkAuth() { const { auth: { user }} = store.getState(); if (!user) { // oops, not logged in, so can't be here! replaceState(null, '/'); } cb(); } if (!isAuthLoaded(store.getState())) { store.dispatch(loadAuth()).then(checkAuth); } else { checkAuth(); } }; /** * Please keep routes in alphabetical order */ return ( <Route path="/" component={App}> { /* Home (main) route */ } <IndexRoute component={Home}/> { /* Routes requiring login */ } <Route onEnter={requireLogin}> <Route path="chat" component={Chat}/> <Route path="loginSuccess" component={LoginSuccess}/> </Route> { /* Routes */ } <Route path="about" component={About}/> <Route path="login" component={Login}/> <Route path="survey" component={Survey}/> <Route path="widgets" component={Widgets}/> { /* Catch all route */ } <Route path="*" component={NotFound} status={404} /> </Route> ); };
Use alphabetical route order for easier merging
Use alphabetical route order for easier merging
JavaScript
mit
Boelensman1/championpick2
--- +++ @@ -31,17 +31,27 @@ } }; + /** + * Please keep routes in alphabetical order + */ return ( <Route path="/" component={App}> + { /* Home (main) route */ } <IndexRoute component={Home}/> - <Route path="widgets" component={Widgets}/> - <Route path="about" component={About}/> - <Route path="login" component={Login}/> + + { /* Routes requiring login */ } <Route onEnter={requireLogin}> <Route path="chat" component={Chat}/> <Route path="loginSuccess" component={LoginSuccess}/> </Route> + + { /* Routes */ } + <Route path="about" component={About}/> + <Route path="login" component={Login}/> <Route path="survey" component={Survey}/> + <Route path="widgets" component={Widgets}/> + + { /* Catch all route */ } <Route path="*" component={NotFound} status={404} /> </Route> );
62f13a4a58f0e5b8f5271c850608da180e5e34bb
examples/official-storybook/webpack.config.js
examples/official-storybook/webpack.config.js
const path = require('path'); module.exports = async ({ config }) => ({ ...config, module: { ...config.module, rules: [ ...config.module.rules, { test: /\.stories\.jsx?$/, use: require.resolve('@storybook/addon-storysource/loader'), include: [ path.resolve(__dirname, './stories'), path.resolve(__dirname, '../../lib/ui/src'), path.resolve(__dirname, '../../lib/components/src'), ], enforce: 'pre', }, { test: /\.js/, use: config.module.rules[0].use, include: [ path.resolve(__dirname, '../../lib/ui/src'), path.resolve(__dirname, '../../lib/components/src'), ], }, { test: /\.tsx?$/, use: [ { loader: require.resolve('ts-loader'), }, ], }, ], }, resolve: { ...config.resolve, extensions: [...(config.resolve.extensions || []), '.ts', '.tsx'], }, });
const path = require('path'); module.exports = async ({ config }) => ({ ...config, module: { ...config.module, rules: [ ...config.module.rules.slice(1), { test: /\.(mjs|jsx?|tsx?)$/, use: [ { loader: 'babel-loader', options: { cacheDirectory: '/Users/dev/Projects/GitHub/storybook/core/examples/official-storybook/node_modules/.cache/storybook', presets: [ ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: 2 }], '@babel/preset-typescript', ['babel-preset-minify', { builtIns: false, mangle: false }], '@babel/preset-react', '@babel/preset-flow', ], plugins: [ '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-class-properties', '@babel/plugin-syntax-dynamic-import', ['babel-plugin-emotion', { sourceMap: true, autoLabel: true }], 'babel-plugin-macros', '@babel/plugin-transform-react-constant-elements', 'babel-plugin-add-react-displayname', [ 'babel-plugin-react-docgen', { DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES' }, ], ], }, }, ], exclude: [/node_modules/, /dist/], }, { test: /\.stories\.jsx?$/, use: require.resolve('@storybook/addon-storysource/loader'), include: [ path.resolve(__dirname, './stories'), path.resolve(__dirname, '../../lib/ui/src'), path.resolve(__dirname, '../../lib/components/src'), ], enforce: 'pre', }, ], }, resolve: { ...config.resolve, extensions: [...(config.resolve.extensions || []), '.ts', '.tsx'], }, });
CHANGE the loader for most code in the official example, unify js & ts loading
CHANGE the loader for most code in the official example, unify js & ts loading
JavaScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook
--- +++ @@ -5,7 +5,40 @@ module: { ...config.module, rules: [ - ...config.module.rules, + ...config.module.rules.slice(1), + { + test: /\.(mjs|jsx?|tsx?)$/, + use: [ + { + loader: 'babel-loader', + options: { + cacheDirectory: + '/Users/dev/Projects/GitHub/storybook/core/examples/official-storybook/node_modules/.cache/storybook', + presets: [ + ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: 2 }], + '@babel/preset-typescript', + ['babel-preset-minify', { builtIns: false, mangle: false }], + '@babel/preset-react', + '@babel/preset-flow', + ], + plugins: [ + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-proposal-class-properties', + '@babel/plugin-syntax-dynamic-import', + ['babel-plugin-emotion', { sourceMap: true, autoLabel: true }], + 'babel-plugin-macros', + '@babel/plugin-transform-react-constant-elements', + 'babel-plugin-add-react-displayname', + [ + 'babel-plugin-react-docgen', + { DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES' }, + ], + ], + }, + }, + ], + exclude: [/node_modules/, /dist/], + }, { test: /\.stories\.jsx?$/, use: require.resolve('@storybook/addon-storysource/loader'), @@ -16,22 +49,6 @@ ], enforce: 'pre', }, - { - test: /\.js/, - use: config.module.rules[0].use, - include: [ - path.resolve(__dirname, '../../lib/ui/src'), - path.resolve(__dirname, '../../lib/components/src'), - ], - }, - { - test: /\.tsx?$/, - use: [ - { - loader: require.resolve('ts-loader'), - }, - ], - }, ], }, resolve: {
2162824829d990d1751c3ecb7635c176ae9522d3
packages/runtime/scripts/emscripten-installer.js
packages/runtime/scripts/emscripten-installer.js
const fs = require("fs"); const path = require("path"); const dependencyUtils = require("../../compiler/scripts/dependency-utils"); const EMSCRIPTEN_GIT_URL = "https://github.com/kripken/emscripten.git"; // TODO Switch to emsdk if web assembly backend is included function buildEmscripten(directory) { console.log("Build Emscripten"); const emscriptenDirectory = path.join(directory, "emscripten"); dependencyUtils.gitCloneOrPull(EMSCRIPTEN_GIT_URL, emscriptenDirectory); // dependencyUtils.exec("git -C %s checkout incoming", emscriptenDirectory); dependencyUtils.exec("git -C %s checkout d1a1fc121b7d6aab9adcb0c418453d48be318754", emscriptenDirectory); // use last working until #23 is fixed return emscriptenDirectory; } function install(directory) { if (process.env.EMSCRIPTEN) { fs.symlinkSync(process.env.EMSCRIPTEN, path.join(directory, "emscripten"), "directory"); return process.env.EMSCRIPTEN; } return buildEmscripten(directory); } module.exports = { install: install };
const fs = require("fs"); const path = require("path"); const dependencyUtils = require("../../compiler/scripts/dependency-utils"); const EMSCRIPTEN_GIT_URL = "https://github.com/kripken/emscripten.git"; // TODO Switch to emsdk if web assembly backend is included function buildEmscripten(directory) { console.log("Build Emscripten"); const emscriptenDirectory = path.join(directory, "emscripten"); dependencyUtils.gitCloneOrPull(EMSCRIPTEN_GIT_URL, emscriptenDirectory); dependencyUtils.exec("git -C %s checkout incoming", emscriptenDirectory); return emscriptenDirectory; } function install(directory) { if (process.env.EMSCRIPTEN) { fs.symlinkSync(process.env.EMSCRIPTEN, path.join(directory, "emscripten"), "directory"); return process.env.EMSCRIPTEN; } return buildEmscripten(directory); } module.exports = { install: install };
Switch back to emscripten incoming
Switch back to emscripten incoming Fixes #23
JavaScript
mit
MichaReiser/speedy.js,MichaReiser/speedy.js,MichaReiser/speedy.js,MichaReiser/speedy.js,MichaReiser/speedy.js,MichaReiser/speedy.js
--- +++ @@ -9,8 +9,7 @@ console.log("Build Emscripten"); const emscriptenDirectory = path.join(directory, "emscripten"); dependencyUtils.gitCloneOrPull(EMSCRIPTEN_GIT_URL, emscriptenDirectory); - // dependencyUtils.exec("git -C %s checkout incoming", emscriptenDirectory); - dependencyUtils.exec("git -C %s checkout d1a1fc121b7d6aab9adcb0c418453d48be318754", emscriptenDirectory); // use last working until #23 is fixed + dependencyUtils.exec("git -C %s checkout incoming", emscriptenDirectory); return emscriptenDirectory; }
bb101f3fd5a1585d237b947ef7a00a06ad845708
src/modules/client/client-base.js
src/modules/client/client-base.js
/* @flow */ import './polyfills/requestIdleCallback'; import '../store/stateManager'; import '../store/storeHelpers'; import '../gcm/gcm-client'; import '../history/history-client'; import '../location/location-client'; import '../presence/presence-client'; import '../session/session-client'; import '../socket/socket-client'; if (process.env.NODE_ENV !== 'production') { require('../client-test/client-test'); }
/* @flow */ import './polyfills/requestIdleCallback'; import '../gcm/gcm-client'; import '../history/history-client'; import '../location/location-client'; import '../presence/presence-client'; import '../session/session-client'; import '../socket/socket-client'; import '../store/storeHelpers'; import '../store/stateManager'; if (process.env.NODE_ENV !== 'production') { require('../client-test/client-test'); }
Initialize state after listeners are added
Initialize state after listeners are added
JavaScript
agpl-3.0
belng/pure,Anup-Allamsetty/pure,scrollback/pure,belng/pure,Anup-Allamsetty/pure,scrollback/pure,Anup-Allamsetty/pure,scrollback/pure,Anup-Allamsetty/pure,scrollback/pure,belng/pure,belng/pure
--- +++ @@ -1,9 +1,6 @@ /* @flow */ import './polyfills/requestIdleCallback'; - -import '../store/stateManager'; -import '../store/storeHelpers'; import '../gcm/gcm-client'; import '../history/history-client'; @@ -12,6 +9,9 @@ import '../session/session-client'; import '../socket/socket-client'; +import '../store/storeHelpers'; +import '../store/stateManager'; + if (process.env.NODE_ENV !== 'production') { require('../client-test/client-test'); }
4dcbd25f4dd6c2de5fe23e1b7441100cb5659c43
app/models/route-label.js
app/models/route-label.js
import Ember from 'ember'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; export default Model.extend({ routeNumber: attr('number'), routeName: attr('string'), });
import Model from 'ember-data/model'; import attr from 'ember-data/attr'; export default Model.extend({ routeNumber: attr('number'), routeName: attr('string'), });
Switch to 'ridership' name for property in sparkline data.
Switch to 'ridership' name for property in sparkline data.
JavaScript
mit
jga/capmetrics-web,jga/capmetrics-web
--- +++ @@ -1,4 +1,3 @@ -import Ember from 'ember'; import Model from 'ember-data/model'; import attr from 'ember-data/attr';
ba55570a360defbfc9a344e86db64aa4679dc54b
widdershins.js
widdershins.js
var fs = require('fs'); var path = require('path'); var yaml = require('js-yaml'); var converter = require('./index.js'); var argv = require('yargs') .usage('widdershins [options] {input-spec} [output markdown]') .demand(1) .strict() .boolean('yaml') .alias('y','yaml') .describe('yaml','Load spec in yaml format, default json') .boolean('code') .alias('c','code') .describe('code','Turn generic code samples off') .boolean('lang') .alias('l','lang') .describe('lang','Automatically generate list of languages for code samples') .help('h') .alias('h', 'help') .version(function() { return require('./package.json').version; }) .argv; var swagger = {}; if (argv.yaml) { var s = fs.readFileSync(path.resolve(argv._[0]),'utf8'); swagger = yaml.safeLoad(s); } else { swagger = require(path.resolve(argv._[0])); } var options = {}; options.codeSamples = !argv.code; if (argv.lang) options.language_tabs = []; var output = converter.convert(swagger,options); if (argv._.length>1) { fs.writeFileSync(path.resolve(argv._[1]),output,'utf8'); } else { console.log(output); }
var fs = require('fs'); var path = require('path'); var yaml = require('js-yaml'); var converter = require('./index.js'); var argv = require('yargs') .usage('widdershins [options] {input-spec} [[-o] output markdown]') .demand(1) .strict() .boolean('yaml') .alias('y','yaml') .describe('yaml','Load spec in yaml format, default json') .boolean('code') .alias('c','code') .describe('code','Turn generic code samples off') .boolean('lang') .alias('l','lang') .describe('lang','Automatically generate list of languages for code samples') .string('outfile') .alias('o','outfile') .describe('outfile','file to write output markdown to') .help('h') .alias('h', 'help') .version(function() { return require('./package.json').version; }) .argv; var swagger = {}; if (argv.yaml) { var s = fs.readFileSync(path.resolve(argv._[0]),'utf8'); swagger = yaml.safeLoad(s); } else { swagger = require(path.resolve(argv._[0])); } var options = {}; options.codeSamples = !argv.code; if (argv.lang) options.language_tabs = []; var output = converter.convert(swagger,options); var outfile = argv.outfile||argv._[1]; if (outfile) { fs.writeFileSync(path.resolve(outfile),output,'utf8'); } else { console.log(output); }
Add -o / --outfile option
Add -o / --outfile option
JavaScript
mit
rbarilani/widdershins,Mermade/widdershins,Mermade/widdershins
--- +++ @@ -6,7 +6,7 @@ var converter = require('./index.js'); var argv = require('yargs') - .usage('widdershins [options] {input-spec} [output markdown]') + .usage('widdershins [options] {input-spec} [[-o] output markdown]') .demand(1) .strict() .boolean('yaml') @@ -18,6 +18,9 @@ .boolean('lang') .alias('l','lang') .describe('lang','Automatically generate list of languages for code samples') + .string('outfile') + .alias('o','outfile') + .describe('outfile','file to write output markdown to') .help('h') .alias('h', 'help') .version(function() { @@ -40,8 +43,9 @@ var output = converter.convert(swagger,options); -if (argv._.length>1) { - fs.writeFileSync(path.resolve(argv._[1]),output,'utf8'); +var outfile = argv.outfile||argv._[1]; +if (outfile) { + fs.writeFileSync(path.resolve(outfile),output,'utf8'); } else { console.log(output);
a40a6273953c0e18eddcd67919754814461c5dd4
packages/spacebars-compiler/package.js
packages/spacebars-compiler/package.js
Package.describe({ summary: "Compiler for Spacebars template language" }); Package.on_use(function (api) { api.use('spacebars-common'); api.imply('spacebars-common'); // we attach stuff to the global symbol `HTML`, exported // by `htmljs` via `html-tools`, so we both use and effectively // imply it. api.use('html-tools'); api.imply('html-tools'); api.use('underscore'); api.use('minifiers', ['server']); api.add_files(['tokens.js', 'tojs.js', 'templatetag.js', 'spacebars-compiler.js']); }); Package.on_test(function (api) { api.use('underscore'); api.use('spacebars'); api.use('spacebars-compiler'); api.use('tinytest'); api.add_files('spacebars_tests.js'); api.add_files('compile_tests.js'); api.add_files('token_tests.js'); });
Package.describe({ summary: "Compiler for Spacebars template language" }); Package.on_use(function (api) { api.use('spacebars-common'); api.imply('spacebars-common'); // we attach stuff to the global symbol `HTML`, exported // by `htmljs` via `html-tools`, so we both use and effectively // imply it. api.use('html-tools'); api.imply('html-tools'); api.use('underscore'); api.use('minifiers', ['server']); api.add_files(['tokens.js', 'tojs.js', 'templatetag.js', 'spacebars-compiler.js']); }); Package.on_test(function (api) { api.use('underscore'); api.use('spacebars-compiler'); api.use('tinytest'); api.add_files('spacebars_tests.js'); api.add_files('compile_tests.js'); api.add_files('token_tests.js'); });
Remove spacebars-compiler -> spacebars test dependency.
Remove spacebars-compiler -> spacebars test dependency. This fixes a circular build-time dependency when building test slices.
JavaScript
mit
michielvanoeffelen/meteor,benstoltz/meteor,dboyliao/meteor,yyx990803/meteor,DCKT/meteor,skarekrow/meteor,meonkeys/meteor,kengchau/meteor,youprofit/meteor,brdtrpp/meteor,jenalgit/meteor,kengchau/meteor,esteedqueen/meteor,vacjaliu/meteor,lieuwex/meteor,lpinto93/meteor,aramk/meteor,qscripter/meteor,GrimDerp/meteor,dandv/meteor,benstoltz/meteor,justintung/meteor,namho102/meteor,brdtrpp/meteor,Profab/meteor,karlito40/meteor,johnthepink/meteor,lorensr/meteor,aramk/meteor,Paulyoufu/meteor-1,joannekoong/meteor,karlito40/meteor,udhayam/meteor,youprofit/meteor,chiefninew/meteor,codingang/meteor,framewr/meteor,wmkcc/meteor,dev-bobsong/meteor,lorensr/meteor,paul-barry-kenzan/meteor,h200863057/meteor,aramk/meteor,dboyliao/meteor,PatrickMcGuinness/meteor,eluck/meteor,DCKT/meteor,kidaa/meteor,aldeed/meteor,akintoey/meteor,imanmafi/meteor,mauricionr/meteor,sdeveloper/meteor,chasertech/meteor,shmiko/meteor,whip112/meteor,jeblister/meteor,allanalexandre/meteor,evilemon/meteor,aleclarson/meteor,emmerge/meteor,pandeysoni/meteor,saisai/meteor,papimomi/meteor,arunoda/meteor,D1no/meteor,daltonrenaldo/meteor,shrop/meteor,DAB0mB/meteor,benjamn/meteor,ericterpstra/meteor,servel333/meteor,ljack/meteor,chinasb/meteor,Ken-Liu/meteor,jenalgit/meteor,lorensr/meteor,jg3526/meteor,baiyunping333/meteor,williambr/meteor,ericterpstra/meteor,oceanzou123/meteor,papimomi/meteor,saisai/meteor,sdeveloper/meteor,baysao/meteor,AnthonyAstige/meteor,Jonekee/meteor,codedogfish/meteor,yalexx/meteor,lawrenceAIO/meteor,lpinto93/meteor,alexbeletsky/meteor,aleclarson/meteor,akintoey/meteor,sunny-g/meteor,DCKT/meteor,jagi/meteor,DCKT/meteor,cbonami/meteor,justintung/meteor,esteedqueen/meteor,newswim/meteor,namho102/meteor,mauricionr/meteor,benstoltz/meteor,planet-training/meteor,cog-64/meteor,Urigo/meteor,ndarilek/meteor,shadedprofit/meteor,shrop/meteor,Ken-Liu/meteor,SeanOceanHu/meteor,sdeveloper/meteor,saisai/meteor,newswim/meteor,daltonrenaldo/meteor,servel333/meteor,ericterpstra/meteor,cog-64/meteor,mauricionr/meteor,meonkeys/meteor,hristaki/meteor,cherbst/meteor,cog-64/meteor,devgrok/meteor,papimomi/meteor,somallg/meteor,Jeremy017/meteor,shadedprofit/meteor,h200863057/meteor,rabbyalone/meteor,sitexa/meteor,cherbst/meteor,iman-mafi/meteor,Quicksteve/meteor,framewr/meteor,Profab/meteor,brdtrpp/meteor,chinasb/meteor,steedos/meteor,rozzzly/meteor,mauricionr/meteor,yanisIk/meteor,yonglehou/meteor,newswim/meteor,lieuwex/meteor,aldeed/meteor,Hansoft/meteor,TechplexEngineer/meteor,cbonami/meteor,mauricionr/meteor,JesseQin/meteor,calvintychan/meteor,namho102/meteor,DCKT/meteor,servel333/meteor,devgrok/meteor,servel333/meteor,4commerce-technologies-AG/meteor,chinasb/meteor,calvintychan/meteor,skarekrow/meteor,TribeMedia/meteor,elkingtonmcb/meteor,daltonrenaldo/meteor,stevenliuit/meteor,luohuazju/meteor,Paulyoufu/meteor-1,Urigo/meteor,yonas/meteor-freebsd,lassombra/meteor,neotim/meteor,yiliaofan/meteor,cherbst/meteor,akintoey/meteor,eluck/meteor,daslicht/meteor,mjmasn/meteor,dboyliao/meteor,udhayam/meteor,iman-mafi/meteor,vacjaliu/meteor,TribeMedia/meteor,modulexcite/meteor,PatrickMcGuinness/meteor,shadedprofit/meteor,guazipi/meteor,pandeysoni/meteor,paul-barry-kenzan/meteor,chinasb/meteor,brettle/meteor,chiefninew/meteor,pjump/meteor,allanalexandre/meteor,msavin/meteor,Paulyoufu/meteor-1,shadedprofit/meteor,dfischer/meteor,HugoRLopes/meteor,cherbst/meteor,daslicht/meteor,4commerce-technologies-AG/meteor,cog-64/meteor,ndarilek/meteor,saisai/meteor,baysao/meteor,DAB0mB/meteor,ndarilek/meteor,DAB0mB/meteor,neotim/meteor,colinligertwood/meteor,pjump/meteor,Profab/meteor,chasertech/meteor,yanisIk/meteor,TribeMedia/meteor,shmiko/meteor,rabbyalone/meteor,Urigo/meteor,queso/meteor,AnthonyAstige/meteor,iman-mafi/meteor,yyx990803/meteor,D1no/meteor,h200863057/meteor,daltonrenaldo/meteor,Prithvi-A/meteor,Eynaliyev/meteor,colinligertwood/meteor,paul-barry-kenzan/meteor,juansgaitan/meteor,kencheung/meteor,Profab/meteor,Eynaliyev/meteor,TechplexEngineer/meteor,zdd910/meteor,katopz/meteor,Theviajerock/meteor,chmac/meteor,AnjirHossain/meteor,D1no/meteor,baiyunping333/meteor,yyx990803/meteor,yanisIk/meteor,GrimDerp/meteor,dboyliao/meteor,elkingtonmcb/meteor,mirstan/meteor,Prithvi-A/meteor,mauricionr/meteor,shrop/meteor,justintung/meteor,aldeed/meteor,saisai/meteor,qscripter/meteor,sdeveloper/meteor,yonas/meteor-freebsd,whip112/meteor,Quicksteve/meteor,udhayam/meteor,yalexx/meteor,lpinto93/meteor,williambr/meteor,aramk/meteor,servel333/meteor,johnthepink/meteor,akintoey/meteor,shadedprofit/meteor,shmiko/meteor,msavin/meteor,codingang/meteor,jenalgit/meteor,ljack/meteor,mubassirhayat/meteor,brettle/meteor,dfischer/meteor,karlito40/meteor,fashionsun/meteor,msavin/meteor,sclausen/meteor,cbonami/meteor,sclausen/meteor,jg3526/meteor,HugoRLopes/meteor,meonkeys/meteor,jagi/meteor,Theviajerock/meteor,chiefninew/meteor,michielvanoeffelen/meteor,AnthonyAstige/meteor,cog-64/meteor,dev-bobsong/meteor,oceanzou123/meteor,AlexR1712/meteor,alphanso/meteor,katopz/meteor,oceanzou123/meteor,yonglehou/meteor,hristaki/meteor,yyx990803/meteor,LWHTarena/meteor,HugoRLopes/meteor,judsonbsilva/meteor,newswim/meteor,chiefninew/meteor,bhargav175/meteor,kengchau/meteor,yinhe007/meteor,somallg/meteor,yiliaofan/meteor,ljack/meteor,Profab/meteor,modulexcite/meteor,Eynaliyev/meteor,Profab/meteor,colinligertwood/meteor,lieuwex/meteor,GrimDerp/meteor,Hansoft/meteor,queso/meteor,ndarilek/meteor,kengchau/meteor,steedos/meteor,joannekoong/meteor,wmkcc/meteor,ashwathgovind/meteor,hristaki/meteor,mirstan/meteor,lpinto93/meteor,ljack/meteor,dfischer/meteor,paul-barry-kenzan/meteor,eluck/meteor,TribeMedia/meteor,paul-barry-kenzan/meteor,D1no/meteor,msavin/meteor,dandv/meteor,AnthonyAstige/meteor,neotim/meteor,jirengu/meteor,nuvipannu/meteor,yiliaofan/meteor,JesseQin/meteor,mjmasn/meteor,devgrok/meteor,karlito40/meteor,JesseQin/meteor,cog-64/meteor,JesseQin/meteor,judsonbsilva/meteor,Jeremy017/meteor,chasertech/meteor,judsonbsilva/meteor,chengxiaole/meteor,Ken-Liu/meteor,ashwathgovind/meteor,tdamsma/meteor,henrypan/meteor,yinhe007/meteor,lorensr/meteor,wmkcc/meteor,benjamn/meteor,vjau/meteor,rabbyalone/meteor,deanius/meteor,jirengu/meteor,Hansoft/meteor,guazipi/meteor,mjmasn/meteor,sitexa/meteor,yinhe007/meteor,aldeed/meteor,HugoRLopes/meteor,ericterpstra/meteor,alexbeletsky/meteor,AnthonyAstige/meteor,ljack/meteor,Jeremy017/meteor,TribeMedia/meteor,alphanso/meteor,tdamsma/meteor,jenalgit/meteor,williambr/meteor,lawrenceAIO/meteor,udhayam/meteor,dev-bobsong/meteor,Paulyoufu/meteor-1,hristaki/meteor,yonglehou/meteor,pjump/meteor,sitexa/meteor,justintung/meteor,vjau/meteor,chinasb/meteor,chiefninew/meteor,ashwathgovind/meteor,tdamsma/meteor,yalexx/meteor,justintung/meteor,sunny-g/meteor,EduShareOntario/meteor,michielvanoeffelen/meteor,planet-training/meteor,somallg/meteor,alexbeletsky/meteor,sunny-g/meteor,yonas/meteor-freebsd,dfischer/meteor,IveWong/meteor,servel333/meteor,Hansoft/meteor,Jonekee/meteor,PatrickMcGuinness/meteor,karlito40/meteor,modulexcite/meteor,benjamn/meteor,deanius/meteor,kencheung/meteor,luohuazju/meteor,brdtrpp/meteor,Paulyoufu/meteor-1,ericterpstra/meteor,Theviajerock/meteor,sdeveloper/meteor,ashwathgovind/meteor,steedos/meteor,yonas/meteor-freebsd,nuvipannu/meteor,luohuazju/meteor,Urigo/meteor,chmac/meteor,brettle/meteor,modulexcite/meteor,shadedprofit/meteor,lieuwex/meteor,yiliaofan/meteor,vacjaliu/meteor,nuvipannu/meteor,TechplexEngineer/meteor,TechplexEngineer/meteor,aldeed/meteor,akintoey/meteor,stevenliuit/meteor,lawrenceAIO/meteor,yonglehou/meteor,colinligertwood/meteor,somallg/meteor,4commerce-technologies-AG/meteor,daltonrenaldo/meteor,jdivy/meteor,fashionsun/meteor,modulexcite/meteor,jg3526/meteor,EduShareOntario/meteor,ashwathgovind/meteor,jdivy/meteor,youprofit/meteor,shrop/meteor,alexbeletsky/meteor,AlexR1712/meteor,williambr/meteor,whip112/meteor,mubassirhayat/meteor,esteedqueen/meteor,planet-training/meteor,stevenliuit/meteor,aramk/meteor,kencheung/meteor,Profab/meteor,h200863057/meteor,evilemon/meteor,AnjirHossain/meteor,chasertech/meteor,kencheung/meteor,elkingtonmcb/meteor,meteor-velocity/meteor,baiyunping333/meteor,jeblister/meteor,jrudio/meteor,dandv/meteor,steedos/meteor,yanisIk/meteor,JesseQin/meteor,arunoda/meteor,Puena/meteor,lpinto93/meteor,newswim/meteor,dev-bobsong/meteor,Quicksteve/meteor,elkingtonmcb/meteor,LWHTarena/meteor,Puena/meteor,nuvipannu/meteor,Jeremy017/meteor,codedogfish/meteor,shmiko/meteor,Quicksteve/meteor,jrudio/meteor,somallg/meteor,alexbeletsky/meteor,ashwathgovind/meteor,guazipi/meteor,IveWong/meteor,framewr/meteor,somallg/meteor,arunoda/meteor,skarekrow/meteor,calvintychan/meteor,4commerce-technologies-AG/meteor,DAB0mB/meteor,jagi/meteor,fashionsun/meteor,h200863057/meteor,baysao/meteor,4commerce-technologies-AG/meteor,joannekoong/meteor,newswim/meteor,planet-training/meteor,dandv/meteor,stevenliuit/meteor,baysao/meteor,mirstan/meteor,Jonekee/meteor,stevenliuit/meteor,codingang/meteor,jirengu/meteor,guazipi/meteor,evilemon/meteor,zdd910/meteor,cbonami/meteor,alphanso/meteor,alexbeletsky/meteor,mjmasn/meteor,iman-mafi/meteor,brettle/meteor,Prithvi-A/meteor,mubassirhayat/meteor,planet-training/meteor,aleclarson/meteor,Theviajerock/meteor,planet-training/meteor,daltonrenaldo/meteor,eluck/meteor,chengxiaole/meteor,eluck/meteor,ndarilek/meteor,allanalexandre/meteor,baysao/meteor,chmac/meteor,yinhe007/meteor,brettle/meteor,sclausen/meteor,pandeysoni/meteor,yalexx/meteor,AnthonyAstige/meteor,ashwathgovind/meteor,williambr/meteor,benstoltz/meteor,kidaa/meteor,yyx990803/meteor,daslicht/meteor,jrudio/meteor,LWHTarena/meteor,lawrenceAIO/meteor,mirstan/meteor,kidaa/meteor,queso/meteor,tdamsma/meteor,l0rd0fwar/meteor,jagi/meteor,arunoda/meteor,sunny-g/meteor,yiliaofan/meteor,imanmafi/meteor,Theviajerock/meteor,Puena/meteor,dev-bobsong/meteor,dboyliao/meteor,bhargav175/meteor,Puena/meteor,codingang/meteor,aldeed/meteor,deanius/meteor,yiliaofan/meteor,bhargav175/meteor,udhayam/meteor,yanisIk/meteor,whip112/meteor,cbonami/meteor,papimomi/meteor,rabbyalone/meteor,allanalexandre/meteor,yyx990803/meteor,Ken-Liu/meteor,Theviajerock/meteor,yiliaofan/meteor,mirstan/meteor,judsonbsilva/meteor,wmkcc/meteor,johnthepink/meteor,l0rd0fwar/meteor,meteor-velocity/meteor,calvintychan/meteor,Puena/meteor,devgrok/meteor,mirstan/meteor,joannekoong/meteor,codingang/meteor,oceanzou123/meteor,karlito40/meteor,henrypan/meteor,Jeremy017/meteor,rozzzly/meteor,qscripter/meteor,SeanOceanHu/meteor,paul-barry-kenzan/meteor,zdd910/meteor,yinhe007/meteor,juansgaitan/meteor,pandeysoni/meteor,deanius/meteor,pandeysoni/meteor,chengxiaole/meteor,JesseQin/meteor,h200863057/meteor,IveWong/meteor,EduShareOntario/meteor,framewr/meteor,zdd910/meteor,jirengu/meteor,karlito40/meteor,jeblister/meteor,iman-mafi/meteor,jg3526/meteor,qscripter/meteor,vjau/meteor,bhargav175/meteor,AlexR1712/meteor,emmerge/meteor,juansgaitan/meteor,kencheung/meteor,juansgaitan/meteor,SeanOceanHu/meteor,juansgaitan/meteor,Ken-Liu/meteor,shrop/meteor,calvintychan/meteor,jdivy/meteor,baysao/meteor,benstoltz/meteor,kengchau/meteor,Quicksteve/meteor,HugoRLopes/meteor,meonkeys/meteor,chmac/meteor,D1no/meteor,arunoda/meteor,pjump/meteor,pjump/meteor,somallg/meteor,IveWong/meteor,zdd910/meteor,Eynaliyev/meteor,LWHTarena/meteor,aramk/meteor,iman-mafi/meteor,l0rd0fwar/meteor,meonkeys/meteor,youprofit/meteor,bhargav175/meteor,SeanOceanHu/meteor,allanalexandre/meteor,hristaki/meteor,imanmafi/meteor,DAB0mB/meteor,skarekrow/meteor,AnthonyAstige/meteor,sclausen/meteor,daslicht/meteor,Jeremy017/meteor,hristaki/meteor,mubassirhayat/meteor,PatrickMcGuinness/meteor,dandv/meteor,daslicht/meteor,yonglehou/meteor,rabbyalone/meteor,jrudio/meteor,wmkcc/meteor,ljack/meteor,alexbeletsky/meteor,ndarilek/meteor,rozzzly/meteor,yinhe007/meteor,kidaa/meteor,chasertech/meteor,yanisIk/meteor,shadedprofit/meteor,GrimDerp/meteor,michielvanoeffelen/meteor,mjmasn/meteor,4commerce-technologies-AG/meteor,qscripter/meteor,codingang/meteor,esteedqueen/meteor,Puena/meteor,Eynaliyev/meteor,oceanzou123/meteor,EduShareOntario/meteor,brdtrpp/meteor,GrimDerp/meteor,arunoda/meteor,evilemon/meteor,ericterpstra/meteor,yyx990803/meteor,karlito40/meteor,allanalexandre/meteor,jeblister/meteor,wmkcc/meteor,shrop/meteor,cog-64/meteor,neotim/meteor,Hansoft/meteor,h200863057/meteor,LWHTarena/meteor,rabbyalone/meteor,saisai/meteor,tdamsma/meteor,modulexcite/meteor,queso/meteor,AnjirHossain/meteor,lawrenceAIO/meteor,sitexa/meteor,chinasb/meteor,TribeMedia/meteor,youprofit/meteor,Urigo/meteor,EduShareOntario/meteor,brettle/meteor,somallg/meteor,eluck/meteor,dandv/meteor,queso/meteor,yanisIk/meteor,steedos/meteor,servel333/meteor,jenalgit/meteor,lorensr/meteor,alphanso/meteor,vacjaliu/meteor,lieuwex/meteor,chasertech/meteor,eluck/meteor,jenalgit/meteor,D1no/meteor,vjau/meteor,sclausen/meteor,D1no/meteor,udhayam/meteor,eluck/meteor,evilemon/meteor,planet-training/meteor,codedogfish/meteor,kengchau/meteor,codingang/meteor,lassombra/meteor,tdamsma/meteor,papimomi/meteor,alphanso/meteor,vacjaliu/meteor,HugoRLopes/meteor,whip112/meteor,joannekoong/meteor,l0rd0fwar/meteor,williambr/meteor,sclausen/meteor,imanmafi/meteor,AnjirHossain/meteor,mjmasn/meteor,jg3526/meteor,l0rd0fwar/meteor,jeblister/meteor,planet-training/meteor,yonglehou/meteor,dev-bobsong/meteor,lpinto93/meteor,cherbst/meteor,brdtrpp/meteor,benjamn/meteor,luohuazju/meteor,katopz/meteor,Urigo/meteor,modulexcite/meteor,aldeed/meteor,lawrenceAIO/meteor,chengxiaole/meteor,papimomi/meteor,jenalgit/meteor,steedos/meteor,fashionsun/meteor,fashionsun/meteor,esteedqueen/meteor,hristaki/meteor,Jonekee/meteor,Prithvi-A/meteor,tdamsma/meteor,brdtrpp/meteor,evilemon/meteor,D1no/meteor,yonas/meteor-freebsd,pjump/meteor,devgrok/meteor,jagi/meteor,allanalexandre/meteor,yinhe007/meteor,Quicksteve/meteor,skarekrow/meteor,baysao/meteor,williambr/meteor,jdivy/meteor,jdivy/meteor,pandeysoni/meteor,sunny-g/meteor,joannekoong/meteor,Puena/meteor,ericterpstra/meteor,Jonekee/meteor,AnjirHossain/meteor,jirengu/meteor,l0rd0fwar/meteor,Urigo/meteor,imanmafi/meteor,meteor-velocity/meteor,AlexR1712/meteor,baiyunping333/meteor,meteor-velocity/meteor,LWHTarena/meteor,chiefninew/meteor,codedogfish/meteor,EduShareOntario/meteor,sdeveloper/meteor,PatrickMcGuinness/meteor,johnthepink/meteor,Eynaliyev/meteor,EduShareOntario/meteor,nuvipannu/meteor,Ken-Liu/meteor,qscripter/meteor,imanmafi/meteor,sdeveloper/meteor,kidaa/meteor,emmerge/meteor,ljack/meteor,Paulyoufu/meteor-1,namho102/meteor,emmerge/meteor,vjau/meteor,devgrok/meteor,newswim/meteor,yonas/meteor-freebsd,deanius/meteor,lawrenceAIO/meteor,akintoey/meteor,AnjirHossain/meteor,rabbyalone/meteor,chengxiaole/meteor,emmerge/meteor,wmkcc/meteor,Theviajerock/meteor,Prithvi-A/meteor,JesseQin/meteor,elkingtonmcb/meteor,luohuazju/meteor,framewr/meteor,sitexa/meteor,baiyunping333/meteor,Ken-Liu/meteor,cherbst/meteor,chiefninew/meteor,jg3526/meteor,lassombra/meteor,TechplexEngineer/meteor,henrypan/meteor,arunoda/meteor,AlexR1712/meteor,GrimDerp/meteor,baiyunping333/meteor,rozzzly/meteor,deanius/meteor,lassombra/meteor,TechplexEngineer/meteor,Quicksteve/meteor,dfischer/meteor,elkingtonmcb/meteor,brdtrpp/meteor,jagi/meteor,AnjirHossain/meteor,vjau/meteor,queso/meteor,shmiko/meteor,juansgaitan/meteor,framewr/meteor,juansgaitan/meteor,chiefninew/meteor,emmerge/meteor,allanalexandre/meteor,bhargav175/meteor,meteor-velocity/meteor,skarekrow/meteor,sitexa/meteor,namho102/meteor,ndarilek/meteor,oceanzou123/meteor,kencheung/meteor,Eynaliyev/meteor,ndarilek/meteor,daltonrenaldo/meteor,daslicht/meteor,neotim/meteor,IveWong/meteor,sclausen/meteor,yalexx/meteor,lorensr/meteor,SeanOceanHu/meteor,benjamn/meteor,IveWong/meteor,AnthonyAstige/meteor,johnthepink/meteor,deanius/meteor,justintung/meteor,queso/meteor,DAB0mB/meteor,mirstan/meteor,msavin/meteor,stevenliuit/meteor,jg3526/meteor,michielvanoeffelen/meteor,zdd910/meteor,evilemon/meteor,meteor-velocity/meteor,zdd910/meteor,benjamn/meteor,alphanso/meteor,chmac/meteor,steedos/meteor,johnthepink/meteor,kengchau/meteor,dev-bobsong/meteor,tdamsma/meteor,dboyliao/meteor,guazipi/meteor,colinligertwood/meteor,cbonami/meteor,neotim/meteor,mubassirhayat/meteor,jdivy/meteor,stevenliuit/meteor,judsonbsilva/meteor,judsonbsilva/meteor,brettle/meteor,michielvanoeffelen/meteor,4commerce-technologies-AG/meteor,ljack/meteor,colinligertwood/meteor,lieuwex/meteor,Jonekee/meteor,katopz/meteor,kidaa/meteor,daltonrenaldo/meteor,paul-barry-kenzan/meteor,kidaa/meteor,sunny-g/meteor,alphanso/meteor,dboyliao/meteor,vacjaliu/meteor,Jeremy017/meteor,chmac/meteor,meteor-velocity/meteor,vacjaliu/meteor,daslicht/meteor,jagi/meteor,udhayam/meteor,yalexx/meteor,mjmasn/meteor,aramk/meteor,lorensr/meteor,katopz/meteor,pjump/meteor,henrypan/meteor,guazipi/meteor,youprofit/meteor,sunny-g/meteor,bhargav175/meteor,vjau/meteor,elkingtonmcb/meteor,codedogfish/meteor,nuvipannu/meteor,joannekoong/meteor,Prithvi-A/meteor,justintung/meteor,meonkeys/meteor,shrop/meteor,calvintychan/meteor,fashionsun/meteor,lassombra/meteor,sunny-g/meteor,imanmafi/meteor,whip112/meteor,katopz/meteor,baiyunping333/meteor,jeblister/meteor,LWHTarena/meteor,msavin/meteor,cbonami/meteor,Jonekee/meteor,fashionsun/meteor,devgrok/meteor,mauricionr/meteor,emmerge/meteor,benstoltz/meteor,shmiko/meteor,framewr/meteor,Paulyoufu/meteor-1,chmac/meteor,rozzzly/meteor,GrimDerp/meteor,namho102/meteor,neotim/meteor,jirengu/meteor,codedogfish/meteor,l0rd0fwar/meteor,mubassirhayat/meteor,chasertech/meteor,yalexx/meteor,DCKT/meteor,michielvanoeffelen/meteor,chengxiaole/meteor,servel333/meteor,IveWong/meteor,dandv/meteor,dfischer/meteor,judsonbsilva/meteor,luohuazju/meteor,henrypan/meteor,papimomi/meteor,benstoltz/meteor,nuvipannu/meteor,colinligertwood/meteor,DAB0mB/meteor,mubassirhayat/meteor,jeblister/meteor,cherbst/meteor,msavin/meteor,chinasb/meteor,johnthepink/meteor,Hansoft/meteor,PatrickMcGuinness/meteor,yanisIk/meteor,pandeysoni/meteor,jrudio/meteor,dboyliao/meteor,guazipi/meteor,HugoRLopes/meteor,esteedqueen/meteor,kencheung/meteor,henrypan/meteor,qscripter/meteor,iman-mafi/meteor,esteedqueen/meteor,AlexR1712/meteor,SeanOceanHu/meteor,mubassirhayat/meteor,SeanOceanHu/meteor,katopz/meteor,saisai/meteor,skarekrow/meteor,namho102/meteor,Hansoft/meteor,sitexa/meteor,lpinto93/meteor,PatrickMcGuinness/meteor,lassombra/meteor,oceanzou123/meteor,calvintychan/meteor,TechplexEngineer/meteor,luohuazju/meteor,rozzzly/meteor,dfischer/meteor,DCKT/meteor,akintoey/meteor,meonkeys/meteor,codedogfish/meteor,SeanOceanHu/meteor,yonas/meteor-freebsd,chengxiaole/meteor,TribeMedia/meteor,jdivy/meteor,jrudio/meteor,jirengu/meteor,lassombra/meteor,lieuwex/meteor,rozzzly/meteor,yonglehou/meteor,whip112/meteor,henrypan/meteor,Eynaliyev/meteor,AlexR1712/meteor,benjamn/meteor,HugoRLopes/meteor,alexbeletsky/meteor,youprofit/meteor,shmiko/meteor,Prithvi-A/meteor
--- +++ @@ -20,7 +20,6 @@ Package.on_test(function (api) { api.use('underscore'); - api.use('spacebars'); api.use('spacebars-compiler'); api.use('tinytest'); api.add_files('spacebars_tests.js');
2f3673021ca1020c341cf4bdef67f43dd8450119
scripts/facts.js
scripts/facts.js
module.exports = function(robot){ robot.facts = { sendFact: function(response){ var apiUrl = 'http://numbersapi.com/random', fact = ''; response.http(apiUrl).get()(function(err, res, body){ if (!!err) return; response.send('Did you know: ' + body + ' #bocbotfacts'); }); } }; robot.hear(/#(.*)fact/i, function(res){ robot.facts.sendFact(res); }); }
module.exports = function(robot){ robot.facts = { sendFact: function(response){ var apiUrl = 'http://numbersapi.com/random', fact = ''; response.http(apiUrl).get()(function(err, res, body){ if (!!err) return; response.send(body + ' #bocbotfacts'); }); } }; robot.hear(/#(.*)fact/i, function(res){ robot.facts.sendFact(res); }); }
Remove 'Did you know:' from beginning of fact
Remove 'Did you know:' from beginning of fact
JavaScript
mit
BallinOuttaControl/bocbot,BallinOuttaControl/bocbot
--- +++ @@ -7,7 +7,7 @@ response.http(apiUrl).get()(function(err, res, body){ if (!!err) return; - response.send('Did you know: ' + body + ' #bocbotfacts'); + response.send(body + ' #bocbotfacts'); }); } };
e4fa5754912ec1d0b94e668599030c9600422281
lib/auth/auth-key.js
lib/auth/auth-key.js
// telegram.link // Copyright 2014 Enrico Stara 'enrico.stara@gmail.com' // Released under the MIT License // https://github.com/enricostara/telegram-mt-node // AuthKey class // // This class represents the Authentication Key require('requirish')._(module); var utility = require('lib/utility'); function AuthKey(id, value) { this.id = id; this.value = value; } AuthKey.prototype.toString = function() { return '{ id:' + this.id.toString('hex') + ', value:' + this.value.toString('hex') + ' }'; }; // Export the class module.exports = exports = AuthKey;
// telegram.link // Copyright 2014 Enrico Stara 'enrico.stara@gmail.com' // Released under the MIT License // https://github.com/enricostara/telegram-mt-node // AuthKey class // // This class represents the Authentication Key require('requirish')._(module); var utility = require('lib/utility'); function AuthKey(id, value) { this.id = id; this.value = value; } AuthKey.prototype.toString = function() { return '{ id:' + this.id.toString('hex') + ', value:' + this.value.toString('hex') + ' }'; }; AuthKey.prototype.derivateAesKey = function(msgKey, fromServer) { var aKey = this.value; var x = fromServer ? 8 : 0; var sha1A = utility.createSHAHash(Buffer.concat([msgKey, aKey.slice(x, x + 32)], 48)); var sha1B = utility.createSHAHash(Buffer.concat([aKey.slice(x + 32, x + 48), msgKey, aKey.slice(x + 48, x + 64)], 48)); var sha1C = utility.createSHAHash(Buffer.concat([aKey.slice(x + 64, x + 96), msgKey], 48)); var sha1D = utility.createSHAHash(Buffer.concat([msgKey, aKey.slice(x + 96, x + 128)], 48)); return { key: Buffer.concat([sha1A.slice(0, 8), sha1B.slice(8, 20), sha1C.slice(4, 16)], 32), iv: Buffer.concat([sha1A.slice(8, 20), sha1B.slice(0, 8), sha1C.slice(16, 20), sha1D.slice(0, 8)], 32) } }; // Export the class module.exports = exports = AuthKey;
Add the KeyDerivationFunction to AuthKey
Add the KeyDerivationFunction to AuthKey
JavaScript
mit
enricostara/telegram-mt-node,piranna/telegram-mt-node,cgvarela/telegram-mt-node
--- +++ @@ -21,5 +21,18 @@ ' }'; }; +AuthKey.prototype.derivateAesKey = function(msgKey, fromServer) { + var aKey = this.value; + var x = fromServer ? 8 : 0; + var sha1A = utility.createSHAHash(Buffer.concat([msgKey, aKey.slice(x, x + 32)], 48)); + var sha1B = utility.createSHAHash(Buffer.concat([aKey.slice(x + 32, x + 48), msgKey, aKey.slice(x + 48, x + 64)], 48)); + var sha1C = utility.createSHAHash(Buffer.concat([aKey.slice(x + 64, x + 96), msgKey], 48)); + var sha1D = utility.createSHAHash(Buffer.concat([msgKey, aKey.slice(x + 96, x + 128)], 48)); + + return { + key: Buffer.concat([sha1A.slice(0, 8), sha1B.slice(8, 20), sha1C.slice(4, 16)], 32), + iv: Buffer.concat([sha1A.slice(8, 20), sha1B.slice(0, 8), sha1C.slice(16, 20), sha1D.slice(0, 8)], 32) + } +}; // Export the class module.exports = exports = AuthKey;
e3f29fef9cbd98d6fb68d49a396d6260e2797e39
lib/baseInterface.js
lib/baseInterface.js
var EventEmitter = require('events').EventEmitter; var Subscription = require('./subscription'); var ThoonkBaseInterface = function (thoonk) { EventEmitter.call(this); this.thoonk = thoonk; this.redis = this.thoonk.redis; }; ThoonkBaseInterface.prototype = Object.create(EventEmitter.prototype); ThoonkBaseInterface.constructor = ThoonkBaseInterface; (function () { this.handleEvent = function (channel, msg) { // Override this function in your object }; this.getEmitter = function (instance, eventHandler, cb) { var emitter = new Subscription(this, instance, eventHandler, function _subscribed(result) { cb(false, result); }); return emitter; }; this.runScript = function (scriptName, args, cb) { var self = this; cb = cb || function () {}; this.thoonk._runScriptSingle(this.objtype, scriptName, args, function (err, results) { if (err) { self.thoonk.logger.error(scriptName, err); } else { cb.apply(null, results); } }); }; }).call(ThoonkBaseInterface.prototype); module.exports = ThoonkBaseInterface;
var EventEmitter = require('events').EventEmitter; var Subscription = require('./subscription'); var ThoonkBaseInterface = function (thoonk) { EventEmitter.call(this); this.thoonk = thoonk; this.redis = this.thoonk.redis; }; ThoonkBaseInterface.prototype = Object.create(EventEmitter.prototype); ThoonkBaseInterface.constructor = ThoonkBaseInterface; (function () { this.handleEvent = function (channel, msg) { // Override this function in your object }; this.getEmitter = function (instance, eventHandler, cb) { var emitter = new Subscription(this, instance, eventHandler, function _subscribed(result) { cb(false, result); }); return emitter; }; this.runScript = function (scriptName, args, cb) { var self = this; cb = cb || function () {}; this.thoonk._runScriptSingle(this.objtype, scriptName, args, function (err, results) { if (err) { self.thoonk.logger.error(scriptName, err); cb(err); } else { cb.apply(null, results); } }); }; }).call(ThoonkBaseInterface.prototype); module.exports = ThoonkBaseInterface;
Fix error callbacks in interfaces
Fix error callbacks in interfaces
JavaScript
mit
andyet/thoonk.js
--- +++ @@ -33,6 +33,7 @@ this.thoonk._runScriptSingle(this.objtype, scriptName, args, function (err, results) { if (err) { self.thoonk.logger.error(scriptName, err); + cb(err); } else { cb.apply(null, results); }
a67a70ec7693081fa6aa1f94eb9e82cb22b4e7a4
lib/create-styled-component.js
lib/create-styled-component.js
import React from "react"; import R from "ramda"; import T from "prop-types"; export default function createStyledComponent(displayName, use) { return class StyledComponent extends React.Component { static displayName = displayName; static propTypes = { use: T.oneOfType([T.string, T.func]), visual: T.oneOfType([T.object, T.func]), animations: T.objectOf(T.object), children: T.node, }; static defaultProps = { use, visual: {}, }; static contextTypes = { renderer: T.object.isRequired, theme: T.object, }; renderClassName = (visual, animations) => { const { renderer, theme = {} } = this.context; if (typeof visual === "function") { return renderer.renderRule(visual, { animations: this.renderKeyframes(animations), theme, }); } return renderer.renderRule(() => visual); }; renderKeyframes = (animations = {}) => { const { renderer } = this.context; return R.map( animation => renderer.renderKeyframe(() => animation), animations ); }; render() { const { use: Component, visual, animations, ...props } = this.props; return ( <Component {...props} className={this.renderClassName(visual, animations)} /> ); } }; }
import React from "react"; import R from "ramda"; import T from "prop-types"; export default function createStyledComponent(displayName, use) { return class StyledComponent extends React.Component { static displayName = displayName; static propTypes = { use: T.oneOfType([T.string, T.func]), visual: T.oneOfType([T.object, T.func]), animations: T.objectOf(T.object), innerRef: T.func, children: T.node, }; static defaultProps = { use, visual: {}, }; static contextTypes = { renderer: T.object.isRequired, theme: T.object, }; renderClassName = (visual, animations) => { const { renderer, theme = {} } = this.context; if (typeof visual === "function") { return renderer.renderRule(visual, { animations: this.renderKeyframes(animations), theme, }); } return renderer.renderRule(() => visual); }; renderKeyframes = (animations = {}) => { const { renderer } = this.context; return R.map( animation => renderer.renderKeyframe(() => animation), animations ); }; render() { const { use: Component, visual, animations, innerRef, ...props } = this.props; const ref = innerRef ? { ref: r => innerRef(r) } : {} return ( <Component {...ref} {...props} className={this.renderClassName(visual, animations)} /> ); } }; }
Add support for "innerRef" prop
Add support for "innerRef" prop
JavaScript
mit
arturmuller/fela-components
--- +++ @@ -10,6 +10,7 @@ use: T.oneOfType([T.string, T.func]), visual: T.oneOfType([T.object, T.func]), animations: T.objectOf(T.object), + innerRef: T.func, children: T.node, }; @@ -44,9 +45,11 @@ }; render() { - const { use: Component, visual, animations, ...props } = this.props; + const { use: Component, visual, animations, innerRef, ...props } = this.props; + const ref = innerRef ? { ref: r => innerRef(r) } : {} return ( <Component + {...ref} {...props} className={this.renderClassName(visual, animations)} />
058a1e3a32b3dda08bb3f8cd3f3fc695b3b06a8f
services/auth.js
services/auth.js
const jwt = require('jsonwebtoken') const config = require('config') const bcrypt = require('bcrypt') const User = require('./../models/user') const Authenticate = (user) => { return new Promise((resolve, reject) => { User.findOne({ 'where': { 'email': user.email } }) .then((record) => { if (!record) { return reject({ 'errors': { 'user': 'Usuário não encontrado' } }) } bcrypt.compare(user.password, record.password) .then((result) => { if (result) { return jwt.sign(user, config.get('secret'), { expiresIn: '1d' }, (error, token) => { if (error) { return reject({ 'errors': { 'token': 'Não foi possível gerar o token de autenticação' } }) } return resolve({ 'token': token }) }) } return reject({ 'errors': { 'password': 'Senha incorreta' } }) }) }) }) } module.exports = Authenticate
const jwt = require('jsonwebtoken') const config = require('config') const bcrypt = require('bcrypt') const _ = require('lodash') const User = require('./../models/user') const Authenticate = (user) => { return new Promise((resolve, reject) => { User.findOne({ 'where': { 'email': user.email } }) .then((record) => { if (!record) { return reject({ 'errors': { 'user': 'Usuário não encontrado' } }) } record = record.get({ plain: true }) bcrypt.compare(user.password, record.password) .then((result) => { if (result) { return jwt.sign(_.omit(record, ['password']), config.get('secret'), { expiresIn: '1d' }, (error, token) => { if (error) { console.error('[JWT ERROR] ' + error) return reject({ 'errors': { 'token': 'Não foi possível gerar o token de autenticação' } }) } return resolve({ 'token': token }) }) } return reject({ 'errors': { 'password': 'Senha incorreta' } }) }) }) }) } module.exports = Authenticate
Use database record to sign jwt token without password
Use database record to sign jwt token without password
JavaScript
mit
lucasrcdias/customer-mgmt
--- +++ @@ -1,6 +1,7 @@ const jwt = require('jsonwebtoken') const config = require('config') const bcrypt = require('bcrypt') +const _ = require('lodash') const User = require('./../models/user') const Authenticate = (user) => { @@ -11,11 +12,14 @@ return reject({ 'errors': { 'user': 'Usuário não encontrado' } }) } + record = record.get({ plain: true }) + bcrypt.compare(user.password, record.password) .then((result) => { if (result) { - return jwt.sign(user, config.get('secret'), { expiresIn: '1d' }, (error, token) => { + return jwt.sign(_.omit(record, ['password']), config.get('secret'), { expiresIn: '1d' }, (error, token) => { if (error) { + console.error('[JWT ERROR] ' + error) return reject({ 'errors': { 'token': 'Não foi possível gerar o token de autenticação' } }) }
f0c6fbfa23714cd0996886bcd76ed4789c85932b
src/__tests__/components/CloseButton.js
src/__tests__/components/CloseButton.js
/* eslint-env jest */ import React from 'react'; import { shallow } from 'enzyme'; import CloseButton from './../../components/CloseButton'; const closeToast = jest.fn(); describe('CloseButton', () => { it('Should call closeToast on click', () => { const component = shallow(<CloseButton closeToast={closeToast} />); expect(closeToast).not.toHaveBeenCalled(); component.simulate('click'); expect(closeToast).toHaveBeenCalled(); }); });
/* eslint-env jest */ import React from 'react'; import { shallow } from 'enzyme'; import CloseButton from './../../components/CloseButton'; const closeToast = jest.fn(); describe('CloseButton', () => { it('Should call closeToast on click', () => { const component = shallow(<CloseButton closeToast={closeToast} />); expect(closeToast).not.toHaveBeenCalled(); component.simulate('click', { stopPropagation: () => undefined }); expect(closeToast).toHaveBeenCalled(); }); });
Fix failing test event undefined when shadow rendering
Fix failing test event undefined when shadow rendering
JavaScript
mit
fkhadra/react-toastify,sniphpet/react-toastify,fkhadra/react-toastify,fkhadra/react-toastify,sniphpet/react-toastify,fkhadra/react-toastify
--- +++ @@ -11,7 +11,7 @@ const component = shallow(<CloseButton closeToast={closeToast} />); expect(closeToast).not.toHaveBeenCalled(); - component.simulate('click'); + component.simulate('click', { stopPropagation: () => undefined }); expect(closeToast).toHaveBeenCalled(); }); });
6d59fcf4270230a50a33f61c2d59643798f7e2df
lib/install/filter-invalid-actions.js
lib/install/filter-invalid-actions.js
'use strict' var path = require('path') var validate = require('aproba') var log = require('npmlog') var getPackageId = require('./get-package-id.js') module.exports = function (top, differences, next) { validate('SAF', arguments) var action var keep = [] /*eslint no-cond-assign:0*/ while (action = differences.shift()) { var cmd = action[0] var pkg = action[1] if (pkg.isInLink || pkg.parent.target) { log.warn('skippingAction', 'Module is inside a symlinked module: not running ' + cmd + ' ' + getPackageId(pkg) + ' ' + path.relative(top, pkg.path)) } else { keep.push(action) } } differences.push.apply(differences, keep) next() }
'use strict' var path = require('path') var validate = require('aproba') var log = require('npmlog') var getPackageId = require('./get-package-id.js') module.exports = function (top, differences, next) { validate('SAF', arguments) var action var keep = [] differences.forEach(function (action) { var cmd = action[0] var pkg = action[1] if (cmd === 'remove') { pkg.removing = true } }) /*eslint no-cond-assign:0*/ while (action = differences.shift()) { var cmd = action[0] var pkg = action[1] if (pkg.isInLink || pkg.parent.target || pkg.parent.isLink) { // we want to skip warning if this is a child of another module that we're removing if (!pkg.parent.removing) { log.warn('skippingAction', 'Module is inside a symlinked module: not running ' + cmd + ' ' + getPackageId(pkg) + ' ' + path.relative(top, pkg.path)) } } else { keep.push(action) } } differences.push.apply(differences, keep) next() }
Remove extraneous warns when removing a symlink
uninstall: Remove extraneous warns when removing a symlink Don't warn about not acting on a module in a symlink when the module's parent is being removed anyway
JavaScript
artistic-2.0
TimeToogo/npm,midniteio/npm,DaveEmmerson/npm,TimeToogo/npm,yodeyer/npm,princeofdarkness76/npm,ekmartin/npm,ekmartin/npm,lxe/npm,cchamberlain/npm,misterbyrne/npm,yodeyer/npm,segrey/npm,xalopp/npm,princeofdarkness76/npm,kemitchell/npm,princeofdarkness76/npm,yodeyer/npm,kemitchell/npm,misterbyrne/npm,segrey/npm,chadnickbok/npm,TimeToogo/npm,evocateur/npm,ekmartin/npm,misterbyrne/npm,DIREKTSPEED-LTD/npm,kimshinelove/naver-npm,midniteio/npm,segrey/npm,evocateur/npm,yibn2008/npm,lxe/npm,kimshinelove/naver-npm,yibn2008/npm,evanlucas/npm,cchamberlain/npm-msys2,cchamberlain/npm,rsp/npm,evanlucas/npm,DaveEmmerson/npm,thomblake/npm,Volune/npm,kemitchell/npm,DIREKTSPEED-LTD/npm,haggholm/npm,rsp/npm,thomblake/npm,cchamberlain/npm,haggholm/npm,kimshinelove/naver-npm,evanlucas/npm,DaveEmmerson/npm,cchamberlain/npm-msys2,xalopp/npm,xalopp/npm,cchamberlain/npm-msys2,rsp/npm,lxe/npm,chadnickbok/npm,midniteio/npm,DIREKTSPEED-LTD/npm,thomblake/npm,Volune/npm,evocateur/npm,chadnickbok/npm,haggholm/npm,yibn2008/npm,Volune/npm
--- +++ @@ -8,13 +8,25 @@ validate('SAF', arguments) var action var keep = [] + + differences.forEach(function (action) { + var cmd = action[0] + var pkg = action[1] + if (cmd === 'remove') { + pkg.removing = true + } + }) + /*eslint no-cond-assign:0*/ while (action = differences.shift()) { var cmd = action[0] var pkg = action[1] - if (pkg.isInLink || pkg.parent.target) { - log.warn('skippingAction', 'Module is inside a symlinked module: not running ' + - cmd + ' ' + getPackageId(pkg) + ' ' + path.relative(top, pkg.path)) + if (pkg.isInLink || pkg.parent.target || pkg.parent.isLink) { + // we want to skip warning if this is a child of another module that we're removing + if (!pkg.parent.removing) { + log.warn('skippingAction', 'Module is inside a symlinked module: not running ' + + cmd + ' ' + getPackageId(pkg) + ' ' + path.relative(top, pkg.path)) + } } else { keep.push(action) }
492e5e6f35d8fd3cb7d79da358ea710364fa0fe5
app/scripts-browserify/index.js
app/scripts-browserify/index.js
const config = require('collections-online/shared/config'); // Always include collections-online's base require('base')({ helpers: require('../../shared/helpers') }); // Project specific require('analytics'); if(config.features.sitewidePassword) { require('./sitewide-password'); }
const config = require('collections-online/shared/config'); // Always include collections-online's base // FIXME: For some reason require currently does not accept "base" as the // module. To address this we have to provide a full path to the file. require('../../node_modules/collections-online/app/scripts-browserify/base')({ helpers: require('../../shared/helpers') }); // Project specific require('analytics'); if(config.features.sitewidePassword) { require('./sitewide-password'); }
Fix JavaScript error causing images not to be loaded
Fix JavaScript error causing images not to be loaded The error is caused by AssetPage not being available in the window scope. It is currently not included in browserify-index.js either. This is despite the fact that it has been so earlier. Other browserify scripts from collections-online are not included either. The situation seems to be caused by require() currently not accepting "base" as a module name. To address this we have to provide a full path to the file. This issue may be caused by gulp-browserify but we have not been able to confirm this as the root cause.
JavaScript
mit
CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder
--- +++ @@ -1,6 +1,8 @@ const config = require('collections-online/shared/config'); // Always include collections-online's base -require('base')({ +// FIXME: For some reason require currently does not accept "base" as the +// module. To address this we have to provide a full path to the file. +require('../../node_modules/collections-online/app/scripts-browserify/base')({ helpers: require('../../shared/helpers') });
6b9b235b828956915dda289ef845455798c3a281
source/logger.js
source/logger.js
if (Meteor.isServer) { winston = Npm.require('winston'); } Space.Logger = Space.Object.extend(Space, 'Logger', { _logger: null, _state: 'stopped', Constructor() { if (Meteor.isServer) { this._logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)() ] }); } if (Meteor.isClient) { this._logger = console; } }, start() { if (this._state === 'stopped') { this._state = 'running'; } }, stop() { if (this._state === 'running') { this._state = 'stopped'; } }, info(message, meta) { if (this.shouldLog()) this._logger.info(message, meta); }, warn(message, meta) { if (this.shouldLog()) this._logger.warn(message, meta); }, error(message, meta) { if (this.shouldLog()) this._logger.error(message, meta); }, shouldLog() { if (this._state === 'running') return true; } }); // System log Space.log = new Space.Logger(); if (Space.configuration.sysLog.enabled) { Space.log.start(); }
if(Meteor.isServer) { winston = Npm.require('winston'); } Space.Logger = Space.Object.extend(Space, 'Logger', { _logger: null, _state: 'stopped', Constructor() { if(Meteor.isServer) { this._logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)() ] }); } if(Meteor.isClient) { this._logger = console; } }, start() { if(this._state === 'stopped') { this._state = 'running'; } }, stop() { if(this._state === 'running') { this._state = 'stopped'; } }, info(message, meta) { check(message, String) if(this.shouldLog()) this._logger.info.apply(this, arguments); }, warn(message, meta) { check(message, String) if(this.shouldLog()) this._logger.warn.apply(this, arguments); }, error(message, meta) { check(message, String) if(this.shouldLog()) this._logger.error.apply(this, arguments); }, shouldLog() { if(this._state === 'running') return true; } }); // System log Space.log = new Space.Logger(); if(Space.configuration.sysLog.enabled) { Space.log.start(); }
Apply arguments, check message for string
Apply arguments, check message for string
JavaScript
mit
meteor-space/base,meteor-space/base
--- +++ @@ -1,4 +1,4 @@ -if (Meteor.isServer) { +if(Meteor.isServer) { winston = Npm.require('winston'); } @@ -9,44 +9,47 @@ Constructor() { - if (Meteor.isServer) { + if(Meteor.isServer) { this._logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)() ] }); } - if (Meteor.isClient) { + if(Meteor.isClient) { this._logger = console; } }, start() { - if (this._state === 'stopped') { + if(this._state === 'stopped') { this._state = 'running'; } }, stop() { - if (this._state === 'running') { + if(this._state === 'running') { this._state = 'stopped'; } }, info(message, meta) { - if (this.shouldLog()) this._logger.info(message, meta); + check(message, String) + if(this.shouldLog()) this._logger.info.apply(this, arguments); }, warn(message, meta) { - if (this.shouldLog()) this._logger.warn(message, meta); + check(message, String) + if(this.shouldLog()) this._logger.warn.apply(this, arguments); }, error(message, meta) { - if (this.shouldLog()) this._logger.error(message, meta); + check(message, String) + if(this.shouldLog()) this._logger.error.apply(this, arguments); }, shouldLog() { - if (this._state === 'running') return true; + if(this._state === 'running') return true; } }); @@ -54,6 +57,6 @@ // System log Space.log = new Space.Logger(); -if (Space.configuration.sysLog.enabled) { +if(Space.configuration.sysLog.enabled) { Space.log.start(); }
d4d3cee54f57442c2166bead54a8c20d2be0274d
public/lib/feathers/feathers-client.js
public/lib/feathers/feathers-client.js
import feathers from 'feathers/client'; import io from 'steal-socket.io'; import socketio from 'feathers-socketio/client'; import auth from 'feathers-authentication/client'; import hooks from 'feathers-hooks'; var socket = io({ transports: ['websocket'] }); const app = feathers() .configure(socketio(socket)) .configure(hooks()) .configure(auth()); export default app;
import feathers from 'feathers/client'; import io from 'socket.io-client/dist/socket.io'; import socketio from 'feathers-socketio/client'; import auth from 'feathers-authentication/client'; import hooks from 'feathers-hooks'; var socket = io({ transports: ['websocket'] }); const app = feathers() .configure(socketio(socket)) .configure(hooks()) .configure(auth()); export default app;
Use socket.io-client in place of steal-socket.io
Use socket.io-client in place of steal-socket.io
JavaScript
mit
donejs/bitcentive,donejs/bitcentive
--- +++ @@ -1,5 +1,5 @@ import feathers from 'feathers/client'; -import io from 'steal-socket.io'; +import io from 'socket.io-client/dist/socket.io'; import socketio from 'feathers-socketio/client'; import auth from 'feathers-authentication/client'; import hooks from 'feathers-hooks';
ffd02046e61ba52f4ff0f0189efa260f3befeb76
src/component.js
src/component.js
import { select, local } from "d3-selection"; export default function (Component){ var className = Component.className, tagName = Component.tagName, componentLocal = local(); return function (selection, props){ var components = selection .selectAll(className ? "." + className : tagName) .data(Array.isArray(props) ? props : [props]); components .exit() .each(function (){ var instance = componentLocal.get(this); if(instance.destroy){ instance.destroy(); } }) .remove(); components .enter().append(tagName) .attr("class", className) .each(function (){ componentLocal.set(this, Component()); }) .merge(components) .each(function (props){ select(this).call(componentLocal.get(this), props); }); }; };
import { select, local } from "d3-selection"; export default function (component){ var className = component.className, tagName = component.tagName, render = component.render || function(){}; return function (selection, props){ var components = selection .selectAll(className ? "." + className : tagName) .data(Array.isArray(props) ? props : [props]); components.exit().remove(); components .enter().append(tagName).attr("class", className) .merge(components) .each(function (props){ select(this).call(render, props); }); }; };
Restructure implementation to meet new tests
Restructure implementation to meet new tests
JavaScript
bsd-3-clause
curran/d3-component
--- +++ @@ -1,29 +1,19 @@ import { select, local } from "d3-selection"; -export default function (Component){ - var className = Component.className, - tagName = Component.tagName, - componentLocal = local(); +export default function (component){ + var className = component.className, + tagName = component.tagName, + render = component.render || function(){}; return function (selection, props){ var components = selection .selectAll(className ? "." + className : tagName) .data(Array.isArray(props) ? props : [props]); + components.exit().remove(); components - .exit() - .each(function (){ - var instance = componentLocal.get(this); - if(instance.destroy){ instance.destroy(); } - }) - .remove(); - components - .enter().append(tagName) - .attr("class", className) - .each(function (){ - componentLocal.set(this, Component()); - }) + .enter().append(tagName).attr("class", className) .merge(components) .each(function (props){ - select(this).call(componentLocal.get(this), props); + select(this).call(render, props); }); }; };
1e2e0af67d1ca051e4b87c77c832e1d6644eb439
spec/javascripts/pdf/page_spec.js
spec/javascripts/pdf/page_spec.js
import Vue from 'vue'; import pdfjsLib from 'vendor/pdf'; import workerSrc from 'vendor/pdf.worker.min'; import PageComponent from '~/pdf/page/index.vue'; import testPDF from '../fixtures/blob/pdf/test.pdf'; const Component = Vue.extend(PageComponent); describe('Page component', () => { let vm; let testPage; pdfjsLib.PDFJS.workerSrc = workerSrc; const checkRendered = (done) => { if (vm.rendering) { setTimeout(() => { checkRendered(done); }, 100); } else { done(); } }; beforeEach((done) => { pdfjsLib.getDocument(testPDF) .then(pdf => pdf.getPage(1)) .then((page) => { testPage = page; done(); }) .catch((error) => { done.fail(error); }); }); describe('render', () => { beforeEach((done) => { vm = new Component({ propsData: { page: testPage, number: 1, }, }); vm.$mount(); checkRendered(done); }); it('renders first page', () => { expect(vm.$el.tagName).toBeDefined(); }); }); });
import Vue from 'vue'; import pdfjsLib from 'vendor/pdf'; import workerSrc from 'vendor/pdf.worker.min'; import PageComponent from '~/pdf/page/index.vue'; import mountComponent from 'spec/helpers/vue_mount_component_helper'; import testPDF from 'spec/fixtures/blob/pdf/test.pdf'; describe('Page component', () => { const Component = Vue.extend(PageComponent); let vm; let testPage; beforeEach(done => { pdfjsLib.PDFJS.workerSrc = workerSrc; pdfjsLib .getDocument(testPDF) .then(pdf => pdf.getPage(1)) .then(page => { testPage = page; }) .then(done) .catch(done.fail); }); afterEach(() => { vm.$destroy(); }); it('renders the page when mounting', done => { const promise = Promise.resolve(); spyOn(testPage, 'render').and.callFake(() => promise); vm = mountComponent(Component, { page: testPage, number: 1, }); expect(vm.rendering).toBe(true); promise .then(() => { expect(testPage.render).toHaveBeenCalledWith(vm.renderContext); expect(vm.rendering).toBe(false); }) .then(done) .catch(done.fail); }); });
Remove waiting from PDF page component test
Remove waiting from PDF page component test
JavaScript
mit
stoplightio/gitlabhq,stoplightio/gitlabhq,dreampet/gitlab,stoplightio/gitlabhq,axilleas/gitlabhq,iiet/iiet-git,dreampet/gitlab,dreampet/gitlab,iiet/iiet-git,mmkassem/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,axilleas/gitlabhq,jirutka/gitlabhq,iiet/iiet-git,mmkassem/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,stoplightio/gitlabhq,jirutka/gitlabhq,iiet/iiet-git,axilleas/gitlabhq,jirutka/gitlabhq,jirutka/gitlabhq
--- +++ @@ -3,53 +3,45 @@ import workerSrc from 'vendor/pdf.worker.min'; import PageComponent from '~/pdf/page/index.vue'; -import testPDF from '../fixtures/blob/pdf/test.pdf'; - -const Component = Vue.extend(PageComponent); +import mountComponent from 'spec/helpers/vue_mount_component_helper'; +import testPDF from 'spec/fixtures/blob/pdf/test.pdf'; describe('Page component', () => { + const Component = Vue.extend(PageComponent); let vm; let testPage; - pdfjsLib.PDFJS.workerSrc = workerSrc; - const checkRendered = (done) => { - if (vm.rendering) { - setTimeout(() => { - checkRendered(done); - }, 100); - } else { - done(); - } - }; - - beforeEach((done) => { - pdfjsLib.getDocument(testPDF) + beforeEach(done => { + pdfjsLib.PDFJS.workerSrc = workerSrc; + pdfjsLib + .getDocument(testPDF) .then(pdf => pdf.getPage(1)) - .then((page) => { + .then(page => { testPage = page; - done(); }) - .catch((error) => { - done.fail(error); - }); + .then(done) + .catch(done.fail); }); - describe('render', () => { - beforeEach((done) => { - vm = new Component({ - propsData: { - page: testPage, - number: 1, - }, - }); + afterEach(() => { + vm.$destroy(); + }); - vm.$mount(); + it('renders the page when mounting', done => { + const promise = Promise.resolve(); + spyOn(testPage, 'render').and.callFake(() => promise); + vm = mountComponent(Component, { + page: testPage, + number: 1, + }); + expect(vm.rendering).toBe(true); - checkRendered(done); - }); - - it('renders first page', () => { - expect(vm.$el.tagName).toBeDefined(); - }); + promise + .then(() => { + expect(testPage.render).toHaveBeenCalledWith(vm.renderContext); + expect(vm.rendering).toBe(false); + }) + .then(done) + .catch(done.fail); }); });
609e022fe21ca52f678c04bddd4a150e9f112787
app/models/account.js
app/models/account.js
// Example model var mongoose = require('mongoose'), Schema = mongoose.Schema; // Authenticate Schema var Account = new Schema ({ //conflict with node so changed from domain domainProvider: { type: String, default: ''}, uid: { type: String, default: ''}, // Could this be better? //user: { type: Schema.Types.ObjectId, ref: 'User' }, // Is email duplicated with User? email: { type: String, default: ''}, tokens: { kind : {type: String, default: ''}, token : {type: String, default: ''}, tokenSecret:{type: String, default: ''} }, streams: [{ screen_name: { type: String, default: ''}, maxid: { type: Integer, default: 0}, // Used by twitter count: { type: Integer, default: 200}, // Entry Limit content: { type: String, default: ''}, dateRequested: { type: Date, default: Date.now() }, }] }) mongoose.model('Account', Account);
// Example model var mongoose = require('mongoose'), Schema = mongoose.Schema; // Authenticate Schema var Account = new Schema ({ //conflict with node so changed from domain domainProvider: { type: String, default: ''}, uid: { type: String, default: ''}, // Could this be better? //user: { type: Schema.Types.ObjectId, ref: 'User' }, // Is email duplicated with User? email: { type: String, default: ''}, tokens: { kind : {type: String, default: ''}, token : {type: String, default: ''}, tokenSecret:{type: String, default: ''} }, streams: [{ screen_name: { type: String, default: ''}, maxid: { type: Number, default: 0}, // Used by twitter count: { type: Number, default: 200}, // Entry Limit content: { type: String, default: ''}, dateRequested: { type: Date, default: Date.now() }, }] }) mongoose.model('Account', Account);
Use appropriate model types - continued
Use appropriate model types - continued
JavaScript
mit
RichardVSaasbook/ITCS4155Team4,lestrell/bridgesAPI,squeetus/bridgesAPI,stevemacn/bridgesAPI,lestrell/bridgesAPI,squeetus/bridgesAPI,stevemacn/bridgesAPI
--- +++ @@ -18,8 +18,8 @@ }, streams: [{ screen_name: { type: String, default: ''}, - maxid: { type: Integer, default: 0}, // Used by twitter - count: { type: Integer, default: 200}, // Entry Limit + maxid: { type: Number, default: 0}, // Used by twitter + count: { type: Number, default: 200}, // Entry Limit content: { type: String, default: ''}, dateRequested: { type: Date, default: Date.now() }, }]
0c496c344830c479413def1cf70c741d142a4193
app/models/comment.js
app/models/comment.js
import DS from 'ember-data'; export default DS.Model.extend({ blocks: DS.attr(), insertedAt: DS.attr('date', { defaultValue() { return new Date(); } }), updatedAt: DS.attr('date'), canvas: DS.belongsTo('canvas'), block: DS.belongsTo('block'), creator: DS.belongsTo('user'), });
import DS from 'ember-data'; import Ember from 'ember'; export default DS.Model.extend({ blocks: DS.attr(), insertedAt: DS.attr('date', { defaultValue() { return new Date(); } }), updatedAt: DS.attr('date'), canvas: DS.belongsTo('canvas'), block: DS.belongsTo('block'), creator: DS.belongsTo('user'), blockID: Ember.computed.readOnly('block.id') });
Add computed property blockID to fix deprecated binding issues
Add computed property blockID to fix deprecated binding issues
JavaScript
apache-2.0
usecanvas/web-v2,usecanvas/web-v2,usecanvas/web-v2
--- +++ @@ -1,4 +1,5 @@ import DS from 'ember-data'; +import Ember from 'ember'; export default DS.Model.extend({ blocks: DS.attr(), @@ -7,4 +8,5 @@ canvas: DS.belongsTo('canvas'), block: DS.belongsTo('block'), creator: DS.belongsTo('user'), + blockID: Ember.computed.readOnly('block.id') });
195fd6df585d9378cfb1331c320f5179d1018248
app/models/service.js
app/models/service.js
import Resource from 'ember-api-store/models/resource'; import { get, computed } from '@ember/object'; import { inject as service } from '@ember/service'; export default Resource.extend({ intl: service(), scope: service(), canEditYaml: true, displayKind: computed('intl.locale', 'kind', function() { const intl = get(this, 'intl'); if ( get(this, 'kind') === 'LoadBalancer' ) { return intl.t('model.service.displayKind.loadBalancer'); } else { return intl.t('model.service.displayKind.generic'); } }), proxyEndpoints: computed('labels', function(){ const parts = [] const labels = get(this, 'labels'); const location = window.location; if ( labels && labels['kubernetes.io/cluster-service'] === 'true' ) { (get(this, 'ports') || []).forEach((port) => { const linkEndpoint = `${location.origin}/k8s/clusters/${get(this, 'scope.currentCluster.id')}/api/v1/namespaces/${get(this, 'namespaceId')}/services/${get(port, 'targetPort')}:${get(this, 'name')}:/proxy/`; parts.push({ linkEndpoint: linkEndpoint, displayEndpoint: '/index.html', protocol: location.protocol.substr(0, location.protocol.length -1), isTcpish: true, }); }); } return parts; }), });
import Resource from 'ember-api-store/models/resource'; import { get, computed } from '@ember/object'; import { reference } from 'ember-api-store/utils/denormalize'; import { inject as service } from '@ember/service'; export default Resource.extend({ intl: service(), scope: service(), clusterStore: service(), namespace: reference('namespaceId', 'namespace', 'clusterStore'), canEditYaml: true, displayKind: computed('intl.locale', 'kind', function() { const intl = get(this, 'intl'); if ( get(this, 'kind') === 'LoadBalancer' ) { return intl.t('model.service.displayKind.loadBalancer'); } else { return intl.t('model.service.displayKind.generic'); } }), proxyEndpoints: computed('labels', function(){ const parts = [] const labels = get(this, 'labels'); const location = window.location; if ( labels && labels['kubernetes.io/cluster-service'] === 'true' ) { (get(this, 'ports') || []).forEach((port) => { const linkEndpoint = `${location.origin}/k8s/clusters/${get(this, 'scope.currentCluster.id')}/api/v1/namespaces/${get(this, 'namespaceId')}/services/${get(port, 'targetPort')}:${get(this, 'name')}:/proxy/`; parts.push({ linkEndpoint: linkEndpoint, displayEndpoint: '/index.html', protocol: location.protocol.substr(0, location.protocol.length -1), isTcpish: true, }); }); } return parts; }), });
Fix lb group by issue
Fix lb group by issue
JavaScript
apache-2.0
rancher/ui,vincent99/ui,rancher/ui,lvuch/ui,rancher/ui,vincent99/ui,westlywright/ui,rancherio/ui,vincent99/ui,rancherio/ui,lvuch/ui,lvuch/ui,westlywright/ui,rancherio/ui,westlywright/ui
--- +++ @@ -1,10 +1,14 @@ import Resource from 'ember-api-store/models/resource'; import { get, computed } from '@ember/object'; +import { reference } from 'ember-api-store/utils/denormalize'; import { inject as service } from '@ember/service'; export default Resource.extend({ intl: service(), scope: service(), + clusterStore: service(), + + namespace: reference('namespaceId', 'namespace', 'clusterStore'), canEditYaml: true,
d1375e032ac0b4cf0fb56501dc0e79c20d6e0d29
app/static/js/init.js
app/static/js/init.js
$(document).ready(function(){ $('#title_inc').tagsInput({'defaultText': '…'}); $('#title_exc').tagsInput({'defaultText': '…'}); $('#link_inc').tagsInput({'defaultText': '…'}); $('#link_exc').tagsInput({'defaultText': '…'}); set_submit(false) $('#rss_url').blur(function(){ url = $(this).val() $.get( "/check_url?&url=" + escape(url), function( data ) { if (data == 'False') { set_feedback(false) } else { set_feedback(true) if (data != 'True') { $('#rss_url').val(data) } } }); }) }) set_feedback = function (value) { feedback = $('#url_feedback') fieldset = $('#rss_url_fieldset') if ( value ) { fieldset.addClass('has-success').removeClass('has-error') feedback.show().addClass('glyphicon-ok').removeClass('glyphicon-remove') set_submit(true) } else { fieldset.addClass('has-error').removeClass('has-success') feedback.show().addClass('glyphicon-remove').removeClass('glyphicon-ok') set_submit(false) } } set_submit = function (value) { btn = $('#submit_btn') if ( value ) { btn.removeAttr('disabled') } else { btn.attr('disabled', 'disabled') } }
$(document).ready(function(){ $('#title_inc').tagsInput({'defaultText': '…'}); $('#title_exc').tagsInput({'defaultText': '…'}); $('#link_inc').tagsInput({'defaultText': '…'}); $('#link_exc').tagsInput({'defaultText': '…'}); set_submit(false) $('#rss_url').blur(check_url) check_url() }) set_feedback = function (value) { feedback = $('#url_feedback') fieldset = $('#rss_url_fieldset') if ( value ) { fieldset.addClass('has-success').removeClass('has-error') feedback.show().addClass('glyphicon-ok').removeClass('glyphicon-remove') set_submit(true) } else { fieldset.addClass('has-error').removeClass('has-success') feedback.show().addClass('glyphicon-remove').removeClass('glyphicon-ok') set_submit(false) } } set_submit = function (value) { btn = $('#submit_btn') if ( value ) { btn.removeAttr('disabled') } else { btn.attr('disabled', 'disabled') } } check_url = function () { url = $('#rss_url').val() $.get( "/check_url?&url=" + escape(url), function( data ) { if (data == 'False') { set_feedback(false) } else { set_feedback(true) if (data != 'True') { $('#rss_url').val(data) } } }); }
Fix ajax URL check to run on page load
Fix ajax URL check to run on page load
JavaScript
mit
cuducos/filterss,cuducos/filterss,cuducos/filterss
--- +++ @@ -7,19 +7,8 @@ $('#link_exc').tagsInput({'defaultText': '…'}); set_submit(false) - $('#rss_url').blur(function(){ - url = $(this).val() - $.get( "/check_url?&url=" + escape(url), function( data ) { - if (data == 'False') { - set_feedback(false) - } else { - set_feedback(true) - if (data != 'True') { - $('#rss_url').val(data) - } - } - }); - }) + $('#rss_url').blur(check_url) + check_url() }) @@ -34,7 +23,7 @@ fieldset.addClass('has-error').removeClass('has-success') feedback.show().addClass('glyphicon-remove').removeClass('glyphicon-ok') set_submit(false) - + } } @@ -47,3 +36,17 @@ btn.attr('disabled', 'disabled') } } + +check_url = function () { + url = $('#rss_url').val() + $.get( "/check_url?&url=" + escape(url), function( data ) { + if (data == 'False') { + set_feedback(false) + } else { + set_feedback(true) + if (data != 'True') { + $('#rss_url').val(data) + } + } + }); +}
3e830bd1b65b5f83980c68ec56efe328f3e69781
src/wysihtml5.js
src/wysihtml5.js
/** * @license wysihtml5 v@VERSION * https://github.com/xing/wysihtml5 * * Author: Christopher Blum (https://github.com/tiff) * * Copyright (C) 2011 XING AG * Licensed under GNU General Public License * */ var wysihtml5 = { version: "@VERSION", // namespaces commands: {}, dom: {}, quirks: {}, toolbar: {}, lang: {}, selection: {}, views: {}, INVISIBLE_SPACE: "\uFEFF", EMPTY_FUNCTION: function() {}, ELEMENT_NODE: 1, TEXT_NODE: 3, BACKSPACE_KEY: 8, ENTER_KEY: 13, ESCAPE_KEY: 27, SPACE_KEY: 32, DELETE_KEY: 46 };
/** * @license wysihtml5 v@VERSION * https://github.com/xing/wysihtml5 * * Author: Christopher Blum (https://github.com/tiff) * * Copyright (C) 2012 XING AG * Licensed under the MIT license (MIT) * */ var wysihtml5 = { version: "@VERSION", // namespaces commands: {}, dom: {}, quirks: {}, toolbar: {}, lang: {}, selection: {}, views: {}, INVISIBLE_SPACE: "\uFEFF", EMPTY_FUNCTION: function() {}, ELEMENT_NODE: 1, TEXT_NODE: 3, BACKSPACE_KEY: 8, ENTER_KEY: 13, ESCAPE_KEY: 27, SPACE_KEY: 32, DELETE_KEY: 46 };
Update main js file to reflect new license (thx for pointing this out @stereobit)
Update main js file to reflect new license (thx for pointing this out @stereobit)
JavaScript
mit
mmolhoek/wysihtml,camayak/wysihtml5,vitoravelino/wysihtml,Trult/wysihtml,modulexcite/wysihtml,argenticdev/wysihtml,qualwas72/wysihtml5,StepicOrg/wysihtml5,uxtx/wysihtml,StepicOrg/wysihtml5,mrjoelkemp/wysihtml,Voog/wysihtml,Attamusc/wysihtml,argenticdev/wysihtml,jeffersoncarpenter/wysihtml5,flowapp/wysihtml5,GerHobbelt/wysihtml,behance/wysihtml,Trult/wysihtml,mmolhoek/wysihtml,protonet/wysihtml,uxtx/wysihtml,qualwas72/wysihtml5,nicolasiensen/wysihtml,thierryc/wysihtml5-styled,allesklar/wysihtml5_with_ps,hiBetterMe/wysihtml,modulexcite/wysihtml,behance/wysihtml,nicolasiensen/wysihtml,metalabdesign/wysihtml5,protonet/wysihtml,GerHobbelt/wysihtml,Attamusc/wysihtml,Stebalien/wysihtml5,Voog/wysihtml,bevacqua/wysihtml,hugohfo/wysihtml5,thierryc/wysihtml5-styled,hugohfo/wysihtml5,vitoravelino/wysihtml,jeffersoncarpenter/wysihtml5,allesklar/wysihtml5_with_ps,flowapp/wysihtml5,metalabdesign/wysihtml5,Rise-Vision/wysihtml5,xing/wysihtml5,karoltarasiuk/wysihtml,camayak/wysihtml5,karoltarasiuk/wysihtml,thierryc/wysihtml5-styled,thierryc/wysihtml5-styled,mrjoelkemp/wysihtml,hiBetterMe/wysihtml
--- +++ @@ -4,8 +4,8 @@ * * Author: Christopher Blum (https://github.com/tiff) * - * Copyright (C) 2011 XING AG - * Licensed under GNU General Public License + * Copyright (C) 2012 XING AG + * Licensed under the MIT license (MIT) * */ var wysihtml5 = {
89dd3fd60f1c35c9c8a50141c0579042919e6d51
static/js/vcs.js
static/js/vcs.js
var $ = $ || function() {}; // Keeps from throwing ref errors. function swapselected(from, to) { $(to).html(options[$(from).val()]); } function detailselected(from, to) { $(to).text(details[$(from).val()]); } $(function() { $("#grp-slct").change( function() { swapselected("#grp-slct", "#subgrp-slct"); }); $("#subgrp-slct").change( function() { detailselected("#subgrp-slct", "#detail-msg"); }); });
var $ = $ || function() {}; // Keeps from throwing ref errors. function swapselected(from, to) { $(to).html(options[$(from).val()]); } function detailselected(from, to) { $(to).text(details[$(from).val()]); } $(function() { $("#grp-slct").change( function() { swapselected("#grp-slct", "#subgrp-slct"); }); $("#subgrp-slct").change( function() { detailselected("#subgrp-slct", "#detail-msg"); $("#activity_key").attr("value", $("#subgrp-slct").val()); }); });
Add the hidden activity value to the form so we know which activity has been selected.
Add the hidden activity value to the form so we know which activity has been selected.
JavaScript
bsd-3-clause
AeroNotix/django-timetracker,AeroNotix/django-timetracker,AeroNotix/django-timetracker
--- +++ @@ -16,6 +16,7 @@ $("#subgrp-slct").change( function() { detailselected("#subgrp-slct", "#detail-msg"); + $("#activity_key").attr("value", $("#subgrp-slct").val()); }); });
486a84e01f4e1ea9ab1ab0bf8dbbaaf2b80c4db6
grant.js
grant.js
exports.express = () => { return require('./lib/consumer/express') } exports.koa = () => { var version = parseInt(require('koa/package.json').version.split('.')[0]) return require('./lib/consumer/koa' + (version < 2 ? '' : '2')) } exports.hapi = () => { var version = parseInt(require('hapi/package.json').version.split('.')[0]) return require('./lib/consumer/hapi' + (version < 17 ? '' : '17')) }
exports.express = () => { return require('./lib/consumer/express') } exports.koa = () => { var version = parseInt(require('koa/package.json').version.split('.')[0]) return require('./lib/consumer/koa' + (version < 2 ? '' : '2')) } exports.hapi = () => { var pkg try { pkg = require('hapi/package.json') } catch (err) { pkg = require('@hapi/hapi/package.json') } var version = parseInt(pkg.version.split('.')[0]) return require('./lib/consumer/hapi' + (version < 17 ? '' : '17')) }
Add support for @hapi/hapi namespace
Add support for @hapi/hapi namespace
JavaScript
mit
simov/grant
--- +++ @@ -9,6 +9,13 @@ } exports.hapi = () => { - var version = parseInt(require('hapi/package.json').version.split('.')[0]) + var pkg + try { + pkg = require('hapi/package.json') + } + catch (err) { + pkg = require('@hapi/hapi/package.json') + } + var version = parseInt(pkg.version.split('.')[0]) return require('./lib/consumer/hapi' + (version < 17 ? '' : '17')) }
6ed889b77ae4f84a757881249d13ab8fffac6b75
index.js
index.js
var Twit = require('twit'); var config = require('./config.json'); var talks = require('libtlks').talk; var T = new Twit({ consumer_key: config.twitterConsumerKey, consumer_secret: config.twitterConsumerSecret, access_token: config.workers.twitter.token, access_token_secret: config.workers.twitter.secret }); function getUrl(talk) { return "http://tlks.io/talk/" + talk.slug; }; talks.getRandom(config.mongodb, function(err, docs) { if (err) { throw new Error(err); } var talk = docs[0]; var username = talk.author.username; var tweet = talk.title; tweet = tweet + ' ' + getUrl(talk) + ' by @' + username; T.post('statuses/update', { status: tweet }, function(err, data, response) { if (err) { console.log(err); } }); });
var Twit = require('twit'); var config = require('./config.json'); var talks = require('libtlks').talk; var T = new Twit({ consumer_key: config.twitterConsumerKey, consumer_secret: config.twitterConsumerSecret, access_token: config.workers.twitter.token, access_token_secret: config.workers.twitter.secret }); function getUrl(talk) { return "http://tlks.io/talk/" + talk.slug; }; talks.getRandom(config.mongodb, function(err, docs) { if (err) { throw new Error(err); } var talk = docs[0]; var username = talk.author.username; var tweet = talk.title; tweet = tweet + ' ' + getUrl(talk) + ' via @' + username; T.post('statuses/update', { status: tweet }, function(err, data, response) { if (err) { console.log(err); } }); });
Change attribution message from 'by' to 'via'
Change attribution message from 'by' to 'via'
JavaScript
mit
tlksio/worker.twitter
--- +++ @@ -22,7 +22,7 @@ var talk = docs[0]; var username = talk.author.username; var tweet = talk.title; - tweet = tweet + ' ' + getUrl(talk) + ' by @' + username; + tweet = tweet + ' ' + getUrl(talk) + ' via @' + username; T.post('statuses/update', { status: tweet
b3fd8d1bc3d4becb398b610f9b62334ac2b213d4
index.js
index.js
#!/usr/bin/env node --harmony var program = require('commander'); var fetch = require('node-fetch'); var base64 = require('base-64'); program .arguments('<uri>') .version('0.0.2') .description('A command line tool to retrieve that URI to the latest artifact from an Artifactory repo') .option('-u, --username <username>', 'The user to authenticate as') .option('-p, --password <password>', 'The user\'s password') .action(function (uri) { const { username, password } = program; console.log('user: %s \npass: %s \nuri: %s', program.username, program.password, uri); fetchArtifactList(uri, username, password) .then(json => { console.log(JSON.stringify(json, null, 2)); }); }) .parse(process.argv); async function fetchArtifactList(uri, username, password) { const response = await fetch(uri, { method: 'get', headers: { 'Authorization': 'Basic ' + base64.encode(username + ':' + password) }, }); return await response.json(); }
#!/usr/bin/env node --harmony var program = require('commander'); var fetch = require('node-fetch'); var base64 = require('base-64'); async function fetchArtifactList(uri, username, password) { const response = await fetch(uri, { method: 'get', headers: { 'Authorization': 'Basic ' + base64.encode(username + ':' + password) }, }); const body = await response.json(); if (response.status !== 200) { throw body.errors; } return body; } async function showArtifactList(uri, username, password) { try { const json = await fetchArtifactList(uri, username, password); console.log(json.repo); console.log(json.path); console.log(json.children); process.exit(0); } catch (err) { for (let i = 0; i < err.length; i++) { const error = err[i]; console.error('Error: ' + error.message + ' (' + error.status + ')'); } process.exit(1); } } program .arguments('<uri>') .version('0.0.2') .description('A command line tool to retrieve that URI to the latest artifact from an Artifactory repo') .option('-u, --username <username>', 'The user to authenticate as') .option('-p, --password <password>', 'The user\'s password') .action(uri => { const { username, password } = program; showArtifactList(uri, username, password); }) .parse(process.argv);
Throw error and exit on failure
Throw error and exit on failure
JavaScript
mit
kmerhi/artifactoid
--- +++ @@ -3,28 +3,6 @@ var program = require('commander'); var fetch = require('node-fetch'); var base64 = require('base-64'); - -program - .arguments('<uri>') - .version('0.0.2') - .description('A command line tool to retrieve that URI to the latest artifact from an Artifactory repo') - .option('-u, --username <username>', 'The user to authenticate as') - .option('-p, --password <password>', 'The user\'s password') - .action(function (uri) { - const { - username, - password - } = program; - - console.log('user: %s \npass: %s \nuri: %s', - program.username, program.password, uri); - - fetchArtifactList(uri, username, password) - .then(json => { - console.log(JSON.stringify(json, null, 2)); - }); - }) - .parse(process.argv); async function fetchArtifactList(uri, username, password) { const response = await fetch(uri, { @@ -33,5 +11,43 @@ 'Authorization': 'Basic ' + base64.encode(username + ':' + password) }, }); - return await response.json(); + const body = await response.json(); + + if (response.status !== 200) { + throw body.errors; + } + + return body; } + +async function showArtifactList(uri, username, password) { + try { + const json = await fetchArtifactList(uri, username, password); + console.log(json.repo); + console.log(json.path); + console.log(json.children); + process.exit(0); + } catch (err) { + for (let i = 0; i < err.length; i++) { + const error = err[i]; + console.error('Error: ' + error.message + ' (' + error.status + ')'); + } + process.exit(1); + } +} + +program + .arguments('<uri>') + .version('0.0.2') + .description('A command line tool to retrieve that URI to the latest artifact from an Artifactory repo') + .option('-u, --username <username>', 'The user to authenticate as') + .option('-p, --password <password>', 'The user\'s password') + .action(uri => { + const { + username, + password + } = program; + + showArtifactList(uri, username, password); + }) + .parse(process.argv);
6ea8681b9224beb02aed1b7d0b61ad00880517c5
index.js
index.js
'use strict'; var objectToString = Object.prototype.toString; var ERROR_TYPE = '[object Error]'; module.exports = isError; function isError(err) { return objectToString.call(err) === ERROR_TYPE; }
'use strict'; var objectToString = Object.prototype.toString; var getPrototypeOf = Object.getPrototypeOf; var ERROR_TYPE = '[object Error]'; module.exports = isError; function isError(err) { while (err) { if (objectToString.call(err) === ERROR_TYPE) { return true; } err = getPrototypeOf(err); } return false; }
Fix for all combinations of foreign and inherited
Fix for all combinations of foreign and inherited
JavaScript
mit
Raynos/is-error
--- +++ @@ -1,10 +1,17 @@ 'use strict'; var objectToString = Object.prototype.toString; +var getPrototypeOf = Object.getPrototypeOf; var ERROR_TYPE = '[object Error]'; module.exports = isError; function isError(err) { - return objectToString.call(err) === ERROR_TYPE; + while (err) { + if (objectToString.call(err) === ERROR_TYPE) { + return true; + } + err = getPrototypeOf(err); + } + return false; }
d2efe553705101504c4e06ef4f5ec6e9b99c7896
index.js
index.js
/* jshint node: true */ 'use strict'; var VersionChecker = require('ember-cli-version-checker'); module.exports = { name: 'ember-scrollable', init: function() { this._super.init && this._super.init.apply(this, arguments); var checker = new VersionChecker(this); this._checkerForEmber = checker.for('ember', 'bower'); }, included: function(app) { if (app.app) { app = app.app; } this.app = app; this._super.included.apply(this, arguments); }, treeFor: function() { if (this._checkerForEmber.lt('2.3.0') && this.parent === this.project) { console.warn('hash helper is required by ember-scrollable, please install ember-hash-helper-polyfill or upgrade.'); } return this._super.treeFor.apply(this, arguments); } };
/* jshint node: true */ 'use strict'; var VersionChecker = require('ember-cli-version-checker'); module.exports = { name: 'ember-scrollable', init: function() { this._super.init && this._super.init.apply(this, arguments); var checker = new VersionChecker(this); this._checkerForEmber = checker.for('ember', 'bower'); }, included: function(app) { while (app.app) { app = app.app; } this.app = app; this._super.included.apply(this, arguments); }, treeFor: function() { if (this._checkerForEmber.lt('2.3.0') && this.parent === this.project) { console.warn('hash helper is required by ember-scrollable, please install ember-hash-helper-polyfill or upgrade.'); } return this._super.treeFor.apply(this, arguments); } };
Allow addon to be nested at depth of n
Allow addon to be nested at depth of n
JavaScript
mit
alphasights/ember-scrollable,alphasights/ember-scrollable,alphasights/ember-scrollable,alphasights/ember-scrollable
--- +++ @@ -15,7 +15,7 @@ }, included: function(app) { - if (app.app) { + while (app.app) { app = app.app; } this.app = app;
2910888dea3d7b8ec0a1312acfcf9f9a3a7f0332
index.js
index.js
var isPatched = false; var slice = Array.prototype.slice; if (isPatched) return; function addColor(string) { var colorName = getColorName(string); var colors = { green: ['\x1B[32m', '\x1B[39m'], red: ['\x1B[1m\x1B[31m', '\x1B[39m\x1B[22m'], yellow: ['\x1B[33m', '\x1B[39m'] } return colors[colorName][0] + string + colors[colorName][1]; } function getColorName(methodName) { switch (methodName) { case 'ERROR': return 'red'; case 'WARN': return 'yellow'; default: return 'green'; } } ['log', 'info', 'warn', 'error', 'dir', 'assert'].forEach(function(method) { var baseConsoleMethod = console[method]; var messageType = method.toUpperCase(); var output = method === 'warn' || method === 'error' ? 'stderr' : 'stdout'; console[method] = function() { var date = (new Date()).toISOString(); var args = slice.call(arguments); if (process[output].isTTY) messageType = addColor(messageType); process[output].write('[' + date + '] ' + messageType + ' '); return baseConsoleMethod.apply(console, args); } }); isPatched = true;
var isPatched = false; var slice = Array.prototype.slice; if (isPatched) return; function addColor(string) { var colorName = getColorName(string); var colors = { green: ['\x1B[32m', '\x1B[39m'], red: ['\x1B[1m\x1B[31m', '\x1B[39m\x1B[22m'], yellow: ['\x1B[33m', '\x1B[39m'] } return colors[colorName][0] + string + colors[colorName][1]; } function getColorName(methodName) { switch (methodName) { case 'ERROR': return 'red'; case 'WARN': return 'yellow'; default: return 'green'; } } ['log', 'info', 'warn', 'error', 'dir', 'assert'].forEach(function(method) { var baseConsoleMethod = console[method]; var messageType = method.toUpperCase(); var output = method === 'warn' || method === 'error' ? 'stderr' : 'stdout'; if (process[output].isTTY) messageType = addColor(messageType); console[method] = function() { var date = (new Date()).toISOString(); var args = slice.call(arguments); var dateMessage = '[' + date + '] ' + messageType + ' '; args[0] = typeof args[0] === 'string' ? dateMessage + args[0] : dateMessage; return baseConsoleMethod.apply(console, args); } }); isPatched = true;
Append timestamp to existing message string
Append timestamp to existing message string - This fixes a race condition that could cause the timestamp to become separated from the rest of the message if there were a lot of calls to a log method roughly at the same time.
JavaScript
mit
coachme/console-time
--- +++ @@ -27,13 +27,14 @@ var messageType = method.toUpperCase(); var output = method === 'warn' || method === 'error' ? 'stderr' : 'stdout'; + if (process[output].isTTY) messageType = addColor(messageType); + console[method] = function() { var date = (new Date()).toISOString(); var args = slice.call(arguments); + var dateMessage = '[' + date + '] ' + messageType + ' '; - if (process[output].isTTY) messageType = addColor(messageType); - - process[output].write('[' + date + '] ' + messageType + ' '); + args[0] = typeof args[0] === 'string' ? dateMessage + args[0] : dateMessage; return baseConsoleMethod.apply(console, args); }
d3b58ec8c213f169dd5980dfe0be859058a32f0d
index.js
index.js
var request = require('request-core') function client (options) { if (options.end === undefined) { options.end = true } return request(options) } module.exports = client
var request = require('@http/core') function client (options) { if (options.end === undefined) { options.end = true } return request(options) } module.exports = client
Migrate to the @http npm scope
Migrate to the @http npm scope
JavaScript
apache-2.0
request/client
--- +++ @@ -1,5 +1,5 @@ -var request = require('request-core') +var request = require('@http/core') function client (options) {
a100cff62a2ebc0c9bb640b71cee9d54da90cef0
index.js
index.js
export {all} from './lib/all.js' export {one} from './lib/one.js' export {toHast} from './lib/index.js'
/** * @typedef {import('./lib/index.js').Options} Options * @typedef {import('./lib/index.js').Handler} Handler * @typedef {import('./lib/index.js').Handlers} Handlers * @typedef {import('./lib/index.js').H} H */ export {all} from './lib/all.js' export {one} from './lib/one.js' export {toHast} from './lib/index.js'
Add exports of a couple of types
Add exports of a couple of types
JavaScript
mit
wooorm/mdast-util-to-hast,syntax-tree/mdast-util-to-hast
--- +++ @@ -1,3 +1,10 @@ +/** + * @typedef {import('./lib/index.js').Options} Options + * @typedef {import('./lib/index.js').Handler} Handler + * @typedef {import('./lib/index.js').Handlers} Handlers + * @typedef {import('./lib/index.js').H} H + */ + export {all} from './lib/all.js' export {one} from './lib/one.js' export {toHast} from './lib/index.js'
342df768597a9e6cdc8205d8fd19431dcc5af73c
index.js
index.js
/** * Remove initial and final spaces and tabs at the line breaks in `value`. * Does not trim initial and final spaces and tabs of the value itself. * * @param {string} value * Value to trim. * @returns {string} * Trimmed value. */ export function trimLines(value) { return String(value).replace(/[ \t]*\n+[ \t]*/g, '\n') }
/** * Remove initial and final spaces and tabs at the line breaks in `value`. * Does not trim initial and final spaces and tabs of the value itself. * * @param {string} value * Value to trim. * @returns {string} * Trimmed value. */ export function trimLines(value) { return String(value).replace(/[ \t]*(\r?\n|\r)+[ \t]*/g, '$1') }
Add support for carriage return, carriage return + line feed
Add support for carriage return, carriage return + line feed
JavaScript
mit
wooorm/trim-lines
--- +++ @@ -8,5 +8,5 @@ * Trimmed value. */ export function trimLines(value) { - return String(value).replace(/[ \t]*\n+[ \t]*/g, '\n') + return String(value).replace(/[ \t]*(\r?\n|\r)+[ \t]*/g, '$1') }
314febf7078ea6becc74d46ca562cb442c73c34e
index.js
index.js
/* jshint node: true */ 'use strict'; // var path = require('path'); module.exports = { name: 'ember-power-select', included: function(app) { // Don't include the precompiled css file if the user uses ember-cli-sass if (!app.registry.availablePlugins['ember-cli-sass']) { app.import('vendor/ember-power-select.css'); } }, contentFor: function(type, config) { this.eachAddonInvoke('contentFor', [this, type, config]); } };  
/* jshint node: true */ 'use strict'; // var path = require('path'); module.exports = { name: 'ember-power-select', included: function(app) { // Don't include the precompiled css file if the user uses ember-cli-sass if (!app.registry.availablePlugins['ember-cli-sass']) { app.import('vendor/ember-power-select.css'); } }, contentFor: function(type, config) { var emberBasicDropdown = this.addons.filter(function(addon) { return addon.name === 'ember-basic-dropdown'; })[0] return emberBasicDropdown.contentFor.apply(this, [type, config]); } };  
Fix invocation of ember-basic-dropdown's contentFor hook
Fix invocation of ember-basic-dropdown's contentFor hook
JavaScript
mit
esbanarango/ember-power-select,cibernox/ember-power-select,cibernox/ember-power-select,chrisgame/ember-power-select,esbanarango/ember-power-select,esbanarango/ember-power-select,chrisgame/ember-power-select,Dremora/ember-power-select,Dremora/ember-power-select,cibernox/ember-power-select,cibernox/ember-power-select
--- +++ @@ -13,7 +13,10 @@ }, contentFor: function(type, config) { - this.eachAddonInvoke('contentFor', [this, type, config]); + var emberBasicDropdown = this.addons.filter(function(addon) { + return addon.name === 'ember-basic-dropdown'; + })[0] + return emberBasicDropdown.contentFor.apply(this, [type, config]); } };  
9014971093b57ca00e7d36bfefeaaba3a3ccc9dd
index.js
index.js
module.exports = { parser: 'babel-eslint', extends: 'airbnb', globals: { before: true, beforeEach: true, after: true, afterEach: true, describe: true, it: true, }, rules: { 'arrow-body-style': [0], 'react/jsx-no-bind': [0], }, };
module.exports = { parser: 'babel-eslint', extends: 'airbnb', globals: { before: true, beforeEach: true, after: true, afterEach: true, describe: true, it: true, }, rules: { 'arrow-body-style': [0], 'react/jsx-no-bind': [0], 'object-shorthand': [0], }, };
Allow long version of object construction.
Allow long version of object construction.
JavaScript
mit
crewmeister/eslint-config-crewmeister
--- +++ @@ -12,5 +12,6 @@ rules: { 'arrow-body-style': [0], 'react/jsx-no-bind': [0], + 'object-shorthand': [0], }, };
acd16ec4341cbd416951712afe3e52a761027dde
index.js
index.js
module.exports = { Builder: require("./lib/builder").Builder, defaultConfig: require("./lib/defaults") };
module.exports = { Builder: require("./lib/builder").Builder, defaultConfig: require("./lib/default") };
Fix error in node module
Fix error in node module
JavaScript
apache-2.0
HRDeprecated/builder
--- +++ @@ -1,4 +1,4 @@ module.exports = { Builder: require("./lib/builder").Builder, - defaultConfig: require("./lib/defaults") + defaultConfig: require("./lib/default") };
255a3e5703da713d56d7403458e76efab3fc8199
index.js
index.js
var LogEmitter = function (source) { this.source = source; }; LogEmitter.prototype.info = function (message) { process.emit("gulp:log", { level: "info", message: message, source: this.source }); }; LogEmitter.prototype.warn = function (message) { process.emit("gulp:log", { level: "warn", message: message, source: this.source }); }; LogEmitter.prototype.error = function (message) { var data = { level: "error", message: message, source: this.source }; if (message instanceof Error) { data.message = message.message; data.error = message; } process.emit("gulp:log", data); }; LogEmitter.prototype.debug = function (message) { process.emit("gulp:log", { level: "debug", message: message, source: this.source }); }; module.exports = { Logger: function (source) { return new LogEmitter(source); } }; // var log = require('gulp-logemitter').Logger('my plugin'); // log.info("This is something to say");
var LogEmitter = function (source) { this.source = source; }; LogEmitter.prototype.info = function (message) { this.emit({ level: "info", message: message, source: this.source }); }; LogEmitter.prototype.warn = function (message) { this.emit({ level: "warn", message: message, source: this.source }); }; LogEmitter.prototype.error = function (message) { var data = { level: "error", message: message, source: this.source }; if (message instanceof Error) { data.message = message.message; data.error = message; } this.emit(data); }; LogEmitter.prototype.debug = function (message) { this.emit({ level: "debug", message: message, source: this.source }); }; LogEmitter.prototype.emit = function (data) { process.emit("gulp:log", data); }; module.exports = { Logger: function (source) { return new LogEmitter(source); } }; // var log = require('gulp-logemitter').Logger('my plugin'); // log.info("This is something to say");
Refactor emit action into its own method
Refactor emit action into its own method
JavaScript
mit
contra/gulp-log-emitter
--- +++ @@ -3,11 +3,11 @@ }; LogEmitter.prototype.info = function (message) { - process.emit("gulp:log", { level: "info", message: message, source: this.source }); + this.emit({ level: "info", message: message, source: this.source }); }; LogEmitter.prototype.warn = function (message) { - process.emit("gulp:log", { level: "warn", message: message, source: this.source }); + this.emit({ level: "warn", message: message, source: this.source }); }; LogEmitter.prototype.error = function (message) { @@ -22,13 +22,16 @@ data.error = message; } - process.emit("gulp:log", data); + this.emit(data); }; LogEmitter.prototype.debug = function (message) { - process.emit("gulp:log", { level: "debug", message: message, source: this.source }); + this.emit({ level: "debug", message: message, source: this.source }); }; +LogEmitter.prototype.emit = function (data) { + process.emit("gulp:log", data); +}; module.exports = { Logger: function (source) {
cc4d32b3767a62a4f84f62240280014cff5fbc7e
src/candela/VisComponent/index.js
src/candela/VisComponent/index.js
export default class VisComponent { constructor (el) { if (!el) { throw new Error('"el" is a required argument'); } this.el = el; } render () { throw new Error('"render() is pure abstract"'); } }
export default class VisComponent { constructor (el) { if (!el) { throw new Error('"el" is a required argument'); } this.el = el; } render () { throw new Error('"render() is pure abstract"'); } getSerializationFormats () { return []; } }
Add default getSerializationFormats method in superclass
Add default getSerializationFormats method in superclass
JavaScript
apache-2.0
Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela
--- +++ @@ -10,4 +10,8 @@ render () { throw new Error('"render() is pure abstract"'); } + + getSerializationFormats () { + return []; + } }
82588752c39925c756ae0aeef5346a694a44a1c7
src/commands/rover/PingCommand.js
src/commands/rover/PingCommand.js
const Command = require('../Command') module.exports = class PingCommand extends Command { constructor (client) { super(client, { name: 'ping', properName: 'Ping', description: 'Ping the bot to see API latency', userPermissions: [], throttling: { usages: 1, duration: 10 } // 1 usage every 10 seconds }) } async fn (msg) { const start = Date.now() msg.channel.send('Pinging...').then(message => { message.edit(`:ping_pong: Pong! Took **${Math.ceil(Date.now() - start)}ms**`) }) } }
const Command = require('../Command') module.exports = class PingCommand extends Command { constructor (client) { super(client, { name: 'ping', properName: 'Ping', description: 'Ping the bot to see API latency', userPermissions: [], throttling: { usages: 1, duration: 10 } // 1 usage every 10 seconds }) } async fn (msg) { msg.reply(`:ping_pong: Pong! Latency to Discord: ${this.client.ws.ping}ms.`) } }
Update ping command to show Discord latency
Update ping command to show Discord latency
JavaScript
apache-2.0
evaera/RoVer
--- +++ @@ -13,9 +13,6 @@ } async fn (msg) { - const start = Date.now() - msg.channel.send('Pinging...').then(message => { - message.edit(`:ping_pong: Pong! Took **${Math.ceil(Date.now() - start)}ms**`) - }) + msg.reply(`:ping_pong: Pong! Latency to Discord: ${this.client.ws.ping}ms.`) } }
75a66a9bad87cf4c9b9dfea6be5ffbf1559a791d
src/main/webapp/scripts/index.js
src/main/webapp/scripts/index.js
//$("checkbox").click(setLocationCookie); $(document).ready(function() { $('#location-checkbox').change(function() { if(this.checked) { setLocationCookie(); } }); });
//$("checkbox").click(setLocationCookie); $(document).ready(function() { $('#location-checkbox').change(function() { if(this.checked) { setLocationCookie(); } }); $('#blob-input').change(function() { const filePath = $(this).val(); $('#file-path').text(filePath.split('\\').pop()); }); });
Add js for fake upload button
Add js for fake upload button
JavaScript
apache-2.0
googleinterns/step36-2020,googleinterns/step36-2020,googleinterns/step36-2020
--- +++ @@ -5,4 +5,9 @@ setLocationCookie(); } }); + + $('#blob-input').change(function() { + const filePath = $(this).val(); + $('#file-path').text(filePath.split('\\').pop()); + }); });
cc13a47514441d2ffd90b041d6ef7a792609e61e
src/js/components/search-input.js
src/js/components/search-input.js
import React from 'react' import { sparqlConnect } from '../sparql/configure-sparql' import { LOADING, LOADED, FAILED } from 'sparql-connect' import { browserHistory } from 'react-router' import { uriToLink } from '../router-mapping' import { connect } from 'react-redux' import { changeKeyword } from '../actions/app-state' function SearchInput({ keyword, changeKeyword }) { return ( <span> Search everything : <input type="search" placeholder="Enter a keyword" name="search_input" value={keyword} onChange={e => changeKeyword(e.target.value)} /> <button onClick={() => browserHistory.push(uriToLink.searchItems(keyword))}> OK </button> </span> ) } const mapStateToProps = state => ({ keyword: state.appState.keyword }) export default connect(mapStateToProps, { changeKeyword })(SearchInput)
import React, { Component } from 'react' import { sparqlConnect } from '../sparql/configure-sparql' import { LOADING, LOADED, FAILED } from 'sparql-connect' import { browserHistory } from 'react-router' import { uriToLink } from '../router-mapping' import { connect } from 'react-redux' export default class SearchInput extends Component { constructor(props) { super(props) this.handleSubmit = () => browserHistory.push(uriToLink.searchItems(this.refs.search.value)) } render() { return ( <span> Search everything : <input type="search" placeholder="Enter a keyword" ref="search" /> <button onClick={this.handleSubmit}> OK </button> </span> ) } }
Use stateful component for search input and remove appState reducer
Use stateful component for search input and remove appState reducer
JavaScript
mit
Antoine-Dreyer/Classification-Explorer,UNECE/Classification-Explorer,Antoine-Dreyer/Classification-Explorer,UNECE/Classification-Explorer
--- +++ @@ -1,26 +1,28 @@ -import React from 'react' +import React, { Component } from 'react' import { sparqlConnect } from '../sparql/configure-sparql' import { LOADING, LOADED, FAILED } from 'sparql-connect' import { browserHistory } from 'react-router' import { uriToLink } from '../router-mapping' import { connect } from 'react-redux' -import { changeKeyword } from '../actions/app-state' -function SearchInput({ keyword, changeKeyword }) { - return ( - <span> - Search everything : - <input type="search" placeholder="Enter a keyword" - name="search_input" - value={keyword} - onChange={e => changeKeyword(e.target.value)} /> - <button - onClick={() => browserHistory.push(uriToLink.searchItems(keyword))}> - OK - </button> - </span> - ) +export default class SearchInput extends Component { + + constructor(props) { + super(props) + this.handleSubmit = () => + browserHistory.push(uriToLink.searchItems(this.refs.search.value)) + } + + render() { + return ( + <span> + Search everything : + <input type="search" placeholder="Enter a keyword" ref="search" /> + <button onClick={this.handleSubmit}> + OK + </button> + </span> + ) + } } -const mapStateToProps = state => ({ keyword: state.appState.keyword }) -export default connect(mapStateToProps, { changeKeyword })(SearchInput)
8789732b4ceb906ecc37aa56ba185b52b7c94128
src/server/boot/angular-html5.js
src/server/boot/angular-html5.js
var libPath = require('path'); module.exports = function supportAngularHtml5(server) { var router = server.loopback.Router(); router.all('/*', function(req, res, next) { var reqUrl = req.originalUrl; if (reqUrl.match(/^\/js\/.*/) !== null) { // static javascript resources, skip it next(); } else if (reqUrl.match(/^\/views\/.*/)) { // static html view resources, skip it next(); } else { // otherwise just gave the index.html for angular HTML5 mode support res.sendFile('client/public/index.html', { root: libPath.join(__dirname, '..', '..') }); } }); server.use(router); };
var libPath = require('path'); module.exports = function supportAngularHtml5(server) { var router = server.loopback.Router(); router.all('/*', function(req, res, next) { var reqUrl = req.originalUrl; if (reqUrl.match(/^\/js\/.*/) !== null) { // static javascript resources, skip it next(); } else if (reqUrl.match(/^\/views\/.*/)) { // static html view resources, skip it next(); } else if (reqUrl.match(/^\/img\/.*/)) { // static image resources, skip it next(); } else if (reqUrl.match(/^\/page\/.*/)) { // static html resources, skip it next(); } else if (reqUrl.match(/^\/api.*/)) { // loopback api root, skip it next(); } else if (reqUrl.match(/^\/explorer.*/)) { // loopback explorer root, skip it next(); } else { // otherwise just gave the index.html for angular HTML5 mode support res.sendFile('client/public/index.html', { root: libPath.join(__dirname, '..', '..') }); } }); server.use(router); };
Add more filter rules to meet requirement.
Add more filter rules to meet requirement.
JavaScript
mit
agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart
--- +++ @@ -12,6 +12,18 @@ } else if (reqUrl.match(/^\/views\/.*/)) { // static html view resources, skip it next(); + } else if (reqUrl.match(/^\/img\/.*/)) { + // static image resources, skip it + next(); + } else if (reqUrl.match(/^\/page\/.*/)) { + // static html resources, skip it + next(); + } else if (reqUrl.match(/^\/api.*/)) { + // loopback api root, skip it + next(); + } else if (reqUrl.match(/^\/explorer.*/)) { + // loopback explorer root, skip it + next(); } else { // otherwise just gave the index.html for angular HTML5 mode support res.sendFile('client/public/index.html', { root: libPath.join(__dirname, '..', '..') });
b5fdaf6c9d68dc759f9f05d9c7b3b3dcd2a7ff7a
dawn/js/utils/Ansible.js
dawn/js/utils/Ansible.js
import AppDispatcher from '../dispatcher/AppDispatcher'; let runtimeAddress = localStorage.getItem('runtimeAddress') || '127.0.0.1'; let socket = io('http://' + runtimeAddress + ':5000/'); socket.on('connect', ()=>console.log('Connected to runtime.')); socket.on('connect_error', (err)=>console.log(err)); /* * Hack for Ansible messages to enter Flux flow. * Received messages are dispatched as actions, * with action's type deteremined by msg_type */ socket.on('message', (message)=>{ let unpackedMsg = message.content; unpackedMsg.type = message.header.msg_type; AppDispatcher.dispatch(unpackedMsg); }); /* * Module for communicating with the runtime. */ let Ansible = { /* Private, use sendMessage */ _send(obj) { return socket.emit('message', JSON.stringify(obj)); }, /* Send data over ZMQ to the runtime */ sendMessage(msgType, content) { let msg = { header: { msg_type: msgType }, content: content }; this._send(msg); } }; export default Ansible;
import AppDispatcher from '../dispatcher/AppDispatcher'; let runtimeAddress = localStorage.getItem('runtimeAddress') || '127.0.0.1'; let socket = io('http://' + runtimeAddress + ':5000/'); socket.on('connect', ()=>console.log('Connected to runtime.')); socket.on('connect_error', (err)=>console.log(err)); /* * Hack for Ansible messages to enter Flux flow. * Received messages are dispatched as actions, * with action's type deteremined by msg_type */ socket.on('message', (message)=>{ let transportName = socket.io.engine.transport.name; if (transportName !== 'websocket') { console.log('Websockets not working! Using:', transportName); } let unpackedMsg = message.content; unpackedMsg.type = message.header.msg_type; AppDispatcher.dispatch(unpackedMsg); }); /* * Module for communicating with the runtime. */ let Ansible = { /* Private, use sendMessage */ _send(obj) { return socket.emit('message', JSON.stringify(obj)); }, /* Send data over ZMQ to the runtime */ sendMessage(msgType, content) { let msg = { header: { msg_type: msgType }, content: content }; this._send(msg); } }; export default Ansible;
Add socketio websocket status check
Add socketio websocket status check
JavaScript
apache-2.0
pioneers/PieCentral,pioneers/PieCentral,pioneers/PieCentral,pioneers/PieCentral,pioneers/PieCentral,pioneers/PieCentral,pioneers/PieCentral
--- +++ @@ -11,6 +11,10 @@ * with action's type deteremined by msg_type */ socket.on('message', (message)=>{ + let transportName = socket.io.engine.transport.name; + if (transportName !== 'websocket') { + console.log('Websockets not working! Using:', transportName); + } let unpackedMsg = message.content; unpackedMsg.type = message.header.msg_type; AppDispatcher.dispatch(unpackedMsg);
b88476d0f8ff2ee9a534245b61c672d340c2b941
test/gameSpec.js
test/gameSpec.js
var game = require('../game.js'); var chai = require('chai'); chai.should(); describe('Game', function() { describe('createPack', function() { it('has 52 cards', function() { var p = game.createPack(); p.should.have.lengthOf(52); }); }); describe('shuffle', function() { it('should have same number of cards', function() { var p = game.createPack(); var s = game.shuffle(p); p.should.have.lengthOf(s.length); }); }) describe('draw', function() { describe('one card', function() { it('should draw the requested number', function() { var pack = game.createPack(); var cards = game.draw(pack, 1, [], false); cards.should.have.lengthOf(1); }); }); describe('three cards', function() { it('should draw the requested number', function() { var pack = game.createPack(); var cards = game.draw(pack, 3, [], false); cards.should.have.lengthOf(3); }); }); }); });
var game = require('../game.js'); var chai = require('chai'); chai.should(); describe('Game', function() { describe('createPack', function() { it('has 52 cards', function() { var p = game.createPack(); p.should.have.lengthOf(52); }); }); describe('shuffle', function() { it('should have same number of cards', function() { var p = game.createPack(); var s = game.shuffle(p); p.should.have.lengthOf(s.length); }); }) describe('draw', function() { describe('one card', function() { it('should draw the requested number', function() { var pack = game.createPack(); var cards = game.draw(pack, 1, [], false); cards.should.have.lengthOf(1); }); it('should remove the card from the pack', function() { var pack = game.createPack(); var initialLength = pack.length; var cards = game.draw(pack, 1, [], false); pack.should.have.lengthOf(initialLength - 1); pack.should.not.include(cards[0]); }); }); describe('three cards', function() { it('should draw the requested number', function() { var pack = game.createPack(); var cards = game.draw(pack, 3, [], false); cards.should.have.lengthOf(3); }); it('should remove the cards from the pack', function() { var pack = game.createPack(); var initialLength = pack.length; var cards = game.draw(pack, 3, [], false); pack.should.have.lengthOf(initialLength - 3); pack.should.not.have.members(cards); }); }); }); });
Add test that draw removes card from deck
Add test that draw removes card from deck
JavaScript
mit
psmarshall/500,psmarshall/500
--- +++ @@ -26,6 +26,14 @@ var cards = game.draw(pack, 1, [], false); cards.should.have.lengthOf(1); }); + + it('should remove the card from the pack', function() { + var pack = game.createPack(); + var initialLength = pack.length; + var cards = game.draw(pack, 1, [], false); + pack.should.have.lengthOf(initialLength - 1); + pack.should.not.include(cards[0]); + }); }); describe('three cards', function() { @@ -34,6 +42,14 @@ var cards = game.draw(pack, 3, [], false); cards.should.have.lengthOf(3); }); + + it('should remove the cards from the pack', function() { + var pack = game.createPack(); + var initialLength = pack.length; + var cards = game.draw(pack, 3, [], false); + pack.should.have.lengthOf(initialLength - 3); + pack.should.not.have.members(cards); + }); }); });