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
d38ffbb8e604b3cd23eece42137ed2925bbda3c2
src/helpers/createTypeAlias.js
src/helpers/createTypeAlias.js
export default function createTypeAlias(j, flowTypes, { name, export } = { name: 'Props', export: false }) { const typeAlias = j.typeAlias( j.identifier(name), null, j.objectTypeAnnotation(flowTypes) ); if (export) { return j.exportNamedDeclaration(typeAlias); } return typeAlias; }
export default function createTypeAlias(j, flowTypes, { name='Props', shouldExport=false } = {}) { const typeAlias = j.typeAlias( j.identifier(name), null, j.objectTypeAnnotation(flowTypes) ); if (shouldExport) { return j.exportNamedDeclaration(typeAlias); } return typeAlias; }
Fix defaults, fix `export` arg name
Fix defaults, fix `export` arg name
JavaScript
mit
billyvg/codemod-proptypes-to-flow
--- +++ @@ -1,9 +1,9 @@ -export default function createTypeAlias(j, flowTypes, { name, export } = { name: 'Props', export: false }) { +export default function createTypeAlias(j, flowTypes, { name='Props', shouldExport=false } = {}) { const typeAlias = j.typeAlias( j.identifier(name), null, j.objectTypeAnnotation(flowTypes) ); - if (export) { + if (shouldExport) { return j.exportNamedDeclaration(typeAlias); }
cb5b6c72bffc569c2511af72c309b91dbd308c64
tests/acceptance/simple-relationships-test.js
tests/acceptance/simple-relationships-test.js
import Ember from 'ember'; import { test } from 'qunit'; import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; const { get } = Ember; moduleForAcceptance('Acceptance | simple relationships', { beforeEach() { this.author = server.create('author'); this.post = server.create('post', { author: this.author, }); this.comment = server.create('comment', { post: this.post, }); server.createList('reaction', 4, { post: this.post, }); visit(`/posts/${get(this.post, 'slug')}`); }, }); test('it can use a belongsTo id from the snapshot when generating a url', function(assert) { // Comments are loaded with data and ids assert.equal(find('#comments p').length, 1); }); test('it can load a hasMany relationship from just a url template', function(assert) { assert.equal(find('#reactions p').length, 4); }); test('it can load a belongsTo relationship from just a url template', function(assert) { assert.equal(find('#author').text(), `by ${this.author.name}`); });
import Ember from 'ember'; import { test } from 'qunit'; import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; const { get } = Ember; moduleForAcceptance('Acceptance | simple relationships', { beforeEach() { this.author = server.create('author'); this.post = server.create('post', { author: this.author, }); this.comment = server.create('comment', { post: this.post, }); server.createList('reaction', 4, { post: this.post, }); visit(`/posts/${get(this.post, 'slug')}`); }, }); test('it can use a belongsTo id from the snapshot when generating a url', function(assert) { // The comments relationship comes with with data and ids. Therefore it uses // the findRecord adapter hook in the comment adapter and the comment adapter // urlTemplate. assert.equal(find('#comments p').length, 1); }); test('it can load a hasMany relationship from just a url template', function(assert) { // The reactions relationshp is configured in the post model to use the // urlTemplate. It therefore uses the findMany hook in the post adapter and // the post adapter reactionsUrlTemplate. assert.equal(find('#reactions p').length, 4); }); test('it can load a belongsTo relationship from just a url template', function(assert) { // The reactions relationshp is configured in the post model to use the // urlTemplate. It therefore uses the findBelongsTo hook in the post adapter and // the post adapter authorUrlTemplate. assert.equal(find('#author').text(), `by ${this.author.name}`); });
Clarify the role of each test in the simple relationships acceptance tests
Clarify the role of each test in the simple relationships acceptance tests
JavaScript
mit
amiel/ember-data-url-templates,amiel/ember-data-url-templates
--- +++ @@ -25,15 +25,23 @@ }); test('it can use a belongsTo id from the snapshot when generating a url', function(assert) { - // Comments are loaded with data and ids + // The comments relationship comes with with data and ids. Therefore it uses + // the findRecord adapter hook in the comment adapter and the comment adapter + // urlTemplate. assert.equal(find('#comments p').length, 1); }); test('it can load a hasMany relationship from just a url template', function(assert) { + // The reactions relationshp is configured in the post model to use the + // urlTemplate. It therefore uses the findMany hook in the post adapter and + // the post adapter reactionsUrlTemplate. assert.equal(find('#reactions p').length, 4); }); test('it can load a belongsTo relationship from just a url template', function(assert) { + // The reactions relationshp is configured in the post model to use the + // urlTemplate. It therefore uses the findBelongsTo hook in the post adapter and + // the post adapter authorUrlTemplate. assert.equal(find('#author').text(), `by ${this.author.name}`); });
1c00703a3ac96f44da886596dbb1db50ab79069f
cli/run.js
cli/run.js
/** * @file * Run validation by CLI */ var Q = require('q'); var getOptions = require('../actions/cli/get-options'); var suppressMessages = require('../actions/suppress'); var validateByW3c = require('../actions/validate-by-w3c'); var getReporter = require('../reporter'); function main() { getOptions() .then(function (options) { return Q.all([ {options: options}, validateByW3c(options.url) ]); }) .then(function (data) { var ctx = data[0]; var validationData = suppressMessages(data[1], ctx.options); var reporter = getReporter(ctx.options.reporter); console.log(reporter(validationData, ctx.options)); }) .done(); } if (module === require.main) { main(); }
/** * @file * Run validation by CLI */ var Q = require('q'); var getOptions = require('../actions/cli/get-options'); var suppressMessages = require('../actions/suppress'); var validateByW3c = require('../actions/validate-by-w3c'); var getReporter = require('../reporter'); function main() { getOptions() .then(function (options) { return Q.all([ {options: options}, validateByW3c(options.url) ]); }) .then(function (data) { var ctx = data[0]; var validationData = suppressMessages(data[1], ctx.options); var reporter = getReporter(ctx.options.reporter); console.log(reporter(validationData, ctx.options)); process.exit(validationData.isValid ? 0 : 1); }) .done(); } if (module === require.main) { main(); }
Implement positive exit code if feed is not valid
Implement positive exit code if feed is not valid
JavaScript
mit
andre487/feed-validator,Andre-487/feed-validator,andre487/feed-validator,Andre-487/feed-validator
--- +++ @@ -24,6 +24,8 @@ var reporter = getReporter(ctx.options.reporter); console.log(reporter(validationData, ctx.options)); + + process.exit(validationData.isValid ? 0 : 1); }) .done(); }
1af1c4e115cc9f806241ad589f497cd43b7fdad2
modules/who.js
modules/who.js
module.exports = function(ircbot, config) { var request = require('request'); ircbot.addListener('message', function (from, to, message) { if (to !== config.irc.announceChannel || message !== '!who') { return; } request({ url: 'https://fauna.initlab.org/api/users/present.json', json: true }, function(error, response, body) { if (error !== null || response.statusCode !== 200) { ircbot.say(to, 'Error getting data'); return; } ircbot.say(to, 'People in init Lab: ' + body.map(function(user) { return user.name + ' (' + user.username + ')'; }).join(', ')); }); }); };
module.exports = function(ircbot, config) { var request = require('request'); ircbot.addListener('message', function (from, to, message) { if (to !== config.irc.announceChannel || message !== '!who') { return; } request({ url: 'https://fauna.initlab.org/api/users/present.json', json: true }, function(error, response, body) { if (error !== null || response.statusCode !== 200) { ircbot.say(to, 'Error getting data'); return; } var people = body.map(function(user) { return user.name + ' (' + user.username + ')'; }); if (people.length === 0) { ircbot.say(to, 'No one in init Lab :('); return; } ircbot.say(to, 'People in init Lab: ' + people.join(', ')); }); }); };
Send a different message when no one is in the Lab
Send a different message when no one is in the Lab
JavaScript
mit
initLab/irc-notifier
--- +++ @@ -15,9 +15,16 @@ return; } - ircbot.say(to, 'People in init Lab: ' + body.map(function(user) { + var people = body.map(function(user) { return user.name + ' (' + user.username + ')'; - }).join(', ')); + }); + + if (people.length === 0) { + ircbot.say(to, 'No one in init Lab :('); + return; + } + + ircbot.say(to, 'People in init Lab: ' + people.join(', ')); }); }); };
d230d002bf02fb1063b887a0b67d336c31f45b99
js/jquery-sidebar.js
js/jquery-sidebar.js
$.fn.sidebar = function() { var $sidebar = this; var $tabs = $sidebar.children('.sidebar-tabs').first(); var $container = $sidebar.children('.sidebar-content').first(); $sidebar.find('.sidebar-tabs > li > a').on('click', function() { var $tab = $(this).closest('li'); if ($tab.hasClass('active')) $sidebar.close(); else $sidebar.open(this.hash.slice(1), $tab); }); $sidebar.open = function(id, $tab) { // hide old active contents $container.children('.sidebar-pane.active').removeClass('active'); // show new content $container.children('#' + id).addClass('active'); // remove old active highlights $tabs.children('li.active').removeClass('active'); // set new highlight $tab.addClass('active'); if ($sidebar.hasClass('collapsed')) // open sidebar $sidebar.removeClass('collapsed'); }; $sidebar.close = function() { // remove old active highlights $tabs.children('li.active').removeClass('active'); // close sidebar $sidebar.addClass('collapsed'); }; return $sidebar; };
$.fn.sidebar = function() { var $sidebar = this; var $tabs = $sidebar.children('.sidebar-tabs').first(); var $container = $sidebar.children('.sidebar-content').first(); $sidebar.find('.sidebar-tabs > li > a').on('click', function() { var $tab = $(this).closest('li'); if ($tab.hasClass('active')) $sidebar.close(); else $sidebar.open(this.hash.slice(1), $tab); }); $sidebar.open = function(id, $tab) { if (typeof $tab === 'undefined') $tab = $tabs.find('li > a[href="#' + id + '"]').parent(); // hide old active contents $container.children('.sidebar-pane.active').removeClass('active'); // show new content $container.children('#' + id).addClass('active'); // remove old active highlights $tabs.children('li.active').removeClass('active'); // set new highlight $tab.addClass('active'); if ($sidebar.hasClass('collapsed')) // open sidebar $sidebar.removeClass('collapsed'); }; $sidebar.close = function() { // remove old active highlights $tabs.children('li.active').removeClass('active'); // close sidebar $sidebar.addClass('collapsed'); }; return $sidebar; };
Make open() methods tab parameter optional
js/jquery: Make open() methods tab parameter optional The last three commits are closing #3
JavaScript
mit
wsignor/wsignor.github.io,noerw/sidebar-v2,noerw/sidebar-v2,Turbo87/sidebar-v2,andrewmartini/sidebar-v2,wsignor/wsignor.github.io,MuellerMatthew/sidebar-v2,andrewmartini/sidebar-v2,projectbid7/sidebar-v2
--- +++ @@ -13,6 +13,9 @@ }); $sidebar.open = function(id, $tab) { + if (typeof $tab === 'undefined') + $tab = $tabs.find('li > a[href="#' + id + '"]').parent(); + // hide old active contents $container.children('.sidebar-pane.active').removeClass('active');
593b14d0eb07f9b0c9698da3758df51922825ffa
app/views/room.js
app/views/room.js
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), game.playing ? null : h('form', {id: 'setup', method: 'post', action: `/${gameID}`}, [ h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'submit'}, 'Start') ]), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, className: game.ended ? game.winner === playerID ? 'win' : 'lost' : '' }, [ h('h3', player.name), h('img', {src: player.type === 'nodemcu' ? '/nodemcu.png' : '/phone.png'}), h('span', String(player.score)) ]) })) ]) ]); };
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), game.playing ? null : h('form', {id: 'setup', method: 'post', action: `/${gameID}`}, [ h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'submit'}, 'Start') ]), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, className: game.ended ? game.winner === playerID ? 'won' : 'lost' : '' }, [ h('h3', player.name), h('img', {src: player.type === 'nodemcu' ? '/nodemcu.png' : '/phone.png'}), h('span', String(player.score)) ]) })) ]) ]); };
Fix typo win -> won
Fix typo win -> won
JavaScript
mit
rijkvanzanten/luaus
--- +++ @@ -15,7 +15,7 @@ style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, - className: game.ended ? game.winner === playerID ? 'win' : 'lost' : '' + className: game.ended ? game.winner === playerID ? 'won' : 'lost' : '' }, [ h('h3', player.name), h('img', {src: player.type === 'nodemcu' ? '/nodemcu.png' : '/phone.png'}),
0deb09921fd17a6dac967a47ed2dee31fa85028e
js/reducers/index.js
js/reducers/index.js
import account from './account'; import person from './person'; import languages from './languages'; import jobTypes from './jobTypes'; import creditCards from './creditCards'; const { combineReducers } = require('redux'); export default combineReducers({ person, languages, account, jobTypes, creditCards });
import account from './account'; import person from './person'; import languages from './languages'; import jobTypes from './jobTypes'; import ownedJobs from './ownedJobs'; import creditCards from './creditCards'; const { combineReducers } = require('redux'); export default combineReducers({ person, languages, account, jobTypes, ownedJobs, creditCards });
Add ownedJobs reducer in combineReducers
Add ownedJobs reducer in combineReducers
JavaScript
mit
justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client
--- +++ @@ -2,8 +2,9 @@ import person from './person'; import languages from './languages'; import jobTypes from './jobTypes'; +import ownedJobs from './ownedJobs'; import creditCards from './creditCards'; const { combineReducers } = require('redux'); -export default combineReducers({ person, languages, account, jobTypes, creditCards }); +export default combineReducers({ person, languages, account, jobTypes, ownedJobs, creditCards });
ec1a3d52a358958b27c3648299f96bf53de07e92
server/initViewEngine.js
server/initViewEngine.js
var path = require('path'); module.exports = function initViewEngine (keystone, app) { // Allow usage of custom view engines if (keystone.get('custom engine')) { app.engine(keystone.get('view engine'), keystone.get('custom engine')); } // Set location of view templates and view engine app.set('views', keystone.getPath('views') || path.sep + 'views'); app.set('view engine', keystone.get('view engine')); var customView = keystone.get('view'); if (customView) { app.set('view', customView); } };
var path = require('path'); module.exports = function initViewEngine (keystone, app) { // Allow usage of custom view engines if (keystone.get('custom engine')) { app.engine(keystone.get('view engine'), keystone.get('custom engine')); } // Set location of view templates and view engine app.set('views', keystone.getPath('views') || 'views'); app.set('view engine', keystone.get('view engine')); var customView = keystone.get('view'); if (customView) { app.set('view', customView); } };
Update default views folder so it's relative to the current project, instead of being `/views` at the root of the filesystem.
Update default views folder so it's relative to the current project, instead of being `/views` at the root of the filesystem.
JavaScript
mit
trentmillar/keystone,frontyard/keystone,danielmahon/keystone,matthewstyers/keystone,trentmillar/keystone,vokal/keystone,benkroeger/keystone,benkroeger/keystone,andrewlinfoot/keystone,frontyard/keystone,frontyard/keystone,naustudio/keystone,Pop-Code/keystone,matthewstyers/keystone,trentmillar/keystone,vokal/keystone,vokal/keystone,benkroeger/keystone,andrewlinfoot/keystone,matthewstyers/keystone,danielmahon/keystone,naustudio/keystone,danielmahon/keystone,naustudio/keystone,andrewlinfoot/keystone,Pop-Code/keystone
--- +++ @@ -7,7 +7,7 @@ } // Set location of view templates and view engine - app.set('views', keystone.getPath('views') || path.sep + 'views'); + app.set('views', keystone.getPath('views') || 'views'); app.set('view engine', keystone.get('view engine')); var customView = keystone.get('view');
fb90564f3e93db090f1cf622a22b0ec1fc9f2461
app/initializers/ember-cli-bem.js
app/initializers/ember-cli-bem.js
import Ember from 'ember'; import NamingStrategyFactory from 'ember-cli-bem/naming-strategies/factory'; const { Component, } = Ember; export default { name: 'ember-cli-bem', initialize(owner) { const config = owner.lookup('config:environment'); const addonConfig = config['ember-cli-bem']; const factory = new NamingStrategyFactory(); const strategy = factory.getStrategy(addonConfig); Component.reopen({ __namingStrategy__: strategy, }); }, }
import Ember from 'ember'; import NamingStrategyFactory from 'ember-cli-bem/naming-strategies/factory'; const { Component, } = Ember; export default { name: 'ember-cli-bem', initialize(owner) { const config = owner.registry.resolve('config:environment'); const addonConfig = config['ember-cli-bem']; const factory = new NamingStrategyFactory(); const strategy = factory.getStrategy(addonConfig); Component.reopen({ __namingStrategy__: strategy, }); }, }
Fix a bug in the initializer
Fix a bug in the initializer
JavaScript
mit
nikityy/ember-cli-bem,nikityy/ember-cli-bem
--- +++ @@ -10,7 +10,7 @@ name: 'ember-cli-bem', initialize(owner) { - const config = owner.lookup('config:environment'); + const config = owner.registry.resolve('config:environment'); const addonConfig = config['ember-cli-bem']; const factory = new NamingStrategyFactory(); const strategy = factory.getStrategy(addonConfig);
1dac18d5d0184d382513c34cc1ee2666b924ca35
plugins/queue/discard.js
plugins/queue/discard.js
// discard exports.register = function () { this.register_hook('queue','discard'); } exports.discard = function (next, connection) { var transaction = connection.transaction; if (connection.notes.discard || transaction.notes.discard) { connection.loginfo(this, 'discarding message'); // Pretend we delivered the message return next(OK); } // Allow other queue plugins to deliver return next(); }
// discard exports.register = function () { this.register_hook('queue','discard'); this.register_hook('queue_outbound', 'discard'); } exports.discard = function (next, connection) { var transaction = connection.transaction; if (connection.notes.discard || transaction.notes.discard) { connection.loginfo(this, 'discarding message'); // Pretend we delivered the message return next(OK); } // Allow other queue plugins to deliver return next(); }
Discard plugin should run on queue_outbound as well
Discard plugin should run on queue_outbound as well
JavaScript
mit
Synchro/Haraka,armored/Haraka,Dexus/Haraka,MignonCornet/Haraka,bsmr-x-script/Haraka,jjz/Haraka,julian-maughan/Haraka,AbhilashSrivastava/haraka_sniffer,alessioalex/Haraka,dweekly/Haraka,hatsebutz/Haraka,typingArtist/Haraka,DarkSorrow/Haraka,pedroaxl/Haraka,hiteshjoshi/my-haraka-config,hayesgm/Haraka,msimerson/Haraka,haraka/Haraka,pedroaxl/Haraka,hatsebutz/Haraka,danucalovj/Haraka,smfreegard/Haraka,fatalbanana/Haraka,baudehlo/Haraka,slattery/Haraka,jaredj/Haraka,fredjean/Haraka,msimerson/Haraka,hayesgm/Haraka,jjz/Haraka,typingArtist/Haraka,craigslist/Haraka,pedroaxl/Haraka,msimerson/Haraka,zombified/Haraka,slattery/Haraka,Dexus/Haraka,smfreegard/Haraka,craigslist/Haraka,ruffrey/hk,bsmr-x-script/Haraka,MignonCornet/Haraka,zombified/Haraka,danucalovj/Haraka,bsmr-x-script/Haraka,hiteshjoshi/my-haraka-config,AbhilashSrivastava/haraka_sniffer,bsmr-x-script/Haraka,jaredj/Haraka,mcreenan/Haraka,slattery/Haraka,niteoweb/Haraka,craigslist/Haraka,haraka/Haraka,Synchro/Haraka,msimerson/Haraka,hatsebutz/Haraka,zombified/Haraka,danucalovj/Haraka,hiteshjoshi/my-haraka-config,ruffrey/hk,wltsmrz/Haraka,armored/Haraka,smfreegard/Haraka,DarkSorrow/Haraka,baudehlo/Haraka,Synchro/Haraka,dweekly/Haraka,zombified/Haraka,Dexus/Haraka,jaredj/Haraka,typingArtist/Haraka,fredjean/Haraka,MignonCornet/Haraka,slattery/Haraka,haraka/Haraka,hatsebutz/Haraka,fredjean/Haraka,typingArtist/Haraka,armored/Haraka,Synchro/Haraka,craigslist/Haraka,niteoweb/Haraka,fatalbanana/Haraka,haraka/Haraka,jjz/Haraka,baudehlo/Haraka,xming/Haraka,xming/Haraka,alessioalex/Haraka,baudehlo/Haraka,danucalovj/Haraka,wltsmrz/Haraka,jjz/Haraka,AbhilashSrivastava/haraka_sniffer,MignonCornet/Haraka,mcreenan/Haraka,fatalbanana/Haraka,abhas/Haraka,DarkSorrow/Haraka,smfreegard/Haraka,niteoweb/Haraka,fatalbanana/Haraka,DarkSorrow/Haraka,abhas/Haraka,AbhilashSrivastava/haraka_sniffer,jaredj/Haraka,julian-maughan/Haraka,Dexus/Haraka,abhas/Haraka
--- +++ @@ -2,6 +2,7 @@ exports.register = function () { this.register_hook('queue','discard'); + this.register_hook('queue_outbound', 'discard'); } exports.discard = function (next, connection) {
41eea1ab82ce70a24874cd51498fffcfd3797541
eloquent_js_exercises/chapter09/chapter09_ex01.js
eloquent_js_exercises/chapter09/chapter09_ex01.js
verify(/ca[rt]/, ["my car", "bad cats"], ["camper", "high art"]); verify(/pr?op/, ["pop culture", "mad props"], ["plop"]); verify(/ferr[et|y|ari]/, ["ferret", "ferry", "ferrari"], ["ferrum", "transfer A"]); verify(/ious\b/, ["how delicious", "spacious room"], ["ruinous", "consciousness"]); verify(/\s[.,:;]/, ["bad punctuation ."], ["escape the dot"]); verify(/\w{7,}/, ["hottentottententen"], ["no", "hotten totten tenten"]); verify(/\b[^e ]+\b/, ["red platypus", "wobbling nest"], ["earth bed", "learning ape"]);
// Fill in the regular expressions verify(/ca[rt]/, ["my car", "bad cats"], ["camper", "high art"]); verify(/pr?op/, ["pop culture", "mad props"], ["plop"]); verify(/ferr(et|y|ari)/, ["ferret", "ferry", "ferrari"], ["ferrum", "transfer A"]); verify(/ious\b/, ["how delicious", "spacious room"], ["ruinous", "consciousness"]); verify(/\s[.,:;]/, ["bad punctuation ."], ["escape the period"]); verify(/\w{7,}/, ["hottentottententen"], ["no", "hotten totten tenten"]); verify(/\b[^e\s]+\b/, ["red platypus", "wobbling nest"], ["earth bed", "learning ape"]);
Add Chapter 09, exercise 1
Add Chapter 09, exercise 1
JavaScript
mit
bewuethr/ctci
--- +++ @@ -1,27 +1,29 @@ +// Fill in the regular expressions + verify(/ca[rt]/, - ["my car", "bad cats"], - ["camper", "high art"]); + ["my car", "bad cats"], + ["camper", "high art"]); verify(/pr?op/, - ["pop culture", "mad props"], - ["plop"]); + ["pop culture", "mad props"], + ["plop"]); -verify(/ferr[et|y|ari]/, - ["ferret", "ferry", "ferrari"], - ["ferrum", "transfer A"]); +verify(/ferr(et|y|ari)/, + ["ferret", "ferry", "ferrari"], + ["ferrum", "transfer A"]); verify(/ious\b/, - ["how delicious", "spacious room"], - ["ruinous", "consciousness"]); + ["how delicious", "spacious room"], + ["ruinous", "consciousness"]); verify(/\s[.,:;]/, - ["bad punctuation ."], - ["escape the dot"]); + ["bad punctuation ."], + ["escape the period"]); verify(/\w{7,}/, - ["hottentottententen"], - ["no", "hotten totten tenten"]); + ["hottentottententen"], + ["no", "hotten totten tenten"]); -verify(/\b[^e ]+\b/, - ["red platypus", "wobbling nest"], - ["earth bed", "learning ape"]); +verify(/\b[^e\s]+\b/, + ["red platypus", "wobbling nest"], + ["earth bed", "learning ape"]);
062ebb5ecf53c778c2e1e67e5f070927cedeb78d
meanrecipes/static/js/script.js
meanrecipes/static/js/script.js
$('#suggestions').typed({ strings: ["chocolate chip cookies", "brownies", "pancakes"], typeSpeed: 50, backSpeed: 15, backDelay: 1500, loop: true, }); $('#recipe-form').submit(function() { get_recipe($('#recipe-title').val()); return false; }); function get_recipe(title) { var url = '/recipe/search/' + title; $.get(url, function(data) { $('#ingredients').empty(); $('#method').empty(); data = JSON.parse(data); $('#title').text("Recipe for " + data.title); for (i = 0; i < data.ingredients.length; i++) { $('#ingredients').append('<li>' + data.ingredients[i][0] + data.ingredients[i][1] + " " + data.ingredients[i][2] + '</li>'); } for (i = 0; i < data.method.length; i++) { $('#method').append('<li>' + data.method[i] + '</li>'); } }); }
$('#suggestions').typed({ strings: ["chocolate chip cookies", "brownies", "pancakes"], typeSpeed: 50, backSpeed: 15, backDelay: 1500, loop: true }); $('#recipe-form').submit(function() { get_recipe($('#recipe-title').val()); return false; }); function get_recipe(title) { var url = '/recipe/search/' + title; $.get(url, function(data) { $('#ingredients').empty(); $('#method').empty(); $('#title').text("Recipe for " + data.title); for (i = 0; i < data.ingredients.length; i++) { $('#ingredients').append('<li>' + data.ingredients[i][0] + data.ingredients[i][1] + " " + data.ingredients[i][2] + '</li>'); } for (i = 0; i < data.method.length; i++) { $('#method').append('<li>' + data.method[i] + '</li>'); } } ); }
Fix JSON parsing bug, ingredients displayed correctly again.
Fix JSON parsing bug, ingredients displayed correctly again.
JavaScript
bsd-2-clause
kkelk/MeanRecipes,kkelk/MeanRecipes,kkelk/MeanRecipes,kkelk/MeanRecipes
--- +++ @@ -3,29 +3,28 @@ typeSpeed: 50, backSpeed: 15, backDelay: 1500, - loop: true, + loop: true }); $('#recipe-form').submit(function() { - get_recipe($('#recipe-title').val()); - return false; + get_recipe($('#recipe-title').val()); + return false; }); function get_recipe(title) { - var url = '/recipe/search/' + title; - $.get(url, - function(data) { - $('#ingredients').empty(); - $('#method').empty(); + var url = '/recipe/search/' + title; + $.get(url, + function(data) { + $('#ingredients').empty(); + $('#method').empty(); - data = JSON.parse(data); - $('#title').text("Recipe for " + data.title); -for (i = 0; i < data.ingredients.length; i++) { - $('#ingredients').append('<li>' + data.ingredients[i][0] + data.ingredients[i][1] + " " + data.ingredients[i][2] + '</li>'); + $('#title').text("Recipe for " + data.title); + for (i = 0; i < data.ingredients.length; i++) { + $('#ingredients').append('<li>' + data.ingredients[i][0] + data.ingredients[i][1] + " " + data.ingredients[i][2] + '</li>'); + } + for (i = 0; i < data.method.length; i++) { + $('#method').append('<li>' + data.method[i] + '</li>'); + } + } + ); } - for (i = 0; i < data.method.length; i++) { - $('#method').append('<li>' + data.method[i] + '</li>'); - } - }); -} -
c3aeab3192ceb5dc32333453ae35d21878ed4a84
demo/server.js
demo/server.js
'use strict'; var path = require('path'); var bigrest = require('../index'); var http = bigrest.listen(18080, { debug: true, basepath: __dirname, static: { urlpath: '/files', filepath: path.join(__dirname, 'files') }, compression: { threshold: 16 * 1024 } });
'use strict'; var path = require('path'); var bigrest = require('../index'); var http = bigrest.listen(18080, { debug: true, basepath: __dirname, static: { urlpath: '/files', filepath: path.join(__dirname, 'files') }, compression: { threshold: 16 * 1024 }, rootwork: function(req, res) { res.send('It works...'); }, r404work: function(req, res, next) { if(req.path !== '/404') next(); else res.redirect('/'); } });
Add demo for options r404work
Add demo for options r404work
JavaScript
mit
vietor/bigrest,vietor/bigrest
--- +++ @@ -12,5 +12,14 @@ }, compression: { threshold: 16 * 1024 + }, + rootwork: function(req, res) { + res.send('It works...'); + }, + r404work: function(req, res, next) { + if(req.path !== '/404') + next(); + else + res.redirect('/'); } });
c0c389b65c3eb323d76e75c005e2383b6ebfbe84
src/content_scripts/utilities/next_friday_provider.js
src/content_scripts/utilities/next_friday_provider.js
import moment from 'moment' export default class NextFridayProvider { static formattedDate() { return momentNextFriday().format('M/D'); } static millisecondsDate() { return momentNextFriday().toDate().valueOf(); } } const momentNextFriday = () => { let nextFriday = moment() .endOf('week') .subtract(1, 'day') .hour(15) .minutes(0) .seconds(0) .milliseconds(0); if (moment().isAfter(nextFriday)) { nextFriday.add(1, 'week'); } return nextFriday; };
import moment from 'moment' export default class NextFridayProvider { static formattedDate() { return momentNextFriday().format('M/D'); } static millisecondsDate() { return momentNextFriday().toDate().valueOf(); } } const momentNextFriday = () => { let nextFriday = moment() .endOf('week') .subtract(1, 'day') .hour(14) .minutes(0) .seconds(0) .milliseconds(0); if (moment().isAfter(nextFriday)) { nextFriday.add(1, 'week'); } return nextFriday; };
Make alarm go off at 3pm instead of 4pm
Make alarm go off at 3pm instead of 4pm - Moment dates are 0 indexed
JavaScript
isc
oliverswitzer/wwltw-for-pivotal-tracker,oliverswitzer/wwltw-for-pivotal-tracker
--- +++ @@ -14,7 +14,7 @@ let nextFriday = moment() .endOf('week') .subtract(1, 'day') - .hour(15) + .hour(14) .minutes(0) .seconds(0) .milliseconds(0);
05825cb8ab1d4554153e1d327917665b5547792c
src/nodes/local-node-device-stats/device-stats.es6.js
src/nodes/local-node-device-stats/device-stats.es6.js
'use strict'; import { StatsCollector } from './lib/stats'; export default function(RED) { class DeviceStatsNode { constructor(n) { RED.nodes.createNode(this, n); this.name = n.name; this.mem = n.mem; this.nw = n.nw; this.load = n.load; this.hostname = n.hostname; this.useString = n.useString; this.collector = new StatsCollector(this); this.status({}); this.on('input', msg => { clearTimeout(this.timeout); this.status({ fill: 'red', shape: 'dot', text: 'device-stats.status.heartbeat' }); let opts = msg ? msg.payload : null; this.collector.collect(opts).then(stats => { if (this.useString || opts && opts.useString) { stats = JSON.stringify(stats); } this.send({ payload: stats }); this.timeout = setTimeout(() => { this.status({}); }, 750); }).catch(err => { RED.log.warn(RED._('device-stats.errors.unknown', { error: err })); this.status({}); }); }); } } RED.nodes.registerType('DeviceStats', DeviceStatsNode); }
'use strict'; import { StatsCollector } from './lib/stats'; export default function(RED) { class DeviceStatsNode { constructor(n) { RED.nodes.createNode(this, n); this.name = n.name; this.mem = n.mem; this.nw = n.nw; this.load = n.load; this.hostname = n.hostname; this.useString = n.useString; this.collector = new StatsCollector(this); this.status({}); this.on('input', msg => { clearTimeout(this.timeout); delete this.timeout; this.status({ fill: 'red', shape: 'dot', text: 'device-stats.status.heartbeat' }); let opts = msg ? msg.payload : null; this.collector.collect(opts).then(stats => { if (this.useString || opts && opts.useString) { stats = JSON.stringify(stats); } this.send({ payload: stats }); this.timeout = setTimeout(() => { if (this.timeout) { this.status({}); } }, 750); }).catch(err => { RED.log.warn(RED._('device-stats.errors.unknown', { error: err })); this.status({}); }); }); } } RED.nodes.registerType('DeviceStats', DeviceStatsNode); }
Clear the status only when the timeout is valid
Clear the status only when the timeout is valid
JavaScript
unknown
CANDY-LINE/candy-red,dbaba/candy-red,CANDY-LINE/candy-red,dbaba/candy-red,dbaba/candy-red,CANDY-LINE/candy-red
--- +++ @@ -18,6 +18,7 @@ this.on('input', msg => { clearTimeout(this.timeout); + delete this.timeout; this.status({ fill: 'red', shape: 'dot', text: 'device-stats.status.heartbeat' }); let opts = msg ? msg.payload : null; this.collector.collect(opts).then(stats => { @@ -26,7 +27,9 @@ } this.send({ payload: stats }); this.timeout = setTimeout(() => { - this.status({}); + if (this.timeout) { + this.status({}); + } }, 750); }).catch(err => { RED.log.warn(RED._('device-stats.errors.unknown', { error: err }));
ddfd3f09e5d0efefbe88eafe6ebfe64d2ee19d2c
test/index.test.js
test/index.test.js
const assert = require('assert'); const configMergeLoader = require('../index.js'); describe('Config Merge Loader', function() { it('should return a function', function() { assert.equal(typeof configMergeLoader, 'function'); }); describe('when called', function() { const loaderInput = 'Loader Content'; it('should return as string', function() { const loaderResult = configMergeLoader(loaderInput); assert.equal(typeof loaderResult, 'string'); }); }); });
const assert = require('assert'); const configMergeLoader = require('../index.js'); describe('Config Merge Loader', function() { it('should return a function', function() { assert.equal(typeof configMergeLoader, 'function'); }); describe('when called', function() { const loaderInput = 'Loader Content'; it('should return as string', function() { const loaderResult = configMergeLoader(loaderInput); assert.equal(typeof loaderResult, 'string'); }); it('should return the same string it is given', function() { const loaderResult = configMergeLoader(loaderInput); assert.equal(loaderResult, loaderInput); }); }); });
Test that it returns the same string it is given
Test that it returns the same string it is given
JavaScript
mit
bitfyre/config-merge-loader
--- +++ @@ -13,5 +13,10 @@ const loaderResult = configMergeLoader(loaderInput); assert.equal(typeof loaderResult, 'string'); }); + + it('should return the same string it is given', function() { + const loaderResult = configMergeLoader(loaderInput); + assert.equal(loaderResult, loaderInput); + }); }); });
f4015e8cd71450ddf7b7ebfb96f0957c3e5dea8d
test/plexacious.js
test/plexacious.js
const { expect } = require('chai'); const Plexacious = require('../js/Plexacious'); const plex = new Plexacious(); describe('Plexacious:', () => { describe('Event attaching:', () => { it('should attach a callback to an event', () => { plex.on('test', () => {}); expect(plex._eventEmitter.listenerCount('test')).to.equal(1); }); it('should detach the callback if no function is passed', () => { plex.on('test'); expect(plex._eventEmitter.listenerCount('test')).to.equal(0); }); }); describe('Recently Added:', () => { }); });
const { expect } = require('chai'); const Plexacious = require('../js/Plexacious'); const plex = new Plexacious(); describe('Plexacious:', () => { });
Remove event-related tests since we're now simply extending the EventEmitter class
Remove event-related tests since we're now simply extending the EventEmitter class
JavaScript
isc
ketsugi/plexacious
--- +++ @@ -4,19 +4,4 @@ const plex = new Plexacious(); describe('Plexacious:', () => { - describe('Event attaching:', () => { - it('should attach a callback to an event', () => { - plex.on('test', () => {}); - expect(plex._eventEmitter.listenerCount('test')).to.equal(1); - }); - - it('should detach the callback if no function is passed', () => { - plex.on('test'); - expect(plex._eventEmitter.listenerCount('test')).to.equal(0); - }); - }); - - describe('Recently Added:', () => { - - }); });
8d5b8c535cdc6c281f5e3b3613b548322eae4905
src/scripts/editor/Exporter.js
src/scripts/editor/Exporter.js
export default class Exporter { constructor(editor) { this.editor = editor; } getData() { var tweenTime = this.editor.tweenTime; var domain = this.editor.timeline.x.domain(); var domain_start = domain[0]; var domain_end = domain[1]; return { settings: { time: tweenTime.timer.getCurrentTime(), duration: tweenTime.timer.getDuration(), domain: [domain_start.getTime(), domain_end.getTime()] }, data: tweenTime.data }; } getJSON() { var options = this.editor.options; var json_replacer = function(key, val) { // Disable all private properies from TweenMax/TimelineMax if (key.indexOf('_') === 0) { return undefined; } if (options.json_replacer !== undefined) { return options.json_replacer(key, val); } return val; }; var data = this.getData(); return JSON.stringify(data, json_replacer, 2); } }
export default class Exporter { constructor(editor) { this.editor = editor; } getData() { var tweenTime = this.editor.tweenTime; var domain = this.editor.timeline.x.domain(); var domain_start = domain[0]; var domain_end = domain[1]; return { settings: { time: tweenTime.timer.getCurrentTime(), duration: tweenTime.timer.getDuration(), domain: [domain_start.getTime(), domain_end.getTime()] }, data: tweenTime.data }; } getJSON() { var options = this.editor.options; var json_replacer = function(key, val) { // Disable all private properies from TweenMax/TimelineMax if (key.indexOf('_') === 0) { return undefined; } if (options.json_replacer !== undefined) { return options.json_replacer(key, val); } return val; }; var data = this.getData(); // Give the possibility to add your own data in the export. // ex: new Editor({getJSON: function(data) {data.test = 42; return data;} }) if (typeof this.editor.options.getJSON !== 'undefined') { data = this.editor.options.getJSON(data); } return JSON.stringify(data, json_replacer, 2); } }
Add ability to add your own data in export (exporter.getJSON)
Add ability to add your own data in export (exporter.getJSON)
JavaScript
mit
idflood/TweenTime,idflood/TweenTime
--- +++ @@ -32,6 +32,11 @@ }; var data = this.getData(); + // Give the possibility to add your own data in the export. + // ex: new Editor({getJSON: function(data) {data.test = 42; return data;} }) + if (typeof this.editor.options.getJSON !== 'undefined') { + data = this.editor.options.getJSON(data); + } return JSON.stringify(data, json_replacer, 2); } }
3375511bc07214da78c36fdd4f87ec7bea8aceed
installed-tests/test/js/test0010basic.js
installed-tests/test/js/test0010basic.js
const JSUnit = imports.jsUnit; // application/javascript;version=1.8 function testBasic1() { var foo = 1+1; JSUnit.assertEquals(2, foo); } function testFakeFailure() { var foo = 1+1; JSUnit.assertEquals(5, foo); } JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
const JSUnit = imports.jsUnit; // application/javascript;version=1.8 function testBasic1() { var foo = 1+1; JSUnit.assertEquals(2, foo); } JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
Revert "Add a fake test failure"
Revert "Add a fake test failure" This reverts commit 564dc61d02b854a278b07e21c65c33859ee82dbc.
JavaScript
mit
pixunil/cjs,mtwebster/cjs,pixunil/cjs,djdeath/gjs,djdeath/gjs,djdeath/gjs,mtwebster/cjs,djdeath/gjs,mtwebster/cjs,pixunil/cjs,pixunil/cjs,endlessm/gjs,endlessm/gjs,mtwebster/cjs,endlessm/gjs,djdeath/gjs,pixunil/cjs,endlessm/gjs,mtwebster/cjs,endlessm/gjs
--- +++ @@ -5,9 +5,4 @@ JSUnit.assertEquals(2, foo); } -function testFakeFailure() { - var foo = 1+1; - JSUnit.assertEquals(5, foo); -} - JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
d688d4bdfa582484669f319b1829bfcbdaaeadae
esm/router.js
esm/router.js
/* global Node */ import { ensureEl } from './util.js'; import { setChildren } from './setchildren.js'; export function router (parent, Views, initData) { return new Router(parent, Views, initData); } export class Router { constructor (parent, Views, initData) { this.el = ensureEl(parent); this.Views = Views; this.initData = initData; } update (route, data) { if (route !== this.route) { const Views = this.Views; const View = Views[route]; this.route = route; if (View instanceof Node || View.el instanceof Node) { this.view = View; } else { this.view = View && new View(this.initData, data); } setChildren(this.el, [ this.view ]); } this.view && this.view.update && this.view.update(data, route); } }
/* global Node */ import { ensureEl } from './util.js'; import { setChildren } from './setchildren.js'; export function router (parent, Views, initData) { return new Router(parent, Views, initData); } export class Router { constructor (parent, Views, initData) { this.el = ensureEl(parent); this.Views = Views; this.initData = initData; } update (route, data) { if (route !== this.route) { const Views = this.Views; const View = Views[route]; this.route = route; if (View && (View instanceof Node || View.el instanceof Node)) { this.view = View; } else { this.view = View && new View(this.initData, data); } setChildren(this.el, [ this.view ]); } this.view && this.view.update && this.view.update(data, route); } }
Fix critical bug with Router
Fix critical bug with Router
JavaScript
mit
redom/redom,pakastin/redom
--- +++ @@ -20,7 +20,7 @@ this.route = route; - if (View instanceof Node || View.el instanceof Node) { + if (View && (View instanceof Node || View.el instanceof Node)) { this.view = View; } else { this.view = View && new View(this.initData, data);
370aa543cf79d19ccfbba0b69f442a08db20cf90
data/fillIn.js
data/fillIn.js
/* * This Source Code is subject to the terms of the Mozilla Public License * version 2.0 (the "License"). You can obtain a copy of the License at * http://mozilla.org/MPL/2.0/. */ "use strict"; let {host, password} = self.options; if (location.hostname != host) throw new Error("Password is meant for a different website, not filling in."); let fields = document.querySelectorAll("input[type=password]"); fields = Array.filter(fields, element => element.offsetHeight && element.offsetWidth); if (fields.length > 0) { for (let field of fields) field.value = password; fields[0].focus(); self.port.emit("success"); } else self.port.emit("failure");
/* * This Source Code is subject to the terms of the Mozilla Public License * version 2.0 (the "License"). You can obtain a copy of the License at * http://mozilla.org/MPL/2.0/. */ "use strict"; let {host, password} = self.options; if (location.hostname != host) throw new Error("Password is meant for a different website, not filling in."); let fields = document.querySelectorAll("input[type=password]"); fields = Array.filter(fields, element => element.offsetHeight && element.offsetWidth); if (fields.length > 0) { for (let field of fields) { field.value = password; field.dispatchEvent(new Event("change", {bubbles: true})); } fields[0].focus(); self.port.emit("success"); } else self.port.emit("failure");
Make sure to trigger "change" event when filling in passwords, webpage logic might rely on it
Make sure to trigger "change" event when filling in passwords, webpage logic might rely on it
JavaScript
mpl-2.0
palant/easypasswords,palant/easypasswords
--- +++ @@ -15,7 +15,10 @@ if (fields.length > 0) { for (let field of fields) + { field.value = password; + field.dispatchEvent(new Event("change", {bubbles: true})); + } fields[0].focus(); self.port.emit("success"); }
5cfc30383756d04c84bf4306a350685185dd4ca4
couchdb.js
couchdb.js
// Copyright 2011 Iris Couch // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. module.exports = handle_http function handle_http(req, res) { res.writeHead(200) res.end('Hello, world\n') }
// Copyright 2011 Iris Couch // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. var express = require('express') var app = express() module.exports = app app.get('/', function(req, res) { res.send('Hello from express!\n') }) if(require.main === module) { app.listen(3000) console.log('Listening on :3000') }
Use an Express app instead
Use an Express app instead
JavaScript
apache-2.0
iriscouch/couchjs,iriscouch/couchjs
--- +++ @@ -12,9 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -module.exports = handle_http +var express = require('express') -function handle_http(req, res) { - res.writeHead(200) - res.end('Hello, world\n') +var app = express() +module.exports = app + +app.get('/', function(req, res) { + res.send('Hello from express!\n') +}) + +if(require.main === module) { + app.listen(3000) + console.log('Listening on :3000') }
2f70c937c40af5fb88f76f5e7af08800f29a93fc
main/exports.js
main/exports.js
'use strict'; const {BrowserWindow, app} = require('electron'); const loadRoute = require('./utils/routes'); let exportsWindow = null; const openExportsWindow = show => { if (!exportsWindow) { exportsWindow = new BrowserWindow({ width: 320, height: 360, resizable: false, minimizable: false, maximizable: false, titleBarStyle: 'hiddenInset', show }); loadRoute(exportsWindow, 'exports'); exportsWindow.on('close', event => { event.preventDefault(); exportsWindow.hide(); }); exportsWindow.on('closed', () => { exportsWindow = null; }); } }; const getExportsWindow = () => exportsWindow; const showExportsWindow = () => { if (!exportsWindow) { openExportsWindow(true); } if (exportsWindow.isVisible()) { exportsWindow.focus(); } else { exportsWindow.show(); } }; app.on('before-quit', () => { if (exportsWindow) { exportsWindow.removeAllListeners('close'); } }); module.exports = { openExportsWindow, getExportsWindow, showExportsWindow };
'use strict'; const {BrowserWindow, app} = require('electron'); const loadRoute = require('./utils/routes'); let exportsWindow = null; const openExportsWindow = show => { if (!exportsWindow) { exportsWindow = new BrowserWindow({ width: 320, height: 360, resizable: false, maximizable: false, fullscreenable: false, titleBarStyle: 'hiddenInset', show }); loadRoute(exportsWindow, 'exports'); exportsWindow.on('close', event => { event.preventDefault(); exportsWindow.hide(); }); exportsWindow.on('closed', () => { exportsWindow = null; }); } }; const getExportsWindow = () => exportsWindow; const showExportsWindow = () => { if (!exportsWindow) { openExportsWindow(true); } if (exportsWindow.isVisible()) { exportsWindow.focus(); } else { exportsWindow.show(); } }; app.on('before-quit', () => { if (exportsWindow) { exportsWindow.removeAllListeners('close'); } }); module.exports = { openExportsWindow, getExportsWindow, showExportsWindow };
Fix the export window options
Fix the export window options The window should be minimizable but not fullscreenable.
JavaScript
mit
wulkano/kap
--- +++ @@ -11,8 +11,8 @@ width: 320, height: 360, resizable: false, - minimizable: false, maximizable: false, + fullscreenable: false, titleBarStyle: 'hiddenInset', show });
1ef3f1ce228275c3714a4874163b220c85fe6cce
client/app/controllers/profile.js
client/app/controllers/profile.js
angular.module('bolt.profile', ['bolt.auth']) .controller('ProfileController', function ($scope, $rootScope, $window, Auth, Profile) { $scope.newInfo = {}; $scope.session = window.localStorage; var getUserInfo = function () { Profile.getUser() .then(function (currentUser) { // $window.localStorage.setItem('username', currentUser.username); // $window.localStorage.setItem('firstName', currentUser.firstName); // $window.localStorage.setItem('lastName', currentUser.lastName); // $window.localStorage.setItem('phone', currentUser.phone); // $window.localStorage.setItem('email', currentUser.email); // $window.localStorage.setItem('preferredDistance', currentUser.preferredDistance); // $window.localStorage.setItem('runs', currentUser.runs); // $window.localStorage.setItem('achievements', currentUser.achievements); }) .catch(function (err) { console.error(err); }); }; $scope.signout = function () { Auth.signout(); }; getUserInfo(); });
angular.module('bolt.profile', ['bolt.auth']) .controller('ProfileController', function ($scope, $rootScope, $window, Auth, Profile) { $scope.newInfo = {}; $scope.session = window.localStorage; var getUserInfo = function () { Profile.getUser() .catch(function (err) { console.error(err); }); }; $scope.signout = function () { Auth.signout(); }; getUserInfo(); });
Remove zombie code, .then for useless promise
Remove zombie code, .then for useless promise
JavaScript
mit
elliotaplant/Bolt,gm758/Bolt,boisterousSplash/Bolt,thomasRhoffmann/Bolt,gm758/Bolt,boisterousSplash/Bolt,thomasRhoffmann/Bolt,elliotaplant/Bolt
--- +++ @@ -6,16 +6,6 @@ var getUserInfo = function () { Profile.getUser() - .then(function (currentUser) { - // $window.localStorage.setItem('username', currentUser.username); - // $window.localStorage.setItem('firstName', currentUser.firstName); - // $window.localStorage.setItem('lastName', currentUser.lastName); - // $window.localStorage.setItem('phone', currentUser.phone); - // $window.localStorage.setItem('email', currentUser.email); - // $window.localStorage.setItem('preferredDistance', currentUser.preferredDistance); - // $window.localStorage.setItem('runs', currentUser.runs); - // $window.localStorage.setItem('achievements', currentUser.achievements); - }) .catch(function (err) { console.error(err); });
56e908e8f9e4e4758eecbfa1a74e3d4d533dd4d2
collections/user.js
collections/user.js
Meteor.methods({ userAddVisitedRoom: function(roomId) { var rooms = Rooms.find({ _id: roomId }, { _id: 1 }); if (rooms.count() === 0) { throw new Meteor.Error(422, 'Room does not exist'); } var users = Meteor.users.find({ $and: [{ _id: Meteor.userId() }, { visitedRooms: { $elemMatch: { room_id: roomId } } }] }, { _id: 1 }); if (users.count() === 0) { Meteor.users.update({ _id: Meteor.userId() }, { $push: { visitedRooms: { when: new Date(), room_id: roomId } } }); } }, userUpdate: function(user) { validateUser(user); Meteor.users.update({ _id: Meteor.userId() }, { $set: user }); } }); var validateUser = function(user) { check(user, { 'profile.fullname': String, 'profile.company': String, 'profile.location': String, 'profile.about': String, 'profile.skills': Array, 'profile.interests': Array, 'profile.availability': { morning: Boolean, afternoon: Boolean, night: Boolean }, 'profile.timezone': String }); };
Meteor.methods({ userAddVisitedRoom: function(roomId) { var rooms = Rooms.find({ _id: roomId }, { _id: 1 }); if (rooms.count() === 0) { throw new Meteor.Error(422, 'Room does not exist'); } var users = Meteor.users.find({ $and: [{ _id: Meteor.userId() }, { visitedRooms: { $elemMatch: { room_id: roomId } } }] }, { _id: 1 }); if (users.count() === 0) { Meteor.users.update({ _id: Meteor.userId() }, { $push: { visitedRooms: { when: new Date(), room_id: roomId } } }); Rooms.update({ _id: roomId }, { $inc: { visits: 1 } }); } }, userUpdate: function(user) { validateUser(user); Meteor.users.update({ _id: Meteor.userId() }, { $set: user }); } }); var validateUser = function(user) { check(user, { 'profile.fullname': String, 'profile.company': String, 'profile.location': String, 'profile.about': String, 'profile.skills': Array, 'profile.interests': Array, 'profile.availability': { morning: Boolean, afternoon: Boolean, night: Boolean }, 'profile.timezone': String }); };
Add visit counter for rooms.
Add visit counter for rooms.
JavaScript
mit
eagleoneraptor/confnode,eagleoneraptor/confnode,dnohales/confnode,dnohales/confnode
--- +++ @@ -34,6 +34,14 @@ } } }); + + Rooms.update({ + _id: roomId + }, { + $inc: { + visits: 1 + } + }); } },
9888147ba44dd9a8505f07de40053cf3c71fdd04
init_chrome.js
init_chrome.js
chrome.app.runtime.onLaunched.addListener(function () { chrome.app.window.create('app/index.html', { bounds: { width: 800, height: 600, left: 100, top: 100 }, minWidth: 800, minHeight: 600 }); });
chrome.app.runtime.onLaunched.addListener(function () { chrome.app.window.create('app/index.html', { bounds: { width: 800, height: 600, left: 100, top: 100 }, minWidth: 400, minHeight: 400, frame: 'none' }); });
Hide frame on Chrome App
Hide frame on Chrome App
JavaScript
unknown
nitrotasks/nitro,nitrotasks/nitro,CaffeinatedCode/nitro
--- +++ @@ -7,8 +7,9 @@ left: 100, top: 100 }, - minWidth: 800, - minHeight: 600 + minWidth: 400, + minHeight: 400, + frame: 'none' }); });
64994f9901bcf3cef537da822e603215fa5b4568
lib/models/errors.js
lib/models/errors.js
ErrorModel = function (appId) { var self = this; this.appId = appId; this.errors = {}; this.startTime = Date.now(); } _.extend(ErrorModel.prototype, KadiraModel.prototype); ErrorModel.prototype.buildPayload = function() { var metrics = _.values(this.errors); this.startTime = Date.now(); this.errors = {}; return {errors: metrics}; }; ErrorModel.prototype.trackError = function(ex, trace) { var key = trace.type + ':' + ex.message; if(this.errors[key]) { this.errors[key].count++; } else { this.errors[key] = this._formatError(ex, trace); } }; ErrorModel.prototype._formatError = function(ex, trace) { var source = trace.type + ':' + trace.name; return { appId : this.appId, name : ex.message, source : source, startTime : trace.at, type : 'server', trace: trace, stack : [{at: trace.at, events: trace.events, stack: ex.stack}], count: 1, } };
ErrorModel = function (appId) { var self = this; this.appId = appId; this.errors = {}; this.startTime = Date.now(); } _.extend(ErrorModel.prototype, KadiraModel.prototype); ErrorModel.prototype.buildPayload = function() { var metrics = _.values(this.errors); this.startTime = Date.now(); this.errors = {}; return {errors: metrics}; }; ErrorModel.prototype.trackError = function(ex, trace) { var key = trace.type + ':' + ex.message; if(this.errors[key]) { this.errors[key].count++; } else { this.errors[key] = this._formatError(ex, trace); } }; ErrorModel.prototype._formatError = function(ex, trace) { var source = trace.type + ':' + trace.name; return { appId : this.appId, name : ex.message, source : source, startTime : trace.at, type : 'server', trace: trace, stack : [{stack: ex.stack}], count: 1, } };
Remove redundant data (error time and events)
Remove redundant data (error time and events)
JavaScript
mit
meteorhacks/kadira,chatr/kadira
--- +++ @@ -33,7 +33,7 @@ startTime : trace.at, type : 'server', trace: trace, - stack : [{at: trace.at, events: trace.events, stack: ex.stack}], + stack : [{stack: ex.stack}], count: 1, } };
6a94be934d49b145a877609b2ea37f805ade5910
src/components/Footer.js
src/components/Footer.js
import React, { Component } from 'react'; class Footer extends Component { render() { if (this.props.data) { var networks = this.props.data.social.map(function (network) { return ( <span key={network.name} className="m-4"> <a href={network.url}> <i className={network.class}></i> </a> </span> ); }); } return ( <footer> <div className="col-md-12"> <div className="social-links">{networks}</div> <div className="copyright py-4 text-center"> <div className="container"> <small>Copyright &copy; Davina Griss</small> </div> </div> </div> </footer> ); } } export default Footer;
import React, { Component } from 'react'; class Footer extends Component { render() { if (this.props.data) { var networks = this.props.data.social.map(function (network) { return ( <span key={network.name} className="m-4"> <a href={network.url} target="_blank" rel="noopener noreferrer"> <i className={network.class}></i> </a> </span> ); }); } return ( <footer> <div className="col-md-12"> <div className="social-links">{networks}</div> <div className="copyright py-4 text-center"> <div className="container"> <small>Copyright &copy; Davina Griss</small> </div> </div> </div> </footer> ); } } export default Footer;
Add target blank for footer links
Add target blank for footer links
JavaScript
mit
enesates/enesates.github.io,enesates/enesates.github.io,NestorPlasencia/NestorPlasencia.github.io,NestorPlasencia/NestorPlasencia.github.io
--- +++ @@ -6,7 +6,7 @@ var networks = this.props.data.social.map(function (network) { return ( <span key={network.name} className="m-4"> - <a href={network.url}> + <a href={network.url} target="_blank" rel="noopener noreferrer"> <i className={network.class}></i> </a> </span>
c9cc4809e687d33cd807268fe9b9e147ebe99687
web_server.js
web_server.js
const express = require('express'); const http = require('http'); const socketIO = require('socket.io'); const path = require('path'); const app = express(); const server = http.Server(app); const io = socketIO(server); // Exposes the folder frontend app.use(express.static(path.join(__dirname, 'frontend', 'dist'))); io.on('connection', function (socket) { socket.emit('test-event', { hello: 'world' }); socket.on('another-event', function (data) { console.log(data); }); }); server.listen(process.env.PORT || 3000, () => { console.log(`Server is listening on port: ${server.address().port}`); });
const express = require('express'); const http = require('http'); const socketIO = require('socket.io'); const path = require('path'); const app = express(); const server = http.Server(app); const io = socketIO(server); // Exposes the folder frontend app.use(express.static(path.join(__dirname, 'frontend', 'dist'))); io.on('connection', function (socket) { socket.emit('test-event', { hello: 'world' }); socket.on('another-event', function (data) { console.log(data); }); }); server.listen(process.env.PORT || 80, () => { console.log(`Server is listening on port: ${server.address().port}`); });
Use port 80 as default
Use port 80 as default
JavaScript
mit
mbrandau/simple-chat,mbrandau/simple-chat,mbrandau/simple-chat
--- +++ @@ -17,6 +17,6 @@ }); }); -server.listen(process.env.PORT || 3000, () => { +server.listen(process.env.PORT || 80, () => { console.log(`Server is listening on port: ${server.address().port}`); });
8520af084ed87b946256d30319461d14a8832467
components/Title.js
components/Title.js
export default () => <div> <h1> react-todo{' '} <small>by <a href="https://github.com/pmdarrow">pmdarrow</a></small> </h1> <style>{` h1 { margin: 2rem; } `}</style> </div>;
export default () => <div> <h1>react-todo</h1> <p>By <a href="https://github.com/pmdarrow">@pmdarrow</a></p> <p><a href="https://github.com/pmdarrow/react-todo">View on GitHub</a></p> </div>;
Add link to GitHub project
Add link to GitHub project
JavaScript
mit
pmdarrow/react-todo
--- +++ @@ -1,12 +1,6 @@ export default () => <div> - <h1> - react-todo{' '} - <small>by <a href="https://github.com/pmdarrow">pmdarrow</a></small> - </h1> - <style>{` - h1 { - margin: 2rem; - } - `}</style> + <h1>react-todo</h1> + <p>By <a href="https://github.com/pmdarrow">@pmdarrow</a></p> + <p><a href="https://github.com/pmdarrow/react-todo">View on GitHub</a></p> </div>;
5ad964ba3ed5728d88686d2f5cfc3becac49f667
Libraries/Animated/src/Animated.js
Libraries/Animated/src/Animated.js
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; import Platform from '../../Utilities/Platform'; const View = require('../../Components/View/View'); const React = require('react'); import type {AnimatedComponentType} from './createAnimatedComponent'; const AnimatedMock = require('./AnimatedMock'); const AnimatedImplementation = require('./AnimatedImplementation'); const Animated = ((Platform.isTesting ? AnimatedMock : AnimatedImplementation): typeof AnimatedMock); module.exports = { get FlatList(): any { return require('./components/AnimatedFlatList'); }, get Image(): any { return require('./components/AnimatedImage'); }, get ScrollView(): any { return require('./components/AnimatedScrollView'); }, get SectionList(): any { return require('./components/AnimatedSectionList'); }, get Text(): any { return require('./components/AnimatedText'); }, get View(): AnimatedComponentType< React.ElementConfig<typeof View>, React.ElementRef<typeof View>, > { return require('./components/AnimatedView'); }, ...Animated, };
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; import Platform from '../../Utilities/Platform'; const View = require('../../Components/View/View'); const React = require('react'); import type {AnimatedComponentType} from './createAnimatedComponent'; const AnimatedMock = require('./AnimatedMock'); const AnimatedImplementation = require('./AnimatedImplementation'); //TODO(T57411659): Remove the bridgeless check when Animated perf regressions are fixed. const Animated = ((Platform.isTesting || global.RN$Bridgeless ? AnimatedMock : AnimatedImplementation): typeof AnimatedMock); module.exports = { get FlatList(): any { return require('./components/AnimatedFlatList'); }, get Image(): any { return require('./components/AnimatedImage'); }, get ScrollView(): any { return require('./components/AnimatedScrollView'); }, get SectionList(): any { return require('./components/AnimatedSectionList'); }, get Text(): any { return require('./components/AnimatedText'); }, get View(): AnimatedComponentType< React.ElementConfig<typeof View>, React.ElementRef<typeof View>, > { return require('./components/AnimatedView'); }, ...Animated, };
Disable animations in bridgeless mode
Disable animations in bridgeless mode Summary: Bridgeless mode requires all native modules to be turbomodules. The iOS animated module was converted to TM, but reverted due to perf issues. RSNara is looking into it, but it may be an involved fix. As a short term workaround, to unblock release mode testing of bridgeless mode, use `AnimatedMock`. Changelog: [Internal] Disable animations in bridgeless mode Reviewed By: RSNara Differential Revision: D19729827 fbshipit-source-id: e6c4d89258ec23da252c047b4c67c171f7f21c25
JavaScript
mit
facebook/react-native,myntra/react-native,myntra/react-native,exponentjs/react-native,exponentjs/react-native,hoangpham95/react-native,hoangpham95/react-native,exponent/react-native,pandiaraj44/react-native,exponent/react-native,pandiaraj44/react-native,janicduplessis/react-native,exponentjs/react-native,exponentjs/react-native,arthuralee/react-native,myntra/react-native,hammerandchisel/react-native,janicduplessis/react-native,exponent/react-native,arthuralee/react-native,myntra/react-native,hoangpham95/react-native,exponent/react-native,javache/react-native,hammerandchisel/react-native,javache/react-native,myntra/react-native,hammerandchisel/react-native,facebook/react-native,janicduplessis/react-native,hoangpham95/react-native,exponent/react-native,hammerandchisel/react-native,javache/react-native,hammerandchisel/react-native,hoangpham95/react-native,facebook/react-native,pandiaraj44/react-native,facebook/react-native,javache/react-native,hammerandchisel/react-native,exponentjs/react-native,pandiaraj44/react-native,myntra/react-native,myntra/react-native,pandiaraj44/react-native,pandiaraj44/react-native,exponentjs/react-native,hoangpham95/react-native,facebook/react-native,hoangpham95/react-native,exponentjs/react-native,pandiaraj44/react-native,janicduplessis/react-native,hoangpham95/react-native,facebook/react-native,janicduplessis/react-native,exponent/react-native,pandiaraj44/react-native,myntra/react-native,javache/react-native,janicduplessis/react-native,arthuralee/react-native,javache/react-native,janicduplessis/react-native,javache/react-native,javache/react-native,arthuralee/react-native,myntra/react-native,facebook/react-native,hammerandchisel/react-native,javache/react-native,janicduplessis/react-native,facebook/react-native,exponent/react-native,exponent/react-native,hammerandchisel/react-native,arthuralee/react-native,facebook/react-native,exponentjs/react-native
--- +++ @@ -18,7 +18,8 @@ const AnimatedMock = require('./AnimatedMock'); const AnimatedImplementation = require('./AnimatedImplementation'); -const Animated = ((Platform.isTesting +//TODO(T57411659): Remove the bridgeless check when Animated perf regressions are fixed. +const Animated = ((Platform.isTesting || global.RN$Bridgeless ? AnimatedMock : AnimatedImplementation): typeof AnimatedMock);
80f69f97e1be8d1492ee1708d2e8f41f0fc7926a
config/default.js
config/default.js
'use strict'; module.exports = { github: { username: 'maker-of-life', repo: 'maker-of-life/game-of-life', branch: 'game', localPath: 'tmp', }, commit: { name: 'Maker of Life', message: 'Create life', }, };
'use strict'; module.exports = { github: { username: 'maker-of-life', repo: 'maker-of-life/game-of-life', branch: 'master', localPath: 'tmp', }, commit: { name: 'Maker of Life', message: 'Create life', }, };
Switch back to the master branch
Switch back to the master branch
JavaScript
mit
erbridge/life-maker
--- +++ @@ -4,7 +4,7 @@ github: { username: 'maker-of-life', repo: 'maker-of-life/game-of-life', - branch: 'game', + branch: 'master', localPath: 'tmp', },
e1073a4bf48150c057266a5b0f7e0556f3b4b39a
App/reducers/reducers.js
App/reducers/reducers.js
import { combineReducers } from 'redux' import { REQUEST_WORKSPACES, RECEIVE_WORKSPACES, SELECT_WORKSPACE, REQUEST_RESULTS, RECEIVE_RESULTS, SELECT_RESULT, REQUEST_QUERIES, RECEIVE_QUERIES, SELECT_QUERY } from '../actions/actions' import { reducer as form } from 'redux-form' function selectedQuery(state = 'default', action) { switch (action.type) { case SELECT_QUERY: return action.query default: return state } } function selectedWorkspace(state = 'default', action) { switch (action.type) { case SELECT_WORKSPACE: return action.workspace; default: return state; } } function queryResults(state, action) { switch (action.type) { case REQUEST_RESULTS: //TODO: Write async call here return; default: return state; } } const rootReducer = combineReducers({ selectedWorkspace, form selectedQuery, selectedWorkspace }) export default rootReducer
import { combineReducers } from 'redux' import { REQUEST_WORKSPACES, RECEIVE_WORKSPACES, SELECT_WORKSPACE, REQUEST_RESULTS, RECEIVE_RESULTS, SELECT_RESULT, REQUEST_QUERIES, RECEIVE_QUERIES, SELECT_QUERY } from '../actions/actions' import { reducer as form } from 'redux-form' function selectedQuery(state = 'default', action) { switch (action.type) { case SELECT_QUERY: return action.query default: return state } } function selectedWorkspace(state = 'default', action) { switch (action.type) { case SELECT_WORKSPACE: return action.workspace; default: return state; } } function queryResults(state, action) { switch (action.type) { case REQUEST_RESULTS: //TODO: Write async call here return; default: return state; } } const rootReducer = combineReducers({ selectedWorkspace, selectedQuery, selectedWorkspace, form }) export default rootReducer
Fix for missing comma from merging branches
Fix for missing comma from merging branches
JavaScript
mit
csecapstone485organization/ddf-mobile,csecapstone485organization/ddf-mobile,csecapstone485organization/ddf-mobile
--- +++ @@ -38,9 +38,9 @@ const rootReducer = combineReducers({ selectedWorkspace, + selectedQuery, + selectedWorkspace, form - selectedQuery, - selectedWorkspace }) export default rootReducer
4d4bd6c4533b2be681752b90a999b1936cc954d4
middleware/ensure-found.js
middleware/ensure-found.js
/* * Ensures something has been found during the request. Returns 404 if * res.template is unset, res.locals is empty and statusCode has not been set * to 204. * * Should be placed at the very end of the middleware pipeline, * after all project specific routes but before the error handler & responder. * * @module midwest/middleware/ensure-found */ 'use strict'; const _ = require('lodash'); module.exports = function ensureFound(req, res, next) { // it seems most reasonable to check if res.locals is empty before res.statusCode // because the former is much more common if (res.template || res.master || !_.isEmpty(res.locals) || res.statusCode === 204) { next(); } else { // generates Not Found error if there is no page to render and no truthy // values in data const err = new Error(`Not found: ${req.path}`); err.status = 404; next(err); } };
/* * Ensures something has been found during the request. Returns 404 if * res.template is unset, res.locals is empty and statusCode has not been set * to 204. * * Should be placed at the very end of the middleware pipeline, * after all project specific routes but before the error handler & responder. * * @module midwest/middleware/ensure-found */ 'use strict'; const _ = require('lodash'); module.exports = function ensureFound(req, res, next) { // it seems most reasonable to check if res.locals is empty before res.statusCode // because the former is much more common if (res.template || res.master || !_.isEmpty(res.locals) || res.statusCode === 204) { next(); } else { // generates Not Found error if there is no page to render and no truthy // values in data const err = new Error(`Not found: ${req.method.toUpperCase()} ${req.path}`); err.status = 404; next(err); } };
Add req.method to error message on not found
Add req.method to error message on not found
JavaScript
mit
thebitmill/midwest
--- +++ @@ -21,7 +21,7 @@ } else { // generates Not Found error if there is no page to render and no truthy // values in data - const err = new Error(`Not found: ${req.path}`); + const err = new Error(`Not found: ${req.method.toUpperCase()} ${req.path}`); err.status = 404; next(err);
dad76c400c3a9188cb99227fb1725f932e673f34
www/js/app.js
www/js/app.js
/*global _:true, App:true, Backbone:true */ /*jshint forin:false, plusplus:false, sub:true */ 'use strict'; define([ 'zepto', 'install', 'datastore', 'collections/episodes', 'collections/podcasts', 'models/episode', 'models/podcast', 'views/app' ], function($, install, DataStore, Episodes, Podcasts, Episode, Podcast, AppView) { var GLOBALS = { DATABASE_NAME: 'podcasts', HAS: { nativeScroll: (function() { return 'WebkitOverflowScrolling' in window.document.createElement('div').style; })() }, OBJECT_STORE_NAME: 'podcasts', TIME_TO_UPDATE: 3600 * 5 // Update podcasts every five hours } window.GLOBALS = GLOBALS; function initialize(callback) { if (GLOBALS.HAS.nativeScroll) { $('body').addClass('native-scroll'); } DataStore.load(function() { var app = new AppView(); }); } function timestamp(date) { if (!date) { date = new Date() } return Math.round(date.getTime() / 1000) } window.timestamp = timestamp; return { initialize: initialize }; });
/*global _:true, App:true, Backbone:true */ /*jshint forin:false, plusplus:false, sub:true */ 'use strict'; define([ 'zepto', 'install', 'datastore', 'collections/episodes', 'collections/podcasts', 'models/episode', 'models/podcast', 'views/app' ], function($, install, DataStore, Episodes, Podcasts, Episode, Podcast, AppView) { var GLOBALS = { DATABASE_NAME: 'podcasts', HAS: { audioSupportMP3: (function() { var a = window.document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); })(), audioSupportOGG: (function() { var a = window.document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/ogg;').replace(/no/, '')); })(), nativeScroll: (function() { return 'WebkitOverflowScrolling' in window.document.createElement('div').style; })() }, OBJECT_STORE_NAME: 'podcasts', TIME_TO_UPDATE: 3600 * 5 // Update podcasts every five hours } window.GLOBALS = GLOBALS; function initialize(callback) { if (GLOBALS.HAS.nativeScroll) { $('body').addClass('native-scroll'); } DataStore.load(function() { var app = new AppView(); }); } function timestamp(date) { if (!date) { date = new Date() } return Math.round(date.getTime() / 1000) } window.timestamp = timestamp; return { initialize: initialize }; });
Add audio type checks for MP3 and OGG Vorbis
Add audio type checks for MP3 and OGG Vorbis
JavaScript
mit
sole/high-fidelity,mozilla/high-fidelity,prateekjadhwani/high-fidelity,lmorchard/high-fidelity,sole/high-fidelity,prateekjadhwani/high-fidelity,lmorchard/high-fidelity,sole/high-fidelity,sole/high-fidelity,mozilla/high-fidelity
--- +++ @@ -15,6 +15,14 @@ var GLOBALS = { DATABASE_NAME: 'podcasts', HAS: { + audioSupportMP3: (function() { + var a = window.document.createElement('audio'); + return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); + })(), + audioSupportOGG: (function() { + var a = window.document.createElement('audio'); + return !!(a.canPlayType && a.canPlayType('audio/ogg;').replace(/no/, '')); + })(), nativeScroll: (function() { return 'WebkitOverflowScrolling' in window.document.createElement('div').style; })()
11abe0cfb783f73d6b5a281430ef1bb9c99460c6
examples/todos/lib/router.js
examples/todos/lib/router.js
Router.configure({ // we use the appBody template to define the layout for the entire app layoutTemplate: 'appBody', // the appNotFound template is used for unknown routes and missing lists notFoundTemplate: 'appNotFound', // show the appLoading template whilst the subscriptions below load their data loadingTemplate: 'appLoading', // wait on the following subscriptions before rendering the page to ensure // the data it's expecting is present waitOn: function() { return [ Meteor.subscribe('publicLists'), Meteor.subscribe('privateLists') ]; } }); if (Meteor.isClient) LaunchScreen.hold(); Router.map(function() { this.route('join'); this.route('signin'); this.route('listsShow', { path: '/lists/:_id', // subscribe to todos before the page is rendered but don't wait on the // subscription, we'll just render the items as they arrive onBeforeAction: function () { this.todosHandle = Meteor.subscribe('todos', this.params._id); }, data: function () { return Lists.findOne(this.params._id); }, action: function () { this.render(); LaunchScreen.release(); } }); this.route('home', { path: '/', action: function() { Router.go('listsShow', Lists.findOne()); } }); }); if (Meteor.isClient) { Router.onBeforeAction('loading', {except: ['join', 'signin']}); Router.onBeforeAction('dataNotFound', {except: ['join', 'signin']}); }
Router.configure({ // we use the appBody template to define the layout for the entire app layoutTemplate: 'appBody', // the appNotFound template is used for unknown routes and missing lists notFoundTemplate: 'appNotFound', // show the appLoading template whilst the subscriptions below load their data loadingTemplate: 'appLoading', // wait on the following subscriptions before rendering the page to ensure // the data it's expecting is present waitOn: function() { return [ Meteor.subscribe('publicLists'), Meteor.subscribe('privateLists') ]; } }); if (Meteor.isClient) { var launchScreenHandler = LaunchScreen.hold(); } Router.map(function() { this.route('join'); this.route('signin'); this.route('listsShow', { path: '/lists/:_id', // subscribe to todos before the page is rendered but don't wait on the // subscription, we'll just render the items as they arrive onBeforeAction: function () { this.todosHandle = Meteor.subscribe('todos', this.params._id); }, data: function () { return Lists.findOne(this.params._id); }, action: function () { this.render(); launchScreenHandler.release(); } }); this.route('home', { path: '/', action: function() { Router.go('listsShow', Lists.findOne()); } }); }); if (Meteor.isClient) { Router.onBeforeAction('loading', {except: ['join', 'signin']}); Router.onBeforeAction('dataNotFound', {except: ['join', 'signin']}); }
Fix usage of new LaunchScreen API in Todos
Fix usage of new LaunchScreen API in Todos
JavaScript
mit
tdamsma/meteor,lorensr/meteor,rabbyalone/meteor,sclausen/meteor,pjump/meteor,aramk/meteor,devgrok/meteor,guazipi/meteor,EduShareOntario/meteor,AnjirHossain/meteor,mubassirhayat/meteor,joannekoong/meteor,dev-bobsong/meteor,yonas/meteor-freebsd,Quicksteve/meteor,lorensr/meteor,shrop/meteor,dandv/meteor,daltonrenaldo/meteor,yonglehou/meteor,henrypan/meteor,justintung/meteor,calvintychan/meteor,ndarilek/meteor,kencheung/meteor,dev-bobsong/meteor,skarekrow/meteor,imanmafi/meteor,steedos/meteor,cbonami/meteor,imanmafi/meteor,D1no/meteor,alphanso/meteor,Ken-Liu/meteor,Hansoft/meteor,ashwathgovind/meteor,AlexR1712/meteor,Hansoft/meteor,emmerge/meteor,elkingtonmcb/meteor,Puena/meteor,evilemon/meteor,neotim/meteor,paul-barry-kenzan/meteor,aramk/meteor,dandv/meteor,nuvipannu/meteor,Hansoft/meteor,deanius/meteor,servel333/meteor,sitexa/meteor,chinasb/meteor,kengchau/meteor,benstoltz/meteor,EduShareOntario/meteor,benstoltz/meteor,planet-training/meteor,lorensr/meteor,lpinto93/meteor,IveWong/meteor,williambr/meteor,EduShareOntario/meteor,luohuazju/meteor,henrypan/meteor,sdeveloper/meteor,namho102/meteor,emmerge/meteor,msavin/meteor,calvintychan/meteor,arunoda/meteor,Eynaliyev/meteor,lawrenceAIO/meteor,Urigo/meteor,jg3526/meteor,chasertech/meteor,dev-bobsong/meteor,alphanso/meteor,wmkcc/meteor,zdd910/meteor,namho102/meteor,l0rd0fwar/meteor,Theviajerock/meteor,sunny-g/meteor,luohuazju/meteor,cog-64/meteor,kengchau/meteor,HugoRLopes/meteor,GrimDerp/meteor,TribeMedia/meteor,yinhe007/meteor,DCKT/meteor,LWHTarena/meteor,michielvanoeffelen/meteor,jrudio/meteor,aleclarson/meteor,colinligertwood/meteor,codingang/meteor,cog-64/meteor,mauricionr/meteor,lpinto93/meteor,zdd910/meteor,williambr/meteor,chmac/meteor,kencheung/meteor,rabbyalone/meteor,yonas/meteor-freebsd,servel333/meteor,GrimDerp/meteor,Jonekee/meteor,chasertech/meteor,AnjirHossain/meteor,mubassirhayat/meteor,jeblister/meteor,karlito40/meteor,somallg/meteor,kencheung/meteor,meteor-velocity/meteor,TribeMedia/meteor,DAB0mB/meteor,lawrenceAIO/meteor,baysao/meteor,calvintychan/meteor,HugoRLopes/meteor,yalexx/meteor,Puena/meteor,h200863057/meteor,pjump/meteor,baiyunping333/meteor,dfischer/meteor,Quicksteve/meteor,baiyunping333/meteor,mjmasn/meteor,justintung/meteor,sitexa/meteor,msavin/meteor,kidaa/meteor,fashionsun/meteor,oceanzou123/meteor,pjump/meteor,kidaa/meteor,lawrenceAIO/meteor,lieuwex/meteor,vacjaliu/meteor,henrypan/meteor,ericterpstra/meteor,codingang/meteor,yinhe007/meteor,jg3526/meteor,GrimDerp/meteor,mjmasn/meteor,stevenliuit/meteor,chasertech/meteor,ericterpstra/meteor,yalexx/meteor,queso/meteor,vjau/meteor,akintoey/meteor,kengchau/meteor,luohuazju/meteor,vjau/meteor,oceanzou123/meteor,neotim/meteor,brdtrpp/meteor,Ken-Liu/meteor,Hansoft/meteor,rozzzly/meteor,juansgaitan/meteor,AlexR1712/meteor,queso/meteor,jrudio/meteor,cog-64/meteor,aramk/meteor,hristaki/meteor,codedogfish/meteor,udhayam/meteor,skarekrow/meteor,Urigo/meteor,l0rd0fwar/meteor,dfischer/meteor,papimomi/meteor,benjamn/meteor,aldeed/meteor,oceanzou123/meteor,codingang/meteor,lpinto93/meteor,jrudio/meteor,DCKT/meteor,mirstan/meteor,chmac/meteor,ljack/meteor,sdeveloper/meteor,yinhe007/meteor,HugoRLopes/meteor,aldeed/meteor,evilemon/meteor,baiyunping333/meteor,sunny-g/meteor,Theviajerock/meteor,Paulyoufu/meteor-1,servel333/meteor,jirengu/meteor,modulexcite/meteor,cherbst/meteor,jdivy/meteor,jirengu/meteor,evilemon/meteor,mirstan/meteor,hristaki/meteor,chmac/meteor,jeblister/meteor,jg3526/meteor,emmerge/meteor,lieuwex/meteor,namho102/meteor,DAB0mB/meteor,vjau/meteor,guazipi/meteor,alexbeletsky/meteor,mjmasn/meteor,chasertech/meteor,framewr/meteor,baysao/meteor,Theviajerock/meteor,evilemon/meteor,jdivy/meteor,akintoey/meteor,yinhe007/meteor,meteor-velocity/meteor,Quicksteve/meteor,h200863057/meteor,yanisIk/meteor,eluck/meteor,planet-training/meteor,paul-barry-kenzan/meteor,rabbyalone/meteor,bhargav175/meteor,jdivy/meteor,chinasb/meteor,GrimDerp/meteor,guazipi/meteor,chinasb/meteor,alphanso/meteor,brettle/meteor,chasertech/meteor,ashwathgovind/meteor,meonkeys/meteor,Puena/meteor,akintoey/meteor,benstoltz/meteor,namho102/meteor,AlexR1712/meteor,msavin/meteor,mauricionr/meteor,papimomi/meteor,stevenliuit/meteor,chengxiaole/meteor,baysao/meteor,ljack/meteor,karlito40/meteor,codingang/meteor,saisai/meteor,shrop/meteor,henrypan/meteor,AlexR1712/meteor,whip112/meteor,cbonami/meteor,luohuazju/meteor,h200863057/meteor,lawrenceAIO/meteor,Profab/meteor,Quicksteve/meteor,Theviajerock/meteor,SeanOceanHu/meteor,daltonrenaldo/meteor,sitexa/meteor,ashwathgovind/meteor,somallg/meteor,mirstan/meteor,qscripter/meteor,TechplexEngineer/meteor,Ken-Liu/meteor,justintung/meteor,henrypan/meteor,lawrenceAIO/meteor,baysao/meteor,l0rd0fwar/meteor,mirstan/meteor,shmiko/meteor,alexbeletsky/meteor,Jeremy017/meteor,dboyliao/meteor,luohuazju/meteor,cbonami/meteor,TribeMedia/meteor,qscripter/meteor,PatrickMcGuinness/meteor,dboyliao/meteor,AnthonyAstige/meteor,Profab/meteor,PatrickMcGuinness/meteor,ljack/meteor,meonkeys/meteor,LWHTarena/meteor,PatrickMcGuinness/meteor,Theviajerock/meteor,katopz/meteor,cherbst/meteor,colinligertwood/meteor,steedos/meteor,elkingtonmcb/meteor,modulexcite/meteor,brdtrpp/meteor,qscripter/meteor,yonas/meteor-freebsd,dev-bobsong/meteor,ndarilek/meteor,SeanOceanHu/meteor,SeanOceanHu/meteor,shadedprofit/meteor,daslicht/meteor,PatrickMcGuinness/meteor,ericterpstra/meteor,dandv/meteor,johnthepink/meteor,Hansoft/meteor,jenalgit/meteor,skarekrow/meteor,rozzzly/meteor,qscripter/meteor,framewr/meteor,AnthonyAstige/meteor,qscripter/meteor,SeanOceanHu/meteor,devgrok/meteor,planet-training/meteor,joannekoong/meteor,cbonami/meteor,deanius/meteor,kengchau/meteor,queso/meteor,ashwathgovind/meteor,mirstan/meteor,4commerce-technologies-AG/meteor,dfischer/meteor,williambr/meteor,cbonami/meteor,luohuazju/meteor,yanisIk/meteor,pjump/meteor,benstoltz/meteor,yanisIk/meteor,lpinto93/meteor,AnjirHossain/meteor,juansgaitan/meteor,daltonrenaldo/meteor,aldeed/meteor,whip112/meteor,michielvanoeffelen/meteor,brdtrpp/meteor,bhargav175/meteor,aldeed/meteor,hristaki/meteor,iman-mafi/meteor,chmac/meteor,queso/meteor,dboyliao/meteor,tdamsma/meteor,brettle/meteor,alexbeletsky/meteor,qscripter/meteor,devgrok/meteor,bhargav175/meteor,yonglehou/meteor,calvintychan/meteor,chengxiaole/meteor,Jeremy017/meteor,imanmafi/meteor,paul-barry-kenzan/meteor,Puena/meteor,Prithvi-A/meteor,framewr/meteor,h200863057/meteor,iman-mafi/meteor,cog-64/meteor,msavin/meteor,TechplexEngineer/meteor,dfischer/meteor,lassombra/meteor,calvintychan/meteor,whip112/meteor,alphanso/meteor,devgrok/meteor,youprofit/meteor,youprofit/meteor,TribeMedia/meteor,dandv/meteor,sdeveloper/meteor,IveWong/meteor,wmkcc/meteor,codedogfish/meteor,dboyliao/meteor,Paulyoufu/meteor-1,framewr/meteor,Jeremy017/meteor,esteedqueen/meteor,modulexcite/meteor,cherbst/meteor,sdeveloper/meteor,IveWong/meteor,dfischer/meteor,JesseQin/meteor,yiliaofan/meteor,brdtrpp/meteor,sdeveloper/meteor,JesseQin/meteor,framewr/meteor,colinligertwood/meteor,servel333/meteor,Puena/meteor,imanmafi/meteor,4commerce-technologies-AG/meteor,shrop/meteor,judsonbsilva/meteor,evilemon/meteor,Prithvi-A/meteor,mubassirhayat/meteor,aramk/meteor,yiliaofan/meteor,williambr/meteor,AnjirHossain/meteor,arunoda/meteor,dev-bobsong/meteor,ericterpstra/meteor,katopz/meteor,jeblister/meteor,skarekrow/meteor,arunoda/meteor,somallg/meteor,h200863057/meteor,henrypan/meteor,newswim/meteor,TechplexEngineer/meteor,devgrok/meteor,chengxiaole/meteor,modulexcite/meteor,PatrickMcGuinness/meteor,guazipi/meteor,Profab/meteor,juansgaitan/meteor,karlito40/meteor,mirstan/meteor,EduShareOntario/meteor,allanalexandre/meteor,AnthonyAstige/meteor,TechplexEngineer/meteor,shmiko/meteor,alphanso/meteor,Urigo/meteor,pandeysoni/meteor,oceanzou123/meteor,Theviajerock/meteor,D1no/meteor,sclausen/meteor,michielvanoeffelen/meteor,cherbst/meteor,deanius/meteor,DCKT/meteor,paul-barry-kenzan/meteor,ashwathgovind/meteor,Urigo/meteor,jenalgit/meteor,namho102/meteor,oceanzou123/meteor,imanmafi/meteor,AlexR1712/meteor,nuvipannu/meteor,Jonekee/meteor,shadedprofit/meteor,hristaki/meteor,paul-barry-kenzan/meteor,Prithvi-A/meteor,HugoRLopes/meteor,justintung/meteor,youprofit/meteor,qscripter/meteor,calvintychan/meteor,jenalgit/meteor,sunny-g/meteor,lassombra/meteor,jagi/meteor,yanisIk/meteor,daslicht/meteor,Eynaliyev/meteor,saisai/meteor,nuvipannu/meteor,esteedqueen/meteor,neotim/meteor,eluck/meteor,Ken-Liu/meteor,arunoda/meteor,pandeysoni/meteor,chiefninew/meteor,dev-bobsong/meteor,rozzzly/meteor,skarekrow/meteor,neotim/meteor,neotim/meteor,4commerce-technologies-AG/meteor,yanisIk/meteor,zdd910/meteor,katopz/meteor,lorensr/meteor,papimomi/meteor,shmiko/meteor,SeanOceanHu/meteor,ndarilek/meteor,benjamn/meteor,bhargav175/meteor,alphanso/meteor,juansgaitan/meteor,iman-mafi/meteor,Prithvi-A/meteor,dboyliao/meteor,msavin/meteor,shrop/meteor,chmac/meteor,jagi/meteor,LWHTarena/meteor,williambr/meteor,alexbeletsky/meteor,Quicksteve/meteor,kengchau/meteor,mauricionr/meteor,aldeed/meteor,yiliaofan/meteor,eluck/meteor,arunoda/meteor,yonas/meteor-freebsd,DAB0mB/meteor,planet-training/meteor,mjmasn/meteor,Eynaliyev/meteor,Paulyoufu/meteor-1,PatrickMcGuinness/meteor,Puena/meteor,papimomi/meteor,youprofit/meteor,yyx990803/meteor,zdd910/meteor,vjau/meteor,meonkeys/meteor,aleclarson/meteor,esteedqueen/meteor,yonglehou/meteor,brettle/meteor,mauricionr/meteor,youprofit/meteor,imanmafi/meteor,yonglehou/meteor,iman-mafi/meteor,devgrok/meteor,allanalexandre/meteor,namho102/meteor,AnjirHossain/meteor,alexbeletsky/meteor,fashionsun/meteor,steedos/meteor,justintung/meteor,tdamsma/meteor,vacjaliu/meteor,jg3526/meteor,daltonrenaldo/meteor,yalexx/meteor,yanisIk/meteor,rabbyalone/meteor,lpinto93/meteor,ashwathgovind/meteor,udhayam/meteor,HugoRLopes/meteor,Urigo/meteor,Eynaliyev/meteor,justintung/meteor,paul-barry-kenzan/meteor,udhayam/meteor,shmiko/meteor,sitexa/meteor,jeblister/meteor,wmkcc/meteor,Eynaliyev/meteor,AnjirHossain/meteor,cbonami/meteor,4commerce-technologies-AG/meteor,brdtrpp/meteor,JesseQin/meteor,l0rd0fwar/meteor,eluck/meteor,tdamsma/meteor,4commerce-technologies-AG/meteor,katopz/meteor,nuvipannu/meteor,TribeMedia/meteor,DCKT/meteor,jdivy/meteor,AnthonyAstige/meteor,alexbeletsky/meteor,modulexcite/meteor,fashionsun/meteor,allanalexandre/meteor,zdd910/meteor,elkingtonmcb/meteor,yinhe007/meteor,dfischer/meteor,GrimDerp/meteor,SeanOceanHu/meteor,cherbst/meteor,sitexa/meteor,chiefninew/meteor,pandeysoni/meteor,LWHTarena/meteor,planet-training/meteor,h200863057/meteor,juansgaitan/meteor,ericterpstra/meteor,Jonekee/meteor,jdivy/meteor,fashionsun/meteor,daltonrenaldo/meteor,meteor-velocity/meteor,deanius/meteor,jrudio/meteor,baiyunping333/meteor,kidaa/meteor,whip112/meteor,saisai/meteor,ndarilek/meteor,SeanOceanHu/meteor,oceanzou123/meteor,Eynaliyev/meteor,esteedqueen/meteor,brettle/meteor,vacjaliu/meteor,pjump/meteor,DAB0mB/meteor,jrudio/meteor,EduShareOntario/meteor,aleclarson/meteor,lieuwex/meteor,sunny-g/meteor,jenalgit/meteor,vjau/meteor,kidaa/meteor,mauricionr/meteor,lieuwex/meteor,EduShareOntario/meteor,jagi/meteor,sclausen/meteor,yanisIk/meteor,dfischer/meteor,ericterpstra/meteor,D1no/meteor,HugoRLopes/meteor,newswim/meteor,fashionsun/meteor,meonkeys/meteor,Urigo/meteor,dboyliao/meteor,youprofit/meteor,bhargav175/meteor,JesseQin/meteor,Prithvi-A/meteor,bhargav175/meteor,shrop/meteor,somallg/meteor,zdd910/meteor,mubassirhayat/meteor,HugoRLopes/meteor,elkingtonmcb/meteor,cherbst/meteor,pandeysoni/meteor,shrop/meteor,benjamn/meteor,JesseQin/meteor,yalexx/meteor,alexbeletsky/meteor,DAB0mB/meteor,Ken-Liu/meteor,udhayam/meteor,DAB0mB/meteor,Ken-Liu/meteor,judsonbsilva/meteor,tdamsma/meteor,skarekrow/meteor,servel333/meteor,papimomi/meteor,brettle/meteor,ljack/meteor,akintoey/meteor,elkingtonmcb/meteor,baiyunping333/meteor,juansgaitan/meteor,ericterpstra/meteor,cherbst/meteor,lorensr/meteor,Profab/meteor,saisai/meteor,youprofit/meteor,emmerge/meteor,colinligertwood/meteor,judsonbsilva/meteor,yyx990803/meteor,codedogfish/meteor,benjamn/meteor,yonglehou/meteor,papimomi/meteor,yonas/meteor-freebsd,wmkcc/meteor,karlito40/meteor,AnthonyAstige/meteor,judsonbsilva/meteor,lassombra/meteor,benjamn/meteor,shrop/meteor,johnthepink/meteor,dboyliao/meteor,neotim/meteor,jagi/meteor,TechplexEngineer/meteor,michielvanoeffelen/meteor,aramk/meteor,chiefninew/meteor,Paulyoufu/meteor-1,emmerge/meteor,shmiko/meteor,yonglehou/meteor,meonkeys/meteor,esteedqueen/meteor,kidaa/meteor,meonkeys/meteor,Prithvi-A/meteor,codingang/meteor,steedos/meteor,TechplexEngineer/meteor,emmerge/meteor,udhayam/meteor,ashwathgovind/meteor,shmiko/meteor,AnjirHossain/meteor,akintoey/meteor,newswim/meteor,allanalexandre/meteor,rozzzly/meteor,jagi/meteor,D1no/meteor,yonas/meteor-freebsd,mauricionr/meteor,newswim/meteor,DCKT/meteor,saisai/meteor,l0rd0fwar/meteor,chiefninew/meteor,steedos/meteor,jeblister/meteor,yyx990803/meteor,lorensr/meteor,karlito40/meteor,jirengu/meteor,allanalexandre/meteor,saisai/meteor,johnthepink/meteor,kencheung/meteor,stevenliuit/meteor,Jeremy017/meteor,LWHTarena/meteor,jdivy/meteor,colinligertwood/meteor,chinasb/meteor,vacjaliu/meteor,stevenliuit/meteor,sclausen/meteor,yinhe007/meteor,iman-mafi/meteor,deanius/meteor,dandv/meteor,Quicksteve/meteor,vjau/meteor,judsonbsilva/meteor,evilemon/meteor,aldeed/meteor,akintoey/meteor,ndarilek/meteor,eluck/meteor,iman-mafi/meteor,Jonekee/meteor,AlexR1712/meteor,alexbeletsky/meteor,Jonekee/meteor,cog-64/meteor,tdamsma/meteor,codedogfish/meteor,chengxiaole/meteor,arunoda/meteor,imanmafi/meteor,LWHTarena/meteor,Ken-Liu/meteor,modulexcite/meteor,chinasb/meteor,Profab/meteor,newswim/meteor,Paulyoufu/meteor-1,sunny-g/meteor,ljack/meteor,l0rd0fwar/meteor,rabbyalone/meteor,lpinto93/meteor,GrimDerp/meteor,yyx990803/meteor,shadedprofit/meteor,steedos/meteor,johnthepink/meteor,jenalgit/meteor,D1no/meteor,sunny-g/meteor,ndarilek/meteor,joannekoong/meteor,lieuwex/meteor,johnthepink/meteor,pandeysoni/meteor,tdamsma/meteor,IveWong/meteor,meonkeys/meteor,yalexx/meteor,deanius/meteor,jrudio/meteor,chiefninew/meteor,yyx990803/meteor,cbonami/meteor,benstoltz/meteor,EduShareOntario/meteor,dboyliao/meteor,oceanzou123/meteor,ndarilek/meteor,lieuwex/meteor,joannekoong/meteor,IveWong/meteor,nuvipannu/meteor,akintoey/meteor,somallg/meteor,elkingtonmcb/meteor,lawrenceAIO/meteor,daltonrenaldo/meteor,arunoda/meteor,Jeremy017/meteor,newswim/meteor,baiyunping333/meteor,chmac/meteor,jg3526/meteor,chinasb/meteor,baysao/meteor,ljack/meteor,modulexcite/meteor,Eynaliyev/meteor,henrypan/meteor,somallg/meteor,stevenliuit/meteor,meteor-velocity/meteor,Paulyoufu/meteor-1,pandeysoni/meteor,michielvanoeffelen/meteor,aldeed/meteor,jg3526/meteor,jeblister/meteor,steedos/meteor,jenalgit/meteor,williambr/meteor,queso/meteor,planet-training/meteor,sunny-g/meteor,esteedqueen/meteor,tdamsma/meteor,rozzzly/meteor,chiefninew/meteor,guazipi/meteor,h200863057/meteor,ljack/meteor,baysao/meteor,planet-training/meteor,mauricionr/meteor,johnthepink/meteor,pandeysoni/meteor,msavin/meteor,benjamn/meteor,allanalexandre/meteor,elkingtonmcb/meteor,cog-64/meteor,karlito40/meteor,karlito40/meteor,rozzzly/meteor,karlito40/meteor,sdeveloper/meteor,Jonekee/meteor,AnthonyAstige/meteor,hristaki/meteor,daslicht/meteor,lassombra/meteor,williambr/meteor,PatrickMcGuinness/meteor,rozzzly/meteor,wmkcc/meteor,codedogfish/meteor,lorensr/meteor,rabbyalone/meteor,mjmasn/meteor,kencheung/meteor,whip112/meteor,lawrenceAIO/meteor,colinligertwood/meteor,guazipi/meteor,joannekoong/meteor,Prithvi-A/meteor,yiliaofan/meteor,shadedprofit/meteor,daslicht/meteor,eluck/meteor,whip112/meteor,AnthonyAstige/meteor,vjau/meteor,Eynaliyev/meteor,pjump/meteor,judsonbsilva/meteor,shadedprofit/meteor,queso/meteor,stevenliuit/meteor,shadedprofit/meteor,esteedqueen/meteor,TribeMedia/meteor,sdeveloper/meteor,kencheung/meteor,Profab/meteor,yalexx/meteor,codedogfish/meteor,kengchau/meteor,stevenliuit/meteor,skarekrow/meteor,l0rd0fwar/meteor,sunny-g/meteor,shmiko/meteor,jg3526/meteor,luohuazju/meteor,codingang/meteor,sclausen/meteor,johnthepink/meteor,bhargav175/meteor,vacjaliu/meteor,papimomi/meteor,neotim/meteor,Hansoft/meteor,mubassirhayat/meteor,udhayam/meteor,Puena/meteor,evilemon/meteor,katopz/meteor,sclausen/meteor,brdtrpp/meteor,joannekoong/meteor,SeanOceanHu/meteor,nuvipannu/meteor,chengxiaole/meteor,chasertech/meteor,chasertech/meteor,yiliaofan/meteor,yonglehou/meteor,yanisIk/meteor,yyx990803/meteor,meteor-velocity/meteor,juansgaitan/meteor,udhayam/meteor,brdtrpp/meteor,paul-barry-kenzan/meteor,D1no/meteor,alphanso/meteor,namho102/meteor,hristaki/meteor,jeblister/meteor,IveWong/meteor,D1no/meteor,yiliaofan/meteor,chinasb/meteor,planet-training/meteor,allanalexandre/meteor,fashionsun/meteor,meteor-velocity/meteor,jirengu/meteor,kencheung/meteor,TribeMedia/meteor,iman-mafi/meteor,chengxiaole/meteor,chiefninew/meteor,IveWong/meteor,jagi/meteor,zdd910/meteor,kidaa/meteor,devgrok/meteor,mubassirhayat/meteor,michielvanoeffelen/meteor,daslicht/meteor,deanius/meteor,AnthonyAstige/meteor,jenalgit/meteor,kidaa/meteor,D1no/meteor,brettle/meteor,daltonrenaldo/meteor,Urigo/meteor,meteor-velocity/meteor,HugoRLopes/meteor,chmac/meteor,vacjaliu/meteor,joannekoong/meteor,JesseQin/meteor,daslicht/meteor,yinhe007/meteor,AlexR1712/meteor,yyx990803/meteor,Theviajerock/meteor,4commerce-technologies-AG/meteor,Jeremy017/meteor,jirengu/meteor,framewr/meteor,pjump/meteor,codingang/meteor,ljack/meteor,codedogfish/meteor,benstoltz/meteor,Quicksteve/meteor,DCKT/meteor,sitexa/meteor,eluck/meteor,Hansoft/meteor,Jonekee/meteor,calvintychan/meteor,guazipi/meteor,ndarilek/meteor,brdtrpp/meteor,lassombra/meteor,servel333/meteor,kengchau/meteor,wmkcc/meteor,rabbyalone/meteor,framewr/meteor,newswim/meteor,lieuwex/meteor,GrimDerp/meteor,lassombra/meteor,mubassirhayat/meteor,chiefninew/meteor,nuvipannu/meteor,DCKT/meteor,dandv/meteor,judsonbsilva/meteor,hristaki/meteor,daslicht/meteor,shadedprofit/meteor,katopz/meteor,eluck/meteor,chengxiaole/meteor,daltonrenaldo/meteor,brettle/meteor,4commerce-technologies-AG/meteor,katopz/meteor,yalexx/meteor,cog-64/meteor,Paulyoufu/meteor-1,aramk/meteor,JesseQin/meteor,colinligertwood/meteor,jagi/meteor,servel333/meteor,Profab/meteor,jirengu/meteor,fashionsun/meteor,wmkcc/meteor,yiliaofan/meteor,yonas/meteor-freebsd,TechplexEngineer/meteor,baiyunping333/meteor,benstoltz/meteor,allanalexandre/meteor,mubassirhayat/meteor,mirstan/meteor,baysao/meteor,somallg/meteor,servel333/meteor,saisai/meteor,mjmasn/meteor,queso/meteor,whip112/meteor,dev-bobsong/meteor,sclausen/meteor,mjmasn/meteor,justintung/meteor,aramk/meteor,lassombra/meteor,DAB0mB/meteor,msavin/meteor,michielvanoeffelen/meteor,benjamn/meteor,somallg/meteor,emmerge/meteor,jirengu/meteor,sitexa/meteor,vacjaliu/meteor,jdivy/meteor,lpinto93/meteor,dandv/meteor,LWHTarena/meteor,Jeremy017/meteor
--- +++ @@ -18,8 +18,9 @@ } }); -if (Meteor.isClient) - LaunchScreen.hold(); +if (Meteor.isClient) { + var launchScreenHandler = LaunchScreen.hold(); +} Router.map(function() { this.route('join'); @@ -37,7 +38,7 @@ }, action: function () { this.render(); - LaunchScreen.release(); + launchScreenHandler.release(); } });
554c6401d5dc68d7609317aa332241eeaa8ceb17
back/controllers/city/community.ctrl.js
back/controllers/city/community.ctrl.js
/** * @fileOverview Communities CRUD controller. */ // var log = require('logg').getLogger('app.ctrl.city.Dashboard'); var ControllerBase = require('nodeon-base').ControllerBase; var CrudeEntity = require('crude-entity'); var CommunityEnt = require('../../entities/community.ent'); /** * Communities CRUD controller. * * @contructor * @extends {app.ControllerBase} */ var Dashboard = module.exports = ControllerBase.extendSingleton(function(){ this.crude = new CrudeEntity('/community', CommunityEnt); this.crude.config({ idField: '_id', pagination: false, entityCreate: 'createApi', entityReadOne: 'readOneApi', entityReadLimit: 'readLimitApi', entityUpdate: 'updateApi', }); });
/** * @fileOverview Communities CRUD controller. */ // var log = require('logg').getLogger('app.ctrl.city.Dashboard'); var ControllerBase = require('nodeon-base').ControllerBase; var CrudeEntity = require('crude-entity'); var CommunityEnt = require('../../entities/community.ent'); var CommunityMidd = require('../../middleware/communities.midd'); /** * Communities CRUD controller. * * @contructor * @extends {app.ControllerBase} */ var Community = module.exports = ControllerBase.extendSingleton(function () { this.crude = new CrudeEntity('/community', CommunityEnt); this.crude.config({ idField: '_id', pagination: false, entityCreate: 'createApi', entityReadOne: 'readOneApi', entityReadLimit: 'readLimitApi', entityUpdate: 'updateApi', }); var communityMidd = CommunityMidd.getInstance(); this.add = [ this._add.bind(this), ]; this.del = [ communityMidd.populateSingleFromParam.bind(communityMidd), this._del.bind(this), ]; this.edit = [ communityMidd.populateSingleFromParam.bind(communityMidd), this._edit.bind(this), ]; }); /** * The add an item form. * * @param {Object} req The request Object. * @param {Object} res The response Object. */ Community.prototype._add = function(req, res) { res.render('/city/community/add'); }; /** * The del an item form. * * @param {Object} req The request Object. * @param {Object} res The response Object. */ Community.prototype._del = function(req, res) { res.render('/city/community/del'); }; /** * The edit an item form. * * @param {Object} req The request Object. * @param {Object} res The response Object. */ Community.prototype._edit = function(req, res) { res.render('/city/community/edit'); };
Add CRUD forms on community controller
Add CRUD forms on community controller
JavaScript
mpl-2.0
WeAreRoots/weareroots.org
--- +++ @@ -7,6 +7,7 @@ var CrudeEntity = require('crude-entity'); var CommunityEnt = require('../../entities/community.ent'); +var CommunityMidd = require('../../middleware/communities.midd'); /** * Communities CRUD controller. @@ -14,7 +15,7 @@ * @contructor * @extends {app.ControllerBase} */ -var Dashboard = module.exports = ControllerBase.extendSingleton(function(){ +var Community = module.exports = ControllerBase.extendSingleton(function () { this.crude = new CrudeEntity('/community', CommunityEnt); this.crude.config({ idField: '_id', @@ -24,4 +25,48 @@ entityReadLimit: 'readLimitApi', entityUpdate: 'updateApi', }); + + var communityMidd = CommunityMidd.getInstance(); + + this.add = [ + this._add.bind(this), + ]; + this.del = [ + communityMidd.populateSingleFromParam.bind(communityMidd), + this._del.bind(this), + ]; + this.edit = [ + communityMidd.populateSingleFromParam.bind(communityMidd), + this._edit.bind(this), + ]; }); + +/** + * The add an item form. + * + * @param {Object} req The request Object. + * @param {Object} res The response Object. + */ +Community.prototype._add = function(req, res) { + res.render('/city/community/add'); +}; + +/** + * The del an item form. + * + * @param {Object} req The request Object. + * @param {Object} res The response Object. + */ +Community.prototype._del = function(req, res) { + res.render('/city/community/del'); +}; + +/** + * The edit an item form. + * + * @param {Object} req The request Object. + * @param {Object} res The response Object. + */ +Community.prototype._edit = function(req, res) { + res.render('/city/community/edit'); +};
0f789ea82e785d9e06582e892c4ec4ea45f245c8
httpserver.js
httpserver.js
var http = require('http'); var url = require('url'); var port = 8000; var server = http.createServer(function (request, response){ try { //go to http://127.0.0.1:8000/?req=Monty console.log('Server Pinged'); //Ping the server (will show in the cmd prompt) //The below will be written to the Web Browser response.writeHead(200, {"Content-Type": "text/plain"}); var req = checkURL(request); //Passes request into the checkURL function and stores output into the req variable var resp; if(req === "Aaron"){ resp = "Gavendo"; } else if(req === "Monty"){ resp = "python"; } else if(req === "Hello"){ resp = "World"; } else{ resp = "Please Enter: Aaron, Monty or Hello"; } response.write(resp); //Write the response on the web page. response.end(); } catch (e) { response.writeHead(500, { 'content-type': 'text/plain' }); response.write('ERROR:' + e); response.end('\n'); } }); server.listen(port); console.log('The server has run'); //This is for the cmd prompt. Runs once at the start. function checkURL(request){ var phrase = url.parse(request.url, true).query; // this checks for a query with a property called 'req' and returns its value. return phrase.req; }
var http = require('http'); var url = require('url'); var port = 8000; var server = http.createServer(function (request, response){ try { //go to http://127.0.0.1:8000/?req=Hello console.log('Server Pinged'); response.writeHead(200, {"Content-Type": "text/plain"}); var req = checkURL(request); var resp; if(req === "Hello"){ resp = "World"; } else{ resp = "Please Enter: Aaron, Monty or Hello"; } response.write(resp); response.end(); } catch(e) { response.writeHead(500, { 'content-type': 'text/plain' }); response.write('ERROR:' + e); response.end('\n'); } }); server.listen(port); console.log('The server has run'); function checkURL(request){ var phrase = url.parse(request.url, true).query; // this checks for a query with a property called 'req' and returns its value. return phrase.req; }
Fix Space and comment issues.
Fix Space and comment issues.
JavaScript
mit
delpillar/AvengersCC
--- +++ @@ -3,42 +3,33 @@ var port = 8000; var server = http.createServer(function (request, response){ - - try { - //go to http://127.0.0.1:8000/?req=Monty - console.log('Server Pinged'); //Ping the server (will show in the cmd prompt) - //The below will be written to the Web Browser - response.writeHead(200, {"Content-Type": "text/plain"}); - var req = checkURL(request); //Passes request into the checkURL function and stores output into the req variable - var resp; - if(req === "Aaron"){ - resp = "Gavendo"; - } - else if(req === "Monty"){ - resp = "python"; - } - else if(req === "Hello"){ - resp = "World"; - } - else{ - resp = "Please Enter: Aaron, Monty or Hello"; - } - response.write(resp); //Write the response on the web page. - response.end(); - } - catch (e) { - response.writeHead(500, { 'content-type': 'text/plain' }); - response.write('ERROR:' + e); - response.end('\n'); - } - + try { + //go to http://127.0.0.1:8000/?req=Hello + console.log('Server Pinged'); + response.writeHead(200, {"Content-Type": "text/plain"}); + var req = checkURL(request); + var resp; + if(req === "Hello"){ + resp = "World"; + } + else{ + resp = "Please Enter: Aaron, Monty or Hello"; + } + response.write(resp); + response.end(); + } + catch(e) { + response.writeHead(500, { 'content-type': 'text/plain' }); + response.write('ERROR:' + e); + response.end('\n'); + } }); server.listen(port); -console.log('The server has run'); //This is for the cmd prompt. Runs once at the start. +console.log('The server has run'); function checkURL(request){ - var phrase = url.parse(request.url, true).query; - // this checks for a query with a property called 'req' and returns its value. - return phrase.req; + var phrase = url.parse(request.url, true).query; + // this checks for a query with a property called 'req' and returns its value. + return phrase.req; }
c0ec7d4aa404259b62ee6d077e648d77ff0b08b5
src/components/Navbar.js
src/components/Navbar.js
/* * @flow */ import React from 'react'; export default function Navbar() { return ( <nav className="navbar navbar-default navbar-fixed-top navbar-inverse"> <div className="container-fluid"> <div className="navbar-header"> <a className="navbar-brand" href="/"> Bonsai - Trim your dependency trees </a> </div> <ul className="nav navbar-nav navbar-right"> <li> <a className="navbar-link" href="https://pinterest.github.io/bonsai/"> Docs </a> </li> <li> <a className="navbar-link" href="https://github.com/pinterest/bonsai"> Github </a> </li> </ul> </div> </nav> ); }
/* * @flow */ import React from 'react'; export default function Navbar() { return ( <nav className="navbar navbar-default navbar-fixed-top navbar-inverse"> <div className="container-fluid"> <div className="navbar-header"> <a className="navbar-brand" href="/" onClick={(e) => { event.preventDefault(); window.location.reload(); }}> Bonsai - Trim your dependency trees </a> </div> <ul className="nav navbar-nav navbar-right"> <li> <a className="navbar-link" href="https://pinterest.github.io/bonsai/"> Docs </a> </li> <li> <a className="navbar-link" href="https://github.com/pinterest/bonsai"> Github </a> </li> </ul> </div> </nav> ); }
Set the navbar to reload, no matter the url.
Set the navbar to reload, no matter the url.
JavaScript
apache-2.0
pinterest/bonsai,pinterest/bonsai,pinterest/bonsai
--- +++ @@ -9,7 +9,10 @@ <nav className="navbar navbar-default navbar-fixed-top navbar-inverse"> <div className="container-fluid"> <div className="navbar-header"> - <a className="navbar-brand" href="/"> + <a className="navbar-brand" href="/" onClick={(e) => { + event.preventDefault(); + window.location.reload(); + }}> Bonsai - Trim your dependency trees </a> </div>
d55af7519d0c44b6686d066a29a79ffe478f5789
app/components/Accounts/accounts.controller.js
app/components/Accounts/accounts.controller.js
( function() { "use strict"; angular.module('ACBank') .controller('AccountsController', AccountsController); AccountsController.$inject = [ '$scope', '$ionicModal' ]; function AccountsController ($scope, $ionicModal) { var vm = this; vm.options = [ { iconClass: "ion-plus-round", imageSource: "", clicked: function () { $scope.addAccountModal.show(); } }, { iconClass: "", imageSource: "../img/withdraw.png", clicked: function () { console.log("Withdraw"); } }, { iconClass: "", imageSource: "../img/deposit.png", clicked: function () { $scope.depositModal.show(); } } ]; $scope.accounts = []; $ionicModal.fromTemplateUrl('../templates/NL-Modals/Add Account/add-account-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.addAccountModal = modal; }); $ionicModal.fromTemplateUrl('../templates/NL-Modals/Deposit/deposit-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.depositModal = modal; }); } })();
( function() { "use strict"; angular.module('ACBank') .controller('AccountsController', AccountsController); AccountsController.$inject = [ '$scope', '$ionicModal' ]; function AccountsController ($scope, $ionicModal) { var vm = this; vm.options = [ { iconClass: "ion-plus-round", imageSource: "", clicked: function () { $scope.addAccountModal.show(); } }, { iconClass: "", imageSource: "../img/withdraw.png", clicked: function () { $scope.withdrawModal.show(); } }, { iconClass: "", imageSource: "../img/deposit.png", clicked: function () { $scope.depositModal.show(); } } ]; $scope.accounts = []; $ionicModal.fromTemplateUrl('../templates/NL-Modals/Add Account/add-account-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.addAccountModal = modal; }); $ionicModal.fromTemplateUrl('../templates/NL-Modals/Deposit/deposit-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.depositModal = modal; }); $ionicModal.fromTemplateUrl('../templates/NL-Modals/Withdraw/withdraw-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.withdrawModal = modal; }); } })();
Create modal for withdraw form
Create modal for withdraw form
JavaScript
mit
danielzy95/NewLeaf-Bank,danielzy95/NewLeaf-Bank
--- +++ @@ -19,7 +19,7 @@ { iconClass: "", imageSource: "../img/withdraw.png", - clicked: function () { console.log("Withdraw"); } + clicked: function () { $scope.withdrawModal.show(); } }, { iconClass: "", @@ -43,6 +43,13 @@ }).then(function(modal) { $scope.depositModal = modal; }); + + $ionicModal.fromTemplateUrl('../templates/NL-Modals/Withdraw/withdraw-modal.html', { + scope: $scope, + animation: 'slide-in-up' + }).then(function(modal) { + $scope.withdrawModal = modal; + }); } })();
a664da36f0c30e8357198e5db4817ac763254dc0
packages/truffle-solidity-utils/index.js
packages/truffle-solidity-utils/index.js
var SolidityUtils = { getCharacterOffsetToLineAndColumnMapping: function(source) { var mapping = []; source = source.split(""); var line = 0; var column = 0; source.forEach(function(character) { if (character == "\n") { line += 1; column = -1; mapping.push({ line: line, column: 0 }); } else { mapping.push({ line: line, column: column }); } column += 1; }); return mapping; }, getHumanReadableSourceMap: function(sourceMap) { var map = sourceMap.split(';'); var last = {}; return map.map(function(current) { var ret = { start: last.start, length: last.length, file: last.file, jump: last.jump }; current = current.split(':'); if (current[0] && current[0] !== '-1' && current[0].length) { ret.start = parseInt(current[0]); } if (current[1] && current[1] !== '-1' && current[1].length) { ret.length = parseInt(current[1]); } if (current[2] /*&& current[2] !== '-1'*/ && current[2].length) { ret.file = parseInt(current[2]); } if (current[3] && current[3].length) { ret.jump = current[3]; } last = ret; return ret; }); } }; module.exports = SolidityUtils;
var SolidityUtils = { getCharacterOffsetToLineAndColumnMapping: function(source) { var mapping = []; source = source.split(""); var line = 0; var column = 0; source.forEach(function(character) { if (character === "\n") { line += 1; column = -1; mapping.push({ line: line, column: 0 }); } else { mapping.push({ line: line, column: column }); } column += 1; }); return mapping; }, getHumanReadableSourceMap: function(sourceMap) { var map = sourceMap.split(';'); var last = {}; return map.map(function(current) { var ret = { start: last.start, length: last.length, file: last.file, jump: last.jump }; current = current.split(':'); if (current[0] && current[0] !== '-1' && current[0].length) { ret.start = parseInt(current[0]); } if (current[1] && current[1] !== '-1' && current[1].length) { ret.length = parseInt(current[1]); } if (current[2] /*&& current[2] !== '-1'*/ && current[2].length) { ret.file = parseInt(current[2]); } if (current[3] && current[3].length) { ret.jump = current[3]; } last = ret; return ret; }); } }; module.exports = SolidityUtils;
Convert Non-strict to strict equality checking Convert non-strict equality checking, using `==`, to the strict version, using `===`.
Convert Non-strict to strict equality checking Convert non-strict equality checking, using `==`, to the strict version, using `===`.
JavaScript
mit
ConsenSys/truffle
--- +++ @@ -9,7 +9,7 @@ var column = 0; source.forEach(function(character) { - if (character == "\n") { + if (character === "\n") { line += 1; column = -1;
ab82d0455847ebcec2bf7e57fe795f3924ff001b
tasks/dist.js
tasks/dist.js
import gulpLoadPlugins from 'gulp-load-plugins'; import runSequence from 'run-sequence'; import * as paths from './paths'; import gulp from './_gulp'; import jspmBuild from './utils'; const $ = gulpLoadPlugins(); gulp.task('dist:jspm', ['compile:styles'], () => jspmBuild({ minify: true, mangle: true, sourceMaps: false }) ); gulp.task('dist:js', (callback) => runSequence('dist:jspm', 'js:replace_paths', callback) ); gulp.task('dist:html', () => gulp.src(paths.SRC_INDEX) .pipe($.htmlReplace({'js': 'scripts/main.js'})) .pipe($.minifyHtml({empty: true})) .pipe(gulp.dest(paths.BUILD_DIR)) ); gulp.task('dist:copy', () => { const htmlFilter = $.filter("**/*.!(html)", {restore: true}); return gulp.src(paths.BUILD_ALL) .pipe(htmlFilter) .pipe($.rev()) .pipe(htmlFilter.restore) .pipe($.revReplace()) .pipe(gulp.dest(paths.DIST_DIR)); }); gulp.task('dist', (callback) => runSequence( ['clean:build', 'clean:dist', 'utils:copy_to_tmp'], ['dist:js', 'dist:html', 'build:images', 'build:fonts'], 'dist:copy', callback ) );
import gulpLoadPlugins from 'gulp-load-plugins'; import runSequence from 'run-sequence'; import * as paths from './paths'; import gulp from './_gulp'; import jspmBuild from './utils'; const $ = gulpLoadPlugins(); gulp.task('dist:jspm', ['compile:styles'], () => jspmBuild({ minify: true, mangle: true, sourceMaps: false }) ); gulp.task('dist:js', (callback) => runSequence('dist:jspm', 'js:replace_paths', callback) ); gulp.task('dist:html', () => gulp.src(paths.SRC_INDEX) .pipe($.htmlReplace({'js': 'scripts/main.js'})) .pipe($.minifyHtml({empty: true})) .pipe(gulp.dest(paths.BUILD_DIR)) ); gulp.task('dist:copy', () => { const htmlFilter = $.filter('**/*.!(html)', {restore: true}); return gulp.src(paths.BUILD_ALL) .pipe(htmlFilter) .pipe($.rev()) .pipe(htmlFilter.restore) .pipe($.revReplace()) .pipe(gulp.dest(paths.DIST_DIR)) .pipe($.gzip()) .pipe(gulp.dest(paths.DIST_DIR)); }); gulp.task('dist', (callback) => runSequence( ['clean:build', 'clean:dist', 'utils:copy_to_tmp'], ['dist:js', 'dist:html', 'build:images', 'build:fonts'], 'dist:copy', callback ) );
Make sure we gzip our assets for deployment
Make sure we gzip our assets for deployment
JavaScript
unlicense
gsong/es6-jspm-gulp-starter,gsong/es6-jspm-gulp-starter
--- +++ @@ -32,13 +32,15 @@ gulp.task('dist:copy', () => { - const htmlFilter = $.filter("**/*.!(html)", {restore: true}); + const htmlFilter = $.filter('**/*.!(html)', {restore: true}); return gulp.src(paths.BUILD_ALL) .pipe(htmlFilter) .pipe($.rev()) .pipe(htmlFilter.restore) .pipe($.revReplace()) + .pipe(gulp.dest(paths.DIST_DIR)) + .pipe($.gzip()) .pipe(gulp.dest(paths.DIST_DIR)); });
5733e5c5ef6467b7e74d0129201411651cde5ec1
client/src/safari-audio-bandaid.js
client/src/safari-audio-bandaid.js
'use strict'; const RELOAD_KEY = 'safari-reload-193289123', WAIT_TIME = 100; // Does it matter how long to wait? /** * Safari desktop audio is being dumb and won't play until a second page loads an audio file within a session. * Uses browser detection: http://stackoverflow.com/a/23522755 */ exports.check = function () { let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); if (isSafari) { if (navigator.cookieEnabled === false) { showError(1); } else { if (sessionStorage !== undefined && sessionStorage.getItem(RELOAD_KEY) !== 'y') { sessionStorage.setItem(RELOAD_KEY, 'y'); if (sessionStorage.getItem(RELOAD_KEY) === 'y') { setTimeout(() => { document.location.reload(false); }, WAIT_TIME); } else { showError(2); } } else { showError(3); } } } }; function showError(code) { console.error('Cannot set Safari reload key - sound might not work until reloaded manually: ' + code); }
'use strict'; const RELOAD_KEY = 'safari-reload-193289123', WAIT_TIME = 100; // Does it matter how long to wait? /** * Safari desktop audio is being dumb and won't play until a second page loads an audio file within a session. * Uses browser detection: http://stackoverflow.com/a/23522755 * * This still, doesn't always work. */ exports.check = function () { let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); if (isSafari) { if (navigator.cookieEnabled === false) { showError(1); } else { if (sessionStorage !== undefined) { if (sessionStorage.getItem(RELOAD_KEY) !== 'y') { sessionStorage.setItem(RELOAD_KEY, 'y'); if (sessionStorage.getItem(RELOAD_KEY) === 'y') { setTimeout(() => { document.location.reload(false); }, WAIT_TIME); } else { showError(2); } } else { // Was already set, so do nothing. } } else { showError(3); } } } }; function showError(code) { console.error('Cannot set Safari reload key - sound might not work until reloaded manually: ' + code); }
Fix error message logging in Safari bandaid
Fix error message logging in Safari bandaid
JavaScript
mit
hiddenwaffle/mazing,hiddenwaffle/mazing
--- +++ @@ -7,6 +7,8 @@ /** * Safari desktop audio is being dumb and won't play until a second page loads an audio file within a session. * Uses browser detection: http://stackoverflow.com/a/23522755 + * + * This still, doesn't always work. */ exports.check = function () { let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); @@ -14,12 +16,16 @@ if (navigator.cookieEnabled === false) { showError(1); } else { - if (sessionStorage !== undefined && sessionStorage.getItem(RELOAD_KEY) !== 'y') { - sessionStorage.setItem(RELOAD_KEY, 'y'); - if (sessionStorage.getItem(RELOAD_KEY) === 'y') { - setTimeout(() => { document.location.reload(false); }, WAIT_TIME); + if (sessionStorage !== undefined) { + if (sessionStorage.getItem(RELOAD_KEY) !== 'y') { + sessionStorage.setItem(RELOAD_KEY, 'y'); + if (sessionStorage.getItem(RELOAD_KEY) === 'y') { + setTimeout(() => { document.location.reload(false); }, WAIT_TIME); + } else { + showError(2); + } } else { - showError(2); + // Was already set, so do nothing. } } else { showError(3);
15da64f080c5003a3cd62d6d51647d5a88c7069d
client/users/auth/register/exec.js
client/users/auth/register/exec.js
'use strict'; /** * client **/ /** * client.common **/ /** * client.common.auth **/ /** * client.common.auth.register **/ /*global $, _, nodeca, window*/ /** * client.common.auth.register.exec($form, event) * * send registration data on server **/ module.exports = function ($form, event) { var params = nodeca.client.common.form.getData($form); nodeca.server.users.auth.register.exec(params, function(err){ var message; if (err) { if (err.statusCode === 409) { // clear pass params.pass = ''; // add errors params.errors = err.message; $form.replaceWith( nodeca.client.common.render('users.auth.register.view', params) ).fadeIn(); return; } message = nodeca.runtime.t('common.error.server_internal'); nodeca.client.common.notice('error', message); return; } $form.replaceWith( nodeca.client.common.render('users.auth.register.success') ).fadeIn(); }); // Disable regular click return false; };
'use strict'; /** * client **/ /** * client.common **/ /** * client.common.auth **/ /** * client.common.auth.register **/ /*global $, _, nodeca, window*/ /** * client.common.auth.register.exec($form, event) * * send registration data on server **/ module.exports = function ($form, event) { var params = nodeca.client.common.form.getData($form); nodeca.server.users.auth.register.exec(params, function(err){ var message; if (err) { if (err.statusCode === 409) { // clear pass params.pass = ''; // add errors params.errors = err.message; nodeca.client.common.render.page('users.auth.register.view', params); return; } message = nodeca.runtime.t('common.error.server_internal'); nodeca.client.common.notice('error', message); return; } nodeca.client.common.render.page('users.auth.register.success'); }); // Disable regular click return false; };
Use render.page for full-page reload
Use render.page for full-page reload
JavaScript
mit
nodeca/nodeca.users
--- +++ @@ -38,9 +38,7 @@ params.pass = ''; // add errors params.errors = err.message; - $form.replaceWith( - nodeca.client.common.render('users.auth.register.view', params) - ).fadeIn(); + nodeca.client.common.render.page('users.auth.register.view', params); return; } message = nodeca.runtime.t('common.error.server_internal'); @@ -48,9 +46,7 @@ return; } - $form.replaceWith( - nodeca.client.common.render('users.auth.register.success') - ).fadeIn(); + nodeca.client.common.render.page('users.auth.register.success'); }); // Disable regular click
eca75545e94bfeb2842992fb5e28b2f10946c6a8
agir/carte/components/map/index.js
agir/carte/components/map/index.js
import "ol/ol.css"; import "./style.css"; import listMap from "./listMap"; import itemMap from "./itemMap"; export default { listMap, itemMap, };
import "ol/ol.css"; import "./style.css"; export async function listMap() { const listMapModule = (await import("./listMap")).default; listMapModule.apply(null, arguments); } export async function itemMap() { const itemMapModule = (await import("./itemMap")).default; itemMapModule.apply(null, arguments); }
Revert "fix: chunk load errors on legacy map"
Revert "fix: chunk load errors on legacy map" This reverts commit 8f3220c2a95d1ec9ed6d1cbb742d579a019b7e36.
JavaScript
agpl-3.0
lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django
--- +++ @@ -1,9 +1,14 @@ import "ol/ol.css"; import "./style.css"; -import listMap from "./listMap"; -import itemMap from "./itemMap"; -export default { - listMap, - itemMap, -}; +export async function listMap() { + const listMapModule = (await import("./listMap")).default; + + listMapModule.apply(null, arguments); +} + +export async function itemMap() { + const itemMapModule = (await import("./itemMap")).default; + + itemMapModule.apply(null, arguments); +}
a2fda0c397b32f60c6bd8fccbd3e55ccaee381ed
src/battle/index.js
src/battle/index.js
import loop from 'loop'; import StatusBar from 'statusBar'; import BattleMap from 'map'; import state from 'state'; import { subtractSet } from 'pura/vector/tuple'; import { canvasOffsetLeft, canvasOffsetTop, scaleX, scaleY } from 'dom'; import { render as renderUI, uiElements, clearUi } from 'ui'; import { calcWorldPosition } from 'camera'; import { clear } from 'pura/canvas/tuple'; let stopLoop; const calcMousePosition = ({ clientX, clientY, touches }) => touches ? ([touches[0].clientX, touches[0].clientY]) : ([clientX, clientY]); export default { init() { uiElements.push(BattleMap, StatusBar); stopLoop = loop(dt => { clear(); renderUI(); }); window.addEventListener('click', (evt) => { const position = subtractSet(calcMousePosition(evt), [canvasOffsetLeft, canvasOffsetTop]); position[0] *= scaleX; position[1] *= scaleY; state.target = calcWorldPosition(position); }); }, dismiss() { stopLoop(); } }
import loop from 'loop'; import StatusBar from 'statusBar'; import BattleMap from 'map'; import state from 'state'; import { inputs } from 'controls'; import { subtractSet } from 'pura/vector/tuple'; import { canvasOffsetLeft, canvasOffsetTop, scaleX, scaleY } from 'dom'; import { render as renderUI, uiElements, clearUi } from 'ui'; import { calcWorldPosition } from 'camera'; import { clear } from 'pura/canvas/tuple'; export default { init() { uiElements.push(BattleMap, StatusBar); state.logic = () => { if (inputs.mouse === 1) { state.target = calcWorldPosition(inputs.mousePosition); } }; }, dismiss() { } }
Update battle map with input handling
Update battle map with input handling
JavaScript
mit
HyphnKnight/js13k-2017,HyphnKnight/js13k-2017
--- +++ @@ -2,35 +2,21 @@ import StatusBar from 'statusBar'; import BattleMap from 'map'; import state from 'state'; +import { inputs } from 'controls'; import { subtractSet } from 'pura/vector/tuple'; import { canvasOffsetLeft, canvasOffsetTop, scaleX, scaleY } from 'dom'; import { render as renderUI, uiElements, clearUi } from 'ui'; import { calcWorldPosition } from 'camera'; import { clear } from 'pura/canvas/tuple'; -let stopLoop; - -const calcMousePosition = - ({ clientX, clientY, touches }) => - touches - ? ([touches[0].clientX, touches[0].clientY]) - : ([clientX, clientY]); - export default { init() { uiElements.push(BattleMap, StatusBar); - stopLoop = loop(dt => { - clear(); - renderUI(); - }); - window.addEventListener('click', (evt) => { - const position = subtractSet(calcMousePosition(evt), [canvasOffsetLeft, canvasOffsetTop]); - position[0] *= scaleX; - position[1] *= scaleY; - state.target = calcWorldPosition(position); - }); + state.logic = () => { + if (inputs.mouse === 1) { + state.target = calcWorldPosition(inputs.mousePosition); + } + }; }, - dismiss() { - stopLoop(); - } + dismiss() { } }
5556cdf8a84ee8b1201f5e861395fafd784eab09
gevents.js
gevents.js
'use strict'; var request = require('request'); var opts = { uri: 'https://api.github.com' + '/users/jm-janzen/events', json: true, method: 'GET', headers: { 'User-Agent': 'nodejs script' } } request(opts, function (err, res, body) { if (err) throw new Error(err); var format = '[%s]: %s %s %s %s'; for (var i = 0; i < body.length; i++) { console.log(format , body[i].created_at , body[i].type , body[i].actor.login , body[i].repo.name); } });
'use strict'; var request = require('request'); var opts = { uri: 'https://api.github.com' + '/users/' + process.argv[2] + '/events', json: true, method: 'GET', headers: { 'User-Agent': 'nodejs script' } } request(opts, function (err, res, body) { if (err) throw new Error(err); var format = '[%s]: %s %s %s %s'; for (var i = 0; i < body.length; i++) { console.log(format , body[i].created_at , body[i].type , body[i].actor.login , body[i].repo.name); } });
Add user-name as parameter, rather than hardcoding
Add user-name as parameter, rather than hardcoding TODO check for user-name before attempting to issue request
JavaScript
mit
jm-janzen/scripts,jm-janzen/scripts,jm-janzen/scripts
--- +++ @@ -3,7 +3,7 @@ var request = require('request'); var opts = { - uri: 'https://api.github.com' + '/users/jm-janzen/events', + uri: 'https://api.github.com' + '/users/' + process.argv[2] + '/events', json: true, method: 'GET', headers: {
d24c5ea29e999b3b1ed1c20fd4d19b27c54b302a
app/assets/javascripts/models/mixer.js
app/assets/javascripts/models/mixer.js
Mixer = function () { this.mix = [] } //Adds a track to the mix. Takes args = {url: sound.aws.com, divId: 1} Mixer.prototype.addTrack = function (args) { var newTrack = new Howl({ url : [args['url']] }); this.mix[args['divId']] = newTrack } Mixer.prototype.removeTrack = function (arrayPosition) { this.mix[arrayPosition] = null }
Mixer = function () { this.mix = [] } //Adds a track to the mix. Takes args = {url: sound.aws.com, divId: 1} Mixer.prototype.addTrack = function (args) { var newTrack = new Howl({ url : [args['url']] }); this.mix[args['divId']] = newTrack; } Mixer.prototype.removeTrack = function (arrayPosition) { this.mix[arrayPosition] = null; } Mixer.prototype.globalPlay = function () { for (var i = 0; i< this.mix.length; i++) { this.mix[i].play() } } Mixer.prototype.globalPause = function () { for (var i = 0; i< this.mix.length; i++) { this.mix[i].pause() } }
Write globalPause and globalPlay methods for Mixer model
Write globalPause and globalPlay methods for Mixer model
JavaScript
mit
chi-bobolinks-2015/TheGoldenRecord,chi-bobolinks-2015/TheGoldenRecord,chi-bobolinks-2015/TheGoldenRecord
--- +++ @@ -7,9 +7,21 @@ var newTrack = new Howl({ url : [args['url']] }); - this.mix[args['divId']] = newTrack + this.mix[args['divId']] = newTrack; } Mixer.prototype.removeTrack = function (arrayPosition) { - this.mix[arrayPosition] = null + this.mix[arrayPosition] = null; } + +Mixer.prototype.globalPlay = function () { + for (var i = 0; i< this.mix.length; i++) { + this.mix[i].play() + } +} + +Mixer.prototype.globalPause = function () { + for (var i = 0; i< this.mix.length; i++) { + this.mix[i].pause() + } +}
518fac5020c9055cda2e72b91319df340641d1c9
app/users/pwd-activation.controller.js
app/users/pwd-activation.controller.js
'use strict'; angular.module('arachne.controllers') /** * Set new password. * * @author: Daniel M. de Oliveira */ .controller('PwdActivationController', ['$scope', '$stateParams', '$filter', '$location', 'PwdActivation', 'messageService', function ($scope, $stateParams, $filter, $location, PwdActivation, messages) { /** * Copy the user so that the shown passwords * of user object in $scope do not get modified * * @param user */ var copyUser = function (user) { var newUser = JSON.parse(JSON.stringify(user)); if (user.password) newUser.password = $filter('md5')(user.password); if (user.passwordConfirm) newUser.passwordConfirm = $filter('md5')(user.passwordConfirm); return newUser; }; var handleActivationSuccess = function () { messages.dontClearOnNextLocationChange(); messages.add('ui.passwordactivation.success', 'success'); $location.path("/"); }; var handleActivationError = function (data) { console.log(data); messages.add('default', 'danger'); }; $scope.submit = function () { PwdActivation.save({token: $stateParams.token}, copyUser($scope.user), handleActivationSuccess, handleActivationError ); } }]);
'use strict'; angular.module('arachne.controllers') /** * Set new password. * * @author: Daniel M. de Oliveira */ .controller('PwdActivationController', ['$scope', '$stateParams', '$filter', '$location', 'PwdActivation', 'messageService', function ($scope, $stateParams, $filter, $location, PwdActivation, messages) { /** * Copy the user so that the shown passwords * of user object in $scope do not get modified * * @param user */ var copyUser = function (user) { var newUser = JSON.parse(JSON.stringify(user)); if (user.password) newUser.password = $filter('md5')(user.password); if (user.passwordConfirm) newUser.passwordConfirm = $filter('md5')(user.passwordConfirm); return newUser; }; var handleActivationSuccess = function () { messages.dontClearOnNextLocationChange(); messages.add('ui.passwordactivation.success', 'success'); $location.path("/"); }; var handleActivationError = function (data) { console.log(data); messages.add('ui.register.passwordsDontMatch', 'danger'); }; $scope.submit = function () { PwdActivation.save({token: $stateParams.token}, copyUser($scope.user), handleActivationSuccess, handleActivationError ); } }]);
Change password reset error message
Change password reset error message
JavaScript
apache-2.0
dainst/arachnefrontend,dainst/arachnefrontend,codarchlab/arachnefrontend,codarchlab/arachnefrontend
--- +++ @@ -38,7 +38,7 @@ var handleActivationError = function (data) { console.log(data); - messages.add('default', 'danger'); + messages.add('ui.register.passwordsDontMatch', 'danger'); }; $scope.submit = function () {
a3c7fef9a49f938aa9426b38a2d6e9652c21ae39
src/components/Felony.js
src/components/Felony.js
'use strict'; import React, { Component } from 'react'; import ReactCSS from 'reactcss'; import colors from '../styles/variables/colors'; import 'normalize.css'; import '../fonts/work-sans/WorkSans.css!'; import '../styles/felony.css!'; import Header from './header/Header'; import EncryptKeyList from './encrypt/EncryptKeyList'; import FloatingButtonToggle from './floating-button/FloatingButtonToggle'; export class Felony extends Component { classes() { return { 'default': { app: { Absolute: '0 0 0 0', background: colors.bgLight, }, header: { position: 'fixed', top: 0, left: 0, right: 0, }, encryptKeyList: { position: 'fixed', top: 78, left: 0, right: 0, bottom: 0, overflowY: 'scroll', // TODO: elastic scroll }, }, }; } render() { return ( <div is="app"> <div is="header"> <Header /> </div> <div is="encryptKeyList"> <EncryptKeyList /> </div> <FloatingButtonToggle /> </div> ); } } export default ReactCSS(Felony);
'use strict' import 'normalize.css' import React, { Component } from 'react' import ReactCSS from 'reactcss' import '../fonts/work-sans/WorkSans.css!' import '../styles/felony.css!' import colors from '../styles/variables/colors' import EncryptKeyListContainer from '../containers/EncryptKeyListContainer' import FloatingButtonToggle from './floating-button/FloatingButtonToggle' import Header from './header/Header' export class Felony extends Component { classes() { return { 'default': { app: { absolute: '0 0 0 0', background: colors.bgLight, }, header: { position: 'fixed', top: 0, left: 0, right: 0, }, encryptKeyList: { position: 'fixed', top: 78, left: 0, right: 0, bottom: 0, overflowY: 'scroll', // TODO: elastic scroll }, }, } } render() { return ( <div is="app"> <div is="header"> <Header /> </div> <div is="encryptKeyList"> <EncryptKeyListContainer /> </div> <FloatingButtonToggle /> </div> ) } } export default ReactCSS(Felony)
Use react key list container
Use react key list container
JavaScript
mit
henryboldi/felony,tobycyanide/felony,tobycyanide/felony,henryboldi/felony
--- +++ @@ -1,23 +1,23 @@ -'use strict'; +'use strict' -import React, { Component } from 'react'; -import ReactCSS from 'reactcss'; +import 'normalize.css' +import React, { Component } from 'react' +import ReactCSS from 'reactcss' -import colors from '../styles/variables/colors'; -import 'normalize.css'; -import '../fonts/work-sans/WorkSans.css!'; -import '../styles/felony.css!'; +import '../fonts/work-sans/WorkSans.css!' +import '../styles/felony.css!' +import colors from '../styles/variables/colors' -import Header from './header/Header'; -import EncryptKeyList from './encrypt/EncryptKeyList'; -import FloatingButtonToggle from './floating-button/FloatingButtonToggle'; +import EncryptKeyListContainer from '../containers/EncryptKeyListContainer' +import FloatingButtonToggle from './floating-button/FloatingButtonToggle' +import Header from './header/Header' export class Felony extends Component { classes() { return { 'default': { app: { - Absolute: '0 0 0 0', + absolute: '0 0 0 0', background: colors.bgLight, }, header: { @@ -35,7 +35,7 @@ overflowY: 'scroll', // TODO: elastic scroll }, }, - }; + } } render() { @@ -45,12 +45,12 @@ <Header /> </div> <div is="encryptKeyList"> - <EncryptKeyList /> + <EncryptKeyListContainer /> </div> <FloatingButtonToggle /> </div> - ); + ) } } -export default ReactCSS(Felony); +export default ReactCSS(Felony)
d67f181f7adaf5e15529cab3b0e950821784c125
lib/commands/bench.js
lib/commands/bench.js
module.exports = function() { return this .title('Benchmarks') .helpful() .arg() .name('treeish-list') .title('List of revisions to compare (git treeish)') .arr() .end() .opt() .name('benchmarks') .short('b').long('benchmark') .arr() .title('List of benchmarks to run') .end() .opt() .name('no-wc') .short('w').long('no-wc') .flag() .title('Run benchmarks without using working copy, use only specified revisions') .end() .opt() .name('rerun') .long('rerun') .flag() .title('Reuse previously checked out and made revisions, run benchmarks only') .end() .opt() .name('techs') .long('techs') .short('t') .title('Tech to run testing') .arr() .end() .opt() .name('rme') .short('r').long('rme') .title('Delta for RME') .end() .opt() .name('delay') .short('d').long('delay') .title('Delay between benchmarks') .end() .act(function(opts,args) { return require('../bench')(opts, args).start(); }) .end(); };
module.exports = function() { return this .title('Benchmarks') .helpful() .arg() .name('treeish-list') .title('List of revisions to compare (git treeish)') .arr() .end() .opt() .name('benchmarks') .short('b').long('benchmark') .arr() .title('List of benchmarks to run') .end() .opt() .name('no-wc') .short('w').long('no-wc') .flag() .title('Run benchmarks without using working copy, use only specified revisions') .end() .opt() .name('rerun') .long('rerun') .flag() .title('Reuse previously checked out and made revisions, run benchmarks only') .end() .opt() .name('techs') .long('techs') .short('t') .title('Techs to run tests for') .arr() .end() .opt() .name('rme') .short('r').long('rme') .title('Delta for RME') .end() .opt() .name('delay') .short('d').long('delay') .title('Delay between benchmarks') .end() .act(function(opts,args) { return require('../bench')(opts, args).start(); }) .end(); };
Change a title of the option
Change a title of the option
JavaScript
mit
bem-archive/bem-tools,bem/bem-tools,bem-archive/bem-tools,bem/bem-tools
--- +++ @@ -30,7 +30,7 @@ .name('techs') .long('techs') .short('t') - .title('Tech to run testing') + .title('Techs to run tests for') .arr() .end() .opt()
ed49dda7b558b023170222c8e3c6cdbb661dd98e
karma.conf.js
karma.conf.js
// Karma configuration file, see link for more information // https://karma-runner.github.io/0.13/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular/cli'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular/cli/plugins/karma') ], client:{ clearContext: false // leave Jasmine Spec Runner output visible in browser }, files: [ { pattern: './src/test.ts', watched: false } ], preprocessors: { './src/test.ts': ['@angular/cli'] }, mime: { 'text/x-typescript': ['ts','tsx'] }, coverageIstanbulReporter: { reports: [ 'html', 'lcovonly' ], fixWebpackSourcePaths: true }, angularCli: { environment: 'dev' }, reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress', 'coverage-istanbul'] : ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };
// Karma configuration file, see link for more information // https://karma-runner.github.io/0.13/config/configuration-file.html module.exports = function (config) { configuration = { basePath: '', frameworks: ['jasmine', '@angular/cli'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular/cli/plugins/karma') ], client:{ clearContext: false // leave Jasmine Spec Runner output visible in browser }, files: [ { pattern: './src/test.ts', watched: false } ], preprocessors: { './src/test.ts': ['@angular/cli'] }, mime: { 'text/x-typescript': ['ts','tsx'] }, coverageIstanbulReporter: { reports: [ 'html', 'lcovonly' ], fixWebpackSourcePaths: true }, angularCli: { environment: 'dev' }, reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress', 'coverage-istanbul'] : ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, customLaunchers: { Chrome_travis_ci: { base: 'Chrome', flags: ['--no-sandbox'] } }, }; // Update browser configuration for Travis CI if (process.env.TRAVIS) { configuration.browsers = ['Chrome_travis_ci']; } config.set(configuration); };
Configure custom karma browser launcher for travis
Configure custom karma browser launcher for travis
JavaScript
mit
briggySmalls/late-train-mate,briggySmalls/late-train-mate,briggySmalls/late-train-mate
--- +++ @@ -2,7 +2,7 @@ // https://karma-runner.github.io/0.13/config/configuration-file.html module.exports = function (config) { - config.set({ + configuration = { basePath: '', frameworks: ['jasmine', '@angular/cli'], plugins: [ @@ -39,6 +39,20 @@ logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], - singleRun: false - }); + singleRun: false, + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + }; + + // Update browser configuration for Travis CI + if (process.env.TRAVIS) { + configuration.browsers = ['Chrome_travis_ci']; + } + + config.set(configuration); }; +
edfb85e8ccb1986c33c2752ea5ddb42f153ce8f2
examples/rolesWithAccountsUI/server/startup.js
examples/rolesWithAccountsUI/server/startup.js
Meteor.startup(function () { console.log('Running server startup code...'); Accounts.onCreateUser(function (options, user) { Roles.addRolesToUserObj(user, ['admin','view-secrets']); if (options.profile) { // include the user profile user.profile = options.profile } // other user object changes... // ... return user; }); });
Meteor.startup(function () { console.log('Running server startup code...'); Accounts.onCreateUser(function (options, user) { Roles.setRolesOnUserObj(user, ['admin','view-secrets']); if (options.profile) { // include the user profile user.profile = options.profile } // other user object changes... // ... return user; }); });
Change example method to properly reflect action taken
Change example method to properly reflect action taken
JavaScript
mit
sumanla13a/moleReteor,dandv/meteor-roles,zoey4lee/meteor-roles,alanning/meteor-roles,dropfen/meteor-roles,sumanla13a/moleReteor,dandv/meteor-roles,challett/meteor-roles
--- +++ @@ -3,7 +3,7 @@ console.log('Running server startup code...'); Accounts.onCreateUser(function (options, user) { - Roles.addRolesToUserObj(user, ['admin','view-secrets']); + Roles.setRolesOnUserObj(user, ['admin','view-secrets']); if (options.profile) { // include the user profile
0008264bcabddf8d2b6b19fde7aa41b0de7a5b77
src/templates/Compact.js
src/templates/Compact.js
// Simple, slimline template based on https://github.com/rackt/react-router/blob/master/CHANGES.md import Default from './Default' export default class Compact extends Default { mergesTitle = null fixesTitle = null commitsTitle = null fixPrefix = 'Fixed ' mergePrefix = 'Merged ' listSpacing = '\n' renderReleaseHeading = (release, previousRelease) => { const title = this.renderReleaseTitle(release, previousRelease) const date = release.tag ? `\n> ${formatDate(release.date)}` : '' return `### ${title}${date}\n` } } function formatDate (string) { const date = new Date(string) const day = date.getDate() const month = date.toLocaleString('en', { month: 'long' }) const year = date.getFullYear() return `${day} ${month} ${year}` }
// Simple, slimline template based on https://github.com/rackt/react-router/blob/master/CHANGES.md import Default from './Default' const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] export default class Compact extends Default { mergesTitle = null fixesTitle = null commitsTitle = null fixPrefix = 'Fixed ' mergePrefix = 'Merged ' listSpacing = '\n' renderReleaseHeading = (release, previousRelease) => { const title = this.renderReleaseTitle(release, previousRelease) const date = release.tag ? `\n> ${formatDate(release.date)}` : '' return `### ${title}${date}\n` } } function formatDate (string) { const date = new Date(string) const day = date.getDate() const month = months[date.getMonth()] const year = date.getFullYear() return `${day} ${month} ${year}` }
Replace toLocaleString usage with months array
Replace toLocaleString usage with months array Not supported in node 0.10
JavaScript
mit
CookPete/auto-changelog,CookPete/auto-changelog
--- +++ @@ -1,6 +1,8 @@ // Simple, slimline template based on https://github.com/rackt/react-router/blob/master/CHANGES.md import Default from './Default' + +const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] export default class Compact extends Default { mergesTitle = null @@ -22,7 +24,7 @@ function formatDate (string) { const date = new Date(string) const day = date.getDate() - const month = date.toLocaleString('en', { month: 'long' }) + const month = months[date.getMonth()] const year = date.getFullYear() return `${day} ${month} ${year}` }
d76659cde113f54aa724bf2554f9dc84bb2d8e8e
lib/cb.events.socketio/main.js
lib/cb.events.socketio/main.js
// Requires var wireFriendly = require('../utils').wireFriendly; function setup(options, imports, register) { // Import var events = imports.events; var io = imports.socket_io.io; // Send events to user io.of('/events').on('connection', function(socket) { // Send to client var handler = function(data) { socket.emit(this.event, wireFriendly(data)); }; // Clean up on disconnect var cleanup = function() { events.offAny(handler); }; // Construct events.onAny(handler); // Disconnect cleanly socket.on('disconnect', cleanup); }); // Register register(null, {}); } // Exports module.exports = setup;
// Requires var wireFriendly = require('../utils').wireFriendly; function setup(options, imports, register) { // Import var events = imports.events; var io = imports.socket_io.io; // Send events to user io.of('/events').on('connection', function(socket) { // Send to client var handler = function(data) { socket.emit("event", { "event": this.event, "data": wireFriendly(data) }); }; // Clean up on disconnect var cleanup = function() { events.offAny(handler); }; // Construct events.onAny(handler); // Disconnect cleanly socket.on('disconnect', cleanup); }); // Register register(null, {}); } // Exports module.exports = setup;
Change event propagation in socket.io
Change event propagation in socket.io
JavaScript
apache-2.0
kustomzone/codebox,code-box/codebox,ronoaldo/codebox,smallbal/codebox,ahmadassaf/Codebox,rajthilakmca/codebox,nobutakaoshiro/codebox,fly19890211/codebox,nobutakaoshiro/codebox,Ckai1991/codebox,listepo/codebox,rajthilakmca/codebox,LogeshEswar/codebox,listepo/codebox,rodrigues-daniel/codebox,smallbal/codebox,indykish/codebox,code-box/codebox,quietdog/codebox,CodeboxIDE/codebox,indykish/codebox,blubrackets/codebox,etopian/codebox,fly19890211/codebox,kustomzone/codebox,etopian/codebox,blubrackets/codebox,rodrigues-daniel/codebox,LogeshEswar/codebox,lcamilo15/codebox,CodeboxIDE/codebox,Ckai1991/codebox,ahmadassaf/Codebox,quietdog/codebox,lcamilo15/codebox,ronoaldo/codebox
--- +++ @@ -11,7 +11,10 @@ io.of('/events').on('connection', function(socket) { // Send to client var handler = function(data) { - socket.emit(this.event, wireFriendly(data)); + socket.emit("event", { + "event": this.event, + "data": wireFriendly(data) + }); }; // Clean up on disconnect
c9e4245ef6893d9981e7f3cd18c9beb3d20b172a
core/components/com_content/admin/assets/js/content.js
core/components/com_content/admin/assets/js/content.js
Hubzero.submitbutton = function(task) { $(document).trigger('editorSave'); var frm = document.getElementById('item-form'); if (frm) { if (task == 'cancel' || document.formvalidator.isValid(frm)) { Hubzero.submitform(task, frm); } else { alert(frm.getAttribute('data-invalid-msg')); } } } jQuery(document).ready(function ($) { $('#btn-batch-submit') .on('click', function (e){ Hubzero.submitbutton('article.batch'); }); $('#btn-batch-clear') .on('click', function (e){ e.preventDefault(); $('#batch-category-id').val(''); $('#batch-access').val(''); $('#batch-language-id').val(''); }); });
Hubzero.submitbutton = function(task) { var frm = document.getElementById('adminForm'); if (frm) { return Hubzero.submitform(task, frm); } $(document).trigger('editorSave'); var frm = document.getElementById('item-form'); if (frm) { if (task == 'cancel' || document.formvalidator.isValid(frm)) { Hubzero.submitform(task, frm); } else { alert(frm.getAttribute('data-invalid-msg')); } } } jQuery(document).ready(function ($) { $('#btn-batch-submit') .on('click', function (e){ Hubzero.submitbutton('article.batch'); }); $('#btn-batch-clear') .on('click', function (e){ e.preventDefault(); $('#batch-category-id').val(''); $('#batch-access').val(''); $('#batch-language-id').val(''); }); });
Add support for submitbutton on listing page
[fix] Add support for submitbutton on listing page Fixes: https://qubeshub.org/support/ticket/1409
JavaScript
mit
zooley/hubzero-cms,zooley/hubzero-cms,anthonyfuentes/hubzero-cms,zooley/hubzero-cms,zweidner/hubzero-cms,zweidner/hubzero-cms,zweidner/hubzero-cms,anthonyfuentes/hubzero-cms,zweidner/hubzero-cms,anthonyfuentes/hubzero-cms,anthonyfuentes/hubzero-cms,zooley/hubzero-cms
--- +++ @@ -1,5 +1,11 @@ Hubzero.submitbutton = function(task) { + var frm = document.getElementById('adminForm'); + + if (frm) { + return Hubzero.submitform(task, frm); + } + $(document).trigger('editorSave'); var frm = document.getElementById('item-form');
04f24422e4567ed015db973a5d28f867f984e151
app/containers/settings/ProfileSettingsPage.js
app/containers/settings/ProfileSettingsPage.js
// @flow import React, { Component, PropTypes } from 'react'; import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; import Settings from '../../components/settings/Settings'; import ProfileSettings from '../../components/settings/categories/ProfileSettings'; @observer(['state', 'controller']) export default class ProfileSettingsPage extends Component { static propTypes = { state: PropTypes.shape({ account: PropTypes.shape({ userAccount: PropTypes.shape({ profile: MobxPropTypes.observableObject.isRequired }).isRequired, isLoading: PropTypes.bool.isRequired }).isRequired }).isRequired, controller: PropTypes.shape({ account: PropTypes.shape({ updateName: PropTypes.func.isRequired }).isRequired }).isRequired }; render() { const { profile } = this.props.state.account.userAccount; const { isLoading } = this.props.state.account; const { controller } = this.props; if (isLoading) return <div>Loading</div>; return ( <Settings> <ProfileSettings profile={profile} onFieldValueChange={(field, name) => controller.account.updateField(field, name)} /> </Settings> ); } }
// @flow import React, { Component, PropTypes } from 'react'; import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; import Settings from '../../components/settings/Settings'; import ProfileSettings from '../../components/settings/categories/ProfileSettings'; @observer(['state', 'controller']) export default class ProfileSettingsPage extends Component { static propTypes = { state: PropTypes.shape({ account: PropTypes.shape({ userAccount: PropTypes.shape({ profile: MobxPropTypes.observableObject.isRequired }).isRequired, isLoading: PropTypes.bool.isRequired }).isRequired }).isRequired, controller: PropTypes.shape({ account: PropTypes.shape({ updateField: PropTypes.func.isRequired }).isRequired }).isRequired }; render() { const { profile } = this.props.state.account.userAccount; const { isLoading } = this.props.state.account; const { controller } = this.props; if (isLoading) return <div>Loading</div>; return ( <Settings> <ProfileSettings profile={profile} onFieldValueChange={(field, name) => controller.account.updateField(field, name)} /> </Settings> ); } }
Fix profile settings page props type checking
Fix profile settings page props type checking
JavaScript
apache-2.0
input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus
--- +++ @@ -18,7 +18,7 @@ }).isRequired, controller: PropTypes.shape({ account: PropTypes.shape({ - updateName: PropTypes.func.isRequired + updateField: PropTypes.func.isRequired }).isRequired }).isRequired };
bbae408dae6e4a10488f85ae5180ed62ba033406
javascript/irg-constants-config.js
javascript/irg-constants-config.js
IRG.constants = (function(){ var approvedDomains = function(){ return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com", "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com", "deviantart.net", "awwni.me", "i."]; }; var messages = { error: { aProblem : "There's been a problem!", noImagesFound: "No images were found." }, info: { enterSubreddits: "Please enter your subreddits." } }; return{ approvedDomains: approvedDomains(), messages: messages }; })(); IRG.config = (function(){ var redditLocation = "https://www.reddit.com"; return{ redditLocation: redditLocation }; })();
IRG.constants = (function(){ var approvedDomains = function(){ return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com", "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com", "deviantart.net", "awwni.me", "i.", "fbcdn.net"]; }; var messages = { error: { aProblem : "There's been a problem!", noImagesFound: "No images were found." }, info: { enterSubreddits: "Please enter your subreddits." } }; return{ approvedDomains: approvedDomains(), messages: messages }; })(); IRG.config = (function(){ var redditLocation = "https://www.reddit.com"; return{ redditLocation: redditLocation }; })();
Add a URL to the whitelist
Add a URL to the whitelist
JavaScript
mit
CharlieCorner/InfiniteRedditGallery,CharlieCorner/InfiniteRedditGallery
--- +++ @@ -5,7 +5,7 @@ "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com", - "deviantart.net", "awwni.me", "i."]; + "deviantart.net", "awwni.me", "i.", "fbcdn.net"]; }; var messages = {
8ef3e64a4724f1a5ba59d785535c777888497793
javascript/irg-constants-config.js
javascript/irg-constants-config.js
IRG.constants = (function(){ var approvedDomains = function(){ return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com", "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com"]; }; var messages = { error: { aProblem : "There's been a problem!", noImagesFound: "No images were found." }, info: { enterSubreddits: "Please enter your subreddits." } }; return{ approvedDomains: approvedDomains(), messages: messages }; })(); IRG.config = (function(){ })();
IRG.constants = (function(){ var approvedDomains = function(){ return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com", "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com", "deviantart.net"]; }; var messages = { error: { aProblem : "There's been a problem!", noImagesFound: "No images were found." }, info: { enterSubreddits: "Please enter your subreddits." } }; return{ approvedDomains: approvedDomains(), messages: messages }; })(); IRG.config = (function(){ })();
Add a new domain to the whitelist
Add a new domain to the whitelist
JavaScript
mit
CharlieCorner/InfiniteRedditGallery,CharlieCorner/InfiniteRedditGallery
--- +++ @@ -4,7 +4,8 @@ return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com", "fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com", "s-media-cache-ak0.pinimg.com", "gfycat.com", "gifbeam.com", "staticflickr.com", "imgflip.com", - "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com"]; + "upload.wikimedia.org", "livememe.com", "tumblr.com", "wikipedia.org", "archive.is", "imgrush.com", + "deviantart.net"]; }; var messages = {
e3f7d5db84e5f24f7647e03c5b1f15a5e24b2d21
src/main/web/florence/js/functions/__init.js
src/main/web/florence/js/functions/__init.js
setupFlorence(); //forms field styling markup injection //$('select:not(.small)').wrap('<span class="selectbg"></span>'); //$('select.small').wrap('<span class="selectbg selectbg--small"></span>'); //$('.selectbg--small:eq(1)').addClass('selectbg--small--margin'); //$('.selectbg--small:eq(3)').addClass('float-right');
setupFlorence();
Remove commented code not used.
Remove commented code not used.
JavaScript
mit
ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence
--- +++ @@ -1,8 +1 @@ setupFlorence(); - - -//forms field styling markup injection -//$('select:not(.small)').wrap('<span class="selectbg"></span>'); -//$('select.small').wrap('<span class="selectbg selectbg--small"></span>'); -//$('.selectbg--small:eq(1)').addClass('selectbg--small--margin'); -//$('.selectbg--small:eq(3)').addClass('float-right');
cc4030c1901365a14360c581521bece5037b140f
mockingjays.js
mockingjays.js
Server = require('./src/server'); Mockingjay = require('./src/mockingjay'); DefaultOptions = require('./src/default_options'); var Mockingjays = function() {} /** * Start creates a Mockingjays Server and starts proxying * or mocking responses based on previous training. * * @param options - An {Object} with options * :cacheDir - Path to cache storage. * :port - Port that Mockingjays should bind to. * :serverBaseUrl - Base URL for the source server. */ Mockingjays.prototype.start = function(options) { var finalOptions = DefaultOptions.merge(options); var mockingjay = new Mockingjay(); Server.listen(finalOptions, function(req, res){ mockingjay.onRequest(req, res)}); } module.exports = Mockingjays
Server = require('./src/server'); Mockingjay = require('./src/mockingjay'); DefaultOptions = require('./src/default_options'); var Mockingjays = function() {} /** * Start creates a Mockingjays Server and starts proxying * or mocking responses based on previous training. * * @param options - An {Object} with options * :cacheDir - Path to cache storage. * :port - Port that Mockingjays should bind to. * :serverBaseUrl - Base URL for the source server. */ Mockingjays.prototype.start = function(options) { var defaultOptions = new DefaultOptions(); var finalOptions = defaultOptions.merge(options); var mockingjay = new Mockingjay(finalOptions); Server.listen(finalOptions, function(req, res){ mockingjay.onRequest(req, res)}); } module.exports = Mockingjays
Update Option Parsing for Mockingjays
Update Option Parsing for Mockingjays
JavaScript
apache-2.0
blad/mockingjays
--- +++ @@ -14,8 +14,9 @@ * :serverBaseUrl - Base URL for the source server. */ Mockingjays.prototype.start = function(options) { - var finalOptions = DefaultOptions.merge(options); - var mockingjay = new Mockingjay(); + var defaultOptions = new DefaultOptions(); + var finalOptions = defaultOptions.merge(options); + var mockingjay = new Mockingjay(finalOptions); Server.listen(finalOptions, function(req, res){ mockingjay.onRequest(req, res)}); }
5f54a6c59f4011b1a0027c9b92cbf532f4f457ad
points/index.js
points/index.js
var pointTable = {}; module.exports = function(match, response) { var points = Number(match[1]), multiplier = ('to' === match[2]) - ('from' === match[2]), target = match[3]; pointTable[target] = (pointTable[target] || 0) + (points * multiplier); response.end(target + ': ' + pointTable[target] + ' points'); }
var math = require('mathjs'); var pointTable = {}; var renderPoints = function renderPoints(points) { if (typeof points !== 'number' || points !== points) { return 'wat'; } if (points === Infinity) { return 'way too many points'; } return points.toString + ' points'; }; var points = function points(match, response) { var matchExpr = match[1], points = Math.round(math.eval(matchExpr)), multiplier = ('to' === match[3]) - ('from' === match[3]), target = match[4]; pointTable[target] = (pointTable[target] || 0) + (points * multiplier); response.end(target + ': ' + renderPoints(pointTable[target])); }; module.exports = points;
Make point parsing and rendering less crappy
Make point parsing and rendering less crappy
JavaScript
mit
elvinyung/strapbots
--- +++ @@ -1,12 +1,28 @@ + +var math = require('mathjs'); var pointTable = {}; -module.exports = function(match, response) { - var points = Number(match[1]), - multiplier = ('to' === match[2]) - ('from' === match[2]), - target = match[3]; +var renderPoints = function renderPoints(points) { + if (typeof points !== 'number' || points !== points) { + return 'wat'; + } + if (points === Infinity) { + return 'way too many points'; + } + + return points.toString + ' points'; +}; + +var points = function points(match, response) { + var matchExpr = match[1], + points = Math.round(math.eval(matchExpr)), + multiplier = ('to' === match[3]) - ('from' === match[3]), + target = match[4]; pointTable[target] = (pointTable[target] || 0) + (points * multiplier); - response.end(target + ': ' + pointTable[target] + ' points'); -} + response.end(target + ': ' + renderPoints(pointTable[target])); +}; + +module.exports = points;
7f6546b97f62020c2f5b7aeedd7e1f06f823137c
forwarder.js
forwarder.js
var follow = require('follow'); var request = require('request'); module.exports = function(db_url, handler_url) { function isSuccessCode(code) { return code >= 200 && code < 300; } function forwardHook(doc) { request({ url: handler_url, method: doc.req.method, body: doc.req.body, headers: { 'Content-type': doc.req.headers["Content-Type"] } }, function (error, response, body) { if (error) { console.log("Error forwarding hook: " + error); } else if (!isSuccessCode(response.statusCode)) { console.log("Error forwarding hook: server returned " + response.statusCode); } else { console.log("Forwarded webhook id: " + doc._id); } }); } follow({db: db_url, include_docs:true, since: 'now'}, function(error, change) { if (error) { console.log("Error following changes: " + error); } else { var doc = change.doc; if (doc.type === 'webhook') { forwardHook(doc); } } }); console.log("Hookforward is listening for changes..."); }
var follow = require('follow'); var request = require('request'); module.exports = function(db_url, handler_url) { function isSuccessCode(code) { return code >= 200 && code < 300; } function forwardHook(doc) { var url = doc.req.query.handler_url || handler_url; if (!url) { console.log("No handler_url defined for webhook id: " + doc._id); return; } request({ url: url, method: doc.req.method, body: doc.req.body, headers: { 'Content-type': doc.req.headers["Content-Type"] } }, function (error, response, body) { if (error) { console.log("Error forwarding hook: " + error); } else if (!isSuccessCode(response.statusCode)) { console.log("Error forwarding hook: server returned " + response.statusCode); } else { console.log("Forwarded webhook id: " + doc._id); } }); } follow({db: db_url, include_docs:true, since: 'now'}, function(error, change) { if (error) { console.log("Error following changes: " + error); } else { var doc = change.doc; if (doc.type === 'webhook') { forwardHook(doc); } } }); console.log("Hookforward is listening for changes..."); }
Enable passing in handler_url via capture url querystring variable
Enable passing in handler_url via capture url querystring variable Allows use with providers that require you pass in notify url with each request
JavaScript
mit
gbuesing/hookforward
--- +++ @@ -9,8 +9,15 @@ } function forwardHook(doc) { + var url = doc.req.query.handler_url || handler_url; + + if (!url) { + console.log("No handler_url defined for webhook id: " + doc._id); + return; + } + request({ - url: handler_url, + url: url, method: doc.req.method, body: doc.req.body, headers: {
ce3ea9318e1236e44c3da1aac95a8370debe7af7
framework.js
framework.js
'use strict'; // TODO: use traditional way or ? let Framework = { inject: function (coreName) { console.log(`framework inject ${coreName}`); // checkCore(); this.coreName = coreName; return this; }, start: function () { console.log(`server start with ${this.coreName}`); }, // internal coreName: '', checkCore: (coreName) => { } }; module.exports = Framework;
'use strict'; const net = require('net'); const socket = net.Socket; // TODO: use traditional way or ? let Framework = { inject: function (coreName) { this.core = getCore(coreName); console.log(`framework inject ${coreName}`); return this; }, start: function () { const server = net.createServer(onConnect); server.listen(this.core.system.port, () => { console.log(`server start with ${this.core.name}`); }); }, // internal core: {} }; function onConnect() { } function getCore(coreName) { return { name: coreName, system: { port: 9922 } }; } module.exports = Framework;
Add draft for core structure.
Add draft for core structure.
JavaScript
mit
Kevin-Xi/dududu
--- +++ @@ -1,20 +1,37 @@ 'use strict'; +const net = require('net'); +const socket = net.Socket; + // TODO: use traditional way or ? let Framework = { inject: function (coreName) { + this.core = getCore(coreName); console.log(`framework inject ${coreName}`); - // checkCore(); - this.coreName = coreName; return this; }, - start: function () { console.log(`server start with ${this.coreName}`); }, + start: function () { + const server = net.createServer(onConnect); + server.listen(this.core.system.port, () => { + console.log(`server start with ${this.core.name}`); + }); + }, // internal - coreName: '', - checkCore: (coreName) => { - - } + core: {} }; +function onConnect() { + +} + +function getCore(coreName) { + return { + name: coreName, + system: { + port: 9922 + } + }; +} + module.exports = Framework;
ee5ca8c1679e482746ee89c7df85073319fec595
lib/client.js
lib/client.js
'use strict'; /* lib/client.js * The Client object. * * */ module.exports = Client; function Client(socket){ if (typeof socket !== 'object') throw new Error('Clients can only bind to Sockets'); this._socket = socket; this.state = 'start'; } Client.prototype = require('events').EventEmitter; Client.prototype.send = function(data){ if (typeof data === 'object') data = JSON.stringify(data); this._socket.write(data); };
'use strict'; const EventEmitter = require('events'); /* lib/client.js * The Client object. * * */ module.exports = Client; function Client(socket){ if (typeof socket !== 'object') throw new Error('Clients can only bind to Sockets'); this._socket = socket; this.state = 'start'; } Client.prototype = new EventEmitter(); Client.prototype.send = function(data){ if (typeof data === 'object') data = JSON.stringify(data); this._socket.write(data); };
Fix events on Client objects
Fix events on Client objects
JavaScript
mit
jamen/rela
--- +++ @@ -1,4 +1,6 @@ 'use strict'; + +const EventEmitter = require('events'); /* lib/client.js * The Client object. @@ -14,7 +16,7 @@ this.state = 'start'; } -Client.prototype = require('events').EventEmitter; +Client.prototype = new EventEmitter(); Client.prototype.send = function(data){ if (typeof data === 'object') data = JSON.stringify(data);
892a68d4185882a21ad92084ba45c114a2462440
lib/config.js
lib/config.js
module.exports = { WS_URL : 'http://www.workshape.io/' };
module.exports = { WS_URL : process.env.WS_URL || 'http://www.workshape.io/' };
Read WS_URL from environment variables
Read WS_URL from environment variables
JavaScript
mit
Workshape/ws-radial-plot-prerender-server
--- +++ @@ -1,3 +1,3 @@ module.exports = { - WS_URL : 'http://www.workshape.io/' + WS_URL : process.env.WS_URL || 'http://www.workshape.io/' };
e8627295b3a31e7559d9ee3d0200d9ac2d975e05
priv/ui/app/js/feature_model.js
priv/ui/app/js/feature_model.js
var FeatureModel = function(attrs){ this.id = (attrs && attrs.id) || null; this.title = (attrs && attrs.title) || null; this.description = (attrs && attrs.description) || null; this.master_switch_state = (attrs && attrs.master_switch_state) || null; this.definition = (attrs && attrs.definition) || null; }; FeatureModel.prototype.toggle = function(toggleState) { if (toggleState) { this.master_switch_state = this.definition === null ? "on" : "dynamic"; } else { this.master_switch_state = "off"; } } FeatureModel.prototype.isNew = function() { return this.id === null; } module.exports = FeatureModel;
var FeatureModel = function(attrs){ this.id = (attrs && attrs.id) || null; this.title = (attrs && attrs.title) || null; this.description = (attrs && attrs.description) || null; this.master_state = (attrs && attrs.master_state) || null; this.dynamic_state = (attrs && attrs.dynamic_state) || null; this.definition = (attrs && attrs.definition) || null; }; FeatureModel.prototype.toggle = function(toggleState) { if (toggleState) { this.master_state = true; } else { this.master_state = false; } } FeatureModel.prototype.isNew = function() { return this.id === null; } module.exports = FeatureModel;
Update the feature model with master_state and dynamic_state props
Update the feature model with master_state and dynamic_state props
JavaScript
mit
envato/iodized,envato/iodized
--- +++ @@ -1,16 +1,17 @@ var FeatureModel = function(attrs){ - this.id = (attrs && attrs.id) || null; - this.title = (attrs && attrs.title) || null; - this.description = (attrs && attrs.description) || null; - this.master_switch_state = (attrs && attrs.master_switch_state) || null; - this.definition = (attrs && attrs.definition) || null; + this.id = (attrs && attrs.id) || null; + this.title = (attrs && attrs.title) || null; + this.description = (attrs && attrs.description) || null; + this.master_state = (attrs && attrs.master_state) || null; + this.dynamic_state = (attrs && attrs.dynamic_state) || null; + this.definition = (attrs && attrs.definition) || null; }; FeatureModel.prototype.toggle = function(toggleState) { if (toggleState) { - this.master_switch_state = this.definition === null ? "on" : "dynamic"; + this.master_state = true; } else { - this.master_switch_state = "off"; + this.master_state = false; } }
d48b2c7b53e67f271118dfb33f44ed44137b52e1
models/user.js
models/user.js
const bcrypt = require('bcrypt') module.exports = function (sequelize, DataTypes) { const User = sequelize.define('User', { id: { primaryKey: true, type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4 }, name: { unique: true, type: DataTypes.STRING, allowNull: false, validate: { notEmpty: true } }, email: { type: DataTypes.STRING, allowNull: false, validate: { isEmail: true }, roles: false }, hashedPassword: { type: DataTypes.STRING, allowNull: false, validate: { notEmpty: true }, roles: false } }, { classMethods: { associate (models) { User.hasMany(models.Bikeshed) User.hasMany(models.Vote) }, hashPassword (password) { return new Promise((resolve, reject) => { bcrypt.hash(password, 8, (err, hash) => { err ? reject(err) : resolve(hash) }) }) }, comparePassword (password, hash) { return new Promise((resolve, reject) => { bcrypt.compare(password, hash, (err, res) => { err ? reject(err) : resolve(res) }) }) } } }) return User }
const bcrypt = require('bcrypt') module.exports = function (sequelize, DataTypes) { const User = sequelize.define('User', { id: { primaryKey: true, type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4 }, name: { type: DataTypes.STRING, allowNull: false, validate: { max: 255, notEmpty: true } }, email: { unique: true, type: DataTypes.STRING, allowNull: false, validate: { isEmail: true }, roles: false }, hashedPassword: { type: DataTypes.STRING, allowNull: false, validate: { notEmpty: true }, roles: false } }, { classMethods: { associate (models) { User.hasMany(models.Bikeshed) User.hasMany(models.Vote) }, hashPassword (password) { return new Promise((resolve, reject) => { bcrypt.hash(password, 8, (err, hash) => { err ? reject(err) : resolve(hash) }) }) }, comparePassword (password, hash) { return new Promise((resolve, reject) => { bcrypt.compare(password, hash, (err, res) => { err ? reject(err) : resolve(res) }) }) } } }) return User }
Remove name unique constraint, move to email
Remove name unique constraint, move to email
JavaScript
apache-2.0
cesarandreu/bshed,cesarandreu/bshed
--- +++ @@ -8,14 +8,15 @@ defaultValue: DataTypes.UUIDV4 }, name: { - unique: true, type: DataTypes.STRING, allowNull: false, validate: { + max: 255, notEmpty: true } }, email: { + unique: true, type: DataTypes.STRING, allowNull: false, validate: {
484232c79b3dd498a72d54ac2786dd57b2740972
share/spice/xkcd/display/xkcd_display.js
share/spice/xkcd/display/xkcd_display.js
function ddg_spice_xkcd_display(api_result) { if (!api_result.img || !api_result.alt) return; //calls our endpoint to get the number of the latest comic $.getJSON('/js/spice/xkcd/latest/', function(data){ //if we are looking at the latest comic, don't display the 'next' link api_result.has_next = parseInt(data.num) > parseInt(api_result.num); Spice.render({ data : api_result, header1 : api_result.safe_title + " (xkcd)", source_url : 'http://xkcd.com/' + api_result.num, source_name : 'xkcd', template_normal : 'xkcd', force_big_header : true, force_no_fold : true, }); }); } //gets the number for the previous comic Handlebars.registerHelper("previousNum", function(num, options) { if(num > 1) { return options.fn({num: num - 1}); } }); //gets the number for the next comic Handlebars.registerHelper("nextNum", function(num, options) { return options.fn({num: num + 1}); });
function ddg_spice_xkcd_display(api_result) { if (!api_result.img || !api_result.alt) return; //calls our endpoint to get the number of the latest comic $.getJSON('/js/spice/xkcd/latest/', function(data){ //if we are looking at the latest comic, don't display the 'next' link api_result.has_next = parseInt(data.num) > parseInt(api_result.num); Spice.render({ data : api_result, header1 : api_result.safe_title + " (xkcd)", source_url : 'http://xkcd.com/' + api_result.num, source_name : 'xkcd', template_normal : 'xkcd_display', force_big_header : true, force_no_fold : true }); }); } //gets the number for the previous comic Handlebars.registerHelper("previousNum", function(num, options) { if(num > 1) { return options.fn({num: num - 1}); } }); //gets the number for the next comic Handlebars.registerHelper("nextNum", function(num, options) { return options.fn({num: num + 1}); });
Change name of the template.
xkcd: Change name of the template.
JavaScript
apache-2.0
iambibhas/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,deserted/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,lerna/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,ppant/zeroclickinfo-spice,levaly/zeroclickinfo-spice,levaly/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,P71/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,lerna/zeroclickinfo-spice,lernae/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,lernae/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,lernae/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lerna/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,sevki/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,imwally/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,loganom/zeroclickinfo-spice,lerna/zeroclickinfo-spice,echosa/zeroclickinfo-spice,sevki/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,stennie/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,lerna/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,loganom/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,deserted/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,echosa/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,ppant/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,lernae/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,lernae/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,sevki/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,stennie/zeroclickinfo-spice,loganom/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,sevki/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,levaly/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,P71/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,loganom/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,levaly/zeroclickinfo-spice,soleo/zeroclickinfo-spice,deserted/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,imwally/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,imwally/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,soleo/zeroclickinfo-spice,soleo/zeroclickinfo-spice,ppant/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,echosa/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,deserted/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,imwally/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,ppant/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,mayo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,lernae/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,levaly/zeroclickinfo-spice,soleo/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,echosa/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,soleo/zeroclickinfo-spice,mayo/zeroclickinfo-spice,imwally/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,levaly/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,deserted/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,P71/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,deserted/zeroclickinfo-spice,stennie/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,P71/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,stennie/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,soleo/zeroclickinfo-spice,echosa/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice
--- +++ @@ -12,9 +12,9 @@ header1 : api_result.safe_title + " (xkcd)", source_url : 'http://xkcd.com/' + api_result.num, source_name : 'xkcd', - template_normal : 'xkcd', + template_normal : 'xkcd_display', force_big_header : true, - force_no_fold : true, + force_no_fold : true }); }); }
cc662f1bfdd92dff3c36c492bc4fee64ca2668f6
src/hooks/create-user.js
src/hooks/create-user.js
// Use this hook to manipulate incoming or outgoing data. // For more information on hooks see: http://docs.feathersjs.com/api/hooks.html module.exports = function (options = {}) { // eslint-disable-line no-unused-vars return function (hook) { const { facebook, facebookId } = hook.data; return this.find({ facebookId }).then(user => { if (user.data.length < 1) { const { profile } = facebook; const { name, gender, emails } = profile; const email = emails && emails.length && emails[0].value || undefined; hook.data = Object.assign( {}, { firstName: name && name.givenName || undefined, lastName: name && name.familyName || undefined, facebookId, email, gender, } ); } return hook; }); }; };
// Use this hook to manipulate incoming or outgoing data. // For more information on hooks see: http://docs.feathersjs.com/api/hooks.html module.exports = function (options = {}) { // eslint-disable-line no-unused-vars return function (hook) { const { facebook, facebookId } = hook.data; return this.find({ query: { facebookId } }).then(user => { if (user.data.length < 1) { const { profile } = facebook; const { name, gender, emails } = profile; const email = emails && emails.length && emails[0].value || undefined; hook.data = Object.assign( {}, { firstName: name && name.givenName || undefined, lastName: name && name.familyName || undefined, facebookId, email, gender, } ); } return hook; }); }; };
Fix the params object in the find
Fix the params object in the find
JavaScript
mit
sscaff1/ccs-feathers,sscaff1/ccs-feathers
--- +++ @@ -5,7 +5,7 @@ // eslint-disable-line no-unused-vars return function (hook) { const { facebook, facebookId } = hook.data; - return this.find({ facebookId }).then(user => { + return this.find({ query: { facebookId } }).then(user => { if (user.data.length < 1) { const { profile } = facebook; const { name, gender, emails } = profile;
22a15baa9bac645b1ffb58fa87233143627cf671
ng-template.js
ng-template.js
/*global System:false, exports:false */ var serverRelativeRegexp = /^\w+:\/\/[^\/]*/; function santiseSource( source ) { return source.replace( /(['\\])/g, '\\$1' ) .replace( /[\f]/g, '\\f' ) .replace( /[\b]/g, '\\b' ) .replace( /[\n]/g, '\\n' ) .replace( /[\t]/g, '\\t' ) .replace( /[\r]/g, '\\r' ) .replace( /[\u2028]/g, '\\u2028' ) .replace( /[\u2029]/g, '\\u2029' ); } function resolveUrl( address, baseUrl, useServerRelative ) { if ( useServerRelative ) { return address.replace( serverRelativeRegexp, '' ); } else if ( baseUrl && address.indexOf( baseUrl ) === 0 ) { return address.substr( baseUrl.length ); } return address; } exports.translate = function( load ) { var baseUrl = typeof System.baseURL === 'string' ? System.baseURL : '', options = System.ngTemplatePlugin || {}, url = resolveUrl( load.address, baseUrl, !!options.serverRelative ); return "require('angular').module('ng')" + ".run(['$templateCache', function(c) { c.put('" + url + "', '" + santiseSource( load.source ) + "') }]);" + "module.exports = { templateUrl: '" + url + "' };"; };
/*global System:false, exports:false */ function santiseSource( source ) { return source.replace( /(['\\])/g, '\\$1' ) .replace( /[\f]/g, '\\f' ) .replace( /[\b]/g, '\\b' ) .replace( /[\n]/g, '\\n' ) .replace( /[\t]/g, '\\t' ) .replace( /[\r]/g, '\\r' ) .replace( /[\u2028]/g, '\\u2028' ) .replace( /[\u2029]/g, '\\u2029' ); } function resolveUrl( address, baseUrl ) { if ( baseUrl && address.indexOf( baseUrl ) === 0 ) { return address.substr( baseUrl.length ); } return address; } exports.translate = function translate( load ) { var baseUrl = typeof System.baseURL === 'string' ? System.baseURL : '', options = System.ngTemplatePlugin || {}, url = resolveUrl( load.address, baseUrl ); return 'var url = ' + ( options.serverRelative ? "System.baseURL.replace(/^\\w+:\\/\\/[^\\/]*/,'')+" : '' ) + "'" + url + "';" + "require('angular').module('ng')" + ".run(['$templateCache', function(c) { c.put(" + "url, '" + santiseSource( load.source ) + "'); }]);" + 'module.exports = { templateUrl: url };'; };
Fix issues with resolving server relative URLs when bundling with JSPM
Fix issues with resolving server relative URLs when bundling with JSPM
JavaScript
mit
jamespamplin/plugin-ng-template
--- +++ @@ -1,6 +1,4 @@ /*global System:false, exports:false */ - -var serverRelativeRegexp = /^\w+:\/\/[^\/]*/; function santiseSource( source ) { return source.replace( /(['\\])/g, '\\$1' ) @@ -13,22 +11,24 @@ .replace( /[\u2029]/g, '\\u2029' ); } -function resolveUrl( address, baseUrl, useServerRelative ) { - if ( useServerRelative ) { - return address.replace( serverRelativeRegexp, '' ); - - } else if ( baseUrl && address.indexOf( baseUrl ) === 0 ) { +function resolveUrl( address, baseUrl ) { + if ( baseUrl && address.indexOf( baseUrl ) === 0 ) { return address.substr( baseUrl.length ); } return address; } -exports.translate = function( load ) { +exports.translate = function translate( load ) { var baseUrl = typeof System.baseURL === 'string' ? System.baseURL : '', options = System.ngTemplatePlugin || {}, - url = resolveUrl( load.address, baseUrl, !!options.serverRelative ); + url = resolveUrl( load.address, baseUrl ); - return "require('angular').module('ng')" + - ".run(['$templateCache', function(c) { c.put('" + url + "', '" + santiseSource( load.source ) + "') }]);" + - "module.exports = { templateUrl: '" + url + "' };"; + return 'var url = ' + + ( options.serverRelative ? "System.baseURL.replace(/^\\w+:\\/\\/[^\\/]*/,'')+" : '' ) + + "'" + url + "';" + + "require('angular').module('ng')" + + ".run(['$templateCache', function(c) { c.put(" + + "url, '" + + santiseSource( load.source ) + "'); }]);" + + 'module.exports = { templateUrl: url };'; };
9235fec23dd1089ee8c4a78d49f68f1b532fed94
etc/bg.js
etc/bg.js
console.log("Courses+ background page!"); cpal.request.addBeforeSendHeaders(["*://courses2015.dalton.org/*"], function(details) { if (details.url.indexOf("user/icon/dalton/") > -1) { details.requestHeaders.push({name: 'X-CoursesPlus-RefererSpoof-Yay', value: "https://courses2015.dalton.org/user/profile.php"}); } for (var i = 0; i < details.requestHeaders.length; ++i) { if (details.requestHeaders[i].name === 'X-CoursesPlus-RefererSpoof-Yay') { var newVal = details.requestHeaders[i].value; //details.requestHeaders.splice(i, 1); for (var j = 0; j < details.requestHeaders.length; ++j) { if (details.requestHeaders[i].name === 'Referer') { break; } } if (details.requestHeaders[j] !== 'Referer') { details.requestHeaders.push({name: 'Referer', value: newVal}); } else { details.requestHeaders[j].value = newVal; } break; } } return {requestHeaders: details.requestHeaders}; });
console.log("Courses+ background page!"); cpal.request.addBeforeSendHeaders(["*://courses2015.dalton.org/*"], function(details) { if (details.url.indexOf("user/icon/dalton/") > -1) { details.requestHeaders.push({name: 'X-CoursesPlus-RefererSpoof-Yay', value: "https://courses2015.dalton.org/user/profile.php"}); } if (details.url.indexOf("theme/image.php/dalton/core") > -1 && details.url.indexOf("/u/f1") > -1) { details.requestHeaders.push({name: 'X-CoursesPlus-RefererSpoof-Yay', value: "https://courses2015.dalton.org/user/profile.php"}); } for (var i = 0; i < details.requestHeaders.length; ++i) { if (details.requestHeaders[i].name === 'X-CoursesPlus-RefererSpoof-Yay') { var newVal = details.requestHeaders[i].value; //details.requestHeaders.splice(i, 1); for (var j = 0; j < details.requestHeaders.length; ++j) { if (details.requestHeaders[i].name === 'Referer') { break; } } if (details.requestHeaders[j] !== 'Referer') { details.requestHeaders.push({name: 'Referer', value: newVal}); } else { details.requestHeaders[j].value = newVal; } break; } } return {requestHeaders: details.requestHeaders}; });
Fix coursesnew with no avatar
Fix coursesnew with no avatar
JavaScript
mit
CoursesPlus/CoursesPlus,CoursesPlus/CoursesPlus
--- +++ @@ -1,6 +1,9 @@ console.log("Courses+ background page!"); cpal.request.addBeforeSendHeaders(["*://courses2015.dalton.org/*"], function(details) { if (details.url.indexOf("user/icon/dalton/") > -1) { + details.requestHeaders.push({name: 'X-CoursesPlus-RefererSpoof-Yay', value: "https://courses2015.dalton.org/user/profile.php"}); + } + if (details.url.indexOf("theme/image.php/dalton/core") > -1 && details.url.indexOf("/u/f1") > -1) { details.requestHeaders.push({name: 'X-CoursesPlus-RefererSpoof-Yay', value: "https://courses2015.dalton.org/user/profile.php"}); } for (var i = 0; i < details.requestHeaders.length; ++i) {
25883839e7b996d47784c32912c0a9f20abe3cca
development/server/server.spec.js
development/server/server.spec.js
var assert = require('assert'); var request = require('supertest'); var exec = require('child_process').exec; var application = require(__dirname + '/server.js'); describe('server', function () { before(function () { application.listen(); }); after(function () { application.close(); }); describe('Array', function () { describe('#indexOf()', function () { it('should return -1 when the value is not present', function () { assert.equal(-1, [1, 2, 3].indexOf(5)); assert.equal(-1, [1, 2, 3].indexOf(0)); }); }); describe('#indexOf()', function () { it('should return -1 when the value is not present', function () { assert.equal(-1, [1, 2, 3].indexOf(5)); }); }); describe('GET /', function() { it('respond with json', function(done) { request(application.app) .get('/') .set('Accept', 'application/json') .expect('Content-Type', /html/) .expect(200, done); }); }); describe('Run Abao', function() { it('respond with json', function(done) { this.timeout(15000); exec('abao ./raml/api.raml --server http://localhost:3000/api', function (err) { done(); }); }); }); }); });
var assert = require('assert'); var request = require('supertest'); var exec = require('child_process').exec; var application = require(__dirname + '/server.js'); describe('server', function () { before(function () { application.listen(); }); after(function () { application.close(); }); describe('Array', function () { describe('#indexOf()', function () { it('should return -1 when the value is not present', function () { assert.equal(-1, [1, 2, 3].indexOf(5)); assert.equal(-1, [1, 2, 3].indexOf(0)); }); }); describe('#indexOf()', function () { it('should return -1 when the value is not present', function () { assert.equal(-1, [1, 2, 3].indexOf(5)); }); }); describe('GET /', function() { it('respond with json', function(done) { request(application.app) .get('/') .set('Accept', 'application/json') .expect('Content-Type', /html/) .expect(200, done); }); }); describe('Run Abao', function() { it('respond with json', function(done) { this.timeout(15000); exec('node node_modules/.bin/abao ./raml/api.raml --server http://localhost:3000/api', function (err, stdout) { console.log(stdout); done(); }); }); }); }); });
Change abao test to use the local installation instead of the global.
Change abao test to use the local installation instead of the global.
JavaScript
mit
kanbanana/knowledgebase,kanbanana/knowledgebase,kanbanana/knowledgebase
--- +++ @@ -40,7 +40,8 @@ describe('Run Abao', function() { it('respond with json', function(done) { this.timeout(15000); - exec('abao ./raml/api.raml --server http://localhost:3000/api', function (err) { + exec('node node_modules/.bin/abao ./raml/api.raml --server http://localhost:3000/api', function (err, stdout) { + console.log(stdout); done(); }); });
b250e5508d49ec212ce1fafa3c5fbdbefb31cf3b
src/containers/Pubs/Pubs.js
src/containers/Pubs/Pubs.js
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as pubsActions from 'redux/modules/pubs'; @connect( state => ({ availablePubs: state.pubs.availablePubs, selectedPub: state.pubs.selectedPub }), pubsActions ) export default class Pubs extends Component { static propTypes = { availablePubs: PropTypes.array, selectedPub: PropTypes.object, getPubs: PropTypes.func } render() { return ( <div> Pubs Component {this.props.availablePubs.map((pub) => { return <p key={pub._id}>{pub.name}</p>; })} <button className="btn" onClick={::this.props.getPubs}>Dawaj</button> </div> ); } }
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as pubsActions from 'redux/modules/pubs'; @connect( state => ({ availablePubs: state.pubs.availablePubs, selectedPub: state.pubs.selectedPub }), pubsActions ) export default class Pubs extends Component { static propTypes = { availablePubs: PropTypes.array, selectedPub: PropTypes.object, getPubs: PropTypes.func } componentDidMount() { if (this.props.availablePubs.length === 0) this.props.getPubs(); } render() { return ( <div> Pubs Component {this.props.availablePubs.map((pub) => { return <p key={pub._id}>{pub.name}</p>; })} <button className="btn" onClick={::this.props.getPubs}>Dawaj</button> </div> ); } }
Add initial available pubs load function if the route is accessed without transition
Add initial available pubs load function if the route is accessed without transition
JavaScript
mit
fuczak/pipsy
--- +++ @@ -16,6 +16,10 @@ getPubs: PropTypes.func } + componentDidMount() { + if (this.props.availablePubs.length === 0) this.props.getPubs(); + } + render() { return ( <div>
c0e0c0420c51732d0d8ab574af014d0c09c10192
test/result-trap.js
test/result-trap.js
var tap = require("../") tap.test("trap result", function (t0) { t0.plan(3) var t1 = new(tap.Harness)(tap.Test).test() console.log('here') t1.plan(1) t1.on("result", function (res) { if (res.wanted === 4) { t0.equal(res.found, 3) t0.equal(res.wanted, 4) t0.end() t1.end() } }) t1.equal(1 + 2, 4) })
var tap = require("../") tap.test("trap result #TODO", function (t0) { console.log("not ok 1 result event trapping #TODO") return t0.end() t0.plan(3) var t1 = new(tap.Harness)(tap.Test).test() t1.plan(1) t1.on("result", function (res) { if (res.wanted === 4) { t0.equal(res.found, 3) t0.equal(res.wanted, 4) t0.end() t1.end() } }) t1.equal(1 + 2, 4) })
Mark this test as todo
Mark this test as todo
JavaScript
mit
chbrown/node-tap,strongloop-forks/node-tap,strongloop-forks/node-tap,jkrems/node-tap,evanlucas/node-tap,Dignifiedquire/node-tap-core,othiym23/node-tap,isaacs/node-tap,jkrems/node-tap,dominictarr/node-tap,myndzi/node-tap,othiym23/node-tap,chbrown/node-tap,jinivo/marhert,myndzi/node-tap,Raynos/node-tap,iarna/node-tap,tapjs/node-tap,jondlm/node-tap,iarna/node-tap,evanlucas/node-tap,isaacs/node-tap,Dignifiedquire/node-tap-core,tapjs/node-tap,jondlm/node-tap,substack/node-tap
--- +++ @@ -1,22 +1,25 @@ var tap = require("../") -tap.test("trap result", function (t0) { +tap.test("trap result #TODO", function (t0) { + + console.log("not ok 1 result event trapping #TODO") + return t0.end() + t0.plan(3) - + var t1 = new(tap.Harness)(tap.Test).test() - -console.log('here') + t1.plan(1) - + t1.on("result", function (res) { if (res.wanted === 4) { t0.equal(res.found, 3) t0.equal(res.wanted, 4) - + t0.end() t1.end() } }) - + t1.equal(1 + 2, 4) })
3ced3e98bc7dd9f692728da5244b2dead8203da6
examples/image-gallery/templates/image-page.js
examples/image-gallery/templates/image-page.js
import React from 'react' import { rhythm } from 'utils/typography' const ImagePage = (props) => { console.log(props) const {regular, retina} = props.data.image return ( <div> <p>{props.data.image.FileName}</p> <img src={regular.src} srcSet={`${retina.src} 2x`} style={{ display: 'inline', marginRight: rhythm(1/2), marginBottom: rhythm(1/2), verticalAlign: 'middle', }} /> </div> ) } export default ImagePage export const pageQuery = ` query ImagePage($path: String!) { image(path: $path) { FileName regular: image(width: 1000) { src } retina: image(width: 2000) { src } } } `
import React from 'react' import { rhythm } from 'utils/typography' class ImagePage extends React.Component { constructor () { super() this.state = { loaded: false, } } render () { console.log(this.props) const {regular, retina, micro} = this.props.data.image return ( <div> <p>{this.props.data.image.FileName}</p> <img src={`data:image/jpeg;base64,${micro.src}`} style={{ width: regular.width, height: regular.height, position: 'absolute', transition: 'opacity 0.5s', opacity: this.state.loaded ? 0 : 1, }} /> <img src={regular.src} onLoad={() => this.setState({ loaded: true })} srcSet={`${retina.src} 2x`} /> </div> ) } } export default ImagePage export const pageQuery = ` query ImagePage($path: String!) { image(path: $path) { FileName micro: image(width: 20, base64: true) { src } regular: image(width: 1000) { src width height } retina: image(width: 2000) { src } } } `
Add progressive image loading example
Add progressive image loading example
JavaScript
mit
0x80/gatsby,Khaledgarbaya/gatsby,danielfarrell/gatsby,fk/gatsby,0x80/gatsby,danielfarrell/gatsby,gatsbyjs/gatsby,mingaldrichgan/gatsby,chiedo/gatsby,0x80/gatsby,fk/gatsby,gatsbyjs/gatsby,okcoker/gatsby,mingaldrichgan/gatsby,fk/gatsby,ChristopherBiscardi/gatsby,mickeyreiss/gatsby,chiedo/gatsby,gatsbyjs/gatsby,danielfarrell/gatsby,fabrictech/gatsby,gatsbyjs/gatsby,mingaldrichgan/gatsby,fabrictech/gatsby,Khaledgarbaya/gatsby,mickeyreiss/gatsby,ChristopherBiscardi/gatsby,chiedo/gatsby,mickeyreiss/gatsby,ChristopherBiscardi/gatsby,Khaledgarbaya/gatsby,ChristopherBiscardi/gatsby,okcoker/gatsby,okcoker/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,fabrictech/gatsby
--- +++ @@ -1,24 +1,38 @@ import React from 'react' import { rhythm } from 'utils/typography' -const ImagePage = (props) => { - console.log(props) - const {regular, retina} = props.data.image - return ( - <div> - <p>{props.data.image.FileName}</p> - <img - src={regular.src} - srcSet={`${retina.src} 2x`} - style={{ - display: 'inline', - marginRight: rhythm(1/2), - marginBottom: rhythm(1/2), - verticalAlign: 'middle', - }} - /> - </div> - ) +class ImagePage extends React.Component { + constructor () { + super() + this.state = { + loaded: false, + } + } + + render () { + console.log(this.props) + const {regular, retina, micro} = this.props.data.image + return ( + <div> + <p>{this.props.data.image.FileName}</p> + <img + src={`data:image/jpeg;base64,${micro.src}`} + style={{ + width: regular.width, + height: regular.height, + position: 'absolute', + transition: 'opacity 0.5s', + opacity: this.state.loaded ? 0 : 1, + }} + /> + <img + src={regular.src} + onLoad={() => this.setState({ loaded: true })} + srcSet={`${retina.src} 2x`} + /> + </div> + ) + } } export default ImagePage @@ -27,8 +41,13 @@ query ImagePage($path: String!) { image(path: $path) { FileName + micro: image(width: 20, base64: true) { + src + } regular: image(width: 1000) { src + width + height } retina: image(width: 2000) { src
4142327d11e8efc2d7de074659a065565245abe1
flava/server.js
flava/server.js
/** * Created by Wayne on 16/2/22. */ var config = require('./config/config'); var setup = require('./config/setup')(); var express = require('./config/express'); new express().listen(config.port); console.log('process.env.NODE_ENV', process.env.NODE_ENV); exports.index = function () { } exports.index1 = function () { } exports.index3 = function () { } exports.index4 = function () { var j = 0; } exports.index5 = function () { var j = 5; } exports.index6 = function () { var j = 6; }
/** * Created by Wayne on 16/2/22. */ var config = require('./config/config'); var setup = require('./config/setup')(); var express = require('./config/express'); new express().listen(config.port); console.log('process.env.NODE_ENV', process.env.NODE_ENV); exports.index = function () { } exports.index1 = function () { } exports.index3 = function () { } exports.index4 = function () { var j = 0; } exports.index5 = function () { var j = 55; } exports.index6 = function () { var j = 66; }
Fix bug about index 6
Fix bug about index 6
JavaScript
mit
zwmei/NXQS,zwmei/NXQS
--- +++ @@ -26,8 +26,8 @@ } exports.index5 = function () { - var j = 5; + var j = 55; } exports.index6 = function () { - var j = 6; + var j = 66; }
274c3c63cc0f8376c8d20cf8844768933ad0c11f
client/src/containers/Dashboard.js
client/src/containers/Dashboard.js
import React, { Component } from 'react'; import {observer} from 'mobx-react'; import Services from '../components/Services'; import Tasks from '../components/Tasks'; import FlatButton from 'material-ui/FlatButton'; import { Link } from 'react-router'; const styles = { button: { margin: 0.6 + 'rem' } }; const Dashboard = observer( class Dashboard extends Component { constructor(props) { super(props); this.state = { selectedServices: [] }; } onServiceSelection(selectedServices) { this.setState({ selectedServices: selectedServices }); } render() { const {nodeStore} = this.props.route; return ( <div> <FlatButton label="Create Service" containerElement={<Link to="/services/create" />} primary={true} style={styles.button} icon={<i className="material-icons">add</i>} /> <Services services={nodeStore.services} onSelection={this.onServiceSelection.bind(this)} selectedServices={this.state.selectedServices}/> <Tasks tasks={nodeStore.tasks} selectedServices={this.state.selectedServices}/> </div> ); } } ); export default Dashboard;
import React, { Component } from 'react'; import {observer} from 'mobx-react'; import Services from '../components/Services'; import Tasks from '../components/Tasks'; import FlatButton from 'material-ui/FlatButton'; import { Link } from 'react-router'; const styles = { button: { margin: 0.6 + 'rem' } }; const Dashboard = observer( class Dashboard extends Component { constructor(props) { super(props); this.state = { selectedServices: [] }; } onServiceSelection(selectedServices) { this.setState({ selectedServices: selectedServices }); } render() { const {nodeStore} = this.props.route; /* <FlatButton label="Create Service" containerElement={<Link to="/services/create" />} primary={true} style={styles.button} icon={<i className="material-icons">add</i>} /> */ return ( <div> <Services services={nodeStore.services} onSelection={this.onServiceSelection.bind(this)} selectedServices={this.state.selectedServices}/> <Tasks tasks={nodeStore.tasks} selectedServices={this.state.selectedServices}/> </div> ); } } ); export default Dashboard;
Disable non-functional create service button
Disable non-functional create service button
JavaScript
mit
jsalonen/swarmist,jsalonen/swarmist
--- +++ @@ -28,9 +28,7 @@ render() { const {nodeStore} = this.props.route; - - return ( - <div> + /* <FlatButton label="Create Service" containerElement={<Link to="/services/create" />} @@ -38,6 +36,10 @@ style={styles.button} icon={<i className="material-icons">add</i>} /> + */ + + return ( + <div> <Services services={nodeStore.services} onSelection={this.onServiceSelection.bind(this)}
71e3042184626c37d9cff421743589b3e21a3e29
test/util/mock-client.js
test/util/mock-client.js
import request from 'request'; function call(endpoint, method, qs, json) { let options = { uri: `http://localhost/api/${endpoint}`, method }; if (typeof qs !== 'undefined') { options.qs = qs; } if (typeof json !== 'undefined') { options.json = json; } return new Promise((resolve, reject) => { request(options, (error, response, body) => { if (typeof body === 'string') { body = JSON.parse(body); } if (body.status === 'success') { resolve(body.data); } else { reject(body.message); } }); }); } export function del(endpoint, data) { return call(endpoint, 'DELETE', data); } export function get(endpoint, data) { return call(endpoint, 'GET', data); } export function post(endpoint, data) { return call(endpoint, 'POST', undefined, data); }
import request from 'request'; const PROTOCOL = 'http'; const HOST = 'localhost'; const PORT = 8080; function call(endpoint, method, qs, json) { let options = { uri: `${PROTOCOL}://${HOST}:${PORT}/api/${endpoint}`, method }; if (typeof qs !== 'undefined') { options.qs = qs; } if (typeof json !== 'undefined') { options.json = json; } return new Promise((resolve, reject) => { request(options, (error, response, body) => { if (typeof body === 'string') { body = JSON.parse(body); } if (body.status === 'success') { resolve(body.data); } else { reject(body.message); } }); }); } export function del(endpoint, data) { return call(endpoint, 'DELETE', data); } export function get(endpoint, data) { return call(endpoint, 'GET', data); } export function post(endpoint, data) { return call(endpoint, 'POST', undefined, data); }
Use port 8080 for testing
Use port 8080 for testing
JavaScript
unlicense
TheFourFifths/consus,TheFourFifths/consus
--- +++ @@ -1,8 +1,12 @@ import request from 'request'; + +const PROTOCOL = 'http'; +const HOST = 'localhost'; +const PORT = 8080; function call(endpoint, method, qs, json) { let options = { - uri: `http://localhost/api/${endpoint}`, + uri: `${PROTOCOL}://${HOST}:${PORT}/api/${endpoint}`, method }; if (typeof qs !== 'undefined') {
743c72c930d1e5b83492e778d45c3950c2ba397d
src/_reducers/AccountReducer.js
src/_reducers/AccountReducer.js
import { fromJS } from 'immutable'; import { SERVER_DATA_AUTHORIZE, SERVER_DATA_BALANCE, SERVER_DATA_PAYOUT_CURRENCIES, SERVER_DATA_BUY, UPDATE_TOKEN, } from '../_constants/ActionTypes'; const initialState = fromJS({ loginid: '', fullname: '', currency: 'USD', balance: 0, token: '', currencies: ['USD'], }); export default (state = initialState, action) => { switch (action.type) { case SERVER_DATA_AUTHORIZE: { const authorize = fromJS(action.serverResponse.authorize); return state.merge(authorize); } case SERVER_DATA_BALANCE: { return state.set('balance', action.serverResponse.balance.balance); } case SERVER_DATA_BUY: { return state.setIn(['account', 'balance'], action.serverResponse.balance_after); } case SERVER_DATA_PAYOUT_CURRENCIES: { return state.set('currencies', action.serverResponse.payout_currencies); } case UPDATE_TOKEN: { return state.set('token', action.token); } default: return state; } };
import { fromJS } from 'immutable'; import { SERVER_DATA_AUTHORIZE, SERVER_DATA_BALANCE, SERVER_DATA_PAYOUT_CURRENCIES, SERVER_DATA_BUY, UPDATE_TOKEN, } from '../_constants/ActionTypes'; const initialState = fromJS({ loginid: '', fullname: '', currency: 'USD', balance: 0, token: '', currencies: ['USD'], }); export default (state = initialState, action) => { switch (action.type) { case SERVER_DATA_AUTHORIZE: { const authorize = fromJS(action.serverResponse.authorize); if (!authorize.currency) { return state.merge(authorize).set('currency', 'USD'); } return state.merge(authorize); } case SERVER_DATA_BALANCE: { return state.set('balance', action.serverResponse.balance.balance); } case SERVER_DATA_BUY: { return state.setIn(['account', 'balance'], action.serverResponse.balance_after); } case SERVER_DATA_PAYOUT_CURRENCIES: { return state.set('currencies', action.serverResponse.payout_currencies); } case UPDATE_TOKEN: { return state.set('token', action.token); } default: return state; } };
Set default currency to USD if none
Set default currency to USD if none
JavaScript
mit
nuruddeensalihu/binary-next-gen,qingweibinary/binary-next-gen,binary-com/binary-next-gen,nazaninreihani/binary-next-gen,nuruddeensalihu/binary-next-gen,nazaninreihani/binary-next-gen,binary-com/binary-next-gen,binary-com/binary-next-gen,qingweibinary/binary-next-gen,qingweibinary/binary-next-gen,nazaninreihani/binary-next-gen,nuruddeensalihu/binary-next-gen
--- +++ @@ -20,6 +20,9 @@ switch (action.type) { case SERVER_DATA_AUTHORIZE: { const authorize = fromJS(action.serverResponse.authorize); + if (!authorize.currency) { + return state.merge(authorize).set('currency', 'USD'); + } return state.merge(authorize); } case SERVER_DATA_BALANCE: {
8b6b07a2e46763b1f42f8f99cfe07ce30517e10d
lib/router.js
lib/router.js
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allMangasCover'); } }); Router.route('/ownedMangas', { name: 'ownedMangas', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); } }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); } }); Router.route('/:mangasName/tome/:tomeNumber/:_id', { name: 'tomeDetails', waitOn: function() { return [subscriptions.subscribe('tomeDetails', this.params._id), subscriptions.subscribe('allTomes', Meteor.userId(), this.params.mangasName)]; }, data: function() { return Mangas.findOne(this.params._id); } }); Router.route('/:author', { name: 'mangaka', waitOn: function() { return subscriptions.subscribe('mangaka', Meteor.userId(), this.params.author); } });
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allMangasCover'); }, fastRender: true }); Router.route('/ownedMangas', { name: 'ownedMangas', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); } }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); } }); Router.route('/:mangasName/tome/:tomeNumber/:_id', { name: 'tomeDetails', waitOn: function() { return [subscriptions.subscribe('tomeDetails', this.params._id), subscriptions.subscribe('allTomes', Meteor.userId(), this.params.mangasName)]; }, data: function() { return Mangas.findOne(this.params._id); } }); Router.route('/:author', { name: 'mangaka', waitOn: function() { return subscriptions.subscribe('mangaka', Meteor.userId(), this.params.author); } });
Add fastRender for the home
Add fastRender for the home
JavaScript
mit
dexterneo/mangas,dexterneo/mangas,dexterneo/mangatek,dexterneo/mangatek
--- +++ @@ -10,7 +10,8 @@ name: 'home', waitOn: function() { return subscriptions.subscribe('allMangasCover'); - } + }, + fastRender: true }); Router.route('/ownedMangas', {
b761dcde4504dd02fc8fd54cc499da91efa7a56e
src/app/directives/bodyClass.js
src/app/directives/bodyClass.js
define([ 'angular', 'app', 'lodash' ], function (angular, app, _) { 'use strict'; angular .module('grafana.directives') .directive('bodyClass', function() { return { link: function($scope, elem) { var lastPulldownVal; var lastHideControlsVal; $scope.$watch('dashboard.pulldowns', function() { if (!$scope.dashboard) { return; } var panel = _.find($scope.dashboard.pulldowns, function(pulldown) { return pulldown.enable; }); var panelEnabled = panel ? panel.enable : false; if (lastPulldownVal !== panelEnabled) { elem.toggleClass('submenu-controls-visible', panelEnabled); lastPulldownVal = panelEnabled; } }, true); $scope.$watch('dashboard.hideControls', function() { if (!$scope.dashboard) { return; } var hideControls = $scope.dashboard.hideControls || $scope.playlist_active; if (lastHideControlsVal !== hideControls) { elem.toggleClass('hide-controls', hideControls); lastHideControlsVal = hideControls; } }); $scope.$watch('playlist_active', function() { elem.toggleClass('hide-controls', $scope.playlist_active === true); elem.toggleClass('playlist-active', $scope.playlist_active === true); }); } }; }); });
define([ 'angular', 'app', 'lodash' ], function (angular, app, _) { 'use strict'; angular .module('grafana.directives') .directive('bodyClass', function() { return { link: function($scope, elem) { var lastPulldownVal; var lastHideControlsVal; $scope.$watchCollection('dashboard.pulldowns', function() { if (!$scope.dashboard) { return; } var panel = _.find($scope.dashboard.pulldowns, function(pulldown) { return pulldown.enable; }); var panelEnabled = panel ? panel.enable : false; if (lastPulldownVal !== panelEnabled) { elem.toggleClass('submenu-controls-visible', panelEnabled); lastPulldownVal = panelEnabled; } }); $scope.$watch('dashboard.hideControls', function() { if (!$scope.dashboard) { return; } var hideControls = $scope.dashboard.hideControls || $scope.playlist_active; if (lastHideControlsVal !== hideControls) { elem.toggleClass('hide-controls', hideControls); lastHideControlsVal = hideControls; } }); $scope.$watch('playlist_active', function() { elem.toggleClass('hide-controls', $scope.playlist_active === true); elem.toggleClass('playlist-active', $scope.playlist_active === true); }); } }; }); });
Switch from watch to watchCollection for bodyclass directive
Switch from watch to watchCollection for bodyclass directive
JavaScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -15,7 +15,7 @@ var lastPulldownVal; var lastHideControlsVal; - $scope.$watch('dashboard.pulldowns', function() { + $scope.$watchCollection('dashboard.pulldowns', function() { if (!$scope.dashboard) { return; } @@ -26,7 +26,7 @@ elem.toggleClass('submenu-controls-visible', panelEnabled); lastPulldownVal = panelEnabled; } - }, true); + }); $scope.$watch('dashboard.hideControls', function() { if (!$scope.dashboard) {
9c3f28abade0f393e2aba5f5960756fb24832a74
lib/cucumber/support_code/world_constructor.js
lib/cucumber/support_code/world_constructor.js
var WorldConstructor = function() { return function(callback) { callback(this) }; }; module.exports = WorldConstructor;
var WorldConstructor = function() { return function World(callback) { callback() }; }; module.exports = WorldConstructor;
Simplify default World constructor callback
Simplify default World constructor callback
JavaScript
mit
AbraaoAlves/cucumber-js,Telogical/CucumberJS,marnen/cucumber-js,MinMat/cucumber-js,richardmcsong/cucumber-js,bluenergy/cucumber-js,AbraaoAlves/cucumber-js,h2non/cucumber-js,MinMat/cucumber-js,Telogical/CucumberJS,h2non/cucumber-js,vilmysj/cucumber-js,mhoyer/cucumber-js,marnen/cucumber-js,richardmcsong/cucumber-js,vilmysj/cucumber-js,i-e-b/cucumber-js,cucumber/cucumber-js,MinMat/cucumber-js,gnikhil2/cucumber-js,marnen/cucumber-js,arty-name/cucumber-js,karthiktv006/cucumber-js,mhoyer/cucumber-js,gnikhil2/cucumber-js,karthiktv006/cucumber-js,h2non/cucumber-js,richardmcsong/cucumber-js,cucumber/cucumber-js,eddieloeffen/cucumber-js,bluenergy/cucumber-js,mhoyer/cucumber-js,AbraaoAlves/cucumber-js,vilmysj/cucumber-js,arty-name/cucumber-js,bluenergy/cucumber-js,eddieloeffen/cucumber-js,SierraGolf/cucumber-js,gnikhil2/cucumber-js,arty-name/cucumber-js,eddieloeffen/cucumber-js,SierraGolf/cucumber-js,cucumber/cucumber-js,SierraGolf/cucumber-js,i-e-b/cucumber-js
--- +++ @@ -1,4 +1,4 @@ var WorldConstructor = function() { - return function(callback) { callback(this) }; + return function World(callback) { callback() }; }; module.exports = WorldConstructor;
9ad051a99797c70c2f806409d342d25aa91431a9
concrete/js/captcha/recaptchav3.js
concrete/js/captcha/recaptchav3.js
function RecaptchaV3() { $(".recaptcha-v3").each(function () { var el = $(this); var clientId = grecaptcha.render($(el).attr("id"), { 'sitekey': $(el).attr('data-sitekey'), 'badge': $(el).attr('data-badge'), 'theme': $(el).attr('data-theme'), 'size': 'invisible', }); grecaptcha.ready(function () { grecaptcha.execute(clientId, { action: 'submit' }) }); }); }
/* jshint unused:vars, undef:true, browser:true, jquery:true */ /* global grecaptcha */ ;(function(global, $) { 'use strict'; function render(element) { var $element = $(element), clientId = grecaptcha.render( $element.attr('id'), { sitekey: $element.data('sitekey'), badge: $element.data('badge'), theme: $element.data('theme'), size: 'invisible' } ); grecaptcha.ready(function () { grecaptcha.execute( clientId, { action: 'submit' } ); }); } global.RecaptchaV3 = function() { $('.recaptcha-v3').each(function () { render(this); }); }; })(window, jQuery);
Configure jshint, simplify javascript structure
Configure jshint, simplify javascript structure
JavaScript
mit
concrete5/concrete5,jaromirdalecky/concrete5,deek87/concrete5,olsgreen/concrete5,olsgreen/concrete5,jaromirdalecky/concrete5,haeflimi/concrete5,mlocati/concrete5,mlocati/concrete5,rikzuiderlicht/concrete5,mlocati/concrete5,deek87/concrete5,deek87/concrete5,MrKarlDilkington/concrete5,MrKarlDilkington/concrete5,hissy/concrete5,hissy/concrete5,olsgreen/concrete5,rikzuiderlicht/concrete5,MrKarlDilkington/concrete5,rikzuiderlicht/concrete5,concrete5/concrete5,biplobice/concrete5,mlocati/concrete5,biplobice/concrete5,mainio/concrete5,concrete5/concrete5,mainio/concrete5,jaromirdalecky/concrete5,hissy/concrete5,concrete5/concrete5,biplobice/concrete5,haeflimi/concrete5,haeflimi/concrete5,haeflimi/concrete5,mainio/concrete5,biplobice/concrete5,hissy/concrete5,jaromirdalecky/concrete5,deek87/concrete5
--- +++ @@ -1,16 +1,34 @@ -function RecaptchaV3() { - $(".recaptcha-v3").each(function () { - var el = $(this); - var clientId = grecaptcha.render($(el).attr("id"), { - 'sitekey': $(el).attr('data-sitekey'), - 'badge': $(el).attr('data-badge'), - 'theme': $(el).attr('data-theme'), - 'size': 'invisible', - }); - grecaptcha.ready(function () { - grecaptcha.execute(clientId, { +/* jshint unused:vars, undef:true, browser:true, jquery:true */ +/* global grecaptcha */ + +;(function(global, $) { +'use strict'; + +function render(element) { + var $element = $(element), + clientId = grecaptcha.render( + $element.attr('id'), + { + sitekey: $element.data('sitekey'), + badge: $element.data('badge'), + theme: $element.data('theme'), + size: 'invisible' + } + ); + grecaptcha.ready(function () { + grecaptcha.execute( + clientId, + { action: 'submit' - }) - }); + } + ); }); } + +global.RecaptchaV3 = function() { + $('.recaptcha-v3').each(function () { + render(this); + }); +}; + +})(window, jQuery);
bd84d284e22e663535a1d64060dacbea4eb10b30
js/locations.js
js/locations.js
$(function () { var locationList = $("#location-list"); function populateLocations(features) { locationList.empty(); $.each(features, function(i, v) { $("<li/>").appendTo(locationList) .toggleClass("lead", i == 0) .html(v.properties.details); }); } if (locationList.length > 0) { $.getJSON("sites.geojson", function(data) { populateLocations(data.features); var d = $.Deferred(); navigator.geolocation.getCurrentPosition( function(position) { var distanceTo = function(feature) { return geolib.getDistance({ 'longitude': position.coords.longitude, 'latitude': position.coords.latitude }, { 'longitude': feature.geometry.coordinates[0], 'latitude': feature.geometry.coordinates[1] }); }; // sort features by distance data.features.sort(function(a, b) { return distanceTo(a) - distanceTo(b); }); d.resolve(data.features); }, function() { // use original order d.resolve(data.features); }, { enableHighAccuracy: false } ); d.promise().done(populateLocations); }); } });
$(function () { var locationList = $("#location-list"); function populateLocations(data) { locationList.empty(); $.each(data.features, function(i, v) { $("<li/>").appendTo(locationList) .toggleClass("lead", i == 0 && data.locationKnown) .html(v.properties.details); }); } if (locationList.length > 0) { $.getJSON("sites.geojson", function(data) { populateLocations({ locationKnown: false, features: data.features }); var d = $.Deferred(); navigator.geolocation.getCurrentPosition( function(position) { var distanceTo = function(feature) { return geolib.getDistance({ 'longitude': position.coords.longitude, 'latitude': position.coords.latitude }, { 'longitude': feature.geometry.coordinates[0], 'latitude': feature.geometry.coordinates[1] }); }; // sort features by distance data.features.sort(function(a, b) { return distanceTo(a) - distanceTo(b); }); d.resolve({ locationKnown: true, features: data.features }); }, function() { function name(feature) { var details = feature.properties.details; return $('<div>'+details+'</div>').text(); } // sort features by distance data.features.sort(function(a, b) { return name(a).localeCompare(name(b)); }); d.resolve({ locationKnown: false, features: data.features }); }, { enableHighAccuracy: false } ); d.promise().done(populateLocations); }); } });
Sort by name if location not available
Sort by name if location not available
JavaScript
apache-2.0
resbaz/resbaz-2016-02-01,BillMills/resbaz-site,BillMills/resbaz-site,resbaz/resbaz-2016-02-01
--- +++ @@ -1,16 +1,19 @@ $(function () { var locationList = $("#location-list"); - function populateLocations(features) { + function populateLocations(data) { locationList.empty(); - $.each(features, function(i, v) { + $.each(data.features, function(i, v) { $("<li/>").appendTo(locationList) - .toggleClass("lead", i == 0) + .toggleClass("lead", i == 0 && data.locationKnown) .html(v.properties.details); }); } if (locationList.length > 0) { $.getJSON("sites.geojson", function(data) { - populateLocations(data.features); + populateLocations({ + locationKnown: false, + features: data.features + }); var d = $.Deferred(); navigator.geolocation.getCurrentPosition( function(position) { @@ -28,11 +31,24 @@ data.features.sort(function(a, b) { return distanceTo(a) - distanceTo(b); }); - d.resolve(data.features); + d.resolve({ + locationKnown: true, + features: data.features + }); }, function() { - // use original order - d.resolve(data.features); + function name(feature) { + var details = feature.properties.details; + return $('<div>'+details+'</div>').text(); + } + // sort features by distance + data.features.sort(function(a, b) { + return name(a).localeCompare(name(b)); + }); + d.resolve({ + locationKnown: false, + features: data.features + }); }, { enableHighAccuracy: false
9a5b708be7e705acfb87ddaa2117c196621cf616
src/pages/dataTableUtilities/reducer/getReducer.js
src/pages/dataTableUtilities/reducer/getReducer.js
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ /** * Method using a factory pattern variant to get a reducer * for a particular page or page style. * * For a new page - create a constant object with the * methods from reducerMethods which are composed to create * a reducer. Add to PAGE_REDUCERS. * * Each key value pair in a reducer object should be in the form * action type: reducer function, returning a new state object * */ import { filterData, editTotalQuantity, focusNextCell, selectRow, deselectRow, deselectAll, focusCell, sortData, } from './reducerMethods'; /** * Used for actions that should be in all pages using a data table. */ const BASE_TABLE_PAGE_REDUCER = { focusNextCell, focusCell, sortData, }; const customerInvoice = { ...BASE_TABLE_PAGE_REDUCER, filterData, editTotalQuantity, selectRow, deselectRow, deselectAll, }; const PAGE_REDUCERS = { customerInvoice, }; const getReducer = page => { const reducer = PAGE_REDUCERS[page]; return (state, action) => { const { type } = action; if (!reducer[type]) return state; return reducer[type](state, action); }; }; export default getReducer;
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ /** * Method using a factory pattern variant to get a reducer * for a particular page or page style. * * For a new page - create a constant object with the * methods from reducerMethods which are composed to create * a reducer. Add to PAGE_REDUCERS. * * Each key value pair in a reducer object should be in the form * action type: reducer function, returning a new state object * */ import { filterData, editTotalQuantity, focusNextCell, selectRow, deselectRow, deselectAll, focusCell, sortData, openBasicModal, } from './reducerMethods'; /** * Used for actions that should be in all pages using a data table. */ const BASE_TABLE_PAGE_REDUCER = { focusNextCell, focusCell, sortData, }; const customerInvoice = { ...BASE_TABLE_PAGE_REDUCER, filterData, editTotalQuantity, selectRow, deselectRow, deselectAll, openBasicModal, }; const PAGE_REDUCERS = { customerInvoice, }; const getReducer = page => { const reducer = PAGE_REDUCERS[page]; return (state, action) => { const { type } = action; if (!reducer[type]) return state; return reducer[type](state, action); }; }; export default getReducer;
Add openBasicModal reducer method to customer invoice
Add openBasicModal reducer method to customer invoice
JavaScript
mit
sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile
--- +++ @@ -25,6 +25,7 @@ deselectAll, focusCell, sortData, + openBasicModal, } from './reducerMethods'; /** @@ -43,6 +44,7 @@ selectRow, deselectRow, deselectAll, + openBasicModal, }; const PAGE_REDUCERS = {
73c4dd83b679457a2d1ff6334fb0bd563e0030d5
src/i18n.js
src/i18n.js
import React, { Component } from 'react'; import Polyglot from 'node-polyglot'; // Provider root component export default class I18n extends Component { constructor(props) { super(props); this._polyglot = new Polyglot({ locale: props.locale, phrases: props.messages, }); } getChildContext() { return { t: this._polyglot.t.bind(this._polyglot) }; } componentWillReceiveProps(newProps) { if (newProps.locale !== this.props.locale) { this._polyglot = new Polyglot({ locale: newProps.locale, phrases: newProps.messages }) } } shouldComponentUpdate(nextProps) { return this.props.locale !== nextProps.locale } render() { const children = this.props.children; return React.Children.only(children); } } I18n.propTypes = { locale: React.PropTypes.string.isRequired, messages: React.PropTypes.object.isRequired, children: React.PropTypes.element.isRequired, }; I18n.childContextTypes = { t: React.PropTypes.func.isRequired, };
import React, { Component } from 'react'; import Polyglot from 'node-polyglot'; // Provider root component export default class I18n extends Component { constructor(props) { super(props); this._polyglot = new Polyglot({ locale: props.locale, phrases: props.messages, }); } getChildContext() { return { t: this._polyglot.t.bind(this._polyglot) }; } componentWillReceiveProps(newProps) { if (newProps.locale !== this.props.locale) { this._polyglot = new Polyglot({ locale: newProps.locale, phrases: newProps.messages }) } } render() { const children = this.props.children; return React.Children.only(children); } } I18n.propTypes = { locale: React.PropTypes.string.isRequired, messages: React.PropTypes.object.isRequired, children: React.PropTypes.element.isRequired, }; I18n.childContextTypes = { t: React.PropTypes.func.isRequired, };
Fix update behavior removing shouldComponentUpdate
Fix update behavior removing shouldComponentUpdate The should component update was not such a good idea as the component did not update when props of other components changed
JavaScript
mit
nayaabkhan/react-polyglot,nayaabkhan/react-polyglot
--- +++ @@ -24,10 +24,6 @@ }) } } - - shouldComponentUpdate(nextProps) { - return this.props.locale !== nextProps.locale - } render() { const children = this.props.children;
476c12381d7364fddb46c158b6e13bfeb940cc02
src/test/moment/calendar.js
src/test/moment/calendar.js
// These tests are for locale independent features // locale dependent tests would be in locale test folder import { module, test } from '../qunit'; import moment from '../../moment'; module('calendar'); test('passing a function', function (assert) { var a = moment().hours(2).minutes(0).seconds(0); assert.equal(moment(a).calendar(null, { 'sameDay': function () { return 'h:mmA'; } }), '2:00AM', 'should equate'); });
// These tests are for locale independent features // locale dependent tests would be in locale test folder import { module, test } from '../qunit'; import moment from '../../moment'; module('calendar'); test('passing a function', function (assert) { var a = moment().hours(13).minutes(0).seconds(0); assert.equal(moment(a).calendar(null, { 'sameDay': function () { return 'h:mmA'; } }), '1:00PM', 'should equate'); });
Test mid-day to avoid DST issues
Test mid-day to avoid DST issues
JavaScript
mit
PKRoma/moment,SkReD/moment,Oire/moment,OtkurBiz/moment,moment/moment,monoblaine/moment,xkxx/moment,optimizely/moment,optimizely/moment,xkxx/moment,xkxx/moment,Oire/moment,scriptrdotio/moment,joelmheim/moment,OtkurBiz/moment,ze-pequeno/moment,moment/moment,gabrielmaldi/moment,samuelfullerthomas/moment,maggiepint/moment,samuelfullerthomas/moment,ichernev/moment,calebcauthon/moment,mj1856/moment,moment/moment,maggiepint/moment,OtkurBiz/moment,whytobe/moment,julionc/moment,julionc/moment,ze-pequeno/moment,PKRoma/moment,ze-pequeno/moment,samuelfullerthomas/moment,whytobe/moment,gabrielmaldi/moment,monoblaine/moment,calebcauthon/moment,mj1856/moment,maggiepint/moment,joelmheim/moment,ichernev/moment,joelmheim/moment,mj1856/moment,marijaselakovic/moment,PKRoma/moment,marijaselakovic/moment,scriptrdotio/moment,scriptrdotio/moment,Oire/moment,calebcauthon/moment,julionc/moment
--- +++ @@ -6,12 +6,12 @@ module('calendar'); test('passing a function', function (assert) { - var a = moment().hours(2).minutes(0).seconds(0); + var a = moment().hours(13).minutes(0).seconds(0); assert.equal(moment(a).calendar(null, { 'sameDay': function () { return 'h:mmA'; } - }), '2:00AM', 'should equate'); + }), '1:00PM', 'should equate'); });
620f3cdaab7158d0430dd00c2a8b2adadabb7ea9
lib/logger.js
lib/logger.js
var util = require('util'); var levels = [ 'silly', 'input', 'verbose', 'prompt', 'debug', 'http', 'info', 'data', 'help', 'warn', 'error' ]; levels.forEach(function(level) { exports[level] = function(msg) { console.log( level + ':', util.format.apply( this, [msg].concat([].slice.call(arguments, 1)))); }; }); exports.wrap = function(getPrefix, func) { if (typeof getPrefix != 'function') { var msg = getPrefix; getPrefix = function() { return msg; }; } return function() { var args = arguments, that = this, prefix = getPrefix.apply(that, args); wrapper = {}; levels.forEach(function(level) { wrapper[level] = function(msg) { msg = (prefix ? prefix + ': ' : '') + msg; exports[level].apply( this, [msg].concat([].slice.call(arguments, 1))); }; }); return func.apply(that, [wrapper].concat([].slice.call(args))); }; };
var util = require('util'); var levels = [ 'silly', 'input', 'verbose', 'prompt', 'debug', 'http', 'info', 'data', 'help', 'warn', 'error' ]; levels.forEach(function(level) { exports[level] = function(msg) { if (!exports.disabled) { console.log( level + ':', util.format.apply( this, [msg].concat([].slice.call(arguments, 1)))); } }; }); exports.disabled = false; exports.wrap = function(getPrefix, func) { if (typeof getPrefix != 'function') { var msg = getPrefix; getPrefix = function() { return msg; }; } return function() { var args = arguments, that = this, prefix = getPrefix.apply(that, args); wrapper = {}; levels.forEach(function(level) { wrapper[level] = function(msg) { msg = (prefix ? prefix + ': ' : '') + msg; exports[level].apply( this, [msg].concat([].slice.call(arguments, 1))); }; }); return func.apply(that, [wrapper].concat([].slice.call(args))); }; };
Allow disabling logging when Winston is not being used
Allow disabling logging when Winston is not being used
JavaScript
mit
nylen/node-web-template,nylen/node-web-media-player
--- +++ @@ -16,13 +16,17 @@ levels.forEach(function(level) { exports[level] = function(msg) { - console.log( - level + ':', - util.format.apply( - this, - [msg].concat([].slice.call(arguments, 1)))); + if (!exports.disabled) { + console.log( + level + ':', + util.format.apply( + this, + [msg].concat([].slice.call(arguments, 1)))); + } }; }); + +exports.disabled = false; exports.wrap = function(getPrefix, func) { if (typeof getPrefix != 'function') {
80d5eb3fa1d3d4653e5d67f62b8a5d8ed6c7a3ca
js/game.js
js/game.js
// Game Controller // A checkers board has 64 squares like a chess board but it only uses 32 squares all the same color // Each player has 12 pieces and pieces that make until the last squares on the enemy side is promoted // Promoted piece also moves on diagonals with no limit of squares if it is free // The moves are on diagonal one square at a time // To capture, the piece capturing jumps the enemy piece advancing two squares on diagonal // The game end when one of the player lost all pieces or doesn't have moves to make function Game() { /* Board.initial generate all elements used to be pieces and empty squares on the board and return an array of the board initial position*/ this.board = Board.initial(); this.playingNow = "blue"; } Game.prototype.test = function(param){ console.log(this.board); } Game.prototype.whoseTurn = function(){ }
// Game Controller // A checkers board has 64 squares like a chess board but it only uses 32 squares all the same color // Each player has 12 pieces and pieces that make until the last squares on the enemy side is promoted // Promoted piece also moves on diagonals with no limit of squares if it is free // The moves are on diagonal one square at a time // To capture, the piece capturing jumps the enemy piece advancing two squares on diagonal // The game end when one of the player lost all pieces or doesn't have moves to make function Game() { /* Board.initial generate all elements used to be pieces and empty squares on the board and return an array of the board initial position*/ this.board = Board.initial(); } Game.prototype.flattenBoard = function(param){ var flatBoard = this.board.reduce( function(a,b) { return a.concat(b); },[] ); return flatBoard; } Game.prototype.whoseTurn = function(){ }
Create prototype to flatten board
Create prototype to flatten board
JavaScript
mit
RenanBa/checkers-v1,RenanBa/checkers-v1
--- +++ @@ -9,11 +9,15 @@ /* Board.initial generate all elements used to be pieces and empty squares on the board and return an array of the board initial position*/ this.board = Board.initial(); - this.playingNow = "blue"; } -Game.prototype.test = function(param){ - console.log(this.board); +Game.prototype.flattenBoard = function(param){ + var flatBoard = this.board.reduce( + function(a,b) { + return a.concat(b); + },[] + ); + return flatBoard; } Game.prototype.whoseTurn = function(){
4d909497a1c18d05b46cb6b4115dbd6ad5b0656a
src/components/Specimen/Span.js
src/components/Specimen/Span.js
import React, {Component, PropTypes} from 'react'; export default class Span extends Component { render() { const {children, span} = this.props; const style = { boxSizing: 'border-box', display: 'flex', flexBasis: span && window.innerWidth > 640 ? `calc(${span / 6 * 100}% - 10px)` : 'calc(100% - 10px)', flexWrap: 'wrap', margin: '24px 10px 0 0', padding: 0, position: 'relative' }; return ( <div {...this.props} style={{...style, ...this.props.style}}> {children} </div> ); } } Span.propTypes = { span: PropTypes.number, children: PropTypes.node.isRequired, style: PropTypes.object };
import React, {Component, PropTypes} from 'react'; export default class Span extends Component { render() { const {children, span} = this.props; const style = { boxSizing: 'border-box', display: 'flex', flexBasis: span && window.innerWidth > 640 ? `calc(${span / 6 * 100}% - 10px)` : 'calc(100% - 10px)', // Bug fix for Firefox; width and flexBasis don't work on horizontally scrolling code blocks maxWidth: span && window.innerWidth > 640 ? `calc(${span / 6 * 100}% - 10px)` : 'calc(100% - 10px)', flexWrap: 'wrap', margin: '24px 10px 0 0', padding: 0, position: 'relative' }; return ( <div {...this.props} style={{...style, ...this.props.style}}> {children} </div> ); } } Span.propTypes = { span: PropTypes.number, children: PropTypes.node.isRequired, style: PropTypes.object };
Fix max width of overflowing specimens on Firefox
Fix max width of overflowing specimens on Firefox
JavaScript
bsd-3-clause
interactivethings/catalog,interactivethings/catalog,interactivethings/catalog,interactivethings/catalog
--- +++ @@ -8,6 +8,10 @@ boxSizing: 'border-box', display: 'flex', flexBasis: span && window.innerWidth > 640 ? + `calc(${span / 6 * 100}% - 10px)` : + 'calc(100% - 10px)', + // Bug fix for Firefox; width and flexBasis don't work on horizontally scrolling code blocks + maxWidth: span && window.innerWidth > 640 ? `calc(${span / 6 * 100}% - 10px)` : 'calc(100% - 10px)', flexWrap: 'wrap',
ef08b8e74ece8daafa19e6c788a55f49fb07d15c
source/tab/LoginTracker.js
source/tab/LoginTracker.js
import { getCurrentTitle, getCurrentURL } from "./page.js"; let __sharedTracker = null; export default class LoginTracker { username = ""; password = ""; _url = getCurrentTitle(); _title = getCurrentTitle(); get title() { return this._title; } get url() { return this._url; } } export function getSharedTracker() { if (!__sharedTracker) { __sharedTracker = new LoginTracker(); } return __sharedTracker; }
import { getCurrentTitle, getCurrentURL } from "./page.js"; let __sharedTracker = null; export default class LoginTracker { username = ""; password = ""; _url = getCurrentURL(); _title = getCurrentTitle(); get title() { return this._title; } get url() { return this._url; } } export function getSharedTracker() { if (!__sharedTracker) { __sharedTracker = new LoginTracker(); } return __sharedTracker; }
Fix URL in login tracking
Fix URL in login tracking
JavaScript
mit
perry-mitchell/buttercup-chrome,perry-mitchell/buttercup-chrome,buttercup-pw/buttercup-browser-extension,buttercup-pw/buttercup-browser-extension
--- +++ @@ -5,7 +5,7 @@ export default class LoginTracker { username = ""; password = ""; - _url = getCurrentTitle(); + _url = getCurrentURL(); _title = getCurrentTitle(); get title() {
dd5b51fe036ffa661c847e70d03eb02d6926e21a
src/main.js
src/main.js
import Firebase from 'firebase' import Vue from 'vue' import VueRouter from 'vue-router' import App from './App.vue' Vue.use(VueRouter) let router = new VueRouter({ hashboang: false, history: true, }) let MEGAKanban = Vue.extend({}) let Redirect = Vue.extend({ ready() { let boardName = localStorage.getItem('MEGAKanban_board') if (!boardName) { boardName = this.randomName() localStorage.setItem('MEGAKanban_board', boardName) } router.go(boardName) }, methods: { // generate board name using timestamp // @todo: generate memorable names randomName() { let now = new Date() return btoa(now) } } }) router.map({ '/': { name: 'root', component: Redirect }, '/:board': { name: 'board', component: App } }) router.start(MEGAKanban, '#main')
import Firebase from 'firebase' import Vue from 'vue' import VueRouter from 'vue-router' import nonsense from './nonsense' import App from './App.vue' window.randomSet = nonsense.randomSet window.randomNumber = nonsense.randomNumber Vue.use(VueRouter) let router = new VueRouter({ hashboang: false, history: true, }) let MEGAKanban = Vue.extend({}) let Redirect = Vue.extend({ ready() { let boardName = this.randomName() router.go(boardName) }, methods: { randomName() { return nonsense.randomSet() .concat(nonsense.randomNumber()) .join('-') } } }) router.map({ '/': { name: 'root', component: Redirect }, '/:board': { name: 'board', component: App } }) router.start(MEGAKanban, '#main')
Use nonsense board name, no localStorage
Use nonsense board name, no localStorage
JavaScript
mit
lunardog/MEGAKanban,lunardog/MEGAKanban
--- +++ @@ -2,7 +2,11 @@ import Vue from 'vue' import VueRouter from 'vue-router' +import nonsense from './nonsense' import App from './App.vue' + +window.randomSet = nonsense.randomSet +window.randomNumber = nonsense.randomNumber Vue.use(VueRouter) @@ -16,20 +20,15 @@ let Redirect = Vue.extend({ ready() { - let boardName = localStorage.getItem('MEGAKanban_board') - if (!boardName) { - boardName = this.randomName() - localStorage.setItem('MEGAKanban_board', boardName) - } + let boardName = this.randomName() router.go(boardName) }, methods: { - // generate board name using timestamp - // @todo: generate memorable names randomName() { - let now = new Date() - return btoa(now) + return nonsense.randomSet() + .concat(nonsense.randomNumber()) + .join('-') } } })
e580b1c8dc4e2a09feaa5b6be00a3e8d1ea31e01
src/mailgun-transport.js
src/mailgun-transport.js
'use strict'; var Mailgun = require('mailgun-js'); var packageData = require('../package.json'); module.exports = function(options) { return new MailgunTransport(options); }; function MailgunTransport(options) { this.options = options || {}; this.name = 'Mailgun'; this.version = packageData.version; } MailgunTransport.prototype.send = function (mail, callback) { var mailgun = Mailgun({ apiKey: this.options.auth.api_key, domain: this.options.auth.domain || '' }); var data = { from: mail.data.from, to: mail.data.to, subject: mail.data.subject, text: mail.data.text } mailgun.messages().send(data, function (err, body) { if (err) { console.log(err); return callback(err); } return callback(); } ); };
'use strict'; var Mailgun = require('mailgun-js'); var packageData = require('../package.json'); module.exports = function(options) { return new MailgunTransport(options); }; function MailgunTransport(options) { this.options = options || {}; this.name = 'Mailgun'; this.version = packageData.version; } MailgunTransport.prototype.send = function (mail, callback) { var mailgun = Mailgun({ apiKey: this.options.auth.api_key, domain: this.options.auth.domain || '' }); var data = { from: mail.data.from, to: mail.data.to, subject: mail.data.subject, text: mail.data.text, html: mail.data.html } mailgun.messages().send(data, function (err, body) { if (err) { console.log(err); return callback(err); } return callback(); } ); };
Add in support for passing through the html param
Add in support for passing through the html param
JavaScript
mit
orliesaurus/nodemailer-mailgun-transport,wmcmurray/nodemailer-mailgun-transport,rasteiner/nodemailer-mailgun-transport
--- +++ @@ -24,7 +24,8 @@ from: mail.data.from, to: mail.data.to, subject: mail.data.subject, - text: mail.data.text + text: mail.data.text, + html: mail.data.html } mailgun.messages().send(data,
e28021852e496cbe943f5b2b3bee1fb6353a629d
src/js/factories/chat.js
src/js/factories/chat.js
(function() { 'use strict'; // This is my local Docker IRC server var defaultHost = '192.168.99.100:6667'; angular.module('app.factories.chat', []). factory('chat', Chat); Chat.$inject = ['$websocket', '$rootScope']; function Chat($websocket, $rootScope) { var ws = $websocket('ws://localhost:6060?server=' + defaultHost); $rootScope.logs = []; ws.onMessage(function(message) { console.log(message); var d = JSON.parse(message.data); $rootScope.logs.push(d); }); ws.onOpen(function() { console.log('WebSocket opened!'); ws.send({ name: 'SET', message: defaultHost + '/#roomtest' }); methods.setNick('paked'); }); var methods = { sendMessage: function(message) { ws.send({ name: 'SEND', message: message, channel: defaultHost + '/#roomtest' }); }, setNick: function(nick) { ws.send({ name: 'NICK', message: nick }); } }; return methods; } })();
(function() { 'use strict'; // This is my local Docker IRC server var defaultHost = '192.168.99.100:6667'; angular.module('app.factories.chat', []). factory('chat', Chat); Chat.$inject = ['$websocket', '$rootScope']; function Chat($websocket, $rootScope) { var ws = $websocket('ws://localhost:6060?server=' + defaultHost); $rootScope.logs = []; ws.onMessage(function(message) { console.log(message); var d = JSON.parse(message.data); $rootScope.logs.push(d); }); ws.onOpen(function() { console.log('WebSocket opened!'); ws.send({ name: 'SET', message: defaultHost + '/#roomtest' }); methods.setNick('paked'); }); var methods = { sendMessage: function(message) { ws.send({ name: 'SEND', message: message, channel: defaultHost + '/#roomtest' }); }, setNick: function(nick) { ws.send({ name: 'NICK', message: nick }); }, _send: function(obj) { ws.send(obj); } }; return methods; } })();
Add _send function for hacky-ness
Add _send function for hacky-ness
JavaScript
mit
BigRoom/mystique,BigRoom/mystique
--- +++ @@ -43,6 +43,9 @@ name: 'NICK', message: nick }); + }, + _send: function(obj) { + ws.send(obj); } };
1e94858c1498a5cc429aeccdfdd8b2d92615decd
lib/toHTML.js
lib/toHTML.js
'use strict'; /*eslint no-underscore-dangle: 0*/ var ElementFactory = require('./ElementFactory.js'); var elem = new ElementFactory({}); var stream = require('stream'); var ToHTML = function(options) { this.options = options; this.elem = new ElementFactory(options); stream.Transform.call(this, { objectMode: true }); }; var convertTokenToHTML = function(token) { var html = ''; switch (token.type) { case 'open': html = elem.open(token.name, token.attr, token.selfClose); break; case 'close': html = elem.close(token.name); break; case 'text': html = token.content; break; case 'processinginstruction': html = elem.open(token.content); break; case 'comment': html = '<!--' + token.content + '-->'; break; default: console.log('Unrecognised token type: ', token); break; } return html; }; require('util').inherits(ToHTML, stream.Transform); ToHTML.prototype._transform = function(token, enc, cb) { // Ignore invalid tokens if (typeof token !== 'object' || !token.type) { cb(null); } this.push(convertTokenToHTML(token)); cb(null); }; module.exports = function(options) { return new ToHTML(options); }; module.exports.convertTokenToHTML = convertTokenToHTML;
'use strict'; /*eslint no-underscore-dangle: 0*/ var ElementFactory = require('./ElementFactory.js'); var elem = new ElementFactory({}); var stream = require('stream'); var ToHTML = function(options) { this.options = options; this.elem = new ElementFactory(options); stream.Transform.call(this, { objectMode: true }); }; var convertTokenToHTML = function(token) { var html = ''; switch (token.type) { case 'open': html = elem.open(token.name, token.attr, token.selfClose); break; case 'close': html = elem.close(token.name); break; case 'text': html = token.content; break; case 'processinginstruction': html = elem.open(token.content); break; case 'comment': html = '<!--' + token.content + '-->'; break; default: console.log('Unrecognised token type: ', token); break; } return html; }; require('util').inherits(ToHTML, stream.Transform); ToHTML.prototype._transform = function(token, enc, cb) { // Ignore invalid tokens if (typeof token !== 'object' || !token.type) { if (typeof token === 'string') { this.push(token); } return cb(null); } this.push(convertTokenToHTML(token)); cb(null); }; module.exports = function(options) { return new ToHTML(options); }; module.exports.convertTokenToHTML = convertTokenToHTML;
Allow strings to pass through the stream
Allow strings to pass through the stream
JavaScript
isc
ironikart/html-tokeniser,ironikart/html-tokeniser
--- +++ @@ -42,7 +42,10 @@ ToHTML.prototype._transform = function(token, enc, cb) { // Ignore invalid tokens if (typeof token !== 'object' || !token.type) { - cb(null); + if (typeof token === 'string') { + this.push(token); + } + return cb(null); } this.push(convertTokenToHTML(token));
9f7f601f966b8abb784d28a87703d952ffca5282
examples/cordova/modules/BarcodeScannerPage.js
examples/cordova/modules/BarcodeScannerPage.js
var PluginPage = require('./PluginPage'); var page = new PluginPage('BarcodeScanner', 'cordova-plugin-barcodescanner', function(parent) { new tabris.Button({ layoutData: {left: 10, top: 10, right: 10}, text: 'Scan Barcode' }).on('select', scanBarcode).appendTo(parent); var resultView = new tabris.TextView({ layoutData: {top: 'prev() 20', left: 20, right: 20}, markupEnabled: true }).appendTo(parent); function scanBarcode() { cordova.plugins.barcodeScanner.scan(function(result) { resultView.set('text', result.cancelled ? '<b>Scan cancelled</b>' : '<b>Scan result:</b> ' + result.text + ' (' + result.format + ')'); }, function(error) { resultView.set('text', '<b>Error:</b> ' + error); }); } }); module.exports = page;
var PluginPage = require('./PluginPage'); var page = new PluginPage('BarcodeScanner', 'phonegap-plugin-barcodescanner', function(parent) { new tabris.Button({ layoutData: {left: 10, top: 10, right: 10}, text: 'Scan Barcode' }).on('select', scanBarcode).appendTo(parent); var resultView = new tabris.TextView({ layoutData: {top: 'prev() 20', left: 20, right: 20}, markupEnabled: true }).appendTo(parent); function scanBarcode() { cordova.plugins.barcodeScanner.scan(function(result) { resultView.set('text', result.cancelled ? '<b>Scan cancelled</b>' : '<b>Scan result:</b> ' + result.text + ' (' + result.format + ')'); }, function(error) { resultView.set('text', '<b>Error:</b> ' + error); }); } }); module.exports = page;
Update barcode scanner example to reference plugin "phonegap-plugin-barcodescanner"
Update barcode scanner example to reference plugin "phonegap-plugin-barcodescanner" Previously the incorrect plugin "cordova-plugin-barcodescanner" has been referenced Change-Id: I2e318fdf66ba8186a135a28d8ddc92a94ee63ea4
JavaScript
bsd-3-clause
eclipsesource/tabris-js,eclipsesource/tabris-js,eclipsesource/tabris-js
--- +++ @@ -1,6 +1,6 @@ var PluginPage = require('./PluginPage'); -var page = new PluginPage('BarcodeScanner', 'cordova-plugin-barcodescanner', function(parent) { +var page = new PluginPage('BarcodeScanner', 'phonegap-plugin-barcodescanner', function(parent) { new tabris.Button({ layoutData: {left: 10, top: 10, right: 10},
65c2c4b7ee3833e8ea30deb701cfcbb337562d7e
lib/settings.js
lib/settings.js
var Settings = { setUrls: function(urls) { localStorage.setItem('urls', JSON.stringify(urls)); }, getUrls: function() { var urls = localStorage.getItem('urls') || ''; return JSON.parse(urls); } };
var Settings = { setUrls: function(urls) { localStorage.setItem('urls', JSON.stringify(urls)); }, getUrls: function() { var urls = localStorage.getItem('urls'); return urls ? JSON.parse(urls) : ''; } };
Fix bug when no urls have been set up yet
Fix bug when no urls have been set up yet
JavaScript
mit
craigerm/unstyled,craigerm/unstyled
--- +++ @@ -3,7 +3,7 @@ localStorage.setItem('urls', JSON.stringify(urls)); }, getUrls: function() { - var urls = localStorage.getItem('urls') || ''; - return JSON.parse(urls); + var urls = localStorage.getItem('urls'); + return urls ? JSON.parse(urls) : ''; } };
973d38c62da08d6f19b49f1cbd097694080331aa
app/anol/modules/mouseposition/mouseposition-directive.js
app/anol/modules/mouseposition/mouseposition-directive.js
angular.module('anol.mouseposition', []) .directive('anolMousePosition', ['MapService', function(MapService) { return { restrict: 'A', require: '?^anolMap', scope: {}, link: { pre: function(scope, element, attrs, AnolMapController) { scope.map = MapService.getMap(); var controlOptions = {}; if(angular.isUndefined(AnolMapController)) { controlOptions = { target: element[0] }; } scope.map.addControl( new ol.control.MousePosition(controlOptions) ); } } }; }]);
angular.module('anol.mouseposition', []) .directive('anolMousePosition', ['MapService', function(MapService) { return { restrict: 'A', require: '?^anolMap', scope: {}, link: { pre: function(scope, element, attrs) { scope.map = MapService.getMap(); }, post: function(scope, element, attrs, AnolMapController) { var controlOptions = {}; if(angular.isFunction(scope.coordinateFormat)) { controlOptions.coordinateFormat = scope.coordinateFormat; } if(angular.isUndefined(AnolMapController)) { controlOptions = { target: element[0] }; } scope.map.addControl( new ol.control.MousePosition(controlOptions) ); } } }; }]);
Add coordinateFormat function to controlOptions if present
Add coordinateFormat function to controlOptions if present
JavaScript
mit
omniscale/orka-app,omniscale/orka-app,hgarnelo/orka-app,hgarnelo/orka-app
--- +++ @@ -6,10 +6,16 @@ require: '?^anolMap', scope: {}, link: { - pre: function(scope, element, attrs, AnolMapController) { + pre: function(scope, element, attrs) { scope.map = MapService.getMap(); + }, + post: function(scope, element, attrs, AnolMapController) { + var controlOptions = {}; - var controlOptions = {}; + if(angular.isFunction(scope.coordinateFormat)) { + controlOptions.coordinateFormat = scope.coordinateFormat; + } + if(angular.isUndefined(AnolMapController)) { controlOptions = { target: element[0]
348197bb61eb41bd9c37295f961084448156d47b
prod-server.js
prod-server.js
const path = require("path"); const ROOT = require("./config/path-helper").ROOT; const WebpackIsomorphicTools = require("webpack-isomorphic-tools"); function hotReloadTemplate(templatesDir) { require("marko/hot-reload").enable(); require("chokidar") .watch(templatesDir) .on("change", filename => { require("marko/hot-reload").handleFileModified(path.join(ROOT, filename)); }); } global.webpackIsomorphicTools = new WebpackIsomorphicTools( require("./config/webpack/webpack-isomorphic-tools") ); // to get the node require instead of dynamic require by webpack global.nodeRequire = require; global.webpackIsomorphicTools .server(ROOT, () => { require("source-map-support").install(); if (process.env.NODE_DEBUGGER) { require("babel-core/register"); require("./app/server"); } else { require("./build/server"); } if (process.env.NODE_ENV === "development") { hotReloadTemplate("./app/server/application/templates/**/*.marko"); } });
const path = require("path"); const ROOT = require("./config/path-helper").ROOT; const WebpackIsomorphicTools = require("webpack-isomorphic-tools"); require("source-map-support").install({ environment: "node" }); function hotReloadTemplate(templatesDir) { require("marko/hot-reload").enable(); require("chokidar") .watch(templatesDir) .on("change", filename => { require("marko/hot-reload").handleFileModified(path.join(ROOT, filename)); }); } global.webpackIsomorphicTools = new WebpackIsomorphicTools( require("./config/webpack/webpack-isomorphic-tools") ); // to get the node require instead of dynamic require by webpack global.nodeRequire = require; global.webpackIsomorphicTools .server(ROOT, () => { if (process.env.NODE_DEBUGGER) { require("babel-core/register"); require("./app/server"); } else { require("./build/server"); } if (process.env.NODE_ENV === "development") { hotReloadTemplate("./app/server/application/templates/**/*.marko"); } });
Add source-map-support only for node env
Add source-map-support only for node env
JavaScript
mit
hung-phan/all-hail-the-R,hung-phan/koa-react-isomorphic,hung-phan/koa-react-isomorphic,hung-phan/koa-react-isomorphic,hung-phan/all-hail-the-R
--- +++ @@ -1,6 +1,10 @@ const path = require("path"); const ROOT = require("./config/path-helper").ROOT; const WebpackIsomorphicTools = require("webpack-isomorphic-tools"); + +require("source-map-support").install({ + environment: "node" +}); function hotReloadTemplate(templatesDir) { require("marko/hot-reload").enable(); @@ -20,8 +24,6 @@ global.webpackIsomorphicTools .server(ROOT, () => { - require("source-map-support").install(); - if (process.env.NODE_DEBUGGER) { require("babel-core/register"); require("./app/server");