commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
66bea3348e4c84a9a9d45eddbc1cf1e8c0932d3a
index.js
index.js
var ids = ['yeka52', 'maboyong', 'datouma', 'gaizhilizcw', 'tianhao', 'qinnan', 'lianghuan', 'talich', 'loveletter', 'zenithdie', 'Glasschurch', 'nosensedigit', 'oldplusnew', 'negative2', 'taosay', 'DKLearnsPop', 'mactalk', 'lswlsw', 'rosicky311', 'zhimovie', 'liangbianyao', 'bianzhongqingnianxingdongzhinan', 'phos-study']; var rssPath = 'out/zhuanlanrss.xml'; require('./lib/rss')(ids, rssPath);
var ids = ['yeka52', 'maboyong', 'datouma', 'gaizhilizcw', 'tianhao', 'qinnan', 'lianghuan', 'talich', 'loveletter', 'zenithdie', 'Glasschurch', 'nosensedigit', 'oldplusnew', 'negative2', 'taosay', 'DKLearnsPop', 'mactalk', 'lswlsw', 'rosicky311', 'zhimovie', 'liangbianyao', 'bianzhongqingnianxingdongzhinan', 'phos-study']; var rssPath = 'out/zhuanlanrss.xml'; require('./lib/rss')(ids, rssPath);
Revert "Revert "Revert "Revert "trigger update""""
Revert "Revert "Revert "Revert "trigger update"""" This reverts commit d2be7c861e979d444b4f39aa8167d99fe93ad812.
JavaScript
apache-2.0
songchenwen/zhuanlan-rss,songchenwen/zhuanlan-rss
--- +++ @@ -6,3 +6,4 @@ var rssPath = 'out/zhuanlanrss.xml'; require('./lib/rss')(ids, rssPath); +
e11cdbfdf605225184acbc48a7af45a719d0a832
app/resize/index.js
app/resize/index.js
import candela from './../../src/candela'; import indexContent from './index.jade'; import 'javascript-detect-element-resize/detect-element-resize'; import './index.styl'; function showPage () { [...document.getElementsByClassName('page')].forEach(el => { el.classList.add('hidden'); }); let pageId = 'main'; if (window.location.hash.length > 1) { pageId = window.location.hash.slice(1); } document.getElementById(pageId).classList.remove('hidden'); } window.addEventListener('load', () => { document.getElementsByTagName('body')[0].innerHTML = indexContent(); showPage(); window.addEventListener('hashchange', showPage, false); let data = []; for (let i = 0; i < 100; i += 1) { data.push({x: Math.random(), y: Math.random()}); } [...document.getElementsByClassName('vis-element')].forEach(el => { let vis = new candela.components.Scatter( el, data, { x: 'x', y: 'y' } ); vis.render(); window.addResizeListener(el, () => vis.render()); }); window.setInterval(() => { document.getElementById('containing-table').style.width = (500 + Math.floor(Math.random() * 500)) + 'px'; }, 1000); });
import candela from './../../src/candela'; import indexContent from './index.jade'; import 'javascript-detect-element-resize/detect-element-resize'; import './index.styl'; function showPage () { [...document.getElementsByClassName('page')].forEach(el => { el.classList.add('hidden'); }); let pageId = 'main'; if (window.location.hash.length > 1) { pageId = window.location.hash.slice(1); } document.getElementById(pageId).classList.remove('hidden'); } window.addEventListener('load', () => { document.getElementsByTagName('body')[0].innerHTML = indexContent(); showPage(); window.addEventListener('hashchange', showPage, false); let data = []; for (let i = 0; i < 100; i += 1) { data.push({x: Math.random(), y: Math.random()}); } [...document.getElementsByClassName('vis-element')].forEach(el => { let vis = new candela.components.Scatter( el, { data, x: 'x', y: 'y' } ); vis.render(); window.addResizeListener(el, () => vis.render()); }); window.setInterval(() => { document.getElementById('containing-table').style.width = (500 + Math.floor(Math.random() * 500)) + 'px'; }, 1000); });
Fix resize demo to work with updated Scatter plot
Fix resize demo to work with updated Scatter plot
JavaScript
apache-2.0
Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela
--- +++ @@ -27,8 +27,8 @@ [...document.getElementsByClassName('vis-element')].forEach(el => { let vis = new candela.components.Scatter( el, - data, { + data, x: 'x', y: 'y' }
29ec5b25a9a10568e98eee4bd6964e58090ac470
gulp/tasks/clean.js
gulp/tasks/clean.js
import gulp from 'gulp'; import del from 'del'; const list = [ 'src/web/**/*.css', 'src/web/**/*.css.map', 'src/web/**/*.js.map', 'dist/**/*', // exclusion '!src/web/vendor/**' ]; export default (options) => { gulp.task('clean', (callback) => { del(list).then(() => { callback(); }); }); };
import gulp from 'gulp'; import del from 'del'; const list = [ 'dist/cnc/app', 'dist/cnc/web', 'src/web/**/*.css', 'src/web/**/*.css.map', 'src/web/**/*.js.map', // exclusion '!src/web/vendor/**' ]; export default (options) => { gulp.task('clean', (callback) => { del(list).then(() => { callback(); }); }); };
Clean only app and web from dist/cnc
Clean only app and web from dist/cnc
JavaScript
mit
cheton/cnc,cncjs/cncjs,cncjs/cncjs,cheton/piduino-grbl,cncjs/cncjs,cheton/piduino-grbl,cheton/cnc.js,cheton/cnc,cheton/cnc.js,cheton/piduino-grbl,cheton/cnc,cheton/cnc.js
--- +++ @@ -2,10 +2,11 @@ import del from 'del'; const list = [ + 'dist/cnc/app', + 'dist/cnc/web', 'src/web/**/*.css', 'src/web/**/*.css.map', 'src/web/**/*.js.map', - 'dist/**/*', // exclusion '!src/web/vendor/**' ];
d73050a1e157f1786a0361cec00768f170fad647
config-sample.js
config-sample.js
"use strict"; module.exports = { twitter: { consumer_key: "", consumer_secret: "", access_token: "", access_token_secret: "" }, timezone: "Asia/Tokyo", themeCount: 4, themes: [ "ココア", "チノ", "リゼ", "千夜", "シャロ", "マヤ", "メグ", "青山ブルーマウンテン", "モカ", "ティッピー", "ワイルドギース", "あんこ" ] };
"use strict"; module.exports = { twitter: { consumer_key: "", consumer_secret: "", access_token: "", access_token_secret: "" }, timezone: "Asia/Tokyo", themeCount: 4, themes: [ "ココア", "チノ", "リゼ", "千夜", "シャロ", "マヤ", "メグ", "青山ブルーマウンテン", "モカ", "凛", "タカヒロ", "チノ母", "ココア母", "リゼ父", "千夜祖母", "メグ母", "ティッピー", "ワイルドギース", "あんこ" ] };
Add themes to default config
Add themes to default config
JavaScript
mit
rot1024/gochiusa-onedraw-bot
--- +++ @@ -23,6 +23,13 @@ "メグ", "青山ブルーマウンテン", "モカ", + "凛", + "タカヒロ", + "チノ母", + "ココア母", + "リゼ父", + "千夜祖母", + "メグ母", "ティッピー", "ワイルドギース", "あんこ"
2fc2997ac3f47d4101a96d39e6850ff620e976d3
assets/js/common.js
assets/js/common.js
function successMessage(message) { new PNotify({ title: 'Success!!', text: message, type: 'success' }); } function errorMessage(message) { new PNotify({ title: 'Failed!!', text: message, type: 'error' }); }
function successMessage(message) { new PNotify({ title: 'Success!!', text: message, type: 'success' }); } function errorMessage(message) { new PNotify({ title: 'Failed!!', text: message, type: 'error' }); } // Preview image function previewImage(input) { if (input.files && input.files[0]) { var sizeMB = input.files[0].size/1024/1024; if (sizeMB > 0.5) { errorMessage("Image Size exceeds the limit. Please try again."); $(input).val(''); } else { var reader = new FileReader(); reader.onload = function (e) { $('#preview-image').fadeIn('fast'); $('#preview-image').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } }
Add previewImage on Common js
Add previewImage on Common js
JavaScript
mit
gctomakin/renTRMNL,gctomakin/renTRMNL,gctomakin/renTRMNL
--- +++ @@ -13,3 +13,21 @@ type: 'error' }); } + +// Preview image +function previewImage(input) { + if (input.files && input.files[0]) { + var sizeMB = input.files[0].size/1024/1024; + if (sizeMB > 0.5) { + errorMessage("Image Size exceeds the limit. Please try again."); + $(input).val(''); + } else { + var reader = new FileReader(); + reader.onload = function (e) { + $('#preview-image').fadeIn('fast'); + $('#preview-image').attr('src', e.target.result); + } + reader.readAsDataURL(input.files[0]); + } + } +}
a03b6f2c8c34123f1213cfc790fc4b06ee94bef0
config/initializers/database.js
config/initializers/database.js
// config/initializers/database.js var config = require('nconf'); var mongoose = require('mongoose'); module.exports = function(cb) { 'use strict'; // Initialize the component here then call the callback mongoose.connect(process.env.MONGO_DB_URL || config.get('MONGO_DB_URL')); // connect to our database // Return the call back cb(); };
// config/initializers/database.js var config = require('nconf'); var mongoose = require('mongoose'); module.exports = function(cb) { 'use strict'; // Initialize the component here then call the callback mongoose.connect(process.env.MONGOLAB_URI || config.get('MONGO_DB_URL')); // connect to our database // Return the call back cb(); };
Change mongo URI environment var
Change mongo URI environment var
JavaScript
mit
hamehta3/aaa-drivinglaws-api
--- +++ @@ -6,7 +6,7 @@ module.exports = function(cb) { 'use strict'; // Initialize the component here then call the callback - mongoose.connect(process.env.MONGO_DB_URL || config.get('MONGO_DB_URL')); // connect to our database + mongoose.connect(process.env.MONGOLAB_URI || config.get('MONGO_DB_URL')); // connect to our database // Return the call back cb(); };
95a5b7ae3438ae47aff3102077dce77464a5430c
setup/setupBeta.js
setup/setupBeta.js
/** * Validate if the application is in beta * and the user has the access token to * view the beta version. * * If not authorized session, then display coming soon */ const env = require('../env') module.exports = (app) => { // This is only valid for Heroku. // Change this if you're using other // hosting provider. if (process.env.BETA_ACTIVATED && process.env.NODE_ENV === 'production') { app.use(setupBetaFirewall) } } function setupBetaFirewall (req, res, next) { const betaSecretToken = process.env.BETA_TOKEN let key = null if (req.query && req.query.beta) { key = req.query.token } else if (req.cookies) { key = req.cookies['betaToken'] } if (!key) { return res.render('comingSoon') } if (key === betaSecretToken) { // Set the beta cookie res.cookie('betaToken', process.env.BETA_TOKEN, { maxAge: 7 * (24 * 3600000), httpOnly: true }) return next() } return res.render('comingSoon', { message: 'Invalid beta token or session has expired...' }) }
/** * Validate if the application is in beta * and the user has the access token to * view the beta version. * * If not authorized session, then display coming soon */ const env = require('../env') module.exports = (app) => { // This is only valid for Heroku. // Change this if you're using other // hosting provider. if (process.env.BETA_ACTIVATED === 'true' && process.env.NODE_ENV === 'production') { app.use(setupBetaFirewall) } } function setupBetaFirewall (req, res, next) { const betaSecretToken = process.env.BETA_TOKEN let key = null if (req.query && req.query.beta) { key = req.query.token } else if (req.cookies) { key = req.cookies['betaToken'] } if (!key) { return res.render('comingSoon') } if (key === betaSecretToken) { // Set the beta cookie res.cookie('betaToken', process.env.BETA_TOKEN, { maxAge: 7 * (24 * 3600000), httpOnly: true }) return next() } return res.render('comingSoon', { message: 'Invalid beta token or session has expired...' }) }
Check if beta flag is activated
Check if beta flag is activated
JavaScript
mit
ferreiro/website,ferreiro/website
--- +++ @@ -11,7 +11,7 @@ // This is only valid for Heroku. // Change this if you're using other // hosting provider. - if (process.env.BETA_ACTIVATED && process.env.NODE_ENV === 'production') { + if (process.env.BETA_ACTIVATED === 'true' && process.env.NODE_ENV === 'production') { app.use(setupBetaFirewall) } }
486b73ea5f37f93c120e2b9b683be50641690fd9
lib/exec.js
lib/exec.js
'use strict'; const { execFile } = require('child_process'); const exec = (...args) => { return new Promise((resolve, reject) => { execFile(...args, (err, stdout) => { if (err) { reject(err); return; } resolve(stdout); }); }); }; module.exports = exec;
'use strict'; const util = require('util'); const childProcess = require('child_process'); const execFile = util.promisify(childProcess.execFile); const exec = async (...args) => { const { stdout } = await execFile(...args); return stdout; }; module.exports = exec;
Simplify with async and await
Simplify with async and await
JavaScript
mpl-2.0
sholladay/os-proxy
--- +++ @@ -1,17 +1,13 @@ 'use strict'; -const { execFile } = require('child_process'); +const util = require('util'); +const childProcess = require('child_process'); -const exec = (...args) => { - return new Promise((resolve, reject) => { - execFile(...args, (err, stdout) => { - if (err) { - reject(err); - return; - } - resolve(stdout); - }); - }); +const execFile = util.promisify(childProcess.execFile); + +const exec = async (...args) => { + const { stdout } = await execFile(...args); + return stdout; }; module.exports = exec;
6d702bff33fc8da1f8063219674ac4f2d02aa103
src/actions/searchActions.js
src/actions/searchActions.js
import { createAction } from 'redux-actions'; import backend from '../service/backend.js'; export default createAction( 'GET_CARDATA', async (searchQuery) => await backend.getCarData(searchQuery) );
import { createAction } from 'redux-actions'; import backend from '../service/backend.js'; export default createAction( 'GET_CARDATA', async (searchQuery) => await backend.getCarData(searchQuery) );
Edit file to include async actions instead of sync actions
Edit file to include async actions instead of sync actions */ reducers now resolve promises with new middleware
JavaScript
mit
InconspicuousPaprika/Car.ly,Biletnikoff/Car.ly,Biletnikoff/Car.ly,dgilroy77/Car.ly,cehsu/Car.ly,dgilroy77/Car.ly,cehsu/Car.ly,InconspicuousPaprika/Car.ly,Biletnikoff/Car.ly,cehsu/Car.ly,Jzucca/Car.ly,Jzucca/Car.ly,dgilroy77/Car.ly,InconspicuousPaprika/Car.ly,Jzucca/Car.ly
--- +++ @@ -4,5 +4,5 @@ export default createAction( 'GET_CARDATA', - async (searchQuery) => await backend.getCarData(searchQuery) + async (searchQuery) => await backend.getCarData(searchQuery) );
d7ef13680371c6ca8176826a5f140cd1fe6eea13
tests/routes/Home/index.spec.js
tests/routes/Home/index.spec.js
import HomeRoute from 'routes/Home' describe('(Route) Home', () => { let _component beforeEach(() => { _component = HomeRoute.component() }) it('Should return a route configuration object', () => { expect(typeof HomeRoute).to.equal('object') }) it('Should define a route component', () => { expect(_component.type).to.equal('main') }) })
import HomeRoute from 'routes/Home' import { Content } from 'react-mdc-web' describe('(Route) Home', () => { let _component beforeEach(() => { _component = HomeRoute.component() }) it('Should return a route configuration object', () => { expect(typeof HomeRoute).to.equal('object') }) it('Should define a route component', () => { expect(_component.type).to.equal(Content) }) })
Fix text for new component
Fix text for new component
JavaScript
mit
techcoop/techcoop.group,techcoop/techcoop.group
--- +++ @@ -1,4 +1,5 @@ import HomeRoute from 'routes/Home' +import { Content } from 'react-mdc-web' describe('(Route) Home', () => { let _component @@ -12,6 +13,6 @@ }) it('Should define a route component', () => { - expect(_component.type).to.equal('main') + expect(_component.type).to.equal(Content) }) })
5fe6d82e9acbdd8baed5bd8d8e3e0eb182c5fd19
src/components/search_bar.js
src/components/search_bar.js
import React, { Component } from 'react' //class-based component (ES6) class SearchBar extends Component { constructor(props) { super(props); this.state = { term: '' } } render() { //method definition in ES6 return <input onChange={event => console.log(event.target.value)} />; } } export default SearchBar;
import React, { Component } from 'react' //class-based component (ES6) class SearchBar extends Component { constructor(props) { super(props); this.state = { searchInput: '' } //This is the only time we set state like this. We usually use setState } render() { //method definition in ES6 return ( <div> <input onChange={event => this.setState({ searchInput: event.target.value })} /> <br/>Value of the input: { this.state.searchInput } </div> ) } } export default SearchBar;
Set the state of the component and output it to the screen
Set the state of the component and output it to the screen
JavaScript
mit
phirefly/react-redux-starter,phirefly/react-redux-starter
--- +++ @@ -5,11 +5,16 @@ constructor(props) { super(props); - this.state = { term: '' } + this.state = { searchInput: '' } //This is the only time we set state like this. We usually use setState } render() { //method definition in ES6 - return <input onChange={event => console.log(event.target.value)} />; + return ( + <div> + <input onChange={event => this.setState({ searchInput: event.target.value })} /> + <br/>Value of the input: { this.state.searchInput } + </div> + ) } }
13dfef553e22433d89800c6a2d90dadc8a968fcd
src/engine/monitor-record.js
src/engine/monitor-record.js
const {Record} = require('immutable'); const MonitorRecord = Record({ id: null, // Block Id /** Present only if the monitor is sprite-specific, such as x position */ spriteName: null, /** Present only if the monitor is sprite-specific, such as x position */ targetId: null, opcode: null, value: null, params: null, mode: 1, // 1=default, 2=big, 3=slider sliderMin: 0, sliderMax: 100, x: 0, y: 0, width: 0, height: 0, visible: true }); module.exports = MonitorRecord;
const {Record} = require('immutable'); const MonitorRecord = Record({ id: null, // Block Id /** Present only if the monitor is sprite-specific, such as x position */ spriteName: null, /** Present only if the monitor is sprite-specific, such as x position */ targetId: null, opcode: null, value: null, params: null, mode: 'default', sliderMin: 0, sliderMax: 100, x: 0, y: 0, width: 0, height: 0, visible: true }); module.exports = MonitorRecord;
Fix default value for monitor record
Fix default value for monitor record
JavaScript
bsd-3-clause
LLK/scratch-vm,LLK/scratch-vm,LLK/scratch-vm
--- +++ @@ -9,7 +9,7 @@ opcode: null, value: null, params: null, - mode: 1, // 1=default, 2=big, 3=slider + mode: 'default', sliderMin: 0, sliderMax: 100, x: 0,
c09a44b92c9d689e80f6c0492614dc56705bbfb0
test/fixtures/test_article.js
test/fixtures/test_article.js
/** @jsx React.DOM */ 'use strict' var React = require('react-tools/build/modules/React'); var statusForm = React.createClass({ render: function(){ return <form class="form-horizontal" role="form"> <div class="form-group"> <label for="brand-lead" class="col-sm-4 control-label">Brand lead:</label> <div class="col-sm-8"> <input class="form-control" placeholder="brand lead" type="text" id="brand-lead" ref="brandLead" data-state="brandLead" /> </div> </div> <div class="form-group"> <label for="status-text" class="col-sm-4 control-label">Status:</label> <div class="col-sm-8"> <textarea id="status-text" class="form-control" rows="40" ref="statusText" data-state="statusText"/> </div> </div> <input class="btn btn-success" type="submit" value="Save status"/> </form> } }); module.exports = statusForm;
'use strict' var React = require('react-tools/build/modules/React'); var statusForm = React.createClass({ render: function(){ return <form class="form-horizontal" role="form"> <div class="form-group"> <label for="brand-lead" class="col-sm-4 control-label">Brand lead:</label> <div class="col-sm-8"> <input class="form-control" placeholder="brand lead" type="text" id="brand-lead" ref="brandLead" data-state="brandLead" /> </div> </div> <div class="form-group"> <label for="status-text" class="col-sm-4 control-label">Status:</label> <div class="col-sm-8"> <textarea id="status-text" class="form-control" rows="40" ref="statusText" data-state="statusText"/> </div> </div> <input class="btn btn-success" type="submit" value="Save status"/> </form> } }); module.exports = statusForm;
Fix test: JSX pragma is deprecated in React 0.12
Fix test: JSX pragma is deprecated in React 0.12
JavaScript
mit
thomasboyt/JSXHint,STRML/JSXHint,henricavalcante/JSXHint,Shriken/JSXHint
--- +++ @@ -1,4 +1,3 @@ -/** @jsx React.DOM */ 'use strict' var React = require('react-tools/build/modules/React');
88799cb55ee1b65f89469cee296fc40d51ac05d4
test/queue/with_delay_test.js
test/queue/with_delay_test.js
'use strict'; require('../helpers'); const assert = require('assert'); const Ironium = require('../..'); describe('Queue with delay', function() { const captureQueue = Ironium.queue('capture'); // Capture processed jobs here. const processed = []; before(function() { Ironium.configure({ concurrency: 1 }); }); before(function() { captureQueue.eachJob(function(job) { processed.push(job); return Promise.resolve(); }); }); before(function() { return captureQueue.delayJob('delayed', '2s'); }); before(Ironium.runOnce); it('should not process immediately', function() { assert.equal(processed.length, 0); }); describe('after short delay', function() { before(function(done) { setTimeout(done, 1500); }); before(Ironium.runOnce); it('should not process job', function() { assert.equal(processed.length, 0); }); }); describe('after sufficient delay', function() { before(function(done) { setTimeout(done, 1000); }); before(Ironium.runOnce); it('should process job', function() { assert.equal(processed.length, 1); assert.equal(processed[0], 'delayed'); }); }); });
'use strict'; require('../helpers'); const assert = require('assert'); const Ironium = require('../..'); describe('Queue with delay', function() { let captureQueue; // Capture processed jobs here. const processed = []; before(function() { Ironium.stop(); Ironium.configure({ concurrency: 1 }); captureQueue = Ironium.queue(`capture-${Date.now()}`); }); before(function() { captureQueue.eachJob(function(job) { processed.push(job); return Promise.resolve(); }); }); before(function() { return captureQueue.delayJob('delayed', '2s'); }); before(Ironium.runOnce); it('should not process immediately', function() { assert.equal(processed.length, 0); }); describe('after short delay', function() { before(function(done) { setTimeout(done, 1500); }); before(Ironium.runOnce); it('should not process job', function() { assert.equal(processed.length, 0); }); }); describe('after sufficient delay', function() { before(function(done) { setTimeout(done, 1000); }); before(Ironium.runOnce); it('should process job', function() { assert.equal(processed.length, 1); assert.equal(processed[0], 'delayed'); }); }); });
Clean up before running this test.
Clean up before running this test.
JavaScript
mit
assaf/ironium
--- +++ @@ -6,13 +6,15 @@ describe('Queue with delay', function() { - const captureQueue = Ironium.queue('capture'); + let captureQueue; // Capture processed jobs here. const processed = []; before(function() { + Ironium.stop(); Ironium.configure({ concurrency: 1 }); + captureQueue = Ironium.queue(`capture-${Date.now()}`); }); before(function() {
cbbce1c48f784449a4210e4eefc5dff339649eb6
src/firefox/lib/main.js
src/firefox/lib/main.js
var buttons = require('sdk/ui/button/action'); var panels = require("sdk/panel"); var self = require("sdk/self"); const {Cu} = require("chrome"); Cu.import(self.data.url('freedom-for-firefox.jsm')); // Main uProxy button. var button = buttons.ActionButton({ id: "uProxy-button", label: "uProxy-button", icon: { "16": "./icons/NotLoggedIn_32.gif", "19": "./icons/NotLoggedIn_32.gif", "128": "./icons/LoggedIn_256.gif" }, onClick: start }); var panel; // Load freedom. var manifest = self.data.url('core/freedom-module.json'); freedom(manifest, {}).then(function(uproxy) { // Panel that gets displayed when user clicks the button. panel = panels.Panel({ width: 371, height: 600, contentURL: self.data.url("index.html") }) // Set up connection between freedom and content script. require('glue.js').setUpConnection(new uproxy(), panel, button); }); function start(state) { panel.show({ position: button, }); }
var buttons = require('sdk/ui/button/action'); var panels = require("sdk/panel"); var self = require("sdk/self"); const {Cu} = require("chrome"); Cu.import(self.data.url('freedom-for-firefox.jsm')); // Main uProxy button. var button = buttons.ActionButton({ id: "uProxy-button", label: "uProxy-button", icon: { "32": "./icons/NotLoggedIn_32.gif" }, onClick: start }); var panel; // Load freedom. var manifest = self.data.url('core/freedom-module.json'); freedom(manifest, {}).then(function(uproxy) { // Panel that gets displayed when user clicks the button. panel = panels.Panel({ width: 371, height: 600, contentURL: self.data.url("index.html") }) // Set up connection between freedom and content script. require('glue.js').setUpConnection(new uproxy(), panel, button); }); function start(state) { panel.show({ position: button, }); }
Update FF icon to correct size
Update FF icon to correct size
JavaScript
apache-2.0
chinarustin/uproxy,jpevarnek/uproxy,qida/uproxy,itplanes/uproxy,uProxy/uproxy,qida/uproxy,chinarustin/uproxy,roceys/uproxy,jpevarnek/uproxy,MinFu/uproxy,chinarustin/uproxy,dhkong88/uproxy,IveWong/uproxy,roceys/uproxy,dhkong88/uproxy,dhkong88/uproxy,chinarustin/uproxy,uProxy/uproxy,itplanes/uproxy,roceys/uproxy,dhkong88/uproxy,dhkong88/uproxy,IveWong/uproxy,itplanes/uproxy,MinFu/uproxy,qida/uproxy,uProxy/uproxy,MinFu/uproxy,qida/uproxy,roceys/uproxy,jpevarnek/uproxy,roceys/uproxy,MinFu/uproxy,IveWong/uproxy,MinFu/uproxy,jpevarnek/uproxy,IveWong/uproxy,jpevarnek/uproxy,itplanes/uproxy,itplanes/uproxy,chinarustin/uproxy,uProxy/uproxy,qida/uproxy,uProxy/uproxy
--- +++ @@ -10,9 +10,7 @@ id: "uProxy-button", label: "uProxy-button", icon: { - "16": "./icons/NotLoggedIn_32.gif", - "19": "./icons/NotLoggedIn_32.gif", - "128": "./icons/LoggedIn_256.gif" + "32": "./icons/NotLoggedIn_32.gif" }, onClick: start });
7eb522b3cd72bb584d7b053cde79b9ca08f0ec22
src/systems/renderer/sample-renderer-system.js
src/systems/renderer/sample-renderer-system.js
"use strict"; module.exports = function(ecs, data) { // eslint-disable-line no-unused-vars ecs.addEach(function(entity, context) { // eslint-disable-line no-unused-vars var position = data.entities.get(entity, "position"); var size = data.entities.get(entity, "size"); context.fillStyle = "black"; context.fillRect(position.x, position.y, size.width, size.height); }, "camera"); };
"use strict"; module.exports = function(ecs, data) { // eslint-disable-line no-unused-vars data.entities.registerSearch("sampleRendererSystem", ["camera", "position", "size"]); ecs.addEach(function(entity, context) { // eslint-disable-line no-unused-vars var position = data.entities.get(entity, "position"); var size = data.entities.get(entity, "size"); context.fillStyle = "black"; context.fillRect(position.x, position.y, size.width, size.height); }, "sampleRendererSystem"); };
Fix crash when camera doesn't have size
Fix crash when camera doesn't have size
JavaScript
mit
CaldwellYSR/Bug_Catcher,RiseAndShineGames/LudumDare35,RiseAndShineGames/BugCatcher,RiseAndShineGames/BugCatcher,RiseAndShineGames/LudumDare35,RiseAndShineGames/Polymorphic,SplatJS/splat-ecs-starter-project,RiseAndShineGames/Polymorphic,SplatJS/splat-ecs-starter-project,CaldwellYSR/Bug_Catcher
--- +++ @@ -1,10 +1,11 @@ "use strict"; module.exports = function(ecs, data) { // eslint-disable-line no-unused-vars + data.entities.registerSearch("sampleRendererSystem", ["camera", "position", "size"]); ecs.addEach(function(entity, context) { // eslint-disable-line no-unused-vars var position = data.entities.get(entity, "position"); var size = data.entities.get(entity, "size"); context.fillStyle = "black"; context.fillRect(position.x, position.y, size.width, size.height); - }, "camera"); + }, "sampleRendererSystem"); };
0f39be8e6d579dca27d371545a6e1f53658da8a6
veil-knockout.js
veil-knockout.js
// Expose plugin as an AMD module if AMD loader is present: (function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { define(['knockout', 'jquery'], factory); } else { window.ko.bindingHandlers.veil = factory(ko, jQuery); } }(function (ko, $) { 'use strict'; /** * A Knockout binding handler for Veil * * @global */ var veil = { /** @lends ko.bindingHandlers.veil */ init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var $element = $(element), user = ko.unwrap(valueAccessor()), veilTemplate = allBindingsAccessor().veilTemplate, veilOptions = allBindingsAccessor().veilOptions || {}, contentCallback; contentCallback = function(overlay) { ko.renderTemplate(veilTemplate, bindingContext, {}, overlay.get(0)); }; $element.veil(veilOptions); $element.veil().addCallback('afterCreate', contentCallback); $element.on('click', function(ev) { if ($element.veil().isActive()) { $element.veil().hide(); } else { $element.veil().show(); } ev.stopPropagation(); }); ko.utils.domNodeDisposal.addDisposeCallback(element, function() { try { $(element).veil().destroy(); } catch (e) { } }); } }; return veil; }));
// Expose plugin as an AMD module if AMD loader is present: (function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { define(['knockout', 'jquery'], factory); } else { window.ko.bindingHandlers.veil = factory(ko, jQuery); } }(function (ko, $) { 'use strict'; /** * A Knockout binding handler for Veil * * @global */ var veil = { /** @lends ko.bindingHandlers.veil */ init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var $element = $(element), veilTemplate = allBindingsAccessor().veilTemplate, veilOptions = allBindingsAccessor().veilOptions || {}, contentCallback; contentCallback = function(overlay) { ko.renderTemplate(veilTemplate, valueAccessor(), {}, overlay.get(0)); }; $element.veil(veilOptions); $element.veil().addCallback('afterCreate', contentCallback); $element.on('click', function(ev) { if ($element.veil().isActive()) { $element.veil().hide(); } else { $element.veil().show(); } ev.stopPropagation(); }); ko.utils.domNodeDisposal.addDisposeCallback(element, function() { try { $(element).veil().destroy(); } catch (e) { } }); } }; return veil; }));
Use the value accessor as the binding context for the template
Use the value accessor as the binding context for the template
JavaScript
mit
janfoeh/veiljs,janfoeh/veiljs,janfoeh/veiljs
--- +++ @@ -20,13 +20,12 @@ /** @lends ko.bindingHandlers.veil */ init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var $element = $(element), - user = ko.unwrap(valueAccessor()), veilTemplate = allBindingsAccessor().veilTemplate, veilOptions = allBindingsAccessor().veilOptions || {}, contentCallback; contentCallback = function(overlay) { - ko.renderTemplate(veilTemplate, bindingContext, {}, overlay.get(0)); + ko.renderTemplate(veilTemplate, valueAccessor(), {}, overlay.get(0)); }; $element.veil(veilOptions);
aeac97437c856d08a5bc545c966b5701004d82d0
js/lambda.js
js/lambda.js
(function (context) { var λ = {}; λ.map = function (coll, func) { var output = []; for (var index in coll) { output.push(func(coll[index])); } return output; }; λ.reduce = function (coll, func) { }; })(this);
(function (context) { var λ = {}; λ.map = function (coll, func) { var output = []; for (var index in coll) { if (coll.hasOwnProperty(index)) { output.push(func(coll[index])); } } return output; }; λ.reduce = function (coll, func, memo) { for (var index in coll) { if (coll.hasOwnProperty(index)) { if (memo === undefined) { memo = coll[index]; } else { memo = func(memo, coll[index], index); } } } return memo; }; context.λ = λ; context.L = λ; })(this); var inc = function (v) { return v + 1; }; var product = function (pro, next) { return pro * next; }; assert(equalToString(λ.map([1,2,3], inc), [2,3,4]), "Mappin'"); assert(equal(λ.reduce([2,3,4], product), 24), "Reducin'"); assert(equal(λ.reduce([2,3,4], product, 3), 72), "Reducin' with memo"); function equal(v1, v2) { return v1 === v2; } function equalToString(v1, v2) { return v1.toString() === v2.toString(); } function assert(value, message) { if (!value) { throw "FAILED: " + message; } else { console.log(message + " works!"); } }
Implement reduce and fix map.
Implement reduce and fix map.
JavaScript
unlicense
CWDG/Functional-JavaScript-Talk
--- +++ @@ -4,11 +4,55 @@ λ.map = function (coll, func) { var output = []; for (var index in coll) { - output.push(func(coll[index])); + if (coll.hasOwnProperty(index)) { + output.push(func(coll[index])); + } } return output; }; - λ.reduce = function (coll, func) { + λ.reduce = function (coll, func, memo) { + for (var index in coll) { + if (coll.hasOwnProperty(index)) { + if (memo === undefined) { + memo = coll[index]; + } else { + memo = func(memo, coll[index], index); + } + } + } + return memo; }; + + context.λ = λ; + context.L = λ; })(this); + + +var inc = function (v) { + return v + 1; +}; + +var product = function (pro, next) { + return pro * next; +}; + + +assert(equalToString(λ.map([1,2,3], inc), [2,3,4]), "Mappin'"); +assert(equal(λ.reduce([2,3,4], product), 24), "Reducin'"); +assert(equal(λ.reduce([2,3,4], product, 3), 72), "Reducin' with memo"); + +function equal(v1, v2) { + return v1 === v2; +} + +function equalToString(v1, v2) { + return v1.toString() === v2.toString(); +} +function assert(value, message) { + if (!value) { + throw "FAILED: " + message; + } else { + console.log(message + " works!"); + } +}
9346e4bdabedbd3f5e97152577dbaaa3c9fd0779
src/js/sprites/enemy.js
src/js/sprites/enemy.js
export class Enemy extends Phaser.Sprite { constructor(game, x, y) { super(game, x, y, 'enemy'); this.anchor.setTo(0.5); this.game.add.existing(this); this.game.physics.arcade.enable(this); // Disable gravity because it's flying this.body.allowGravity = false; } }
export class Enemy extends Phaser.Sprite { constructor(game, x, y) { super(game, x, y, 'enemy'); this.anchor.setTo(0.5); this.game.add.existing(this); this.game.physics.arcade.enable(this); // Disable gravity because it's flying this.body.allowGravity = false; // Create a patrol behavior with a simple yoyo tween this.movementTween = this.game.add.tween(this).to({ x: "+200" }, 800, "Linear", true, 0, -1); this.movementTween.yoyo(true, 0); } }
Add patrol behavior with a simple yoyo tween
Add patrol behavior with a simple yoyo tween
JavaScript
mit
themadknights/wellofeternity,themadknights/wellofeternity
--- +++ @@ -7,5 +7,9 @@ // Disable gravity because it's flying this.body.allowGravity = false; + + // Create a patrol behavior with a simple yoyo tween + this.movementTween = this.game.add.tween(this).to({ x: "+200" }, 800, "Linear", true, 0, -1); + this.movementTween.yoyo(true, 0); } }
1309a7fbab4fd501b2280f48357b24632a0f8337
web/js/script.js
web/js/script.js
$(document).ready(function () { alert('page loaded.'); mixpanel.track("Page loaded"); $("#my_button").click(function() { // This sends us an event every time a user clicks the button mixpanel.track("Button clicked"); }); }); function hide_welcome() { $('#welcome').slideUp(); mixpanel.track("Hide welcome message"); }
$(document).ready(function () { mixpanel.track("Page loaded"); $("#my_button").click(function() { // This sends us an event every time a user clicks the button mixpanel.track("Button clicked"); }); }); function hide_welcome() { $('#welcome').slideUp(); mixpanel.track("Hide welcome message"); }
Remove test alert on page load
Remove test alert on page load
JavaScript
mit
stefanhapper/politix,stefanhapper/politix,stefanhapper/politix
--- +++ @@ -1,6 +1,6 @@ $(document).ready(function () { - alert('page loaded.'); + mixpanel.track("Page loaded"); $("#my_button").click(function() {
0fc2d4b516a5534184e2ff7e3bcd89c2e5e579ff
extensions/field_upload/assets/publish.js
extensions/field_upload/assets/publish.js
jQuery(document).ready(function() { jQuery('.field-upload').each(function() { var field = jQuery(this); var file = field.find('.file'); var upload = field.find('.upload'); var hidden = upload.find('input[type = "hidden"]'); if (file.length) { var clear = jQuery('<a />') .text('Change') .prependTo(field.find('.label')); var keep = jQuery('<a />') .text('Keep') .prependTo(field.find('.label')) .hide(); clear.bind('click', function() { var file = jQuery('<input type="file" />'); file.attr('name', hidden.attr('name')); clear.hide(); keep.show(); upload.show(); hidden.remove(); file.appendTo(upload); }); keep.bind('click', function() { var file = upload.find('input[type = "file"]'); clear.show(); keep.hide(); upload.hide(); file.remove(); hidden.appendTo(upload); }); upload.hide(); } }); });
jQuery(document).ready(function() { jQuery('.field-upload').each(function() { var field = jQuery(this); var file = field.find('.file'); var upload = field.find('.upload'); var hidden = upload.find('input[type = "hidden"]'); if (file.length) { var clear = jQuery('<a />') .text('Change') .addClass('action-change') .prependTo(field.find('.label')); var keep = jQuery('<a />') .addClass('action-keep') .text('Keep') .prependTo(field.find('.label')) .hide(); clear.bind('click', function() { var file = jQuery('<input type="file" />'); file.attr('name', hidden.attr('name')); clear.hide(); keep.show(); upload.show(); hidden.remove(); file.appendTo(upload); }); keep.bind('click', function() { var file = upload.find('input[type = "file"]'); clear.show(); keep.hide(); upload.hide(); file.remove(); hidden.appendTo(upload); }); upload.hide(); } }); });
Add classes to identify Upload Field interface actions.
Add classes to identify Upload Field interface actions.
JavaScript
mit
embarknow/journey-cms,symphonycms/symphony-3,psychoticmeow/journey-cms,embarknow/journey-cms,embarknow/journey-cms,psychoticmeow/journey-cms,embarknow/journey-cms,embarknow/journey-cms,psychoticmeow/journey-cms,psychoticmeow/journey-cms,psychoticmeow/journey-cms,symphonycms/symphony-3
--- +++ @@ -8,8 +8,10 @@ if (file.length) { var clear = jQuery('<a />') .text('Change') + .addClass('action-change') .prependTo(field.find('.label')); var keep = jQuery('<a />') + .addClass('action-keep') .text('Keep') .prependTo(field.find('.label')) .hide();
b6db9444b7bb99d519c47baae311c7db005c07e8
src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/editor/select-cell-radio-editor.js
src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/editor/select-cell-radio-editor.js
/*global define*/ define([ 'underscore', 'backgrid' ], function (_, Backgrid) { 'use strict'; var SelectCellRadioEditor; SelectCellRadioEditor = Backgrid.SelectCellEditor.extend({ /** * @inheritDoc */ tagName: "div", /** * @inheritDoc */ events: { "change": "save", "blur": "close", "keydown": "close", "click": "onClick" }, /** * @inheritDoc */ template: _.template('<input name="<%- this.model.cid + \'_\' + this.cid %>" type="radio" value="<%- value %>" <%= selected ? checked : "" %>><%- text %>', null, {variable: null}), /** * @param {Object} event */ onClick: function (event) { event.stopPropagation(); } }); return SelectCellRadioEditor; });
/*global define*/ define([ 'underscore', 'backgrid' ], function (_, Backgrid) { 'use strict'; var SelectCellRadioEditor; SelectCellRadioEditor = Backgrid.SelectCellEditor.extend({ /** * @inheritDoc */ tagName: "div", /** * @inheritDoc */ events: { "change": "save", "blur": "close", "keydown": "close", "click": "onClick" }, /** * @inheritDoc */ template: _.template('<input name="<%- this.model.cid + \'_\' + this.cid %>" type="radio" value="<%- value %>" <%= selected ? "checked" : "" %>><%- text %>', null, {variable: null}), /** * @param {Object} event */ onClick: function (event) { event.stopPropagation(); } }); return SelectCellRadioEditor; });
Create editor for input=radio, apply it in select-cell - CR fix
BB-701: Create editor for input=radio, apply it in select-cell - CR fix
JavaScript
mit
2ndkauboy/platform,trustify/oroplatform,ramunasd/platform,trustify/oroplatform,ramunasd/platform,ramunasd/platform,orocrm/platform,Djamy/platform,northdakota/platform,2ndkauboy/platform,geoffroycochard/platform,hugeval/platform,trustify/oroplatform,orocrm/platform,Djamy/platform,geoffroycochard/platform,hugeval/platform,orocrm/platform,Djamy/platform,hugeval/platform,northdakota/platform,geoffroycochard/platform,2ndkauboy/platform,northdakota/platform
--- +++ @@ -26,7 +26,7 @@ /** * @inheritDoc */ - template: _.template('<input name="<%- this.model.cid + \'_\' + this.cid %>" type="radio" value="<%- value %>" <%= selected ? checked : "" %>><%- text %>', null, {variable: null}), + template: _.template('<input name="<%- this.model.cid + \'_\' + this.cid %>" type="radio" value="<%- value %>" <%= selected ? "checked" : "" %>><%- text %>', null, {variable: null}), /** * @param {Object} event
ac95603a12c5b49e073b019c462ebad714159c5e
packages/strapi-generate-new/lib/resources/files/config/functions/bootstrap.js
packages/strapi-generate-new/lib/resources/files/config/functions/bootstrap.js
'use strict'; /** * An asynchronous bootstrap function that runs before * your application gets started. * * This gives you an opportunity to set up your data model, * run jobs, or perform some special logic. */ module.exports = cb => { cb(); };
'use strict'; /** * An asynchronous bootstrap function that runs before * your application gets started. * * This gives you an opportunity to set up your data model, * run jobs, or perform some special logic. */ module.exports = () => {};
Update strapi-generate-new boostrapi function template
Update strapi-generate-new boostrapi function template
JavaScript
mit
wistityhq/strapi,wistityhq/strapi
--- +++ @@ -8,6 +8,4 @@ * run jobs, or perform some special logic. */ -module.exports = cb => { - cb(); -}; +module.exports = () => {};
070e31a447ec330c25609dd2f88c0ee0e06fd70e
client/src/helpers/getRemainingTime.js
client/src/helpers/getRemainingTime.js
export default date => { const diff = new Date(date).getTime() - Date.now(); const days = Math.floor(diff / 86400 / 1000); return `${days} days`; };
export default date => { const diff = new Date(date).getTime() - Date.now(); const days = Math.floor(diff / 86400 / 1000); const ending = days > 1 ? 's' : ''; return days > 0 ? `${days} day${ending}` : `Last day`; };
Change wording for 0 and 1 day
Change wording for 0 and 1 day
JavaScript
mit
jenovs/bears-team-14,jenovs/bears-team-14
--- +++ @@ -2,5 +2,7 @@ const diff = new Date(date).getTime() - Date.now(); const days = Math.floor(diff / 86400 / 1000); - return `${days} days`; + const ending = days > 1 ? 's' : ''; + + return days > 0 ? `${days} day${ending}` : `Last day`; };
1bbd5bcc31fe2f812d559378ee598742faa3a2e9
spec/MydemoSpec.js
spec/MydemoSpec.js
describe("My demo suite", function() { it("contains spec with my demo expectation", function() { expect(1).toBe(1); }); });
describe("My demo suite", function() { it("contains spec with my demo expectation", function() { expect(1).toBe(1); }); }); describe("My suite is just a function", function() { var a = false; it("and so is a spec", function(){ expect(a).toBe(false); }); it("the spec is using not matcher", function() { expect(a).not.toBe(true); expect(a).not.toBe(null); }); });
Use toBe and not.toBe matcher. Look spec as a function
Use toBe and not.toBe matcher. Look spec as a function
JavaScript
mit
philipdai/myjasminedemo,philipdai/myjasminedemo
--- +++ @@ -4,3 +4,16 @@ }); }); +describe("My suite is just a function", function() { + var a = false; + + it("and so is a spec", function(){ + expect(a).toBe(false); + }); + + it("the spec is using not matcher", function() { + expect(a).not.toBe(true); + expect(a).not.toBe(null); + }); +}); +
678557cd57ef1bbad3d46af3219e78ef619198dc
lib/index.js
lib/index.js
function createSleepPromise(timeout) { return new Promise(function(resolve) { setTimeout(resolve, timeout); }); } function sleep(timeout) { // Pass value through, if used in a promise chain function promiseFunction(value) { return createSleepPromise(timeout).then(function() { return value; }); } var sleepPromise = createSleepPromise(timeout); // Normal promise promiseFunction.then = function() { return sleepPromise.then.apply(sleepPromise, arguments); }; promiseFunction.catch = Promise.resolve().catch; return promiseFunction; } export default sleep;
function createSleepPromise(timeout) { return new Promise(resolve => { setTimeout(resolve, timeout); }); } function sleep(timeout) { // Pass value through, if used in a promise chain function promiseFunction(value) { return createSleepPromise(timeout).then(() => value); } const sleepPromise = createSleepPromise(timeout); // Normal promise promiseFunction.then = (...args) => sleepPromise.then(...args); promiseFunction.catch = Promise.resolve().catch; return promiseFunction; } export default sleep;
Refactor code to use arrow functions
Refactor code to use arrow functions
JavaScript
mit
brummelte/sleep-promise
--- +++ @@ -1,5 +1,5 @@ function createSleepPromise(timeout) { - return new Promise(function(resolve) { + return new Promise(resolve => { setTimeout(resolve, timeout); }); } @@ -7,17 +7,13 @@ function sleep(timeout) { // Pass value through, if used in a promise chain function promiseFunction(value) { - return createSleepPromise(timeout).then(function() { - return value; - }); + return createSleepPromise(timeout).then(() => value); } - var sleepPromise = createSleepPromise(timeout); + const sleepPromise = createSleepPromise(timeout); // Normal promise - promiseFunction.then = function() { - return sleepPromise.then.apply(sleepPromise, arguments); - }; + promiseFunction.then = (...args) => sleepPromise.then(...args); promiseFunction.catch = Promise.resolve().catch; return promiseFunction;
6afaf2ee4bce41abc100ca69745a95e768d0e9b5
lib/index.js
lib/index.js
'use strict' var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable') var Plugin = require('vigour-native/lib/bridge/Plugin') var name = require('../package.json').name var AlphaColor = new BridgeObservable({ color: { condition: { $hex: 'color' } }, opacity: { condition: { $number: 'percentage' } }, useValue: true }).Constructor module.exports = exports = new Plugin({ key: name, background: new AlphaColor(), text: new AlphaColor(), display: {} })
'use strict' var BridgeObservable = require('vigour-native/lib/bridge/BridgeObservable') var Plugin = require('vigour-native/lib/bridge/Plugin') var name = require('../package.json').name var AlphaColor = new BridgeObservable({ color: { // condition: { // $hex: 'color' // } }, opacity: { // condition: { // $number: 'percentage' // } }, useValue: true }).Constructor module.exports = exports = new Plugin({ key: name, background: new AlphaColor(), text: new AlphaColor(), display: {} })
Comment out validation for now
Comment out validation for now
JavaScript
bsd-2-clause
vigour-io/statusbar,vigour-io/statusbar
--- +++ @@ -6,14 +6,14 @@ var AlphaColor = new BridgeObservable({ color: { - condition: { - $hex: 'color' - } + // condition: { + // $hex: 'color' + // } }, opacity: { - condition: { - $number: 'percentage' - } + // condition: { + // $number: 'percentage' + // } }, useValue: true }).Constructor
2b7306be7ce8b2a003494239ba3b72150171d0de
client/app/scripts/controllers/admin/features/new.js
client/app/scripts/controllers/admin/features/new.js
angular .module('app') .controller('featureNewController', [ '$scope', '$location', '$routeParams', 'userService', 'featureService', 'actionKitService', '$rootScope', function($scope, $location, $routeParams, userAPI, Feature, actionKitService, $rootScope) { $scope.feature = new Feature(); $scope.create = function() { $scope.feature.$save(function() { $location.path('/admin/features/' + $scope.feature.id + "/edit"); alert("Feature saved successfully!"); }); }; }]);
angular .module('app') .controller('featureNewController', [ '$scope', '$location', '$routeParams', 'userService', 'featureService', 'actionKitService', 'FormHelper', '$rootScope', function($scope, $location, $routeParams, userAPI, Feature, actionKitService, FormHelper, $rootScope) { $scope.feature = new Feature(); $scope.showError = FormHelper.showError; $scope.showSuccess = FormHelper.showSuccess; $scope.create = function() { // FormHelper.create(form, model, callback) FormHelper.create($scope.NewFeatureForm, $scope.feature, function() { $location.path('/admin/features/' + $scope.feature.id + "/edit"); alert("Feature saved successfully!"); }); }; }]);
Update New Feature form to use the Form Helper. Add validations and alerts.
Update New Feature form to use the Form Helper. Add validations and alerts.
JavaScript
mit
brettshollenberger/rootstrikers,brettshollenberger/rootstrikers
--- +++ @@ -7,14 +7,20 @@ 'userService', 'featureService', 'actionKitService', + 'FormHelper', '$rootScope', - function($scope, $location, $routeParams, userAPI, Feature, actionKitService, $rootScope) { + function($scope, $location, $routeParams, userAPI, Feature, actionKitService, FormHelper, $rootScope) { $scope.feature = new Feature(); + $scope.showError = FormHelper.showError; + $scope.showSuccess = FormHelper.showSuccess; + $scope.create = function() { - $scope.feature.$save(function() { + // FormHelper.create(form, model, callback) + FormHelper.create($scope.NewFeatureForm, $scope.feature, function() { $location.path('/admin/features/' + $scope.feature.id + "/edit"); alert("Feature saved successfully!"); }); }; + }]);
45507b79754ca953b2017bb3b71f86cb379365ac
routes/debug.js
routes/debug.js
var async = require('async'); var User = require('../models/user'); var BadgeInstance = require('../models/badge-instance'); exports.showFlushDbForm = function (req, res) { return res.render('admin/flush-user-info.html', { issuer: req.issuer, }); }; exports.flushDb = function flushDb(req, res) { function removeItem(item, callback) { return item.remove(callback); } function removeAfterFind(callback) { return function (err, items) { if (err) return callback(err); return async.map(items, removeItem, callback); } } function flushUsers(callback) { User.find(removeAfterFind(callback)); } function flushInstances(callback) { BadgeInstance.find(removeAfterFind(callback)); } async.parallel([ flushUsers, flushInstances ], function (err, results) { console.dir(err); console.dir(results); res.redirect(303, '/') }); };
var async = require('async'); var User = require('../models/user'); var BadgeInstance = require('../models/badge-instance'); exports.showFlushDbForm = function (req, res) { return res.render('admin/flush-user-info.html', { issuer: req.issuer, }); }; function removeItem(item, callback) { return item.remove(callback); } function removeAfterFind(callback) { return function (err, items) { if (err) return callback(err); return async.map(items, removeItem, callback); } } function flushUsers(callback) { User.find(removeAfterFind(callback)); } function flushInstances(callback) { BadgeInstance.find(removeAfterFind(callback)); } exports.flushDb = function flushDb(req, res) { async.parallel([ flushUsers, flushInstances ], function (err, results) { console.dir(err); console.dir(results); res.redirect(303, '/') }); };
Move functions out of route endpoint.
Move functions out of route endpoint.
JavaScript
mpl-2.0
kayaelle/msol-badger,bdgio/msol-site,bdgio/msol-site,kayaelle/msol-badger,bdgio/msol-site,mozilla/openbadger,kayaelle/msol-badger,mozilla/openbadger
--- +++ @@ -8,22 +8,23 @@ }); }; +function removeItem(item, callback) { + return item.remove(callback); +} +function removeAfterFind(callback) { + return function (err, items) { + if (err) return callback(err); + return async.map(items, removeItem, callback); + } +} +function flushUsers(callback) { + User.find(removeAfterFind(callback)); +} +function flushInstances(callback) { + BadgeInstance.find(removeAfterFind(callback)); +} + exports.flushDb = function flushDb(req, res) { - function removeItem(item, callback) { - return item.remove(callback); - } - function removeAfterFind(callback) { - return function (err, items) { - if (err) return callback(err); - return async.map(items, removeItem, callback); - } - } - function flushUsers(callback) { - User.find(removeAfterFind(callback)); - } - function flushInstances(callback) { - BadgeInstance.find(removeAfterFind(callback)); - } async.parallel([ flushUsers, flushInstances ], function (err, results) { console.dir(err); console.dir(results);
c2cab2cafb54106a5f0b5b185d1ff2614e70ae7b
blankshield.js
blankshield.js
;(function(root) { 'use strict'; var blankshield = function(ele) { addEvent(ele, 'click', function(e) { var href, usedModifier, child; href = e.target.getAttribute('href'); if (!href) return; usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey); if (!usedModifier && e.target.getAttribute('target') !== '_blank') { return; } child = window.open(href); child.opener = null; e.preventDefault(); return false; }); }; function addEvent(target, type, listener) { if (target.addEventListener) { target.addEventListener(type, listener, false); } else if (target.attachEvent) { target.attachEvent('on' + type, listener); } else { target['on' + type] = listener; } } /** * Export for various environments. */ // Export CommonJS if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { module.exports = blankshield; } else { exports.blankshield = blankshield; } } // Register with AMD if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { define('blankshield', [], function() { return blankshield; }); } // export default blankshield function root.blankshield = blankshield; }(this));
;(function(root) { 'use strict'; var handler = function(e) { var href, usedModifier, child; href = e.target.getAttribute('href'); if (!href) return; usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey); if (!usedModifier && e.target.getAttribute('target') !== '_blank') { return; } child = window.open(href); child.opener = null; e.preventDefault(); }; var blankshield = function(target) { if (typeof target.length === 'undefined') { addEvent(target, 'click', handler); } else if (typeof target !== 'string' && !(target instanceof String)) { for (var i = 0; i < target.length; i++) { addEvent(target[i], 'click', handler); } } }; function addEvent(target, type, listener) { if (target.addEventListener) { target.addEventListener(type, listener, false); } else if (target.attachEvent) { target.attachEvent('on' + type, listener); } else { target['on' + type] = listener; } } /** * Export for various environments. */ // Export CommonJS if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { module.exports = blankshield; } else { exports.blankshield = blankshield; } } // Register with AMD if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { define('blankshield', [], function() { return blankshield; }); } // export default blankshield function root.blankshield = blankshield; }(this));
Support arrays and array-like objects
Support arrays and array-like objects
JavaScript
mit
danielstjules/blankshield
--- +++ @@ -1,24 +1,31 @@ ;(function(root) { 'use strict'; - var blankshield = function(ele) { - addEvent(ele, 'click', function(e) { - var href, usedModifier, child; + var handler = function(e) { + var href, usedModifier, child; - href = e.target.getAttribute('href'); - if (!href) return; + href = e.target.getAttribute('href'); + if (!href) return; - usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey); - if (!usedModifier && e.target.getAttribute('target') !== '_blank') { - return; + usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey); + if (!usedModifier && e.target.getAttribute('target') !== '_blank') { + return; + } + + child = window.open(href); + child.opener = null; + + e.preventDefault(); + }; + + var blankshield = function(target) { + if (typeof target.length === 'undefined') { + addEvent(target, 'click', handler); + } else if (typeof target !== 'string' && !(target instanceof String)) { + for (var i = 0; i < target.length; i++) { + addEvent(target[i], 'click', handler); } - - child = window.open(href); - child.opener = null; - - e.preventDefault(); - return false; - }); + } }; function addEvent(target, type, listener) {
64e11acbe71330da23c162b0907d8e0e3ca98e10
_build/Gruntfile.js
_build/Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { files: { 'css/application.css': '../application.sass' } } }, cssmin: { minify: { expand: true, cwd: 'css/', src: ['*.css'], dest: 'css/', ext: '.min.css' } }, csslint: { strict: { src: ['css/application.css'] } }, csscss: { dist: { src: ['css/application.css'] } } }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-csslint'); grunt.loadNpmTasks('grunt-csscss'); grunt.registerTask('build', ['sass', 'cssmin']); grunt.registerTask('test', ['csslint', 'csscss']); };
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { files: { 'css/application.css': '../application.sass' } } }, cssmin: { minify: { expand: true, cwd: 'css/', src: ['*.css'], dest: 'css/', ext: '.min.css' } }, csscss: { dist: { src: ['css/application.css'] } } }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-csscss'); grunt.registerTask('build', ['sass', 'cssmin']); grunt.registerTask('test', ['csscss']); };
Remove csslint fron the grunt build task
Remove csslint fron the grunt build task
JavaScript
mit
mvcss/mvcss,mvcss/mvcss
--- +++ @@ -21,12 +21,6 @@ } }, - csslint: { - strict: { - src: ['css/application.css'] - } - }, - csscss: { dist: { src: ['css/application.css'] @@ -37,10 +31,9 @@ grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-csslint'); grunt.loadNpmTasks('grunt-csscss'); grunt.registerTask('build', ['sass', 'cssmin']); - grunt.registerTask('test', ['csslint', 'csscss']); + grunt.registerTask('test', ['csscss']); };
bd8053484844208b72f825dd4c41fda41b9ea2d9
client/src/components/Index.js
client/src/components/Index.js
import React, { Component } from 'react'; import { Link } from 'react-router'; import gamepad from '../dependencies/img/gamepad.png'; import keyboard from '../dependencies/img/keyboard.png'; export default class Index extends Component { render() { return ( <div> <div className="page-header"><h1>Accueil</h1></div> <div className="row"> <div className="col-md-2 col-md-offset-2 text-center"> <div className="panel panel-default"> <div className="panel-body"> <Link to="//localhost:8080/" target="_blank"> <img src={gamepad} alt="Utiliser le gamepad virtuel" /> <br /> <br /> Utiliser le gamepad virtuel </Link> </div> </div> </div> <div className="col-md-2 col-md-offset-2 text-center"> <div className="panel panel-default"> <div className="panel-body"> <Link to="//localhost:8080/keyboard.html" target="_blank"> <img src={keyboard} alt="Utiliser le clavier virtuel" /> <br /> <br /> Utiliser le clavier virtuel </Link> </div> </div> </div> </div> </div> ); } }
import React, { Component } from 'react'; import { Link } from 'react-router'; import { translate } from 'react-i18next'; import { Row, Col, Panel } from 'react-bootstrap'; import gamepad from '../dependencies/img/gamepad.png'; import keyboard from '../dependencies/img/keyboard.png'; class Index extends Component { render() { const { t } = this.props; return ( <div> <div className="page-header"><h1>{t('Accueil')}</h1></div> <Row> <Col md={2} mdOffset={2} className="text-center"> <Panel> <Link to="//localhost:8080/" target="_blank"> <img src={gamepad} alt={t('Utiliser le gamepad virtuel')} className="img-responsive center-block" /> <br /> <br /> {t('Utiliser le gamepad virtuel')} </Link> </Panel> </Col> <Col md={2} mdOffset={2} className="text-center"> <Panel> <Link to="//localhost:8080/keyboard.html" target="_blank"> <img src={keyboard} alt={t('Utiliser le clavier virtuel')} className="img-responsive center-block" /> <br /> <br /> {t('Utiliser le clavier virtuel')} </Link> </Panel> </Col> </Row> </div> ); } } export default translate()(Index);
Add missing i18n and use bootstrap-react
Add missing i18n and use bootstrap-react
JavaScript
mit
DjLeChuck/recalbox-manager,DjLeChuck/recalbox-manager,DjLeChuck/recalbox-manager
--- +++ @@ -1,41 +1,45 @@ import React, { Component } from 'react'; import { Link } from 'react-router'; +import { translate } from 'react-i18next'; +import { Row, Col, Panel } from 'react-bootstrap'; import gamepad from '../dependencies/img/gamepad.png'; import keyboard from '../dependencies/img/keyboard.png'; -export default class Index extends Component { +class Index extends Component { render() { + const { t } = this.props; + return ( <div> - <div className="page-header"><h1>Accueil</h1></div> + <div className="page-header"><h1>{t('Accueil')}</h1></div> - <div className="row"> - <div className="col-md-2 col-md-offset-2 text-center"> - <div className="panel panel-default"> - <div className="panel-body"> - <Link to="//localhost:8080/" target="_blank"> - <img src={gamepad} alt="Utiliser le gamepad virtuel" /> - <br /> - <br /> - Utiliser le gamepad virtuel - </Link> - </div> - </div> - </div> - <div className="col-md-2 col-md-offset-2 text-center"> - <div className="panel panel-default"> - <div className="panel-body"> - <Link to="//localhost:8080/keyboard.html" target="_blank"> - <img src={keyboard} alt="Utiliser le clavier virtuel" /> - <br /> - <br /> - Utiliser le clavier virtuel - </Link> - </div> - </div> - </div> - </div> + <Row> + <Col md={2} mdOffset={2} className="text-center"> + <Panel> + <Link to="//localhost:8080/" target="_blank"> + <img src={gamepad} alt={t('Utiliser le gamepad virtuel')} + className="img-responsive center-block" /> + <br /> + <br /> + {t('Utiliser le gamepad virtuel')} + </Link> + </Panel> + </Col> + <Col md={2} mdOffset={2} className="text-center"> + <Panel> + <Link to="//localhost:8080/keyboard.html" target="_blank"> + <img src={keyboard} alt={t('Utiliser le clavier virtuel')} + className="img-responsive center-block" /> + <br /> + <br /> + {t('Utiliser le clavier virtuel')} + </Link> + </Panel> + </Col> + </Row> </div> ); } } + +export default translate()(Index);
ee8233732cb43aa0a5aa638a55ac7dabb67e3732
models/complaint.js
models/complaint.js
/* jslint node: true */ 'use strict' var utils = require('../lib/utils') var challenges = require('../data/datacache').challenges module.exports = function (sequelize, DataTypes) { var Complaint = sequelize.define('Complaint', { message: DataTypes.STRING, file: DataTypes.STRING }, { classMethods: { associate: function (models) { Complaint.belongsTo(models.User) } }, hooks: { beforeCreate: function (complaint, fn) { uploadAnonymousChallengeHook(complaint) fn(null, complaint) } }}) return Complaint } function uploadAnonymousChallengeHook (complaint) { if (utils.notSolved(challenges.uploadAnonymous) && !complaint.UserId && complaint.file === 'clickme.pdf') { utils.solve(challenges.uploadAnonymous) } }
/* jslint node: true */ 'use strict' var utils = require('../lib/utils') var challenges = require('../data/datacache').challenges module.exports = function (sequelize, DataTypes) { var Complaint = sequelize.define('Complaint', { message: DataTypes.STRING, file: DataTypes.STRING }, { classMethods: { associate: function (models) { Complaint.belongsTo(models.User) } }, hooks: { beforeCreate: function (complaint, fn) { uploadAnonymousChallengeHook(complaint) fn(null, complaint) } }}) return Complaint } function uploadAnonymousChallengeHook (complaint) { if (utils.notSolved(challenges.uploadAnonymous) && !complaint.UserId && complaint.file === 'clickme.html') { utils.solve(challenges.uploadAnonymous) } }
Fix anonymous upload challenge verification
Fix anonymous upload challenge verification
JavaScript
mit
bonze/juice-shop,oviroman/disertatieiap2017,oviroman/disertatieiap2017,bonze/juice-shop,bonze/juice-shop,m4l1c3/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,m4l1c3/juice-shop,bkimminich/juice-shop,bonze/juice-shop,bonze/juice-shop,m4l1c3/juice-shop,m4l1c3/juice-shop,oviroman/disertatieiap2017,oviroman/disertatieiap2017,m4l1c3/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,oviroman/disertatieiap2017,bkimminich/juice-shop
--- +++ @@ -27,7 +27,7 @@ } function uploadAnonymousChallengeHook (complaint) { - if (utils.notSolved(challenges.uploadAnonymous) && !complaint.UserId && complaint.file === 'clickme.pdf') { + if (utils.notSolved(challenges.uploadAnonymous) && !complaint.UserId && complaint.file === 'clickme.html') { utils.solve(challenges.uploadAnonymous) } }
45428b90917b117a32d21e4c762037953c3a65dd
commonjs/cookie-opt/adapter.js
commonjs/cookie-opt/adapter.js
var $ = require('jQuery'); var componentEvent = require('kwf/component-event'); var cookies = require('js-cookie'); var onOptChangedCb = []; var api = { getDefaultOpt: function() { var defaultOpt = $('body').data('cookieDefaultOpt'); if (defaultOpt != 'in' && defaultOpt != 'out') defaultOpt = 'in'; return defaultOpt; }, getCookieIsSet: function() { return !!cookies.get('cookieOpt'); }, getOpt: function() { if (api.getCookieIsSet()) { return cookies.get('cookieOpt'); } else { return api.getDefaultOpt(); } }, setOpt: function(value) { var opt = cookies.get('cookieOpt'); cookies.set('cookieOpt', value, { expires: 3*365 }); if (opt != value) { for (var i=0; i< onOptChangedCb.length; i++) { onOptChangedCb[i].call(this, opt); } } }, onOptChanged: function(callback) { onOptChangedCb.push(callback); } }; var getAdapter = function(deferred) { deferred.resolve(api); }; module.exports = getAdapter;
var $ = require('jQuery'); var componentEvent = require('kwf/component-event'); var cookies = require('js-cookie'); var onOptChangedCb = []; var api = { getDefaultOpt: function() { var defaultOpt = $('body').data('cookieDefaultOpt'); if (defaultOpt != 'in' && defaultOpt != 'out') defaultOpt = 'in'; return defaultOpt; }, getCookieIsSet: function() { return !!cookies.get('cookieOpt'); }, getOpt: function() { if (api.getCookieIsSet()) { return cookies.get('cookieOpt'); } else { return api.getDefaultOpt(); } }, setOpt: function(value) { var opt = cookies.get('cookieOpt'); cookies.set('cookieOpt', value, { expires: 3*365 }); if (opt != value) { for (var i=0; i< onOptChangedCb.length; i++) { onOptChangedCb[i].call(this, value); } } }, onOptChanged: function(callback) { onOptChangedCb.push(callback); } }; var getAdapter = function(deferred) { deferred.resolve(api); }; module.exports = getAdapter;
Fix wrong value in cookie opt change event
Fix wrong value in cookie opt change event
JavaScript
bsd-2-clause
koala-framework/koala-framework,koala-framework/koala-framework
--- +++ @@ -27,7 +27,7 @@ cookies.set('cookieOpt', value, { expires: 3*365 }); if (opt != value) { for (var i=0; i< onOptChangedCb.length; i++) { - onOptChangedCb[i].call(this, opt); + onOptChangedCb[i].call(this, value); } } },
97ed59bcd2f80b4ed03e144bc7e7e9badfed09fb
app.js
app.js
var config = require("./config.js"); var express = require('express'); var http = require('http'); var path = require('path'); var app = express(); var server = http.createServer(app); var io = require('socket.io').listen(server); io.set('log level', 1); // all environments app.set('port', process.env.PORT || 80); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.cookieParser()); app.use(express.session({ secret: config.security.sessionKey })); app.use(express.methodOverride()); app.use(express.static(path.join(__dirname, 'public'))); // route registration require('./routes')(app, config.db); // socket.io server logic require('./lib/poem-editing')(io, config.db); // development only app.use(function(err, req, res, next) { console.error('***UNHANDLED ERROR: ', err.stack); res.send(500, 'Internal server error'); }); // start the http server server.listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); });
var config = require("./config.js"); var express = require('express'); var http = require('http'); var path = require('path'); var app = express(); var server = http.createServer(app); var io = require('socket.io').listen(server); io.set('log level', 1); // all environments app.set('port', process.env.PORT || 80); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.cookieParser()); app.use(express.session({ secret: config.security.sessionKey })); app.use(express.methodOverride()); app.use(express.static(path.join(__dirname, 'public'))); // route registration require('./routes')(app, config.db); // socket.io server logic require('./lib/poem-editing')(io, config.db); // error handler app.use(function(err, req, res, next) { console.error('***UNHANDLED ERROR: ', err.stack); res.send(500, 'Internal server error'); }); // start the http server server.listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); });
Change incorrect comment for error handler
Change incorrect comment for error handler
JavaScript
mit
jimguys/poemlab,jimguys/poemlab
--- +++ @@ -27,7 +27,7 @@ // socket.io server logic require('./lib/poem-editing')(io, config.db); -// development only +// error handler app.use(function(err, req, res, next) { console.error('***UNHANDLED ERROR: ', err.stack); res.send(500, 'Internal server error');
ba530e5b88e07b5e6df70da60283f4d70567ac19
cli.js
cli.js
#!/usr/bin/env node 'use strict'; var fs = require('fs'); var path = require('path'); var log = require('verbalize'); var argv = require('minimist')(process.argv.slice(2)); var parser = require('./'); log.runner = 'npmignore'; /** * Find the local `ignore` files we need */ var gitignore = argv.g || '.gitignore'; var npmignore = argv.n || '.npmignore'; // optionally specify a different destination var dest = argv.d || argv.dest || npmignore; // patterns to ignore var i = argv.i || argv.ignore; // patterns to un-ignore var u = argv.u || argv.unignore; if (typeof i === 'string') i = i.split(','); if (typeof u === 'string') u = u.split(','); var git = read(gitignore); var npm = read(npmignore); // Parse the files and create a new `.npmignore` file // based on the given arguments along with data that // is already present in either or both files. var res = parser(npm, git, {ignore: i, unignore: u}); // write the file. fs.writeFileSync(dest, res); console.log(); log.inform('updated', dest); log.success(' Done.'); function read(fp) { fp = path.join(process.cwd(), fp); if (!fs.existsSync(fp)) { return null; } return fs.readFileSync(fp, 'utf8'); }
#!/usr/bin/env node 'use strict'; var fs = require('fs'); var path = require('path'); var log = require('verbalize'); var argv = require('minimist')(process.argv.slice(2)); var parser = require('./'); log.runner = 'npmignore'; /** * Find the local `ignore` files we need */ var gitignore = argv.g || argv.gitignore || '.gitignore'; var npmignore = argv.n || argv.npmignore || '.npmignore'; // optionally specify a different destination var dest = argv.d || argv.dest || npmignore; // patterns to ignore var i = argv.i || argv.ignore; // patterns to un-ignore var u = argv.u || argv.unignore; if (typeof i === 'string') i = i.split(','); if (typeof u === 'string') u = u.split(','); var git = read(gitignore); var npm = read(npmignore); // Parse the files and create a new `.npmignore` file // based on the given arguments along with data that // is already present in either or both files. var res = parser(npm, git, {ignore: i, unignore: u}); // write the file. fs.writeFileSync(dest, res); console.log(); log.inform('updated', dest); log.success(' Done.'); function read(fp) { fp = path.join(process.cwd(), fp); if (!fs.existsSync(fp)) { return null; } return fs.readFileSync(fp, 'utf8'); }
Add missing --gitignore --npmignore argument keys
Add missing --gitignore --npmignore argument keys
JavaScript
mit
jonschlinkert/npmignore
--- +++ @@ -14,8 +14,8 @@ * Find the local `ignore` files we need */ -var gitignore = argv.g || '.gitignore'; -var npmignore = argv.n || '.npmignore'; +var gitignore = argv.g || argv.gitignore || '.gitignore'; +var npmignore = argv.n || argv.npmignore || '.npmignore'; // optionally specify a different destination var dest = argv.d || argv.dest || npmignore;
bb899803405e9f3bb24008d0019ddc9c931c81d0
server/wsEvents.js
server/wsEvents.js
var Runner = require('./runner').Runner; module.exports = function (ws) { /*var id = setInterval(function() { ws.send(JSON.stringify(process.memoryUsage()), function() { }); }, 1000); console.log('started client interval');*/ ws.on('message', function(message) { var data = JSON.parse(message); var runner = new Runner(data.commands); runner.runGame(function() { ws.send(runner.gameResult, function() { /* No error handling yet */ }); }); }); ws.on('close', function() { console.log('Closing WS connection'); }); };
var Runner = require('./runner').Runner; module.exports = function (ws) { /*var id = setInterval(function() { ws.send(JSON.stringify(process.memoryUsage()), function() { }); }, 1000); console.log('started client interval');*/ ws.on('message', function(message) { var data = JSON.parse(message); var runner = new Runner(data.commands); runner.runGame(function() { ws.send(runner.gameResult.log + runner.gameResult.result, function() { /* No error handling yet */ }); }); }); ws.on('close', function() { console.log('Closing WS connection'); }); };
Fix server program to show game result.
Fix server program to show game result.
JavaScript
apache-2.0
AI-comp/AILovers,AI-comp/AILovers,AI-comp/AILovers,AI-comp/AILovers,AI-comp/AILovers,AI-comp/AILovers
--- +++ @@ -11,7 +11,7 @@ var data = JSON.parse(message); var runner = new Runner(data.commands); runner.runGame(function() { - ws.send(runner.gameResult, function() { /* No error handling yet */ }); + ws.send(runner.gameResult.log + runner.gameResult.result, function() { /* No error handling yet */ }); }); });
d3bdcaf614aa877ed102ff1041a7884d6eee84f0
R7.Documents.Dnn/js/selectDocuments.js
R7.Documents.Dnn/js/selectDocuments.js
function r7d_selectDocument(documentId, checked, value) { var values = JSON.parse(value); var index = values.indexOf(documentId); if (checked) { if (index < 0) { values.push(documentId); } } else { if (index >= 0) { values.splice(index, 1); } } return JSON.stringify(values); } function r7d_getModuleId(target) { var c = $(target).closest("div.DnnModule").attr("class"); return c.substr(c.lastIndexOf("DnnModule-") + 10); } function r7d_selectDocument2(target) { var documentId = $(target).data("document-id"); var moduleId = r7d_getModuleId(target); var field = document.getElementById("dnn_ctr" + moduleId + "_ViewDocuments_hiddenSelectedDocuments"); field.value = r7d_selectDocument(documentId, target.checked, field.value); } function r7d_selectDeselectAll(target) { var moduleId = r7d_getModuleId(target); $("div.DnnModule-" + moduleId + " .EditCell input[type='checkbox']").prop("checked", target.checked).trigger("change"); }
function r7d_selectDocument(documentId, checked, value) { var values = JSON.parse(value); var index = values.indexOf(documentId); if (checked) { if (index < 0) { values.push(documentId); } } else { if (index >= 0) { values.splice(index, 1); } } return JSON.stringify(values); } function r7d_getModuleId(target) { var c = $(target).closest("div.DnnModule").attr("class"); var moduleId = c.match("DnnModule-(\\d+)")[1]; return moduleId; } function r7d_selectDocument2(target) { var documentId = $(target).data("document-id"); var moduleId = r7d_getModuleId(target); var field = document.getElementById("dnn_ctr" + moduleId + "_ViewDocuments_hiddenSelectedDocuments"); field.value = r7d_selectDocument(documentId, target.checked, field.value); } function r7d_selectDeselectAll(target) { var moduleId = r7d_getModuleId(target); $("div.DnnModule-" + moduleId + " .EditCell input[type='checkbox']").prop("checked", target.checked).trigger("change"); }
Fix GH-115 Cannot select documents with checkboxes on DNN 9
Fix GH-115 Cannot select documents with checkboxes on DNN 9
JavaScript
mit
roman-yagodin/R7.Documents,roman-yagodin/R7.Documents,roman-yagodin/R7.Documents
--- +++ @@ -14,7 +14,8 @@ } function r7d_getModuleId(target) { var c = $(target).closest("div.DnnModule").attr("class"); - return c.substr(c.lastIndexOf("DnnModule-") + 10); + var moduleId = c.match("DnnModule-(\\d+)")[1]; + return moduleId; } function r7d_selectDocument2(target) { var documentId = $(target).data("document-id");
b345f6212f3c783a4736914b19f411dadf90b0c4
webpack.config.js
webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({ template: __dirname + '/app/index.html', filename: 'index.html', inject: 'body' }); module.exports = { entry: [ './app/index.js' ], output: { path: __dirname + '/dist', filename: 'index_bundle.js' }, module: { loaders: [ {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'} ] }, plugins: [HTMLWebpackPluginConfig] };
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({ template: __dirname + '/app/index.html', filename: 'index.html', inject: 'body' }); module.exports = { entry: [ './app/index.js' ], output: { path: __dirname + '/dist', filename: 'index_bundle.js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['react'] } } ] }, plugins: [HTMLWebpackPluginConfig] };
Fix JSX parsing with Babel
Fix JSX parsing with Babel
JavaScript
mit
cimm/blathy,cimm/blathy
--- +++ @@ -15,7 +15,14 @@ }, module: { loaders: [ - {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'} + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + query: { + presets: ['react'] + } + } ] }, plugins: [HTMLWebpackPluginConfig]
a451e50a75d7ee01d72d34c680c9d948c4fde14f
controller/users-admin/server.js
controller/users-admin/server.js
'use strict'; var assign = require('es5-ext/object/assign') , promisify = require('deferred').promisify , bcrypt = require('bcrypt') , dbjsCreate = require('mano/lib/utils/dbjs-form-create') , router = require('mano/server/post-router') , changePassword = require('mano-auth/controller/server/change-password').submit , dbObjects = require('mano').db.objects , genSalt = promisify(bcrypt.genSalt), hash = promisify(bcrypt.hash) , submit = router.submit; // Common assign(exports, require('../user/server')); // Add User exports['user-add'] = { submit: function (data) { return hash(data['User#/password'], genSalt())(function (password) { data['User#/password'] = password; this.target = dbjsCreate(data); }.bind(this)); } }; // Edit User exports['user/[0-9][a-z0-9]+'] = { submit: function (normalizedData, data) { if (this.propertyKey) return changePassword.apply(this, arguments); return submit.apply(this, arguments); } }; // Delete User exports['user/[0-9][a-z0-9]+/delete'] = { submit: function () { dbObjects.delete(this.target); } };
'use strict'; var assign = require('es5-ext/object/assign') , promisify = require('deferred').promisify , bcrypt = require('bcrypt') , dbjsCreate = require('mano/lib/utils/dbjs-form-create') , submit = require('mano/utils/save') , changePassword = require('mano-auth/controller/server/change-password').submit , dbObjects = require('mano').db.objects , genSalt = promisify(bcrypt.genSalt), hash = promisify(bcrypt.hash); // Common assign(exports, require('../user/server')); // Add User exports['user-add'] = { submit: function (data) { return hash(data['User#/password'], genSalt())(function (password) { data['User#/password'] = password; this.target = dbjsCreate(data); }.bind(this)); } }; // Edit User exports['user/[0-9][a-z0-9]+'] = { submit: function (normalizedData, data) { if (this.propertyKey) return changePassword.apply(this, arguments); return submit.apply(this, arguments); } }; // Delete User exports['user/[0-9][a-z0-9]+/delete'] = { submit: function () { dbObjects.delete(this.target); } };
Fix resolution of submit function
Fix resolution of submit function
JavaScript
mit
egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations
--- +++ @@ -4,12 +4,11 @@ , promisify = require('deferred').promisify , bcrypt = require('bcrypt') , dbjsCreate = require('mano/lib/utils/dbjs-form-create') - , router = require('mano/server/post-router') + , submit = require('mano/utils/save') , changePassword = require('mano-auth/controller/server/change-password').submit , dbObjects = require('mano').db.objects - , genSalt = promisify(bcrypt.genSalt), hash = promisify(bcrypt.hash) - , submit = router.submit; + , genSalt = promisify(bcrypt.genSalt), hash = promisify(bcrypt.hash); // Common assign(exports, require('../user/server'));
cbd66e8256e91941e91eebb999ea65e2250c5d7f
webpack.config.js
webpack.config.js
/* global __dirname */ 'use strict'; var webpack = require('webpack'); var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js'); module.exports = { context: __dirname + '/client', entry: { index: './js/index', embed: './js/embed' }, output: { filename: '[name].bundle.js', chunkFilename: '[id].bundle.js', path: __dirname + '/public/js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015'] } }, { test: /\.sass$/, loaders: ['style', 'css', 'sass'] }, { test: /\.jade$/, loaders: ['jade'] } ] }, sassLoader: { indentedSyntax: true }, plugins: [commonsPlugin], node: { fs: 'empty' // needed for term.js } };
/* global __dirname */ 'use strict'; var webpack = require('webpack'); var path = require('path'); var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js'); module.exports = { context: path.resolve(__dirname, 'client'), entry: { index: './js/index', embed: './js/embed' }, output: { filename: '[name].bundle.js', chunkFilename: '[id].bundle.js', path: __dirname + '/public/js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015'] } }, { test: /\.sass$/, loaders: ['style', 'css', 'sass'] }, { test: /\.jade$/, loaders: ['jade'] } ] }, sassLoader: { indentedSyntax: true }, plugins: [commonsPlugin], node: { fs: 'empty' // needed for term.js } };
Fix webpack context path on windows
Fix webpack context path on windows
JavaScript
mit
ebertmi/webbox,ebertmi/webbox,ebertmi/webbox
--- +++ @@ -3,11 +3,12 @@ 'use strict'; var webpack = require('webpack'); +var path = require('path'); var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js'); module.exports = { - context: __dirname + '/client', + context: path.resolve(__dirname, 'client'), entry: { index: './js/index', embed: './js/embed'
8f41cbedd9afca3c812e8c98cfd8e50d7394ae4c
src/instantiateObjectTypes.js
src/instantiateObjectTypes.js
import { GraphQLObjectType, GraphQLID } from 'graphql'; import buildAttributes from './buildAttributes'; import buildRelationships from './buildRelationships'; import titleizeType from './titleizeType'; const getDefaultDescription = (name) => `The ${titleizeType(name)} Cohere model.`; export default (schema) => { const typeCache = {}; const graphQLObjectTypes = schema.types.reduce((prev, type) => { const { meta, name } = type; if (!meta) { throw new Error( 'Micrograph requires every defined type to have a valid meta key. The ' + `${name} type did not have a meta key.` ); } if (typeCache.hasOwnProperty(name)) return prev; typeCache[name] = true; return { ...prev, [name]: new GraphQLObjectType({ description: meta.description || getDefaultDescription(name), name: `${titleizeType(name)}`, fields: () => ({ id: { type: GraphQLID }, ...buildAttributes(type), ...buildRelationships(type, graphQLObjectTypes), }), }), }; }, {}); return graphQLObjectTypes; };
import { GraphQLObjectType, GraphQLID } from 'graphql'; import buildAttributes from './buildAttributes'; import buildRelationships from './buildRelationships'; import titleizeType from './titleizeType'; const getDefaultDescription = (name) => `The ${titleizeType(name)} Cohere model.`; const typeCache = {}; export default (schema) => { const graphQLObjectTypes = schema.types.reduce((prev, type) => { const { meta, name } = type; if (!meta) { throw new Error( 'Micrograph requires every defined type to have a valid meta key. The ' + `${name} type did not have a meta key.` ); } if (typeCache.hasOwnProperty(name)) return prev; typeCache[name] = true; return { ...prev, [name]: new GraphQLObjectType({ description: meta.description || getDefaultDescription(name), name: `${titleizeType(name)}`, fields: () => ({ id: { type: GraphQLID }, ...buildAttributes(type), ...buildRelationships(type, graphQLObjectTypes), }), }), }; }, {}); return graphQLObjectTypes; };
Fix type cache getting result on func calls
Fix type cache getting result on func calls
JavaScript
mit
dylnslck/micrograph
--- +++ @@ -4,10 +4,9 @@ import titleizeType from './titleizeType'; const getDefaultDescription = (name) => `The ${titleizeType(name)} Cohere model.`; +const typeCache = {}; export default (schema) => { - const typeCache = {}; - const graphQLObjectTypes = schema.types.reduce((prev, type) => { const { meta, name } = type;
7074cfd271da781ded38d612a88881c882e193dd
src/jquery-input-file-text.js
src/jquery-input-file-text.js
/** */ (function($) { $.fn.inputFileText = function(userOptions) { var MARKER_ATTRIBUTE = 'data-inputFileText'; if(this.attr(MARKER_ATTRIBUTE) === 'true') { // Plugin has already been applied to input file element return this; } var options = $.extend({ // Defaults text: 'Choose File', remove: false }, userOptions); // Hide input file element this.css({ display: 'none' //width: 0 }); // Insert button after input file element var button = $( '<input type="button" value="' + options.text + '" />' ).insertAfter(this); // Insert text after button element var text = $( '<input type="text" style="readonly:true; border:none; margin-left: 5px" />' ).insertAfter(button); // Open input file dialog when button clicked var self = this; button.click(function() { self.click(); }); // Update text when input file chosen this.change(function() { text.val(self.val()); }); // Mark that this plugin has been applied to the input file element return this.attr(MARKER_ATTRIBUTE, 'true'); }; }(jQuery));
/** */ (function($) { $.fn.inputFileText = function(userOptions) { var MARKER_ATTRIBUTE = 'data-inputFileText'; if(this.attr(MARKER_ATTRIBUTE) === 'true') { // Plugin has already been applied to input file element return this; } var options = $.extend({ // Defaults text: 'Choose File', remove: false }, userOptions); // Hide input file element this.css({ display: 'none' //width: 0 }); // Insert button after input file element var button = $( '<input type="button" value="' + options.text + '" />' ).insertAfter(this); // Insert text after button element var text = $( '<input type="text" style="readonly:true; border:none; margin-left: 5px" />' ).insertAfter(button); // Open input file dialog when button clicked var self = this; button.click(function() { self.click(); }); // Update text when input file chosen this.change(function() { // Chrome puts C:\fakepath\... for file path text.val(self.val().replace('C:\\fakepath\\', '')); }); // Mark that this plugin has been applied to the input file element return this.attr(MARKER_ATTRIBUTE, 'true'); }; }(jQuery));
Fix for Chrome filepath C:\fakepath\
Fix for Chrome filepath C:\fakepath\
JavaScript
mit
datchung/jquery.inputFileText,datchung/jquery.inputFileText
--- +++ @@ -41,7 +41,8 @@ // Update text when input file chosen this.change(function() { - text.val(self.val()); + // Chrome puts C:\fakepath\... for file path + text.val(self.val().replace('C:\\fakepath\\', '')); }); // Mark that this plugin has been applied to the input file element
d4c777e3412db2820a53bd51aa28a72440dce0fb
webapp/src/components/highchart/themes.js
webapp/src/components/highchart/themes.js
export default { standard: { credits: { enabled: false }, chart: { spacingBottom: 20, style: { fontFamily: "'proxima', 'Helvetica', sans-serif' ", paddingTop: '20px' // Make room for buttons } }, exporting: { buttons: { contextButton: { symbol: null, text: 'Export', x: -20, y: -30, theme: { style: { color: '#039', textDecoration: 'underline' } } } } }, title: '' } }
export default { standard: { credits: { enabled: false }, chart: { spacingBottom: 20, style: { fontFamily: "'proxima', 'Helvetica', sans-serif' ", paddingTop: '20px' // Make room for buttons } }, exporting: { buttons: { contextButton: { onclick: function () { this.exportChart({type: 'jpeg'}) }, symbol: null, text: 'Export', x: -20, y: -30, theme: { style: { color: '#039', textDecoration: 'underline' } } } } }, title: '' } }
Make export button only export jpegs
Make export button only export jpegs
JavaScript
agpl-3.0
unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome
--- +++ @@ -11,6 +11,9 @@ exporting: { buttons: { contextButton: { + onclick: function () { + this.exportChart({type: 'jpeg'}) + }, symbol: null, text: 'Export', x: -20,
fd8013b3e7635940abba3382940792c41316aacf
lib/assets/javascripts/spree/backend/store_picker.js
lib/assets/javascripts/spree/backend/store_picker.js
$.fn.storeAutocomplete = function() { this.select2({ minimumInputLength: 1, multiple: true, initSelection: function(element, callback) { $.get(Spree.routes.store_search, { ids: element.val() }, function(data) { callback(data) }) }, ajax: { url: Spree.routes.store_search, datatype: 'json', data: function(term, page) { return { q: term } }, results: function(data, page) { return { results: data } } }, formatResult: function(store) { return store.name; }, formatSelection: function(store) { return store.name; }, id: function(store) { return store.id } }); } $(document).ready(function () { $('.store_picker').storeAutocomplete(); })
$.fn.storeAutocomplete = function() { this.select2({ minimumInputLength: 1, multiple: true, initSelection: function(element, callback) { $.get(Spree.routes.store_search, { ids: element.val() }, function(data) { callback(data) }) }, ajax: { url: Spree.routes.store_search, datatype: 'json', data: function(term, page) { return { q: term } }, results: function(data, page) { return { results: data } } }, formatResult: function(store) { return store.name; }, formatSelection: function(store) { return store.name; }, id: function(store) { return store.id } }); }
Remove duplicate call to storeAutocomplete
Remove duplicate call to storeAutocomplete This was causing javascript errors. storeAutocomplete also doesn't work until the store rule partial is run, since Spree.routes.store_search won't be set.
JavaScript
bsd-3-clause
solidusio/solidus_multi_domain,solidusio/solidus_multi_domain,solidusio/solidus_multi_domain
--- +++ @@ -28,7 +28,3 @@ } }); } - -$(document).ready(function () { - $('.store_picker').storeAutocomplete(); -})
f6f772cf69611eaadc29527b230a62c66af2a8cd
workbox.config.js
workbox.config.js
const path = require('path'); const BUILD_DIR = 'build'; module.exports = { globDirectory: BUILD_DIR, globPatterns: ['/', '**/*.{html,js,css,woff2,webmanifest}'], swSrc: path.join(BUILD_DIR, 'service-worker.js'), swDest: path.join(BUILD_DIR, 'service-worker.js'), mode: 'production', };
const path = require('path'); const BUILD_DIR = 'build'; module.exports = { globDirectory: BUILD_DIR, globPatterns: ['/', '**/*.{js,css,woff2,webmanifest}'], swSrc: path.join(BUILD_DIR, 'service-worker.js'), swDest: path.join(BUILD_DIR, 'service-worker.js'), mode: 'production', };
Remove other HTML pages from precaching
Remove other HTML pages from precaching
JavaScript
mit
esviji/esviji,esviji/esviji
--- +++ @@ -4,7 +4,7 @@ module.exports = { globDirectory: BUILD_DIR, - globPatterns: ['/', '**/*.{html,js,css,woff2,webmanifest}'], + globPatterns: ['/', '**/*.{js,css,woff2,webmanifest}'], swSrc: path.join(BUILD_DIR, 'service-worker.js'), swDest: path.join(BUILD_DIR, 'service-worker.js'), mode: 'production',
9694448f9d41dec92e9cb901e6aa1df163c09d30
src/ipc-helpers.js
src/ipc-helpers.js
const Disposable = require('event-kit').Disposable let ipcRenderer = null let ipcMain = null let BrowserWindow = null exports.on = function (emitter, eventName, callback) { emitter.on(eventName, callback) return new Disposable(() => emitter.removeListener(eventName, callback)) } exports.call = function (channel, ...args) { if (!ipcRenderer) { ipcRenderer = require('electron').ipcRenderer ipcRenderer.setMaxListeners(20) } const responseChannel = getResponseChannel(channel) return new Promise(resolve => { ipcRenderer.on(responseChannel, (event, result) => { ipcRenderer.removeAllListeners(responseChannel) resolve(result) }) ipcRenderer.send(channel, ...args) }) } exports.respondTo = function (channel, callback) { if (!ipcMain) { const electron = require('electron') ipcMain = electron.ipcMain BrowserWindow = electron.BrowserWindow } const responseChannel = getResponseChannel(channel) return exports.on(ipcMain, channel, async (event, ...args) => { const browserWindow = BrowserWindow.fromWebContents(event.sender) const result = await callback(browserWindow, ...args) event.sender.send(responseChannel, result) }) } function getResponseChannel (channel) { return 'ipc-helpers-' + channel + '-response' }
const Disposable = require('event-kit').Disposable let ipcRenderer = null let ipcMain = null let BrowserWindow = null let nextResponseChannelId = 0 exports.on = function (emitter, eventName, callback) { emitter.on(eventName, callback) return new Disposable(() => emitter.removeListener(eventName, callback)) } exports.call = function (channel, ...args) { if (!ipcRenderer) { ipcRenderer = require('electron').ipcRenderer ipcRenderer.setMaxListeners(20) } const responseChannel = `ipc-helpers-response-${nextResponseChannelId++}` return new Promise(resolve => { ipcRenderer.on(responseChannel, (event, result) => { ipcRenderer.removeAllListeners(responseChannel) resolve(result) }) ipcRenderer.send(channel, responseChannel, ...args) }) } exports.respondTo = function (channel, callback) { if (!ipcMain) { const electron = require('electron') ipcMain = electron.ipcMain BrowserWindow = electron.BrowserWindow } return exports.on(ipcMain, channel, async (event, responseChannel, ...args) => { const browserWindow = BrowserWindow.fromWebContents(event.sender) const result = await callback(browserWindow, ...args) event.sender.send(responseChannel, result) }) }
Handle concurrent calls to the same channel in ipc helpers
Handle concurrent calls to the same channel in ipc helpers
JavaScript
mit
PKRoma/atom,Mokolea/atom,Mokolea/atom,PKRoma/atom,andrewleverette/atom,stinsonga/atom,Arcanemagus/atom,Arcanemagus/atom,atom/atom,PKRoma/atom,ardeshirj/atom,andrewleverette/atom,t9md/atom,Mokolea/atom,atom/atom,brettle/atom,brettle/atom,t9md/atom,liuderchi/atom,liuderchi/atom,liuderchi/atom,brettle/atom,ardeshirj/atom,stinsonga/atom,andrewleverette/atom,t9md/atom,stinsonga/atom,Arcanemagus/atom,stinsonga/atom,atom/atom,liuderchi/atom,ardeshirj/atom
--- +++ @@ -2,6 +2,8 @@ let ipcRenderer = null let ipcMain = null let BrowserWindow = null + +let nextResponseChannelId = 0 exports.on = function (emitter, eventName, callback) { emitter.on(eventName, callback) @@ -14,7 +16,7 @@ ipcRenderer.setMaxListeners(20) } - const responseChannel = getResponseChannel(channel) + const responseChannel = `ipc-helpers-response-${nextResponseChannelId++}` return new Promise(resolve => { ipcRenderer.on(responseChannel, (event, result) => { @@ -22,7 +24,7 @@ resolve(result) }) - ipcRenderer.send(channel, ...args) + ipcRenderer.send(channel, responseChannel, ...args) }) } @@ -33,15 +35,9 @@ BrowserWindow = electron.BrowserWindow } - const responseChannel = getResponseChannel(channel) - - return exports.on(ipcMain, channel, async (event, ...args) => { + return exports.on(ipcMain, channel, async (event, responseChannel, ...args) => { const browserWindow = BrowserWindow.fromWebContents(event.sender) const result = await callback(browserWindow, ...args) event.sender.send(responseChannel, result) }) } - -function getResponseChannel (channel) { - return 'ipc-helpers-' + channel + '-response' -}
1a444d80b0d5538063cc78477f89034c83271056
src/application.js
src/application.js
"use strict"; var View = require("./view"); var Router = require("./router"); var util = require("substance-util"); var _ = require("underscore"); // Substance.Application // ========================================================================== // // Application abstraction suggesting strict MVC var Application = function(config) { View.call(this); this.config = config; }; Application.Prototype = function() { // Init router // ---------- this.initRouter = function() { this.router = new Router(); _.each(this.config.routes, function(route) { this.router.route(route.route, route.name, _.bind(this.controller[route.command], this.controller)); }, this); Router.history.start(); }; // Start Application // ---------- // this.start = function() { this.initRouter(); this.$el = $('body'); this.el = this.$el[0]; this.render(); }; }; // Setup prototype chain Application.Prototype.prototype = View.prototype; Application.prototype = new Application.Prototype(); module.exports = Application;
"use strict"; var View = require("./view"); var Router = require("./router"); var util = require("substance-util"); var _ = require("underscore"); // Substance.Application // ========================================================================== // // Application abstraction suggesting strict MVC var Application = function(config) { View.call(this); this.config = config; }; Application.Prototype = function() { // Init router // ---------- this.initRouter = function() { this.router = new Router(); _.each(this.config.routes, function(route) { this.router.route(route.route, route.name, _.bind(this.controller[route.command], this.controller)); }, this); Router.history.start(); }; // Start Application // ---------- // this.start = function() { // First setup the top level view this.$el = $('body'); this.el = this.$el[0]; this.render(); // Now the normal app lifecycle can begin // Because app state changes require the main view to be present // Triggers an initial app state change according to url hash fragment this.initRouter(); }; }; // Setup prototype chain Application.Prototype.prototype = View.prototype; Application.prototype = new Application.Prototype(); module.exports = Application;
Change order of initial app render and router activation.
Change order of initial app render and router activation.
JavaScript
mit
substance/application
--- +++ @@ -35,10 +35,15 @@ // this.start = function() { - this.initRouter(); + // First setup the top level view this.$el = $('body'); this.el = this.$el[0]; this.render(); + + // Now the normal app lifecycle can begin + // Because app state changes require the main view to be present + // Triggers an initial app state change according to url hash fragment + this.initRouter(); }; };
01828cfc40451604b00b7e2380ef3d10bd4714a3
src/components/Warning/Warning.js
src/components/Warning/Warning.js
import React from 'react' import PropTypes from 'prop-types' import { Sticky } from 'react-sticky' import styles from './Warning.scss' class Warning extends React.PureComponent { static propTypes = { error: PropTypes.bool, title: PropTypes.string.isRequired, children: PropTypes.node.isRequired } static defaultProps = { error: false } state = { displayed: true } closeWarning = () => { this.setState({ displayed: false }) } render() { const { displayed } = this.state if (!displayed) { return null } const { error, title, children } = this.props const color = error ? styles.errorStyle : styles.warning return ( <Sticky className={`${styles.sticky} ${color}`}> <div className={styles.content}> <div className={styles.bold}>{title}</div> {children} </div> <div className={styles.closeIcon} onClick={this.closeWarning}> <i className="big remove icon" /> </div> </Sticky> ) } } export default Warning
import React from 'react' import PropTypes from 'prop-types' import { Sticky } from 'react-sticky' import styles from './Warning.scss' class Warning extends React.PureComponent { static propTypes = { error: PropTypes.bool, title: PropTypes.string.isRequired, children: PropTypes.node.isRequired } static defaultProps = { error: false } state = { displayed: true } closeWarning = () => { this.setState({ displayed: false }) } render() { const { displayed } = this.state if (!displayed) return const { error, title, children } = this.props const color = error ? styles.errorStyle : styles.warning return ( <Sticky className={`${styles.sticky} ${color}`}> <div className={styles.content}> <div className={styles.bold}>{title}</div> {children} </div> <div className={styles.closeIcon} onClick={this.closeWarning}> <i className="big remove icon" /> </div> </Sticky> ) } } export default Warning
Remove braces for simple return
Remove braces for simple return
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -28,9 +28,7 @@ render() { const { displayed } = this.state - if (!displayed) { - return null - } + if (!displayed) return const { error, title, children } = this.props const color = error ? styles.errorStyle : styles.warning
07500b1d868a4c623233b54c9cf8c29048cc732e
app/assets/javascripts/edsn.js
app/assets/javascripts/edsn.js
var EDSN_THRESHOLD = 30; var EdsnSwitch = (function(){ var editing; var validBaseLoads = /^(base_load|base_load_edsn)$/; EdsnSwitch.prototype = { enable: function(){ if(editing){ swapEdsnBaseLoadSelectBoxes(); } }, isEdsn: function(){ return validBaseLoads.test($(this).data('type')); }, cloneAndAppendProfileSelect: function(){ swapSelectBox.call(this); } }; function swapEdsnBaseLoadSelectBoxes(){ $("tr.base_load_edsn select.name").each(swapSelectBox); }; function swapSelectBox(){ var technology = $(this).val(); var self = this; var unitSelector = $(this).parents("tr").find(".units input"); var units = parseInt(unitSelector.val()); var actual = (units > EDSN_THRESHOLD ? "base_load_edsn" : "base_load"); var select = $(".hidden select." + actual).clone(true, true); $(this).parent().next().html(select); $(this).find("option[value='" + technology + "']").attr('value', actual); unitSelector.off('change').on('change', swapSelectBox.bind(self)); }; function EdsnSwitch(_editing){ editing = _editing; }; return EdsnSwitch; })();
var EDSN_THRESHOLD = 30; var EdsnSwitch = (function(){ var editing; var validBaseLoads = /^(base_load|base_load_edsn)$/; EdsnSwitch.prototype = { enable: function(){ if(editing){ swapEdsnBaseLoadSelectBoxes(); } }, isEdsn: function(){ return validBaseLoads.test($(this).val()); }, cloneAndAppendProfileSelect: function(){ swapSelectBox.call(this); } }; function swapEdsnBaseLoadSelectBoxes(){ $("tr.base_load_edsn select.name").each(swapSelectBox); }; function swapSelectBox(){ var technology = $(this).val(); var self = this; var unitSelector = $(this).parents("tr").find(".units input"); var units = parseInt(unitSelector.val()); var actual = (units > EDSN_THRESHOLD ? "base_load_edsn" : "base_load"); var select = $(".hidden select." + actual).clone(true, true); $(this).parent().next().html(select); $(this).find("option[value='" + technology + "']").attr('value', actual); unitSelector.off('change').on('change', swapSelectBox.bind(self)); }; function EdsnSwitch(_editing){ editing = _editing; }; return EdsnSwitch; })();
Revert "Use data attribute instead of val()"
Revert "Use data attribute instead of val()" This reverts commit 680debc53973355b553155bdfae857907af0a259. Ref #471
JavaScript
mit
quintel/etmoses,quintel/etmoses,quintel/etmoses,quintel/etmoses,quintel/etmoses
--- +++ @@ -12,7 +12,7 @@ }, isEdsn: function(){ - return validBaseLoads.test($(this).data('type')); + return validBaseLoads.test($(this).val()); }, cloneAndAppendProfileSelect: function(){
e4a2d9412379274d43851f7983dcb3056227f273
actions/navigate.js
actions/navigate.js
var debug = require('debug')('navigateAction'); module.exports = function (context, payload, done) { if (!context.router || !context.router.getRoute) { debug('no router available for navigate handling'); return; } debug('executing', payload); var route = context.router.getRoute(payload.path, {navigate: payload}); if (!route) { var err = new Error('Url does not exist'); err.status = 404; done(err); return; } debug('dispatching CHANGE_ROUTE', route); context.dispatch('CHANGE_ROUTE', route); var routeHandler = route.config && route.config.handler; if (!routeHandler) { done(); return; } // Execute route handler context.executeAction(routeHandler, route, done); done(); };
var debug = require('debug')('navigateAction'); module.exports = function (context, payload, done) { if (!context.router || !context.router.getRoute) { debug('no router available for navigate handling'); return; } debug('executing', payload); var route = context.router.getRoute(payload.path, {navigate: payload}); if (!route) { var err = new Error('Url does not exist'); err.status = 404; done(err); return; } debug('dispatching CHANGE_ROUTE', route); context.dispatch('CHANGE_ROUTE_START', route); var routeHandler = route.config && route.config.handler; if (!routeHandler) { done(); return; } // Execute route handler context.executeAction(routeHandler, route, function (err) { if (err) { context.dispatch('CHANGE_ROUTE_FAILURE', route); } else { context.dispatch('CHANGE_ROUTE_SUCCESS', route); } done(err); }); };
Add success and failure events
Add success and failure events
JavaScript
bsd-3-clause
yahoo/flux-router-component
--- +++ @@ -15,7 +15,7 @@ return; } debug('dispatching CHANGE_ROUTE', route); - context.dispatch('CHANGE_ROUTE', route); + context.dispatch('CHANGE_ROUTE_START', route); var routeHandler = route.config && route.config.handler; if (!routeHandler) { done(); @@ -23,6 +23,12 @@ } // Execute route handler - context.executeAction(routeHandler, route, done); - done(); + context.executeAction(routeHandler, route, function (err) { + if (err) { + context.dispatch('CHANGE_ROUTE_FAILURE', route); + } else { + context.dispatch('CHANGE_ROUTE_SUCCESS', route); + } + done(err); + }); };
d316c7a0e2b7f46344ab97465e2f52be10f0a529
client/routes/_config.js
client/routes/_config.js
Router.configure({ layoutTemplate: 'mainLayout' }); /* Actions */ var requiresUserLogin = function () { if (!Meteor.user()) { this.render('login'); } else { this.next(); } }; // User login required for all areas of site Router.onBeforeAction(requiresUserLogin, {except: ['login']});
Router.configure({ layoutTemplate: 'mainLayout' }); /* Actions */ var requiresUserLogin = function () { if (!Meteor.user()) { this.render('login'); } else { this.next(); } }; var anonymousRoutes = [ 'login', 'atChangePwd', 'atEnrollAccount', 'atForgotPwd', 'atResetPwd', 'atSignIn', 'atSignUp', 'atVerifyEmail', 'atresendVerificationEmail' ]; // User login required for all areas of site Router.plugin('ensureSignedIn', {except: anonymousRoutes});
Exclude AccountsTemplates routes in ensureSignedIn
Exclude AccountsTemplates routes in ensureSignedIn
JavaScript
agpl-3.0
GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing
--- +++ @@ -14,5 +14,17 @@ } }; +var anonymousRoutes = [ + 'login', + 'atChangePwd', + 'atEnrollAccount', + 'atForgotPwd', + 'atResetPwd', + 'atSignIn', + 'atSignUp', + 'atVerifyEmail', + 'atresendVerificationEmail' +]; + // User login required for all areas of site -Router.onBeforeAction(requiresUserLogin, {except: ['login']}); +Router.plugin('ensureSignedIn', {except: anonymousRoutes});
fb7f50252c31c503e1ebe65561fa03f5a868ce56
packages/pundle-core/lib/watcher/adapter-chokidar.js
packages/pundle-core/lib/watcher/adapter-chokidar.js
// @flow import chokidar from 'chokidar' export default class AdapterChokdiar { handle: Object rootDirectory: string constructor(rootDirectory: string, onChange: (path: string) => void) { this.rootDirectory = rootDirectory this.handle = chokidar.watch([], { ignoreInitial: true, awaitWriteFinish: { pollInterval: 50, stabilityThreshold: 250, }, }) this.handle.on('change', path => onChange(path)) } watch(): Promise<void> { return new Promise(resolve => { this.handle.add(this.rootDirectory) this.handle.on('ready', resolve) }) } close() { this.handle.close() } }
// @flow import chokidar from 'chokidar' export default class AdapterChokdiar { handle: Object rootDirectory: string constructor(rootDirectory: string, onChange: (path: string) => void) { this.rootDirectory = rootDirectory this.handle = chokidar.watch([], { ignoreInitial: true, awaitWriteFinish: { pollInterval: 30, stabilityThreshold: 60, }, }) this.handle.on('change', path => onChange(path)) } watch(): Promise<void> { return new Promise(resolve => { this.handle.add(this.rootDirectory) this.handle.on('ready', resolve) }) } close() { this.handle.close() } }
Reduce stability threshold in watcher for faster HMR
:art: Reduce stability threshold in watcher for faster HMR
JavaScript
mit
steelbrain/pundle,steelbrain/pundle,steelbrain/pundle,motion/pundle
--- +++ @@ -11,8 +11,8 @@ this.handle = chokidar.watch([], { ignoreInitial: true, awaitWriteFinish: { - pollInterval: 50, - stabilityThreshold: 250, + pollInterval: 30, + stabilityThreshold: 60, }, }) this.handle.on('change', path => onChange(path))
fd84a884f2d13247b149e162e8bfe1e41bddc0fa
jujugui/static/gui/src/app/components/expert-store-card/test-expert-store-card.js
jujugui/static/gui/src/app/components/expert-store-card/test-expert-store-card.js
/* Copyright (C) 2018 Canonical Ltd. */ 'use strict'; const React = require('react'); const EXPERTS = require('../expert-card/experts'); const ExpertCard = require('../expert-card/expert-card'); const ExpertStoreCard = require('../expert-store-card/expert-store-card'); const jsTestUtils = require('../../utils/component-test-utils'); describe('ExpertStoreCard', function() { function renderComponent(options={}) { return jsTestUtils.shallowRender( <ExpertStoreCard classes={options.classes || ['extra-class']} expert={options.expert || 'spicule'} staticURL="/media" />, true); } it('can render', () => { const renderer = renderComponent(); const output = renderer.getRenderOutput(); const expected = ( <ExpertCard classes={['extra-class']} expert={EXPERTS['spicule']} staticURL="/media"> <div className="expert-store-card"> <p className="expert-store-card__description"> Learn how Spicule and Canonical can help solve your Big Data challenges with JAAS: </p> <a className="button--inline-neutral" href="http://jujucharms.com/experts/" target="_blank"> Learn about Big Data expertise&hellip; </a> </div> </ExpertCard>); expect(output).toEqualJSX(expected); }); });
/* Copyright (C) 2018 Canonical Ltd. */ 'use strict'; const React = require('react'); const enzyme = require('enzyme'); const ExpertStoreCard = require('../expert-store-card/expert-store-card'); describe('ExpertStoreCard', function() { const renderComponent = (options = {}) => enzyme.shallow( <ExpertStoreCard classes={options.classes || ['extra-class']} expert={options.expert || 'spicule'} staticURL="/media" /> ); it('can render', () => { const wrapper = renderComponent(); const expected = ( <div className="expert-store-card"> <p className="expert-store-card__description"> Learn how Spicule and Canonical can help solve your Big Data challenges with JAAS: </p> <a className="button--inline-neutral" href="http://jujucharms.com/experts/" target="_blank"> Learn about Big Data expertise&hellip; </a> </div>); assert.compareJSX(wrapper.find('.expert-store-card'), expected); }); });
Update expert store card tests to use enzyme.
Update expert store card tests to use enzyme.
JavaScript
agpl-3.0
mitechie/juju-gui,mitechie/juju-gui,mitechie/juju-gui,mitechie/juju-gui
--- +++ @@ -2,42 +2,33 @@ 'use strict'; const React = require('react'); +const enzyme = require('enzyme'); -const EXPERTS = require('../expert-card/experts'); -const ExpertCard = require('../expert-card/expert-card'); const ExpertStoreCard = require('../expert-store-card/expert-store-card'); -const jsTestUtils = require('../../utils/component-test-utils'); +describe('ExpertStoreCard', function() { -describe('ExpertStoreCard', function() { - function renderComponent(options={}) { - return jsTestUtils.shallowRender( - <ExpertStoreCard - classes={options.classes || ['extra-class']} - expert={options.expert || 'spicule'} - staticURL="/media" />, true); - } + const renderComponent = (options = {}) => enzyme.shallow( + <ExpertStoreCard + classes={options.classes || ['extra-class']} + expert={options.expert || 'spicule'} + staticURL="/media" /> + ); it('can render', () => { - const renderer = renderComponent(); - const output = renderer.getRenderOutput(); + const wrapper = renderComponent(); const expected = ( - <ExpertCard - classes={['extra-class']} - expert={EXPERTS['spicule']} - staticURL="/media"> - <div className="expert-store-card"> - <p className="expert-store-card__description"> - Learn how Spicule and Canonical can help solve your Big Data - challenges with JAAS: - </p> - <a className="button--inline-neutral" - href="http://jujucharms.com/experts/" - target="_blank"> - Learn about Big Data expertise&hellip; - </a> - </div> - </ExpertCard>); - expect(output).toEqualJSX(expected); + <div className="expert-store-card"> + <p className="expert-store-card__description"> + Learn how Spicule and Canonical can help solve your Big Data + challenges with JAAS: + </p> + <a className="button--inline-neutral" + href="http://jujucharms.com/experts/" + target="_blank"> + Learn about Big Data expertise&hellip; + </a> + </div>); + assert.compareJSX(wrapper.find('.expert-store-card'), expected); }); });
eec5c8bf08302afc8863223973f7e0e117bcfc8e
app_api/controllers/classes.js
app_api/controllers/classes.js
var mongoose = require('mongoose'); var Class = mongoose.model('Class'); var sendJSONresponse = function(res, status, content) { res.status(status); res.json(content); }; module.exports.classesGetAll = function(req, res) { sendJSONresponse(res, 200, {"status": "success"}); }; module.exports.professorsForClass = function(req, res) { sendJSONresponse(res, 200, {"status": "success"}); };
var mongoose = require('mongoose'); var Class = mongoose.model('Class'); var Prof = mongoose.model('Professor'); var sendJSONresponse = function(res, status, content) { res.status(status); res.json(content); }; var errNotFound = {"message": "Not found"}; var success = function(res, data) { sendJSONresponse(res, 200, data); } var errorGet = function(res, err) { sendJSONresponse(res, 404, err); // 404 is standard code for GET error }; module.exports.classesGetAll = function(req, res) { Class .find() .exec(function(err, classes){ // error handling first if (!classes) { errorGet(res, errNotFound); return; } else if (err) { errorGet(res, err); return; } // otherwise, success success(res, classes); }); }; module.exports.professorsForClass = function(req, res) { if (req.params && req.params.classid) { Class .findById(req.params.classid) .exec(function(err, dbclass){ if (!dbclass || !dbclass.professors) { errorGet(res, errNotFound); return; } else if (err) { errorGet(res, err); return; } success(res, dbclass.professors); }); } else { errorGet(res, {"message": "No classid in request"}); } };
Return MongoDB data for class and professor requests.
Return MongoDB data for class and professor requests.
JavaScript
mpl-2.0
jdthomas718/ClassRat,jdthomas718/ClassRat
--- +++ @@ -1,15 +1,57 @@ var mongoose = require('mongoose'); var Class = mongoose.model('Class'); +var Prof = mongoose.model('Professor'); var sendJSONresponse = function(res, status, content) { res.status(status); res.json(content); }; +var errNotFound = {"message": "Not found"}; + +var success = function(res, data) { + sendJSONresponse(res, 200, data); +} + +var errorGet = function(res, err) { + sendJSONresponse(res, 404, err); // 404 is standard code for GET error +}; + module.exports.classesGetAll = function(req, res) { - sendJSONresponse(res, 200, {"status": "success"}); + Class + .find() + .exec(function(err, classes){ + // error handling first + if (!classes) { + errorGet(res, errNotFound); + return; + } else if (err) { + errorGet(res, err); + return; + } + + + // otherwise, success + success(res, classes); + }); }; module.exports.professorsForClass = function(req, res) { - sendJSONresponse(res, 200, {"status": "success"}); + if (req.params && req.params.classid) { + Class + .findById(req.params.classid) + .exec(function(err, dbclass){ + if (!dbclass || !dbclass.professors) { + errorGet(res, errNotFound); + return; + } else if (err) { + errorGet(res, err); + return; + } + + success(res, dbclass.professors); + }); + } else { + errorGet(res, {"message": "No classid in request"}); + } };
4853ca160e8d11e536249db120fce4a556be08df
src/data-access/bukovelAdapter.js
src/data-access/bukovelAdapter.js
import cheerio from 'cheerio'; import moment from 'moment-timezone'; const originalTimeZone = 'Europe/Kiev'; const skiLiftDateFormat = 'DD.MM.YYYY HH:mm:ss'; export default function proceed(data) { if (data.error) { return { errors: Object.values(data.error), lifts: [] }; } const cardNumber = data.success; const $ = cheerio.load(data.html); const dataTables = $('table'); const orginalPurchaseDate = dataTables.eq(0).find('#order_info_header_white:nth-child(1) > span').text(); return { cardNumber: cardNumber, purchaseDate: getAdoptedDateString(orginalPurchaseDate), lifts: getLifts(dataTables.eq(1)) }; function getLifts($tableNode) { return $tableNode .find('tr') // skip first row, // because it is table header .slice(1) .map((index, element) => { var columns = $(element).find('td'); return { skiLiftId: $(columns[0]).text(), date: getAdoptedDateString($(columns[1]).text()), initialLift: Number.parseInt($(columns[2]).text()), liftsLeft: Number.parseInt($(columns[3]).text()) } }) .toArray(); } function getAdoptedDateString(date) { return moment.tz(date, skiLiftDateFormat, originalTimeZone).local().format('L LTS'); } }
import cheerio from 'cheerio'; import moment from 'moment-timezone'; const originalTimeZone = 'Europe/Kiev'; const skiLiftDateFormat = 'DD.MM.YYYY HH:mm:ss'; export default function proceed(data) { if (data.error) { return { errors: Object.values(data.error), lifts: [] }; } const cardNumber = data.success; const $ = cheerio.load(data.html); const dataTables = $('table'); const orginalPurchaseDate = dataTables.eq(0).find('#order_info_header_white:nth-child(1) > span').text(); return { cardNumber: cardNumber, purchaseDate: getAdoptedDateString(orginalPurchaseDate), lifts: getLifts(dataTables.eq(1)) }; function getLifts($tableNode) { return $tableNode .find('tr') // skip first row, // because it is table header .slice(1) .map((index, element) => { var columns = $(element).find('td'); return { skiLiftId: columns.eq(0).text(), date: getAdoptedDateString(columns.eq(1).text()), initialLift: Number.parseInt(columns.eq(2).text()), liftsLeft: Number.parseInt(columns.eq(3).text()) } }) .toArray(); } function getAdoptedDateString(date) { return moment.tz(date, skiLiftDateFormat, originalTimeZone).local().format('L LTS'); } }
Use eq function to ge element by index.
Use eq function to ge element by index.
JavaScript
apache-2.0
blobor/buka,blobor/skipass.site,blobor/skipass.site,blobor/buka
--- +++ @@ -34,10 +34,10 @@ var columns = $(element).find('td'); return { - skiLiftId: $(columns[0]).text(), - date: getAdoptedDateString($(columns[1]).text()), - initialLift: Number.parseInt($(columns[2]).text()), - liftsLeft: Number.parseInt($(columns[3]).text()) + skiLiftId: columns.eq(0).text(), + date: getAdoptedDateString(columns.eq(1).text()), + initialLift: Number.parseInt(columns.eq(2).text()), + liftsLeft: Number.parseInt(columns.eq(3).text()) } }) .toArray();
529811b2a3ca5fd1293a31cf9a18d1c4aa2da1a4
app/assets/javascripts/FormMessageController.js
app/assets/javascripts/FormMessageController.js
/** * Created by elisahilprecht on 09/04/15. */ (function(){ var clickOnErrorMessage = function(e) { e.toElement.setAttribute('class','help-inline display-none'); document.getElementById(e.toElement.id.replace('ErrorText','')).focus(); }; var clickOnInputField = function(e){ document.getElementById(e.toElement.id+'ErrorText').setAttribute('class','help-inline display-none'); }; var helpInlines = document.getElementsByClassName('help-inline'); for(var i=0; i<helpInlines.length; i++){ var ele = helpInlines[i]; if(ele.getAttribute('class')==='help-inline'){ ele.onclick = clickOnErrorMessage; } } var inputFields = document.getElementsByTagName('input'); for(var j=0; j<inputFields.length; j++){ ele.onclick = clickOnInputField; } })();
/** * Created by elisahilprecht on 09/04/15. */ (function(){ var clickOnErrorMessage = function(e) { e.toElement.setAttribute('class','help-inline display-none'); document.getElementById(e.toElement.id.replace('ErrorText','')).focus(); }; var clickOnInputField = function(e){ document.getElementById(e.toElement.id+'ErrorText').setAttribute('class','help-inline display-none'); }; var helpInlines = document.getElementsByClassName('help-inline'); for(var i=0; i<helpInlines.length; i++){ var ele = helpInlines[i]; if(ele.getAttribute('class')==='help-inline'){ ele.onclick = clickOnErrorMessage; var inputId = ele.id.replace('ErrorText', ''); var inputValue = document.getElementById(inputId).value; if(inputValue!==undefined && inputValue!==''){ ele.setAttribute('class', 'help-inline help-inline__bottom' ) } } } var inputFields = document.getElementsByTagName('input'); for(var j=0; j<inputFields.length; j++){ ele.onclick = clickOnInputField; } })();
Set error message at the bottom, if input field is filled.
Set error message at the bottom, if input field is filled.
JavaScript
mit
yetu/oauth2-provider,yetu/oauth2-provider,yetu/oauth2-provider,yetu/oauth2-provider
--- +++ @@ -16,6 +16,11 @@ var ele = helpInlines[i]; if(ele.getAttribute('class')==='help-inline'){ ele.onclick = clickOnErrorMessage; + var inputId = ele.id.replace('ErrorText', ''); + var inputValue = document.getElementById(inputId).value; + if(inputValue!==undefined && inputValue!==''){ + ele.setAttribute('class', 'help-inline help-inline__bottom' ) + } } } var inputFields = document.getElementsByTagName('input');
4fcfb59b100274a49f5d0e1690d00f042a919b97
server/routes/webRTC_routes.js
server/routes/webRTC_routes.js
var dbHelpers = require('../database_queries/database_queries.js'); module.exports = function(app){ app.post('/users', function(req, res){ var packet = req.body; if(packet.userId){ console.log('SENDER post event'); dbHelpers.addLink(packet.hash, packet.userId) .then(function(result){ res.status(200); res.send('link added'); }); } else { console.log('RECEIVER post response event'); dbHelpers.addReceiverToSender(packet.hash, packet.recipientId) .then(function(result) { console.log('adding receiverToSender'); dbHelpers.getSenderId(packet.hash) .then(function(result) { res.status(200); res.send(result); }); }); } // TODO: store caller userID, somehow // tie to random link generated }); app.get('/users', function(req, res){ res.status(200); res.send( ); }); // When someone accesses one of the created links, // make a request here for callee to recieve the caller userID };
var dbHelpers = require('../database_queries/database_queries.js'); module.exports = function(app){ app.post('/users', function(req, res){ var packet = req.body; if(packet.userId){ console.log('SENDER post event'); dbHelpers.addLink(packet.hash, packet.userId) .then(function(result){ res.status(201); res.send('link added'); }); } else { console.log('RECEIVER post response event'); dbHelpers.addReceiverToSender(packet.hash, packet.recipientId) .then(function(result) { console.log('adding receiverToSender'); dbHelpers.getSenderId(packet.hash) .then(function(result) { res.status(200); res.send(result); }); }); } // TODO: store caller userID, somehow // tie to random link generated }); app.get('/users', function(req, res){ res.status(200); res.send( ); }); // When someone accesses one of the created links, // make a request here for callee to recieve the caller userID };
Fix post request to send status 201
[fix] Fix post request to send status 201
JavaScript
mit
MAKE-SITY/MKSTream,MAKE-SITY/MKSTream,SimonDing87/MKSTream,SimonDing87/MKSTream
--- +++ @@ -7,7 +7,7 @@ console.log('SENDER post event'); dbHelpers.addLink(packet.hash, packet.userId) .then(function(result){ - res.status(200); + res.status(201); res.send('link added'); }); } else {
7dbb7b7bdf33ed50f6e2a719a32e79a91f031e77
src/_store/AppStateProvider.js
src/_store/AppStateProvider.js
import React, { Children, Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import LoadingView from '../loading-view/LoadingView'; import { appStateSelector } from '../_selectors/AppStateSelectors'; /** * Note: The loading view is tightly coupled with the auto-signin flow of apps, * If we render children before connected === true, auto sign-in will fail */ @connect(appStateSelector) export default class AppStateProvider extends Component { componentWillMount() { this.setState({ timer: window.setTimeout(this.showMessageForSlowConnection.bind(this), 4000) }); } componentWillUnmount() { window.clearTimeout(this.state.timer); } showMessageForSlowConnection() { this.setState({ showMessage: true }); } static propTypes = { children: PropTypes.object.isRequired, connected: PropTypes.bool.isRequired, }; render() { const { connected, children } = this.props; const loadingText = 'Taking too long to load, check connection.'; const showMessage = this.state && this.state.showMessage; const loadingView = <LoadingView showMessage={showMessage} text={loadingText} />; return Children.only(connected ? children : loadingView); } }
import React, { Children, Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import LoadingView from '../loading-view/LoadingView'; import { appStateSelector } from '../_selectors/AppStateSelectors'; /** * Note: The loading view is tightly coupled with the auto-signin flow of apps, * If we render children before connected === true, auto sign-in will fail */ @connect(appStateSelector) export default class AppStateProvider extends Component { componentWillMount() { this.timer = window.setTimeout(this.showMessageForSlowConnection.bind(this), 4000); } componentWillUnmount() { window.clearTimeout(this.timer); } showMessageForSlowConnection() { this.setState({ showMessage: true }); } static propTypes = { children: PropTypes.object.isRequired, connected: PropTypes.bool.isRequired, }; render() { const { connected, children } = this.props; const loadingText = 'Taking too long to load, check connection.'; const showMessage = this.state && this.state.showMessage; const loadingView = <LoadingView showMessage={showMessage} text={loadingText} />; return Children.only(connected ? children : loadingView); } }
Store timer as variable instead of state
Store timer as variable instead of state
JavaScript
mit
binary-com/binary-next-gen,nazaninreihani/binary-next-gen,binary-com/binary-next-gen,qingweibinary/binary-next-gen,nuruddeensalihu/binary-next-gen,nazaninreihani/binary-next-gen,binary-com/binary-next-gen,qingweibinary/binary-next-gen,nuruddeensalihu/binary-next-gen,nazaninreihani/binary-next-gen,nuruddeensalihu/binary-next-gen,qingweibinary/binary-next-gen
--- +++ @@ -11,11 +11,11 @@ export default class AppStateProvider extends Component { componentWillMount() { - this.setState({ timer: window.setTimeout(this.showMessageForSlowConnection.bind(this), 4000) }); + this.timer = window.setTimeout(this.showMessageForSlowConnection.bind(this), 4000); } componentWillUnmount() { - window.clearTimeout(this.state.timer); + window.clearTimeout(this.timer); } showMessageForSlowConnection() {
9af7f30985a280c6b697f552efdb595752ac2b83
test/stripStyle-test.js
test/stripStyle-test.js
import stripStyle from '../src/stripStyle'; describe('stripStyle', () => { it('should ignore `undefined`', () => { expect(stripStyle({a: undefined})).toEqual({a: undefined}); }); });
import stripStyle from '../src/stripStyle'; import spring from '../src/spring'; describe('stripStyle', () => { it('should return spring object into value', () => { expect(stripStyle({a: spring(1, [1, 2])})).toEqual({a: 1}); }); it('should ignore non-configured values', () => { expect(stripStyle({a: 10, b: 0})).toEqual({a: 10, b: 0}); }); it('should ignore `undefined`', () => { expect(stripStyle({a: undefined})).toEqual({a: undefined}); }); });
Add some tests for stripStyle()
Add some tests for stripStyle() While fixing #180, I noticed that stripStyle() was untested, so I decided to add a couple of basic tests here.
JavaScript
mit
bishopZ/react-motion,chenglou/react-motion,BenoitZugmeyer/preact-motion,keyanzhang/react-motion,threepointone/react-motion,keyanzhang/react-motion,threepointone/react-motion,dieface/react-motion,dieface/react-motion,chenglou/react-motion,bishopZ/react-motion,BenoitZugmeyer/preact-motion
--- +++ @@ -1,6 +1,15 @@ import stripStyle from '../src/stripStyle'; +import spring from '../src/spring'; describe('stripStyle', () => { + it('should return spring object into value', () => { + expect(stripStyle({a: spring(1, [1, 2])})).toEqual({a: 1}); + }); + + it('should ignore non-configured values', () => { + expect(stripStyle({a: 10, b: 0})).toEqual({a: 10, b: 0}); + }); + it('should ignore `undefined`', () => { expect(stripStyle({a: undefined})).toEqual({a: undefined}); });
2be2bf5058c3d0fc8d340b851dac267fd8805c47
src/views/Meal.js
src/views/Meal.js
import React from 'react' export default (props) => ( <div> {props.name} </div> )
import React from 'react' export default props => <div> <a target="_blank" href={props.url}> {props.name} </a> </div>
Add url to meal index
Add url to meal index
JavaScript
mit
cernanb/personal-chef-react-app,cernanb/personal-chef-react-app
--- +++ @@ -1,7 +1,8 @@ import React from 'react' -export default (props) => ( +export default props => <div> - {props.name} + <a target="_blank" href={props.url}> + {props.name} + </a> </div> -)
1ad83da4b627cd7e6c33068ee48cc76d6592265e
src/js/lsClient.js
src/js/lsClient.js
/* Copyright 2013 Weswit Srl Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ //////////////// Connect to current host (or localhost) and configure a StatusWidget define(["LightstreamerClient"],function(LightstreamerClient) { var lsClient = new LightstreamerClient(null,"ROOM"); lsClient.connect(); return lsClient; });
/* Copyright 2013 Weswit Srl Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ //////////////// Connect to current host (or localhost) and configure a StatusWidget define(["LightstreamerClient"],function(LightstreamerClient) { var lsClient = new LightstreamerClient(null,"CHATTILE"); lsClient.connect(); return lsClient; });
Change adapter set to CHATTILE
Change adapter set to CHATTILE
JavaScript
apache-2.0
Lightstreamer/Lightstreamer-example-ChatTile-client-javascript,Weswit/Lightstreamer-example-ChatTile-client-javascript,Weswit/Lightstreamer-example-ChatTile-client-javascript,Lightstreamer/Lightstreamer-example-ChatTile-client-javascript
--- +++ @@ -16,7 +16,7 @@ //////////////// Connect to current host (or localhost) and configure a StatusWidget define(["LightstreamerClient"],function(LightstreamerClient) { - var lsClient = new LightstreamerClient(null,"ROOM"); + var lsClient = new LightstreamerClient(null,"CHATTILE"); lsClient.connect(); return lsClient;
dd9d5a3b9d9d6a03f955dfa23e35d8a73d14b611
examples/Trading-GetOrders.js
examples/Trading-GetOrders.js
/** * example ebay API request to Trading:GetOrders */ var ebay = require('../index.js'); ebay.xmlRequest({ serviceName : 'Trading', opType : 'GetOrders', // app/environment devId: '...........', certId: '...........', appName: '...........', sandbox: true, // per user authToken: '...........', params: { 'OrderStatus': 'Active', 'NumberOfDays': 1 } }, function(error, results) { // ... });
/** * example ebay API request to Trading:GetOrders */ var ebay = require('../index.js'); ebay.xmlRequest({ serviceName : 'Trading', opType : 'GetOrders', // app/environment devId: '...........', certId: '...........', appId: '...........', sandbox: true, // per user authToken: '...........', params: { 'OrderStatus': 'Active', 'NumberOfDays': 1 } }, function(error, results) { // ... });
Change appName to appId since appName no longer works
Change appName to appId since appName no longer works I used this example only to find out a few hours later the example code is outdated
JavaScript
mit
benbuckman/nodejs-ebay-api
--- +++ @@ -11,7 +11,7 @@ // app/environment devId: '...........', certId: '...........', - appName: '...........', + appId: '...........', sandbox: true, // per user
980856c30e0f0d63a6235d82b7d04960bec5f741
remove_duplicate_shorter.js
remove_duplicate_shorter.js
function r_d(a) { "use strict"; var b = a.slice(), //copy array i = 0, k = 0, length = b.length, j, buffer = []; //splicing same elements for (i; i < length; i++) { j = 0; for (j; j < length; j++) { if (i < j && b[j] === b[i]) { b.splice(j, 1, "deleted"); } } } //removing "deleted" elements for (k; k < length; k++) { if (b[k] !== "deleted") { buffer.push(b[k]); } } //return reconstructed array return buffer; }
function r_d(a) { "use strict"; var b = a.slice(), //copy array i = 0, k = 0, length = b.length, j, buffer = []; //splicing same elements for (i; i < length; i++) { j = 0; for (j; j < length; j++) { if (i < j && b[j] === b[i]) { b.splice(j, 1, j + " (deleted)"); //added token the "original element + (deleted)" string } } } //removing "deleted" elements for (k; k < length; k++) { if (!b[k].toString().match("(deleted)")) { //if it matches the string "(deleted)" buffer.push(b[k]); } } //return reconstructed array return buffer; }
Update lline 15 and 21
Update lline 15 and 21 It's about the dummy string replacement.
JavaScript
mit
monkeyraptor/remove_duplicates
--- +++ @@ -12,13 +12,13 @@ j = 0; for (j; j < length; j++) { if (i < j && b[j] === b[i]) { - b.splice(j, 1, "deleted"); + b.splice(j, 1, j + " (deleted)"); //added token the "original element + (deleted)" string } } } //removing "deleted" elements for (k; k < length; k++) { - if (b[k] !== "deleted") { + if (!b[k].toString().match("(deleted)")) { //if it matches the string "(deleted)" buffer.push(b[k]); } }
dffda50a1cad5dd6ac8f6c6f0db45b702ac54f5b
src/RunWrappers/DockerCompose.js
src/RunWrappers/DockerCompose.js
var spawn = require('child_process').spawn; function Runner() { } Runner.prototype.init = function(bosco, next) { this.bosco = bosco; next(); }; Runner.prototype.list = function(options, next) { var installed = true; spawn('docker-compose', ['--version'], { stdio: 'ignore' }) .on('error', function() { installed = false; return next(null, []); }).on('exit', function() { if (installed) { return next(null, ['docker-compose']); } }); }; Runner.prototype.stop = function(options, next) { spawn('docker-compose', ['stop'], { cwd: options.cwd, stdio: 'inherit' }).on('exit', next); }; Runner.prototype.start = function(options, next) { spawn('docker-compose', ['up', '-d'], { cwd: options.cwd, stdio: 'inherit' }).on('exit', next); }; module.exports = new Runner();
var spawn = require('child_process').spawn; function Runner() { } Runner.prototype.init = function(bosco, next) { this.bosco = bosco; next(); }; Runner.prototype.list = function(options, next) { var installed = true; spawn('docker-compose', ['--version'], { cwd: options.cwd, stdio: 'ignore' }) .on('error', function() { installed = false; return next(null, []); }).on('exit', function() { if (installed) { return next(null, ['docker-compose']); } }); }; Runner.prototype.stop = function(options, next) { spawn('docker-compose', ['stop'], { cwd: options.cwd, stdio: 'inherit' }).on('exit', next); }; Runner.prototype.start = function(options, next) { spawn('docker-compose', ['up', '-d'], { cwd: options.cwd, stdio: 'inherit' }).on('exit', next); }; module.exports = new Runner();
Add cwd to docker-compose to make it actually work
Add cwd to docker-compose to make it actually work
JavaScript
mit
tes/bosco,tes/bosco
--- +++ @@ -10,7 +10,7 @@ Runner.prototype.list = function(options, next) { var installed = true; - spawn('docker-compose', ['--version'], { stdio: 'ignore' }) + spawn('docker-compose', ['--version'], { cwd: options.cwd, stdio: 'ignore' }) .on('error', function() { installed = false; return next(null, []);
561fae2e6e5786c8e885e0ff9e6ac10ecc606b94
api/models/Event.js
api/models/Event.js
/** * Event.js * * @description :: TODO: You might write a short summary of how this model works and what it represents here. * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { autoWatch: false, autosubscribe: [], attributes: { room: {model: 'room', required: true}, container: {type: 'string', required: true}, card: {type: 'string', required: true}, game: {model: 'game', required: true} }, afterDestroy: function (events, cb) { _.each(events, function(event) { for (var stat in Event.cards[event.card].effect) { if (stat === 'relics') { Event.count({card: {'contains': 'relic'}, game: event.game}) .then(function(numRelics) { sails.log.info('relics remaining: ' + numRelics); if (numRelics == 0) { Game.startHaunt(event.game); } }) .catch(function(err) { sails.log.error(err); }); } } }); cb(); }, cards: sails.config.gameconfig.cards };
/** * Event.js * * @description :: TODO: You might write a short summary of how this model works and what it represents here. * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { autoWatch: false, autosubscribe: [], attributes: { room: {model: 'room', required: true}, container: {type: 'string', required: true}, card: {type: 'string', required: true}, game: {model: 'game', required: true} }, afterDestroy: function (events, cb) { _.each(events, function(event) { for (var stat in Event.cards[event.card].effect) { if (stat === 'relics') { Event.count({card: {'contains': 'relic'}, game: event.game}) .then(function(numRelics) { sails.log.info('relics remaining: ' + numRelics); if (numRelics == 0 && event.game.haunt == undefined) { Game.startHaunt(event.game); } }) .catch(function(err) { sails.log.error(err); }); } } }); cb(); }, cards: sails.config.gameconfig.cards };
Check to make sure haunt hasn't started before starting it.
Check to make sure haunt hasn't started before starting it.
JavaScript
mit
wallaceicy06/Betrayal,wallaceicy06/Betrayal,wallaceicy06/Betrayal
--- +++ @@ -31,7 +31,7 @@ .then(function(numRelics) { sails.log.info('relics remaining: ' + numRelics); - if (numRelics == 0) { + if (numRelics == 0 && event.game.haunt == undefined) { Game.startHaunt(event.game); }
20894c85aea4ea577dd5c5566dd30d7f9acabf8b
server/api/index.js
server/api/index.js
const express = require('express'); const pg = require('pg'); const router = express.Router(); // SSL must be used to connect to the DB const DB_URL = process.env.DATABASE_URL + '?ssl=true'; router.get('/db', (req, res) => { pg.connect(DB_URL, (err, client, done) => { if (err) { console.error(err); return; } client.query('SELECT * FROM test_table', (err, result) => { if (err) { console.error(err); res.send("Error " + err); } else { res.send(result.rows); } }); }); }) module.exports = router;
const express = require('express'); const pg = require('pg'); const router = express.Router(); // SSL must be used to connect to the DB const DB_URL = process.env.DATABASE_URL + '?ssl=true'; // A catch-all error function generateGenericError() { return { title: "Server Error", description: "There was an error while processing your request." }; } // Generates an error for a 404 resource function generateNotFoundError() { return { title: "Not Found", detail: "Resource not found." }; } // Retrieve a list of every `test` resource router.get('/tests', (req, res) => { pg.connect(DB_URL, (err, client, done) => { if (err) { res.send(500, { errors: [generateGenericError()] }); console.error(err); return; } client.query('SELECT * FROM test_table', (err, result) => { if (err) { console.error(err); res.send(500, { errors: [generateGenericError()] }); } else { res.send({ data: result.rows }); } }); }); }); // Return a single `test` resource router.get('/tests/:id', (req, res) => { pg.connect(DB_URL, (err, client, done) => { if (err) { res.send(500, { errors: [generateGenericError()] }); console.error(err); return; } client.query(`SELECT * FROM test_table WHERE id = ${req.params.id}`, (err, result) => { if (err) { console.error(err); res.send(500, { errors: [generateGenericError()] }); } else { if (!result.rows.length) { res.status(404).send({ errors: [generateNotFoundError()] }); } else { res.send({ data: result.rows[0] }); } } }); }); }); module.exports = router;
Add route to retrieve a single test resource
Add route to retrieve a single test resource Also make API a bit more robust
JavaScript
mit
jmeas/moolah,jmeas/moolah,jmeas/finance-app,jmeas/finance-app
--- +++ @@ -6,21 +6,76 @@ // SSL must be used to connect to the DB const DB_URL = process.env.DATABASE_URL + '?ssl=true'; -router.get('/db', (req, res) => { +// A catch-all error +function generateGenericError() { + return { + title: "Server Error", + description: "There was an error while processing your request." + }; +} + +// Generates an error for a 404 resource +function generateNotFoundError() { + return { + title: "Not Found", + detail: "Resource not found." + }; +} + +// Retrieve a list of every `test` resource +router.get('/tests', (req, res) => { pg.connect(DB_URL, (err, client, done) => { if (err) { + res.send(500, { + errors: [generateGenericError()] + }); console.error(err); return; } client.query('SELECT * FROM test_table', (err, result) => { if (err) { console.error(err); - res.send("Error " + err); + res.send(500, { + errors: [generateGenericError()] + }); } else { - res.send(result.rows); + res.send({ + data: result.rows + }); } }); }); -}) +}); + +// Return a single `test` resource +router.get('/tests/:id', (req, res) => { + pg.connect(DB_URL, (err, client, done) => { + if (err) { + res.send(500, { + errors: [generateGenericError()] + }); + console.error(err); + return; + } + client.query(`SELECT * FROM test_table WHERE id = ${req.params.id}`, (err, result) => { + if (err) { + console.error(err); + res.send(500, { + errors: [generateGenericError()] + }); + } else { + if (!result.rows.length) { + res.status(404).send({ + errors: [generateNotFoundError()] + }); + } else { + res.send({ + data: result.rows[0] + }); + } + } + }); + }); +}); module.exports = router;
447a892ba1c6f4b6c6d50a0ca94b041a1eccc3e2
src/comanche.js
src/comanche.js
const Hooter = require('hooter') const EVENTS = [ ['init', 'sync'], ['start', 'sync'], ['execute', 'async'], ['execute.batch', 'async'], ['execute.one', 'async'], ['execute.handle', 'async'], ['error', 'sync'], ] module.exports = function comanche(args, plugins) { let lifecycle = new Hooter() if (!Array.isArray(plugins)) { throw new Error('Plugins must be an array of functions') } EVENTS.forEach(([event, mode]) => { lifecycle.register(event, mode) }) plugins.forEach((plugin) => plugin(lifecycle)) return lifecycle.tootWith('init', (Class) => { if (!Class) { throw new Error( 'No interface has been defined. At least one plugin must define ' + 'an interface during the "init" event' ) } return new Class(...args) }) }
const Hooter = require('hooter') const EVENTS = [ ['init', 'sync'], ['start', 'sync'], ['execute', 'async'], ['execute.batch', 'async'], ['execute.one', 'async'], ['execute.handle', 'async'], ['error', 'sync'], ] module.exports = function comanche(args, plugins) { let lifecycle = new Hooter() if (!Array.isArray(plugins)) { throw new Error('Plugins must be an array of functions') } EVENTS.forEach(([event, mode]) => { lifecycle.register(event, mode) }) plugins.forEach((plugin) => { plugin(lifecycle.bind(plugin)) }) return lifecycle.tootWith('init', (Class) => { if (!Class) { throw new Error( 'No interface has been defined. At least one plugin must define ' + 'an interface during the "init" event' ) } return new Class(...args) }) }
Make every plugin receive a bound version of the lifecycle
Make every plugin receive a bound version of the lifecycle
JavaScript
isc
alex-shnayder/comanche
--- +++ @@ -22,7 +22,9 @@ EVENTS.forEach(([event, mode]) => { lifecycle.register(event, mode) }) - plugins.forEach((plugin) => plugin(lifecycle)) + plugins.forEach((plugin) => { + plugin(lifecycle.bind(plugin)) + }) return lifecycle.tootWith('init', (Class) => { if (!Class) {
26179d2b79fd1eba4a9db10cb4a5ce615f6b6c51
src/vendor/core/dom/isNode.js
src/vendor/core/dom/isNode.js
/** * Copyright 2013-2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isNode * @typechecks */ /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM node. */ function isNode(object) { return !!(object && ( typeof Node !== 'undefined' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string' )); } module.exports = isNode;
/** * Copyright 2013-2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule isNode * @typechecks */ /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM node. */ function isNode(object) { return !!(object && ( typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string' )); } module.exports = isNode;
Test that Node is a function before using instanceof on it
Test that Node is a function before using instanceof on it
JavaScript
bsd-3-clause
S0lahart-AIRpanas-081905220200-Service/react,ArunTesco/react,RReverser/react,skyFi/react,billfeller/react,reggi/react,zigi74/react,pandoraui/react,dmitriiabramov/react,jeromjoy/react,nhunzaker/react,ashwin01/react,it33/react,ZhouYong10/react,tomv564/react,orzyang/react,atom/react,arasmussen/react,eoin/react,jmacman007/react,chippieTV/react,dmatteo/react,lastjune/react,Jericho25/react,rricard/react,quip/react,phillipalexander/react,insionng/react,tom-wang/react,kakadiya91/react,thr0w/react,supriyantomaftuh/react,pletcher/react,blue68/react,pletcher/react,jbonta/react,chippieTV/react,joe-strummer/react,manl1100/react,AlmeroSteyn/react,yabhis/react,ledrui/react,skomski/react,zhangwei900808/react,odysseyscience/React-IE-Alt,rohannair/react,prometheansacrifice/react,isathish/react,jimfb/react,ouyangwenfeng/react,gajus/react,terminatorheart/react,liyayun/react,kolmstead/react,xiaxuewuhen001/react,reggi/react,tarjei/react,stardev24/react,chinakids/react,crsr/react,neusc/react,zyt01/react,mgmcdermott/react,haoxutong/react,speedyGonzales/react,flarnie/react,bruderstein/server-react,zhangwei900808/react,chicoxyzzy/react,jlongster/react,mgmcdermott/react,kevinrobinson/react,mosoft521/react,thr0w/react,jbonta/react,Instrument/react,ashwin01/react,ericyang321/react,jmacman007/react,Jyrno42/react,brian-murray35/react,quip/react,mik01aj/react,krasimir/react,studiowangfei/react,sergej-kucharev/react,mcanthony/react,silkapp/react,evilemon/react,mnordick/react,AlexJeng/react,felixgrey/react,devonharvey/react,reactjs-vn/reactjs_vndev,kay-is/react,tom-wang/react,neusc/react,andreypopp/react,jbonta/react,vincentnacar02/react,dariocravero/react,liyayun/react,lonely8rain/react,DJCordhose/react,yulongge/react,linalu1/react,felixgrey/react,linmic/react,1yvT0s/react,marocchino/react,wuguanghai45/react,zigi74/react,yulongge/react,henrik/react,zhengqiangzi/react,Lonefy/react,guoshencheng/react,trungda/react,PrecursorApp/react,jagdeesh109/react,iOSDevBlog/react,zorojean/react,Furzikov/react,supriyantomaftuh/react,patrickgoudjoako/react,guoshencheng/react,luomiao3/react,ramortegui/react,empyrical/react,zenlambda/react,alwayrun/react,psibi/react,SpencerCDixon/react,gitoneman/react,joshblack/react,BorderTravelerX/react,claudiopro/react,brigand/react,jabhishek/react,genome21/react,PeterWangPo/react,bspaulding/react,gxr1020/react,labs00/react,ashwin01/react,bitshadow/react,dmatteo/react,edvinerikson/react,perterest/react,dirkliu/react,jessebeach/react,btholt/react,carlosipe/react,jameszhan/react,prometheansacrifice/react,wmydz1/react,dortonway/react,jonhester/react,tlwirtz/react,zenlambda/react,1040112370/react,Chiens/react,luomiao3/react,tomocchino/react,carlosipe/react,ABaldwinHunter/react-classic,Datahero/react,acdlite/react,iOSDevBlog/react,tako-black/react-1,shadowhunter2/react,BreemsEmporiumMensToiletriesFragrances/react,arasmussen/react,zenlambda/react,lastjune/react,soulcm/react,levibuzolic/react,OculusVR/react,dmitriiabramov/react,yungsters/react,prometheansacrifice/react,dirkliu/react,gpbl/react,temnoregg/react,mhhegazy/react,prometheansacrifice/react,rgbkrk/react,crsr/react,gpbl/react,easyfmxu/react,Diaosir/react,jmacman007/react,gold3bear/react,laogong5i0/react,ridixcr/react,jasonwebster/react,Instrument/react,zofuthan/react,neusc/react,jeffchan/react,andrerpena/react,btholt/react,joshbedo/react,reactkr/react,sugarshin/react,blainekasten/react,kaushik94/react,roth1002/react,hejld/react,airondumael/react,jontewks/react,dilidili/react,dgreensp/react,james4388/react,wangyzyoga/react,yungsters/react,btholt/react,rickbeerendonk/react,zilaiyedaren/react,hawsome/react,yungsters/react,Jonekee/react,hawsome/react,zs99/react,dgdblank/react,react-china/react-docs,cinic/react,wesbos/react,gfogle/react,1234-/react,miaozhirui/react,it33/react,edmellum/react,rlugojr/react,davidmason/react,pswai/react,mingyaaaa/react,ThinkedCoder/react,panhongzhi02/react,shripadk/react,gold3bear/react,DJCordhose/react,edvinerikson/react,trueadm/react,jsdf/react,ericyang321/react,huanglp47/react,vincentnacar02/react,0x00evil/react,yhagio/react,miaozhirui/react,claudiopro/react,mtsyganov/react,rasj/react,sverrejoh/react,gpazo/react,VioletLife/react,manl1100/react,darobin/react,getshuvo/react,zeke/react,roylee0704/react,ameyms/react,krasimir/react,camsong/react,Rafe/react,jfschwarz/react,mik01aj/react,reactjs-vn/reactjs_vndev,pdaddyo/react,tomocchino/react,mhhegazy/react,guoshencheng/react,salzhrani/react,conorhastings/react,jameszhan/react,jkcaptain/react,hejld/react,lennerd/react,atom/react,neomadara/react,lhausermann/react,dgdblank/react,alvarojoao/react,getshuvo/react,jbonta/react,camsong/react,jonhester/react,prathamesh-sonpatki/react,zyt01/react,ljhsai/react,zhangwei001/react,AlexJeng/react,wushuyi/react,savelichalex/react,skevy/react,chrisjallen/react,honger05/react,honger05/react,nhunzaker/react,mik01aj/react,lyip1992/react,jiangzhixiao/react,VukDukic/react,JungMinu/react,qq316278987/react,silppuri/react,inuscript/react,ms-carterk/react,TylerBrock/react,hzoo/react,JoshKaufman/react,reggi/react,tywinstark/react,restlessdesign/react,ajdinhedzic/react,jagdeesh109/react,rwwarren/react,mardigtch/react,yabhis/react,atom/react,felixgrey/react,ledrui/react,perterest/react,nsimmons/react,jorrit/react,gleborgne/react,roth1002/react,pswai/react,mohitbhatia1994/react,haoxutong/react,richiethomas/react,spt110/react,Flip120/react,lhausermann/react,getshuvo/react,aaron-goshine/react,agideo/react,magalhas/react,henrik/react,arasmussen/react,orneryhippo/react,gregrperkins/react,varunparkhe/react,songawee/react,wjb12/react,zenlambda/react,roylee0704/react,brigand/react,jzmq/react,pletcher/react,gitoneman/react,MotherNature/react,TheBlasfem/react,dgreensp/react,studiowangfei/react,diegobdev/react,evilemon/react,trellowebinars/react,wzpan/react,vjeux/react,kaushik94/react,iamchenxin/react,concerned3rdparty/react,yasaricli/react,patryknowak/react,cody/react,cpojer/react,songawee/react,jorrit/react,jameszhan/react,pyitphyoaung/react,maxschmeling/react,deepaksharmacse12/react,negativetwelve/react,spt110/react,PrecursorApp/react,pwmckenna/react,luomiao3/react,niole/react,lyip1992/react,OculusVR/react,yasaricli/react,gj262/react,diegobdev/react,salier/react,wangyzyoga/react,jagdeesh109/react,jlongster/react,anushreesubramani/react,jedwards1211/react,howtolearntocode/react,react-china/react-docs,camsong/react,stevemao/react,chicoxyzzy/react,dmatteo/react,laskos/react,qq316278987/react,devonharvey/react,benchling/react,terminatorheart/react,dittos/react,jzmq/react,silppuri/react,chrisbolin/react,joshbedo/react,JoshKaufman/react,panhongzhi02/react,mtsyganov/react,szhigunov/react,dmitriiabramov/react,hzoo/react,thr0w/react,skevy/react,jameszhan/react,gj262/react,AnSavvides/react,gleborgne/react,rickbeerendonk/react,odysseyscience/React-IE-Alt,joe-strummer/react,ssyang0102/react,cody/react,iamdoron/react,michaelchum/react,devonharvey/react,stardev24/react,ninjaofawesome/reaction,alvarojoao/react,levibuzolic/react,wmydz1/react,blainekasten/react,dustin-H/react,jameszhan/react,popovsh6/react,perterest/react,Datahero/react,orzyang/react,kevinrobinson/react,KevinTCoughlin/react,neusc/react,deepaksharmacse12/react,jmacman007/react,yjyi/react,felixgrey/react,tako-black/react-1,zhengqiangzi/react,mcanthony/react,apaatsio/react,alwayrun/react,zs99/react,dgladkov/react,roth1002/react,zeke/react,niubaba63/react,bhamodi/react,ouyangwenfeng/react,gxr1020/react,btholt/react,lonely8rain/react,silkapp/react,ericyang321/react,devonharvey/react,chrisbolin/react,silvestrijonathan/react,temnoregg/react,S0lahart-AIRpanas-081905220200-Service/react,lennerd/react,Spotinux/react,TaaKey/react,ManrajGrover/react,joshbedo/react,ABaldwinHunter/react-classic,ridixcr/react,airondumael/react,ipmobiletech/react,nomanisan/react,dariocravero/react,mcanthony/react,gajus/react,ZhouYong10/react,dittos/react,chrisjallen/react,isathish/react,AmericanSundown/react,jorrit/react,gpbl/react,levibuzolic/react,ianb/react,jbonta/react,jmptrader/react,dilidili/react,sebmarkbage/react,quip/react,alexanther1012/react,hzoo/react,brian-murray35/react,cmfcmf/react,ManrajGrover/react,mik01aj/react,haoxutong/react,cody/react,IndraVikas/react,rricard/react,linalu1/react,pze/react,chippieTV/react,react-china/react-docs,DJCordhose/react,linalu1/react,STRML/react,dgreensp/react,krasimir/react,insionng/react,cmfcmf/react,michaelchum/react,ZhouYong10/react,laskos/react,dariocravero/react,Furzikov/react,zhangwei001/react,greyhwndz/react,albulescu/react,facebook/react,dustin-H/react,dittos/react,rickbeerendonk/react,mjackson/react,diegobdev/react,mosoft521/react,isathish/react,patrickgoudjoako/react,albulescu/react,JungMinu/react,ropik/react,sekiyaeiji/react,hzoo/react,zeke/react,k-cheng/react,joecritch/react,hejld/react,jquense/react,insionng/react,bspaulding/react,billfeller/react,vipulnsward/react,maxschmeling/react,kevin0307/react,obimod/react,ms-carterk/react,wesbos/react,airondumael/react,musofan/react,acdlite/react,kamilio/react,ajdinhedzic/react,eoin/react,tlwirtz/react,JasonZook/react,savelichalex/react,10fish/react,vikbert/react,yasaricli/react,AlexJeng/react,wmydz1/react,salier/react,shripadk/react,krasimir/react,tywinstark/react,billfeller/react,pyitphyoaung/react,yulongge/react,Lonefy/react,mfunkie/react,yut148/react,pswai/react,TaaKey/react,sarvex/react,shripadk/react,VukDukic/react,with-git/react,trungda/react,jmptrader/react,marocchino/react,stardev24/react,ridixcr/react,leohmoraes/react,lina/react,venkateshdaram434/react,kevinrobinson/react,mjackson/react,yuhualingfeng/react,Instrument/react,psibi/react,kamilio/react,yungsters/react,Flip120/react,rricard/react,spt110/react,angeliaz/react,TaaKey/react,DJCordhose/react,varunparkhe/react,bhamodi/react,billfeller/react,scottburch/react,joshblack/react,S0lahart-AIRpanas-081905220200-Service/react,glenjamin/react,angeliaz/react,slongwang/react,jzmq/react,yangshun/react,willhackett/react,zhangwei900808/react,blainekasten/react,tomocchino/react,tlwirtz/react,davidmason/react,pandoraui/react,tom-wang/react,PrecursorApp/react,jedwards1211/react,sarvex/react,stanleycyang/react,zyt01/react,Simek/react,AmericanSundown/react,silvestrijonathan/react,rricard/react,mgmcdermott/react,prathamesh-sonpatki/react,STRML/react,chinakids/react,ledrui/react,mjul/react,trungda/react,mjackson/react,8398a7/react,ajdinhedzic/react,misnet/react,theseyi/react,varunparkhe/react,reactjs-vn/reactjs_vndev,restlessdesign/react,Diaosir/react,elquatro/react,aickin/react,Jericho25/react,jordanpapaleo/react,chrisbolin/react,lonely8rain/react,salzhrani/react,kamilio/react,insionng/react,roth1002/react,usgoodus/react,Lonefy/react,KevinTCoughlin/react,mosoft521/react,JanChw/react,ashwin01/react,algolia/react,dfosco/react,quip/react,yut148/react,wmydz1/react,claudiopro/react,pze/react,Nieralyte/react,pandoraui/react,blue68/react,microlv/react,xiaxuewuhen001/react,afc163/react,jiangzhixiao/react,niubaba63/react,miaozhirui/react,VioletLife/react,edvinerikson/react,iamchenxin/react,shergin/react,spicyj/react,vjeux/react,haoxutong/react,niubaba63/react,lhausermann/react,kevinrobinson/react,Instrument/react,sarvex/react,btholt/react,inuscript/react,free-memory/react,deepaksharmacse12/react,stanleycyang/react,thomasboyt/react,lyip1992/react,miaozhirui/react,aaron-goshine/react,yisbug/react,ABaldwinHunter/react-classic,STRML/react,yongxu/react,MoOx/react,ropik/react,jakeboone02/react,elquatro/react,hawsome/react,andrerpena/react,empyrical/react,iamchenxin/react,kamilio/react,kevinrobinson/react,Zeboch/react-tap-event-plugin,mfunkie/react,zyt01/react,magalhas/react,brillantesmanuel/react,ninjaofawesome/reaction,reactkr/react,mardigtch/react,joshbedo/react,andrescarceller/react,popovsh6/react,neusc/react,richiethomas/react,jquense/react,nickdima/react,darobin/react,k-cheng/react,chicoxyzzy/react,zhangwei001/react,Furzikov/react,cmfcmf/react,ABaldwinHunter/react-engines,lhausermann/react,rickbeerendonk/react,yut148/react,lastjune/react,yangshun/react,pdaddyo/react,prathamesh-sonpatki/react,thr0w/react,arkist/react,aickin/react,gpazo/react,musofan/react,kalloc/react,JoshKaufman/react,brillantesmanuel/react,tomocchino/react,flipactual/react,kolmstead/react,tlwirtz/react,nickpresta/react,javascriptit/react,maxschmeling/react,zenlambda/react,Riokai/react,silkapp/react,Chiens/react,elquatro/react,maxschmeling/react,obimod/react,AnSavvides/react,christer155/react,AlmeroSteyn/react,richiethomas/react,chacbumbum/react,iammerrick/react,obimod/react,obimod/react,tako-black/react-1,wzpan/react,mcanthony/react,musofan/react,trellowebinars/react,facebook/react,framp/react,kchia/react,billfeller/react,apaatsio/react,theseyi/react,syranide/react,tjsavage/react,willhackett/react,aickin/react,theseyi/react,roylee0704/react,staltz/react,gregrperkins/react,jasonwebster/react,psibi/react,zofuthan/react,digideskio/react,greysign/react,honger05/react,staltz/react,sejoker/react,elquatro/react,varunparkhe/react,tako-black/react-1,joon1030/react,niole/react,agideo/react,benjaffe/react,ThinkedCoder/react,ssyang0102/react,nhunzaker/react,vikbert/react,joaomilho/react,gitoneman/react,billfeller/react,arkist/react,lyip1992/react,negativetwelve/react,VukDukic/react,sugarshin/react,skevy/react,jkcaptain/react,yisbug/react,mtsyganov/react,chinakids/react,richiethomas/react,songawee/react,0x00evil/react,iamdoron/react,aaron-goshine/react,niubaba63/react,orzyang/react,ThinkedCoder/react,rwwarren/react,patrickgoudjoako/react,leeleo26/react,pdaddyo/react,rickbeerendonk/react,dgdblank/react,PeterWangPo/react,slongwang/react,Jyrno42/react,Datahero/react,brigand/react,MotherNature/react,salier/react,MotherNature/react,nLight/react,huanglp47/react,zanjs/react,apaatsio/react,haoxutong/react,empyrical/react,microlv/react,Galactix/react,jdlehman/react,musofan/react,jbonta/react,greglittlefield-wf/react,joe-strummer/react,jmptrader/react,livepanzo/react,mosoft521/react,sejoker/react,BreemsEmporiumMensToiletriesFragrances/react,davidmason/react,TheBlasfem/react,dgladkov/react,gxr1020/react,rlugojr/react,jmacman007/react,dmitriiabramov/react,ashwin01/react,bhamodi/react,zofuthan/react,krasimir/react,trellowebinars/react,andrerpena/react,guoshencheng/react,JoshKaufman/react,sejoker/react,reactkr/react,k-cheng/react,yangshun/react,qq316278987/react,andrescarceller/react,silkapp/react,andrewsokolov/react,dustin-H/react,jimfb/react,jeffchan/react,niole/react,1040112370/react,marocchino/react,Duc-Ngo-CSSE/react,ninjaofawesome/reaction,dariocravero/react,dgreensp/react,gougouGet/react,ericyang321/react,sejoker/react,wuguanghai45/react,bhamodi/react,yungsters/react,S0lahart-AIRpanas-081905220200-Service/react,panhongzhi02/react,hawsome/react,ning-github/react,kay-is/react,IndraVikas/react,6feetsong/react,jimfb/react,yisbug/react,mnordick/react,Jericho25/react,brigand/react,tom-wang/react,gold3bear/react,kamilio/react,easyfmxu/react,trueadm/react,nLight/react,vincentism/react,spicyj/react,inuscript/react,iOSDevBlog/react,silppuri/react,pletcher/react,kalloc/react,cmfcmf/react,Flip120/react,microlv/react,devonharvey/react,conorhastings/react,magalhas/react,vipulnsward/react,slongwang/react,Simek/react,linmic/react,joaomilho/react,manl1100/react,JasonZook/react,dgreensp/react,thomasboyt/react,pod4g/react,tlwirtz/react,rasj/react,ning-github/react,dirkliu/react,wudouxingjun/react,ridixcr/react,livepanzo/react,dfosco/react,flarnie/react,gregrperkins/react,yuhualingfeng/react,ilyachenko/react,jquense/react,kakadiya91/react,misnet/react,jontewks/react,linmic/react,greglittlefield-wf/react,wjb12/react,JanChw/react,jonhester/react,bitshadow/react,algolia/react,orneryhippo/react,sitexa/react,andrewsokolov/react,zs99/react,odysseyscience/React-IE-Alt,gajus/react,lennerd/react,jordanpapaleo/react,8398a7/react,LoQIStar/react,vipulnsward/react,acdlite/react,negativetwelve/react,dortonway/react,AlmeroSteyn/react,mfunkie/react,framp/react,huanglp47/react,chacbumbum/react,hejld/react,zorojean/react,rlugojr/react,DJCordhose/react,devonharvey/react,sverrejoh/react,jzmq/react,RReverser/react,acdlite/react,dortonway/react,niole/react,yhagio/react,hzoo/react,claudiopro/react,musofan/react,with-git/react,dgladkov/react,iamdoron/react,mosoft521/react,ms-carterk/react,STRML/react,JoshKaufman/react,lonely8rain/react,chacbumbum/react,garbles/react,zyt01/react,trueadm/react,0x00evil/react,SpencerCDixon/react,billfeller/react,0x00evil/react,tom-wang/react,james4388/react,mnordick/react,pod4g/react,framp/react,ramortegui/react,MichelleTodd/react,benjaffe/react,pwmckenna/react,sverrejoh/react,spt110/react,it33/react,ilyachenko/react,wesbos/react,rohannair/react,niole/react,stanleycyang/react,haoxutong/react,jsdf/react,Duc-Ngo-CSSE/react,tjsavage/react,sitexa/react,yuhualingfeng/react,yabhis/react,digideskio/react,cody/react,Simek/react,felixgrey/react,jabhishek/react,sasumi/react,concerned3rdparty/react,lucius-feng/react,Zeboch/react-tap-event-plugin,yasaricli/react,cpojer/react,angeliaz/react,JoshKaufman/react,dilidili/react,TheBlasfem/react,AnSavvides/react,wushuyi/react,chenglou/react,jordanpapaleo/react,chrismoulton/react,jessebeach/react,iammerrick/react,pswai/react,nickdima/react,iamdoron/react,mgmcdermott/react,vincentism/react,mhhegazy/react,AlexJeng/react,vjeux/react,dittos/react,wmydz1/react,joe-strummer/react,prathamesh-sonpatki/react,staltz/react,Jericho25/react,rricard/react,with-git/react,TylerBrock/react,tomocchino/react,silvestrijonathan/react,demohi/react,alvarojoao/react,jakeboone02/react,chenglou/react,howtolearntocode/react,bhamodi/react,mhhegazy/react,reactjs-vn/reactjs_vndev,sugarshin/react,greysign/react,aaron-goshine/react,jeffchan/react,skomski/react,eoin/react,sdiaz/react,pyitphyoaung/react,sergej-kucharev/react,TaaKey/react,neomadara/react,AnSavvides/react,perperyu/react,roth1002/react,TaaKey/react,zeke/react,iammerrick/react,gj262/react,edvinerikson/react,ms-carterk/react,niubaba63/react,pyitphyoaung/react,sasumi/react,JasonZook/react,greyhwndz/react,jimfb/react,ropik/react,TylerBrock/react,spt110/react,terminatorheart/react,andreypopp/react,liyayun/react,IndraVikas/react,prathamesh-sonpatki/react,mjul/react,ArunTesco/react,wzpan/react,dilidili/react,pod4g/react,genome21/react,bitshadow/react,levibuzolic/react,concerned3rdparty/react,zigi74/react,benchling/react,bestwpw/react,nickpresta/react,phillipalexander/react,kakadiya91/react,jsdf/react,marocchino/react,christer155/react,yongxu/react,wushuyi/react,jsdf/react,rlugojr/react,livepanzo/react,krasimir/react,ameyms/react,tzq668766/react,maxschmeling/react,ridixcr/react,pze/react,gajus/react,misnet/react,stevemao/react,reactkr/react,spt110/react,laogong5i0/react,andreypopp/react,Riokai/react,gfogle/react,nLight/react,chrisjallen/react,flarnie/react,linqingyicen/react,sasumi/react,jontewks/react,zenlambda/react,dortonway/react,MoOx/react,wudouxingjun/react,tako-black/react-1,free-memory/react,ljhsai/react,nLight/react,kalloc/react,trueadm/react,greglittlefield-wf/react,mingyaaaa/react,yiminghe/react,MichelleTodd/react,alvarojoao/react,AlmeroSteyn/react,magalhas/react,reggi/react,leohmoraes/react,jquense/react,dittos/react,sdiaz/react,dariocravero/react,zorojean/react,arasmussen/react,leexiaosi/react,thomasboyt/react,AmericanSundown/react,genome21/react,jfschwarz/react,zofuthan/react,isathish/react,digideskio/react,OculusVR/react,marocchino/react,scottburch/react,sejoker/react,laskos/react,kaushik94/react,Jonekee/react,bspaulding/react,cmfcmf/react,nickdima/react,AnSavvides/react,panhongzhi02/react,patryknowak/react,kaushik94/react,skevy/react,chrismoulton/react,bestwpw/react,ljhsai/react,andreypopp/react,crsr/react,cpojer/react,rgbkrk/react,quip/react,edmellum/react,VukDukic/react,yuhualingfeng/react,reactkr/react,ropik/react,RReverser/react,chrisjallen/react,TheBlasfem/react,chenglou/react,IndraVikas/react,flarnie/react,microlv/react,chippieTV/react,lastjune/react,vincentism/react,lonely8rain/react,negativetwelve/react,jimfb/react,glenjamin/react,brigand/react,SpencerCDixon/react,agileurbanite/react,kakadiya91/react,dustin-H/react,sarvex/react,trellowebinars/react,flipactual/react,slongwang/react,mingyaaaa/react,afc163/react,Instrument/react,silvestrijonathan/react,labs00/react,AmericanSundown/react,vincentnacar02/react,concerned3rdparty/react,ThinkedCoder/react,tarjei/react,salzhrani/react,Flip120/react,tywinstark/react,popovsh6/react,ZhouYong10/react,dgreensp/react,darobin/react,aaron-goshine/react,sverrejoh/react,it33/react,pwmckenna/react,sebmarkbage/react,arkist/react,glenjamin/react,dortonway/react,bestwpw/react,digideskio/react,yiminghe/react,zigi74/react,kieranjones/react,nickpresta/react,levibuzolic/react,laskos/react,gpazo/react,nLight/react,iOSDevBlog/react,rgbkrk/react,yangshun/react,juliocanares/react,STRML/react,Simek/react,Nieralyte/react,Rafe/react,javascriptit/react,ABaldwinHunter/react-engines,pyitphyoaung/react,sebmarkbage/react,linqingyicen/react,tomv564/react,ridixcr/react,spicyj/react,pandoraui/react,claudiopro/react,mcanthony/react,andrerpena/react,phillipalexander/react,wjb12/react,nathanmarks/react,savelichalex/react,dmitriiabramov/react,sekiyaeiji/react,mosoft521/react,tako-black/react-1,mtsyganov/react,jakeboone02/react,1234-/react,bspaulding/react,rickbeerendonk/react,ropik/react,panhongzhi02/react,perterest/react,kamilio/react,yasaricli/react,chenglou/react,trueadm/react,camsong/react,arkist/react,elquatro/react,insionng/react,soulcm/react,Rafe/react,glenjamin/react,sarvex/react,JanChw/react,sasumi/react,VukDukic/react,Spotinux/react,gougouGet/react,chippieTV/react,chrismoulton/react,agileurbanite/react,bleyle/react,leohmoraes/react,microlv/react,rasj/react,yongxu/react,theseyi/react,Riokai/react,andrescarceller/react,agileurbanite/react,honger05/react,zigi74/react,eoin/react,perterest/react,yangshun/react,jlongster/react,jeffchan/react,hejld/react,brigand/react,leohmoraes/react,tarjei/react,usgoodus/react,yulongge/react,staltz/react,pze/react,cinic/react,restlessdesign/react,nhunzaker/react,panhongzhi02/react,rlugojr/react,trueadm/react,miaozhirui/react,Diaosir/react,TheBlasfem/react,evilemon/react,andreypopp/react,kchia/react,cesine/react,PeterWangPo/react,yiminghe/react,jessebeach/react,dfosco/react,zorojean/react,dariocravero/react,empyrical/react,gajus/react,ABaldwinHunter/react-engines,gajus/react,dittos/react,shadowhunter2/react,facebook/react,alvarojoao/react,rlugojr/react,jdlehman/react,gfogle/react,jfschwarz/react,jzmq/react,magalhas/react,DJCordhose/react,dustin-H/react,stanleycyang/react,flipactual/react,aickin/react,jeffchan/react,neusc/react,jfschwarz/react,soulcm/react,Rafe/react,greysign/react,zanjs/react,shergin/react,venkateshdaram434/react,ninjaofawesome/reaction,zs99/react,james4388/react,mhhegazy/react,salier/react,jameszhan/react,MichelleTodd/react,leexiaosi/react,edmellum/react,digideskio/react,deepaksharmacse12/react,vincentism/react,stardev24/react,quip/react,ianb/react,1040112370/react,facebook/react,ABaldwinHunter/react-classic,jzmq/react,chicoxyzzy/react,rohannair/react,howtolearntocode/react,prometheansacrifice/react,jordanpapaleo/react,jmptrader/react,shripadk/react,angeliaz/react,rwwarren/react,10fish/react,Riokai/react,lina/react,ms-carterk/react,dmitriiabramov/react,conorhastings/react,yiminghe/react,ipmobiletech/react,OculusVR/react,honger05/react,jedwards1211/react,syranide/react,chicoxyzzy/react,scottburch/react,iOSDevBlog/react,arush/react,zigi74/react,temnoregg/react,tomv564/react,richiethomas/react,AlmeroSteyn/react,ericyang321/react,edmellum/react,blainekasten/react,tywinstark/react,dustin-H/react,richiethomas/react,lennerd/react,garbles/react,thomasboyt/react,yangshun/react,with-git/react,prometheansacrifice/react,mik01aj/react,MichelleTodd/react,theseyi/react,nathanmarks/react,chacbumbum/react,jquense/react,wudouxingjun/react,wuguanghai45/react,manl1100/react,scottburch/react,ms-carterk/react,bspaulding/react,garbles/react,gitignorance/react,syranide/react,anushreesubramani/react,garbles/react,reactkr/react,arkist/react,lyip1992/react,Spotinux/react,sugarshin/react,nickdima/react,zilaiyedaren/react,glenjamin/react,1234-/react,jedwards1211/react,bitshadow/react,gpazo/react,brillantesmanuel/react,OculusVR/react,PrecursorApp/react,linqingyicen/react,1234-/react,iamdoron/react,linmic/react,jakeboone02/react,k-cheng/react,kaushik94/react,VioletLife/react,patrickgoudjoako/react,terminatorheart/react,jagdeesh109/react,yisbug/react,michaelchum/react,jeffchan/react,skevy/react,jessebeach/react,ramortegui/react,nathanmarks/react,speedyGonzales/react,huanglp47/react,BreemsEmporiumMensToiletriesFragrances/react,Chiens/react,zs99/react,stardev24/react,acdlite/react,bruderstein/server-react,Rafe/react,vikbert/react,Jyrno42/react,ABaldwinHunter/react-engines,joshblack/react,IndraVikas/react,mjackson/react,apaatsio/react,nomanisan/react,cpojer/react,airondumael/react,Jyrno42/react,stanleycyang/react,roylee0704/react,conorhastings/react,gfogle/react,benjaffe/react,alvarojoao/react,trellowebinars/react,VioletLife/react,glenjamin/react,szhigunov/react,gold3bear/react,concerned3rdparty/react,nhunzaker/react,jorrit/react,camsong/react,anushreesubramani/react,MichelleTodd/react,hawsome/react,yut148/react,10fish/react,JasonZook/react,ameyms/react,lonely8rain/react,wjb12/react,ABaldwinHunter/react-classic,RReverser/react,gold3bear/react,leexiaosi/react,shergin/react,roylee0704/react,levibuzolic/react,guoshencheng/react,restlessdesign/react,sebmarkbage/react,KevinTCoughlin/react,arkist/react,brigand/react,mhhegazy/react,DigitalCoder/react,jonhester/react,jquense/react,brian-murray35/react,pletcher/react,Jericho25/react,orneryhippo/react,yisbug/react,negativetwelve/react,patrickgoudjoako/react,jimfb/react,jontewks/react,mcanthony/react,brillantesmanuel/react,edvinerikson/react,easyfmxu/react,rohannair/react,1234-/react,benchling/react,joe-strummer/react,afc163/react,rickbeerendonk/react,davidmason/react,zs99/react,willhackett/react,ABaldwinHunter/react-classic,marocchino/react,Spotinux/react,kieranjones/react,iamchenxin/react,afc163/react,jdlehman/react,jlongster/react,odysseyscience/React-IE-Alt,agideo/react,benchling/react,nickpresta/react,ericyang321/react,airondumael/react,lhausermann/react,Furzikov/react,jeromjoy/react,conorhastings/react,vipulnsward/react,jontewks/react,yangshun/react,dgdblank/react,jessebeach/react,pwmckenna/react,reactjs-vn/reactjs_vndev,bitshadow/react,iamchenxin/react,rlugojr/react,VioletLife/react,bruderstein/server-react,venkateshdaram434/react,dfosco/react,KevinTCoughlin/react,juliocanares/react,jedwards1211/react,nickpresta/react,gpazo/react,huanglp47/react,leohmoraes/react,easyfmxu/react,skomski/react,tzq668766/react,anushreesubramani/react,ropik/react,flowbywind/react,atom/react,zhengqiangzi/react,andrerpena/react,kolmstead/react,arush/react,jasonwebster/react,orneryhippo/react,howtolearntocode/react,usgoodus/react,garbles/react,sasumi/react,TaaKey/react,reggi/react,mjackson/react,MotherNature/react,sekiyaeiji/react,leeleo26/react,wmydz1/react,it33/react,nhunzaker/react,bhamodi/react,orneryhippo/react,andrerpena/react,ZhouYong10/react,mjackson/react,mjul/react,MoOx/react,silkapp/react,Flip120/react,xiaxuewuhen001/react,afc163/react,skyFi/react,gpbl/react,apaatsio/react,ThinkedCoder/react,algolia/react,jlongster/react,labs00/react,chippieTV/react,alexanther1012/react,TaaKey/react,DigitalCoder/react,joon1030/react,mjul/react,zhangwei001/react,arasmussen/react,terminatorheart/react,jdlehman/react,shripadk/react,AlmeroSteyn/react,BreemsEmporiumMensToiletriesFragrances/react,studiowangfei/react,cpojer/react,joon1030/react,gfogle/react,sverrejoh/react,zhangwei001/react,magalhas/react,Simek/react,bruderstein/server-react,howtolearntocode/react,christer155/react,flarnie/react,chicoxyzzy/react,dfosco/react,concerned3rdparty/react,thomasboyt/react,blainekasten/react,bruderstein/server-react,stevemao/react,krasimir/react,stanleycyang/react,sdiaz/react,Lonefy/react,hawsome/react,ZhouYong10/react,psibi/react,kieranjones/react,gregrperkins/react,mosoft521/react,rohannair/react,gpbl/react,kolmstead/react,odysseyscience/React-IE-Alt,wmydz1/react,apaatsio/react,dgdblank/react,pyitphyoaung/react,Diaosir/react,brillantesmanuel/react,demohi/react,supriyantomaftuh/react,kakadiya91/react,kevin0307/react,yiminghe/react,james4388/react,jabhishek/react,1040112370/react,trungda/react,ramortegui/react,Furzikov/react,free-memory/react,jagdeesh109/react,joaomilho/react,vipulnsward/react,bspaulding/react,tomocchino/react,rohannair/react,alexanther1012/react,nhunzaker/react,0x00evil/react,pandoraui/react,manl1100/react,usgoodus/react,ning-github/react,gregrperkins/react,thomasboyt/react,livepanzo/react,zorojean/react,10fish/react,pdaddyo/react,iammerrick/react,kolmstead/react,yulongge/react,tarjei/react,Nieralyte/react,aickin/react,nickpresta/react,facebook/react,silvestrijonathan/react,guoshencheng/react,react-china/react-docs,andrescarceller/react,0x00evil/react,MotherNature/react,kchia/react,jorrit/react,wushuyi/react,zorojean/react,STRML/react,gitignorance/react,howtolearntocode/react,mgmcdermott/react,tjsavage/react,dmatteo/react,crsr/react,kakadiya91/react,Riokai/react,with-git/react,MoOx/react,theseyi/react,prometheansacrifice/react,jmptrader/react,anushreesubramani/react,jdlehman/react,1040112370/react,ManrajGrover/react,tomv564/react,slongwang/react,linqingyicen/react,andrewsokolov/react,laogong5i0/react,tzq668766/react,ashwin01/react,dilidili/react,gitignorance/react,MichelleTodd/react,chenglou/react,laogong5i0/react,chrisjallen/react,sitexa/react,terminatorheart/react,silvestrijonathan/react,stardev24/react,pswai/react,staltz/react,niubaba63/react,sergej-kucharev/react,miaozhirui/react,lhausermann/react,cmfcmf/react,Simek/react,dirkliu/react,ABaldwinHunter/react-engines,angeliaz/react,qq316278987/react,VioletLife/react,PrecursorApp/react,jsdf/react,ramortegui/react,jasonwebster/react,anushreesubramani/react,patryknowak/react,JungMinu/react,songawee/react,empyrical/react,lina/react,yjyi/react,1040112370/react,Spotinux/react,tywinstark/react,psibi/react,andrescarceller/react,aickin/react,mfunkie/react,dgdblank/react,demohi/react,ipmobiletech/react,roylee0704/react,javascriptit/react,easyfmxu/react,jmacman007/react,TaaKey/react,acdlite/react,spicyj/react,ledrui/react,rohannair/react,chicoxyzzy/react,perperyu/react,kchia/react,dirkliu/react,orneryhippo/react,jedwards1211/react,iamchenxin/react,kevin0307/react,cody/react,quip/react,qq316278987/react,anushreesubramani/react,zofuthan/react,conorhastings/react,supriyantomaftuh/react,jfschwarz/react,tom-wang/react,shergin/react,wjb12/react,vikbert/react,joecritch/react,yongxu/react,elquatro/react,lyip1992/react,AlexJeng/react,carlosipe/react,Duc-Ngo-CSSE/react,flowbywind/react,gxr1020/react,nathanmarks/react,usgoodus/react,blainekasten/react,glenjamin/react,garbles/react,iammerrick/react,jlongster/react,mingyaaaa/react,yuhualingfeng/react,ameyms/react,shergin/react,AlmeroSteyn/react,zyt01/react,Diaosir/react,vikbert/react,cpojer/react,cesine/react,Riokai/react,supriyantomaftuh/react,rgbkrk/react,mohitbhatia1994/react,crsr/react,syranide/react,gleborgne/react,vjeux/react,christer155/react,yhagio/react,prathamesh-sonpatki/react,jorrit/react,niubaba63/react,microlv/react,jeromjoy/react,framp/react,TaaKey/react,nLight/react,salzhrani/react,chenglou/react,6feetsong/react,BorderTravelerX/react,zilaiyedaren/react,alwayrun/react,albulescu/react,1yvT0s/react,yiminghe/react,joaomilho/react,MoOx/react,zeke/react,mgmcdermott/react,benchling/react,Galactix/react,cesine/react,thr0w/react,wushuyi/react,easyfmxu/react,Jonekee/react,Galactix/react,chenglou/react,thr0w/react,cinic/react,trungda/react,jsdf/react,iOSDevBlog/react,ledrui/react,ameyms/react,empyrical/react,qq316278987/react,jonhester/react,jordanpapaleo/react,VioletLife/react,lucius-feng/react,trellowebinars/react,zhangwei001/react,davidmason/react,shadowhunter2/react,pswai/react,james4388/react,yisbug/react,claudiopro/react,restlessdesign/react,yongxu/react,dilidili/react,ABaldwinHunter/react-engines,neomadara/react,patrickgoudjoako/react,AnSavvides/react,eoin/react,savelichalex/react,Spotinux/react,laskos/react,arush/react,1yvT0s/react,AlexJeng/react,jdlehman/react,shripadk/react,joe-strummer/react,yut148/react,dilidili/react,dortonway/react,obimod/react,nomanisan/react,mhhegazy/react,edvinerikson/react,yiminghe/react,vincentism/react,camsong/react,linmic/react,camsong/react,leeleo26/react,bleyle/react,KevinTCoughlin/react,reactjs-vn/reactjs_vndev,silvestrijonathan/react,bleyle/react,savelichalex/react,ericyang321/react,mjackson/react,bitshadow/react,kevinrobinson/react,TheBlasfem/react,skyFi/react,jkcaptain/react,facebook/react,trungda/react,tomv564/react,blue68/react,yjyi/react,TaaKey/react,vikbert/react,rgbkrk/react,sverrejoh/react,james4388/react,flarnie/react,Simek/react,nathanmarks/react,AmericanSundown/react,joecritch/react,cody/react,angeliaz/react,gougouGet/react,edvinerikson/react,k-cheng/react,joshblack/react,inuscript/react,TaaKey/react,hejld/react,neomadara/react,with-git/react,reggi/react,laogong5i0/react,LoQIStar/react,tlwirtz/react,wangyzyoga/react,dmatteo/react,apaatsio/react,framp/react,benchling/react,yungsters/react,andreypopp/react,jonhester/react,lennerd/react,kaushik94/react,christer155/react,skevy/react,BreemsEmporiumMensToiletriesFragrances/react,acdlite/react,facebook/react,tarjei/react,musofan/react,flarnie/react,davidmason/react,linqingyicen/react,mingyaaaa/react,claudiopro/react,richiethomas/react,gpbl/react,STRML/react,k-cheng/react,joecritch/react,mohitbhatia1994/react,Furzikov/react,gfogle/react,lastjune/react,Instrument/react,yut148/react,joecritch/react,ilyachenko/react,roth1002/react,it33/react,joecritch/react,studiowangfei/react,ameyms/react,savelichalex/react,ssyang0102/react,neomadara/react,mardigtch/react,sugarshin/react,yungsters/react,edmellum/react,digideskio/react,trueadm/react,scottburch/react,bspaulding/react,Jyrno42/react,S0lahart-AIRpanas-081905220200-Service/react,jzmq/react,zeke/react,salzhrani/react,maxschmeling/react,aickin/react,laskos/react,6feetsong/react,gitoneman/react,lucius-feng/react,joaomilho/react,pze/react,LoQIStar/react,vincentism/react,joecritch/react,nsimmons/react,usgoodus/react,jakeboone02/react,insionng/react,restlessdesign/react,ianb/react,jiangzhixiao/react,shergin/react,aaron-goshine/react,DigitalCoder/react,juliocanares/react,greyhwndz/react,maxschmeling/react,IndraVikas/react,studiowangfei/react,sugarshin/react,gxr1020/react,framp/react,brillantesmanuel/react,tomocchino/react,iamdoron/react,chacbumbum/react,nsimmons/react,1234-/react,arasmussen/react,gpazo/react,flowbywind/react,with-git/react,pdaddyo/react,jontewks/react,sarvex/react,bruderstein/server-react,nickdima/react,zanjs/react,gitoneman/react,vipulnsward/react,Jyrno42/react,kay-is/react,deepaksharmacse12/react,jordanpapaleo/react,speedyGonzales/react,jorrit/react,empyrical/react,joshblack/react,jameszhan/react,jquense/react,shergin/react,staltz/react,joaomilho/react,eoin/react,perperyu/react,edmellum/react,8398a7/react,kaushik94/react,salier/react,roth1002/react,Jericho25/react,BorderTravelerX/react,ouyangwenfeng/react,pwmckenna/react,KevinTCoughlin/react,JasonZook/react,salier/react,pyitphyoaung/react,cpojer/react,inuscript/react,henrik/react,temnoregg/react,livepanzo/react,szhigunov/react,gregrperkins/react,jordanpapaleo/react,inuscript/react,isathish/react,rricard/react,jdlehman/react,temnoregg/react,nathanmarks/react,salzhrani/react,linmic/react,ArunTesco/react,dirkliu/react
--- +++ @@ -23,7 +23,7 @@ */ function isNode(object) { return !!(object && ( - typeof Node !== 'undefined' ? object instanceof Node : + typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'
1407ea164be846b079933809649ed8e2f375ae89
src/utils/index.js
src/utils/index.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/. */ // @flow /** * Firefox has issues switching quickly between fill style colors, as the CSS color * is fully parsed each time it is set. As a mitigation, provide a class that only * switches the color when it's really needed. */ export class FastFillStyle { _ctx: CanvasRenderingContext2D; _previousFillColor: string; constructor(ctx: CanvasRenderingContext2D) { this._ctx = ctx; this._previousFillColor = ''; } set(fillStyle: string) { if (fillStyle !== this._previousFillColor) { // This could throw if setCtx wasn't set before calling it. Don't provide an // extra check here since this code is so hot. this._ctx.fillStyle = fillStyle; this._previousFillColor = fillStyle; } } }
/* 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/. */ // @flow /** * Firefox has issues switching quickly between fill style colors, as the CSS color * is fully parsed each time it is set. As a mitigation, provide a class that only * switches the color when it's really needed. */ export class FastFillStyle { _ctx: CanvasRenderingContext2D; _previousFillColor: string; constructor(ctx: CanvasRenderingContext2D) { this._ctx = ctx; this._previousFillColor = ''; } set(fillStyle: string) { if (fillStyle !== this._previousFillColor) { this._ctx.fillStyle = fillStyle; this._previousFillColor = fillStyle; } } }
Remove outdated comment in FastFillStyle
Remove outdated comment in FastFillStyle
JavaScript
mpl-2.0
mstange/cleopatra,devtools-html/perf.html,devtools-html/perf.html,mstange/cleopatra
--- +++ @@ -19,8 +19,6 @@ set(fillStyle: string) { if (fillStyle !== this._previousFillColor) { - // This could throw if setCtx wasn't set before calling it. Don't provide an - // extra check here since this code is so hot. this._ctx.fillStyle = fillStyle; this._previousFillColor = fillStyle; }
2fcd149b6418298ed41be1bb5167ceca681426a1
test/docstrings.js
test/docstrings.js
Date; //doc: Creates JavaScript Date instances which let you work with dates and times. new Date; //doc: Creates JavaScript Date instances which let you work with dates and times. var myalias = Date; myalias; //doc: Creates JavaScript Date instances which let you work with dates and times. // This is variable foo. var foo = 10; foo; //doc: This is variable foo. // This function returns a monkey. function makeMonkey() { return "monkey"; } makeMonkey; //doc: This function returns a monkey. var monkeyAlias = makeMonkey; monkeyAlias; //doc: This function returns a monkey. // This is an irrelevant comment. // This describes abc. var abc = 20; abc; //doc: This describes abc. // Quux is a thing. And here are a bunch more sentences that would // make the docstring too long, and are thus wisely stripped by Tern's // brain-dead heuristics. Ayay. function Quux() {} Quux; //doc: Quux is a thing. /* Extra bogus * whitespace is also stripped. */ var baz = "hi"; baz; //doc: Extra bogus whitespace is also stripped. var o = { // Get the name. getName: function() { return this.name; }, // The name name: "Harold" }; o.getName; //doc: Get the name. o.name; // The name
Date; //doc: Creates JavaScript Date instances which let you work with dates and times. new Date; //doc: Creates JavaScript Date instances which let you work with dates and times. var myalias = Date; myalias; //doc: Creates JavaScript Date instances which let you work with dates and times. // This is variable foo. var foo = 10; foo; //doc: This is variable foo. // This function returns a monkey. function makeMonkey() { return "monkey"; } makeMonkey; //doc: This function returns a monkey. var monkeyAlias = makeMonkey; monkeyAlias; //doc: This function returns a monkey. // This is an irrelevant comment. // This describes abc. var abc = 20; abc; //doc: This describes abc. // Quux is a thing. And here are a bunch more sentences that would // make the docstring too long, and are thus wisely stripped by Tern's // brain-dead heuristics. Ayay. function Quux() {} Quux; //doc: Quux is a thing. /* Extra bogus * whitespace is also stripped. */ var baz = "hi"; baz; //doc: Extra bogus whitespace is also stripped. var o = { // Get the name. getName: function() { return this.name; }, // The name name: "Harold" }; o.getName; //doc: Get the name. o.name; //doc: The name
Check `o.name` docstring ("doc:" was omitted from comment test)
Check `o.name` docstring ("doc:" was omitted from comment test)
JavaScript
mit
emacsmirror/tern,neoclide/tern,neoclide/tern,emallson/tern,neoclide/tern,jgiles/tern,othree/tern,rustemferreira/tern,ryanstewart/tern,marijnh/tern,talyian/tern,ternjs/tern,anandthakker/tern,talyian/tern,talyian/tern,adrianton3/tern,MarcelGerber/tern,messfairy/tern,cdosborn/tern,angelozerr/tern,mcanthony/tern,pombredanne/tern,dorellang/tern,purcell/tern,anandthakker/tern,jason0x43/tern,eranif/tern,kylehg/tern,angelozerr/tern,albertinad/tern,rustemferreira/tern,othree/tern,MarcelGerber/tern,mcanthony/tern,marijnh/tern,cdosborn/tern,fileability/tern,MarcelGerber/tern,vegansk/tern,inafact/tern,messfairy/tern,cdosborn/tern,dorellang/tern,jgiles/tern,aklt/tern,Icenium/tern,fileability/tern,marijnh/tern,Icenium/tern,othree/tern,albertinad/tern,eranif/tern,sergeche/tern,messfairy/tern,ternjs/tern,forivall/tern,adrianton3/tern,fileability/tern,rustemferreira/tern,OliverJAsh/tern,cloud9ide/tern,mcanthony/tern,dorellang/tern,cloud9ide/tern,ypresto/tern,emallson/tern,emallson/tern,emacsmirror/tern,sqs/tern,emacsmirror/tern,kentdoppelganger/tern,Icenium/tern,ternjs/tern,jgiles/tern,eranif/tern,albertinad/tern,anandthakker/tern,adrianton3/tern
--- +++ @@ -49,4 +49,4 @@ }; o.getName; //doc: Get the name. -o.name; // The name +o.name; //doc: The name
8ca59435d4e2827171d3428db821da6e70111139
examples/books-AMD/app/views.js
examples/books-AMD/app/views.js
/*global define:false */ define(["underscore", "backbone"], function (_, Backbone) { "use strict"; var views = { BookListItem: Backbone.View.extend({ tagName: 'li', template: _.template("<a href='/#book-details/<%-id%>'><%-title%></a>"), initialize: function (opts) { this.$el.html(this.template(opts.book.toJSON())); } }), BookList: Backbone.View.extend({ tagName: 'ul', initialize: function (opts) { this.$el.append.apply(this.$el, opts.books.map(function (book) { return (new views.BookListItem({ book: book })).el; })); } }), BookDetails: Backbone.View.extend({ template: _.template("<div>'<%-title%>' written by <%-author%> sometime around <%-year%></div><div><a href='/#books-list'>back</a></div>"), initialize: function (opts) { this.$el.html(this.template(opts.book.toJSON())); } }), Error: Backbone.View.extend({ template: _.template("<div>Oops, an error occured: <%-error%></div>"), initialize: function (opts) { this.$el.html(this.template({ error: opts.error })); } }) }; return views; });
/*global define:false */ define(["underscore", "backbone"], function (_, Backbone) { "use strict"; var views = { BookListItem: Backbone.View.extend({ tagName: 'li', template: _.template("<a href='/#book-details/<%-id%>'><%-title%></a>"), initialize: function (opts) { this.$el.html(this.template(opts.book.toJSON())); } }), BookList: Backbone.View.extend({ tagName: 'ul', initialize: function (opts) { this.$el.append.apply(this.$el, opts.books.map(function (book) { return (new views.BookListItem({ book: book })).el; })); } }), BookDetails: Backbone.View.extend({ template: _.template("<div>'<%-title%>' written by <%-author%> sometime around <%-year%></div><div><a href='/#books-list'>back</a></div>"), initialize: function (opts) { this.$el.html(this.template(opts.book.toJSON())); } }), Error: Backbone.View.extend({ template: _.template("<div>Oops, an error occured: <%-error%></div>"), initialize: function (opts) { this.$el.html(this.template({ error: opts.error })); } }) }; return views; });
Insert missing line break at end-of-file
Insert missing line break at end-of-file
JavaScript
mit
biril/backbone-faux-server
f8a02fad40dde2daa0600e17e3a44dc132b2981c
src/regex/index.js
src/regex/index.js
var main = require('./main'); var extend = require('extend'); var defaultOptions = { definitions: false, quotes: '"' }; module.exports = function (data, options) { var regexOptions = options.parserConfig.regex || {}; var finalOptions = extend(options, regexOptions); var migrated = main(data.toString(), finalOptions); return migrated; }
var main = require('./main'); var extend = require('extend'); var defaultOptions = { definitions: false, quotes: '"' }; module.exports = function (data, options) { options = options || {}; options.parserConfig = options.parserConfig || {}; var regexOptions = options.parserConfig.regex || {}; var finalOptions = extend(options, regexOptions); var migrated = main(data.toString(), finalOptions); return migrated; }
Fix options argument in regex parser
Fix options argument in regex parser
JavaScript
mit
apsdehal/qunit-migrate
--- +++ @@ -6,6 +6,8 @@ }; module.exports = function (data, options) { + options = options || {}; + options.parserConfig = options.parserConfig || {}; var regexOptions = options.parserConfig.regex || {}; var finalOptions = extend(options, regexOptions);
12d843dc88533f6db7b43bb72d654053a57ca307
test/mysql.test.js
test/mysql.test.js
var assert = require('assert'), Lapidus = require('../index.js'), spawnSync = require('child_process').spawnSync, fs = require('fs'); describe('MySQL', function () { var output; before(function(done) { output = spawnSync('node', ['index.js', '-c', './test/config/lapidus.json'], {timeout: 1000 }); done(); }); it('connects to MySQL valid backends', function () { assert.equal(output.status, 0); assert.equal(output.stderr.toString(), ''); }); it('creates a lookup table of primary keys', function() { assert.notEqual(output.stdout.toString().indexOf('caching for fast lookups'), -1); }); });
var assert = require('assert'), Lapidus = require('../index.js'), spawnSync = require('child_process').spawnSync, fs = require('fs'); describe('MySQL', function () { var output; before(function(done) { output = spawnSync('node', ['index.js', '-c', './test/config/lapidus.json'], { timeout: 1500 }); done(); }); it('connects to MySQL valid backends', function () { assert.equal(output.status, 0); assert.equal(output.stderr.toString(), ''); }); it('creates a lookup table of primary keys', function() { assert.notEqual(output.stdout.toString().indexOf('caching for fast lookups'), -1); }); });
Increase timeout to see if it fixes invalid packet sequence in Travis
Increase timeout to see if it fixes invalid packet sequence in Travis
JavaScript
mit
JarvusInnovations/lapidus
--- +++ @@ -7,7 +7,7 @@ var output; before(function(done) { - output = spawnSync('node', ['index.js', '-c', './test/config/lapidus.json'], {timeout: 1000 }); + output = spawnSync('node', ['index.js', '-c', './test/config/lapidus.json'], { timeout: 1500 }); done(); });
5f98bffa11b065ac1b075d30b0ce5be2fe453a2b
app/scripts/main.js
app/scripts/main.js
(function(window, document, undefined) { "use strict"; require.config({ paths: { // Libraries "jquery": "../../libraries/jquery/jquery", "hljs": "../../libraries/highlightjs/highlight.pack", // /Libraries // Application "app": "app", // /Application }, shim: { } }); require(["jquery", "app"], function( $, App) { var app = App.create({ name: "voxel", useHighlight: true }); console.log("App, %s, with jQuery v%s says, '%s'", app.options.name, $.fn.jquery, app.greet()); }); })(window, document);
require.config({ paths: { // Libraries "jquery": "../../libraries/jquery/jquery", "hljs": "../../libraries/highlightjs/highlight.pack", // /Libraries }, shim: { } }); require(["jquery", "app"], function( $, App) { var app = App.create({ name: "voxel", useHighlight: true }); console.log("App, %s, with jQuery v%s says, '%s'", app.options.name, $.fn.jquery, app.greet()); });
Remove IIFE and app module path.
Remove IIFE and app module path.
JavaScript
mit
rishabhsrao/voxel,rishabhsrao/voxel,rishabhsrao/voxel
--- +++ @@ -1,29 +1,21 @@ -(function(window, document, undefined) { - "use strict"; +require.config({ + paths: { + // Libraries + "jquery": "../../libraries/jquery/jquery", + "hljs": "../../libraries/highlightjs/highlight.pack", + // /Libraries + }, - require.config({ - paths: { - // Libraries - "jquery": "../../libraries/jquery/jquery", - "hljs": "../../libraries/highlightjs/highlight.pack", - // /Libraries + shim: { + } +}); - // Application - "app": "app", - // /Application - }, - - shim: { - } +require(["jquery", "app"], +function( $, App) { + var app = App.create({ + name: "voxel", + useHighlight: true }); - require(["jquery", "app"], - function( $, App) { - var app = App.create({ - name: "voxel", - useHighlight: true - }); - - console.log("App, %s, with jQuery v%s says, '%s'", app.options.name, $.fn.jquery, app.greet()); - }); -})(window, document); + console.log("App, %s, with jQuery v%s says, '%s'", app.options.name, $.fn.jquery, app.greet()); +});
c90523eae80f211105fd7e2905a549455a544716
src/firewyrm.js
src/firewyrm.js
if (typeof define !== 'function') { var define = require('amdefine')(module); } define(['./deferred', './tools'], function(Deferred, tools) { return { asVal: asVal, create: create }; function create(wyrmhole, mimetype, args) { var send = Deferred.fn(wyrmhole, 'sendMessage'); return send(['New', mimetype, args]).then(function(spawnId) { return tools.wrapAlienWyrmling(wyrmhole, spawnId, 0); }).then(function(queenling) { queenling.destroy = function() { return send(['Destroy', queenling.spawnId]); }; return queenling; }, function(error) { console.log("CREATE ERROR:", error); return Deferred.reject(error); }); } function asVal(obj) { if (tools.isPrimitive(obj)) { return obj; } return { $type: 'json', data: obj }; } });
if (typeof define !== 'function') { var define = require('amdefine')(module); } define(['./deferred', './tools'], function(Deferred, tools) { return { asVal: asVal, create: create }; function create(wyrmhole, mimetype, args) { var send = Deferred.fn(wyrmhole, 'sendMessage'); return send(['New', mimetype, args]).then(function(spawnId) { return tools.wrapAlienWyrmling(wyrmhole, spawnId, 0); }).then(function(queenling) { Object.defineProperty(queenling, 'destroy', { value: function() { return send(['Destroy', queenling.spawnId]); } }); return queenling; }, function(error) { console.log("CREATE ERROR:", error); return Deferred.reject(error); }); } function asVal(obj) { if (tools.isPrimitive(obj)) { return obj; } return { $type: 'json', data: obj }; } });
Make queenling.destroy non-writable, non-enumerable, non-configurable
Make queenling.destroy non-writable, non-enumerable, non-configurable
JavaScript
mit
gradecam/firewyrm-js,gradecam/firewyrm-js
--- +++ @@ -11,9 +11,11 @@ return send(['New', mimetype, args]).then(function(spawnId) { return tools.wrapAlienWyrmling(wyrmhole, spawnId, 0); }).then(function(queenling) { - queenling.destroy = function() { - return send(['Destroy', queenling.spawnId]); - }; + Object.defineProperty(queenling, 'destroy', { + value: function() { + return send(['Destroy', queenling.spawnId]); + } + }); return queenling; }, function(error) { console.log("CREATE ERROR:", error);
c6856449d0b69e0199e842458028d04f51668e36
src/components/NotFoundPage.js
src/components/NotFoundPage.js
import React from 'react'; import Image from './Image'; import { Link } from 'react-router'; const NotFoundPage = () => { const locations = [ 'Sahasrahla\'s pocket', 'sick kid\'s bed', 'Hera basement', 'king\'s tomb' ]; const location = locations[Math.floor(Math.random() * (locations.length))]; return ( <div className="not-found-page"> <Image src={`/icons/chest-1-open-1.png`} /> <h4> 404 </h4> <p>The item you were looking for is probably in {location}.</p> <Link to="/"> Go back to homepage </Link> </div> ); }; export default NotFoundPage;
import React from 'react'; import Image from './Image'; import { Link } from 'react-router'; const NotFoundPage = () => { const sahanames = [ 'sahasralah', 'sabotaging', 'sacahuista', 'sacahuiste', 'saccharase', 'saccharide', 'saccharify', 'saccharine', 'saccharins', 'sacerdotal', 'sackcloths', 'salmonella', 'saltarelli', 'saltarello', 'saltations', 'saltbushes', 'saltcellar', 'saltshaker', 'salubrious', 'sandgrouse', 'sandlotter', 'sandstorms', 'sandwiched', 'sauerkraut', 'schipperke', 'schismatic', 'schizocarp', 'schmalzier', 'schmeering', 'schmoosing', 'shibboleth', 'shovelnose', 'sahananana', 'sarararara', 'salamander', 'sharshalah', 'shahabadoo', 'sassafrass' ]; // Pick a random sahaname, capitalize, and add 's or ' let sahaString = sahanames[Math.floor(Math.random() * (sahanames.length))]; sahaString = sahaString.charAt(0).toUpperCase() + sahaString.slice(1); sahaString += (sahaString.charAt(sahaString.length - 1) == 's') ? "'" : "'s"; const locations = [ `${sahaString} pocket`, 'Sick Kid\'s bed', 'Hera basement', 'King\'s Tomb' ]; const location = locations[Math.floor(Math.random() * (locations.length))]; return ( <div className="not-found-page"> <Image src={`/icons/chest-1-open-1.png`} /> <h4> 404 </h4> <p>The item you were looking for is probably in {location}.</p> <Link to="/"> Go back to homepage </Link> </div> ); }; export default NotFoundPage;
Add Sahasrahla's nicknames to the 404 page
Add Sahasrahla's nicknames to the 404 page
JavaScript
mit
easymac/alttp-map-tracker,easymac/alttp-map-tracker
--- +++ @@ -4,11 +4,26 @@ import { Link } from 'react-router'; const NotFoundPage = () => { + const sahanames = [ + 'sahasralah', 'sabotaging', 'sacahuista', 'sacahuiste', 'saccharase', 'saccharide', 'saccharify', + 'saccharine', 'saccharins', 'sacerdotal', 'sackcloths', 'salmonella', 'saltarelli', 'saltarello', + 'saltations', 'saltbushes', 'saltcellar', 'saltshaker', 'salubrious', 'sandgrouse', 'sandlotter', + 'sandstorms', 'sandwiched', 'sauerkraut', 'schipperke', 'schismatic', 'schizocarp', 'schmalzier', + 'schmeering', 'schmoosing', 'shibboleth', 'shovelnose', 'sahananana', 'sarararara', 'salamander', + 'sharshalah', 'shahabadoo', 'sassafrass' + ]; + + // Pick a random sahaname, capitalize, and add 's or ' + let sahaString = sahanames[Math.floor(Math.random() * (sahanames.length))]; + sahaString = sahaString.charAt(0).toUpperCase() + sahaString.slice(1); + sahaString += (sahaString.charAt(sahaString.length - 1) == 's') ? "'" : "'s"; + + const locations = [ - 'Sahasrahla\'s pocket', - 'sick kid\'s bed', + `${sahaString} pocket`, + 'Sick Kid\'s bed', 'Hera basement', - 'king\'s tomb' + 'King\'s Tomb' ]; const location = locations[Math.floor(Math.random() * (locations.length))];
381b357f0bf25d9f345f70d3b8c55a16e4fac166
src/components/html-message.js
src/components/html-message.js
/* global React */ /* jslint esnext:true */ import escape from '../escape'; import IntlMixin from '../mixin'; function escapeProps(props) { return Object.keys(props).reduce(function (escapedProps, name) { var value = props[name]; // TODO: Can we force string coersion here? Or would that not be needed // and possible mess with IntlMessageFormat? if (typeof value === 'string') { value = escape(value); } escapedProps[name] = value; return escapedProps; }, {}); } var IntlHTMLMessage = React.createClass({ displayName: 'HTMLMessage', mixins : [IntlMixin], render: function () { var message = React.Children.only(this.props.children); var escapedProps = escapeProps(this.props); // Since the message presumably has HTML in it, we need to set // `innerHTML` in order for it to be rendered and not escaped by React. // To be safe, we are escaping all string prop values before formatting // the message. It is assumed that the message is not UGC, and came from // the developer making it more like a template. return React.DOM.span({ dangerouslySetInnerHTML: { __html: this.formatMessage(message, escapedProps) } }); } }); export default IntlHTMLMessage;
/* global React */ /* jslint esnext:true */ import escape from '../escape'; import IntlMixin from '../mixin'; function escapeProps(props) { return Object.keys(props).reduce(function (escapedProps, name) { var value = props[name]; // TODO: Can we force string coersion here? Or would that not be needed // and possible mess with IntlMessageFormat? if (typeof value === 'string') { value = escape(value); } escapedProps[name] = value; return escapedProps; }, {}); } var IntlHTMLMessage = React.createClass({ displayName: 'IntlHTMLMessage', mixins : [IntlMixin], getDefaultProps: function () { return {__tagName: 'span'}; }, render: function () { var props = this.props; var tagName = props.__tagName; var message = props.children; var escapedProps = escapeProps(props); // Since the message presumably has HTML in it, we need to set // `innerHTML` in order for it to be rendered and not escaped by React. // To be safe, we are escaping all string prop values before formatting // the message. It is assumed that the message is not UGC, and came from // the developer making it more like a template. return React.DOM[tagName]({ dangerouslySetInnerHTML: { __html: this.formatMessage(message, escapedProps) } }); } }); export default IntlHTMLMessage;
Add support for configured tagName to HTMLMessage
Add support for configured tagName to HTMLMessage
JavaScript
bsd-3-clause
btd/react-intl,ryan1234/react-intl,btd/react-intl,CumpsD/react-intl,Jonekee/react-intl,hukka/react-intl,keppelen/react-intl,keppelen/react-intl,ryan1234/react-intl,mattikl/react-intl,ericf/react-intl,CumpsD/react-intl,baer/react-intl,tsironis/react-intl,Vungle/react-intl,mattikl/react-intl,tsironis/react-intl,tsironis/react-intl,gseguin/react-intl,gseguin/react-intl,Vungle/react-intl,keppelen/react-intl,Vungle/react-intl,hukka/react-intl,vasa-chi/react-intl,CumpsD/react-intl,mattikl/react-intl,btd/react-intl,ryan1234/react-intl,gseguin/react-intl,hukka/react-intl
--- +++ @@ -20,19 +20,25 @@ } var IntlHTMLMessage = React.createClass({ - displayName: 'HTMLMessage', + displayName: 'IntlHTMLMessage', mixins : [IntlMixin], + getDefaultProps: function () { + return {__tagName: 'span'}; + }, + render: function () { - var message = React.Children.only(this.props.children); - var escapedProps = escapeProps(this.props); + var props = this.props; + var tagName = props.__tagName; + var message = props.children; + var escapedProps = escapeProps(props); // Since the message presumably has HTML in it, we need to set // `innerHTML` in order for it to be rendered and not escaped by React. // To be safe, we are escaping all string prop values before formatting // the message. It is assumed that the message is not UGC, and came from // the developer making it more like a template. - return React.DOM.span({ + return React.DOM[tagName]({ dangerouslySetInnerHTML: { __html: this.formatMessage(message, escapedProps) }
28de0bd2815c0abe4a9cef56d4707f78ede3ee1f
client/app/app.js
client/app/app.js
// we don't need to use a variable // or the from keyword when importing a css/styl file // thanks the the styles loader it gets added as a // <style> tag in the head by default but can be changed import 'normalize.css'; import {appDirective} from './app.directive'; // the angular libs are just common js // and therefore we can assume they were // exported using the default keyword in ES2015 // so we can import each module // with any name we see fit. // Note that the actual value are just strings except angular itself // because that's how angular decided to export // their auxillary modules import angular from 'angular'; import uiRouter from 'angular-ui-router'; import ngAnimate from 'angular-animate'; // because we exported a named variable // without using default keyword // we must import it with the brackets import {home} from './components/home/home'; import {blog} from './components/blog/blog'; // TODO: register common with app // TODO: register shared with app angular.module('app', [ uiRouter, ngAnimate, // home is the module, the angular module // because that's what we exported in home.js // all angular modules have a name // property who's value is the name you set the // module to be home.name, blog.name ]) .directive('app', appDirective);
// we don't need to use a variable // or the from keyword when importing a css/styl file // thanks the the styles loader it gets added as a // <style> tag in the head by default but can be changed import 'normalize.css'; import {appDirective} from './app.directive'; // the angular libs are just common js // and therefore we can assume they were // exported using the default keyword in ES2015 // so we can import each module // with any name we see fit. // Note that the actual value are just strings except angular itself // because that's how angular decided to export // their auxillary modules import angular from 'angular'; import uiRouter from 'angular-ui-router'; import ngAnimate from 'angular-animate'; // because we exported a named variable // without using default keyword // we must import it with the brackets import {home} from './components/home/home'; import {blog} from './components/blog/blog'; import {common} from './components/common/common'; import {shared} from './shared/shared'; angular.module('app', [ uiRouter, ngAnimate, // home is the module, the angular module // because that's what we exported in home.js // all angular modules have a name // property who's value is the name you set the // module to be home.name, blog.name, common.name, shared.name ]) .directive('app', appDirective);
Add a service to get the posts
Add a service to get the posts
JavaScript
mit
kbeloborodko/angular-blog,kbeloborodko/angular-blog
--- +++ @@ -20,8 +20,8 @@ // we must import it with the brackets import {home} from './components/home/home'; import {blog} from './components/blog/blog'; -// TODO: register common with app -// TODO: register shared with app +import {common} from './components/common/common'; +import {shared} from './shared/shared'; angular.module('app', [ uiRouter, @@ -32,6 +32,8 @@ // property who's value is the name you set the // module to be home.name, - blog.name + blog.name, + common.name, + shared.name ]) .directive('app', appDirective);
49f8abc62323c6384345e370a5330e477cc1eb64
src/action-types.js
src/action-types.js
// This function generates the five statuses from a single CRUD action. // For instance, you'd probably pass "CREATE", "READ", "UPDATE", or "DELETE" // as `crudAction`. const mapConstant = (resourceName, crudAction) => ({ [`${crudAction}_${resourceName}`]: `${crudAction}_${resourceName}`, [`${crudAction}_${resourceName}_SUCCEED`]: `${crudAction}_${resourceName}_SUCCEED`, [`${crudAction}_${resourceName}_FAIL`]: `${crudAction}_${resourceName}_FAIL`, [`${crudAction}_${resourceName}_NULL`]: `${crudAction}_${resourceName}_NULL`, }); const createTypes = mapConstant('RESOURCES', 'CREATE'); const readTypes = mapConstant('RESOURCES', 'READ'); const updateTypes = mapConstant('RESOURCES', 'UPDATE'); const deleteTypes = mapConstant('RESOURCES', 'DELETE'); export default { ...createTypes, ...readTypes, ...updateTypes, ...deleteTypes };
// This function generates the five statuses from a single CRUD action. // For instance, you'd probably pass "CREATE", "READ", "UPDATE", or "DELETE" // as `crudAction`. const mapConstant = (crudAction) => ({ [`${crudAction}_RESOURCES`]: `${crudAction}_RESOURCES`, [`${crudAction}_RESOURCES_SUCCEED`]: `${crudAction}_RESOURCES_SUCCEED`, [`${crudAction}_RESOURCES_FAIL`]: `${crudAction}_RESOURCES_FAIL`, [`${crudAction}_RESOURCES_NULL`]: `${crudAction}_RESOURCES_NULL`, }); const createTypes = mapConstant('CREATE'); const readTypes = mapConstant('READ'); const updateTypes = mapConstant('UPDATE'); const deleteTypes = mapConstant('DELETE'); export default { ...createTypes, ...readTypes, ...updateTypes, ...deleteTypes };
Simplify action type generation code
Simplify action type generation code
JavaScript
mit
jmeas/resourceful-redux,jmeas/resourceful-redux
--- +++ @@ -1,17 +1,17 @@ // This function generates the five statuses from a single CRUD action. // For instance, you'd probably pass "CREATE", "READ", "UPDATE", or "DELETE" // as `crudAction`. -const mapConstant = (resourceName, crudAction) => ({ - [`${crudAction}_${resourceName}`]: `${crudAction}_${resourceName}`, - [`${crudAction}_${resourceName}_SUCCEED`]: `${crudAction}_${resourceName}_SUCCEED`, - [`${crudAction}_${resourceName}_FAIL`]: `${crudAction}_${resourceName}_FAIL`, - [`${crudAction}_${resourceName}_NULL`]: `${crudAction}_${resourceName}_NULL`, +const mapConstant = (crudAction) => ({ + [`${crudAction}_RESOURCES`]: `${crudAction}_RESOURCES`, + [`${crudAction}_RESOURCES_SUCCEED`]: `${crudAction}_RESOURCES_SUCCEED`, + [`${crudAction}_RESOURCES_FAIL`]: `${crudAction}_RESOURCES_FAIL`, + [`${crudAction}_RESOURCES_NULL`]: `${crudAction}_RESOURCES_NULL`, }); -const createTypes = mapConstant('RESOURCES', 'CREATE'); -const readTypes = mapConstant('RESOURCES', 'READ'); -const updateTypes = mapConstant('RESOURCES', 'UPDATE'); -const deleteTypes = mapConstant('RESOURCES', 'DELETE'); +const createTypes = mapConstant('CREATE'); +const readTypes = mapConstant('READ'); +const updateTypes = mapConstant('UPDATE'); +const deleteTypes = mapConstant('DELETE'); export default { ...createTypes,
98e25d04c5fd4541a66cae07fe8043ba5605676a
express/models/rule_parser.js
express/models/rule_parser.js
// L-System Rule Parser function RuleParser(str) { this.str = str; this.rules = {}; this.parse = function() { var c, d; var env = 0; var rule_str; var variable; for (var i = 0; i < this.str.length; i++) { c = this.str[i]; if (i > 0) { d = this.str[i-1]; } else { d = null; } if (c == '(') { env = 1; rule_str = ""; } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+\-\[\]]/) == 0) && env == 1) { variable = c; } else if (c == '>' && d == '-') { env = 2; } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0) && env == 2) { rule_str += c; } else if (c == ')') { this.rules[variable] = rule_str; env = 0; } } return this.rules; } } module.exports = RuleParser;
// L-System Rule Parser function RuleParser(str) { this.str = str; this.rules = {}; this.parse = function() { var c, d; var env = 0; var rule_str; var variable; var variable_regex = /[A-Z]/; var control_regex = /[\+-\[\]]/; for (var i = 0; i < this.str.length; i++) { c = this.str[i]; if (i > 0) { d = this.str[i-1]; } else { d = null; } if (c == '(') { env = 1; rule_str = ""; } else if (c == '>' && d == '-') { env = 3; } else if ((c.search(variable_regex) == 0 || c.search(control_regex) == 0) && env == 1) { variable = c; env = 2; } else if ((c.search(variable_regex) == 0 || c.search(control_regex) == 0) && env == 3) { rule_str += c; } else if (c == ')') { this.rules[variable] = rule_str; env = 0; } } return this.rules; } } module.exports = RuleParser;
Fix rule parser to allow certain rules
Fix rule parser to allow certain rules Specifically, rules that have control characters as their "variable" (thse should always be "constant" rules). An example is (+ -> +).
JavaScript
bsd-3-clause
dwjackson/html_fractals
--- +++ @@ -8,6 +8,9 @@ var env = 0; var rule_str; var variable; + + var variable_regex = /[A-Z]/; + var control_regex = /[\+-\[\]]/; for (var i = 0; i < this.str.length; i++) { c = this.str[i]; @@ -20,13 +23,14 @@ if (c == '(') { env = 1; rule_str = ""; - } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+\-\[\]]/) == 0) + } else if (c == '>' && d == '-') { + env = 3; + } else if ((c.search(variable_regex) == 0 || c.search(control_regex) == 0) && env == 1) { variable = c; - } else if (c == '>' && d == '-') { env = 2; - } else if ((c.search(/[A-Z]/) == 0 || c.search(/[\+-\[\]]/) == 0) - && env == 2) { + } else if ((c.search(variable_regex) == 0 || c.search(control_regex) == 0) + && env == 3) { rule_str += c; } else if (c == ')') { this.rules[variable] = rule_str;
e68591417bc299995bdb41e50dc1e6e67995e9a7
blocks/sms/index.js
blocks/sms/index.js
module.exports = { className: 'sms', template: require('./index.html'), data: { name: 'SMS', icon: '/images/blocks_sms.png', attributes: { value: { label: 'Phone #', type: 'string', value: '+18005555555' }, messageBody: { label: 'Message', type: 'string', value: '', }, innerHTML: { label: 'Label', type: 'string', value: 'Send SMS' } } }, ready: function () { var self = this; self.$el.addEventListener('click', function (e) { if (!window.MozActivity) return; if (self.$parent.$parent.$data.params.mode !== 'play') return; e.preventDefault(); new MozActivity({ name: 'new', data: { type: 'websms/sms', number: self.$data.attributes.value.value, body: self.$data.attributes.messageBody.value, } }); }); } };
module.exports = { className: 'sms', template: require('./index.html'), data: { name: 'SMS', icon: '/images/blocks_sms.png', attributes: { value: { label: 'Phone #', type: 'string', value: '+18005555555' }, messageBody: { label: 'Message', type: 'string', value: '', }, innerHTML: { label: 'Label', type: 'string', value: 'Send SMS' } } }, ready: function () { var self = this; self.$el.addEventListener('click', function (e) { if (self.$parent.$parent.$data.params.mode !== 'play') return; e.preventDefault(); var number = self.$data.attributes.value.value; var body = self.$data.attributes.messageBody.value window.location = 'sms:' + number + '?body=' + body; }); } };
Use standard sms: format rather than MozActivity for SMS brick.
Use standard sms: format rather than MozActivity for SMS brick.
JavaScript
mpl-2.0
rodmoreno/webmaker-android,codex8/webmaker-app,bolaram/webmaker-android,gvn/webmaker-android,mozilla/webmaker-android,adamlofting/webmaker-android,alanmoo/webmaker-android,secretrobotron/webmaker-android,thejdeep/webmaker-app,bolaram/webmaker-android,mozilla/webmaker-android,k88hudson/webmaker-android,k88hudson/webmaker-android,toolness/webmaker-android,alicoding/webmaker-android,cadecairos/webmaker-android,rodmoreno/webmaker-android,vazquez/webmaker-android,codex8/webmaker-app,alicoding/webmaker-android,j796160836/webmaker-android,j796160836/webmaker-android,vazquez/webmaker-android,secretrobotron/webmaker-android,gvn/webmaker-android,alanmoo/webmaker-android,thejdeep/webmaker-app
--- +++ @@ -25,19 +25,12 @@ ready: function () { var self = this; self.$el.addEventListener('click', function (e) { - if (!window.MozActivity) return; + if (self.$parent.$parent.$data.params.mode !== 'play') return; + e.preventDefault(); - if (self.$parent.$parent.$data.params.mode !== 'play') return; - - e.preventDefault(); - new MozActivity({ - name: 'new', - data: { - type: 'websms/sms', - number: self.$data.attributes.value.value, - body: self.$data.attributes.messageBody.value, - } - }); + var number = self.$data.attributes.value.value; + var body = self.$data.attributes.messageBody.value + window.location = 'sms:' + number + '?body=' + body; }); } };
1be130e89f07ac9d28ddc133ba9f7d335e4e83e5
src/ext/Function.js
src/ext/Function.js
/* ================================================================================================== Lowland - JavaScript low level functions Copyright (C) 2012 Sebatian Fastner ================================================================================================== */ /** * #require(ext.sugar.Object) */ (function(window) { var hasPostMessage = !!window.postMessage; var slice = Array.prototype.slice; var timeouts = []; var messageName = "$$lowland-zero-timeout-message"; var handleMessage = function(event) { if (event.source == window && event.data == messageName) { lowland.bom.Events.stopPropagation(event); if (timeouts.length > 0) { var timeout = timeouts.shift(); timeout[0].apply(timeout[1], timeout[2]); } } }; lowland.bom.Events.set(window, "message", handleMessage, true); core.Main.addMembers("Function", { delay : function(time, context) { var func = this; return setTimeout(function(context, args) { func.apply(context, args); }, time, context, slice.call(arguments, 2)); }, /** * Based upon work of http://dbaron.org/log/20100309-faster-timeouts */ lazy : function(context) { context = context || this; //timeouts.push([func, slice.call(arguments,1)]); timeouts.push([this, context, slice.call(arguments,1)]); postMessage(messageName, "*"); } }); })(window);
/* ================================================================================================== Lowland - JavaScript low level functions Copyright (C) 2012 Sebatian Fastner ================================================================================================== */ /** * #require(ext.sugar.Object) */ (function(window) { var hasPostMessage = !!window.postMessage; var slice = Array.prototype.slice; var timeouts = []; var messageName = "$$lowland-zero-timeout-message"; var handleMessage = function(event) { if (event.source == window && event.data == messageName) { lowland.bom.Events.stopPropagation(event); if (timeouts.length > 0) { var timeout = timeouts.shift(); timeout[0].apply(timeout[1], timeout[2]); } } }; lowland.bom.Events.set(window, "message", handleMessage, true); core.Main.addMembers("Function", { lowDelay : function(time, context) { var func = this; return setTimeout(function(context, args) { func.apply(context||this, args||[]); }, time, context, slice.call(arguments, 2)); }, /** * Based upon work of http://dbaron.org/log/20100309-faster-timeouts */ lazy : function(context) { context = context || this; //timeouts.push([func, slice.call(arguments,1)]); timeouts.push([this, context, slice.call(arguments,1)]); postMessage(messageName, "*"); } }); })(window);
Rename delay to lowDelay as original name conflicts with Prototype
Rename delay to lowDelay as original name conflicts with Prototype
JavaScript
mit
fastner/lowland,fastner/lowland
--- +++ @@ -29,10 +29,10 @@ core.Main.addMembers("Function", { - delay : function(time, context) { + lowDelay : function(time, context) { var func = this; return setTimeout(function(context, args) { - func.apply(context, args); + func.apply(context||this, args||[]); }, time, context, slice.call(arguments, 2)); },
cee19b9e8c5c9f3901aa061c066cffe8d37bb88a
app/controllers/patient-view.js
app/controllers/patient-view.js
var express = require('express'); var router = express.Router(); var pipe = require('../transformers/pipe'); router.post('/\\$cds-hook', function(req, res, next) { var context = { requestParams: req.query || {}, language: "fi", nation: "fi", cards: ["reminders", "guidelink", "cmrlink"] }; pipe.execute(req, res, next, context); }); router.get('/\\$cds-hook-metadata', function(req, res, next) { res.json({ "resourceType" : "Parameters", "parameter" : [{ "name" : "name", "valueString" : "EBMeDS patient view" }, { "name" : "description", "valueString" : "EBMeDS patient view" }, { "name" : "activity", "valueCoding" : { "system" : "http://cds-hooks.smarthealthit.org/activity", "code" : "patient-view" } } ] }); }); module.exports = router;
var express = require('express'); var router = express.Router(); var pipe = require('../transformers/pipe'); router.post('/\\$cds-hook', function(req, res, next) { var context = { requestParams: req.query || {}, language: "en_US", nation: "US", cards: ["reminders", "guidelink", "cmrlink"] }; pipe.execute(req, res, next, context); }); router.get('/\\$cds-hook-metadata', function(req, res, next) { res.json({ "resourceType" : "Parameters", "parameter" : [{ "name" : "name", "valueString" : "EBMeDS patient view" }, { "name" : "description", "valueString" : "EBMeDS patient view" }, { "name" : "activity", "valueCoding" : { "system" : "http://cds-hooks.smarthealthit.org/activity", "code" : "patient-view" } } ] }); }); module.exports = router;
Change language to en_US for patient view API
Change language to en_US for patient view API
JavaScript
mit
ebmeds/ebmeds-fhir,ebmeds/ebmeds-fhir
--- +++ @@ -6,8 +6,8 @@ var context = { requestParams: req.query || {}, - language: "fi", - nation: "fi", + language: "en_US", + nation: "US", cards: ["reminders", "guidelink", "cmrlink"] };
e4445e5850d68d02059c3280fe29aa1f70690a1b
config/express.js
config/express.js
'use strict'; // Initialize express. const config = {}; // Port config.port = process.env.LISTEN_PORT || 5050; module.exports = config;
'use strict'; // Initialize express. const config = {}; // Port config.port = process.env.PORT || 5050; module.exports = config;
Use PORT env variable for compatibility with Heroku
Use PORT env variable for compatibility with Heroku
JavaScript
mit
DoSomething/blink,DoSomething/blink
--- +++ @@ -4,6 +4,6 @@ const config = {}; // Port -config.port = process.env.LISTEN_PORT || 5050; +config.port = process.env.PORT || 5050; module.exports = config;
8a841f7c7501c9085f32a3c08c448f6f102737d2
test/await-test.js
test/await-test.js
require('buster').spec.expose(); var expect = require('buster').expect; var await = require('../lib/combinators/await').await; var observe = require('../lib/combinators/observe').observe; var Stream = require('../lib/Stream'); var resolve = require('../lib/promises').Promise.resolve; var sentinel = { value: 'sentinel' }; function identity(x) { return x; } describe('await', function() { it('should await promises', function() { var s = await(Stream.of(resolve(sentinel))); return observe(function(x) { expect(x).toBe(sentinel); }, s); }); });
require('buster').spec.expose(); var expect = require('buster').expect; var await = require('../lib/combinators/await').await; var delay = require('../lib/combinators/timed').delay; var observe = require('../lib/combinators/observe').observe; var reduce = require('../lib/combinators/reduce').reduce; var Stream = require('../lib/Stream'); var promise = require('../lib/promises'); var resolve = promise.Promise.resolve; var delayedPromise = promise.delay; var streamHelper = require('./helper/stream-helper'); var createTestScheduler = streamHelper.createTestScheduler; var sentinel = { value: 'sentinel' }; function identity(x) { return x; } describe('await', function() { it('should await promises', function() { var s = await(Stream.of(resolve(sentinel))); return observe(function(x) { expect(x).toBe(sentinel); }, s); }); it('should preserve event order', function() { var scheduler = createTestScheduler(); var slow = delayedPromise(10, 1, scheduler); var fast = resolve(sentinel); // delayed promise followed by already fulfilled promise var s = await(Stream.from([slow, fast])); var result = reduce(function(a, x) { return a.concat(x); }, [], s).then(function(a) { expect(a).toEqual([1, sentinel]); }); scheduler.tick(10, 1); return result; }); });
Test that await preserves event order
Test that await preserves event order
JavaScript
mit
mostjs/core,mostjs/core,axefrog/most,axefrog/core,nissoh/core,cujojs/most
--- +++ @@ -2,9 +2,16 @@ var expect = require('buster').expect; var await = require('../lib/combinators/await').await; +var delay = require('../lib/combinators/timed').delay; var observe = require('../lib/combinators/observe').observe; +var reduce = require('../lib/combinators/reduce').reduce; var Stream = require('../lib/Stream'); -var resolve = require('../lib/promises').Promise.resolve; +var promise = require('../lib/promises'); +var resolve = promise.Promise.resolve; +var delayedPromise = promise.delay; + +var streamHelper = require('./helper/stream-helper'); +var createTestScheduler = streamHelper.createTestScheduler; var sentinel = { value: 'sentinel' }; @@ -22,4 +29,22 @@ }, s); }); + it('should preserve event order', function() { + var scheduler = createTestScheduler(); + var slow = delayedPromise(10, 1, scheduler); + var fast = resolve(sentinel); + + // delayed promise followed by already fulfilled promise + var s = await(Stream.from([slow, fast])); + + var result = reduce(function(a, x) { + return a.concat(x); + }, [], s).then(function(a) { + expect(a).toEqual([1, sentinel]); + }); + + scheduler.tick(10, 1); + return result; + }); + });
5d667bf9f7df2f07ec3bac215e23f5621efe739b
app/scripts/src/content/item.js
app/scripts/src/content/item.js
'use strict'; /* This was necessary to priorize Star Wars: The Clone Wars (2008) over Star Wars: Clone Wars (2003). I left this object because it could be useful for other movies/shows */ var fullTitles = { 'Star Wars: The Clone Wars': '"Star Wars: The Clone Wars"', 'The Office (U.S.)': 'The Office (US)', 'The Blind Side': '"The Blind Side"', 'The Avengers': '"The Avengers"', 'The Seven Deadly Sins': '"The Seven Deadly Sins"' } function Item(options) { this.title = fullTitles[options.title] || options.title; this.type = options.type; if (this.type === 'show') { this.epTitle = options.epTitle; this.season = options.season; this.episode = options.episode; } } module.exports = Item;
'use strict'; /* This was necessary to priorize Star Wars: The Clone Wars (2008) over Star Wars: Clone Wars (2003). I left this object because it could be useful for other movies/shows */ var fullTitles = { 'Star Wars: The Clone Wars': '"Star Wars: The Clone Wars"', 'The Office (U.S.)': 'The Office (US)', 'The Blind Side': '"The Blind Side"', 'The Avengers': '"The Avengers"', 'The Seven Deadly Sins': '"The Seven Deadly Sins"', 'Young and Hungry': '"Young and Hungry"', 'The 100': '"The 100"' } function Item(options) { this.title = fullTitles[options.title] || options.title; this.type = options.type; if (this.type === 'show') { this.epTitle = options.epTitle; this.season = options.season; this.episode = options.episode; } } module.exports = Item;
Add Young and Hungry and The 100 to fullTitles search
Add Young and Hungry and The 100 to fullTitles search
JavaScript
mit
MrMamen/traktflix,tegon/traktflix,tegon/traktflix,MrMamen/traktflix
--- +++ @@ -7,7 +7,9 @@ 'The Office (U.S.)': 'The Office (US)', 'The Blind Side': '"The Blind Side"', 'The Avengers': '"The Avengers"', - 'The Seven Deadly Sins': '"The Seven Deadly Sins"' + 'The Seven Deadly Sins': '"The Seven Deadly Sins"', + 'Young and Hungry': '"Young and Hungry"', + 'The 100': '"The 100"' } function Item(options) {
da8c91153b1eb24b14927ad8b49f4ebf5465340d
test/karma.conf.js
test/karma.conf.js
module.exports = function (config) { var CI = process.env.CI; config.set({ basePath: '..', frameworks: ['mocha', 'chai'], browsers: CI ? ['PhantomJS'] : ['Chrome', 'Firefox', 'IE'], files: [ 'http://jdataview.github.io/dist/jdataview.js', 'dist/browser/jbinary.js', 'test/karma.mocha.conf.js', 'test/test.js', {pattern: 'test/123.tar', included: false, served: true} ], logLevel: CI ? config.LOG_ERROR : config.LOG_INFO, reporters: [CI ? 'dots' : 'progress'] }); };
module.exports = function (config) { var CI = process.env.CI; config.set({ basePath: '..', frameworks: ['mocha', 'chai'], browsers: CI ? ['PhantomJS', 'Firefox'] : ['Chrome', 'Firefox', 'IE'], files: [ 'http://jdataview.github.io/dist/jdataview.js', 'dist/browser/jbinary.js', 'test/karma.mocha.conf.js', 'test/test.js', {pattern: 'test/123.tar', included: false, served: true} ], logLevel: CI ? config.LOG_ERROR : config.LOG_INFO, reporters: [CI ? 'dots' : 'progress'] }); };
Include Firefox for CI testing.
Include Firefox for CI testing.
JavaScript
mit
dark5un/jBinary,jDataView/jBinary,dark5un/jBinary,npmcomponent/jDataView-jBinary
--- +++ @@ -4,7 +4,7 @@ config.set({ basePath: '..', frameworks: ['mocha', 'chai'], - browsers: CI ? ['PhantomJS'] : ['Chrome', 'Firefox', 'IE'], + browsers: CI ? ['PhantomJS', 'Firefox'] : ['Chrome', 'Firefox', 'IE'], files: [ 'http://jdataview.github.io/dist/jdataview.js', 'dist/browser/jbinary.js',
edf7ecdcc5d6a2bd6268be7b9bf213edb4baa9ca
jest/moveSnapshots.js
jest/moveSnapshots.js
const fs = require('fs') const glob = require('glob') const outputDirectory = [process.env.CIRCLE_ARTIFACTS, 'snapshots'] .filter(x => x) .join('/') const createDir = dir => { const splitPath = dir.split('/') splitPath.reduce((path, subPath) => { if (!fs.existsSync(path)) { console.log(`Create directory at ${path}.`); fs.mkdirSync(path) } return `${path}/${subPath}` }) } glob('src/__snapshots__/*.snap', {}, (er, files) => { files.forEach(fileName => { const newName = fileName .replace(/__snapshots__\//g, '') .replace('src/', `${outputDirectory}/`) console.log(`Move file ${fileName} to ${newName}.`); createDir(newName) fs.renameSync(fileName, newName) }) glob('src/__snapshots__', {}, (er, files) => { files.forEach(fileName => { fs.rmdirSync(fileName) }) }) })
const fs = require('fs') const glob = require('glob') const outputDirectory = [process.env.$CIRCLE_ARTIFACTS, 'snapshots'] .filter(x => x) .join('/') const createDir = dir => { const splitPath = dir.split('/') splitPath.reduce((path, subPath) => { if (!fs.existsSync(path)) { console.log(`Create directory at ${path}.`); fs.mkdirSync(path) } return `${path}/${subPath}` }) } glob('src/__snapshots__/*.snap', {}, (er, files) => { files.forEach(fileName => { const newName = fileName .replace(/__snapshots__\//g, '') .replace('src/', `${outputDirectory}/`) console.log(`Move file ${fileName} to ${newName}.`); createDir(newName) fs.renameSync(fileName, newName) }) glob('src/__snapshots__', {}, (er, files) => { files.forEach(fileName => { fs.rmdirSync(fileName) }) }) })
Fix CircleCI artifacts env path
Fix CircleCI artifacts env path
JavaScript
mit
Ciunkos/ciunkos.com
--- +++ @@ -1,7 +1,7 @@ const fs = require('fs') const glob = require('glob') -const outputDirectory = [process.env.CIRCLE_ARTIFACTS, 'snapshots'] +const outputDirectory = [process.env.$CIRCLE_ARTIFACTS, 'snapshots'] .filter(x => x) .join('/')
8f290015079b2c2dcf46077afc75c19b6dad655c
src/notifiers/slack/webtask.js
src/notifiers/slack/webtask.js
'use strict'; var util = require('util'); /** * @param {secret} SLACK_WEBHOOK_URL * @param {secret} SLACK_CHANNEL_NAME */ module.exports = function(ctx, cb) { var params = ctx.body; if (!ctx.secrets.SLACK_WEBHOOK_URL || !ctx.secrets.SLACK_CHANNEL_NAME) { return cb(new Error('"SLACK_WEBHOOK_URL" and "SLACK_CHANNEL_NAME" parameters required')); } if (!params.service || !params.members) { return cb(new Error('"service" and "members" parameters required')); } var SLACK_WEBHOOK_URL = ctx.secrets.SLACK_WEBHOOK_URL; var SLACK_CHANNEL_NAME = ctx.secrets.SLACK_CHANNEL_NAME; var slack = require('slack-notify')(SLACK_WEBHOOK_URL); var service = params.service; var members = params.members.join(', '); var messages = { tfa_disabled: util.format('Users without TFA on `%s` are %s', service, members) }; slack.send({ channel: SLACK_CHANNEL_NAME, icon_emoji: ':warning:', text: messages.tfa_disabled, unfurl_links: 0, username: 'TFA Monitor' }); cb(); };
'use strict'; const assert = require('assert'); const util = require('util'); /** * @param {secret} SLACK_WEBHOOK_URL * @param {secret} SLACK_CHANNEL_NAME * @param JSON body * * body: [{name: 'GitHub', accounts: ['john', 'mark']}] */ module.exports = (ctx, cb) => { assert(ctx.secrets.SLACK_CHANNEL_NAME, 'SLACK_CHANNEL_NAME secret is missing!'); assert(ctx.secrets.SLACK_WEBHOOK_URL, 'SLACK_WEBHOOK_URL secret is missing!'); assert(Array.isArray(ctx.body), 'Body content is not an Array!'); const slack = require('slack-notify')(ctx.secrets.SLACK_WEBHOOK_URL); slack.onError = (err) => cb(err); ctx.body.forEach(service => { let accounts = service.accounts.map(account => `*${account}*`).join(', '); let message = `Users without MFA on \`${service.name}\` are ${accounts}`; slack.send({ channel: ctx.secrets.SLACK_CHANNEL_NAME, icon_emoji: ':warning:', username: 'MFA Agent', text: message }); }); cb(); };
Update Slack notifier to use new data format.
Update Slack notifier to use new data format.
JavaScript
mit
radekk/webtask-mfa-monitor,radekk/webtask-tfa-monitor,radekk/mfa-monitor
--- +++ @@ -1,38 +1,34 @@ 'use strict'; -var util = require('util'); +const assert = require('assert'); +const util = require('util'); /** * @param {secret} SLACK_WEBHOOK_URL * @param {secret} SLACK_CHANNEL_NAME + * @param JSON body + * + * body: [{name: 'GitHub', accounts: ['john', 'mark']}] */ -module.exports = function(ctx, cb) { - var params = ctx.body; +module.exports = (ctx, cb) => { + assert(ctx.secrets.SLACK_CHANNEL_NAME, 'SLACK_CHANNEL_NAME secret is missing!'); + assert(ctx.secrets.SLACK_WEBHOOK_URL, 'SLACK_WEBHOOK_URL secret is missing!'); + assert(Array.isArray(ctx.body), 'Body content is not an Array!'); - if (!ctx.secrets.SLACK_WEBHOOK_URL || !ctx.secrets.SLACK_CHANNEL_NAME) { - return cb(new Error('"SLACK_WEBHOOK_URL" and "SLACK_CHANNEL_NAME" parameters required')); - } + const slack = require('slack-notify')(ctx.secrets.SLACK_WEBHOOK_URL); + slack.onError = (err) => cb(err); - if (!params.service || !params.members) { - return cb(new Error('"service" and "members" parameters required')); - } - - var SLACK_WEBHOOK_URL = ctx.secrets.SLACK_WEBHOOK_URL; - var SLACK_CHANNEL_NAME = ctx.secrets.SLACK_CHANNEL_NAME; - var slack = require('slack-notify')(SLACK_WEBHOOK_URL); - var service = params.service; - var members = params.members.join(', '); - var messages = { - tfa_disabled: util.format('Users without TFA on `%s` are %s', service, members) - }; + ctx.body.forEach(service => { + let accounts = service.accounts.map(account => `*${account}*`).join(', '); + let message = `Users without MFA on \`${service.name}\` are ${accounts}`; slack.send({ - channel: SLACK_CHANNEL_NAME, + channel: ctx.secrets.SLACK_CHANNEL_NAME, icon_emoji: ':warning:', - text: messages.tfa_disabled, - unfurl_links: 0, - username: 'TFA Monitor' + username: 'MFA Agent', + text: message }); + }); - cb(); + cb(); };
ea2f8dce2e4c331f69aaca71823e12593ad25d6f
ui/main.js
ui/main.js
// Blank the document so the 404 page doesn't show up visibly. document.documentElement.style.display = 'none'; // Can't use DOMContentLoaded, calling document.write or document.close inside it from // inside an extension causes a crash. onload = function() { document.write("<!DOCTYPE html><script src='" + resolveUrl("bower_components/platform/platform.js") + "'></script><cr-app></cr-app>"); document.close(); document.documentElement.style.display = ''; document.head.appendChild(createLink("import", "bower_components/polymer/polymer.html")); document.head.appendChild(createLink("import", "ui/cr-app.html")); document.head.appendChild(createLink("stylesheet", "ui/style.css")); };
// Blank the document so the 404 page doesn't show up visibly. document.documentElement.style.display = 'none'; // Can't use DOMContentLoaded, calling document.write or document.close inside it from // inside an extension causes a crash. onload = function() { document.write( "<!DOCTYPE html>" + "<meta name=viewport content='width=device-width, user-scalable=no'>" + "<script src='" + resolveUrl("bower_components/platform/platform.js") + "'></script>" + "<cr-app></cr-app>" ); document.close(); document.documentElement.style.display = ''; document.head.appendChild(createLink("import", "bower_components/polymer/polymer.html")); document.head.appendChild(createLink("import", "ui/cr-app.html")); document.head.appendChild(createLink("stylesheet", "ui/style.css")); };
Add a meta viewport. The app doesn't quite look right on mobile, but at least this paves the way.
Add a meta viewport. The app doesn't quite look right on mobile, but at least this paves the way.
JavaScript
bsd-3-clause
esprehn/chromium-codereview,esprehn/chromium-codereview
--- +++ @@ -5,7 +5,12 @@ // Can't use DOMContentLoaded, calling document.write or document.close inside it from // inside an extension causes a crash. onload = function() { - document.write("<!DOCTYPE html><script src='" + resolveUrl("bower_components/platform/platform.js") + "'></script><cr-app></cr-app>"); + document.write( + "<!DOCTYPE html>" + + "<meta name=viewport content='width=device-width, user-scalable=no'>" + + "<script src='" + resolveUrl("bower_components/platform/platform.js") + "'></script>" + + "<cr-app></cr-app>" + ); document.close(); document.documentElement.style.display = '';
6b3018fdece04e9c8328a4609ab34c20ad012598
test/karma.conf.js
test/karma.conf.js
module.exports = function (config) { config.set({ frameworks: ['browserify', 'mocha'], reporters: ['mocha'], preprocessors: { 'build/karma.js': ['browserify'] }, browserify: { debug: true }, client: { mocha: { timeout: 10000 } }, files: ['build/karma.js'], colors: true, singleRun: true, logLevel: config.LOG_INFO }); };
module.exports = function (config) { config.set({ frameworks: ['browserify', 'mocha'], reporters: ['mocha'], preprocessors: { 'build/karma.js': ['browserify'] }, browserify: { debug: true }, client: { mocha: { timeout: 30000 } }, files: ['build/karma.js'], colors: true, singleRun: true, logLevel: config.LOG_INFO }); };
Increase timeout for Travis test
Increase timeout for Travis test
JavaScript
bsd-3-clause
jupyter/jupyter-js-services,jupyterlab/services,blink1073/services,blink1073/jupyter-js-services,minrk/jupyter-js-services,jupyter/jupyter-js-services,blink1073/jupyter-js-services,blink1073/services,blink1073/services,minrk/jupyter-js-services,blink1073/jupyter-js-services,blink1073/services,jupyterlab/services,jupyter/jupyter-js-services,jupyterlab/services,jupyterlab/services,minrk/jupyter-js-services,jupyter/jupyter-js-services,minrk/jupyter-js-services,blink1073/jupyter-js-services
--- +++ @@ -4,7 +4,7 @@ reporters: ['mocha'], preprocessors: { 'build/karma.js': ['browserify'] }, browserify: { debug: true }, - client: { mocha: { timeout: 10000 } }, + client: { mocha: { timeout: 30000 } }, files: ['build/karma.js'], colors: true, singleRun: true,
7f4821f63a9eb0679191b0cae6057b62ec4b0572
src/vdom/dom.js
src/vdom/dom.js
function createElement (el) { const realNode = document.createElement(el.tagName); if (el.attributes) { for (let a = 0; a < el.attributes.length; a++) { const attr = el.attributes[a]; const name = attr.name; const value = attr.value; if (!value) { continue; } if (name === 'content') { if (Array.isArray(value)) { value.forEach(ch => realNode.appendChild(render(ch))); } else { realNode.appendChild(render(value)); } } else { realNode.setAttribute(name, value); } } } if (el.childNodes) { const frag = document.createDocumentFragment(); for (let a = 0; a < el.childNodes.length; a++) { const ch = el.childNodes[a]; if (ch) { frag.appendChild(render(ch)); } } if (realNode.hasOwnProperty('content')) { realNode.content = frag; } else { realNode.appendChild(frag); } } return realNode; } function createText (el) { return document.createTextNode(el.textContent); } export default function render (el) { if (el instanceof Node) { return el; } const realNode = el.tagName ? createElement(el) : createText(el); return el.__realNode = realNode; }
function createElement (el) { const realNode = document.createElement(el.tagName); if (el.attributes) { for (let a = 0; a < el.attributes.length; a++) { const attr = el.attributes[a]; const name = attr.name; const value = attr.value; if (!value) { continue; } if (name === 'content') { if (Array.isArray(value)) { value.forEach(ch => realNode.appendChild(render(ch))); } else { realNode.appendChild(render(value)); } } else if (name.indexOf('on') === 0) { realNode.addEventListener(name.substring(2).toLowerCase(), value); } else { realNode.setAttribute(name, value); } } } if (el.childNodes) { const frag = document.createDocumentFragment(); for (let a = 0; a < el.childNodes.length; a++) { const ch = el.childNodes[a]; if (ch) { frag.appendChild(render(ch)); } } if (realNode.hasOwnProperty('content')) { realNode.content = frag; } else { realNode.appendChild(frag); } } return realNode; } function createText (el) { return document.createTextNode(el.textContent); } export default function render (el) { if (el instanceof Node) { return el; } const realNode = el.tagName ? createElement(el) : createText(el); return el.__realNode = realNode; }
Add event automation for on prefixes.
Add event automation for on prefixes.
JavaScript
mit
skatejs/dom-diff
--- +++ @@ -17,6 +17,8 @@ } else { realNode.appendChild(render(value)); } + } else if (name.indexOf('on') === 0) { + realNode.addEventListener(name.substring(2).toLowerCase(), value); } else { realNode.setAttribute(name, value); }
9eb190f80faceee9a431925207049fcbc5cf0a38
src/react-web3/Web3Provider.js
src/react-web3/Web3Provider.js
import React, { Component } from 'react'; import PropTypes from 'prop-types' class Web3Provider extends Component { render() { if (window.web3) { return this.props.children } return <this.props.web3UnavailableScreen /> } getChildContext() { return { web3: window.web3 } } } Web3Provider.childContextTypes = { web3: PropTypes.object } export default Web3Provider;
import React, { Component } from 'react' import PropTypes from 'prop-types' import Web3 from 'web3' const ONE_SECOND = 1000; class Web3Provider extends Component { constructor(props, context) { super(props, context) this.state = { selectedAccount: null } this.web3 = null this.interval = null } render() { const { web3UnavailableScreen: Web3UnavailableScreen } = this.props if (window.web3) { if (!this.web3) { this.web3 = new Web3(window.web3.currentProvider); this.fetchAccounts() } return this.props.children } return <Web3UnavailableScreen /> } componentDidMount() { this.initPoll(); } initPoll = () => { if (!this.interval) { this.interval = setInterval(this.fetchAccounts, ONE_SECOND) } } fetchAccounts = () => { const { web3 } = this const { onChangeAccount } = this.props if (!web3 || !web3.eth) { return } return web3.eth.getAccounts() .then(accounts => { if (!accounts || !accounts.length) { return } let curr = this.state.selectedAccount let next = accounts[0] curr = curr && curr.toLowerCase() next = next && next.toLowerCase() const didChange = curr && next && (curr !== next) if (didChange && typeof onChangeAccount === 'function') { onChangeAccount(next) } this.setState({ selectedAccount: next || null }) }) } getChildContext() { return { web3: this.web3, selectedAccount: this.state.selectedAccount } } } Web3Provider.childContextTypes = { web3: PropTypes.object, selectedAccount: PropTypes.string } export default Web3Provider;
Add onChangeAccount callback and selectedAccount context variable
Add onChangeAccount callback and selectedAccount context variable
JavaScript
mit
oraclesorg/ico-wizard,oraclesorg/ico-wizard,oraclesorg/ico-wizard
--- +++ @@ -1,24 +1,88 @@ -import React, { Component } from 'react'; +import React, { Component } from 'react' import PropTypes from 'prop-types' +import Web3 from 'web3' + +const ONE_SECOND = 1000; class Web3Provider extends Component { + constructor(props, context) { + super(props, context) + + this.state = { + selectedAccount: null + } + + this.web3 = null + this.interval = null + + } render() { + const { web3UnavailableScreen: Web3UnavailableScreen } = this.props + if (window.web3) { + if (!this.web3) { + this.web3 = new Web3(window.web3.currentProvider); + this.fetchAccounts() + } + return this.props.children } - return <this.props.web3UnavailableScreen /> + return <Web3UnavailableScreen /> + } + + componentDidMount() { + this.initPoll(); + } + + initPoll = () => { + if (!this.interval) { + this.interval = setInterval(this.fetchAccounts, ONE_SECOND) + } + } + + fetchAccounts = () => { + const { web3 } = this + const { onChangeAccount } = this.props + + if (!web3 || !web3.eth) { + return + } + + return web3.eth.getAccounts() + .then(accounts => { + if (!accounts || !accounts.length) { + return + } + + let curr = this.state.selectedAccount + let next = accounts[0] + curr = curr && curr.toLowerCase() + next = next && next.toLowerCase() + + const didChange = curr && next && (curr !== next) + + if (didChange && typeof onChangeAccount === 'function') { + onChangeAccount(next) + } + + this.setState({ + selectedAccount: next || null + }) + }) } getChildContext() { return { - web3: window.web3 + web3: this.web3, + selectedAccount: this.state.selectedAccount } } } Web3Provider.childContextTypes = { - web3: PropTypes.object + web3: PropTypes.object, + selectedAccount: PropTypes.string } export default Web3Provider;
9790f7aa9215185dbec94f20187962e0bb0af7b6
app/card/card_service.js
app/card/card_service.js
app.service("cardService", function() { this.getCardUrl = function(name) { return "http://gatherer.wizards.com/Pages/Card/Details.aspx?name=" + name; }; this.getCardImage = function(name) { return "http://gatherer.wizards.com/Handlers/Image.ashx?name=" + name + "&type=card&.jpg"; }; });
app.service("cardService", function() { this.getCardUrl = function(name) { name = this.sanitizeName_(name); return "http://gatherer.wizards.com/Pages/Card/Details.aspx?name=" + name; }; this.getCardImage = function(name) { name = this.sanitizeName_(name); return "http://gatherer.wizards.com/Handlers/Image.ashx?name=" + name + "&type=card&.jpg"; }; this.sanitizeName_ = function(name) { return name.replace("\u00C6", "Ae"); } });
Fix card image/links that have Æ in the name
Fix card image/links that have Æ in the name
JavaScript
mit
kevinpang/edhrec-site
--- +++ @@ -1,9 +1,15 @@ app.service("cardService", function() { this.getCardUrl = function(name) { + name = this.sanitizeName_(name); return "http://gatherer.wizards.com/Pages/Card/Details.aspx?name=" + name; }; this.getCardImage = function(name) { + name = this.sanitizeName_(name); return "http://gatherer.wizards.com/Handlers/Image.ashx?name=" + name + "&type=card&.jpg"; }; + + this.sanitizeName_ = function(name) { + return name.replace("\u00C6", "Ae"); + } });
63d03c065b816bedace4756350fa4c49b6da18b1
test/message.js
test/message.js
var test = require('tape') var error = require('../') test('message', function(t) { t.plan(3) var MyError = error('MyError') t.equals(MyError().name, 'MyError', 'name should be correct') t.equals(MyError('rawr').message, 'rawr', 'message should be correct') t.equals(MyError('meh').stack.split('\n')[0], 'MyError: meh', 'stack should contain name and message') })
var test = require('tape') var error = require('../') test('message', function(t) { t.plan(3) var MyError = error('MyError') t.equals(MyError().name, 'MyError', 'name should be correct') t.equals(MyError('rawr').message, 'rawr', 'message should be correct') try { throw new MyError('meh') } catch (err) { t.equals(err.stack.split('\n')[0], 'MyError: meh', 'stack should contain name and message') } })
Throw the error so IE sets the stack property
Throw the error so IE sets the stack property
JavaScript
mit
andrezsanchez/custom-error
--- +++ @@ -7,5 +7,10 @@ t.equals(MyError().name, 'MyError', 'name should be correct') t.equals(MyError('rawr').message, 'rawr', 'message should be correct') - t.equals(MyError('meh').stack.split('\n')[0], 'MyError: meh', 'stack should contain name and message') + try { + throw new MyError('meh') + } + catch (err) { + t.equals(err.stack.split('\n')[0], 'MyError: meh', 'stack should contain name and message') + } })
8efe68d397b3416d196009178e26c46194c81b27
tests/test.config.circle-ci.js
tests/test.config.circle-ci.js
module.exports = { store_url: 'http://localhost:8080', account_user: 'test:tester', account_password: 'testing', account_name: 'AUTH_test', container_name: 'test_container', object_name: 'test_object', segment_container_name: 'segment_test_container', segment_object_name: 'segment_test_object', dlo_container_name: 'dlo_test_container', dlo_object_name: 'dlo_test_object', dlo_prefix: 'dlo_prefix', slo_container_name: 'slo_test_container', slo_object_name: 'slo_test_object' };
module.exports = { store_url: 'http://localhost:8080', account_user: 'test', account_password: 'testing', account_name: 'tester', container_name: 'test_container', object_name: 'test_object', segment_container_name: 'segment_test_container', segment_object_name: 'segment_test_object', dlo_container_name: 'dlo_test_container', dlo_object_name: 'dlo_test_object', dlo_prefix: 'dlo_prefix', slo_container_name: 'slo_test_container', slo_object_name: 'slo_test_object' };
Fix circleci test config file
Fix circleci test config file
JavaScript
mit
Tezirg/os2
--- +++ @@ -1,8 +1,8 @@ module.exports = { store_url: 'http://localhost:8080', - account_user: 'test:tester', + account_user: 'test', account_password: 'testing', - account_name: 'AUTH_test', + account_name: 'tester', container_name: 'test_container', object_name: 'test_object', segment_container_name: 'segment_test_container',
b5a5dcf506c4be39afdc9a9a0700272f9807efaf
test/unit/index.js
test/unit/index.js
const testsContext = require.context('./specs', true, /\.spec$/); testsContext.keys().forEach(testsContext); const srcContext = require.context('../../src', true, /^\/(?!index(\.js)?$)/); srcContext.keys().forEach(srcContext);
// mock passive event listener support and upsupport (() => { const originAddListener = window.addEventListener; let flag; window.addEventListener = (...args) => { // try to read passive property and only read once time if it is accessible if (!flag && args[2] && args[2].passive) { flag = false; } originAddListener.apply(window, args); }; })(); const testsContext = require.context('./specs', true, /\.spec$/); testsContext.keys().forEach(testsContext); const srcContext = require.context('../../src', true, /^\/(?!index(\.js)?$)/); srcContext.keys().forEach(srcContext);
Improve unit tests for passive event support logic
Improve unit tests for passive event support logic
JavaScript
mit
PeachScript/vue-infinite-loading,PeachScript/vue-infinite-loading
--- +++ @@ -1,3 +1,17 @@ +// mock passive event listener support and upsupport +(() => { + const originAddListener = window.addEventListener; + let flag; + + window.addEventListener = (...args) => { + // try to read passive property and only read once time if it is accessible + if (!flag && args[2] && args[2].passive) { + flag = false; + } + originAddListener.apply(window, args); + }; +})(); + const testsContext = require.context('./specs', true, /\.spec$/); testsContext.keys().forEach(testsContext);
7aafe74a946594994027c6439c18135291aad82d
lib/tape/test.js
lib/tape/test.js
'use strict'; // MODULES // var test = require( 'tape' ); var lib = require( './../lib' ); // TESTS // test( 'main export is a function', function test( t ) { t.ok( typeof lib === 'function', 'main export is a function' ); t.end(); });
'use strict'; // MODULES // var tape = require( 'tape' ); var lib = require( './../lib' ); // TESTS // tape( 'main export is a function', function test( t ) { t.ok( typeof lib === 'function', 'main export is a function' ); t.end(); });
Update tape template so that tape is assigned to a variable of the same name
Update tape template so that tape is assigned to a variable of the same name
JavaScript
mit
kgryte/test-snippet
--- +++ @@ -2,13 +2,13 @@ // MODULES // -var test = require( 'tape' ); +var tape = require( 'tape' ); var lib = require( './../lib' ); // TESTS // -test( 'main export is a function', function test( t ) { +tape( 'main export is a function', function test( t ) { t.ok( typeof lib === 'function', 'main export is a function' ); t.end(); });
d3589b80adc8d1f358e297d880cf6404bae469c8
lib/ui/events.js
lib/ui/events.js
exports = module.exports = function (UI) { var setHistoryHeight = function () { // Set the history component dynamic height UI.components.history.height = UI.screen.height - UI.components.input.height; }; UI.screen.on('prerender', function () { setHistoryHeight(); }); UI.screen.on('resize', function () { setHistoryHeight(); UI.screen.render(); }); // If box is focused, handle `Control+s`. UI.components.input.key('C-s', function(ch, key) { var message = this.getValue(); UI.context.room.writeMessage(message); this.clearValue(); UI.screen.render(); }); // Quit on `q`, or `Control-C` when the focus is on the screen UI.screen.key(['q', 'C-c'], function (ch, key) { return process.exit(0); }); // Focus on `escape` or `i` when focus is on the screen. UI.screen.key(['escape', 'i'], function () { // Set the focus on the input. UI.components.input.focus(); }); UI.screen.key(['up', 'down'], function (ch, key) { UI.components.history[key.name](); }); };
exports = module.exports = function (UI) { var setHistoryHeight = function () { // Set the history component dynamic height UI.components.history.height = UI.screen.height - UI.components.input.height; }; UI.screen.on('prerender', function () { setHistoryHeight(); }); UI.screen.on('resize', function () { setHistoryHeight(); UI.screen.render(); }); // If box is focused, handle `Control+s`. UI.components.input.key('C-s', function(ch, key) { var message = this.getValue(); UI.context.room.writeMessage(message); this.clearValue(); UI.screen.render(); }); // Quit on `q`, or `Control-C` when the focus is on the screen UI.screen.key(['q', 'C-c'], function (ch, key) { return process.exit(0); }); // Focus on `escape` or `i` when focus is on the screen. UI.screen.key(['escape', 'i'], function () { // Set the focus on the input. UI.components.input.focus(); }); // History scrolling events. UI.screen.key(['up', 'k'], function () { UI.components.history.up(); }); UI.screen.key(['down', 'j'], function () { UI.components.history.down(); }); };
Add vi scrolling keys to scrolling key-binding
Add vi scrolling keys to scrolling key-binding
JavaScript
mit
KillerDesigner/gitter-cli,RodrigoEspinosa/gitter-cli,leohmoraes/gitter-cli,Acidburn0zzz/gitter-cli,juliosueiras/gitter-cli
--- +++ @@ -34,7 +34,12 @@ UI.components.input.focus(); }); - UI.screen.key(['up', 'down'], function (ch, key) { - UI.components.history[key.name](); + // History scrolling events. + UI.screen.key(['up', 'k'], function () { + UI.components.history.up(); }); + UI.screen.key(['down', 'j'], function () { + UI.components.history.down(); + }); + };