commit
stringlengths
40
40
old_file
stringlengths
4
264
new_file
stringlengths
4
264
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
624
message
stringlengths
15
4.7k
lang
stringclasses
3 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
824a95776d93c5fe6314d11d17e7f810d2994414
accounts-anonymous-client.js
accounts-anonymous-client.js
AccountsAnonymous.login = function (callback) { callback = callback || function () {}; if (Meteor.userId()) { callback(new Meteor.Error('accounts-anonymous-already-logged-in', "You can't login anonymously while you are already logged in.")); return; } Accounts.callLoginMethod({ methodArguments: [{ anonymous: true }], userCallback: function (error, result) { if (error) { callback && callback(error); } else { callback && callback(); } } }); }
AccountsAnonymous.login = function (callback) { callback = callback || function () {}; if (Meteor.userId()) { callback(new Meteor.Error(AccountsAnonymous._ALREADY_LOGGED_IN_ERROR, "You can't login anonymously while you are already logged in.")); return; } Accounts.callLoginMethod({ methodArguments: [{ anonymous: true }], userCallback: function (error, result) { if (error) { callback && callback(error); } else { callback && callback(); } } }); }
Use constant for error message.
Use constant for error message.
JavaScript
mit
brettle/meteor-accounts-anonymous
fe17a2b4115bdedd639b4c26a9a54ee33dbb5bf7
addon/array-pager.js
addon/array-pager.js
import Em from 'ember'; import ArraySlice from 'array-slice'; var get = Em.get; var set = Em.set; var ArrayPager = ArraySlice.extend({ // 1-based page: function (key, page) { var limit = get(this, 'limit'); var offset; // default value if (arguments.length <= 1) { offset = get(this, 'offset') || 0; return Math.ceil(offset / limit) || 1; } // setter // no negative pages page = Math.max(page - 1, 0); offset = (limit * page) || 0; set(this, 'offset', offset); return page + 1; }.property('offset', 'limit'), // 1-based pages: function () { var limit = get(this, 'limit'); var length = get(this, 'content.length'); var pages = Math.ceil(length / limit) || 1; if (pages === Infinity) { pages = 0; } return pages; }.property('content.length', 'limit') }); ArrayPager.computed = { page: function (prop, page, limit) { return Em.computed(prop, function () { return ArrayPager.create({ content: get(this, prop), page: page, limit: limit }); }); } }; export default ArrayPager;
import Em from 'ember'; import ArraySlice from 'array-slice'; var computed = Em.computed; var get = Em.get; var set = Em.set; var ArrayPager = ArraySlice.extend({ // 1-based page: computed('offset', 'limit', function (key, page) { var limit = get(this, 'limit'); var offset; // default value if (arguments.length <= 1) { offset = get(this, 'offset') || 0; return Math.ceil(offset / limit) || 1; } // setter // no negative pages page = Math.max(page - 1, 0); offset = (limit * page) || 0; set(this, 'offset', offset); return page + 1; }), // 1-based pages: computed('content.length', 'limit', function () { var limit = get(this, 'limit'); var length = get(this, 'content.length'); var pages = Math.ceil(length / limit) || 1; if (pages === Infinity) { pages = 0; } return pages; }) }); ArrayPager.computed = { page: function (prop, page, limit) { return computed(function () { return ArrayPager.create({ content: get(this, prop), page: page, limit: limit }); }); } }; export default ArrayPager;
Use `Ember.computed` instead of `Function.prototype.property`
Use `Ember.computed` instead of `Function.prototype.property`
JavaScript
mit
j-/ember-cli-array-pager,j-/ember-cli-array-pager
a433c763359129ba034309097681368e7f2b38e8
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require_tree .
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require angular //= require angular-rails-templates //= require angular-app //= require_tree ./angular-app/templates //= require_tree ./angular-app/modules //= require_tree ./angular-app/filters //= require_tree ./angular-app/directives //= require_tree ./angular-app/models //= require_tree ./angular-app/services //= require_tree ./angular-app/controllers
Add angular assets to asset pipeline
Add angular assets to asset pipeline
JavaScript
mit
godspeedyoo/rails-angular-skeleton,godspeedyoo/rails-angular-skeleton,godspeedyoo/sc2tracker,godspeedyoo/sc2tracker,godspeedyoo/rails-angular-skeleton,godspeedyoo/sc2tracker
204820f700ed8f8c89e50b310b7f1433bec4402e
js/analytics.js
js/analytics.js
/** * @constructor */ function Analytics() { this.service_ = null; } Analytics.prototype.start = function(settings) { if (this.service_) { throw 'Analytics should be started only once per session.'; } this.service_ = analytics.getService('text_app'); var propertyId = 'UA-48886257-1'; if (chrome.runtime.getManifest()['name'].indexOf('Dev') >= 0) { propertyId = 'UA-48886257-2'; } this.tracker_ = this.service_.getTracker(propertyId); this.reportSettings_(settings); this.tracker_.sendAppView('main'); }; Analytics.prototype.reportSettings_ = function(settings) { this.tracker_.set('dimension1', settings.get('spacestab').toString()); this.tracker_.set('dimension2', settings.get('tabsize').toString()); this.tracker_.set('dimension3', Math.round(settings.get('fontsize')).toString()); this.tracker_.set('dimension4', settings.get('sidebaropen').toString()); this.tracker_.set('dimension5', settings.get('theme')); };
/** * @constructor */ function Analytics() { this.service_ = null; } Analytics.prototype.start = function(settings) { if (this.service_) { throw 'Analytics should be started only once per session.'; } this.service_ = analytics.getService('text_app'); var propertyId = 'UA-48886257-2'; if (chrome.runtime.id === 'mmfbcljfglbokpmkimbfghdkjmjhdgbg') { propertyId = 'UA-48886257-1'; } this.tracker_ = this.service_.getTracker(propertyId); this.reportSettings_(settings); this.tracker_.sendAppView('main'); }; Analytics.prototype.reportSettings_ = function(settings) { this.tracker_.set('dimension1', settings.get('spacestab').toString()); this.tracker_.set('dimension2', settings.get('tabsize').toString()); this.tracker_.set('dimension3', Math.round(settings.get('fontsize')).toString()); this.tracker_.set('dimension4', settings.get('sidebaropen').toString()); this.tracker_.set('dimension5', settings.get('theme')); };
Use chrome.runtime.id instead of name to select Analytics property.
Use chrome.runtime.id instead of name to select Analytics property.
JavaScript
bsd-3-clause
codex8/text-app,modulexcite/text-app,l3dlp/text-app,zkendall/WordBinder,l3dlp/text-app,zkendall/WordBinder,codex8/text-app,modulexcite/text-app,modulexcite/text-app,l3dlp/text-app,codex8/text-app,zkendall/WordBinder
8fdb62c51eab8f19cb5e6e7b3dac6bf28f017411
packages/components/containers/themes/CustomThemeModal.js
packages/components/containers/themes/CustomThemeModal.js
import React, { useState } from 'react'; import { c } from 'ttag'; import PropTypes from 'prop-types'; import { FormModal, PrimaryButton, Label, Alert, TextArea } from 'react-components'; const CustomThemeModal = ({ onSave, theme: initialTheme = '', ...rest }) => { const [theme, setTheme] = useState(initialTheme); const handleChange = ({ target }) => setTheme(target.value); const handleSubmit = async () => { await onSave(theme); rest.onClose(); }; return ( <FormModal submit={<PrimaryButton type="submit">{c('Action').t`Save`}</PrimaryButton>} onSubmit={handleSubmit} title={c('Title').t`Custom mode`} small {...rest} > <Alert type="warning">{c('Warning') .t`Custom modes from third parties can potentially betray your privacy. Only use modes from trusted sources.`}</Alert> <Label className="mb1" htmlFor="themeTextarea">{c('Label').t`CSS code`}</Label> <TextArea className="mb1" id="themeTextarea" value={theme} placeholder={c('Action').t`Insert CSS code here`} onChange={handleChange} /> </FormModal> ); }; CustomThemeModal.propTypes = { onSave: PropTypes.func.isRequired, theme: PropTypes.string }; export default CustomThemeModal;
import React, { useState } from 'react'; import { c } from 'ttag'; import PropTypes from 'prop-types'; import { FormModal, PrimaryButton, Label, Alert, TextArea } from 'react-components'; const CustomThemeModal = ({ onSave, theme: initialTheme = '', ...rest }) => { const [theme, setTheme] = useState(initialTheme); const handleChange = ({ target }) => setTheme(target.value); const handleSubmit = async () => { await onSave(theme); rest.onClose(); }; return ( <FormModal submit={<PrimaryButton type="submit">{c('Action').t`Save`}</PrimaryButton>} onSubmit={handleSubmit} title={c('Title').t`Custom mode`} {...rest} > <Alert type="warning">{c('Warning') .t`Custom modes from third parties can potentially betray your privacy. Only use modes from trusted sources.`}</Alert> <Label className="bl mb0-5" htmlFor="themeTextarea">{c('Label').t`CSS code`}</Label> <TextArea className="mb1" id="themeTextarea" value={theme} placeholder={c('Action').t`Insert CSS code here`} onChange={handleChange} /> </FormModal> ); }; CustomThemeModal.propTypes = { onSave: PropTypes.func.isRequired, theme: PropTypes.string }; export default CustomThemeModal;
Use larger modal for Custom CSS
[MAILWEB-801] Use larger modal for Custom CSS
JavaScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
8e0822de5b362f9cd5d421269084dd8c23829f98
test/e2e/scenarios.js
test/e2e/scenarios.js
'use strict'; /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */ describe('ng-grid', function() { beforeEach(function() { browser().navigateTo('../../workbench/index.html'); }); describe('templates', function() { browser().navigateTo('../../workbench/templating/external.html'); it('should not cause a $digest or $apply error when fetching the template completes after the data $http request does', function() { }); it('should load external templates before building the grid', function() { // todo: rows should have data when external template is defined }); it('should only load the same external template once', function() { // todo }); }); });
'use strict'; /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */ describe('ng-grid', function() { // beforeEach(function() { // browser().navigateTo('../../workbench/index.html'); // }); describe('templates', function() { beforeEach(function() { browser().navigateTo('../../workbench/templating/external.html'); }); it('should not cause a $digest or $apply error when fetching the template completes after the data $http request does', function() { }); it('should load external templates before building the grid', function() { // todo: rows should have data when external template is defined }); it('should only load the same external template once', function() { // todo }); }); });
Fix for "browser is not defined" error
Fix for "browser is not defined" error The `browser` variable is not available outside a beforeEach() call.
JavaScript
mit
ciccio86/ui-grid,PaulL1/ng-grid,zen4s/ng-grid,b2io/ng-grid,louwie17/ui-grid,pkdevbox/ui-grid,dietergoetelen/ui-grid,zen4s/ng-grid,ingshtrom/ui-grid,edivancamargo/ui-grid,edmondpr/ng-grid,Stiv/ui-grid,angular-ui/ng-grid,JLLeitschuh/ui-grid,louwie17/ui-grid,SomeKittens/ui-grid,yccteam/ui-grid,Phalynx/ng-grid,ntgn81/ui-grid,280455936/ng-grid,Lukasz-Wisniewski/ui-grid,c1240539157/ui-grid,hahn-kev/ui-grid,Stiv/ui-grid,eeiswerth/ng-grid,mportuga/ui-grid,como-quesito/ui-grid,Cosium/ui-grid,htettwin/ui-grid,DexStr/ng-grid,scottlepp/ui-grid,ingshtrom/ui-grid,salarmehr/ng-grid,zamboney/ui-grid,zuohaocheng/ui-grid,nsartor/ui-grid,zuohaocheng/ui-grid,Julius1985/ui-grid,xiaojie123/ng-grid,abgaryanharutyun/ng-grid,zuohaocheng/ui-grid,klieber/ui-grid,InteractiveIntelligence/ng-grid,ntmuigrid/ntmuigrid,b2io/ng-grid,FugleMonkey/ng-grid,solvebio/ng-grid,Servoy/ng-grid,jbarrus/ng-grid,cell-one/ui-grid,kamikasky/ui-grid,zhaokunfay/ui-grid,AgDude/ng-grid,triersistemas/tr-grid,eeiswerth/ng-grid,dietergoetelen/ui-grid,therealtomas/ui-grid,Julius1985/ui-grid,solvebio/ng-grid,Namek/ui-grid,amyboyd/ng-grid,imbalind/ui-grid,pzw224/ui-grid,aw2basc/ui-grid,masterpowers/ui-grid,500tech/ng-grid,swalters/ng-grid,vidakovic/ui-grid,PeopleNet/ng-grid-fork,ppossanzini/ui-grid,dpinho17/ui-grid,dbckr/ui-grid,InteractiveIntelligence/ng-grid,Lukasz-Wisniewski/ui-grid,xiaojie123/ng-grid,angular-ui/ng-grid-legacy,yccteam/ui-grid,machinemetrics/ui-grid,Stiv/ui-grid,bartkiewicz/ui-grid,b2io/ng-grid,frantisekjandos/ui-grid,bartkiewicz/ui-grid,ciccio86/ui-grid,louwie17/ui-grid,YonatanKra/ui-grid,thomsonreuters/ng-grid,Khamull/ui-grid,machinemetrics/ui-grid,domakas/ui-grid,robpurcell/ui-grid,domakas/ui-grid,abgaryanharutyun/ng-grid,suryasingh/ng-grid,eeiswerth/ng-grid,pkdevbox/ui-grid,angular-ui/ng-grid-legacy,Lukasz-Wisniewski/ui-grid,dbckr/ui-grid,edmondpr/ng-grid,klieber/ui-grid,280455936/ng-grid,mirik123/ng-grid,zuzusik/ui-grid,jbarrus/ng-grid,Servoy/ng-grid,ppossanzini/ui-grid,AgDude/ng-grid,zuzusik/ui-grid,mage-eag/ui-grid,seafoam6/ui-grid,zamboney/ui-grid,Cosium/ui-grid,aw2basc/ui-grid,jiangzhixiao/ui-grid,kenwilcox/ui-grid,FernCreek/ng-grid,mage-eag/ui-grid,sandwich99/ng-grid,cell-one/ui-grid,Servoy/ng-grid,amyboyd/ng-grid,sandwich99/ng-grid,likaiwalkman/ui-grid,luisdesig/ui-grid,jintoppy/ui-grid,ntmuigrid/ntmuigrid,dpinho17/ui-grid,thomsonreuters/ng-grid,imbalind/ui-grid,salarmehr/ng-grid,cell-one/ui-grid,dpinho17/ui-grid,machinemetrics/ui-grid,mage-eag/ui-grid,brucebetts/ui-grid,c1240539157/ui-grid,rightscale/ng-grid,luisdesig/ui-grid,salarmehr/ng-grid,DexStr/ng-grid,Namek/ui-grid,SomeKittens/ui-grid,kennypowers1987/ui-grid,wesleycho/ui-grid,zhaokunfay/ui-grid,hahn-kev/ui-grid,amyboyd/ng-grid,rightscale/ng-grid,solvebio/ng-grid,zamboney/ui-grid,benoror/ui-grid,edmondpr/ng-grid,kennypowers1987/ui-grid,nishant8BITS/ng-grid,AdverseEvents/ui-grid,FugleMonkey/ng-grid,mboriani/ClearFilters,DexStr/ng-grid,Namek/ui-grid,kenwilcox/ui-grid,lookfirst/ui-grid,wesleycho/ui-grid,lookfirst/ui-grid,yccteam/ui-grid,280455936/ng-grid,hahn-kev/ui-grid,FernCreek/ng-grid,AdverseEvents/ui-grid,zhaokunfay/ui-grid,YonatanKra/ui-grid,dietergoetelen/ui-grid,JLLeitschuh/ui-grid,nishant8BITS/ng-grid,mirik123/ng-grid,angular-ui/ui-grid,suryasingh/ng-grid,kenwilcox/ui-grid,masterpowers/ui-grid,mportuga/ui-grid,zmon/ui-grid,brucebetts/ui-grid,alex87/ui-grid,benoror/ui-grid,luisdesig/ui-grid,scottlepp/ui-grid,scottlepp/ui-grid,dlgski/ui-grid,frantisekjandos/ui-grid,abgaryanharutyun/ng-grid,sandwich99/ng-grid,ingshtrom/ui-grid,500tech/ng-grid,kamikasky/ui-grid,htettwin/ui-grid,likaiwalkman/ui-grid,pzw224/ui-grid,angular-ui/ui-grid,JLLeitschuh/ui-grid,triersistemas/tr-grid,zen4s/ng-grid,benoror/ui-grid,PeopleNet/ng-grid-fork,aw2basc/ui-grid,YonatanKra/ui-grid,bjossi86/ui-grid,nsartor/ui-grid,Julius1985/ui-grid,c1240539157/ui-grid,angular-ui/ng-grid,JayHuang/ng-grid,bjossi86/ui-grid,cityglobal/ui-grid,AgDude/ng-grid,suryasingh/ng-grid,vidakovic/ui-grid,mboriani/ClearFilters,reupen/ui-grid,Khamull/ui-grid,btesser/ng-grid,kennypowers1987/ui-grid,triersistemas/tr-grid,pkdevbox/ui-grid,swalters/ng-grid,JayHuang/ng-grid,DmitryEfimenko/ui-grid,Phalynx/ng-grid,como-quesito/ui-grid,ntgn81/ui-grid,500tech/ng-grid,masterpowers/ui-grid,reupen/ui-grid,btesser/ng-grid,mirik123/ng-grid,robpurcell/ui-grid,brucebetts/ui-grid,zmon/ui-grid,JayHuang/ng-grid,dlgski/ui-grid,reupen/ui-grid,zmon/ui-grid,jmptrader/ui-grid,PaulL1/ng-grid,ppossanzini/ui-grid,seafoam6/ui-grid,mboriani/ClearFilters,edivancamargo/ui-grid,angular-ui/ui-grid,nsartor/ui-grid,wesleycho/ui-grid,vidakovic/ui-grid,DmitryEfimenko/ui-grid,jintoppy/ui-grid,lookfirst/ui-grid,robpurcell/ui-grid,angular-ui/ng-grid-legacy,kamikasky/ui-grid,bartkiewicz/ui-grid,jintoppy/ui-grid,cityglobal/ui-grid,como-quesito/ui-grid,FugleMonkey/ng-grid,FernCreek/ng-grid,therealtomas/ui-grid,zuzusik/ui-grid,frantisekjandos/ui-grid,bjossi86/ui-grid,jmptrader/ui-grid,jiangzhixiao/ui-grid,ntgn81/ui-grid,alex87/ui-grid,dbckr/ui-grid,DmitryEfimenko/ui-grid,imbalind/ui-grid,ciccio86/ui-grid,pzw224/ui-grid,alex87/ui-grid,jbarrus/ng-grid,cityglobal/ui-grid,xiaojie123/ng-grid,likaiwalkman/ui-grid,htettwin/ui-grid,nishant8BITS/ng-grid,AdverseEvents/ui-grid,InteractiveIntelligence/ng-grid,jiangzhixiao/ui-grid,domakas/ui-grid,SomeKittens/ui-grid,btesser/ng-grid,angular-ui/ng-grid,edivancamargo/ui-grid,jmptrader/ui-grid,dlgski/ui-grid,klieber/ui-grid,mportuga/ui-grid,Cosium/ui-grid,therealtomas/ui-grid,seafoam6/ui-grid,Khamull/ui-grid,ntmuigrid/ntmuigrid,Phalynx/ng-grid
36ac9e32d2b4fa5f8df837b956f8e73287395c86
bin/reviewServer.js
bin/reviewServer.js
#!/usr/bin/env node 'use strict'; /** * Binary to run the main server. * (C) 2015 Alex Fernández. */ // requires var stdio = require('stdio'); var Log = require('log'); var reviewServer = require('../lib/reviewServer'); // globals var log = new Log('info'); var credentials = {}; // init try { credentials = require('../credentials.json'); } catch(exception) { log.info('Please enter default values in a file called credentials.json'); } var options = stdio.getopt({ token: {key: 't', args: 1, description: 'Consumer token for Trello'}, key: {key: 'k', args: 1, description: 'Key for Trello'}, secret: {key: 's', args: 1, description: 'Secret value to access the server'}, port: {key: 'p', args: 1, description: 'Port to start the server', default: 6003}, quiet: {key: 'q', description: 'Do not log any messages'}, debug: {key: 'd', description: 'Log debug messages'}, }); credentials.overwriteWith(options); reviewServer.start(credentials);
#!/usr/bin/env node 'use strict'; /** * Binary to run the main server. * (C) 2015 Alex Fernández. */ // requires var stdio = require('stdio'); var Log = require('log'); var reviewServer = require('../lib/reviewServer'); // globals var log = new Log('info'); var credentials = {}; // init try { credentials = require('../credentials.json'); } catch(exception) { log.info('Please enter default values in a file called credentials.json'); } var options = stdio.getopt({ token: {key: 't', args: 1, description: 'Consumer token for Trello'}, key: {key: 'k', args: 1, description: 'Key for Trello'}, secret: {key: 's', args: 1, description: 'Secret value to access the server'}, port: {key: 'p', args: 1, description: 'Port to start the server', default: 7431}, quiet: {key: 'q', description: 'Do not log any messages'}, debug: {key: 'd', description: 'Log debug messages'}, }); credentials.overwriteWith(options); reviewServer.start(credentials);
Change default port to 7431.
Change default port to 7431.
JavaScript
mit
alexfernandez/trello-reviewer
3c3c4381d1d0dff38184d2543cff92f5c6be45be
bin/reviewServer.js
bin/reviewServer.js
#!/usr/bin/env node 'use strict'; /** * Binary to run the main server. * (C) 2015 Alex Fernández. */ // requires var stdio = require('stdio'); var reviewServer = require('../lib/reviewServer'); // init var options = stdio.getopt({ token: {key: 't', args: 1, mandatory: true, description: 'Consumer token for Trello'}, key: {key: 'k', args: 1, mandatory: true, description: 'Key for Trello'}, secret: {key: 's', args: 1, mandatory: true, description: 'Secret value to access the server'}, port: {key: 'p', args: 1, description: 'Port to start the server', default: 6003}, quiet: {key: 'q', description: 'Do not log any messages'}, debug: {key: 'd', description: 'Log debug messages'}, }); reviewServer.start(options);
#!/usr/bin/env node 'use strict'; /** * Binary to run the main server. * (C) 2015 Alex Fernández. */ // requires var stdio = require('stdio'); var Log = require('log'); var reviewServer = require('../lib/reviewServer'); // globals var log = new Log('info'); // init try { var credentials = require('./credentials.json'); } catch(exception) { log.info('Please enter default values in a file called credentials.json'); } var options = stdio.getopt({ token: {key: 't', args: 1, description: 'Consumer token for Trello'}, key: {key: 'k', args: 1, description: 'Key for Trello'}, secret: {key: 's', args: 1, description: 'Secret value to access the server'}, port: {key: 'p', args: 1, description: 'Port to start the server', default: 6003}, quiet: {key: 'q', description: 'Do not log any messages'}, debug: {key: 'd', description: 'Log debug messages'}, }); credentials.overwriteWith(options); reviewServer.start(credentials);
Use credentials as default values, complain if not found.
Use credentials as default values, complain if not found.
JavaScript
mit
alexfernandez/trello-reviewer
df8b1d826bbbe45a9b21738ea0c4d6c4fe4b7c49
lib/engine/index.js
lib/engine/index.js
const path = require('path') module.exports = function engine (config) { require('./driver')(config) config.engine.on('init', function (processType) { // processType will be 'runner','processor', or 'main' // Useful for detecting what module you are in if (processType === 'main') { // if (!config.common.storage.db.users.count()) { // importDB(config) // } } if (processType === 'runtime') { patchRuntimeGlobals(config) } }) } function patchRuntimeGlobals (config) { let pathToModule = path.join(path.dirname(require.main.filename), 'runtime/user-globals.js') let userGlobals = require(pathToModule) let newUserGlobals = require('./runtime/user-globals.js') Object.assign(userGlobals, newUserGlobals) }
const path = require('path') module.exports = function (config) { if (config.engine.driver) { // TODO: For some reason this is missing on runtimes, this needs // investigated as it makes on('playerSandbox') never trigger require('./driver')(config) } config.engine.on('init', function (processType) { console.log('INIT', processType) // processType will be 'runner','processor', or 'main' // Useful for detecting what module you are in if (processType === 'main') { // if (!config.common.storage.db.users.count()) { // importDB(config) // } } if (processType === 'runtime') { patchRuntimeGlobals(config) } }) } function patchRuntimeGlobals (config) { let pathToModule = path.join(path.dirname(require.main.filename), 'user-globals.js') let userGlobals = require(pathToModule) let newUserGlobals = require('./runtime/user-globals.js') Object.assign(userGlobals, newUserGlobals) }
Fix user global patching. Work around wierd runtime error
Fix user global patching. Work around wierd runtime error
JavaScript
mit
ScreepsMods/screepsmod-mongo
9f7b8362fbc99bc3c2832413de7963e19a21637f
app/assets/javascripts/sw.js
app/assets/javascripts/sw.js
console.log('Started', self); self.addEventListener('install', function(event) { self.skipWaiting(); console.log('Installed', event); }); self.addEventListener('activate', function(event) { console.log('Activated', event); }); self.addEventListener('push', function(event) { console.log('Push message', event); var title = 'Push message'; event.waitUntil( self.registration.showNotification(title, { body: 'The Message', tag: 'my-tag' })); }); self.addEventListener('notificationclick', function(event) { console.log('Notification click: tag ', event.notification.tag); event.notification.close(); var url = 'https://www.google.com/'; event.waitUntil( clients.matchAll({ type: 'window' }) .then(function(windowClients) { for (var i = 0; i < windowClients.length; i++) { var client = windowClients[i]; if (client.url === url && 'focus' in client) { return client.focus(); } } if (clients.openWindow) { return clients.openWindow(url); } }) ); });
console.log('Started', self); self.addEventListener('install', function(event) { self.skipWaiting(); console.log('Installed', event); }); self.addEventListener('activate', function(event) { console.log('Activated', event); }); self.addEventListener('push', function(event) { var title = 'Push message'; event.waitUntil( self.registration.showNotification(title, { body: 'The Message', icon: 'assets/launcher-icon-4x.png', tag: 'my-tag' })); }); self.addEventListener('notificationclick', function(event) { console.log('Notification click: tag ', event.notification.tag); event.notification.close(); var url = 'https://www.google.com/'; if (clients.openWindow) { return clients.openWindow(url); } });
Add notification icon and delete code that didn't work
Add notification icon and delete code that didn't work
JavaScript
mit
coreyja/glassy-collections,coreyja/glassy-collections,coreyja/glassy-collections
21fd5924b841f9926b8ba6ca57b387539222fe54
lib/parse/readme.js
lib/parse/readme.js
var _ = require('lodash'); var marked = require('marked'); var textRenderer = require('marked-text-renderer'); function extractFirstNode(nodes, nType) { return _.chain(nodes) .filter(function(node) { return node.type == nType; }) .pluck("text") .first() .value(); } function parseReadme(src) { var nodes, title, description; var renderer = textRenderer(); // Parse content nodes = marked.lexer(src); var title = extractFirstNode(nodes, "heading"); var description = extractFirstNode(nodes, "paragraph"); var convert = _.compose( function(text) { return _.unescape(text.replace(/(\r\n|\n|\r)/gm, "")); }, _.partialRight(marked, _.extend({}, marked.defaults, { renderer: renderer })) ); return { title: convert(title), description: convert(description) }; } // Exports module.exports = parseReadme;
var _ = require('lodash'); var marked = require('marked'); var textRenderer = require('marked-text-renderer'); function extractFirstNode(nodes, nType) { return _.chain(nodes) .filter(function(node) { return node.type == nType; }) .pluck("text") .first() .value(); } function parseReadme(src) { var nodes, title, description; var renderer = textRenderer(); // Parse content nodes = marked.lexer(src); title = extractFirstNode(nodes, "heading") || ''; description = extractFirstNode(nodes, "paragraph") || ''; var convert = _.compose( function(text) { return _.unescape(text.replace(/(\r\n|\n|\r)/gm, "")); }, function(text) { return marked.parse(text, _.extend({}, marked.defaults, { renderer: renderer })); } ); return { title: convert(title), description: convert(description) }; } // Exports module.exports = parseReadme;
Fix generate failing on README parsing
Fix generate failing on README parsing Failed if no title or description could be extracted
JavaScript
apache-2.0
CN-Sean/gitbook,OriPekelman/gitbook,hujianfei1989/gitbook,iamchenxin/gitbook,JohnTroony/gitbook,xxxhycl2010/gitbook,qingying5810/gitbook,bjlxj2008/gitbook,JozoVilcek/gitbook,kamyu104/gitbook,strawluffy/gitbook,ferrior30/gitbook,yaonphy/SwiftBlog,shibe97/gitbook,gencer/gitbook,palerdot/gitbook,mautic/documentation,haamop/documentation,youprofit/gitbook,megumiteam/documentation,bjlxj2008/gitbook,iamchenxin/gitbook,CN-Sean/gitbook,npracht/documentation,snowsnail/gitbook,switchspan/gitbook,vehar/gitbook,ryanswanson/gitbook,intfrr/gitbook,hujianfei1989/gitbook,mruse/gitbook,bradparks/gitbook,2390183798/gitbook,Abhikos/gitbook,GitbookIO/gitbook,shibe97/gitbook,nycitt/gitbook,sunlianghua/gitbook,youprofit/gitbook,npracht/documentation,ferrior30/gitbook,jocr1627/gitbook,haamop/documentation,codepiano/gitbook,gaearon/gitbook,sunlianghua/gitbook,ZachLamb/gitbook,justinleoye/gitbook,tzq668766/gitbook,iflyup/gitbook,hongbinz/gitbook,grokcoder/gitbook,lucciano/gitbook,gencer/gitbook,Keystion/gitbook,athiruban/gitbook,thelastmile/gitbook,webwlsong/gitbook,xiongjungit/gitbook,wewelove/gitbook,2390183798/gitbook,anrim/gitbook,lucciano/gitbook,switchspan/gitbook,wewelove/gitbook,mruse/gitbook,xcv58/gitbook,FKV587/gitbook,intfrr/gitbook,mautic/documentation,codepiano/gitbook,a-moses/gitbook,tshoper/gitbook,escopecz/documentation,guiquanz/gitbook,boyXiong/gitbook,megumiteam/documentation,qingying5810/gitbook,athiruban/gitbook,sudobashme/gitbook,rohan07/gitbook,bradparks/gitbook,palerdot/gitbook,gaearon/gitbook,snowsnail/gitbook,xxxhycl2010/gitbook,FKV587/gitbook,nycitt/gitbook,thelastmile/gitbook,gdbooks/gitbook,justinleoye/gitbook,jasonslyvia/gitbook,jasonslyvia/gitbook,minghe/gitbook,xiongjungit/gitbook,tzq668766/gitbook,alex-dixon/gitbook,ZachLamb/gitbook,iflyup/gitbook,jocr1627/gitbook,escopecz/documentation,webwlsong/gitbook,hongbinz/gitbook,gdbooks/gitbook,xcv58/gitbook,alex-dixon/gitbook,kamyu104/gitbook,a-moses/gitbook,OriPekelman/gitbook,rohan07/gitbook,grokcoder/gitbook,vehar/gitbook,JohnTroony/gitbook,boyXiong/gitbook,minghe/gitbook,sudobashme/gitbook,guiquanz/gitbook,tshoper/gitbook
7e15fe42282c594260e7185760246a50f9ee7e50
lib/socketErrors.js
lib/socketErrors.js
var createError = require('createerror'); var httpErrors = require('httperrors'); var socketCodesMap = require('./socketCodesMap'); var _ = require('lodash'); var SocketError = createError({ name: 'SocketError' }); function createSocketError(errorCode) { var statusCode = socketCodesMap[errorCode] || 'Unknown'; var options = _.defaults({ name: errorCode, code: errorCode, statusCode: statusCode, status: statusCode }, _.omit(httpErrors(statusCode), 'message')); var socketError = createError(options, SocketError); socketErrors[errorCode] = socketError; return socketError; } var socketErrors = module.exports = function (err) { var errorName; if (socketErrors.hasOwnProperty(err.code)) { errorName = err.code; } else { errorName = 'NotSocketError'; } return new socketErrors[errorName](err); }; module.exports.SocketError = SocketError; // create an Unknown error sentinel socketErrors.NotSocketError = createSocketError('NotSocketError'); // create a new socket error for each error code Object.keys(socketCodesMap).forEach(createSocketError);
var createError = require('createerror'); var httpErrors = require('httperrors'); var socketCodesMap = require('./socketCodesMap'); var _ = require('lodash'); var SocketError = createError({ name: 'SocketError' }); function createSocketError(errorCode) { var statusCode = socketCodesMap[errorCode] || 'Unknown'; var options = _.defaults({ name: errorCode, code: errorCode, statusCode: statusCode, status: statusCode }, _.omit(httpErrors(statusCode), 'message')); var socketError = createError(options, SocketError); socketErrors[errorCode] = socketError; return socketError; } var socketErrors = module.exports = function (err) { var errorName; if (socketErrors.hasOwnProperty(err.code)) { errorName = err.code; } else { errorName = 'NotSocketError'; } return new socketErrors[errorName](err); }; // export the base class module.exports.SocketError = SocketError; // create an Unknown error sentinel socketErrors.NotSocketError = createSocketError('NotSocketError'); // create a new socket error for each error code Object.keys(socketCodesMap).forEach(createSocketError);
Add a small comment to an export.
Add a small comment to an export.
JavaScript
bsd-3-clause
alexjeffburke/node-socketerrors
c6594d95ad6a2f694837561df71ec0997ae50fa9
app/reducers/alertMessage.js
app/reducers/alertMessage.js
import _ from 'lodash'; import { OPEN_ALERT_MESSAGE, CLOSE_ALERT_MESSAGE, } from '../actions/actionTypes'; const initialState = { show: false, messages: { th: '', en: '', }, technical: { message: '', code: '', }, }; const getInitialState = () => ({ ...initialState, }); export default (state = getInitialState(), action) => { switch (action.type) { case OPEN_ALERT_MESSAGE: return { ...state, show: true, // messages: action.messages, }; case CLOSE_ALERT_MESSAGE: return getInitialState(); default: return state; } };
import _ from 'lodash'; import { OPEN_ALERT_MESSAGE, CLOSE_ALERT_MESSAGE, } from '../actions/actionTypes'; const initialState = { show: false, title: { th: '', en: '' }, messages: { th: '', en: '', }, technical: { message: '', code: '', }, }; const getInitialState = () => ({ ...initialState, }); export default (state = getInitialState(), action) => { switch (action.type) { case OPEN_ALERT_MESSAGE: return { ...state, show: true, title: action.data.title, messages: action.data.messages, technical: action.data.technical, }; case CLOSE_ALERT_MESSAGE: return getInitialState(); default: return state; } };
Add alert message reducer format
Add alert message reducer format
JavaScript
mit
hlex/vms,hlex/vms
b6296f0ff62ec2a9e8e123c57d2e696b2bbc62c8
test/unit/supported-formulas.js
test/unit/supported-formulas.js
import SUPPORTED_FORMULAS from '../../src/supported-formulas'; describe('.SUPPORTED_FORMULAS', () => { it('should be defined', () => { expect(SUPPORTED_FORMULAS.length).to.eq(391); }); });
import SUPPORTED_FORMULAS from '../../src/supported-formulas'; describe('.SUPPORTED_FORMULAS', () => { it('should be defined', () => { expect(SUPPORTED_FORMULAS.length).to.eq(392); }); });
Update unit test for supported formula
Update unit test for supported formula
JavaScript
mit
kevb/formula-parser,kevb/formula-parser
b9cc15c3e8329b61c0984e9ca70069f9f3e764a7
api/models/Places.js
api/models/Places.js
/** * Places.js * * @description :: TODO: You might write a short summary of how this model works and what it represents here. * @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models */ module.exports = { //connection: 'db_server', //configurations to disale UpdateAt and CreatedAt Waterline Columns tableName: 'places', autoCreatedAt: false, autoUpdatedAt: false, attributes: { id: { type: 'integer', autoIncrement: true, unique: true, primaryKey: true }, company_id: { type: 'integer', required: true }, name: { type: 'string', required: true }, description: { type: 'text', required: true }, created_at: { type: 'datetime' }, updated_at: { type: 'datetime' }, updated_by_user: { type: 'integer', columnName: 'updated_by_user_id', required: true } } };
/** * Places.js * * @description :: TODO: You might write a short summary of how this model works and what it represents here. * @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models */ module.exports = { //connection: 'db_server', //configurations to disale UpdateAt and CreatedAt Waterline Columns tableName: 'places', autoCreatedAt: false, autoUpdatedAt: false, attributes: { id: { type: 'integer', autoIncrement: true, unique: true, primaryKey: true }, company_id: { type: 'integer', required: true }, name: { type: 'string', required: true }, description: { type: 'text' }, created_at: { type: 'datetime' }, updated_at: { type: 'datetime' }, updated_by_user: { type: 'integer', columnName: 'updated_by_user_id', required: true } } };
Refactor [description] property to not require
Refactor [description] property to not require
JavaScript
mit
FernandoPucci/GerPro,FernandoPucci/GerPro
57c466b4ee66259f80be6cd5d1d858051f462118
imports/api/payments/collection.js
imports/api/payments/collection.js
import { Mongo } from 'meteor/mongo'; import moment from 'moment'; const Payments = new Mongo.Collection('payments'); Payments.refund = (orderId) => { if (orderId) { const payment = Payments.findOne({ order_id: orderId }); if (payment && payment.charge.id) { import StripeHelper from '../cards/server/stripe_helper'; StripeHelper.refundCharge(payment.charge.id); } } }; Payments.recentPaymentCompleted = email => Payments.findOne({ email, status: 'completed', timestamp: { $gte: moment().subtract(10, 'minutes').toDate(), }, }); Payments.deny({ insert() { return true; }, update() { return true; }, remove() { return true; }, }); export default Payments;
import { Mongo } from 'meteor/mongo'; import moment from 'moment'; const Payments = new Mongo.Collection('payments'); Payments.refund = (orderId) => { if (orderId) { const payment = Payments.findOne({ order_id: orderId }); if (payment && payment.charge.id) { import StripeHelper from '../cards/server/stripe_helper'; StripeHelper.refundCharge(payment.charge.id); } } }; Payments.recentPaymentCompleted = (email) => { const recentPayments = Payments.find({ email, status: 'completed', timestamp: { $gte: moment().subtract(10, 'minutes').toDate(), }, }, { sort: { timestamp: -1, }, }).fetch(); return recentPayments ? recentPayments[0] : null; }; Payments.deny({ insert() { return true; }, update() { return true; }, remove() { return true; }, }); export default Payments;
Use most recent payment when sending final charged to Shopify
Use most recent payment when sending final charged to Shopify
JavaScript
mit
hwillson/shopify-hosted-payments,hwillson/shopify-hosted-payments
a7e8bb0e37d1981bb287345c5ab575cedd1b4708
test/integration/endpoints.js
test/integration/endpoints.js
var fs = require('fs'), fileModule = require('file'), testDir = '/tests', testFileName = 'integration_test.js'; process.env.INTEGRATION = true; describe('endpoint', function() { it('should load the server and set everything up properly',function(done){ this.timeout(1000); //Server should not take more than 1 sek to boot var app = require(process.cwd() + '/server'); app.on('ready',function(){ fileModule.walkSync('./endpoints', function(dirPath, dirs, files){ if (dirPath.indexOf(testDir) < 0) return; files.forEach(function(file){ if (file != testFileName) return; var path = dirPath + '/' + file; if (!fs.existsSync(path)) return; require('../../' + path); }); }); done(); }); }); });
var fs = require('fs'), path = require('path'), fileModule = require('file'), testDir = '/tests', testFileName = 'integration_test.js'; process.env.INTEGRATION = true; describe('endpoint', function() { it('should load the server and set everything up properly',function(done){ this.timeout(1000); //Server should not take more than 1 sek to boot var app = require(process.cwd() + '/server'); app.on('ready',function(){ fileModule.walkSync('./endpoints', function(dirPath, dirs, files){ if (dirPath.indexOf(testDir) < 0) return; files.forEach(function(file){ if (file != testFileName) return; var fullPath = dirPath + '/' + file; if (!fs.existsSync(fullPath)) return; if (path.extname(fullPath) !== '.js') return; require('../../' + fullPath); }); }); done(); }); }); });
Check the file extension before requiring a test.
Check the file extension before requiring a test. My vim swap files kept getting caught in the test runner so I made the change to only load up .js files.
JavaScript
mit
apis-is/apis
ad926871ed5df6e2d7e22e99236cd615ce713e2d
git-deploy.js
git-deploy.js
// include flightplan.js var plan = require('flightplan'); // Plan to git deploy via ssh remote plan.remote('gitDeploy', function(remote) { var webRoot = plan.runtime.options.webRoot; // git pull remote.with('cd ' + webRoot, function() { remote.exec('git pull'); }); });
module.exports = function () { /* @method remotGitDeploy Takes a flightplan instance and transport @param remote {Object} Flightplan transport instance @param webRoot {string} path to run git pull on the remote server e.g. /var/www/project */ var remotGitDeploy = function (remote, webRoot) { // git pull remote.with('cd ' + webRoot, function() { remote.exec('git pull'); }); }; /* @method addToPlan Takes a flightplan instance and adds a task called gitDeploy @param plan {Object} Flightplan instance @param plan.runtime.options.webRoot {String} Remote path to run git pull */ var addToPlan = function (plan) { // Plan to git deploy via ssh remote var webRoot = plan.runtime.options.webRoot; plan.remote('gitDeploy', function(remote) { remoteGitDeploy(remote, webRoot); }); }; return { addToPlan: addToPlan, remoteGitDeploy: remoteGitDeploy }; }
Update module to return two different methods for adding the deploy script
Update module to return two different methods for adding the deploy script
JavaScript
mit
grahamgilchrist/flightplan-git-deploy
88be0d0fa047a6b7e9b13db8c59683db85e6794a
app/scripts/themes.js
app/scripts/themes.js
angular.module('GLClient.themes', []) .factory('Templates', function() { var selected_theme = 'default'; return { 'home': 'templates/' + selected_theme + '/views/home.html', 'about': 'templates/' + selected_theme + '/views/about.html', 'status': 'templates/' + selected_theme + '/views/status.html', 'submission': { 'form': 'templates/' + selected_theme + '/views/submission/form.html', 'main': 'templates/' + selected_theme + '/views/submission/main.html' } }; } );
angular.module('GLClient.themes', []) .factory('Templates', function() { // XXX do not add the "default" string to this file as it is used by // build-custom-glclient.sh for matching. var selected_theme = 'default'; return { 'home': 'templates/' + selected_theme + '/views/home.html', 'about': 'templates/' + selected_theme + '/views/about.html', 'status': 'templates/' + selected_theme + '/views/status.html', 'submission': { 'form': 'templates/' + selected_theme + '/views/submission/form.html', 'main': 'templates/' + selected_theme + '/views/submission/main.html' } }; } );
Add note about quirk related to build-custom-glclient.sh
Add note about quirk related to build-custom-glclient.sh
JavaScript
agpl-3.0
vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks
72048194677c0ac8c0276c1066e816d31ed43cb5
test/test-creation.js
test/test-creation.js
/*global describe, beforeEach, it*/ 'use strict'; var path = require('path'); var helpers = require('yeoman-generator').test; describe('plugin generator', function () { beforeEach(function (done) { helpers.testDirectory(path.join(__dirname, 'temp'), function (err) { if (err) { return done(err); } this.app = helpers.createGenerator('plugin:app', [ '../../app' ]); done(); }.bind(this)); }); it('creates expected files', function (done) { var expected = [ // add files you expect to exist here. '.jshintrc', '.editorconfig' ]; helpers.mockPrompt(this.app, { 'someOption': true }); this.app.options['skip-install'] = true; this.app.run({}, function () { helpers.assertFiles(expected); done(); }); }); });
/*global describe, beforeEach, it*/ 'use strict'; var path = require('path'); var helpers = require('yeoman-generator').test; describe('plugin generator', function () { beforeEach(function (done) { helpers.testDirectory(path.join(__dirname, 'temp'), function (err) { if (err) { return done(err); } this.app = helpers.createGenerator('plugin:app', [ '../../app' ]); done(); }.bind(this)); }); it('creates expected files', function (done) { var expected = [ // add files you expect to exist here. '.jshintrc', '.editorconfig', '.gitignore', '.npmignore', 'LICENSE-MIT', 'bower.json', 'test/main.js', 'index.js' ]; helpers.mockPrompt(this.app, { pluginName: 'myPlugin', fullName: 'assemble-plugin-myPlugin', description: 'The best plugin ever', user: 'assemble', stages: ['render:after:pages'], homepage: 'https://github.com/assemble/assemble-plugin-myPlugin', repositoryUrl: 'https://github.com/assemble/assemble-plugin-myPlugin.git', bugUrl: 'https://github.com/assemble/assemble-plugin-myPlugin/issues', licenseType: 'MIT', licenseUrl: 'https://github.com/assemble/assemble-plugin-myPlugin/blob/master/LICENSE-MIT', contributors: 'assemble' }); this.app.options['skip-install'] = true; this.app.run({}, function () { helpers.assertFile(expected); done(); }); }); });
Update test mockPromt and expected
Update test mockPromt and expected
JavaScript
mit
assemble/generator-plugin
6e81e98a48eeb01bf69e89c3192c48424f364f51
examples/playground/webpack.config.js
examples/playground/webpack.config.js
var webpack = require('webpack') module.exports = { context: __dirname, entry: [ "./index", "webpack-dev-server/client?http://localhost:8080", "webpack/hot/only-dev-server", ], output: { path: __dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ test: /\.khufu$/, loaders: ['babel', '../../src/loader'], exclude: /node_modules/, }, { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/, }], }, resolve: { modulesDirectories: ["/usr/local/lib/node_modules", "../.."], }, resolveLoader: { modulesDirectories: ["/usr/local/lib/node_modules"], }, devServer: { contentBase: '.', hot: true, }, khufu: { static_attrs: false, // for normal hot reload }, plugins: [ new webpack.NoErrorsPlugin(), ], }
var webpack = require('webpack') var DEV = process.env['NODE_ENV'] != 'production'; module.exports = { context: __dirname, entry: DEV ? [ "./index", "webpack-dev-server/client?http://localhost:8080", "webpack/hot/only-dev-server", ] : "./index", output: { path: __dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ test: /\.khufu$/, loaders: ['babel', '../../src/loader'], exclude: /node_modules/, }, { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/, }], }, resolve: { modulesDirectories: ["/usr/local/lib/node_modules", "../.."], }, resolveLoader: { modulesDirectories: ["/usr/local/lib/node_modules"], }, devServer: { contentBase: '.', hot: true, }, khufu: { static_attrs: !DEV, }, plugins: [ new webpack.NoErrorsPlugin(), ], }
Add non-hot-reload build support for playground
Add non-hot-reload build support for playground
JavaScript
apache-2.0
tailhook/khufu
e212a38b3032b1ad19debbb5d7b3b183cc6b9670
webapp/routes/temperature_api.js
webapp/routes/temperature_api.js
'use strict'; const router = require('express').Router(); const temperatureapi = require('../api/temperature'); const requiresApiAuthorization = require('../auth/requiresApiAuthorization'); router.get('/api/temperature/currentTemperature', requiresApiAuthorization(), temperatureapi.getCurrentTemperature); module.exports = router;
'use strict'; const router = require('express').Router(); const temperatureapi = require('../api/temperature'); const requiresApiAuthorization = require('../auth/requiresApiAuthorization'); const auth = require('../auth/Authentication'); router.get('/api/temperature/currentTemperature', requiresApiAuthorization(), temperatureapi.getCurrentTemperature); router.get('/api/temperature/', auth.getBearerHandler(), temperatureapi.getCurrentTemperature); module.exports = router;
Add token authenticated temperature route
Add token authenticated temperature route
JavaScript
apache-2.0
rossharper/raspberrysauce,rossharper/raspberrysauce
1d92056ea7405c5d8d9da577c2baf5d581236bf1
src/server/lib/findFilePath.js
src/server/lib/findFilePath.js
import path from "path"; import config from "config"; export default function findPath(configName) { let configRoot = process.env.FILE_PATH || "files"; if (config.paths && config.paths.files) { configRoot = config.paths.files; } let configPath = path.join(configRoot, configName); if (config.paths && config.paths[configName]) { configPath = config.paths[configName]; } if (configPath[0] !== "/") { configPath = path.join(__dirname, "..", "..", "..", configPath); } return configPath; }
import path from "path"; import config from "config"; export default function findPath(configName) { const configRoot = process.env.FILE_PATH || "files"; let configPath = path.join(configRoot, configName); if (config.paths && config.paths[configName]) { configPath = config.paths[configName]; } if (configPath[0] !== "/") { configPath = path.join(__dirname, "..", "..", "..", configPath); } return configPath; }
Fix shared file path config reading
Fix shared file path config reading
JavaScript
agpl-3.0
strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs
6b50ec716db9b529220500a1ae3d5db2e80f1d83
ci/tagElmRelease.js
ci/tagElmRelease.js
const execSync = require('child_process').execSync; /** A semantic release "publish" plugin to create git tags and publish using elm-package */ async function tagElmRelease(config, context) { const newVersion = context.nextRelease.version; exec(`git tag -a ${newVersion} -m "elm-package release ${newVersion}"`); exec(`git push --tags`); exec(`elm-package publish`); } function exec(command, context) { context.logger.log(`Running: ${command}`); execSync(command); } module.exports = tagElmRelease;
const execSync = require('child_process').execSync; /** A semantic release "publish" plugin to create git tags and publish using elm-package */ async function tagElmRelease(config, context) { function exec(command) { context.logger.log(`Running: ${command}`); execSync(command); } const newVersion = context.nextRelease.version; exec(`git tag -a ${newVersion} -m "elm-package release ${newVersion}"`); exec(`git push --tags`); exec(`elm-package publish`); } module.exports = tagElmRelease;
Fix error with elm deployments
fix(ci): Fix error with elm deployments Note: this update does not change any user facing code and is related to our continuous integration / semantic release process only. I am tagging it as "fix" so we can continue to test the release process.
JavaScript
bsd-3-clause
cultureamp/elm-css-modules-loader,cultureamp/elm-css-modules-loader
0d4f743d87898f101d47a733572f55eae1128be9
lib/actions/upload-actions.js
lib/actions/upload-actions.js
// @flow import type { FetchJSON } from '../utils/fetch-json'; import type { UploadMultimediaResult } from '../types/media-types'; async function uploadMultimedia( fetchJSON: FetchJSON, multimedia: Object, onProgress: (percent: number) => void, abortHandler: (abort: () => void) => void, ): Promise<UploadMultimediaResult> { const response = await fetchJSON( 'upload_multimedia', { multimedia }, { blobUpload: true, onProgress, abortHandler }, ); return { id: response.id, uri: response.uri }; } const assignMediaServerIDToMessageActionType = "ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE"; const assignMediaServerURIToMessageActionType = "ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE"; export { uploadMultimedia, assignMediaServerIDToMessageActionType, assignMediaServerURIToMessageActionType, };
// @flow import type { FetchJSON } from '../utils/fetch-json'; import type { UploadMultimediaResult } from '../types/media-types'; async function uploadMultimedia( fetchJSON: FetchJSON, multimedia: Object, onProgress: (percent: number) => void, abortHandler: (abort: () => void) => void, ): Promise<UploadMultimediaResult> { const response = await fetchJSON( 'upload_multimedia', { multimedia: [ multimedia ] }, { blobUpload: true, onProgress, abortHandler }, ); return { id: response.id, uri: response.uri }; } const assignMediaServerIDToMessageActionType = "ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE"; const assignMediaServerURIToMessageActionType = "ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE"; export { uploadMultimedia, assignMediaServerIDToMessageActionType, assignMediaServerURIToMessageActionType, };
Fix bug in multimedia upload
[lib] Fix bug in multimedia upload `uploadBlob` expects an array of multimedia, not a single one.
JavaScript
bsd-3-clause
Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal
c1893a257a0685934607946f4c24758796eb74bf
lib/formatters/codeclimate.js
lib/formatters/codeclimate.js
'use strict'; module.exports = function (err, data) { if (err) { return 'Debug output: %j' + JSON.stringify(data) + '\n' + JSON.stringify(err); } if (!data.length) { return; } var returnString = ''; for (var i = 0, il = data.length; i < il; ++i) { returnString += JSON.stringify({ type: 'issue', check_name: 'Vulnerable module "' + data[i].module + '" identified', description: '`' + data[i].module + '` ' + data[i].title, categories: ['Security'], remediation_points: 300000, content: { body: data[i].content }, location: { path: 'npm-shrinkwrap.json', lines: { begin: data[i].line.start, end: data[i].line.end } } }) + '\0\n'; } return returnString; };
'use strict'; module.exports = function (err, data) { if (err) { return err.stack; } if (!data.length) { return; } var returnString = ''; for (var i = 0, il = data.length; i < il; ++i) { returnString += JSON.stringify({ type: 'issue', check_name: 'Vulnerable module "' + data[i].module + '" identified', description: '`' + data[i].module + '` ' + data[i].title, categories: ['Security'], remediation_points: 300000, content: { body: data[i].content }, location: { path: 'npm-shrinkwrap.json', lines: { begin: data[i].line.start, end: data[i].line.end } } }) + '\0\n'; } return returnString; };
Return error message in Code Climate runs
Return error message in Code Climate runs Stringifying an Error object results in {} so the formatter was not returning the actual underlying error with the Code Climate formatter. This change returns the error so that they user can take action if an analysis run fails. This change returns the Error stack which includes a helpful error message and the backtrace for debugging purposes.
JavaScript
apache-2.0
requiresafe/cli,chetanddesai/nsp,nodesecurity/nsp,ABaldwinHunter/nsp-classic,ABaldwinHunter/nsp
1588f4b832ba791ce295c2367c92b7607817fa48
lib/atom-dataset-provider/options.js
lib/atom-dataset-provider/options.js
/*:tabSize=2:indentSize=2:noTabs=true:mode=javascript:*/ var commander = require('commander'), path = require('path'); var version = JSON.parse(require('fs') .readFileSync(path.join(__dirname, '..', '..', 'package.json'))) .version; var stringToPattern = function(strPattern) { if (strPattern.charAt(0) == '/') strPattern = strPattern.slice(1, strPattern.length-1); return new RegExp(strPattern); }; var Options = function() { return (new commander.Command) .version(version) .option('-d, --directory <dir>', '<dir> to monitor', '.') .option('-p, --port <port>', '<port> to serve on', parseInt, 4000) .option('--title <title>', '<title> for feed', require('os').hostname()) .option('--group-pattern <pattern>', '<pattern> with capture to group by. eg. /^(.*)\.\w+$/', stringToPattern, /^(.*)\.\w+$/); } exports = module.exports = Options;
/*:tabSize=2:indentSize=2:noTabs=true:mode=javascript:*/ var commander = require('commander'), path = require('path'); var version = JSON.parse(require('fs') .readFileSync(path.join(__dirname, '..', '..', 'package.json'))) .version; var stringToPattern = function(strPattern) { if (strPattern.charAt(0) == '/') strPattern = strPattern.slice(1, strPattern.length-1); return new RegExp(strPattern); }; var Options = function() { return (new commander.Command) .version(version) .option('-d, --directory <dir>', '<dir> to monitor', '.') .option('-p, --port <port>', '<port> to serve on', parseInt, 4000) .option('--title <title>', '<title> for feed', require('os').hostname()) .option('--group-pattern <pattern>', '<pattern> with capture to group by. eg. /^(.*)\\.\\w+$/', stringToPattern, /^(.*)\.\w+$/); } exports = module.exports = Options;
Correct minor typo in group-pattern help.
Correct minor typo in group-pattern help.
JavaScript
mit
tjdett/atom-dataset-provider
5d4ee69a7d577d2906b08d228bd883afbb22caae
config.js
config.js
export default { "url": process.env.CRN_SERVER_URL, "port": 8111, "location": process.env.CRN_SERVER_LOCATION, "headers": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE", "Access-Control-Allow-Headers": "content-type, Authorization" }, "scitran": { "url": "http://localhost:8110/api/", "secret": process.env.SCITRAN_CORE_DRONE_SECRET, "fileStore": process.env.CRN_SERVER_CORE_FILE_STORE }, "agave": { "url": process.env.CRN_SERVER_AGAVE_URL, "username": process.env.CRN_SERVER_AGAVE_USERNAME, "password": process.env.CRN_SERVER_AGAVE_PASSWORD, "clientName": process.env.CRN_SERVER_AGAVE_CLIENT_NAME, "clientDescription": process.env.CRN_SERVER_AGAVE_CLIENT_DESCRIPTION, "consumerKey": process.env.CRN_SERVER_AGAVE_CONSUMER_KEY, "consumerSecret": process.env.CRN_SERVER_AGAVE_CONSUMER_SECRET, "storage": process.env.CRN_SERVER_AGAVE_STORAGE }, "mongo": { "url": "mongodb://localhost:27017/crn" } };
let config = { "url": process.env.CRN_SERVER_URL, "port": 8111, "location": process.env.CRN_SERVER_LOCATION, "headers": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE", "Access-Control-Allow-Headers": "content-type, Authorization" }, "scitran": { "url": "http://localhost:8110/api/", "secret": process.env.SCITRAN_CORE_DRONE_SECRET, "fileStore": process.env.CRN_SERVER_CORE_FILE_STORE }, "agave": { "url": process.env.CRN_SERVER_AGAVE_URL, "username": process.env.CRN_SERVER_AGAVE_USERNAME, "password": process.env.CRN_SERVER_AGAVE_PASSWORD, "clientName": process.env.CRN_SERVER_AGAVE_CLIENT_NAME, "clientDescription": process.env.CRN_SERVER_AGAVE_CLIENT_DESCRIPTION, "consumerKey": process.env.CRN_SERVER_AGAVE_CONSUMER_KEY, "consumerSecret": process.env.CRN_SERVER_AGAVE_CONSUMER_SECRET, "storage": process.env.CRN_SERVER_AGAVE_STORAGE }, "mongo": { "url": "mongodb://localhost:27017/crn" } }; console.log(config); export default config;
Add logging for docker debugging
Add logging for docker debugging
JavaScript
mit
poldracklab/crn_server,poldracklab/crn_server
70405b476543b96bbeeb3299ac83c3ffd9aa86be
lib/honyomi/web/public/js/honyomi.js
lib/honyomi/web/public/js/honyomi.js
$(document).ready(function() { $('.star').click(function() { // Toggle a display of star $(this).toggleClass('favorited'); var isFavorited = $(this).hasClass('favorited'); // Get a page info var id = $(this).attr('honyomi-id'); var page_no = $(this).attr('honyomi-page-no'); // ajax $.post( '/command', { kind: 'favorite', id: id, page_no: page_no, favorited: isFavorited }, function(data) { // Return a result of POST } ); }); });
$(document).ready(function() { $(document).on('click', '.star', function(e) { // Toggle a display of star $(this).toggleClass('favorited'); var isFavorited = $(this).hasClass('favorited'); // Get a page info var id = $(this).attr('honyomi-id'); var page_no = $(this).attr('honyomi-page-no'); // ajax $.post( '/command', { kind: 'favorite', id: id, page_no: page_no, favorited: isFavorited }, function(data) { // Return a result of POST } ); e.preventDefault(); }); });
Support the AutoPagerize in the click event
Support the AutoPagerize in the click event
JavaScript
mit
ongaeshi/honyomi,ongaeshi/honyomi,ongaeshi/honyomi
a50bbdcd25e3618112f6515ca64fc2c6fa67f1c3
front_end/app/screens/ShoppingList.js
front_end/app/screens/ShoppingList.js
import React, {Component} from 'react'; import { View, Text, ScrollView, Button } from 'react-native'; import axios from 'axios'; import colors from '../config/colors'; import { UserItem } from '../components/UserItem'; class ShoppingList extends Component { constructor(props) { super(props); this.state = { userItems: [] }; this.getUserItems = this.getUserItems.bind(this); this.handleButtonPress = this.handleButtonPress.bind(this); } componentDidMount() { this.getUserItems(); } getUserItems() { axios.get('http://localhost:3000/user_items') .then(response => { this.setState({userItems: response.data}) }) .catch(error => { console.log(error); }); } handleButtonPress() { this.props.navigation.navigate('PickStop'); }; render() { return ( <View style={{ backgroundColor: colors.background }}> <ScrollView style={{ backgroundColor: colors.background}}> {this.state.userItems.map((userItem, idx) => ( <UserItem user_item={userItem} getUserItems={this.getUserItems} key={idx} /> ))} </ScrollView> <Button onPress={() => this.handleButtonPress()} title="Find Yo' Stop!" color={colors.buttonText} backgroundColor={colors.buttonBackground} accessibilityLabel="Find Your Stop for One Stop Shopping" style={{height: 600}} /> </View> ); } } export default ShoppingList;
import React, {Component} from 'react'; import { View, Text, ScrollView } from 'react-native'; import { Button } from 'native-base'; import axios from 'axios'; import colors from '../config/colors'; import { UserItem } from '../components/UserItem'; class ShoppingList extends Component { constructor(props) { super(props); this.state = { userItems: [] }; this.getUserItems = this.getUserItems.bind(this); this.handleButtonPress = this.handleButtonPress.bind(this); } componentDidMount() { this.getUserItems(); } getUserItems() { axios.get('http://localhost:3000/user_items') .then(response => { this.setState({userItems: response.data}) }) .catch(error => { console.log(error); }); } handleButtonPress() { this.props.navigation.navigate('PickStop'); }; render() { return ( <View style={{ backgroundColor: colors.background }}> <ScrollView style={{ backgroundColor: colors.background}}> {this.state.userItems.map((userItem, idx) => ( <UserItem user_item={userItem} getUserItems={this.getUserItems} key={idx} /> ))} </ScrollView> <Button full onPress={() => this.handleButtonPress()}> <Text>Find Yo' Stop!</Text> </Button> </View> ); } } export default ShoppingList;
Add button full component to shopping list
Add button full component to shopping list
JavaScript
mit
DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop
8a81c825a2687f988cd231f458fbc16d39e7c3fa
frontend/app/routes/questions/show.js
frontend/app/routes/questions/show.js
import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { return this.store.find('question', params.id); } });
import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { return this.store.find('question', params.id); }, actions: { didTransition: function() { this.get('controller').set('isEditing', false); } } });
Reset controller state on didTransition
Reset controller state on didTransition
JavaScript
mit
LaunchAcademy/rescue_mission,LaunchAcademy/rescue_mission,LaunchAcademy/rescue_mission
00b8cf436ea49f4939d1c0790ac19789f713153f
js/app.js
js/app.js
import React from "react"; import { render } from "react-dom"; import { applyRouterMiddleware, Router, Route, browserHistory, IndexRoute } from "react-router"; import { useScroll } from 'react-router-scroll'; import App from "./components/App.react"; import TagList from "./components/TagList.react"; import NotFound from "./components/NotFound"; import PluginList from "./components/PluginList.react"; import { syncHistoryWithStore } from "react-router-redux"; import store from "./stores/CreateStore"; import { Provider } from "react-redux"; import "whatwg-fetch"; import Css from "../css/main.css"; import Tags from "./tags"; const history = syncHistoryWithStore(browserHistory, store); var routes = ( <Router history={history} render={applyRouterMiddleware(useScroll())}> <Route path="/" component={App}> <IndexRoute component={TagList} /> { Tags.map((tag) => <Route key={tag} path={`tag/${tag}`} component={PluginList} tag={tag} />) } <Route path="*" component={NotFound} /> </Route> </Router> ) render( <Provider store={store}> {routes} </Provider>, document.getElementById('app') );
import React from "react"; import { render } from "react-dom"; import { applyRouterMiddleware, Router, Route, browserHistory, IndexRoute } from "react-router"; import { useScroll } from 'react-router-scroll'; import App from "./components/App.react"; import TagList from "./components/TagList.react"; import NotFound from "./components/NotFound"; import PluginList from "./components/PluginList.react"; import { syncHistoryWithStore } from "react-router-redux"; import store from "./stores/CreateStore"; import { Provider } from "react-redux"; import "whatwg-fetch"; import globalStyes from './global-styles'; import Tags from "./tags"; const history = syncHistoryWithStore(browserHistory, store); var routes = ( <Router history={history} render={applyRouterMiddleware(useScroll())}> <Route path="/" component={App}> <IndexRoute component={TagList} /> { Tags.map((tag) => <Route key={tag} path={`tag/${tag}`} component={PluginList} tag={tag} />) } <Route path="*" component={NotFound} /> </Route> </Router> ) render( <Provider store={store}> {routes} </Provider>, document.getElementById('app') );
Remove css import, add global styles
Remove css import, add global styles
JavaScript
mit
mxstbr/postcss.parts,mxstbr/postcss.parts
7d49a20492e4a92afb07c194195856292b72a589
lib/modules/storage/utils/omit_undefined.js
lib/modules/storage/utils/omit_undefined.js
import _ from 'lodash'; function omitUndefined(obj) { const result = {}; _.forOwn(obj, function(value, key) { if (_.isPlainObject(value)) { result[key] = omitUndefined(value); } else if (!_.isUndefined(value)) { result[key] = value; } }); return result; } export default omitUndefined;
import _ from 'lodash'; function omitUndefined(obj) { return _.transform(obj, function(result, value, key) { if (_.isPlainObject(value)) { result[key] = omitUndefined(value); } else if (!_.isUndefined(value)) { result[key] = value; } }); } export default omitUndefined;
Use _.transform instead of _.reduce
Use _.transform instead of _.reduce
JavaScript
mit
jagi/meteor-astronomy
72f827e84ba5e696d0bacdb8b900018c7a51dc55
main-process/native-ui/dialogs/open-file.js
main-process/native-ui/dialogs/open-file.js
var ipc = require('electron').ipcMain; var dialog = require('electron').dialog; module.exports.setup = function () { ipc.on('open-file-dialog', function (event) { var files = dialog.showOpenDialog({properties: ['openFile', 'openDirectory']}); if (files) { event.sender.send('selected-directory', files); } }); };
var ipc = require('electron').ipcMain; var dialog = require('electron').dialog; module.exports.setup = function () { ipc.on('open-file-dialog', function (event) { dialog.showOpenDialog({properties: ['openFile', 'openDirectory']}, function (files) { if (files) { event.sender.send('selected-directory', files); } }); }); };
Use callback for dialog API
Use callback for dialog API
JavaScript
mit
PanCheng111/XDF_Personal_Analysis,PanCheng111/XDF_Personal_Analysis,blep/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,blep/electron-api-demos,electron/electron-api-demos,PanCheng111/XDF_Personal_Analysis
6c2e22850f428e208acda085417e54bc911b3ddb
config/policies.js
config/policies.js
/** * Policy Mappings * (sails.config.policies) * * Policies are simple functions which run **before** your controllers. * You can apply one or more policies to a given controller, or protect * its actions individually. * * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed * below by its filename, minus the extension, (e.g. "authenticated") * * For more information on how policies work, see: * http://sailsjs.org/#!/documentation/concepts/Policies * * For more information on configuring policies, check out: * http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.policies.html */ module.exports.policies = { // Default behavior request authentication '*': ['jwtAuth', false], // Public routes AuthController: { ipLogin: true, oauthLogin: true, oauthLoginSubmit: true, jwtLogin: true, }, // Authenticated routes MessageController: { find: ['jwtAuth'], findOne: ['jwtAuth'], create: ['jwtAuth'], getChannels: ['jwtAuth'], }, };
/** * Policy Mappings * (sails.config.policies) * * Policies are simple functions which run **before** your controllers. * You can apply one or more policies to a given controller, or protect * its actions individually. * * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed * below by its filename, minus the extension, (e.g. "authenticated") * * For more information on how policies work, see: * http://sailsjs.org/#!/documentation/concepts/Policies * * For more information on configuring policies, check out: * http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.policies.html */ module.exports.policies = { // Default behavior request authentication '*': ['jwtAuth', false], // Public routes AuthController: { ipLogin: true, oauthLogin: true, oauthLoginSubmit: true, jwtLogin: true, }, // Authenticated routes MessageController: { find: ['jwtAuth'], create: ['jwtAuth'], getChannels: ['jwtAuth'], }, };
Remove old route from config
Remove old route from config
JavaScript
mit
ungdev/flux2-server,ungdev/flux2-server,ungdev/flux2-server
e3d2f266ed07b9a98f3a076d0684877e1d141970
config/policies.js
config/policies.js
/** * Policies are simply Express middleware functions which run before your controllers. * You can apply one or more policies for a given controller or action. * * Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder, * at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`) * * For more information on policies, check out: * http://sailsjs.org/#documentation */ module.exports.policies = { // Default policy for all controllers and actions // (`true` allows public access) '*': true, GroupController: { '*': 'authenticated' }, MainController: { 'dashboard': 'authenticated' }, RoomController: { '*': 'authenticated' }, UserController: { '*': 'authenticated', 'create': true } };
/** * Policies are simply Express middleware functions which run before your controllers. * You can apply one or more policies for a given controller or action. * * Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder, * at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`) * * For more information on policies, check out: * http://sailsjs.org/#documentation */ module.exports.policies = { // Default policy for all controllers and actions // (`true` allows public access) '*': true, GroupController: { '*': 'authenticated', 'create': ['authenticated', 'admin'], 'manage': ['authenticated', 'admin'], 'user_add': ['authenticated', 'admin'], 'user_delete': ['authenticated', 'admin'], 'destroy': ['authenticated', 'admin'] }, MainController: { 'dashboard': 'authenticated' }, MessageController: { '*': 'authenticated' }, RoomController: { '*': 'authenticated', 'create': ['authenticated', 'admin'], 'manage': ['authenticated', 'admin'], 'destroy': ['authenticated', 'admin'] }, UserController: { '*': 'authenticated', 'manage': ['authenticated', 'admin'], 'create': true } };
Attach admin policy to actions which create or destroy groups, rooms, or users.
Attach admin policy to actions which create or destroy groups, rooms, or users. Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
JavaScript
mit
maxfierke/WaterCooler
0f21e7aed83f547ced598a9d6c869b7814686eb5
init/rollup.config.js
init/rollup.config.js
const rollupBabel = require('rollup-plugin-babel'); const rollupCommonjs = require('rollup-plugin-commonjs'); const rollupNodeResolve = require('rollup-plugin-node-resolve'); const rollupUglify = require('rollup-plugin-uglify'); const path = require('path'); const pkg = require(path.join(process.cwd(), 'package.json')); const shouldMinify = process.argv.indexOf('--min') !== -1; const presetEs2015 = require('babel-preset-es2015-rollup'); const babel = rollupBabel({ presets: presetEs2015, }); const plugins = [ babel, rollupCommonjs(), rollupNodeResolve(), ]; if (shouldMinify) { plugins.push(rollupUglify()); } const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js'; const moduleName = pkg['build:global'] || pkg.name; module.exports = { dest: `dist/index${shouldMinify ? '.min' : ''}.js`, entry, exports: 'named', format: 'umd', moduleName, plugins, sourceMap: true, useStrict: false, };
const rollupBabel = require('rollup-plugin-babel'); const rollupCommonjs = require('rollup-plugin-commonjs'); const rollupNodeResolve = require('rollup-plugin-node-resolve'); const rollupUglify = require('rollup-plugin-uglify'); const path = require('path'); const pkg = require(path.join(process.cwd(), 'package.json')); const shouldMinify = process.argv.indexOf('--min') !== -1; const presetEs2015 = require('babel-preset-es2015-rollup'); const babel = rollupBabel({ presets: presetEs2015, }); const plugins = [ babel, rollupCommonjs(), rollupNodeResolve(), ]; if (shouldMinify) { plugins.push(rollupUglify()); } const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js'; const moduleName = pkg['build:global'] || pkg.name; module.exports = { dest: 'dist/index' + (shouldMinify ? '.min' : '') + '.js', entry, exports: 'named', format: 'umd', moduleName, plugins, sourceMap: true, useStrict: false, };
Fix template literal issue with underscore templates.
fix(build): Fix template literal issue with underscore templates.
JavaScript
mit
skatejs/build,skatejs/build
bee126e3d4db9860e095f35a3c60b7b94f05b024
blacklisted-sites.js
blacklisted-sites.js
// Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible. // Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py var BLACKLIST = [ 'github', 'agolo.com', 'youtube', 'youtu.be', 'atlassian.net', 'spotify.com', 'twitter.com', 'mail.google', 'imgur.com', 'bit.ly', 'tinyurl', 'vine', 'dropbox' ]; /** Convert the array to an object and export it **/ var empty = {}; // Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object var reducer = function(aggregate, element) { aggregate[element] = 1; return aggregate; } module.exports = BLACKLIST.reduce(reducer, empty);
// Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible. // Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py var BLACKLIST = [ 'github', 'agolo.com', 'youtube', 'youtu.be', 'atlassian.net', 'spotify.com', 'twitter.com', 'mail.google', 'imgur.com', 'bit.ly', 'tinyurl', 'vine', 'dropbox', 'zoom.us', 'appear.in' ]; /** Convert the array to an object and export it **/ var empty = {}; // Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object var reducer = function(aggregate, element) { aggregate[element] = 1; return aggregate; } module.exports = BLACKLIST.reduce(reducer, empty);
Add zoom.us and appear.in to blacklist
Add zoom.us and appear.in to blacklist
JavaScript
mit
premgane/agolo-slackbot
884455a7aa3cc8f8a6f1d6f9ca28faa597b4993f
ipwb/serviceWorker.js
ipwb/serviceWorker.js
/* eslint-env serviceworker */ // This makes a module available named "reconstructive" importScripts('reconstructive.js') // Customize configs (defaults should work for IPWB out of the box) // reconstructive.init({ // version: 'reconstructive.js:v1', // urimPattern: self.location.origin + '/memento/<datetime>/<urir>', // showBanner: false // }) // Add any custom exclusions or modify or delete default ones //> reconstructive.exclusions //< { //< notGet: f (event, config), //< localResource: f (event, config) //< } reconstructive.exclusions.selfScript = function (event, config) { event.request.url.endsWith('reconstructive.js') } // Pass a custom function to generate banner markup // reconstructive.bannerCreator(f (event, rewritten, config)) // Or update the rewriting logic // reconstructive.updateRewriter(f (event, rewritten, config)) // This is unnecessary, but can be useful for debugging or in future self.addEventListener('install', function (event) { console.log('Installing ServiceWorker.') }) // This is unnecessary, but can be useful for debugging or in future self.addEventListener('activate', function (event) { console.log('Activating ServiceWorker.') }) self.addEventListener("fetch", function(event) { console.log('A fetch event triggered:', event); // Add any custom logic here to conditionally call the reroute function reconstructive.reroute(event); })
/* eslint-env serviceworker */ // This makes a module available named "reconstructive" importScripts('/reconstructive.js') // Customize configs (defaults should work for IPWB out of the box) // reconstructive.init({ // version: 'reconstructive.js:v1', // urimPattern: self.location.origin + '/memento/<datetime>/<urir>', // showBanner: false // }) // Add any custom exclusions or modify or delete default ones //> reconstructive.exclusions //< { //< notGet: f (event, config), //< localResource: f (event, config) //< } reconstructive.exclusions.selfScript = function (event, config) { event.request.url.endsWith('reconstructive.js') } // Pass a custom function to generate banner markup // reconstructive.bannerCreator(f (event, rewritten, config)) // Or update the rewriting logic // reconstructive.updateRewriter(f (event, rewritten, config)) // This is unnecessary, but can be useful for debugging or in future self.addEventListener('install', function (event) { console.log('Installing ServiceWorker.') }) // This is unnecessary, but can be useful for debugging or in future self.addEventListener('activate', function (event) { console.log('Activating ServiceWorker.') }) self.addEventListener("fetch", function(event) { console.log('A fetch event triggered:', event); // Add any custom logic here to conditionally call the reroute function reconstructive.reroute(event); })
Load reconstructive.js using an absolute path
Load reconstructive.js using an absolute path
JavaScript
mit
oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb
2b5bd27f0323428e6814b202fefbfb774be97256
lib/engines/scss.js
lib/engines/scss.js
'use strict'; var Engine = require('./engine'); var herit = require('herit'); var path = require('path'); module.exports = herit(Engine, { defaults: function () { return { paths: [], indentedSyntax: false }; }, run: function (asset, cb) { try { var sass = require('node-sass'); sass.render({ data: asset.source, indentedSyntax: this.options.indentedSyntax, includePaths: this.options.paths.concat(path.dirname(asset.abs)), success: function (res) { asset.source = res.css; if (!asset.ext()) asset.exts.push('css'); cb(); }, error: function (er) { cb(new Error(er)); } }); } catch (er) { cb(er); } } });
'use strict'; var Engine = require('./engine'); var herit = require('herit'); var path = require('path'); module.exports = herit(Engine, { defaults: function () { return { paths: [], indentedSyntax: false }; }, run: function (asset, cb) { try { var sass = require('node-sass'); sass.render({ data: asset.source, indentedSyntax: this.options.indentedSyntax, includePaths: this.options.paths.concat(path.dirname(asset.abs)), success: function (res) { asset.source = res.css; if (!asset.ext()) asset.exts.push('css'); cb(); }, error: function (er) { cb(new Error('Line ' + er.line + ': ' + er.message)); } }); } catch (er) { cb(er); } } });
Fix SCSS engine error message
Fix SCSS engine error message
JavaScript
mit
caseywebdev/cogs,caseywebdev/cogs
3f55e7c83a838f2658191d475a00a453fe17157e
lib/infinitedivs.js
lib/infinitedivs.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var infinitedivs = function infinitedivs() { _classCallCheck(this, infinitedivs); }; exports.default = infinitedivs;
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var infinitedivs = function infinitedivs() { _classCallCheck(this, infinitedivs); }; exports.default = infinitedivs; /***/ } /******/ ]);
Create infinitediv class and add basic buffer based loading.
Create infinitediv class and add basic buffer based loading.
JavaScript
mit
supreetpal/infinite-divs,supreetpal/infinite-divs
368aef6a552b9b626b6e8e551f72d39f9a5ba144
lib/modules/info.js
lib/modules/info.js
const chalk = require('chalk'); const helpers = require('../helpers'); exports.about = function () { helpers.printMessage(chalk.green('Welcome to Space CLI'), '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches'); };
const chalk = require('chalk'); const helpers = require('../helpers'); exports.about = function () { helpers.printMessage(chalk.green('Welcome to Space CLI') + ' ' + '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches'); };
Fix inconsistent rendering in about command
Fix inconsistent rendering in about command
JavaScript
mit
Belar/space-cli
2c082c238124844a8bae0c83eb890455452b7067
lib/services/swf.js
lib/services/swf.js
var AWS = require('../core'); /** * @constant * @readonly * Backwards compatibility for access to the {AWS.SWF} service class. */ AWS.SimpleWorkflow = AWS.SWF;
var AWS = require('../core'); AWS.util.hideProperties(AWS, ['SimpleWorkflow']); /** * @constant * @readonly * Backwards compatibility for access to the {AWS.SWF} service class. */ AWS.SimpleWorkflow = AWS.SWF;
Hide SimpleWorkflow service class from AWS properties
Hide SimpleWorkflow service class from AWS properties
JavaScript
apache-2.0
grimurjonsson/aws-sdk-js,jeskew/aws-sdk-js,mohamed-kamal/aws-sdk-js,mapbox/aws-sdk-js,Blufe/aws-sdk-js,jeskew/aws-sdk-js,chrisradek/aws-sdk-js,chrisradek/aws-sdk-js,beni55/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,chrisradek/aws-sdk-js,guymguym/aws-sdk-js,chrisradek/aws-sdk-js,aws/aws-sdk-js,MitocGroup/aws-sdk-js,MitocGroup/aws-sdk-js,jippeholwerda/aws-sdk-js,odeke-em/aws-sdk-js,j3tm0t0/aws-sdk-js,MitocGroup/aws-sdk-js,Blufe/aws-sdk-js,prembasumatary/aws-sdk-js,jeskew/aws-sdk-js,j3tm0t0/aws-sdk-js,odeke-em/aws-sdk-js,LiuJoyceC/aws-sdk-js,guymguym/aws-sdk-js,dconnolly/aws-sdk-js,michael-donat/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,mohamed-kamal/aws-sdk-js,dconnolly/aws-sdk-js,grimurjonsson/aws-sdk-js,beni55/aws-sdk-js,prembasumatary/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,prembasumatary/aws-sdk-js,LiuJoyceC/aws-sdk-js,mohamed-kamal/aws-sdk-js,Blufe/aws-sdk-js,jippeholwerda/aws-sdk-js,GlideMe/aws-sdk-js,guymguym/aws-sdk-js,mapbox/aws-sdk-js,beni55/aws-sdk-js,AdityaManohar/aws-sdk-js,michael-donat/aws-sdk-js,ugie/aws-sdk-js,grimurjonsson/aws-sdk-js,jmswhll/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,GlideMe/aws-sdk-js,jeskew/aws-sdk-js,guymguym/aws-sdk-js,misfitdavidl/aws-sdk-js,odeke-em/aws-sdk-js,jmswhll/aws-sdk-js,prestomation/aws-sdk-js,jippeholwerda/aws-sdk-js,mapbox/aws-sdk-js,j3tm0t0/aws-sdk-js,LiuJoyceC/aws-sdk-js,michael-donat/aws-sdk-js,dconnolly/aws-sdk-js,aws/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,jmswhll/aws-sdk-js
fb4ae324c3bd986677aa8dfed4b64bf5bae5beb6
entity.js
entity.js
const createTransform = require('./transform') let entityId = 0 function Entity (components, parent, tags) { this.id = entityId++ this.tags = tags || [] this.components = components ? components.slice(0) : [] this.transform = this.getComponent('Transform') if (!this.transform) { this.transform = createTransform({ parent: parent ? parent.transform : null }) this.components.unshift(this.transform) } this.transform.set({ parent: parent ? parent.transform : null }) this.components.forEach((component) => component.init(this)) } Entity.prototype.dispose = function () { // detach from the hierarchy this.transform.set({ parent: null }) } Entity.prototype.getComponent = function (type) { return this.components.find((component) => component.type === type) } module.exports = function createEntity (components, parent, tags) { return new Entity(components, parent, tags) }
const createTransform = require('./transform') let entityId = 0 function Entity (components, parent, tags) { this.id = entityId++ this.tags = tags || [] this.components = components ? components.slice(0) : [] this.transform = this.getComponent('Transform') if (!this.transform) { this.transform = createTransform({ parent: parent ? parent.transform : null }) this.components.unshift(this.transform) } this.transform.set({ parent: parent ? parent.transform : null }) this.components.forEach((component) => component.init(this)) } Entity.prototype.dispose = function () { // detach from the hierarchy this.transform.set({ parent: null }) } Entity.prototype.addComponent = function (component) { this.components.push(component) component.init(this) } Entity.prototype.getComponent = function (type) { return this.components.find((component) => component.type === type) } module.exports = function createEntity (components, parent, tags) { return new Entity(components, parent, tags) }
Add addComponent method to Entity
Add addComponent method to Entity
JavaScript
mit
pex-gl/pex-renderer,pex-gl/pex-renderer
3053a37c25fa000223642db9c0eb0dc8b0c265ae
migrations/20170401114125_initial.js
migrations/20170401114125_initial.js
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTableIfNotExists('user', (table) => { table.integer('telegram_id') .primary(); table.string('piikki_username') .unique(); table.string('default_group'); table.text('json_state'); }), ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('user'), ]);
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTableIfNotExists('user', (table) => { table.integer('telegram_id') .primary(); table.string('piikki_username'); table.string('default_group'); table.text('json_state'); }), ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('user'), ]);
Allow multiple nulls in username
Allow multiple nulls in username
JavaScript
mit
majori/piikki-client-tg
48d6b2ef33a9e8a27180d126db6cf37e6a685841
src/components/SearchFilterCountries.js
src/components/SearchFilterCountries.js
import React from 'react'; import { FormattedMessage, FormattedNumber } from 'react-intl'; import { Button, Popover, Position, Spinner } from '@blueprintjs/core'; const SearchFilterCountries = ({ loaded, countries, currentValue, onOpen, onChange }) => { function toggleCountryId(countryId) { const newValue = currentValue.indexOf(countryId) > -1 ? currentValue.filter(i => i !== countryId) : [...currentValue, countryId]; onChange(newValue); } return ( <Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline={true}> <Button rightIconName="caret-down"> <FormattedMessage id="search.countries" defaultMessage="Countries"/> {loaded && <span> (<FormattedNumber value={countries.length} />)</span>} </Button> <div className="search-filter-countries"> {loaded ? <ul className="search-filter-countries-list"> {countries.map(country => ( <li onClick={toggleCountryId.bind(null, country.id)} key={country.id}> <span className="pt-icon-standard pt-icon-tick" style={{'visibility': currentValue.indexOf(country.id) > -1 ? 'visible': 'hidden'}} /> {country.label} </li> ))} </ul> : <Spinner className="pt-large" />} </div> </Popover> ); }; export default SearchFilterCountries;
import React from 'react'; import { FormattedMessage, FormattedNumber } from 'react-intl'; import { Button, Popover, Position, Spinner } from '@blueprintjs/core'; const SearchFilterCountries = ({ loaded, countries, currentValue, onOpen, onChange }) => { function toggleCountryId(countryId) { const newValue = currentValue.indexOf(countryId) > -1 ? currentValue.filter(i => i !== countryId) : [...currentValue, countryId]; onChange(newValue); } return ( <Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline> <Button rightIconName="caret-down"> <FormattedMessage id="search.countries" defaultMessage="Countries"/> {loaded && <span> (<FormattedNumber value={countries.length} />)</span>} </Button> <div className="search-filter-countries"> {loaded ? <ul className="search-filter-countries-list"> {countries.map(country => ( <li onClick={toggleCountryId.bind(null, country.id)} key={country.id}> <span className="pt-icon-standard pt-icon-tick" style={{'visibility': currentValue.indexOf(country.id) > -1 ? 'visible': 'hidden'}} /> {country.label} </li> ))} </ul> : <Spinner className="pt-large" />} </div> </Popover> ); }; export default SearchFilterCountries;
Remove unnecessary value on inline prop
Remove unnecessary value on inline prop
JavaScript
mit
pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph
8e75817344c4743a95f93efbb6a7124220183f60
src/components/MdContent/styles.js
src/components/MdContent/styles.js
import theme from '../../theme' export default { mdContent: {}, content: { position: 'relative', }, markdown: { display: 'block', }, actions: { float: 'right', display: 'flex', alignItems: 'center', position: 'relative', zIndex: 5 }, action: { display: 'flex', height: 30, borderRight: [1, 'solid', theme.borderColor], paddingRight: 20, marginLeft: 20, '&:last-child': { isolate: false, borderRight: 0, paddingRight: 0 }, '&:first-child': { marginLeft: 0 } }, // Removes inlining with title. [theme.media.md]: { actions: { float: 'none', justifyContent: 'flex-end', marginBottom: 20, } }, [theme.media.sm]: { actions: { justifyContent: 'center' } } }
import theme from '../../theme' export default { mdContent: {}, content: { position: 'relative', }, markdown: { display: 'block', }, actions: { float: 'right', display: 'flex', alignItems: 'center', position: 'relative', zIndex: 5, marginLeft: 20 }, action: { display: 'flex', height: 30, borderRight: [1, 'solid', theme.borderColor], paddingRight: 20, marginLeft: 20, '&:last-child': { isolate: false, borderRight: 0, paddingRight: 0 }, '&:first-child': { marginLeft: 0 } }, // Removes inlining with title. [theme.media.md]: { actions: { float: 'none', justifyContent: 'flex-end', marginBottom: 20, } }, [theme.media.sm]: { actions: { justifyContent: 'center' } } }
Fix space between title and version select
Fix space between title and version select
JavaScript
mit
cssinjs/cssinjs
c08fa30117cf593cd91a1325b86a4199b0fd08f6
config/webpack/webpack.config.test.js
config/webpack/webpack.config.test.js
"use strict"; /** * Webpack frontend test configuration. */ var path = require("path"); var prodCfg = require("./webpack.config"); // Replace with `__dirname` if using in project root. var ROOT = process.cwd(); var _ = require("lodash"); // devDependency module.exports = { cache: true, context: path.join(ROOT, "test/client"), entry: "./main", output: { filename: "main.js", publicPath: "/assets/" }, resolve: _.merge({}, prodCfg.resolve, { alias: { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 sinon: "node_modules/sinon/pkg/sinon.js", // Allow root import of `src/FOO` from ROOT/src. src: path.join(ROOT, "src") } }), // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 externals: { "cheerio": "window", "react/lib/ExecutionEnvironment": true, "react/lib/ReactContext": true }, module: _.assign({}, prodCfg.module, { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 noParse: [ /\/sinon\.js/ ] }), devtool: "source-map" };
"use strict"; /** * Webpack frontend test configuration. */ var path = require("path"); var prodCfg = require("./webpack.config"); // Replace with `__dirname` if using in project root. var ROOT = process.cwd(); var _ = require("lodash"); // devDependency module.exports = { cache: true, context: path.join(ROOT, "test/client"), entry: "./main", output: { filename: "main.js", publicPath: "/assets/" }, resolve: _.merge({}, prodCfg.resolve, { alias: { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 sinon: "node_modules/sinon/pkg/sinon.js", // Allow root import of `src/FOO` from ROOT/src. src: path.join(ROOT, "src") } }), // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 externals: { "cheerio": "window", "react/lib/ExecutionEnvironment": true, "react/lib/ReactContext": true, "react/addons": true }, module: _.assign({}, prodCfg.module, { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 noParse: [ /\/sinon\.js/ ] }), devtool: "source-map" };
Fix for enzyme and react 15
Fix for enzyme and react 15
JavaScript
mit
FormidableLabs/builder-radium-component,FormidableLabs/builder-radium-component
59fd6e6d26ddb98957dcdcdb415efddad1080be3
content/bootloader.js
content/bootloader.js
// Render the environment & partner menus renderEnvironmentMenuItems(); renderPartnerMenuItems(); renderGaugeRowItems(); // Events binding window.onhashchange = _handlerRefreshMenuAndPage; // Update the menu and render the content _handlerRefreshMenuAndPage();
// Render the environment & partner menus renderEnvironmentMenuItems(); renderPartnerMenuItems(); renderGaugeRowItems(); // Events binding window.onhashchange = _handlerRefreshMenuAndPage; // Update the menu and render the content _handlerRefreshMenuAndPage(); (function myLoop (i) { setTimeout(function () { renderGaugeRowItems(); if (--i) { myLoop(i); } }, 3000) })(1000);
Add simple code for time triggering of gauge
Add simple code for time triggering of gauge
JavaScript
mit
vejuhust/yet-another-monitoring-dashboard,vejuhust/yet-another-monitoring-dashboard
8ccc4d34fe92889c75a06d01bcdbd9df226aa965
inject.js
inject.js
function receiveMessage(event) { var commentPath, frameURL; // get url of comment commentPath = event.data.commentURL; frameURL = "https://news.ycombinator.com/" + commentPath; showComments( frameURL ) } var showComments = function( URL ) { var commentFrame; } var drawIframe = function() { var frameset, pageURL, pageFrame, commentFrame, html, body; html = document.querySelector( "html" ); body = document.querySelector( "body" ); frameset = document.createElement( "frameset" ); pageFrame = document.createElement( "frame" ); commentFrame = document.createElement( "frame" ); pageFrame.setAttribute( "id", "page-frame" ); commentFrame.setAttribute( "id", "comment-frame" ); pageURL = document.URL; if ( body ) body.parentNode.removeChild( body ); frameset.appendChild( pageFrame ); frameset.appendChild( commentFrame ); html.appendChild( frameset ); pageFrame.setAttribute( "src", pageURL ); } drawIframe(); window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) { var commentPath, frameURL; // get url of comment commentPath = event.data.commentURL; frameURL = "https://news.ycombinator.com/" + commentPath; showComments( frameURL ) } var showComments = function( URL ) { var commentFrame; commentFrame = document.querySelector( "#frameID" ); commentFrame.setAttribute( "src", URL ); } var drawIframe = function() { var frameset, pageURL, pageFrame, commentFrame, html, body; html = document.querySelector( "html" ); body = document.querySelector( "body" ); frameset = document.createElement( "frameset" ); pageFrame = document.createElement( "frame" ); commentFrame = document.createElement( "frame" ); pageFrame.setAttribute( "id", "page-frame" ); commentFrame.setAttribute( "id", "comment-frame" ); pageURL = document.URL; if ( body ) body.parentNode.removeChild( body ); frameset.appendChild( pageFrame ); frameset.appendChild( commentFrame ); html.appendChild( frameset ); pageFrame.setAttribute( "src", pageURL ); } drawIframe(); window.addEventListener("message", receiveMessage, false);
Set attribute of comment frame.
Set attribute of comment frame.
JavaScript
mit
tonyonodi/reddit-comments,tonyonodi/reddit-comments,tonyonodi/back-to-the-comments,tonyonodi/back-to-the-comments
62dee18342aa659ad1f124be9de70b11d3a0c0d1
src/jar/lang/Object/Object-info.js
src/jar/lang/Object/Object-info.js
JAR.register({ MID: 'jar.lang.Object.Object-info', deps: ['..', '.!reduce|derive', '..Array!reduce'] }, function(lang, Obj, Arr) { 'use strict'; var reduce = Obj.reduce; lang.extendNativeType('Object', { keys: function() { return reduce(this, pushKey, []); }, pairs: function() { return reduce(this, pushKeyValue, []); }, prop: function(key) { var propList = key.split('.'); return Arr.reduce(propList, extractProperty, this); }, size: function() { return reduce(this, countProperties, 0); }, values: function() { return reduce(this, pushValue, []); } }); function extractProperty(obj, key) { return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined; } function countProperties(size) { return ++size; } function pushKey(array, value, key) { array[array.length] = key; return array; } function pushValue(array, value) { array[array.length] = value; return array; } function pushKeyValue(array, value, key) { array[array.length] = [key, value]; return array; } return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']); });
JAR.register({ MID: 'jar.lang.Object.Object-info', deps: ['..', '.!reduce|derive', '..Array!reduce'] }, function(lang, Obj, Arr) { 'use strict'; var reduce = Obj.reduce; lang.extendNativeType('Object', { keys: function() { return reduce(this, pushKey, Arr()); }, pairs: function() { return reduce(this, pushKeyValue, Arr()); }, prop: function(key) { var propList = key.split('.'); return Arr.reduce(propList, extractProperty, this); }, size: function() { return reduce(this, countProperties, 0); }, values: function() { return reduce(this, pushValue, Arr()); } }); function extractProperty(obj, key) { return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined; } function countProperties(size) { return ++size; } function pushKey(array, value, key) { array[array.length] = key; return array; } function pushValue(array, value) { array[array.length] = value; return array; } function pushKeyValue(array, value, key) { array[array.length] = Arr(key, value); return array; } return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']); });
Use jar.lang.Array instead of native as returnvalue
Use jar.lang.Array instead of native as returnvalue
JavaScript
mit
HROH/JAR
9cd54ca34eee54d3cbe357147f2f81c6021bc606
controllers/widget.js
controllers/widget.js
var args = _.extend({ duration: 2000, animationDuration: 250, message: '', title: Ti.App.name, elasticity: 0.5, pushForce: 30, usePhysicsEngine: true }, arguments[0] || {}); var That = null; exports.show = function(opt) { if (_.isObject(opt)) _.extend(args, opt); if (_.isString(opt)) _.extend(args, { message: opt }); if (OS_ANDROID && args.view == null) { Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification."); That = Ti.UI.createNotification({ message: args.message, duration: args.duration }); That.show(); } else { That = Widget.createController('window', args); } }; exports.hide = function() { if (That != null) { That.hide(); } };
var args = _.extend({ duration: 2000, animationDuration: 250, message: '', title: Ti.App.name, elasticity: 0.5, pushForce: 30, usePhysicsEngine: true }, arguments[0] || {}); var That = null; exports.show = function(opt) { if (_.isObject(opt)) _.extend(args, opt); if (_.isString(opt)) _.extend(args, { message: opt }); if (OS_ANDROID && args.view == null) { Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification."); That = Ti.UI.createNotification({ message: args.message, duration: args.duration }); That.show(); } else { That = Widget.createController('window', args); } }; exports.update = function(message) { That.update(message); }; exports.hide = function() { if (That != null) { That.hide(); } };
Allow update of notification text.
Allow update of notification text. Allows you to update the message in the notification. I wanted this feature to allow me to show loading percentage in the notification when downloading or uploading data.
JavaScript
mit
titanium-forks/CaffeinaLab.com.caffeinalab.titanium.notifications,CaffeinaLab/Ti.Notifications,DouglasHennrich/Ti.Notifications
2e048f088512f37e0fcc6feec79930b64a615c1d
number_insight/ni-advanced.js
number_insight/ni-advanced.js
require('dotenv').config({path: __dirname + '/../.env'}) const NEXMO_API_KEY = process.env.NEXMO_API_KEY const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET // By default use the command line argument. Otherwise use the environment variable. const INSIGHT_NUMBER = process.argv[2] || process.env.INSIGHT_NUMBER; const Nexmo = require('nexmo'); const nexmo = new Nexmo({ apiKey: NEXMO_API_KEY, apiSecret: NEXMO_API_SECRET }); nexmo.numberInsight.get({level: 'advanced', number: INSIGHT_NUMBER}, (error, result) => { if(error) { console.error(error); } else { console.log(result); } });
require('dotenv').config({path: __dirname + '/../.env'}) const NEXMO_API_KEY = process.env.NEXMO_API_KEY const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET // By default use the command line argument. Otherwise use the environment variable. const INSIGHT_NUMBER = process.argv[2] || process.env.INSIGHT_NUMBER; const Nexmo = require('nexmo'); const nexmo = new Nexmo({ apiKey: NEXMO_API_KEY, apiSecret: NEXMO_API_SECRET }); nexmo.numberInsight.get({level: 'advancedSync', number: INSIGHT_NUMBER}, (error, result) => { if(error) { console.error(error); } else { console.log(result); } });
Change level from `advanced` to `advancedSync`
Change level from `advanced` to `advancedSync` As per: https://github.com/Nexmo/nexmo-node/pull/232
JavaScript
mit
nexmo-community/nexmo-node-quickstart,nexmo-community/nexmo-node-quickstart
460569d2ccd067dea0fcebca62a266e4f43c4ac8
src/express/middleware/createContext.js
src/express/middleware/createContext.js
// ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- var data = require('../../data'), notifications = require('../../notifications'), attachOperators = require('../../query/attachOperators'), logger = require('../../logger'); module.exports = function (configuration) { var dataProvider = data(configuration), notificationsClient = notifications(configuration.notifications).getClient(); return function (req, res, next) { req.azureMobile = { req: req, res: res, data: dataProvider, push: notificationsClient, configuration: configuration, logger: logger, tables: function (name) { return attachOperators(name, dataProvider(configuration.tables[name])); } }; next(); }; };
// ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- var data = require('../../data'), notifications = require('../../notifications'), attachOperators = require('../../query/attachOperators'), logger = require('../../logger'); module.exports = function (configuration) { var dataProvider = data(configuration), notificationsClient = notifications(configuration.notifications).getClient(); return function (req, res, next) { req.azureMobile = { req: req, res: res, data: dataProvider, push: notificationsClient, configuration: configuration, logger: logger, tables: function (name) { if(!configuration.tables[name]) throw new Error("The table '" + name + "' does not exist.") return attachOperators(name, dataProvider(configuration.tables[name])); } }; next(); }; };
Throw meaningful exception if table does not exist
Throw meaningful exception if table does not exist
JavaScript
mit
mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node
7512a4e4e4588c16883ebc5499804a05286d1b64
web/src/js/views/location-chooser.js
web/src/js/views/location-chooser.js
import locations from '../core/locations'; import View from '../base/view'; import {trigger} from '../utils/browser'; import template from '../../templates/location-chooser.ejs'; export default class LocationChooser extends View { constructor({app, location, route}) { super({app}); this.location = location; this.route = route; } getHTML() { const currentLocation = this.location; const targetRoute = this.getTargetRoute(); return this.app.renderTemplate(template, { locations, targetRoute, currentLocation}); } mount() { this.events.bind('change', 'onChange'); } getTargetRoute() { if (this.route.name == 'place-list') { return {name: 'place-list', args: this.route.args}; } else if (this.route.name == 'event-list') { return {name: 'event-list', args: this.route.args}; } else { return {name: 'event-list', args: {}}; } } onChange(event) { trigger(window, 'navigate', this.element.value); } }
import locations from '../core/locations'; import View from '../base/view'; import {trigger} from '../utils/browser'; import template from '../../templates/location-chooser.ejs'; export default class LocationChooser extends View { constructor({app, location, route}) { super({app}); this.location = location; this.route = route; } getHTML() { const currentLocation = this.location; const targetRoute = this.getTargetRoute(); return this.app.renderTemplate(template, { locations, targetRoute, currentLocation}); } mount() { this.events.bind('change', 'onChange'); } getTargetRoute() { if (['place-list', 'event-list'].includes(this.route.name)) { return this.route; } else { return {name: 'event-list', args: {}}; } } onChange(event) { trigger(window, 'navigate', this.element.value); } }
Simplify location chooser target route logic
Simplify location chooser target route logic
JavaScript
mit
despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics
c69e67b560fd1fa97674f254e88e5637d177d1d9
js/app.js
js/app.js
"use strict"; (function() { var filters = { age: function() { this .saturation(20) .gamma(1.4) .vintage() .contrast(5) .exposure(15) .vignette(300, 60) .render() }, lomo: function() { this .brightness(15) .exposure(15) .curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]) .saturation(-20) .gamma(1.8) .vignette("50%", 60) .brightness(5) .render() }, oldtv: function() { this .saturation(-60) .contrast(30) .noise(20) .vignette("50%", 70) .render() } }; $('#filters button').click(function(e) { e.preventDefault(); Caman("#canvas").revert(); Caman("#canvas", filters[$(this).data('filter')]); $('#filters button').removeClass('active'); $(this).addClass('active'); }); })()
"use strict"; (function() { var filters = { age: function() { this .saturation(20) .gamma(1.4) .vintage() .contrast(5) .exposure(15) .vignette(300, 60) .render() }, blackAndWhite: function() { this .gamma(100) .contrast(30) .saturation(-100) .render() }, lomo: function() { this .brightness(15) .exposure(15) .curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]) .saturation(-20) .gamma(1.8) .vignette("50%", 60) .brightness(5) .render() }, oldtv: function() { this .saturation(-60) .contrast(30) .noise(20) .vignette("50%", 70) .render() } }; $('#filters button').click(function(e) { e.preventDefault(); Caman("#canvas").revert(); Caman("#canvas", filters[$(this).data('filter')]); $('#filters button').removeClass('active'); $(this).addClass('active'); }); })()
Add black and white filter
Add black and white filter
JavaScript
bsd-2-clause
fwenzel/hipstergram
b304daf4802a5fa1a870ac65ab9f3674eb83b4c1
app/js/store.js
app/js/store.js
'use strict'; import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducers'; const createStoreWithMiddleware = compose( applyMiddleware(thunk), window.devToolsExtension ? window.devToolsExtension() : f => f )(createStore); export default createStoreWithMiddleware(reducer);
'use strict'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducers'; const createStoreWithMiddleware = applyMiddleware( thunk )(createStore); export default createStoreWithMiddleware(reducer);
Revert "Add dev tools stuff"
Revert "Add dev tools stuff" This reverts commit 46ebaea0030bdb0b81aa5b6ac343f70a968910b9.
JavaScript
mit
rit-sse/officers,rit-sse/officers
ed2d17a60d5d560f3c22722221603d846457ae9c
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('allOwnedMangas', Meteor.userId()); }, fastRender: true });
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); }, fastRender: true }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); }, fastRender: true });
Add route for missing mangas
Add route for missing mangas
JavaScript
mit
dexterneo/mangas,dexterneo/mangas,dexterneo/mangatek,dexterneo/mangatek
3eba8d104dea9a21650e0dcb52ec8d00d42fe4b0
plugin.js
plugin.js
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ constructor() { super(); // Will be injected by core this.app = null; this.plugins = null; this.server = null; this.players = null; this.maps = null; /** * Will hold the defined models for this plugin! * * @type {{}} */ this.models = {}; } /** * Inject Core App interface into the plugin. * * @param {App} app */ inject(app) { this.app = app; this.server = app.server; // Expand app into separate parts. // TODO: Fill in plugins, server, players, maps. } }
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ constructor() { super(); // Will be injected by core this.app = null; this.plugins = null; this.server = null; this.players = null; this.maps = null; /** * Will hold the defined models for this plugin! * * @type {{}} */ this.models = {}; } /** * Inject Core App interface into the plugin. * * @param {App} app */ inject(app) { this.app = app; this.server = app.server; // Expand app into separate parts. this.players = app.players; this.maps = app.maps; } }
Prepare for players and maps update of core.
Prepare for players and maps update of core.
JavaScript
isc
ManiaJS/plugins,ManiaJS/plugins,ManiaJS/plugins
00efb338ffc61def70a3deb5aebc47d1f76203de
jsrts/Runtime-node.js
jsrts/Runtime-node.js
$JSRTS.os = require('os'); $JSRTS.fs = require('fs'); $JSRTS.prim_systemInfo = function (index) { switch (index) { case 0: return "node"; case 1: return $JSRTS.os.platform(); } return ""; }; $JSRTS.prim_writeStr = function (x) { return process.stdout.write(x) } $JSRTS.prim_readStr = function () { var ret = ''; var b = new Buffer(1024); var i = 0; while (true) { $JSRTS.fs.readSync(0, b, i, 1) if (b[i] == 10) { ret = b.toString('utf8', 0, i); break; } i++; if (i == b.length) { nb = new Buffer(b.length * 2); b.copy(nb) b = nb; } } return ret; };
$JSRTS.os = require('os'); $JSRTS.fs = require('fs'); $JSRTS.prim_systemInfo = function (index) { switch (index) { case 0: return "node"; case 1: return $JSRTS.os.platform(); } return ""; }; $JSRTS.prim_writeStr = function (x) { return process.stdout.write(x) } $JSRTS.prim_readStr = function () { var ret = ''; var b = new Buffer(1024); var i = 0; while (true) { $JSRTS.fs.readSync(0, b, i, 1) if (b[i] == 10) { ret = b.toString('utf8', 0, i); break; } i++; if (i == b.length) { var nb = new Buffer(b.length * 2); b.copy(nb) b = nb; } } return ret; };
Fix undeclared variable in node runtime
Fix undeclared variable in node runtime
JavaScript
bsd-3-clause
uuhan/Idris-dev,uuhan/Idris-dev,uuhan/Idris-dev,kojiromike/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,kojiromike/Idris-dev,kojiromike/Idris-dev
3692239249bb4d9efd4e84a2c1ea81d31b28f736
spec/global-spec.js
spec/global-spec.js
var proxyquire = require("proxyquire"); // Returns an ajax instance that has the underlying XMLHttpRequest stubbed. function getStubbedAjax(stub) { proxyquire("../index.js", { xmlhttprequest: { "XMLHttpRequest": function () { this.open = function () {}; this.send = function () {}; this.setRequestHeader = function () { this.readyState = 4; this.status = 200; this.onreadystatechange(); }; if (stub != null) { for (var method in stub) { this[method] = stub[method]; } } } } }); return require("../index.js"); } describe("The get method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.get("http://www.example.com") .then(function () { done(); }, function () { fail(); }) }); });
var proxyquire = require("proxyquire"); // Returns an ajax instance that has the underlying XMLHttpRequest stubbed. function getStubbedAjax(stub) { proxyquire("../index.js", { xmlhttprequest: { "XMLHttpRequest": function () { this.open = function () {}; this.send = function () {}; this.setRequestHeader = function () { this.readyState = 4; this.status = 200; this.onreadystatechange(); }; if (stub != null) { for (var method in stub) { this[method] = stub[method]; } } } } }); return require("../index.js"); } describe("The get method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.get("http://www.example.com") .then(done, fail); }); }); describe("The post method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.post("http://www.example.com") .then(done, fail); }); }); describe("The put method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.put("http://www.example.com") .then(done, fail); }); }); describe("The del method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.del("http://www.example.com") .then(done, fail); }); });
Add basic tests for post/put/del
Add basic tests for post/put/del
JavaScript
mit
levibotelho/dead-simple-ajax
da1cd5e7b6cfe09fb21599dd590b49aada010e3d
koans/AboutExpects.js
koans/AboutExpects.js
describe("About Expects", function() { /We shall contemplate truth by testing reality, via spec expectations. it("should expect true", function() { expect(true).toBeTruthy(); //This should be true }); //To understand reality, we must compare our expectations against reality. it("should expect equality", function () { var expectedValue = FILL_ME_IN; var actualValue = 1 + 1; expect(actualValue === expectedValue).toBeTruthy(); }); //Some ways of asserting equality are better than others. it("should assert equality a better way", function () { var expectedValue = FILL_ME_IN; var actualValue = 1 + 1; // toEqual() compares using common sense equality. expect(actualValue).toEqual(expectedValue); }); //Sometimes you need to be really exact about what you "type". it("should assert equality with ===", function () { var expectedValue = FILL_ME_IN; var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. expect(actualValue).toBe(expectedValue); }); //Sometimes we will ask you to fill in the values. it("should have filled in values", function () { expect(1 + 1).toEqual(FILL_ME_IN); }); });
describe("About Expects", function() { /We shall contemplate truth by testing reality, via spec expectations. it("should expect true", function() { expect(true).toBeTruthy(); //This should be true }); //To understand reality, we must compare our expectations against reality. it("should expect equality", function () { var expectedValue = 2; var actualValue = 1 + 1; expect(actualValue === expectedValue).toBeTruthy(); }); //Some ways of asserting equality are better than others. it("should assert equality a better way", function () { var expectedValue = 2; var actualValue = 1 + 1; // toEqual() compares using common sense equality. expect(actualValue).toEqual(expectedValue); }); //Sometimes you need to be really exact about what you "type". it("should assert equality with ===", function () { var expectedValue = "2"; var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. expect(actualValue).toBe(expectedValue); }); //Sometimes we will ask you to fill in the values. it("should have filled in values", function () { expect(1 + 1).toEqual(2); }); });
Change FILL_ME_IN to respective types
Change FILL_ME_IN to respective types
JavaScript
mit
Imti/javascript-koans,Imti/javascript-koans
260c02133464f51f80d117fdb67893247f55551a
testem.js
testem.js
var Reporter = require('ember-test-utils/reporter') module.exports = { disable_watching: true, framework: 'mocha', launch_in_ci: [ 'Chrome', 'Firefox' ], launch_in_dev: [ 'Chrome' ], reporter: new Reporter(), test_page: 'tests/index.html?hidepassed' }
var Reporter = require('ember-test-utils/reporter') module.exports = { disable_watching: true, framework: 'mocha', launch_in_ci: [ 'Firefox', 'Chrome' ], launch_in_dev: [ 'Chrome' ], reporter: new Reporter(), test_page: 'tests/index.html?hidepassed' }
Test firefox first, so Chrome coverage is used
Test firefox first, so Chrome coverage is used
JavaScript
mit
dafortin/ember-frost-core,EWhite613/ember-frost-core,helrac/ember-frost-core,rox163/ember-frost-core,EWhite613/ember-frost-core,dafortin/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core,dafortin/ember-frost-core,EWhite613/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core
6384ec4372c63b3d5dc5bd540a2dca39552c910c
script.js
script.js
function playAudioOnKeyDown(elt) { let soundToPlay = document.querySelector(`audio[data-key="${elt.keyCode}"]`); let keyToAnimate = document.querySelector(`div[data-key="${elt.keyCode}"]`); keyToAnimate.classList.add('playing'); soundToPlay.currentTime = 0; soundToPlay.play(); keyToAnimate.addEventListener('transitionend', function(element){ if(element.target.classList.contains('playing')) { element.target.classList.remove('playing'); } }); } window.addEventListener('keydown', playAudioOnKeyDown);
Modify JavaScript file, first working version with keyDown
Modify JavaScript file, first working version with keyDown
JavaScript
mit
shahzaibkhalid/electronic-drum-kit,shahzaibkhalid/electronic-drum-kit
069aa383a0b5dc3cb3fca05bce98d8f3106ab1ce
server.js
server.js
var http = require('http'); var mongoClient = require('mongodb').MongoClient; var mongoUri = process.env.MONGO_URI || ''; var port = process.env.PORT || 80; mongoClient.connect(mongoUri, function (err, client) { http.createServer(function (req, res) { if(err){ res.writeHead(500, { 'Content-Type': 'text/plain' }); res.end(`Failed to connect to the database.\n${err}`) return; } const db = client.db('logs'); const requests = db.collection('requests'); requests.count(function(error, count){ res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(`Hello World!\nThere are ${count} request records.`); }) requests.insertOne({ ip: req.headers['x-forwarded-for'] || req.connection.remoteAddress, time: Date.now() }); }).listen(port); });
var http = require('http'); var mongoClient = require('mongodb').MongoClient; var mongoUri = process.env.MONGO_URI || ''; var port = process.env.PORT || 80; mongoClient.connect(mongoUri, function (err, client) { http.createServer(function (req, res) { if(err){ res.writeHead(500, { 'Content-Type': 'text/plain' }); res.end(`Failed to connect to the database.\n${err}`) return; } const db = client.db('logs'); const requests = db.collection('requests'); requests.count(function(error, count){ res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(`Hello World!\nThere are ${count} request records.1222`); }) requests.insertOne({ ip: req.headers['x-forwarded-for'] || req.connection.remoteAddress, time: Date.now() }); }).listen(port); });
Update text to test CI/CD
Update text to test CI/CD
JavaScript
mit
TylerLu/hello-world,TylerLu/hello-world,TylerLu/hello-world
5c104409305efe16dbffd04c5041c2d88e55846a
lib/daemon.js
lib/daemon.js
import readline from 'readline'; import Importer from './Importer'; const commandsToFunctionNames = { fix: 'fixImports', word: 'import', goto: 'goto', rewrite: 'rewriteImports', add: 'addImports', }; export default function daemon() { const rlInterface = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false, }); rlInterface.on('line', (jsonPayload: string) => { const payload = JSON.parse(jsonPayload); const importer = new Importer( payload.fileContent.split('\n'), payload.pathToFile); // TODO: don't automatically invoke function here because of security issues const functionName = commandsToFunctionNames[payload.command]; importer[functionName](payload.commandArg).then((result) => { process.stdout.write(`${JSON.stringify(result)}\n`); }).catch((error) => { // TODO: print entire stack trace here process.stderr.write(error.toString()); }); }); }
import readline from 'readline'; import Importer from './Importer'; const commandsToFunctionNames = { fix: 'fixImports', word: 'import', goto: 'goto', rewrite: 'rewriteImports', add: 'addImports', }; export default function daemon() { const rlInterface = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false, }); rlInterface.on('line', (jsonPayload: string) => { const payload = JSON.parse(jsonPayload); const importer = new Importer( payload.fileContent.split('\n'), payload.pathToFile); // TODO: don't automatically invoke function here because of security issues const functionName = commandsToFunctionNames[payload.command]; importer[functionName](payload.commandArg).then((result) => { process.stdout.write(`${JSON.stringify(result)}\n`); }).catch((error) => { // TODO: print entire stack trace here process.stdout.write(JSON.stringify({ error: error.toString(), })); }); }); }
Print importjsd errors to stdout
Print importjsd errors to stdout I'm playing around with using a vim channel to communicate with the daemon. It's a lot simpler if we can assume all results (even errors) get printed to stdout.
JavaScript
mit
trotzig/import-js,trotzig/import-js,trotzig/import-js,Galooshi/import-js
5594dd12afca6f57965eeac6fd1e5609c89d78b9
lib/linter.js
lib/linter.js
'use strict'; var gonzales = require('gonzales-pe'); var linters = [ require('./linters/space_before_brace') ]; exports.lint = function (data, path, config) { var ast = this.parseAST(data); var errors = []; ast.map(function (node) { var i; for (i = 0; i < linters.length; i++) { errors.push(linters[i].call(null, { config: config, node: node, path: path })); } }); // Remove empty errors return errors.filter(function (error) { return error !== null && error !== true; }); }; exports.parseAST = function (input) { return gonzales.parse(input, { syntax: 'less' }); };
'use strict'; var gonzales = require('gonzales-pe'); var linters = [ require('./linters/space_before_brace') ]; exports.lint = function (input, path, config) { var ast = this.parseAST(input); var errors = []; ast.map(function (node) { var i; for (i = 0; i < linters.length; i++) { errors.push(linters[i].call(null, { config: config, node: node, path: path })); } }); // Remove empty errors return errors.filter(function (error) { return error !== null && error !== true; }); }; exports.parseAST = function (input) { return gonzales.parse(input, { syntax: 'less' }); };
Use 'input' instead of 'data'
Use 'input' instead of 'data'
JavaScript
mit
JoshuaKGoldberg/lesshint,lesshint/lesshint,runarberg/lesshint,gilt/lesshint
3988262c70babec9b3d877077d1327f995247568
problems/filtered_ls/setup.js
problems/filtered_ls/setup.js
const fs = require('fs') , path = require('path') , os = require('os') , onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync , files = [ 'learnyounode.dat' , 'learnyounode.txt' , 'learnyounode.sql' , 'api.html' , 'README.md' , 'data.json' , 'data.dat' , 'words.dat' , 'w00t.dat' , 'w00t.txt' , 'wrrrrongdat' ] module.exports = function () { var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid) , trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json') fs.mkdirSync(dir) files.forEach(function (f) { fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8') }) return { args : [ dir, 'dat' ] , stdin : null , modUseTrack : { trackFile : trackFile , modules : [ 'fs' ] } , verify : onlyAsync.bind(null, trackFile) } }
const fs = require('fs') , path = require('path') , os = require('os') , onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync , files = [ 'learnyounode.dat' , 'learnyounode.txt' , 'learnyounode.sql' , 'api.html' , 'README.md' , 'data.json' , 'data.dat' , 'words.dat' , 'w00t.dat' , 'w00t.txt' , 'wrrrrongdat' , 'dat' ] module.exports = function () { var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid) , trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json') fs.mkdirSync(dir) files.forEach(function (f) { fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8') }) return { args : [ dir, 'dat' ] , stdin : null , modUseTrack : { trackFile : trackFile , modules : [ 'fs' ] } , verify : onlyAsync.bind(null, trackFile) } }
Add test case from make_it_modular to filtered_ls
Add test case from make_it_modular to filtered_ls This test case was present in the next, "same as the previous" challenge, thus preventing some solutions to filtered_ls to work for make_it_modular for an unclear reason.
JavaScript
mit
amandasilveira/learnyounode,soujiro27/learnyounode,sergiorgiraldo/learnyounode,AydinHassan/learnyounode,thenaughtychild/learnyounode,jqk6/learnyounode,Yas3r/learnyounode,kmckee/learnyounode,zpxiaomi/learnyounode,keshwans/learnyounode,jojo1311/learnyounode,5harf/learnyounode,hsidar/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,kmckee/learnyounode,PibeDx/learnyounode,PibeDx/learnyounode,RoseTHERESA/learnyounode-1,Gtskk/learnyoupython,maksimgm/learnyounode,sergiorgiraldo/learnyounode,yous/learnyounode,AydinHassan/learnyounode,hsidar/learnyounode,JonnyCheng/learnyounode,noikiy/learnyounode,chechiachang/learnyounode,amandasilveira/learnyounode,chechiachang/learnyounode,zpxiaomi/learnyounode,walhs/learnyounode,runithome/learnyounode,andrewtdinh/learnyounode,marocchino/learnyounode,pushnoy100500/learnyounode,soujiro27/learnyounode,JonnyCheng/learnyounode,yous/learnyounode,michaelgrilo/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,jqk6/learnyounode,maksimgm/learnyounode,ElTomatos/learnyounode,thenaughtychild/learnyounode,lesterhm/learnyounode,marocchino/learnyounode,Yas3r/learnyounode,ericdouglas/learnyounode,kishorsharma/learnyounode,ralphtheninja/learnyounode,ralphtheninja/learnyounode,ElTomatos/learnyounode,CNBorn/learnyounode,noikiy/learnyounode,esmitley/learnyounode,pushnoy100500/learnyounode,akashnimare/learnyounode,runithome/learnyounode,Gtskk/learnyoupython,andrewtdinh/learnyounode,zhushuanglong/learnyounode,5harf/learnyounode,esmitley/learnyounode,walhs/learnyounode,lesterhm/learnyounode,michaelgrilo/learnyounode,jojo1311/learnyounode,akashnimare/learnyounode,RoseTHERESA/learnyounode-1,keshwans/learnyounode,CNBorn/learnyounode,aijiekj/learnyounode,aijiekj/learnyounode,Gtskk/learnyoupython,metakata/learnyounode,metakata/learnyounode,kishorsharma/learnyounode,zhushuanglong/learnyounode
e62497abb96c1a8753a786e55be75b5e3bb3f90b
src/tasks/check-file-names/__tests__/index-test.js
src/tasks/check-file-names/__tests__/index-test.js
'use strict'; import { runCommand } from '../../../utils/helper-tests'; import { join } from 'path'; describe('Check file names task', () => { pit('should pass with valid file & folder names', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'valid-project') }]) ); pit('should fail if invalid file name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-file-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should fail if invalid folder name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-folder-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use global configuration if parameters are not defined', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'global-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use default configuration without specific parameters', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'default-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); });
'use strict'; import { extendJasmineTimeout, runCommand } from '../../../utils/helper-tests'; import { join } from 'path'; describe('Check file names task', () => { extendJasmineTimeout(jasmine, beforeEach, afterEach); pit('should pass with valid file & folder names', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'valid-project') }]) ); pit('should fail if invalid file name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-file-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should fail if invalid folder name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-folder-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use global configuration if parameters are not defined', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'global-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use default configuration without specific parameters', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'default-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); });
Fix checkFileNames tests (extend timeout)
Fix checkFileNames tests (extend timeout)
JavaScript
mit
urbanjs/tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/urbanjs-tools
67336759eedbcbd662d500336364ba5745ca306a
src/Schema/Address.js
src/Schema/Address.js
const mongoose = require("mongoose"); const shortid = require("shortid"); const ProcessorItem = require("./ProcessorItem"); const originals = require("mongoose-originals"); const Address = new mongoose.Schema({ _id: { type: String, default: shortid.generate, }, processor: { type: ProcessorItem, default: ProcessorItem, }, phone: String, company: String, name: String, country: String, locality: String, streetAddress: String, extendedAddress: String, postalCode: String, createdAt: Date, updatedAt: Date, }); Address.plugin(originals, { fields: [ "phone", "company", "name", "country", "locality", "streetAddress", "extendedAddress", "postalCode", ], }); module.exports = Address;
const mongoose = require("mongoose"); const shortid = require("shortid"); const ProcessorItem = require("./ProcessorItem"); const originals = require("mongoose-originals"); const Address = new mongoose.Schema({ _id: { type: String, default: shortid.generate, }, processor: { type: ProcessorItem, default: ProcessorItem, }, name: String, country: String, postalCode: String, createdAt: Date, updatedAt: Date, }); Address.plugin(originals, { fields: [ "phone", "company", "name", "country", "locality", "streetAddress", "extendedAddress", "postalCode", ], }); module.exports = Address;
Remove not needed fields from schema
Remove not needed fields from schema
JavaScript
mit
enhancv/mongoose-subscriptions
f78e46607cf15a7273ac780086a071f4cea092df
packages/meteor/server_environment.js
packages/meteor/server_environment.js
Meteor = { isClient: false, isServer: true }; try { if (process.env.METEOR_SETTINGS) Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS); } catch (e) { throw new Error("Settings are not valid JSON"); }
Meteor = { isClient: false, isServer: true }; try { Meteor.settings = {}; if (process.env.METEOR_SETTINGS) Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS); } catch (e) { throw new Error("Settings are not valid JSON"); }
Make the default for Meteor.settings be the empty object
Make the default for Meteor.settings be the empty object
JavaScript
mit
TribeMedia/meteor,henrypan/meteor,l0rd0fwar/meteor,esteedqueen/meteor,jg3526/meteor,D1no/meteor,colinligertwood/meteor,Profab/meteor,skarekrow/meteor,dfischer/meteor,shadedprofit/meteor,servel333/meteor,shadedprofit/meteor,baiyunping333/meteor,skarekrow/meteor,GrimDerp/meteor,michielvanoeffelen/meteor,jeblister/meteor,bhargav175/meteor,shmiko/meteor,modulexcite/meteor,yinhe007/meteor,luohuazju/meteor,yiliaofan/meteor,yyx990803/meteor,eluck/meteor,benjamn/meteor,mirstan/meteor,Urigo/meteor,jeblister/meteor,steedos/meteor,ljack/meteor,yyx990803/meteor,paul-barry-kenzan/meteor,sdeveloper/meteor,joannekoong/meteor,pjump/meteor,codedogfish/meteor,meonkeys/meteor,IveWong/meteor,GrimDerp/meteor,somallg/meteor,DCKT/meteor,michielvanoeffelen/meteor,dandv/meteor,jagi/meteor,Jonekee/meteor,LWHTarena/meteor,jrudio/meteor,shmiko/meteor,wmkcc/meteor,jeblister/meteor,cherbst/meteor,daslicht/meteor,joannekoong/meteor,cherbst/meteor,chinasb/meteor,somallg/meteor,sunny-g/meteor,baiyunping333/meteor,elkingtonmcb/meteor,saisai/meteor,yonas/meteor-freebsd,karlito40/meteor,yanisIk/meteor,PatrickMcGuinness/meteor,Quicksteve/meteor,rabbyalone/meteor,AnjirHossain/meteor,joannekoong/meteor,cog-64/meteor,meteor-velocity/meteor,jirengu/meteor,alexbeletsky/meteor,brettle/meteor,bhargav175/meteor,lawrenceAIO/meteor,eluck/meteor,dandv/meteor,daslicht/meteor,mirstan/meteor,ashwathgovind/meteor,4commerce-technologies-AG/meteor,servel333/meteor,ericterpstra/meteor,benjamn/meteor,benstoltz/meteor,williambr/meteor,udhayam/meteor,shmiko/meteor,oceanzou123/meteor,brettle/meteor,calvintychan/meteor,AnthonyAstige/meteor,yinhe007/meteor,sclausen/meteor,luohuazju/meteor,whip112/meteor,Puena/meteor,jdivy/meteor,codingang/meteor,chiefninew/meteor,ashwathgovind/meteor,Hansoft/meteor,modulexcite/meteor,benstoltz/meteor,DAB0mB/meteor,wmkcc/meteor,luohuazju/meteor,Prithvi-A/meteor,evilemon/meteor,baysao/meteor,ndarilek/meteor,jrudio/meteor,jrudio/meteor,neotim/meteor,kengchau/meteor,lieuwex/meteor,qscripter/meteor,wmkcc/meteor,nuvipannu/meteor,ashwathgovind/meteor,TribeMedia/meteor,rozzzly/meteor,arunoda/meteor,vacjaliu/meteor,nuvipannu/meteor,shmiko/meteor,vjau/meteor,katopz/meteor,youprofit/meteor,Prithvi-A/meteor,chmac/meteor,skarekrow/meteor,Ken-Liu/meteor,Puena/meteor,stevenliuit/meteor,lieuwex/meteor,tdamsma/meteor,lieuwex/meteor,chasertech/meteor,daltonrenaldo/meteor,Hansoft/meteor,h200863057/meteor,ndarilek/meteor,DCKT/meteor,AnthonyAstige/meteor,namho102/meteor,baiyunping333/meteor,mubassirhayat/meteor,mjmasn/meteor,evilemon/meteor,l0rd0fwar/meteor,sunny-g/meteor,allanalexandre/meteor,papimomi/meteor,l0rd0fwar/meteor,guazipi/meteor,zdd910/meteor,PatrickMcGuinness/meteor,TechplexEngineer/meteor,mauricionr/meteor,qscripter/meteor,Quicksteve/meteor,qscripter/meteor,DAB0mB/meteor,ashwathgovind/meteor,baysao/meteor,EduShareOntario/meteor,wmkcc/meteor,fashionsun/meteor,lpinto93/meteor,Theviajerock/meteor,yalexx/meteor,jenalgit/meteor,shadedprofit/meteor,michielvanoeffelen/meteor,lieuwex/meteor,pjump/meteor,AlexR1712/meteor,Hansoft/meteor,HugoRLopes/meteor,mauricionr/meteor,PatrickMcGuinness/meteor,AlexR1712/meteor,guazipi/meteor,oceanzou123/meteor,tdamsma/meteor,evilemon/meteor,namho102/meteor,arunoda/meteor,evilemon/meteor,youprofit/meteor,akintoey/meteor,benstoltz/meteor,alexbeletsky/meteor,jg3526/meteor,yiliaofan/meteor,nuvipannu/meteor,chmac/meteor,jagi/meteor,tdamsma/meteor,vacjaliu/meteor,rozzzly/meteor,newswim/meteor,michielvanoeffelen/meteor,IveWong/meteor,chasertech/meteor,rozzzly/meteor,codingang/meteor,servel333/meteor,bhargav175/meteor,judsonbsilva/meteor,EduShareOntario/meteor,lpinto93/meteor,colinligertwood/meteor,cherbst/meteor,Hansoft/meteor,mirstan/meteor,dboyliao/meteor,jg3526/meteor,chiefninew/meteor,katopz/meteor,ashwathgovind/meteor,Eynaliyev/meteor,fashionsun/meteor,sitexa/meteor,yanisIk/meteor,DAB0mB/meteor,mirstan/meteor,l0rd0fwar/meteor,paul-barry-kenzan/meteor,kencheung/meteor,baiyunping333/meteor,steedos/meteor,GrimDerp/meteor,karlito40/meteor,LWHTarena/meteor,AnthonyAstige/meteor,modulexcite/meteor,Profab/meteor,devgrok/meteor,dfischer/meteor,ericterpstra/meteor,dandv/meteor,justintung/meteor,Ken-Liu/meteor,ndarilek/meteor,arunoda/meteor,jg3526/meteor,fashionsun/meteor,Ken-Liu/meteor,Prithvi-A/meteor,chinasb/meteor,justintung/meteor,jg3526/meteor,AnjirHossain/meteor,rozzzly/meteor,brdtrpp/meteor,HugoRLopes/meteor,chiefninew/meteor,yyx990803/meteor,zdd910/meteor,sdeveloper/meteor,planet-training/meteor,TechplexEngineer/meteor,alphanso/meteor,neotim/meteor,vjau/meteor,cog-64/meteor,Urigo/meteor,ndarilek/meteor,justintung/meteor,lorensr/meteor,cbonami/meteor,tdamsma/meteor,johnthepink/meteor,vjau/meteor,bhargav175/meteor,deanius/meteor,elkingtonmcb/meteor,codedogfish/meteor,meteor-velocity/meteor,dfischer/meteor,bhargav175/meteor,shrop/meteor,DAB0mB/meteor,Puena/meteor,yalexx/meteor,judsonbsilva/meteor,elkingtonmcb/meteor,lorensr/meteor,benstoltz/meteor,SeanOceanHu/meteor,williambr/meteor,arunoda/meteor,daltonrenaldo/meteor,cherbst/meteor,meonkeys/meteor,ndarilek/meteor,katopz/meteor,alphanso/meteor,cog-64/meteor,modulexcite/meteor,udhayam/meteor,yyx990803/meteor,SeanOceanHu/meteor,saisai/meteor,allanalexandre/meteor,somallg/meteor,elkingtonmcb/meteor,yalexx/meteor,codingang/meteor,namho102/meteor,hristaki/meteor,h200863057/meteor,cbonami/meteor,yanisIk/meteor,sitexa/meteor,sclausen/meteor,Profab/meteor,jg3526/meteor,Hansoft/meteor,brdtrpp/meteor,vjau/meteor,alphanso/meteor,Hansoft/meteor,ericterpstra/meteor,rabbyalone/meteor,whip112/meteor,servel333/meteor,nuvipannu/meteor,mjmasn/meteor,fashionsun/meteor,LWHTarena/meteor,Jonekee/meteor,Hansoft/meteor,lieuwex/meteor,dfischer/meteor,yinhe007/meteor,vacjaliu/meteor,TribeMedia/meteor,SeanOceanHu/meteor,codedogfish/meteor,pandeysoni/meteor,williambr/meteor,evilemon/meteor,skarekrow/meteor,somallg/meteor,D1no/meteor,katopz/meteor,benjamn/meteor,h200863057/meteor,chmac/meteor,h200863057/meteor,youprofit/meteor,yalexx/meteor,dfischer/meteor,modulexcite/meteor,hristaki/meteor,yalexx/meteor,brdtrpp/meteor,henrypan/meteor,judsonbsilva/meteor,planet-training/meteor,wmkcc/meteor,planet-training/meteor,Puena/meteor,jagi/meteor,imanmafi/meteor,steedos/meteor,lassombra/meteor,rabbyalone/meteor,lassombra/meteor,meteor-velocity/meteor,sdeveloper/meteor,daslicht/meteor,stevenliuit/meteor,Jonekee/meteor,lawrenceAIO/meteor,Eynaliyev/meteor,chiefninew/meteor,servel333/meteor,Ken-Liu/meteor,aramk/meteor,arunoda/meteor,chasertech/meteor,yiliaofan/meteor,dboyliao/meteor,lpinto93/meteor,alexbeletsky/meteor,GrimDerp/meteor,devgrok/meteor,ljack/meteor,henrypan/meteor,chmac/meteor,paul-barry-kenzan/meteor,aleclarson/meteor,aldeed/meteor,iman-mafi/meteor,youprofit/meteor,sdeveloper/meteor,codedogfish/meteor,kidaa/meteor,somallg/meteor,meteor-velocity/meteor,Paulyoufu/meteor-1,esteedqueen/meteor,pandeysoni/meteor,IveWong/meteor,devgrok/meteor,jrudio/meteor,JesseQin/meteor,papimomi/meteor,aramk/meteor,pandeysoni/meteor,brdtrpp/meteor,oceanzou123/meteor,chinasb/meteor,cog-64/meteor,newswim/meteor,Urigo/meteor,brettle/meteor,HugoRLopes/meteor,tdamsma/meteor,chinasb/meteor,DAB0mB/meteor,newswim/meteor,imanmafi/meteor,codedogfish/meteor,whip112/meteor,vacjaliu/meteor,Eynaliyev/meteor,GrimDerp/meteor,jenalgit/meteor,dboyliao/meteor,deanius/meteor,msavin/meteor,jirengu/meteor,emmerge/meteor,luohuazju/meteor,Eynaliyev/meteor,framewr/meteor,emmerge/meteor,neotim/meteor,hristaki/meteor,codingang/meteor,yyx990803/meteor,elkingtonmcb/meteor,johnthepink/meteor,jirengu/meteor,sunny-g/meteor,HugoRLopes/meteor,papimomi/meteor,Jeremy017/meteor,JesseQin/meteor,D1no/meteor,yonas/meteor-freebsd,sitexa/meteor,deanius/meteor,yinhe007/meteor,oceanzou123/meteor,yiliaofan/meteor,servel333/meteor,benjamn/meteor,katopz/meteor,zdd910/meteor,h200863057/meteor,JesseQin/meteor,TechplexEngineer/meteor,daltonrenaldo/meteor,shadedprofit/meteor,shadedprofit/meteor,jeblister/meteor,johnthepink/meteor,calvintychan/meteor,Jeremy017/meteor,stevenliuit/meteor,baysao/meteor,AnjirHossain/meteor,ericterpstra/meteor,msavin/meteor,nuvipannu/meteor,neotim/meteor,TechplexEngineer/meteor,ericterpstra/meteor,GrimDerp/meteor,imanmafi/meteor,juansgaitan/meteor,planet-training/meteor,tdamsma/meteor,meteor-velocity/meteor,dboyliao/meteor,pjump/meteor,daltonrenaldo/meteor,yiliaofan/meteor,steedos/meteor,justintung/meteor,benstoltz/meteor,AnthonyAstige/meteor,kencheung/meteor,elkingtonmcb/meteor,aramk/meteor,williambr/meteor,meonkeys/meteor,brettle/meteor,yonas/meteor-freebsd,ljack/meteor,Quicksteve/meteor,guazipi/meteor,evilemon/meteor,justintung/meteor,TechplexEngineer/meteor,kengchau/meteor,kidaa/meteor,joannekoong/meteor,daltonrenaldo/meteor,ljack/meteor,mirstan/meteor,calvintychan/meteor,judsonbsilva/meteor,deanius/meteor,Theviajerock/meteor,servel333/meteor,johnthepink/meteor,lawrenceAIO/meteor,karlito40/meteor,pandeysoni/meteor,TechplexEngineer/meteor,alphanso/meteor,iman-mafi/meteor,aramk/meteor,queso/meteor,newswim/meteor,tdamsma/meteor,juansgaitan/meteor,esteedqueen/meteor,johnthepink/meteor,papimomi/meteor,benjamn/meteor,deanius/meteor,eluck/meteor,udhayam/meteor,framewr/meteor,baiyunping333/meteor,sclausen/meteor,lassombra/meteor,juansgaitan/meteor,JesseQin/meteor,alexbeletsky/meteor,yonas/meteor-freebsd,katopz/meteor,luohuazju/meteor,daltonrenaldo/meteor,sitexa/meteor,AnjirHossain/meteor,brdtrpp/meteor,SeanOceanHu/meteor,Jonekee/meteor,TribeMedia/meteor,jdivy/meteor,namho102/meteor,baiyunping333/meteor,daltonrenaldo/meteor,yonglehou/meteor,mubassirhayat/meteor,dev-bobsong/meteor,udhayam/meteor,jirengu/meteor,queso/meteor,dev-bobsong/meteor,mubassirhayat/meteor,pandeysoni/meteor,shmiko/meteor,kengchau/meteor,jg3526/meteor,ndarilek/meteor,planet-training/meteor,devgrok/meteor,lorensr/meteor,TribeMedia/meteor,SeanOceanHu/meteor,judsonbsilva/meteor,mirstan/meteor,yanisIk/meteor,AlexR1712/meteor,katopz/meteor,cbonami/meteor,zdd910/meteor,alphanso/meteor,aramk/meteor,h200863057/meteor,paul-barry-kenzan/meteor,yiliaofan/meteor,JesseQin/meteor,chiefninew/meteor,sitexa/meteor,HugoRLopes/meteor,papimomi/meteor,udhayam/meteor,meteor-velocity/meteor,ljack/meteor,jenalgit/meteor,DCKT/meteor,lpinto93/meteor,queso/meteor,yonglehou/meteor,kidaa/meteor,newswim/meteor,emmerge/meteor,Jeremy017/meteor,hristaki/meteor,AnthonyAstige/meteor,PatrickMcGuinness/meteor,sclausen/meteor,jdivy/meteor,hristaki/meteor,williambr/meteor,henrypan/meteor,Profab/meteor,Theviajerock/meteor,Theviajerock/meteor,Quicksteve/meteor,yonglehou/meteor,karlito40/meteor,sunny-g/meteor,esteedqueen/meteor,codedogfish/meteor,joannekoong/meteor,sunny-g/meteor,newswim/meteor,ljack/meteor,yanisIk/meteor,ashwathgovind/meteor,guazipi/meteor,chmac/meteor,fashionsun/meteor,yonglehou/meteor,vjau/meteor,IveWong/meteor,EduShareOntario/meteor,henrypan/meteor,sclausen/meteor,shadedprofit/meteor,meonkeys/meteor,juansgaitan/meteor,DCKT/meteor,lpinto93/meteor,sdeveloper/meteor,karlito40/meteor,sunny-g/meteor,AnthonyAstige/meteor,aldeed/meteor,judsonbsilva/meteor,alphanso/meteor,cog-64/meteor,lassombra/meteor,shadedprofit/meteor,rabbyalone/meteor,jeblister/meteor,cbonami/meteor,Ken-Liu/meteor,l0rd0fwar/meteor,yonas/meteor-freebsd,4commerce-technologies-AG/meteor,lpinto93/meteor,whip112/meteor,JesseQin/meteor,rozzzly/meteor,AlexR1712/meteor,allanalexandre/meteor,allanalexandre/meteor,papimomi/meteor,oceanzou123/meteor,lieuwex/meteor,alexbeletsky/meteor,allanalexandre/meteor,HugoRLopes/meteor,jeblister/meteor,baysao/meteor,saisai/meteor,evilemon/meteor,brettle/meteor,dandv/meteor,baysao/meteor,bhargav175/meteor,Jeremy017/meteor,youprofit/meteor,steedos/meteor,guazipi/meteor,vjau/meteor,kengchau/meteor,Prithvi-A/meteor,fashionsun/meteor,4commerce-technologies-AG/meteor,chinasb/meteor,udhayam/meteor,msavin/meteor,bhargav175/meteor,Eynaliyev/meteor,qscripter/meteor,tdamsma/meteor,shmiko/meteor,jdivy/meteor,colinligertwood/meteor,daslicht/meteor,AnthonyAstige/meteor,yinhe007/meteor,4commerce-technologies-AG/meteor,sdeveloper/meteor,mubassirhayat/meteor,colinligertwood/meteor,SeanOceanHu/meteor,LWHTarena/meteor,whip112/meteor,DCKT/meteor,sdeveloper/meteor,saisai/meteor,dandv/meteor,akintoey/meteor,cbonami/meteor,arunoda/meteor,vacjaliu/meteor,benjamn/meteor,sunny-g/meteor,paul-barry-kenzan/meteor,rozzzly/meteor,calvintychan/meteor,newswim/meteor,planet-training/meteor,brettle/meteor,elkingtonmcb/meteor,planet-training/meteor,chasertech/meteor,Quicksteve/meteor,kencheung/meteor,henrypan/meteor,ljack/meteor,TechplexEngineer/meteor,eluck/meteor,wmkcc/meteor,GrimDerp/meteor,daslicht/meteor,chengxiaole/meteor,shrop/meteor,Jonekee/meteor,chengxiaole/meteor,TribeMedia/meteor,chengxiaole/meteor,vacjaliu/meteor,benjamn/meteor,whip112/meteor,aldeed/meteor,chasertech/meteor,ashwathgovind/meteor,JesseQin/meteor,D1no/meteor,namho102/meteor,msavin/meteor,Theviajerock/meteor,youprofit/meteor,queso/meteor,yyx990803/meteor,dandv/meteor,jagi/meteor,jagi/meteor,DCKT/meteor,nuvipannu/meteor,shrop/meteor,DAB0mB/meteor,karlito40/meteor,pjump/meteor,jagi/meteor,PatrickMcGuinness/meteor,chasertech/meteor,devgrok/meteor,iman-mafi/meteor,sitexa/meteor,chiefninew/meteor,arunoda/meteor,aleclarson/meteor,rabbyalone/meteor,mubassirhayat/meteor,Jeremy017/meteor,chiefninew/meteor,sclausen/meteor,l0rd0fwar/meteor,4commerce-technologies-AG/meteor,yyx990803/meteor,esteedqueen/meteor,AlexR1712/meteor,justintung/meteor,neotim/meteor,cbonami/meteor,Eynaliyev/meteor,modulexcite/meteor,namho102/meteor,alexbeletsky/meteor,whip112/meteor,brdtrpp/meteor,yonas/meteor-freebsd,vjau/meteor,jirengu/meteor,judsonbsilva/meteor,saisai/meteor,eluck/meteor,stevenliuit/meteor,ndarilek/meteor,eluck/meteor,queso/meteor,skarekrow/meteor,HugoRLopes/meteor,EduShareOntario/meteor,emmerge/meteor,yinhe007/meteor,dev-bobsong/meteor,dandv/meteor,papimomi/meteor,skarekrow/meteor,imanmafi/meteor,dfischer/meteor,rozzzly/meteor,lawrenceAIO/meteor,kengchau/meteor,allanalexandre/meteor,yanisIk/meteor,sitexa/meteor,SeanOceanHu/meteor,Quicksteve/meteor,rabbyalone/meteor,Eynaliyev/meteor,michielvanoeffelen/meteor,D1no/meteor,zdd910/meteor,codingang/meteor,yalexx/meteor,lieuwex/meteor,chengxiaole/meteor,mauricionr/meteor,youprofit/meteor,Urigo/meteor,luohuazju/meteor,lorensr/meteor,saisai/meteor,devgrok/meteor,servel333/meteor,jenalgit/meteor,yiliaofan/meteor,mjmasn/meteor,msavin/meteor,chmac/meteor,jdivy/meteor,PatrickMcGuinness/meteor,alexbeletsky/meteor,ndarilek/meteor,yonglehou/meteor,DCKT/meteor,h200863057/meteor,Paulyoufu/meteor-1,chengxiaole/meteor,codingang/meteor,AnthonyAstige/meteor,Urigo/meteor,colinligertwood/meteor,lorensr/meteor,meteor-velocity/meteor,dboyliao/meteor,kidaa/meteor,4commerce-technologies-AG/meteor,Prithvi-A/meteor,cog-64/meteor,brdtrpp/meteor,yinhe007/meteor,akintoey/meteor,LWHTarena/meteor,calvintychan/meteor,framewr/meteor,imanmafi/meteor,yalexx/meteor,Puena/meteor,aramk/meteor,shrop/meteor,kencheung/meteor,jeblister/meteor,lassombra/meteor,daslicht/meteor,Jeremy017/meteor,mauricionr/meteor,Theviajerock/meteor,kidaa/meteor,cherbst/meteor,stevenliuit/meteor,yanisIk/meteor,somallg/meteor,mauricionr/meteor,meonkeys/meteor,colinligertwood/meteor,esteedqueen/meteor,qscripter/meteor,qscripter/meteor,SeanOceanHu/meteor,eluck/meteor,iman-mafi/meteor,Prithvi-A/meteor,Paulyoufu/meteor-1,msavin/meteor,IveWong/meteor,shrop/meteor,qscripter/meteor,emmerge/meteor,chasertech/meteor,LWHTarena/meteor,kencheung/meteor,emmerge/meteor,queso/meteor,Paulyoufu/meteor-1,akintoey/meteor,calvintychan/meteor,guazipi/meteor,ljack/meteor,framewr/meteor,Puena/meteor,justintung/meteor,deanius/meteor,jirengu/meteor,Jonekee/meteor,udhayam/meteor,benstoltz/meteor,pjump/meteor,Ken-Liu/meteor,AnjirHossain/meteor,dev-bobsong/meteor,jenalgit/meteor,dboyliao/meteor,framewr/meteor,somallg/meteor,yanisIk/meteor,williambr/meteor,calvintychan/meteor,mubassirhayat/meteor,Paulyoufu/meteor-1,dev-bobsong/meteor,IveWong/meteor,neotim/meteor,EduShareOntario/meteor,chengxiaole/meteor,luohuazju/meteor,jenalgit/meteor,dboyliao/meteor,allanalexandre/meteor,mjmasn/meteor,Profab/meteor,Theviajerock/meteor,meonkeys/meteor,jirengu/meteor,chmac/meteor,henrypan/meteor,dfischer/meteor,johnthepink/meteor,Ken-Liu/meteor,Jeremy017/meteor,dboyliao/meteor,Eynaliyev/meteor,fashionsun/meteor,shmiko/meteor,aleclarson/meteor,cbonami/meteor,cherbst/meteor,jdivy/meteor,jenalgit/meteor,hristaki/meteor,Paulyoufu/meteor-1,Quicksteve/meteor,framewr/meteor,rabbyalone/meteor,mirstan/meteor,lawrenceAIO/meteor,joannekoong/meteor,mjmasn/meteor,akintoey/meteor,shrop/meteor,meonkeys/meteor,aldeed/meteor,nuvipannu/meteor,codingang/meteor,chinasb/meteor,mauricionr/meteor,karlito40/meteor,aldeed/meteor,colinligertwood/meteor,michielvanoeffelen/meteor,kencheung/meteor,namho102/meteor,joannekoong/meteor,mauricionr/meteor,DAB0mB/meteor,chengxiaole/meteor,mubassirhayat/meteor,pandeysoni/meteor,iman-mafi/meteor,jagi/meteor,imanmafi/meteor,zdd910/meteor,Urigo/meteor,planet-training/meteor,paul-barry-kenzan/meteor,sclausen/meteor,D1no/meteor,4commerce-technologies-AG/meteor,dev-bobsong/meteor,Paulyoufu/meteor-1,neotim/meteor,modulexcite/meteor,johnthepink/meteor,msavin/meteor,devgrok/meteor,kengchau/meteor,iman-mafi/meteor,aldeed/meteor,D1no/meteor,D1no/meteor,vacjaliu/meteor,yonglehou/meteor,esteedqueen/meteor,oceanzou123/meteor,TribeMedia/meteor,kencheung/meteor,lorensr/meteor,sunny-g/meteor,yonglehou/meteor,steedos/meteor,alexbeletsky/meteor,baysao/meteor,paul-barry-kenzan/meteor,aldeed/meteor,aramk/meteor,codedogfish/meteor,hristaki/meteor,lorensr/meteor,stevenliuit/meteor,pandeysoni/meteor,skarekrow/meteor,Prithvi-A/meteor,Profab/meteor,stevenliuit/meteor,AlexR1712/meteor,akintoey/meteor,benstoltz/meteor,iman-mafi/meteor,daslicht/meteor,Jonekee/meteor,imanmafi/meteor,chiefninew/meteor,HugoRLopes/meteor,AnjirHossain/meteor,PatrickMcGuinness/meteor,steedos/meteor,lassombra/meteor,kengchau/meteor,Puena/meteor,emmerge/meteor,baiyunping333/meteor,framewr/meteor,mubassirhayat/meteor,ericterpstra/meteor,lawrenceAIO/meteor,EduShareOntario/meteor,juansgaitan/meteor,jdivy/meteor,oceanzou123/meteor,zdd910/meteor,Profab/meteor,Urigo/meteor,queso/meteor,alphanso/meteor,akintoey/meteor,AnjirHossain/meteor,guazipi/meteor,EduShareOntario/meteor,AlexR1712/meteor,baysao/meteor,pjump/meteor,brdtrpp/meteor,brettle/meteor,dev-bobsong/meteor,wmkcc/meteor,juansgaitan/meteor,l0rd0fwar/meteor,juansgaitan/meteor,daltonrenaldo/meteor,allanalexandre/meteor,mjmasn/meteor,somallg/meteor,kidaa/meteor,jrudio/meteor,mjmasn/meteor,lawrenceAIO/meteor,cog-64/meteor,lpinto93/meteor,yonas/meteor-freebsd,shrop/meteor,jrudio/meteor,deanius/meteor,chinasb/meteor,lassombra/meteor,karlito40/meteor,eluck/meteor,IveWong/meteor,cherbst/meteor,williambr/meteor,saisai/meteor,kidaa/meteor,ericterpstra/meteor,michielvanoeffelen/meteor,LWHTarena/meteor,pjump/meteor
876bd105dc905630f9d01d787c1d60f70113a72a
pages/authPassword/authPassword.js
pages/authPassword/authPassword.js
//var ERR = require('async-stacktrace'); var express = require('express'); var router = express.Router(); var csrf = require('../../lib/csrf'); var config = require('../../lib/config'); router.get('/', function(req, res) { res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies; res.render(__filename.replace(/\.js$/, '.ejs'), res.locals); }); router.post('/', function(req, res) { if (req.body.__action == 'assessmentPassword') { var pl_pw_origUrl = req.cookies.pl_pw_origUrl; var pwCookie = csrf.generateToken({password: req.body.password}, config.secretKey); res.cookie('pl_assessmentpw', pwCookie); res.clearCookie('pl_pw_origUrl'); return res.redirect(pl_pw_origUrl); } }); module.exports = router;
//var ERR = require('async-stacktrace'); var express = require('express'); var router = express.Router(); var csrf = require('../../lib/csrf'); var config = require('../../lib/config'); router.get('/', function(req, res) { res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies; res.render(__filename.replace(/\.js$/, '.ejs'), res.locals); }); router.post('/', function(req, res) { if (req.body.__action == 'assessmentPassword') { var pl_pw_origUrl = req.cookies.pl_pw_origUrl; var maxAge = 1000 * 60 * 60 * 12; // 12 hours var pwCookie = csrf.generateToken({password: req.body.password, maxAge: maxAge}, config.secretKey); res.cookie('pl_assessmentpw', pwCookie, {maxAge: maxAge}); res.clearCookie('pl_pw_origUrl'); return res.redirect(pl_pw_origUrl); } }); module.exports = router;
Add timeouts to CSRF and cookie
Add timeouts to CSRF and cookie
JavaScript
agpl-3.0
parasgithub/PrairieLearn,parasgithub/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,parasgithub/PrairieLearn,rbessick5/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn
c0f10b0f04d691ad7ad2e2bcc5a28effc0f20414
src/index.js
src/index.js
import React from 'react'; import Logo from './components/logo' import SocialButtons from './components/social-buttons' import Navigation from './components/navigation' import Home from './components/home' import Footer from './components/footer' class Page { render() { return ( <div id="wrapper" className="pure-g"> <header className="pure-u-2-3"> <Logo/> <SocialButtons/> <Navigation /> </header> <Home/> <Footer /> </div> ) } } React.render(<Page/>, document.getElementById('app'));
import React from 'react'; import Logo from './components/logo' import SocialButtons from './components/social-buttons' import Navigation from './components/navigation' import Home from './components/home'; import Footer from './components/footer'; import AppUrl from './appurl' class Page { render() { let appUrl = new AppUrl(); const siteComponent = this.props.siteComponent; return ( <div id="wrapper" className="pure-g"> <header className="pure-u-2-3"> <Logo/> <SocialButtons/> <Navigation appUrl={appUrl} /> </header> {siteComponent} <Footer /> </div> ) } } const rerender = (siteComponent = <Home />) => { React.render(<Page siteComponent={siteComponent} />, document.getElementById('app')); }; import {parse as parseUrl} from 'url'; import Chronicle from './lexicon/chronicle' window.addEventListener('hashchange', ({newURL: newUrl}) => { const parsedUrl = parseUrl(newUrl); processUrl(parsedUrl); }); function processUrl(parsedUrl) { if (parsedUrl && parsedUrl.hash && parsedUrl.hash.startsWith('#/')) { if (parsedUrl.hash.match(/^#\/chronicle/)) { Chronicle.componentWithData((chronicleComponent) => { rerender(chronicleComponent); }); } } else { rerender(<Home />); } } processUrl();
Load the page according to the current url, using hashes.
Load the page according to the current url, using hashes.
JavaScript
mit
cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki
969aa542268675b9edfeae9a8139d229712f1000
server.js
server.js
var util = require('util'), connect = require('connect'), serveStatic = require('serve-static'), port = 80, app = connect(); app.use(serveStatic(__dirname)).listen(port); util.puts('Listening on ' + port + '...'); util.puts('Press Ctrl + C to stop.');
var util = require('util'), connect = require('connect'), serveStatic = require('serve-static'), port = process.env.PORT || 3000, app = connect(); app.use(serveStatic(__dirname)).listen(port); util.puts('Listening on ' + port + '...'); util.puts('Press Ctrl + C to stop.');
Update so PORT environment variable is used
Update so PORT environment variable is used
JavaScript
mit
maael/design-patterns-presentation
a6bb5eedb0f26bcdb5b837a5cffd86122db42cf8
src/index.js
src/index.js
// @flow import { elementNames } from './config' import create from './helper' export { apply } from './helper' export function tag(head: string, ...tail: any[]): Function { return create(head)(...tail) } export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } { const helpers = {} names.forEach(name => { helpers[name] = create(name) }) return helpers } export default createHelpers(elementNames)
// @flow import { elementNames } from './config' import create from './helper' export { apply } from './helper' function tag(head: string, ...tail: any[]): Function { return create(head)(...tail) } export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } { const helpers = {} names.forEach(name => { helpers[name] = create(name) }) helpers.tag = tag return helpers } export default createHelpers(elementNames)
Move `tag` helper in default export
Move `tag` helper in default export
JavaScript
mit
ktsn/vue-vnode-helper,ktsn/vue-vnode-helper
bc30514628a5bf9ccd4f92999115ee75c499e2ad
server.js
server.js
var restify = require('restify'); var mainController = require('./controllers/mainController'); var server = restify.createServer({ name: 'self-signed' }); server.use(restify.bodyParser()); server.put('/:client/key', mainController.key); server.get('/:client/key', mainController.publicKey); server.get('/:client/sign', mainController.sign); server.listen(3000, function(){ console.log('Server started at port: 3000'); });
var restify = require('restify'); var mainController = require('./controllers/mainController'); var server = restify.createServer({ name: 'self-signed' }); server.use(restify.bodyParser()); server.put('/:client/key', mainController.key); server.get('/:client/key', mainController.publicKey); server.post('/:client/sign', mainController.sign); server.listen(3000, function(){ console.log('Server started at port: 3000'); });
Move signing method to post verb
Move signing method to post verb
JavaScript
mit
shtpavel/node-signing-server
373fdd2d21739f38464fb502a75c063f07c8d1cf
src/index.js
src/index.js
var Alexa = require('alexa-sdk'); var APP_ID = 'amzn1.ask.skill.933585d3-ba4a-49f9-baed-86e109c589ed'; var SKILL_NAME = 'Snack Overflow'; var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ]; exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context, callback); alexa.registerHandlers(getRecipieHandlers); alexa.execute(); }; var getRecipieHandlers = { 'whatShouldIMakeIntent': function() { var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length); this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]); } };
var Alexa = require('alexa-sdk'); var APP_ID = 'amzn1.ask.skill.85ae7ea2-b727-4d2a-9765-5c563a5ec379'; var SKILL_NAME = 'Snack Overflow'; var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ]; exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context, callback); alexa.registerHandlers(getRecipieHandlers); alexa.execute(); }; var getRecipieHandlers = { 'whatShouldIMakeIntent': function() { var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length); this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]); } };
Update APP_ID to correct app id
Update APP_ID to correct app id
JavaScript
mit
cwboden/amazon-hackathon-alexa
0825b7031e33edfd6d684118046bced28b0a2fd2
src/index.js
src/index.js
import isFunction from 'lodash/isFunction'; import isObject from 'lodash/isObject'; import assign from 'lodash/assign'; import pick from 'lodash/pick'; import flatten from 'lodash/flatten'; import pickBy from 'lodash/pickBy'; import assignWith from 'lodash/assignWith'; import compose from './compose'; export const isDescriptor = isObject; export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose); export const isComposable = obj => isDescriptor(obj) || isStamp(obj); export const init = (...functions) => compose({ initializers: flatten(functions) }); export const overrides = (...keys) => { const flattenKeys = flatten(keys); return compose({ initializers: [function (opt) { assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys)); }] }); }; export const namespaced = (keyStampMap) => { const keyStampMapClone = pickBy(keyStampMap, isStamp); return compose({ initializers: [function (opt) { const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]); assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt)); assign(this, optClone); }] }); };
import { isFunction, isObject, assign, assignWith, pick, pickBy, flatten } from 'lodash'; import compose from './compose'; export const isDescriptor = isObject; export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose); export const isComposable = obj => isDescriptor(obj) || isStamp(obj); export const init = (...functions) => compose({ initializers: flatten(functions) }); export const overrides = (...keys) => { const flattenKeys = flatten(keys); return compose({ initializers: [function (opt) { assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys)); }] }); }; export const namespaced = (keyStampMap) => { const keyStampMapClone = pickBy(keyStampMap, isStamp); return compose({ initializers: [function (opt) { const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]); assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt)); assign(this, optClone); }] }); };
Use single import of lodash
Use single import of lodash
JavaScript
mit
stampit-org/stamp-utils
a8c322a16c2a81f72b1632279604db757bd9cd2a
server.js
server.js
'use strict'; var express = require('express'); var routes = require('./app/routes/index.js'); var mongoose = require('mongoose'); var passport = require('passport'); var session = require('express-session'); var bodyParser = require('body-parser') var app = express(); require('dotenv').load(); require('./app/config/passport')(passport); mongoose.connect(process.env.MONGO_URI); mongoose.Promise = global.Promise; // Configure server to parse JSON for us app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use('/controllers', express.static(process.cwd() + '/app/controllers')); app.use('/public', express.static(process.cwd() + '/public')); app.use(session({ secret: 'secretClementine', resave: false, saveUninitialized: true })); app.use(passport.initialize()); app.use(passport.session()); routes(app, passport); var port = process.env.PORT || 8080; app.listen(port, function () { console.log('Node.js listening on port ' + port + '...'); });
'use strict'; var express = require('express'); var routes = require('./app/routes/index.js'); var mongoose = require('mongoose'); var passport = require('passport'); var session = require('express-session'); var bodyParser = require('body-parser') var app = express(); // require('dotenv').load(); require('./app/config/passport')(passport); mongoose.connect(process.env.MONGO_URI); mongoose.Promise = global.Promise; // Configure server to parse JSON for us app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use('/controllers', express.static(process.cwd() + '/app/controllers')); app.use('/public', express.static(process.cwd() + '/public')); app.use(session({ secret: 'secretClementine', resave: false, saveUninitialized: true })); app.use(passport.initialize()); app.use(passport.session()); routes(app, passport); var port = process.env.PORT || 8080; app.listen(port, function () { console.log('Node.js listening on port ' + port + '...'); });
Comment out dotenv for heroku deployment
Comment out dotenv for heroku deployment
JavaScript
mit
jcsgithub/jcsgithub-votingapp,jcsgithub/jcsgithub-votingapp
d715a4bbc039e4959caabcb3e92ccc8a7626d555
public/javascripts/application.js
public/javascripts/application.js
$(document).ready(function() { var divs = "#flash_success, #flash_notice, #flash_error"; $(divs).each(function() { humanMsg.displayMsg($(this).text()); return false; }); if (window.location.href.search(/query=/) == -1) { $('#query').one('click', function() { $(this).val(''); }); } $(document).bind('keyup', function(event) { if ($(event.target).is(':input')) { return; } if (event.which == 83) { $('#query').focus(); } }); if ($('.count').length > 0) { setInterval(function() { $.getJSON("/api/v1/downloads.json", function(data) { $(".count strong").text(number_with_delimiter(data['total']) + " downloads"); }); }, 5000); } }); // http://kevinvaldek.com/number-with-delimiter-in-javascript function number_with_delimiter(number, delimiter) { number = number + '', delimiter = delimiter || ','; var split = number.split('.'); split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter); return split.join('.'); };
$(document).ready(function() { $('#flash_success, #flash_notice, #flash_error').each(function() { humanMsg.displayMsg($(this).text()); }); if (window.location.href.search(/query=/) == -1) { $('#query').one('click, focus', function() { $(this).val(''); }); } $(document).bind('keyup', function(event) { if ($(event.target).is(':input')) { return; } if (event.which == 83) { $('#query').focus(); } }); if ($('.count').length > 0) { setInterval(function() { $.getJSON('/api/v1/downloads.json', function(data) { $('.count strong') .text(number_with_delimiter(data['total']) + ' downloads'); }); }, 5000); } }); // http://kevinvaldek.com/number-with-delimiter-in-javascript function number_with_delimiter(number, delimiter) { number = number + '', delimiter = delimiter || ','; var split = number.split('.'); split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter); return split.join('.'); };
Clear the search query on focus as well and some minor JS clean up.
Clear the search query on focus as well and some minor JS clean up.
JavaScript
mit
bpm/getbpm.org,bpm/getbpm.org,alloy/gemcutter,dstrctrng/private_event,square/rubygems.org,alloy/gemcutter,dstrctrng/private_event,rubygems/rubygems.org-backup,rubygems/rubygems.org-backup,square/rubygems.org,1337807/rubygems.org,1337807/rubygems.org,square/rubygems.org,1337807/rubygems.org,rubygems/rubygems.org-backup
56a95bd9065a4299a0195b6408ade51b47640ee2
services/bovada.js
services/bovada.js
const axios = require('axios'); const BovadaParser = require('../services/BovadaParser'); axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football'; axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36'; module.exports.getLines = async () => { const [regSeasonResp, playoffResp] = await Promise.all([ axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'), ]); return BovadaParser.call(regSeasonResp.data) .concat(BovadaParser.call(playoffResp.data)); };
const axios = require('axios'); const BovadaParser = require('../services/BovadaParser'); axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football'; axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36'; module.exports.getLines = async () => { const [regSeasonResp, playoffResp, superBowlResp] = await Promise.all([ axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/super-bowl?marketFilterId=def&preMatchOnly=true&lang=en'), ]); return BovadaParser.call(regSeasonResp.data) .concat(BovadaParser.call(playoffResp.data)) .concat(BovadaParser.call(superBowlResp.data)); };
Add Bovada endpoint for super bowl lines
Add Bovada endpoint for super bowl lines
JavaScript
mit
lentz/buddyduel,lentz/buddyduel,lentz/buddyduel
eeee14f6c0d0ae83cce051024739940960474147
plugin.js
plugin.js
/** * @file insert Non-Breaking SPace for CKEditor * Copyright (C) 2014 Alfonso Martnez de Lizarrondo * Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor * */ CKEDITOR.plugins.add( 'nbsp', { init : function( editor ) { // Insert &nbsp; if Ctrl+Space is pressed: editor.addCommand( 'insertNbsp', { exec: function( editor ) { editor.insertHtml( '&nbsp;' ); } }); editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' ); } } );
/** * @file insert Non-Breaking Space for CKEditor * Copyright (C) 2014 Alfonso Martínez de Lizarrondo * Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor * */ CKEDITOR.plugins.add( 'nbsp', { init : function( editor ) { // Insert &nbsp; if Ctrl+Space is pressed: editor.addCommand( 'insertNbsp', { exec: function( editor ) { editor.insertHtml( '&nbsp;', 'text' ); } }); editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' ); } } );
Fix inline tag splitting and comment formatting
Fix inline tag splitting and comment formatting
JavaScript
mpl-2.0
AlfonsoML/nbsp
0e3042f89fb16fe3c130d1044b8e9c7f599f8e72
server.js
server.js
var app = require('express')(); var parser = require('./src/scrip').parse; app.get('/', function (req, res) { var scrip = req.query.scrip; var result = parser(scrip); res.send(result); }); app.listen('8000');
var app = require('express')(); var parser = require('./src/scrip').parse; app.get('/', function (req, res) { var scrip = req.query.scrip; if (scrip) { var result = parser(scrip); res.status(200).json(result); } else { res.status(422).json({'error': 'Invalid data'}); } }); app.listen('8000'); module.exports = app;
Return 422 for invalid parameters
Return 422 for invalid parameters
JavaScript
mit
pranavrc/scrip
64de8750546e31361e85a1ebe2917afe2c7c30df
mspace.js
mspace.js
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*jslint browser: true*/ "use strict"; (function () { window.addEventListener("load", function () { // Insert mathml.css if the <mspace> element is not supported. var box, div, link; div = document.createElement("div"); div.innerHTML = "<math><mspace height='23px' width='77px'/></math>"; document.body.appendChild(div); box = div.firstChild.firstChild.getBoundingClientRect(); document.body.removeChild(div); if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) { link = document.createElement("link"); link.href = "http://fred-wang.github.io/mathml.css/mathml.css"; link.rel = "stylesheet"; document.head.appendChild(link); } }); }());
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*jslint browser: true*/ "use strict"; (function () { window.addEventListener("load", function () { // Insert mathml.css if the <mspace> element is not supported. var box, div, link; div = document.createElement("div"); div.innerHTML = "<math xmlns='http://www.w3.org/1998/Math/MathML'><mspace height='23px' width='77px'/></math>"; document.body.appendChild(div); box = div.firstChild.firstChild.getBoundingClientRect(); document.body.removeChild(div); if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) { link = document.createElement("link"); link.href = "http://fred-wang.github.io/mathml.css/mathml.css"; link.rel = "stylesheet"; document.head.appendChild(link); } }); }());
Add a MathML namespace so that the detection works in XML too.
Add a MathML namespace so that the detection works in XML too.
JavaScript
mpl-2.0
fred-wang/mathml.css,josephlewis42/mathml.css,fred-wang/mathml.css,josephlewis42/mathml.css
47b5d6c7a2e90dec04f1b7e751abed54347488a2
public/js/views/DashboardMainGraph.js
public/js/views/DashboardMainGraph.js
define([], function() { 'use strict'; return Backbone.View.extend({ jqplotId: null, initialize: function(options) { this.render(); var view = this; diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) { view.options.dashArgs.interval = interval; view.render(); }); }, render: function() { // Use convention-based IDs so markup can just hold positional containers. this.jqplotId = this.el.id + '-canvas'; var url = this.buildUrl('/job/count_all_graph?', { interval: this.options.dashArgs.interval }, false); var view = this; $.ajax( url, { success: function(data) { view.$el.empty(); view.$el.append($('<div>').attr('id', view.jqplotId)); var graphData = []; _.each(data, function(result, time) { graphData.push([time, result.count]); }); var defaults = { xaxis: { renderer: $.jqplot.DateAxisRenderer } }; var axes = diana.helpers.Graph.adjustAxes(graphData, defaults); try { $.jqplot( view.jqplotId, [graphData], { title: 'Events', axes: axes, series:[{lineWidth:2}] } ); } catch (e) { if (e.message != 'No data to plot.') { console.log(e); } } } }); } }); });
define([], function() { 'use strict'; return Backbone.View.extend({ jqplotId: null, initialize: function(options) { this.render(); var view = this; diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) { view.options.dashArgs.interval = interval; view.navigate('dashboard', view.options.dashArgs, {trigger: false}); view.render(); }); }, render: function() { // Use convention-based IDs so markup can just hold positional containers. this.jqplotId = this.el.id + '-canvas'; var url = this.buildUrl('/job/count_all_graph?', { interval: this.options.dashArgs.interval }, false); var view = this; $.ajax( url, { success: function(data) { view.$el.empty(); view.$el.append($('<div>').attr('id', view.jqplotId)); var graphData = []; _.each(data, function(result, time) { graphData.push([time, result.count]); }); var defaults = { xaxis: { renderer: $.jqplot.DateAxisRenderer } }; var axes = diana.helpers.Graph.adjustAxes(graphData, defaults); try { $.jqplot( view.jqplotId, [graphData], { title: 'Events', axes: axes, series:[{lineWidth:2}] } ); } catch (e) { if (e.message != 'No data to plot.') { console.log(e); } } } }); } }); });
Update route on interval drop-down changes.
Update route on interval drop-down changes.
JavaScript
mit
codeactual/mainevent
9b5395ab11d8b28bc996f42e266a11a591057551
online.js
online.js
#!/usr/bin/env node 'use strict'; let [,, onLineSrc, onCloseSrc ] = process.argv; let onLine = eval(onLineSrc) || (line => line); let onClose = eval(onCloseSrc) || (() => undefined); let env = new Set(); require('readline') .createInterface({ input: process.stdin }) .on('line', line => { let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || []; let value = onLine(line, columns, env); if (value != null) { console.log(value); } }) .on('close', () => { onClose(env); });
#!/usr/bin/env node 'use strict'; let [,, onLineSrc, onCloseSrc ] = process.argv; let onLine = eval(onLineSrc) || (line => line); let onClose = eval(onCloseSrc) || (() => undefined); let env = new Set(); require('readline') .createInterface({ input: process.stdin }) .on('line', line => { let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || []; let value = onLine(line, columns, env); if (value != null) { console.log(value); } }) .on('close', () => { let value = onClose(env); if (value != null) { console.log(value); } });
Print the return value of onClose if it's not null
Print the return value of onClose if it's not null
JavaScript
mit
bsdelf/scripts
0b942a6b920c3562468b21ff865c729eda5fe453
public/js/login.js
public/js/login.js
/* eslint-env jquery */ start(); function start () { 'use strict'; $(document).ready(() => { $('form').submit(event => { event.preventDefault(); const username = $('#username').val(); const password = $('#password').val(); const loginObj = { username, password }; $.post({ url: '/login', data: JSON.stringify(loginObj), dataType: 'JSON', contentType: "application/json; charset=utf-8", success: (result) => console.log(result) }); }); }); }
/* eslint-env jquery */ start(); function start () { 'use strict'; $(document).ready(() => { $('form').submit(event => { event.preventDefault(); const username = $('#username').val(); const password = $('#password').val(); const loginObj = { username, password }; $.post({ url: '/login', data: JSON.stringify(loginObj), dataType: 'JSON', contentType: 'application/json; charset=utf-8', success: (result) => console.log(result) }); }); }); }
Change double quotes to single quotes
Change double quotes to single quotes
JavaScript
apache-2.0
ailijic/era-floor-time,ailijic/era-floor-time
e558d635be3c497a4766900400ad8b2acb26282f
gulpfile.js
gulpfile.js
var gulp = require('gulp') var connect = require('gulp-connect') var inlinesource = require('gulp-inline-source') gulp.task('connect', () => { connect.server({ root: 'dist', livereload: true }) }) gulp.task('html', () => { gulp.src('./src/index.html') .pipe(inlinesource()) .pipe(gulp.dest('./dist/')) .pipe(connect.reload()) }) gulp.task('watch', () => { gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']) }) gulp.task('default', ['connect', 'watch', 'html'])
var gulp = require('gulp'); var connect = require('gulp-connect'); var inlinesource = require('gulp-inline-source'); gulp.task('connect', () => { connect.server({ root: 'dist', livereload: true }) }) gulp.task('html', () => { gulp.src('./src/index.html') .pipe(inlinesource()) .pipe(gulp.dest('./dist/')) .pipe(connect.reload()); }) gulp.task('watch', () => { gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']); }) gulp.task('default', ['connect', 'watch', 'html']); gulp.task('test', ['html']);
Add test task for Gulp
Add test task for Gulp
JavaScript
mit
jeerbl/beat.pm,jeerbl/beat.pm
ead960958b97975c73851633e4c530ada3f374b8
gulpfile.js
gulpfile.js
'use strict'; const gulp = require('gulp'), fs = require('fs'), plumber = require('gulp-plumber'); const options = { source: 'templates', dist: 'dist', workingDir: 'tmp', src: function plumbedSrc() { return gulp.src.apply(gulp, arguments).pipe(plumber()); } }; /** * Load tasks from the '/tasks' directory. */ const build = require('./tasks/build')(options); const checkDeps = require('./tasks/check-deps')(options); const dupe = require('./tasks/dupe')(options); const less = require('./tasks/less')(options); const lint = require('./tasks/lint')(options); const postcss = require('./tasks/postcss')(options); const sass = require('./tasks/sass')(options); /* By default templates will be built into '/dist' */ gulp.task( 'default', gulp.series( ('dupe', 'less', 'sass', 'postcss', 'lint', 'build'), () => { /* gulp will watch for changes in '/templates'. */ gulp.watch( [ options.source + '/**/*.html', options.source + '/**/*.css', options.source + '/**/*.scss', options.source + '/**/*.less', options.source + '/**/conf.json' ], { delay: 500 }, gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build') ) } ) );
'use strict'; const gulp = require('gulp'), fs = require('fs'), plumber = require('gulp-plumber'); const options = { source: 'templates', dist: 'dist', workingDir: 'tmp', src: function plumbedSrc() { return gulp.src.apply(gulp, arguments).pipe(plumber()); } }; /** * Load tasks from the '/tasks' directory. */ const build = require('./tasks/build')(options); const checkDeps = require('./tasks/check-deps')(options); const dupe = require('./tasks/dupe')(options); const less = require('./tasks/less')(options); const lint = require('./tasks/lint')(options); const postcss = require('./tasks/postcss')(options); const sass = require('./tasks/sass')(options); /* Runs the entire pipeline once. */ gulp.task('run-pipeline', gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build')); /* By default templates will be built into '/dist'. */ gulp.task( 'default', gulp.series( 'run-pipeline', () => { /* gulp will watch for changes in '/templates'. */ gulp.watch( [ options.source + '/**/*.html', options.source + '/**/*.css', options.source + '/**/*.scss', options.source + '/**/*.less', options.source + '/**/conf.json' ], { delay: 500 }, gulp.series('run-pipeline') ) } ) );
Create a gulp task to run pipeline once
Create a gulp task to run pipeline once
JavaScript
mit
fadeit/responsive-html-email-signature,fadeit/responsive-html-email-signature
44d6583901f0eaabfb12594110397cdbfb8f21ad
gulpfile.js
gulpfile.js
var gulp = require("gulp"); var typescript = require("gulp-typescript"); const tsconfig = typescript.createProject("tsconfig.json"); gulp.task("compile", () => { return gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"]) .pipe(tsconfig()) .pipe(gulp.dest("./build")); });
const argv = require("argv"); const gulp = require("gulp"); const path = require("path"); const sourcemaps = require("gulp-sourcemaps"); const typescript = require("gulp-typescript"); const args = argv.option({name: "env", short: "e", type: "string"}).run(); const isDebug = args.options["env"] === "debug"; const destDirname = isDebug ? "debug" : "build" const dest = `./${destDirname}`; const tsconfig = typescript.createProject("tsconfig.json"); gulp.task("compile", () => { const src = gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"], { base: "./src" }); if (isDebug) { return src.pipe(sourcemaps.init()) .pipe(tsconfig()) .pipe(sourcemaps.mapSources((sourcePath, file) => { const from = path.resolve(path.join(__dirname, destDirname)); const to = path.dirname(file.path); return path.join(path.relative(from, to), sourcePath); })) .pipe(sourcemaps.write("")) .pipe(gulp.dest(dest)); } else { return src.pipe(tsconfig()) .pipe(gulp.dest(dest)); } }); gulp.task("build", ["compile"]);
Fix project setup to support production and debug
Fix project setup to support production and debug
JavaScript
mit
nickp10/shuffler,nickp10/shuffler
d5d5e4f18a4a3fb467bac398a0a28d5c9a1701f4
server/routes/dashboard/dashboard.route.js
server/routes/dashboard/dashboard.route.js
const express = require('express') const router = express.Router() module.exports = router
const express = require('express') const queryHelper = require('../../utilities/query') const router = express.Router() router.get('/number-of-student', (req, res) => { queryHelper.queryAndResponse({ sql: `select substr(student_id, 1, 2) as academic_year, count(*) as student_count from students group by substr(student_id, 1, 2)`, req: req, res: res }) }) router.get('/average-gpax', (req, res) => { queryHelper.queryAndResponse({ sql: `SELECT SUBSTRING(student_id, 1, 2) as academic_year, count(*) as student_count FROM students group by SUBSTRING(student_id, 1, 2)`, req: req, res: res }) }) module.exports = router
Add some service to dashboard
Add some service to dashboard
JavaScript
mit
JThanat/student-management-system,JThanat/student-management-system
2ce08f2ca4392a0a5753106e2f582a3310914596
gulpfile.js
gulpfile.js
var gulp = require('gulp'), // this is an arbitrary object that loads all gulp plugins in package.json. coffee = require('coffee-script/register'), $ = require("gulp-load-plugins")(), express = require('express'), path = require('path'), tinylr = require('tiny-lr'), assets = require('connect-assets'), app = express(), server = tinylr(); gulp.task('express', function() { // app.use(express.static(path.resolve('./dist'))); app.set('views', 'src/views'); app.set('view engine', 'jade'); require('./routes')(app); app.use(assets({ paths: ['src/scripts', 'src/images', 'src/stylesheets', 'src/views'] })); app.listen(1337); $.util.log('Listening on port: 1337'); }); // Default Task gulp.task('default', ['express']);
var gulp = require('gulp'), // this is an arbitrary object that loads all gulp plugins in package.json. coffee = require('coffee-script/register'), $ = require("gulp-load-plugins")(), express = require('express'), path = require('path'), tinylr = require('tiny-lr'), assets = require('connect-assets'), app = express(), server = tinylr(); gulp.task('express', function() { // app.use(express.static(path.resolve('./dist'))); app.set('views', 'src/views'); app.set('view engine', 'jade'); require('./routes')(app); app.use(assets({ paths: [ 'src/scripts', 'src/images', 'src/stylesheets', 'src/views', 'bower_components' ] })); app.listen(1337); $.util.log('Listening on port: 1337'); }); // Default Task gulp.task('default', ['express']);
Include bower components as assets
Include bower components as assets
JavaScript
mit
GeoSensorWebLab/Arctic-Scholar-Portal,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/Arctic-Scholar-Portal
4ab099864a19bc91b50122853b6dc1808466d443
gulpfile.js
gulpfile.js
var bower = require('bower'), eventStream = require('event-stream'), gulp = require('gulp'), chmod = require('gulp-chmod'), zip = require('gulp-zip'), tar = require('gulp-tar'), gzip = require('gulp-gzip'); // Installs bower dependencies gulp.task('bower', function(callback) { bower.commands.install([], {}, {}) .on('error', function(error) { callback(error); }) .on('end', function() { callback(); }); }); // Builds and packs plugins sources gulp.task('default', ['bower'], function() { var version = require('./package.json').version; return eventStream.merge( getSources() .pipe(zip('emoji-plugin-' + version + '.zip')), getSources() .pipe(tar('emoji-plugin-' + version + '.tar')) .pipe(gzip()) ) .pipe(chmod(0644)) .pipe(gulp.dest('release')); }); /** * Returns files stream with the plugin sources. * * @returns {Object} Stream with VinylFS files. */ var getSources = function() { return gulp.src([ 'Plugin.php', 'README.md', 'LICENSE', 'js/*', 'css/*', 'components/emoji-images/emoji-images.js', 'components/emoji-images/readme.md', 'components/emoji-images/pngs/*' ], {base: './'} ); }
var bower = require('bower'), eventStream = require('event-stream'), gulp = require('gulp'), chmod = require('gulp-chmod'), zip = require('gulp-zip'), tar = require('gulp-tar'), gzip = require('gulp-gzip'); // Installs bower dependencies gulp.task('bower', function(callback) { bower.commands.install([], {}, {}) .on('error', function(error) { callback(error); }) .on('end', function() { callback(); }); }); gulp.task('prepare-release', ['bower'], function() { var version = require('./package.json').version; return eventStream.merge( getSources() .pipe(zip('emoji-plugin-' + version + '.zip')), getSources() .pipe(tar('emoji-plugin-' + version + '.tar')) .pipe(gzip()) ) .pipe(chmod(0644)) .pipe(gulp.dest('release')); }); // Builds and packs plugins sources gulp.task('default', ['prepare-release'], function() { // The "default" task is just an alias for "prepare-release" task. }); /** * Returns files stream with the plugin sources. * * @returns {Object} Stream with VinylFS files. */ var getSources = function() { return gulp.src([ 'Plugin.php', 'README.md', 'LICENSE', 'js/*', 'css/*', 'components/emoji-images/emoji-images.js', 'components/emoji-images/readme.md', 'components/emoji-images/pngs/*' ], {base: './'} ); }
Add prepare-release task for consistency
Add prepare-release task for consistency
JavaScript
apache-2.0
Mibew/emoji-plugin,Mibew/emoji-plugin
a91c6b4ca951b8cf5d1076d4f7b35746ddbf034f
shared/chat/conversation/messages/retry.js
shared/chat/conversation/messages/retry.js
// @flow import React from 'react' import {globalColors} from '../../../styles' import {Box, Text} from '../../../common-adapters' const Retry = ({onRetry}: {onRetry: () => void}) => ( <Box> <Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text> <Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text> <Text type='BodySmall' style={{color: globalColors.red, textDecoration: 'underline'}} onClick={onRetry}>Retry</Text> </Box> ) export default Retry
// @flow import React from 'react' import {globalColors, globalStyles} from '../../../styles' import {Text} from '../../../common-adapters' const Retry = ({onRetry}: {onRetry: () => void}) => ( <Text type='BodySmall'> <Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text> <Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text> <Text type='BodySmall' style={{color: globalColors.red, ...globalStyles.textDecoration('underline')}} onClick={onRetry}>Retry</Text> </Text> ) export default Retry
Fix styling of Retry component on mobile
Fix styling of Retry component on mobile
JavaScript
bsd-3-clause
keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client
c1fce5f22ff9d83c06981be01a63b5b2da739f6d
website/app/application/core/projects/project/home/home.js
website/app/application/core/projects/project/home/home.js
(function (module) { module.controller('projectHome', projectHome); projectHome.$inject = ["project"]; function projectHome(project, ui) { var ctrl = this; ctrl.project = project; } }(angular.module('materialscommons')));
(function (module) { module.controller('projectHome', projectHome); projectHome.$inject = ["project"]; function projectHome(project) { var ctrl = this; ctrl.project = project; } }(angular.module('materialscommons')));
Remove reference to unused ui service.
Remove reference to unused ui service.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
7b3bdf9c919d38bf18b8825d75deb0f6018c0e37
httpmock.js
httpmock.js
var argv = require('optimist') .usage("Usage: $0 --config [config] --port [port]") .demand(['config']) .default('port', 5000) .argv; var mock = require('./src/mock.js').mock; mock(argv.port, process.cwd + "/" + argv.config);
var argv = require('optimist') .usage("Usage: $0 --config [config] --port [port]") .demand(['config']) .default('port', 5000) .argv; var mock = require('./src/mock.js').mock; mock(argv.port, argv.config);
Revert "Look for mock.js in the current directory"
Revert "Look for mock.js in the current directory" This reverts commit c7f1aa03479a7fd2dedc5d172fbdc0dc692bcf85. Conflicts: httpmock.js
JavaScript
mit
tildedave/httpmock.js
389851c4db207fbd92b424fe1bbccf773745f99b
config.js
config.js
/** * React Static Boilerplate * https://github.com/koistya/react-static-boilerplate * Copyright (c) Konstantin Tarkus (@koistya) | MIT license */ export default { title: 'Flashcards', description: 'For studying stuff. Indeed, for learning stuff.', googleAnalyticsId: 'UA-XXXXX-X', };
/** * React Static Boilerplate * https://github.com/koistya/react-static-boilerplate * Copyright (c) Konstantin Tarkus (@koistya) | MIT license */ export default { title: 'Super Flash Cards', description: 'For studying stuff. Indeed, for learning stuff.', googleAnalyticsId: 'UA-XXXXX-X', };
Change default <title> to "Super Flash Cards"
Change default <title> to "Super Flash Cards"
JavaScript
mit
ahw/flash-cards-static-app,ahw/superflash.cards
91942007195c4eaa1f800be8854e6223b402a0ce
testem.js
testem.js
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'PhantomJS', 'Chrome' ], launch_in_dev: [ 'PhantomJS', 'Chrome' ], browser_args: { Chrome: [ '--disable-gpu', '--headless', '--remote-debugging-port=9222', '--window-size=1440,900' ] } };
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], browser_args: { Chrome: { mode: 'ci', args: [ // --no-sandbox is needed when running Chrome inside a container process.env.TRAVIS ? '--no-sandbox' : null, '--disable-gpu', '--headless', '--remote-debugging-port=0', '--window-size=1440,900' ] }, } };
Use `--no-sandbox` on TravisCI 🔨
Use `--no-sandbox` on TravisCI 🔨 Related to use of Headless Chrome, see https://github.com/ember-cli/ember-cli/pull/7566.
JavaScript
mit
dunnkers/ember-polymer-paper,dunnkers/ember-polymer-paper
415719a72236bb4609d8112037ed2e49a9cc2d9a
testem.js
testem.js
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], browser_args: { Chrome: { mode: 'ci', args: [ '--disable-gpu', '--headless', '--remote-debugging-port=9222', '--window-size=1440,900' ] }, } };
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], browser_args: { Chrome: { mode: 'ci', args: [ '--disable-gpu', '--headless', '--no-sandbox', '--remote-debugging-port=9222', '--window-size=1440,900' ] }, } };
Add --no-sandbox chrome argument to fix Travis CI build
Add --no-sandbox chrome argument to fix Travis CI build
JavaScript
mit
LucasHill/ember-print-this,LucasHill/ember-print-this,LucasHill/ember-print-this
13ce5d9b14847599a894e2098ba10a2382a78bf8
config.js
config.js
module.exports = { refreshMin: 10, github: { per_page: 100, timeout: 5000, version: '3.0.0' }, local: { save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS location: undefined } }
module.exports = { refreshMin: 10, github: { per_page: 100, timeout: 5000, version: '3.0.0' }, local: { save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS location: null } }
Use null instead of undefined and remove whitespace
Use null instead of undefined and remove whitespace
JavaScript
mit
mcwhittemore/gist-db,pinn3/gist-db