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
6a30ee8c3487069be065e1b82df578bbc8cd806b
src/router/index.js
src/router/index.js
import Vue from 'vue'; import VueRouter from 'vue-router'; Vue.use(VueRouter); import Home from './Home'; // import Counter from './Counter' const Counter = resolve => require.ensure([], () => resolve(require('./Counter').default), 'counter'); const GeographicalIp = resolve => require.ensure([], () => resolve(require('./GeographicalIp').default)); const routes = [ { name: 'home', path: '/', component: Home, meta: { title: 'Home' } }, { name: 'counter', path: '/counter', component: Counter, meta: { title: 'Counter' } }, { name: 'geographicalIp', path: '/geographical-ip', component: GeographicalIp, meta: { title: 'Geographical Ip' } } ] const router = new VueRouter({ routes, mode: 'history' }) export default router
import Vue from 'vue'; import VueRouter from 'vue-router'; Vue.use(VueRouter); import Home from './Home'; // import Counter from './Counter' const Counter = resolve => require.ensure([], () => resolve(require('./Counter').default), 'counter'); const GeographicalIp = resolve => require.ensure([], () => resolve(require('./GeographicalIp').default)); const routes = [ { name: 'home', path: '/', component: Home, meta: { title: 'Home' } }, { name: 'counter', path: '/counter', component: Counter, meta: { title: 'Counter' } }, { name: 'geographicalIp', path: '/geographical-ip', component: GeographicalIp, meta: { title: 'Geographical Ip' } } ] const router = new VueRouter({ routes, mode: 'history' }) router.afterEach(to => { if (to.meta.title !== undefined) { document.title = `${ to.meta.title } - Vue-vuex-starter-kit` } }) export default router
Add title for every router
feat: Add title for every router use router.afterEach to set document title.
JavaScript
mit
scopewu/vue-vuex-starter-kit,scopewu/vue-vuex-starter-kit
--- +++ @@ -41,4 +41,10 @@ mode: 'history' }) +router.afterEach(to => { + if (to.meta.title !== undefined) { + document.title = `${ to.meta.title } - Vue-vuex-starter-kit` + } +}) + export default router
77030bd69fdba772e4632443ea0328ffc4f3370b
src/components/GroupRolesView.js
src/components/GroupRolesView.js
import React from 'react' const GroupRolesView = () => ( <div/> ) export default GroupRolesView
import React from 'react' import {connect} from 'react-redux' import {compose, withHandlers, withProps, withState} from 'recompose' import {addMemberToRole, addRoleToGroup} from '../actions/groups' const mapStateToProps = ({groups}) => ({ groups }) const enhance = compose( connect(mapStateToProps), withProps(({match}) => ({ groupId: match.params.groupId })), withState('newRole', 'updateNewRole', {roleName: ''}), withHandlers({ onNewRoleNameChange: props => event => { props.updateNewRole({ ...props.newRole, roleName: event.target.value, }) }, onNewRoleSubmit: props => event => { event.preventDefault() props.dispatch(addRoleToGroup({ groupId: props.groupId, roleName: props.newRoleName, })) } }), ) const GroupRolesView = ({ groups, groupId, onNewRoleNameChange, onNewRoleSubmit, newRole, }) => ( <div> <form onSubmit={onNewRoleSubmit}> <textarea placeholder='New Role Name' value={newRole.roleName} onChange={onNewRoleNameChange} /> <input type='submit' value='submit' /> </form> </div> ) export default enhance(GroupRolesView)
Add form for role view
Add form for role view
JavaScript
mit
mg4tv/mg4tv-web,mg4tv/mg4tv-web
--- +++ @@ -1,7 +1,56 @@ import React from 'react' +import {connect} from 'react-redux' +import {compose, withHandlers, withProps, withState} from 'recompose' +import {addMemberToRole, addRoleToGroup} from '../actions/groups' -const GroupRolesView = () => ( - <div/> + +const mapStateToProps = ({groups}) => ({ + groups +}) + +const enhance = compose( + connect(mapStateToProps), + withProps(({match}) => ({ + groupId: match.params.groupId + })), + withState('newRole', 'updateNewRole', {roleName: ''}), + withHandlers({ + onNewRoleNameChange: props => event => { + props.updateNewRole({ + ...props.newRole, + roleName: event.target.value, + }) + }, + onNewRoleSubmit: props => event => { + event.preventDefault() + props.dispatch(addRoleToGroup({ + groupId: props.groupId, + roleName: props.newRoleName, + })) + } + }), ) -export default GroupRolesView +const GroupRolesView = ({ + groups, + groupId, + onNewRoleNameChange, + onNewRoleSubmit, + newRole, + }) => ( + <div> + <form onSubmit={onNewRoleSubmit}> + <textarea + placeholder='New Role Name' + value={newRole.roleName} + onChange={onNewRoleNameChange} + /> + <input + type='submit' + value='submit' + /> + </form> + </div> +) + +export default enhance(GroupRolesView)
0a0f4879d820bc0764282e15a3959d11a23842e5
jest.config.js
jest.config.js
module.exports = { preset: "ts-jest", testEnvironment: "node", moduleNameMapper: { "^(admin|site|charts|utils|db|settings)/(.*)$": "<rootDir>/$1/$2", "^settings$": "<rootDir>/settings", "^serverSettings$": "<rootDir>/serverSettings" }, setupFilesAfterEnv: ['<rootDir>/test/enzymeSetup.ts'] }
module.exports = { preset: "ts-jest", testEnvironment: "jsdom", moduleNameMapper: { "^(admin|site|charts|utils|db|settings)/(.*)$": "<rootDir>/$1/$2", "^settings$": "<rootDir>/settings", "^serverSettings$": "<rootDir>/serverSettings" }, setupFilesAfterEnv: ['<rootDir>/test/enzymeSetup.ts'] }
Switch jest environment to `jsdom`
Switch jest environment to `jsdom` Probably more appropriate? Found this is `node` when an error was thrown because `window` doesn't exist.
JavaScript
mit
owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher
--- +++ @@ -1,6 +1,6 @@ module.exports = { preset: "ts-jest", - testEnvironment: "node", + testEnvironment: "jsdom", moduleNameMapper: { "^(admin|site|charts|utils|db|settings)/(.*)$": "<rootDir>/$1/$2", "^settings$": "<rootDir>/settings",
124a16c6fee95c52f0a20a6bba3d948b2d8724c5
index.js
index.js
/* eslint-env node */ 'use strict'; const fastbootTransform = require('fastboot-transform'); const filesToImport = [ 'dependencyLibs/inputmask.dependencyLib.js', 'inputmask.js', 'inputmask.extensions.js', 'inputmask.date.extensions.js', 'inputmask.numeric.extensions.js', 'inputmask.phone.extensions.js' ]; module.exports = { name: 'ember-inputmask', options: { nodeAssets: { inputmask: () => ({ vendor: filesToImport.map(file => `dist/inputmask/${file}`), processTree: input => fastbootTransform(input) }) } }, included() { this._super.included.apply(this, arguments); filesToImport.forEach(file => { this.import(`vendor/inputmask/dist/inputmask/${file}`); }); } };
/* eslint-env node */ 'use strict'; const fastbootTransform = require('fastboot-transform'); const filesToImport = [ 'dependencyLibs/inputmask.dependencyLib.js', 'inputmask.js', 'inputmask.extensions.js', 'inputmask.date.extensions.js', 'inputmask.numeric.extensions.js', 'inputmask.phone.extensions.js' ]; module.exports = { name: 'ember-inputmask', options: { nodeAssets: { inputmask: () => ({ vendor: { include: filesToImport.map(file => `dist/inputmask/${file}`), processTree: input => fastbootTransform(input) } }) } }, included() { this._super.included.apply(this, arguments); filesToImport.forEach(file => { this.import(`vendor/inputmask/dist/inputmask/${file}`); }); } };
Make fastboot transform actually work
Make fastboot transform actually work
JavaScript
mit
pzuraq/ember-inputmask,blimmer/ember-inputmask,pzuraq/ember-inputmask,blimmer/ember-inputmask
--- +++ @@ -17,8 +17,10 @@ options: { nodeAssets: { inputmask: () => ({ - vendor: filesToImport.map(file => `dist/inputmask/${file}`), - processTree: input => fastbootTransform(input) + vendor: { + include: filesToImport.map(file => `dist/inputmask/${file}`), + processTree: input => fastbootTransform(input) + } }) } },
86d8f1368c1757cc655b2c7e2ecc9fa7bf78dfbc
src/system/types.js
src/system/types.js
// // types.js - type predicators // BiwaScheme.isNil = function(obj){ return (obj === BiwaScheme.nil); }; BiwaScheme.isUndef = function(obj){ return (obj === BiwaScheme.undef); }; BiwaScheme.isChar = function(obj){ return (obj instanceof BiwaScheme.Char); }; BiwaScheme.isSymbol = function(obj){ return (obj instanceof BiwaScheme.Symbol); }; BiwaScheme.isPort = function(obj){ return (obj instanceof BiwaScheme.Port); }; // Note: '() is not a pair in scheme BiwaScheme.isPair = function(obj){ return (obj instanceof BiwaScheme.Pair) && (obj !== BiwaScheme.nil); }; // Note: isList returns true for '() BiwaScheme.isList = function(obj){ return (obj instanceof BiwaScheme.Pair); // should check it is proper and not cyclic.. }; BiwaScheme.isVector = function(obj){ return (obj instanceof Array) && (obj.closure_p !== true); }; BiwaScheme.isHashtable = function(obj){ return (obj instanceof BiwaScheme.Hashtable); }; BiwaScheme.isMutableHashtable = function(obj){ return (obj instanceof BiwaScheme.Hashtable) && obj.mutable; }; BiwaScheme.isClosure = function(obj){ return (obj instanceof Array) && (obj.closure_p === true); };
// // types.js - type predicators // BiwaScheme.isNil = function(obj){ return (obj === BiwaScheme.nil); }; BiwaScheme.isUndef = function(obj){ return (obj === BiwaScheme.undef); }; BiwaScheme.isChar = function(obj){ return (obj instanceof BiwaScheme.Char); }; BiwaScheme.isSymbol = function(obj){ return (obj instanceof BiwaScheme.Symbol); }; BiwaScheme.isPort = function(obj){ return (obj instanceof BiwaScheme.Port); }; // Note: '() is not a pair in scheme BiwaScheme.isPair = function(obj){ return (obj instanceof BiwaScheme.Pair) && (obj !== BiwaScheme.nil); }; // Note: isList returns true for '() BiwaScheme.isList = function(obj){ if(obj === BiwaScheme.nil) return true; // null base case if(!(obj instanceof BiwaScheme.Pair)) return false; return BiwaScheme.isList(obj.cdr); //TODO: should check if it is not cyclic.. }; BiwaScheme.isVector = function(obj){ return (obj instanceof Array) && (obj.closure_p !== true); }; BiwaScheme.isHashtable = function(obj){ return (obj instanceof BiwaScheme.Hashtable); }; BiwaScheme.isMutableHashtable = function(obj){ return (obj instanceof BiwaScheme.Hashtable) && obj.mutable; }; BiwaScheme.isClosure = function(obj){ return (obj instanceof Array) && (obj.closure_p === true); };
Fix isList to check recursively.
Fix isList to check recursively. BiwaScheme.isList (also used by assert_list) only checked to see if the obj was a pair. It now properly checks the list recursively, ending with the (new) empty list. It still does not check if it's cyclic. This is believed to cause a few test cases to fail where the test cases were relying on the old, incorrect implementation of assert_list.
JavaScript
mit
biwascheme/biwascheme.github.io,yhara/biwascheme,biwascheme/biwascheme,biwascheme/biwascheme,biwascheme/biwascheme,biwascheme/biwascheme.github.io,yhara/biwascheme
--- +++ @@ -29,8 +29,10 @@ // Note: isList returns true for '() BiwaScheme.isList = function(obj){ - return (obj instanceof BiwaScheme.Pair); - // should check it is proper and not cyclic.. + if(obj === BiwaScheme.nil) return true; // null base case + if(!(obj instanceof BiwaScheme.Pair)) return false; + return BiwaScheme.isList(obj.cdr); + //TODO: should check if it is not cyclic.. }; BiwaScheme.isVector = function(obj){
f73eb6af5d1b32dcaf53ca26fa2c99c7edd89514
src/main.js
src/main.js
'use babel' import {transform} from 'babel-core' import Path from 'path' export const compiler = true export const minifier = false export function process(contents, {rootDirectory, filePath, config}) { const beginning = contents.substr(0, 11) if (beginning !== '"use babel"' && beginning !== "'use babel'") { return null } const fileName = Path.dirname(filePath) const relativePath = Path.relative(rootDirectory, filePath) const transpiled = transform(contents, Object.assign({}, config.babel, { filename: fileName, filenameRelative: relativePath, sourceRoot: rootDirectory, sourceMaps: true, highlightCode: false })) return { contents: transpiled.code, sourceMap: transpiled.map } }
'use babel' import {transform} from 'babel-core' import Path from 'path' export const compiler = true export const minifier = false export function process(contents, {rootDirectory, filePath, config}) { const fileName = Path.dirname(filePath) const relativePath = Path.relative(rootDirectory, filePath) const transpiled = transform(contents, Object.assign({}, config.babel, { filename: fileName, filenameRelative: relativePath, sourceRoot: rootDirectory, sourceMaps: true, highlightCode: false })) return { contents: transpiled.code, sourceMap: transpiled.map } }
Remove beginning check for 'use babel'
:fire: Remove beginning check for 'use babel'
JavaScript
mit
steelbrain/ucompiler-plugin-babel
--- +++ @@ -6,11 +6,6 @@ export const compiler = true export const minifier = false export function process(contents, {rootDirectory, filePath, config}) { - const beginning = contents.substr(0, 11) - if (beginning !== '"use babel"' && beginning !== "'use babel'") { - return null - } - const fileName = Path.dirname(filePath) const relativePath = Path.relative(rootDirectory, filePath) const transpiled = transform(contents, Object.assign({}, config.babel, {
d29101b0e12007ecc4ffc0b515c3f5896702feb6
index.js
index.js
#!/usr/bin/env node 'use strict'; var program = require('commander') , gulp = require('gulp') , chalk = require('chalk') , exec = require('exec') , pjson = require('./package.json') var strings = { create: 'Creating new project', install: 'Installing dependencies', complete: 'Done!' } var paths = { basefiles: __dirname + '/assets/**/*', dotfiles: __dirname + '/assets/.*' } function notify(message) { if (!program.quiet) console.log(chalk.green(message)) } function installDependencies(name) { notify(strings.install) exec('cd ' + name + ' && npm install', function () { notify(strings.complete) }) } function newProject(name) { notify(strings.create) gulp.src([paths.basefiles, paths.dotfiles]) .pipe(gulp.dest(process.cwd() + '/' + name)) .on('end', installDependencies.bind(this, name)) } program .version(pjson.version) .option('-q, --quiet', 'Hide logging information') program .command('new <name>') .description('Scaffold out a new app with given name') .action(newProject) program.parse(process.argv);
#!/usr/bin/env node 'use strict'; var program = require('commander') , gulp = require('gulp') , chalk = require('chalk') , exec = require('exec') , pjson = require('./package.json') var strings = { create: 'Creating new project', install: 'Installing dependencies', complete: 'Done!' } var paths = { basefiles: __dirname + '/assets/**/*', dotfiles: __dirname + '/assets/.*', gitignore: __dirname + '/assets/.gitignore' } function notify(message) { if (!program.quiet) console.log(chalk.green(message)) } function installDependencies(name) { notify(strings.install) exec('cd ' + name + ' && npm install', function () { notify(strings.complete) }) } function newProject(name) { notify(strings.create) gulp.src([paths.basefiles, paths.dotfiles, paths.gitignore]) .pipe(gulp.dest(process.cwd() + '/' + name)) .on('end', installDependencies.bind(this, name)) } program .version(pjson.version) .option('-q, --quiet', 'Hide logging information') program .command('new <name>') .description('Scaffold out a new app with given name') .action(newProject) program.parse(process.argv);
Fix bug where .gitignore was not being generated
Fix bug where .gitignore was not being generated
JavaScript
mit
jinn-tool/jinn
--- +++ @@ -16,7 +16,8 @@ var paths = { basefiles: __dirname + '/assets/**/*', - dotfiles: __dirname + '/assets/.*' + dotfiles: __dirname + '/assets/.*', + gitignore: __dirname + '/assets/.gitignore' } function notify(message) { @@ -35,7 +36,7 @@ function newProject(name) { notify(strings.create) - gulp.src([paths.basefiles, paths.dotfiles]) + gulp.src([paths.basefiles, paths.dotfiles, paths.gitignore]) .pipe(gulp.dest(process.cwd() + '/' + name)) .on('end', installDependencies.bind(this, name)) }
12ab81512d58c257decb5a4997a74bb662934098
index.js
index.js
'use strict'; const seneca = require('seneca')() const senecaContet = require('seneca-context') seneca.add({role:'api', cmd:'post'}, (args, done) => { seneca.make('blog/posts').save$(args.post, done) }) seneca.act({role:'web', use:{ prefix: '/api/', pin: {role:'api', cmd:'*'}, map: { 'post': {GET: true} } }}) const app = require('express')() const bodyparser = require('body-parser') app.use(bodyparser.json()) app.use(bodyparser.urlencoded({ extended: true })) app.use(seneca.export('web')) app.listen(8020)
'use strict' const seneca = require('seneca')() const senecaContext = require('seneca-context') seneca.use(require('seneca-context/plugins/setContext'), {createContext: (req, res, context, done) => { const tenant = req.hostname.match(/([^\.]+)/)[1] setImmediate(() => done(null, {tenant})) }}) seneca.add({role:'api', cmd:'post'}, function (args, done) { const si = this console.log('Context is', senecaContext.getContext(si).tenant) si.make('blog/posts').save$(args.post, done) }) seneca.act({role:'web', use:{ prefix: '/api/', pin: {role:'api', cmd:'*'}, map: { 'post': {GET: true} } }}) const app = require('express')() const bodyparser = require('body-parser') app.use(bodyparser.json()) app.use(bodyparser.urlencoded({ extended: true })) app.use(seneca.export('web')) app.listen(8020)
Add tenant context based on subdomain
Add tenant context based on subdomain
JavaScript
mit
eoinsha/seneca-mt-demo
--- +++ @@ -1,9 +1,16 @@ -'use strict'; +'use strict' const seneca = require('seneca')() -const senecaContet = require('seneca-context') +const senecaContext = require('seneca-context') -seneca.add({role:'api', cmd:'post'}, (args, done) => { - seneca.make('blog/posts').save$(args.post, done) +seneca.use(require('seneca-context/plugins/setContext'), {createContext: (req, res, context, done) => { + const tenant = req.hostname.match(/([^\.]+)/)[1] + setImmediate(() => done(null, {tenant})) +}}) + +seneca.add({role:'api', cmd:'post'}, function (args, done) { + const si = this + console.log('Context is', senecaContext.getContext(si).tenant) + si.make('blog/posts').save$(args.post, done) }) seneca.act({role:'web', use:{
58f2b85604c59880d50dff79011022ed4f2bc248
index.js
index.js
const React = require('react'); var { NativeModules, Platform } = require('react-native'); if (Platform.OS === 'android') { module.exports = { get(dim) { try { if(!NativeModules.ExtraDimensions) { throw "ExtraDimensions not defined. Try rebuilding your project. e.g. react-native run-android"; } const result = NativeModules.ExtraDimensions[dim]; if(typeof result !== 'number') { return result; } return result; } catch (e) { console.error(e); } } }; } else { module.exports = { get(dim) { console.warn('react-native-extra-dimensions-android is only available on Android'); return 0; } }; }
const React = require('react'); var { NativeModules, Platform } = require('react-native'); if (Platform.OS === 'android') { module.exports = { get(dim) { try { if(!NativeModules.ExtraDimensions) { throw "ExtraDimensions not defined. Try rebuilding your project. e.g. react-native run-android"; } const result = NativeModules.ExtraDimensions[dim]; if(typeof result !== 'number') { return result; } return result; } catch (e) { console.error(e); } }, getRealWidthHeight() { return this.get('REAL_WINDOW_HEIGHT'); }, getRealWindowWidth() { return this.get('REAL_WIDTH_WIDTH'); }, getStatusBarHeight() { return this.get('STATUS_BAR_HEIGHT'); }, getSoftMenuBarHeight() { return this.get('SOFT_MENU_BAR_HEIGHT'); }, getSmartBarHeight() { return this.get('SMART_BAR_HEIGHT'); }, isSoftMenuBarEnabled() { return this.get('SOFT_MENU_BAR_ENABLED'); } }; } else { module.exports = { get(dim) { console.warn('react-native-extra-dimensions-android is only available on Android'); return 0; } }; }
Make constants accessible through funcs
Make constants accessible through funcs Each constant is not accessible through a function. This should make autocomplete within IDE's much easier
JavaScript
isc
jaysoo/react-native-extra-dimensions-android,Sunhat/react-native-extra-dimensions-android,Sunhat/react-native-extra-dimensions-android,jaysoo/react-native-extra-dimensions-android
--- +++ @@ -17,6 +17,24 @@ } catch (e) { console.error(e); } + }, + getRealWidthHeight() { + return this.get('REAL_WINDOW_HEIGHT'); + }, + getRealWindowWidth() { + return this.get('REAL_WIDTH_WIDTH'); + }, + getStatusBarHeight() { + return this.get('STATUS_BAR_HEIGHT'); + }, + getSoftMenuBarHeight() { + return this.get('SOFT_MENU_BAR_HEIGHT'); + }, + getSmartBarHeight() { + return this.get('SMART_BAR_HEIGHT'); + }, + isSoftMenuBarEnabled() { + return this.get('SOFT_MENU_BAR_ENABLED'); } }; } else {
5561f959ae4a33bd47ccc76ebbef01807e3e8a9c
index.js
index.js
"use strict"; global.use = function (path) { if(path === 'config'){ return require.main.require('./' + path); }else{ return require('./' + path); } }; const Server = use('core/server'); const Message = use('core/messages'); Message.request.addInterceptor(function requestInterceptorLogConsole(){ console.log('-> Request interceptor to: ' + this.request.path); }); Message.response.addInterceptor(function responseInterceptorLogConsole(body){ console.log('<- Response interceptor from: ' + this.request.path); return body; }); Message.response.addInterceptor(function responseInterceptorAddServerNameHeader(body){ this.response.headers['Server'] = 'Dominion'; return body; }); module.exports = new Server();
global.use = function (path) { if (path === "config") { return require.main.require("./" + path); } else { return require("./" + path); } }; const Config = use("config"); const Server = use("core/server"); const Message = use("core/messages"); if (Config.env.development) { Message.request.addInterceptor(function requestInterceptorLogConsole() { console.log("-> Request interceptor to: " + this.request.path); }); Message.response.addInterceptor(function responseInterceptorLogConsole(body) { console.log("<- Response interceptor from: " + this.request.path); return body; }); } Message.response.addInterceptor(function responseInterceptorAddServerNameHeader(body) { this.response.headers["Server"] = "Dominion"; return body; }); module.exports = new Server();
Add console interceptors only in dev env
Add console interceptors only in dev env
JavaScript
mit
yura-chaikovsky/dominion
--- +++ @@ -1,27 +1,29 @@ -"use strict"; global.use = function (path) { - if(path === 'config'){ - return require.main.require('./' + path); - }else{ - return require('./' + path); + if (path === "config") { + return require.main.require("./" + path); + } else { + return require("./" + path); } }; -const Server = use('core/server'); -const Message = use('core/messages'); +const Config = use("config"); +const Server = use("core/server"); +const Message = use("core/messages"); -Message.request.addInterceptor(function requestInterceptorLogConsole(){ - console.log('-> Request interceptor to: ' + this.request.path); -}); +if (Config.env.development) { + Message.request.addInterceptor(function requestInterceptorLogConsole() { + console.log("-> Request interceptor to: " + this.request.path); + }); -Message.response.addInterceptor(function responseInterceptorLogConsole(body){ - console.log('<- Response interceptor from: ' + this.request.path); - return body; -}); + Message.response.addInterceptor(function responseInterceptorLogConsole(body) { + console.log("<- Response interceptor from: " + this.request.path); + return body; + }); +} -Message.response.addInterceptor(function responseInterceptorAddServerNameHeader(body){ - this.response.headers['Server'] = 'Dominion'; +Message.response.addInterceptor(function responseInterceptorAddServerNameHeader(body) { + this.response.headers["Server"] = "Dominion"; return body; });
6613a524deee98784f9b3a282ebfbe08c38dc539
index.js
index.js
/* jshint node: true */ 'use strict'; var path = require('path'); module.exports = { name: 'ember-cli-octicons', blueprintsPath: function() { return path.join(__dirname, 'blueprints'); } };
/* jshint node: true */ 'use strict'; module.exports = { name: 'ember-cli-octicons', included: function(app) { this._super.included(app); app.import(app.bowerDirectory + '/octicons/octicons/octicons.css'); app.import(app.bowerDirectory + '/octicons/octicons/octicons.eot', { destDir: 'assets' }); app.import(app.bowerDirectory + '/octicons/octicons/octicons.woff', { destDir: 'assets' }); app.import(app.bowerDirectory + '/octicons/octicons/octicons.ttf', { destDir: 'assets' }); app.import(app.bowerDirectory + '/octicons/octicons/octicons.svg', { destDir: 'assets' }); } };
Add app.import statements for octicons css and font files
Add app.import statements for octicons css and font files
JavaScript
mit
kpfefferle/ember-cli-octicons,kpfefferle/ember-octicons,kpfefferle/ember-cli-octicons,kpfefferle/ember-octicons
--- +++ @@ -1,11 +1,16 @@ /* jshint node: true */ 'use strict'; -var path = require('path'); - module.exports = { name: 'ember-cli-octicons', - blueprintsPath: function() { - return path.join(__dirname, 'blueprints'); + + included: function(app) { + this._super.included(app); + + app.import(app.bowerDirectory + '/octicons/octicons/octicons.css'); + app.import(app.bowerDirectory + '/octicons/octicons/octicons.eot', { destDir: 'assets' }); + app.import(app.bowerDirectory + '/octicons/octicons/octicons.woff', { destDir: 'assets' }); + app.import(app.bowerDirectory + '/octicons/octicons/octicons.ttf', { destDir: 'assets' }); + app.import(app.bowerDirectory + '/octicons/octicons/octicons.svg', { destDir: 'assets' }); } };
2f2663e7010837ee11a51aaf9a837d15ded56840
src/Components/EditableTable/EditableTableHeader/index.js
src/Components/EditableTable/EditableTableHeader/index.js
import React from 'react' import PropTypes from 'prop-types' const EditableTableHeader = ({columnNames}) => { return( <div> {columnNames.map( columnName => {return <div>columnName</div>})} </div> ) } export default EditableTableHeader
import React from 'react' import PropTypes from 'prop-types' const EditableTableHeader = ({columnNames}) => { return( <div> {columnNames.map( columnName => {return <div>columnName</div>})} </div> ) } EditableTableHeader.propTypes = { columnNames: PropTypes.arrayOf(PropTypes.string).isRequired } export default EditableTableHeader
Add propTypes check to editableTableHeader
Add propTypes check to editableTableHeader
JavaScript
mit
severnsc/brewing-app,severnsc/brewing-app
--- +++ @@ -11,4 +11,8 @@ } +EditableTableHeader.propTypes = { + columnNames: PropTypes.arrayOf(PropTypes.string).isRequired +} + export default EditableTableHeader
681976d249137b65a62ecf282b7fd965abe9590f
index.js
index.js
/* jshint node: true */ 'use strict'; module.exports = { name: 'ember-devtools', isEnabled: function() { var addonConfig = this.app.project.config(this.app.env)['ember-devtools']; return addonConfig.enabled; } };
/* jshint node: true */ 'use strict'; module.exports = { name: 'ember-devtools', isEnabled: function() { var options = (this.app && this.app.options && this.app.options['ember-devtools']) || {} return options.enabled; } };
Update loading of options hash to be compatible with modern ember-cli
Update loading of options hash to be compatible with modern ember-cli
JavaScript
mit
aexmachina/ember-devtools,aexmachina/ember-devtools
--- +++ @@ -4,7 +4,7 @@ module.exports = { name: 'ember-devtools', isEnabled: function() { - var addonConfig = this.app.project.config(this.app.env)['ember-devtools']; - return addonConfig.enabled; + var options = (this.app && this.app.options && this.app.options['ember-devtools']) || {} + return options.enabled; } };
1496dad8078c3a3dc5197d4d56152ac946ee86b5
index.js
index.js
/** * Features a variety of commonly used widgets, including toolbars, text inputs, checkboxes, groups * and multiple types of buttons. * * @namespace onyx */ module.exports.version = "2.6.0-pre.16";
/** * Features a variety of commonly used widgets, including toolbars, text inputs, checkboxes, groups * and multiple types of buttons. * * @namespace onyx */ module.exports.version = "2.6.0-pre.17";
Update version string to 2.6.0-pre.17
Update version string to 2.6.0-pre.17
JavaScript
apache-2.0
enyojs/onyx,enyojs/onyx
--- +++ @@ -4,4 +4,4 @@ * * @namespace onyx */ -module.exports.version = "2.6.0-pre.16"; +module.exports.version = "2.6.0-pre.17";
de0e9f7326601b810153c6e63a2e5c189c1858c7
index.js
index.js
var fs = require('fs'); module.exports = function requireAll(options) { if (typeof options === 'string') { options = { dirname: options, filter: /(.+)\.js(on)?$/, excludeDirs: /^\.(git|svn)$/, params: params }; } var files = fs.readdirSync(options.dirname); var modules = {}; var resolve = options.resolve || identity; var map = options.map || identity; var mapSubDirectoryNames = typeof options.mapSubDirectoryNames === "undefined" ? true : options.mapSubDirectoryNames function excludeDirectory(dirname) { return options.excludeDirs && dirname.match(options.excludeDirs); } files.forEach(function (file) { var filepath = options.dirname + '/' + file; if (fs.statSync(filepath).isDirectory()) { if (excludeDirectory(file)) return; if (mapSubDirectoryNames){ file = map(file, filepath); } modules[file] = requireAll({ dirname: filepath, filter: options.filter, excludeDirs: options.excludeDirs, resolve: resolve, map: map }); } else { var match = file.match(options.filter); if (!match) return; if(!options.params) { modules[match[1]] = resolve(require(filepath)); } else { modules[match[1]] = resolve(require(filepath))(params); } } }); return modules; }; function identity(val) { return val; }
var fs = require('fs'); module.exports = function requireAll(options) { if (typeof options === 'string') { options = { dirname: options, filter: /(.+)\.js(on)?$/, excludeDirs: /^\.(git|svn)$/, params: params }; } var files = fs.readdirSync(options.dirname); var modules = {}; var resolve = options.resolve || identity; var map = options.map || identity; var mapSubDirectoryNames = typeof options.mapSubDirectoryNames === "undefined" ? true : options.mapSubDirectoryNames function excludeDirectory(dirname) { return options.excludeDirs && dirname.match(options.excludeDirs); } files.forEach(function (file) { var filepath = options.dirname + '/' + file; if (fs.statSync(filepath).isDirectory()) { if (excludeDirectory(file)) return; if (mapSubDirectoryNames){ file = map(file, filepath, false); } modules[file] = requireAll({ dirname: filepath, filter: options.filter, excludeDirs: options.excludeDirs, resolve: resolve, map: map }); } else { var match = file.match(options.filter); if (!match) return; if(!options.params) { modules[map(match[1], filepath, true)] = resolve(require(filepath)); } else { modules[map(match[1], filepath, true)] = resolve(require(filepath))(params); } } }); return modules; }; function identity(val) { return val; }
Fix merge conflict & add 3rd paramater for map function; false for directory, true for file
Fix merge conflict & add 3rd paramater for map function; false for directory, true for file
JavaScript
mit
SteveKanter/node-require-all
--- +++ @@ -28,7 +28,7 @@ if (excludeDirectory(file)) return; if (mapSubDirectoryNames){ - file = map(file, filepath); + file = map(file, filepath, false); } modules[file] = requireAll({ @@ -44,9 +44,9 @@ if (!match) return; if(!options.params) { - modules[match[1]] = resolve(require(filepath)); + modules[map(match[1], filepath, true)] = resolve(require(filepath)); } else { - modules[match[1]] = resolve(require(filepath))(params); + modules[map(match[1], filepath, true)] = resolve(require(filepath))(params); } } });
c380459c90a70a345b07ef963534d76fbac42f5d
index.js
index.js
var restify = require('restify'); var messenger = require('./lib/messenger'); var server = restify.createServer(); server.use(restify.queryParser()); server.use(restify.bodyParser()); server.use(restify.authorizationParser()); server.get('/', function (req, res, next) { res.send(200, {status: 'ok'}); }); server.post('/messages', function (req, res, next) { var phoneNumber = req.params.From; messenger.send(phoneNumber, 'Got it.'); res.send(200, {status: 'ok'}); }); server.listen(process.env.PORT || '3000', function() { console.log('%s listening at %s', server.name, server.url); });
var restify = require('restify'); var messenger = require('./lib/messenger'); var server = restify.createServer(); var users = {}; server.use(restify.queryParser()); server.use(restify.bodyParser()); server.use(restify.authorizationParser()); server.get('/', function (req, res, next) { res.send(200, {status: 'ok'}); }); server.post('/messages', function (req, res, next) { var phoneNumber = req.params.From; if users[phoneNumber] { messenger.send(phoneNumber, 'Hello, old friend.'); } else { messenger.send(phoneNumber, 'Nice to meet you.'); users[phoneNumber] = req.params; } res.send(200, {status: 'ok'}); }); server.listen(process.env.PORT || '3000', function() { console.log('%s listening at %s', server.name, server.url); });
Store phone numbers in memory and respond differently
Store phone numbers in memory and respond differently
JavaScript
mpl-2.0
rockawayhelp/emergencybadges,rockawayhelp/emergencybadges
--- +++ @@ -2,6 +2,8 @@ var messenger = require('./lib/messenger'); var server = restify.createServer(); + +var users = {}; server.use(restify.queryParser()); server.use(restify.bodyParser()); @@ -13,7 +15,14 @@ server.post('/messages', function (req, res, next) { var phoneNumber = req.params.From; - messenger.send(phoneNumber, 'Got it.'); + + if users[phoneNumber] { + messenger.send(phoneNumber, 'Hello, old friend.'); + } else { + messenger.send(phoneNumber, 'Nice to meet you.'); + users[phoneNumber] = req.params; + } + res.send(200, {status: 'ok'}); });
854f618c63fa254fef9810963d816cff0a296216
index.js
index.js
var EventEmitter = require('events').EventEmitter; var inherits = require('inherits'); module.exports = function(fn) { inherits(fn, EventEmitter); var self = new fn(); fn.prototype.addEventListener = function(ev, cb) { self.on(ev,cb); //console.log('addEventListener',ev,cb); }; global.postMessage = // unfortunately global for worker (no namespaces?) fn.prototype.postMessage = function(msg) { self.emit('message', {data:msg}); //console.log('postMessage',msg); }; return self; };
var EventEmitter = require('events').EventEmitter; var inherits = require('inherits'); module.exports = function(fn) { inherits(fn, EventEmitter); var self = new fn(); self.addEventListener = function(ev, cb) { self.on(ev,cb); }; global.postMessage = // unfortunately global for worker (no namespaces?) self.postMessage = function(msg) { self.emit('message', {data:msg}); }; return self; };
Augment instance instead of prototype
Augment instance instead of prototype
JavaScript
mit
deathcap/unworkify
--- +++ @@ -8,15 +8,13 @@ var self = new fn(); - fn.prototype.addEventListener = function(ev, cb) { + self.addEventListener = function(ev, cb) { self.on(ev,cb); - //console.log('addEventListener',ev,cb); }; global.postMessage = // unfortunately global for worker (no namespaces?) - fn.prototype.postMessage = function(msg) { + self.postMessage = function(msg) { self.emit('message', {data:msg}); - //console.log('postMessage',msg); }; return self;
5589ab5cf11d02a6ba5dd888e18fbccef7787d56
index.js
index.js
"use strict"; module.exports.Receiver = require( './lib/receiver' ); module.exports.transports = { receivers: { Express: require( './lib/transport.receiver.express' ), Local: require( './lib/transport.receiver.local' ) }, senders: { Http: require( './lib/transport.sender.http' ) } }; // convenience method for creating a receiver. module.exports.createReceiver = function( params ) { params = params || {}; var transConfig = params.transports; var receiver = new this.Receiver( { baseDir: params.baseDir } ); for ( var name in transConfig ) { if ( transConfig.hasOwnProperty( name ) && this.transports.receivers.hasOwnProperty( name ) ) { receiver.addTransport( new this.transports.receivers[ name ]( transConfig[ name ] ) ); } } return receiver; };
"use strict"; module.exports.Receiver = require( './lib/receiver' ); module.exports.transports = { receivers: { Express: require( './lib/transport.receiver.express' ), Local: require( './lib/transport.receiver.local' ) }, senders: { Http: require( './lib/transport.sender.http' ) } }; // convenience method for creating a receiver. module.exports.createReceiver = function( params ) { params = params || {}; var transConfig = params.transports; var receiver = new this.Receiver( { authorize: params.authorize, baseDir: params.baseDir } ); for ( var name in transConfig ) { if ( transConfig.hasOwnProperty( name ) && this.transports.receivers.hasOwnProperty( name ) ) { receiver.addTransport( new this.transports.receivers[ name ]( transConfig[ name ] ) ); } } return receiver; };
Add authorize to createReceiver() convenience method
Add authorize to createReceiver() convenience method
JavaScript
mit
BlueRival/json-fling
--- +++ @@ -19,6 +19,7 @@ var transConfig = params.transports; var receiver = new this.Receiver( { + authorize: params.authorize, baseDir: params.baseDir } );
378099084cd9375ab8755abb00633b9f59f375aa
index.js
index.js
var browserify = require('browserify'); var watchify = require('watchify'); var koars = require('koars-utils')({module: 'assets', asset:'js'}); module.exports = function(src, dest, excludes) { //Setup our cache, timestamp and watchify instance var cache, time = new Date(); var w = watchify(browserify(src, watchify.args)); //Exclude all specified modules if(excludes) excludes.forEach(w.exclude.bind(w)); //Run the initial bundle and listen for updates cache = bundle(); if(koars.dev()) w.on('update', function() { cache = bundle(); }); //Exclude handlebars, if needed, so we use the handlebars instance which has our helpers attached //Then bundle the files, update the timestamp and log our success/failure function bundle() { return new Promise(function(resolve, reject) { w.bundle(function(err, bundle) { if(!err) { time = new Date(); koars.log.debug('Rebuilt js bundle'); resolve(bundle); } else { koars.log.warn(err, 'Failed to build js bundle'); reject(err); } }); }); } //Return a middleware generator function to serve our cached bundle upon request return function *(next) { this.body = yield cache; this.lastModified = time; this.type = 'text/javascript'; }; };
var browserify = require('browserify'); var watchify = require('watchify'); var koars = require('koars-utils')({module: 'assets', asset:'js'}); var path = require('path'); module.exports = function(src, excludes) { //Setup our cache, timestamp and watchify instance var cache, time = new Date(); var w = watchify(browserify(path.join(process.cwd(), src), watchify.args)); //Exclude all specified modules if(excludes) excludes.forEach(w.exclude.bind(w)); //Run the initial bundle and listen for updates cache = bundle(); if(koars.dev()) w.on('update', function() { cache = bundle(); }); //Exclude handlebars, if needed, so we use the handlebars instance which has our helpers attached //Then bundle the files, update the timestamp and log our success/failure function bundle() { return new Promise(function(resolve, reject) { w.bundle(function(err, bundle) { if(!err) { time = new Date(); koars.log.debug('Rebuilt js bundle'); resolve(bundle); } else { koars.log.warn(err, 'Failed to build js bundle'); reject(err); } }); }); } //Return a middleware generator function to serve our cached bundle upon request return function *(next) { this.body = yield cache; this.lastModified = time; this.type = 'text/javascript'; }; };
Remove destination parameter and watch correct path
Remove destination parameter and watch correct path
JavaScript
bsd-3-clause
koars/browserify
--- +++ @@ -1,11 +1,12 @@ var browserify = require('browserify'); var watchify = require('watchify'); var koars = require('koars-utils')({module: 'assets', asset:'js'}); +var path = require('path'); -module.exports = function(src, dest, excludes) { +module.exports = function(src, excludes) { //Setup our cache, timestamp and watchify instance var cache, time = new Date(); - var w = watchify(browserify(src, watchify.args)); + var w = watchify(browserify(path.join(process.cwd(), src), watchify.args)); //Exclude all specified modules if(excludes) excludes.forEach(w.exclude.bind(w));
794a671862448a52c437b8a75c4c29bebdbae228
test/all.js
test/all.js
var detect = require('rtc-tools/detect'); var isTestling = typeof __testlingConsole != 'undefined'; // if we are running in testling then run the media tests if (isTestling) { require('./media'); if (! detect.moz) { // require('./media-reactive'); } } require('./profile'); require('./datachannel'); // require('./heartbeat-disconnect'); require('./custom-id'); require('./request-stream'); require('./reconnect'); require('./events'); if (! detect.moz) { require('./reactive'); require('./reactive-stream-events'); }
var detect = require('rtc-tools/detect'); var isTestling = typeof __testlingConsole != 'undefined'; // if we are running in testling then run the media tests if (isTestling) { require('./media'); if (! detect.moz) { // require('./media-reactive'); } } require('./profile'); require('./datachannel'); // require('./heartbeat-disconnect'); require('./custom-id'); require('./request-stream'); require('./events'); // we need some firefox issues resolved before all tests can be run if (! detect.moz) { // https://bugzilla.mozilla.org/show_bug.cgi?id=852665 require('./reconnect'); // https://bugzilla.mozilla.org/show_bug.cgi?id=857115 require('./reactive'); require('./reactive-stream-events'); }
Remove the reconnection tests from the firefox testsuite
Remove the reconnection tests from the firefox testsuite
JavaScript
apache-2.0
rtc-io/rtc-quickconnect,rtc-io/rtc-quickconnect
--- +++ @@ -15,10 +15,14 @@ // require('./heartbeat-disconnect'); require('./custom-id'); require('./request-stream'); -require('./reconnect'); require('./events'); +// we need some firefox issues resolved before all tests can be run if (! detect.moz) { + // https://bugzilla.mozilla.org/show_bug.cgi?id=852665 + require('./reconnect'); + + // https://bugzilla.mozilla.org/show_bug.cgi?id=857115 require('./reactive'); require('./reactive-stream-events'); }
f9bd33dafe554ddb2ff82a4f956b4fd0a4db72ac
src/Umbraco.Infrastructure/WebAssets/PreviewInitialize.js
src/Umbraco.Infrastructure/WebAssets/PreviewInitialize.js
[ 'lib/jquery/jquery.min.js', 'lib/angular/angular.js', 'lib/underscore/underscore-min.js', 'lib/umbraco/Extensions.js', 'js/app.js', 'js/umbraco.resources.js', 'js/umbraco.services.js', 'js/umbraco.interceptors.js', 'ServerVariables', 'lib/signalr/jquery.signalR.js', 'BackOffice/signalr/hubs', 'js/umbraco.preview.js' ]
[ 'lib/jquery/jquery.min.js', 'lib/angular/angular.js', 'lib/underscore/underscore-min.js', 'lib/umbraco/Extensions.js', 'js/app.js', 'js/umbraco.resources.js', 'js/umbraco.services.js', 'js/umbraco.interceptors.js', 'ServerVariables', 'lib/signalr/signalr.min.js', 'js/umbraco.preview.js' ]
Include new SignalR in preview view
Include new SignalR in preview view
JavaScript
mit
umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS
--- +++ @@ -8,7 +8,6 @@ 'js/umbraco.services.js', 'js/umbraco.interceptors.js', 'ServerVariables', - 'lib/signalr/jquery.signalR.js', - 'BackOffice/signalr/hubs', + 'lib/signalr/signalr.min.js', 'js/umbraco.preview.js' ]
149635f3119a64373b38fae4e56fc93c2db54afc
packages/lesswrong/lib/collections/subscriptions/callbacks.js
packages/lesswrong/lib/collections/subscriptions/callbacks.js
import { addCallback } from 'meteor/vulcan:core'; import { Subscriptions } from './collection' async function deleteOldSubscriptions(subscription) { const { userId, documentId, collectionName, type } = subscription Subscriptions.update({userId, documentId, collectionName, type}, {$set: {deleted: true}}, {multi: true}) } addCallback("subscription.create.async", deleteOldSubscriptions);
import { addCallback } from 'meteor/vulcan:core'; import { Subscriptions } from './collection' async function deleteOldSubscriptions(subscription) { const { userId, documentId, collectionName, type } = subscription Subscriptions.update({userId, documentId, collectionName, type}, {$set: {deleted: true}}, {multi: true}) return subscription; } addCallback("subscription.create.before", deleteOldSubscriptions);
Fix run-order issue where callback that was supposed to delete old sub, deleted new sub too
deleteOldSubscriptions: Fix run-order issue where callback that was supposed to delete old sub, deleted new sub too
JavaScript
mit
Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope
--- +++ @@ -4,6 +4,7 @@ async function deleteOldSubscriptions(subscription) { const { userId, documentId, collectionName, type } = subscription Subscriptions.update({userId, documentId, collectionName, type}, {$set: {deleted: true}}, {multi: true}) + return subscription; } -addCallback("subscription.create.async", deleteOldSubscriptions); +addCallback("subscription.create.before", deleteOldSubscriptions);
faee60fb0d23cb78b016a01ec583be95b03cdf51
bin/index.js
bin/index.js
#!/usr/bin/env node /** * This file creates a `tsconfig.json` if it doesn't already exist. * tsconfig is the recommended method for configuring TypeScript. */ /* global require process */ const exec = require('child_process').exec const path = require('path') const fs = require('fs') const cwd = process.cwd().replace (/\\/g, '/') const suffix = '/node_modules/preact-cli-plugin-typescript' const root = cwd.endsWith(suffix) ? cwd.substr(0, cwd.length - suffix.length) : cwd if (fs.access(path.join(root, 'tsconfig.json'), fs.constants.F_OK, () => {})) { console.warn('Detected an existing tsconfig - make sure you have the correct settings.') } else { // TODO: Proper node way of copying/writing files. exec with strings is nasty. exec(`cp ${path.join('src', 'tsconfig.json')} ${root}`, {cwd: root}, (error) => { if (error) { console.error(`An error occurred while creating tsconfig: ${error}`) return } }) }
#!/usr/bin/env node /** * This file creates a `tsconfig.json` if it doesn't already exist. * tsconfig is the recommended method for configuring TypeScript. */ /* global require process */ const exec = require('child_process').exec const path = require('path') const fs = require('fs') const cwd = process.cwd().replace (/\\/g, '/') const suffix = '/node_modules/preact-cli-plugin-typescript' const root = cwd.endsWith(suffix) ? cwd.substr(0, cwd.length - suffix.length) : cwd if (fs.access(path.join(root, 'tsconfig.json'), fs.constants.F_OK, () => {})) { // TODO: If file exists, get existing config and merge correct values. console.warn('Detected an existing tsconfig - make sure you have the correct settings.') } else { try { fs.createReadStream(path.join('src', 'tsconfig.json')) .pipe(fs.createWriteStream(path.join(root, 'tsconfig.json'))); } catch (e) { console.error('An error occurred while creating the tsconfig', e); } }
Move from exec to fs
Move from exec to fs
JavaScript
mit
wub/preact-cli-plugin-typescript
--- +++ @@ -15,15 +15,15 @@ const root = cwd.endsWith(suffix) ? cwd.substr(0, cwd.length - suffix.length) : cwd if (fs.access(path.join(root, 'tsconfig.json'), fs.constants.F_OK, () => {})) { + // TODO: If file exists, get existing config and merge correct values. console.warn('Detected an existing tsconfig - make sure you have the correct settings.') } else { - // TODO: Proper node way of copying/writing files. exec with strings is nasty. - - exec(`cp ${path.join('src', 'tsconfig.json')} ${root}`, {cwd: root}, (error) => { - if (error) { - console.error(`An error occurred while creating tsconfig: ${error}`) - return - } - }) + try { + fs.createReadStream(path.join('src', 'tsconfig.json')) + .pipe(fs.createWriteStream(path.join(root, 'tsconfig.json'))); + } + catch (e) { + console.error('An error occurred while creating the tsconfig', e); + } }
a5b314aa1c9a36f1311871b32ee6d94ec161cd29
config/views.js
config/views.js
module.exports= { views: [{ "name": "Raw Match Data", "view": "matches" }], matches: function (mongoCollection, callback) { mongoCollection.find().toArray(function (err, matches) { callback([ { name: "Matches", headers: [ { text: "Team", value: "team" }, { text: "Comments", value: "comments" }, { text: "Device", value: "sender" } ], data: matches } ]); db.close(); }); } };
module.exports= { views: [{ "name": "Raw Match Data", "view": "matches" }], matches: function (mongoCollection, callback) { mongoCollection .find() .sort({"_id": -1}) .toArray(function (err, matches) { callback([ { name: "Matches", headers: [ { text: "Team", value: "team" }, { text: "Comments", value: "comments" }, { text: "Device", value: "sender" } ], data: matches } ]); db.close(); }); } };
Return Raw Match Data in Inverse Order
Return Raw Match Data in Inverse Order
JavaScript
bsd-2-clause
FRCteam4909/FRC-Scouting,FRCteam4909/FRC-Scouting,FRCteam4909/FRC-Scouting
--- +++ @@ -5,29 +5,32 @@ }], matches: function (mongoCollection, callback) { - mongoCollection.find().toArray(function (err, matches) { - callback([ - { - name: "Matches", - headers: [ - { - text: "Team", - value: "team" - }, - { - text: "Comments", - value: "comments" - }, - { - text: "Device", - value: "sender" - } - ], - data: matches - } - ]); + mongoCollection + .find() + .sort({"_id": -1}) + .toArray(function (err, matches) { + callback([ + { + name: "Matches", + headers: [ + { + text: "Team", + value: "team" + }, + { + text: "Comments", + value: "comments" + }, + { + text: "Device", + value: "sender" + } + ], + data: matches + } + ]); - db.close(); - }); + db.close(); + }); } };
8b17519bcd20f691f94019be636eb474f6a1f706
server/options-handler.js
server/options-handler.js
var fs = require('fs'); var path = require('path'); var argv = require('optimist').argv; // Load options into JS object. exports.options = JSON.parse(fs.readFileSync(path.resolve(__dirname,'../'+argv.optionsFile)));
var fs = require('fs'); var path = require('path'); var argv = require('optimist').argv; // Load options into JS object. exports.options = JSON.parse(fs.readFileSync(argv.optionsFile));
Change options handler to use filepath instead of filename.
Change options handler to use filepath instead of filename.
JavaScript
mit
MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave
--- +++ @@ -3,5 +3,5 @@ var argv = require('optimist').argv; // Load options into JS object. -exports.options = JSON.parse(fs.readFileSync(path.resolve(__dirname,'../'+argv.optionsFile))); +exports.options = JSON.parse(fs.readFileSync(argv.optionsFile));
4abc3604fbe0d44e4a4a6222558613c906ca95ef
src/formatters/text_formatter.js
src/formatters/text_formatter.js
import columnify from 'columnify'; import figures from 'figures'; import chalk from 'chalk'; export default function TextFormatter(errorsGroupedByFile) { const files = Object.keys(errorsGroupedByFile); const errorsText = files .map(file => { return generateErrorsForFile(file, errorsGroupedByFile[file]); }) .join('\n\n'); const summary = generateSummary(errorsGroupedByFile); return errorsText + '\n\n' + summary + '\n'; } function generateErrorsForFile(file, errors) { const formattedErrors = errors.map(error => { const location = error.locations[0]; return { location: chalk.dim(`${location.line}:${location.column * 4}`), message: error.message, // TODO: Add rule name }; }); const errorsText = columnify(formattedErrors, { showHeaders: false, }); return chalk.underline(file) + '\n' + errorsText; } function generateSummary(errorsGroupedByFile) { const files = Object.keys(errorsGroupedByFile); const errorsCount = files.reduce((sum, file) => { return sum + errorsGroupedByFile[file].length; }, 0); if (errorsCount == 0) { return chalk.green(`${figures.tick} 0 errors detected\n`); } const summary = chalk.red( `${figures.cross} ${errorsCount} error` + (errorsCount > 1 ? 's' : '') + ' detected' ); return summary; }
import columnify from 'columnify'; import figures from 'figures'; import chalk from 'chalk'; export default function TextFormatter(errorsGroupedByFile) { const files = Object.keys(errorsGroupedByFile); const errorsText = files .map(file => { return generateErrorsForFile(file, errorsGroupedByFile[file]); }) .join('\n\n'); const summary = generateSummary(errorsGroupedByFile); return errorsText + '\n\n' + summary + '\n'; } function generateErrorsForFile(file, errors) { const formattedErrors = errors.map(error => { const location = error.locations[0]; return { location: chalk.dim(`${location.line}:${location.column * 4}`), message: error.message, rule: chalk.dim(` ${error.ruleName}`), }; }); const errorsText = columnify(formattedErrors, { showHeaders: false, }); return chalk.underline(file) + '\n' + errorsText; } function generateSummary(errorsGroupedByFile) { const files = Object.keys(errorsGroupedByFile); const errorsCount = files.reduce((sum, file) => { return sum + errorsGroupedByFile[file].length; }, 0); if (errorsCount == 0) { return chalk.green(`${figures.tick} 0 errors detected\n`); } const summary = chalk.red( `${figures.cross} ${errorsCount} error` + (errorsCount > 1 ? 's' : '') + ' detected' ); return summary; }
Include name of `rule` that caused error in text formatter
Include name of `rule` that caused error in text formatter
JavaScript
mit
cjoudrey/graphql-schema-linter
--- +++ @@ -23,7 +23,7 @@ return { location: chalk.dim(`${location.line}:${location.column * 4}`), message: error.message, - // TODO: Add rule name + rule: chalk.dim(` ${error.ruleName}`), }; });
458b683a66b98ae454eac27e87a0d3951ffa9a44
src/redux/action-types.js
src/redux/action-types.js
export const RUNNING = 'RUNNING'; export const START_LOAD_RUNTIME = 'START_LOAD_RUNTIME'; export const FINISH_LOAD_RUNTIME = 'FINISH_LOAD_RUNTIME'; export const FAIL_LOAD_RUNTIME = 'FAIL_LOAD_RUNTIME';
export const START_LOAD_RUNTIME = 'START_LOAD_RUNTIME'; export const FINISH_LOAD_RUNTIME = 'FINISH_LOAD_RUNTIME'; export const FAIL_LOAD_RUNTIME = 'FAIL_LOAD_RUNTIME'; export const START_PARSE = 'START_PARSE'; export const FINISH_PARSE = 'FINISH_PARSE'; export const FAIL_PARSE = 'FAIL_PARSE'; export const START_COMPILE = 'START_COMPILE'; export const FINISH_COMPILE = 'FINISH_COMPILE'; export const FAIL_COMPILE = 'FAIL_COMPILE'; export const STOP_COMPILE = "STOP_COMPILE"; export const START_EXECUTE = 'START_EXECUTE'; export const FINISH_EXECUTE = 'FINISH_EXECUTE'; export const FAIL_EXECUTE = 'FAIL_EXECUTE'; export const STOP_EXECUTE = "STOP_EXECUTE"; export const PAUSE_RUN = 'PAUSE_RUN'; export const CLEAR_STATE = 'CLEAR_STATE';
Add action types for running code
Add action types for running code
JavaScript
apache-2.0
pcardune/pyret-ide,pcardune/pyret-ide
--- +++ @@ -1,5 +1,20 @@ -export const RUNNING = 'RUNNING'; - export const START_LOAD_RUNTIME = 'START_LOAD_RUNTIME'; export const FINISH_LOAD_RUNTIME = 'FINISH_LOAD_RUNTIME'; export const FAIL_LOAD_RUNTIME = 'FAIL_LOAD_RUNTIME'; + +export const START_PARSE = 'START_PARSE'; +export const FINISH_PARSE = 'FINISH_PARSE'; +export const FAIL_PARSE = 'FAIL_PARSE'; + +export const START_COMPILE = 'START_COMPILE'; +export const FINISH_COMPILE = 'FINISH_COMPILE'; +export const FAIL_COMPILE = 'FAIL_COMPILE'; +export const STOP_COMPILE = "STOP_COMPILE"; + +export const START_EXECUTE = 'START_EXECUTE'; +export const FINISH_EXECUTE = 'FINISH_EXECUTE'; +export const FAIL_EXECUTE = 'FAIL_EXECUTE'; +export const STOP_EXECUTE = "STOP_EXECUTE"; + +export const PAUSE_RUN = 'PAUSE_RUN'; +export const CLEAR_STATE = 'CLEAR_STATE';
69bdc2ba08689ea7065ca0f23eda0a3c840b4d89
src/js/components/TabPanel/Measurement.js
src/js/components/TabPanel/Measurement.js
import Measurement from 'esri/dijit/Measurement'; import React, { Component, PropTypes } from 'react'; export default class InfoWindow extends Component { static contextTypes = { map: PropTypes.object.isRequired } initialized = false componentWillUpdate(prevProps) { if ( this.context.map.loaded // the Measurement tool depends on navigationManager so we // need to explicitly check for that before starting the widget && this.context.map.navigationManager && !this.initialized ) { this.initialized = true; const measurementDiv = document.createElement('DIV'); this.measurementContainer.appendChild(measurementDiv); this.measurement = new Measurement({ map: this.context.map }, measurementDiv); this.measurement.startup(); this.measurement.on('measure-end', (event) => { // deactivate the tool after drawing const toolName = event.toolName; this.measurement.setTool(toolName, false); }); } if (prevProps.activeWebmap !== undefined && prevProps.activeWebmap !== this.props.activeWebmap) { if (this.context.map.destroy && this.initialized) { this.measurement.clearResult(); this.initialized = false; } } } componentWillUnmount() { this.measurement.destroy(); } render () { return <div ref={(div) => { this.measurementContainer = div; }} className='measurement-container' />; } }
import Measurement from 'esri/dijit/Measurement'; import React, { Component, PropTypes } from 'react'; export default class InfoWindow extends Component { static contextTypes = { map: PropTypes.object.isRequired } initialized = false componentWillUpdate(prevProps) { if ( this.context.map.loaded // the Measurement tool depends on navigationManager so we // need to explicitly check for that before starting the widget && this.context.map.navigationManager && !this.initialized ) { this.initialized = true; const measurementDiv = document.createElement('DIV'); this.measurementContainer.appendChild(measurementDiv); this.measurement = new Measurement({ map: this.context.map }, measurementDiv); this.measurement.startup(); // this.measurement.on('measure-end', (event) => { // // deactivate the tool after drawing // const toolName = event.toolName; // this.measurement.setTool(toolName, false); // }); } if (prevProps.activeWebmap !== undefined && prevProps.activeWebmap !== this.props.activeWebmap) { if (this.context.map.destroy && this.initialized) { this.measurement.clearResult(); this.initialized = false; } } } componentWillUnmount() { this.measurement.destroy(); } render () { return <div ref={(div) => { this.measurementContainer = div; }} className='measurement-container' />; } }
Remove measurement on-end event listener that was preventing the measurement result from being displayed
Remove measurement on-end event listener that was preventing the measurement result from being displayed
JavaScript
mit
wri/gfw-mapbuilder,wri/gfw-mapbuilder,wri/gfw-mapbuilder
--- +++ @@ -28,11 +28,11 @@ map: this.context.map }, measurementDiv); this.measurement.startup(); - this.measurement.on('measure-end', (event) => { - // deactivate the tool after drawing - const toolName = event.toolName; - this.measurement.setTool(toolName, false); - }); + // this.measurement.on('measure-end', (event) => { + // // deactivate the tool after drawing + // const toolName = event.toolName; + // this.measurement.setTool(toolName, false); + // }); } if (prevProps.activeWebmap !== undefined && prevProps.activeWebmap !== this.props.activeWebmap) {
0080f81ee471972876be9fe847f60da2c6f37fc0
app/index.js
app/index.js
'use strict'; var express = require('express'), index = require('./routes/index.js'); var app = express(); app.get('/', index.get); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Listening at http://%s:%s', host, port); });
'use strict'; var express = require('express'), index = require('./routes/index.js'); var app = express(); app.get('/', index.get); var server = app.listen(process.env.PORT || 3000, function () { var host = server.address().address; var port = server.address().port; console.log('Listening at http://%s:%s', host, port); });
Fix port to be compatible with heroku
Fix port to be compatible with heroku
JavaScript
mit
Zeikko/beating-forehead-vein-backend
--- +++ @@ -7,7 +7,7 @@ app.get('/', index.get); -var server = app.listen(3000, function () { +var server = app.listen(process.env.PORT || 3000, function () { var host = server.address().address; var port = server.address().port;
bf36d46f618163f7ee269bc8c7722513f5a9640c
src/edit/global_events.js
src/edit/global_events.js
import { onBlur } from "../display/focus.js" import { on } from "../util/event.js" // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.getElementsByClassName) return let byClass = document.getElementsByClassName("CodeMirror") for (let i = 0; i < byClass.length; i++) { let cm = byClass[i].CodeMirror if (cm) f(cm) } } let globalsRegistered = false export function ensureGlobalHandlers() { if (globalsRegistered) return registerGlobalHandlers() globalsRegistered = true } function registerGlobalHandlers() { // When the window resizes, we need to refresh active editors. let resizeTimer on(window, "resize", () => { if (resizeTimer == null) resizeTimer = setTimeout(() => { resizeTimer = null forEachCodeMirror(onResize) }, 100) }) // When the window loses focus, we want to show the editor as blurred on(window, "blur", () => forEachCodeMirror(onBlur)) } // Called when the window resizes function onResize(cm) { let d = cm.display if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) return // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null d.scrollbarsClipped = false cm.setSize() }
import { onBlur } from "../display/focus.js" import { on } from "../util/event.js" // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.getElementsByClassName) return let byClass = document.getElementsByClassName("CodeMirror") for (let i = 0; i < byClass.length; i++) { let cm = byClass[i].CodeMirror if (cm) f(cm) } } let globalsRegistered = false export function ensureGlobalHandlers() { if (globalsRegistered) return registerGlobalHandlers() globalsRegistered = true } function registerGlobalHandlers() { // When the window resizes, we need to refresh active editors. let resizeTimer on(window, "resize", () => { if (resizeTimer == null) resizeTimer = setTimeout(() => { resizeTimer = null forEachCodeMirror(onResize) }, 100) }) // When the window loses focus, we want to show the editor as blurred on(window, "blur", () => forEachCodeMirror(onBlur)) } // Called when the window resizes function onResize(cm) { let d = cm.display // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null d.scrollbarsClipped = false cm.setSize() }
Remove fast path in resize handler
Remove fast path in resize handler It can't reliably determine whether the scrollbar still needs to be clipped Closes #5445
JavaScript
mit
wingify/CodeMirror,mtaran-google/CodeMirror,nightwing/CodeMirror,namin/CodeMirror,dperetti/CodeMirror,codio/CodeMirror,namin/CodeMirror,pabloferz/CodeMirror,notepadqq/CodeMirror,codio/CodeMirror,SidPresse/CodeMirror,hackmdio/CodeMirror,codio/CodeMirror,hackmdio/CodeMirror,thomasjm/CodeMirror,notepadqq/CodeMirror,nightwing/CodeMirror,namin/CodeMirror,nightwing/CodeMirror,SidPresse/CodeMirror,thomasjm/CodeMirror,jkaplon/CodeMirror,notepadqq/CodeMirror,jkaplon/CodeMirror,dperetti/CodeMirror,mtaran-google/CodeMirror,pabloferz/CodeMirror,wingify/CodeMirror,dperetti/CodeMirror,SidPresse/CodeMirror,thomasjm/CodeMirror,jkaplon/CodeMirror,pabloferz/CodeMirror,hackmdio/CodeMirror,wingify/CodeMirror,mtaran-google/CodeMirror
--- +++ @@ -35,8 +35,6 @@ // Called when the window resizes function onResize(cm) { let d = cm.display - if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) - return // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null d.scrollbarsClipped = false
8d4a96b8cff3e4ed82aeeb1679326da265b6d42b
src/eeh-flot-directive.js
src/eeh-flot-directive.js
(function (angular) { 'use strict'; function FlotDirective(eehFlot, $interval) { return { restrict: 'AE', template: '<div class="eeh-flot"></div>', scope: { dataset: '=', options: '@', updateCallback: '&', updateCallbackTime: '@' }, link: function link(scope, element) { scope.updateCallbackTime = scope.updateCallbackTime || 1000; var renderArea = element.find('.eeh-flot'); var chart = eehFlot(renderArea, scope.dataset, scope.options); if (angular.isDefined(scope.updateCallback) && angular.isFunction(scope.updateCallback)) { $interval(function() { scope.updateCallback(chart, scope.dataset); }, scope.updateCallbackTime); } } }; } angular.module('eehFlot').directive('eehFlot', FlotDirective); })(angular);
(function (angular) { 'use strict'; function FlotDirective(eehFlot, $interval) { return { restrict: 'AE', template: '<div class="eeh-flot"></div>', scope: { dataset: '=', options: '@', updateCallback: '=', updateCallbackTime: '@' }, link: function link(scope, element) { scope.updateCallbackTime = scope.updateCallbackTime || 40; var renderArea = element.find('.eeh-flot'); var chart = eehFlot(renderArea, scope.dataset, scope.options); if (angular.isFunction(scope.updateCallback)) { $interval(function() { scope.updateCallback(chart, scope.dataset); }, scope.updateCallbackTime); } } }; } angular.module('eehFlot').directive('eehFlot', FlotDirective); })(angular);
Fix issues with callback function
Fix issues with callback function
JavaScript
mit
ethanhann/eeh-flot
--- +++ @@ -8,15 +8,14 @@ scope: { dataset: '=', options: '@', - updateCallback: '&', + updateCallback: '=', updateCallbackTime: '@' }, link: function link(scope, element) { - scope.updateCallbackTime = scope.updateCallbackTime || 1000; + scope.updateCallbackTime = scope.updateCallbackTime || 40; var renderArea = element.find('.eeh-flot'); var chart = eehFlot(renderArea, scope.dataset, scope.options); - if (angular.isDefined(scope.updateCallback) && - angular.isFunction(scope.updateCallback)) { + if (angular.isFunction(scope.updateCallback)) { $interval(function() { scope.updateCallback(chart, scope.dataset); }, scope.updateCallbackTime);
15ad543162ca1a06e321d96e6c46ab16fef07641
randomise.js
randomise.js
function randomise ({ count = 1, min = 0, max = 100, precision = 0, join = ', ' }) { const delta = max - min const array = [] let index = count while (index-- > 0) { const number = min + Math.random() * delta const fixed = Number(number.toFixed(precision)) array.push(fixed) } const result = array.join(join) return result } module.exports = randomise
function randomise ({ count = 1, min = 0, max = 100, precision = 0, join = ', ' } = {}) { const delta = max - min const array = [] let index = count while (index-- > 0) { const number = min + Math.random() * delta const fixed = Number(number.toFixed(precision)) array.push(fixed) } const result = array.join(join) return result } module.exports = randomise
Fix default params by setting empty object
Fix default params by setting empty object
JavaScript
mit
cnlon/randomise
--- +++ @@ -4,7 +4,7 @@ max = 100, precision = 0, join = ', ' -}) { +} = {}) { const delta = max - min const array = [] let index = count
9c7befc18f142f1eed895257a099d3095f4f2f3e
src/fmi-radar-images.js
src/fmi-radar-images.js
const axios = require('axios') const sharp = require('sharp') async function fetchPostProcessedRadarFrame(url) { const data = await fetchRadarImage(url) return processImage(data) } async function fetchRadarImage(url) { const response = await axios({url, method: 'get', responseType: 'arraybuffer'}) return Buffer.from(response.data) } async function processImage(input) { const {data, info} = await sharp(input) .ensureAlpha() .raw() .toBuffer({resolveWithObject: true}) applyAlphaChannel(data) const {width, height, channels} = info const pipeline = sharp(data, {raw: {width, height, channels}}) .overlayWith(`${__dirname}/radar-edges.png`) const png = await pipeline.clone().png().toBuffer() const webp = await pipeline.clone().webp({nearLossless: true}).toBuffer() return {png, webp} } function applyAlphaChannel(data) { for (let i = 0; i < data.length; i += 4) { // eslint-disable-next-line no-bitwise, no-mixed-operators const color = data[i] << 16 | data[i + 1] << 8 | data[i + 2] if (color === 0xffffff || color === 0xf7f7f7) { data[i + 3] = 0 } } } module.exports = { fetchPostProcessedRadarFrame }
const axios = require('axios') const sharp = require('sharp') sharp.cache(false) async function fetchPostProcessedRadarFrame(url) { const data = await fetchRadarImage(url) return processImage(data) } async function fetchRadarImage(url) { const response = await axios({url, method: 'get', responseType: 'arraybuffer'}) return Buffer.from(response.data) } async function processImage(input) { const {data, info} = await sharp(input) .ensureAlpha() .raw() .toBuffer({resolveWithObject: true}) applyAlphaChannel(data) const {width, height, channels} = info const pipeline = sharp(data, {raw: {width, height, channels}}) .overlayWith(`${__dirname}/radar-edges.png`) const png = await pipeline.clone().png().toBuffer() const webp = await pipeline.clone().webp({nearLossless: true}).toBuffer() return {png, webp} } function applyAlphaChannel(data) { for (let i = 0; i < data.length; i += 4) { // eslint-disable-next-line no-bitwise, no-mixed-operators const color = data[i] << 16 | data[i + 1] << 8 | data[i + 2] if (color === 0xffffff || color === 0xf7f7f7) { data[i + 3] = 0 } } } module.exports = { fetchPostProcessedRadarFrame }
Disable sharp cache (helps with Heroku)
Disable sharp cache (helps with Heroku)
JavaScript
mit
heikkipora/sataako-fi,heikkipora/sataako-fi,heikkipora/sataako-fi,heikkipora/sataako-fi
--- +++ @@ -1,5 +1,7 @@ const axios = require('axios') const sharp = require('sharp') + +sharp.cache(false) async function fetchPostProcessedRadarFrame(url) { const data = await fetchRadarImage(url)
8ecca249abcc8f6ff4760ef3a3ee57486a6bdffe
modules/blueprint.js
modules/blueprint.js
var BlueprintClient = require('xively-blueprint-client-js'); var client = new BlueprintClient({ authorization: process.env.BLUEPRINT_AUTHORIZATION }); console.log('Client initialized with authorization >', process.env.BLUEPRINT_AUTHORIZATION); module.exports = client;
var BlueprintClient = require('xively-blueprint-client-js'); var client = new BlueprintClient({ authorization: 'Basic ' + process.env.BLUEPRINT_AUTHORIZATION }); module.exports = client;
Remove log and Prefix Authorization token with 'Basic '
Remove log and Prefix Authorization token with 'Basic ' Update your env vars
JavaScript
mit
Altoros/refill-them-api
--- +++ @@ -1,9 +1,7 @@ var BlueprintClient = require('xively-blueprint-client-js'); var client = new BlueprintClient({ - authorization: process.env.BLUEPRINT_AUTHORIZATION + authorization: 'Basic ' + process.env.BLUEPRINT_AUTHORIZATION }); -console.log('Client initialized with authorization >', process.env.BLUEPRINT_AUTHORIZATION); - module.exports = client;
3ac6057a28b2f3d2e9cee0e663b10ac0d225d99f
test/unit/specs/avfs/partials/members.js
test/unit/specs/avfs/partials/members.js
'use strict'; var chai = require('chai'); var expect = chai.expect; var Stats = require('lib/common/components/stats'); var ReadStream = require('lib/common/streams/read-stream'); var WriteStream = require('lib/common/streams/write-stream'); var SyncWriteStream = require('lib/common/streams/sync-write-stream'); module.exports = function (fs, getElement, version) { describe('members', function () { it('should expose Stats', function () { expect(fs.Stats).to.equal(Stats); }); it('should expose ReadStream', function () { expect(fs.ReadStream).to.be.a('function'); expect(new fs.ReadStream('/file')).to.be.an.instanceof(ReadStream); }); it('should expose WriteStream', function () { expect(fs.WriteStream).to.be.a('function'); expect(new fs.WriteStream('/file')).to.be.an.instanceof(WriteStream); }); if (['v0.10', 'v0.12'].indexOf(version) !== -1) { it('should expose SyncWriteStream', function () { expect(fs.SyncWriteStream).to.be.a('function'); expect(new fs.SyncWriteStream('/file')).to.be.an.instanceof(SyncWriteStream); }); } }); };
'use strict'; var chai = require('chai'); var expect = chai.expect; var Stats = require('lib/common/components/stats'); var ReadStream = require('lib/common/streams/read-stream'); var WriteStream = require('lib/common/streams/write-stream'); var SyncWriteStream = require('lib/common/streams/sync-write-stream'); module.exports = function (fs, getElement, version) { describe('members', function () { it('should expose Stats', function () { expect(fs.Stats).to.equal(Stats); }); it('should expose ReadStream', function () { expect(fs.ReadStream).to.be.a('function'); expect(new fs.ReadStream('/file')).to.be.an.instanceof(ReadStream); }); it('should expose WriteStream', function () { expect(fs.WriteStream).to.be.a('function'); expect(new fs.WriteStream('/file')).to.be.an.instanceof(WriteStream); }); if (['v0.10', 'v0.12'].indexOf(version) !== -1) { it('should expose SyncWriteStream', function () { expect(fs.SyncWriteStream).to.be.a('function'); expect(new fs.SyncWriteStream('/file')).to.be.an.instanceof(SyncWriteStream); }); } if (version !== 'v0.10') { it('should expose access flags', function () { expect(fs).to.contain.keys([ 'F_OK', 'R_OK', 'W_OK', 'X_OK' ]); }); } }); };
Add unit test for access flags
Add unit test for access flags
JavaScript
mit
fldubois/avfs
--- +++ @@ -37,6 +37,19 @@ } + if (version !== 'v0.10') { + + it('should expose access flags', function () { + expect(fs).to.contain.keys([ + 'F_OK', + 'R_OK', + 'W_OK', + 'X_OK' + ]); + }); + + } + }); };
f112e257fb276be3003bf5cfa61aaa8b8811024a
src/components/Household.js
src/components/Household.js
import React, { Component } from 'react' import HouseholdService from '../services/HouseholdService' class Household extends Component { constructor(props) { super(props) this.state = { name: '' } } componentWillReceiveProps(nextProps) { const { id } = nextProps.match.params HouseholdService.fetchHousehold(id) .then(household => this.setState({ name: household.name })) } componentDidMount() { const { id } = this.props.match.params HouseholdService.fetchHousehold(id) .then(household => this.setState({ name: household.name })) } render() { const { name } = this.props return ( <div> <h3>{name}</h3> </div> ) } } export default Household
import React, { Component } from 'react' import HouseholdService from '../services/HouseholdService' class Household extends Component { constructor(props) { super(props) this.state = { name: '' } } componentWillReceiveProps(nextProps) { const { id } = nextProps.match.params HouseholdService.fetchHousehold(id) .then(household => this.setState({ name: household.name })) } componentDidMount() { const { id } = this.props.match.params HouseholdService.fetchHousehold(id) .then(household => this.setState({ name: household.name })) } render() { const { name } = this.state return ( <div> <h3>{name}</h3> </div> ) } } export default Household
Update to take name from state and not props
Update to take name from state and not props
JavaScript
mit
cernanb/personal-chef-react-app,cernanb/personal-chef-react-app
--- +++ @@ -27,7 +27,7 @@ } render() { - const { name } = this.props + const { name } = this.state return ( <div> <h3>{name}</h3>
d80434cc2012215d3f067d66622e1deea3234053
src/utils/arrayHelpers.js
src/utils/arrayHelpers.js
export const withUpdated = (arr, select, update) => ( arr.map(el => select(el) ? update(el) : el) ); export const withInsertedBefore = (arr, selectBefore, element) => { const reference = arr.findIndex(selectBefore); if (reference < 0) { return arr; } if (reference === 0) { return [element, ...arr]; } return [].concat( arr.slice(0, reference), element, arr.slice(reference, arr.length), ); }; export const moveUp = (arr, select) => { const pos = arr.findIndex(select); if (pos <= 0) { return arr; } return arr.map((el, idx) => { if (idx === pos - 1) { return arr[idx + 1]; } else if (idx === pos) { return arr[idx - 1] } else { return el; } }); }; export const moveDown = (arr, select) => { const pos = arr.findIndex(select); if (pos < -1 || pos >= arr.length - 1) { return arr; } return arr.map((el, idx) => { if (idx === pos + 1) { return arr[idx - 1]; } else if (idx === pos) { return arr[idx + 1] } else { return el; } }); };
export const withUpdated = (arr, select, update) => ( arr.map(el => select(el) ? update(el) : el) ); export const withInsertedBefore = (arr, selectBefore, element) => { const reference = arr.findIndex(selectBefore); if (reference < 0) { return arr; } if (reference === 0) { return [element, ...arr]; } return [].concat( arr.slice(0, reference), element, arr.slice(reference, arr.length), ); }; export const moveUp = (arr, select) => { const pos = arr.findIndex(select); if (pos <= 0) { return arr; } return arr.map((el, idx) => { if (idx === pos - 1) { return arr[idx + 1]; } else if (idx === pos) { return arr[idx - 1] } else { return el; } }); }; export const moveDown = (arr, select) => { const pos = arr.findIndex(select); if (pos < 0 || pos >= arr.length - 1) { return arr; } return arr.map((el, idx) => { if (idx === pos + 1) { return arr[idx - 1]; } else if (idx === pos) { return arr[idx + 1] } else { return el; } }); };
Fix arrayHelper move down when selector does not match
Fix arrayHelper move down when selector does not match
JavaScript
agpl-3.0
bfncs/linopress,bfncs/linopress
--- +++ @@ -38,7 +38,7 @@ export const moveDown = (arr, select) => { const pos = arr.findIndex(select); - if (pos < -1 || pos >= arr.length - 1) { + if (pos < 0 || pos >= arr.length - 1) { return arr; } return arr.map((el, idx) => {
a90e6f1f92888e0904bd50d67993ab23ccec1a38
src/services/config/config.service.js
src/services/config/config.service.js
'use strict'; // Service for the spec config. // We keep this separate so that changes are kept even if the spec changes. angular.module('vlui') .factory('Config', function() { var Config = {}; Config.data = {}; Config.config = {}; Config.getConfig = function() { return {}; }; Config.getData = function() { return Config.data; }; Config.large = function() { return { cell: { width: 300, height: 300 }, facet: { cell: { width: 150, height: 150 } }, scale: {useRawDomain: false} }; }; Config.small = function() { return { facet: { cell: { width: 150, height: 150 } } }; }; Config.updateDataset = function(dataset, type) { if (dataset.values) { Config.data.values = dataset.values; delete Config.data.url; Config.data.formatType = undefined; } else { Config.data.url = dataset.url; delete Config.data.values; Config.data.formatType = type; } }; return Config; });
'use strict'; // Service for the spec config. // We keep this separate so that changes are kept even if the spec changes. angular.module('vlui') .factory('Config', function() { var Config = {}; Config.data = {}; Config.config = {}; Config.getConfig = function() { return {}; }; Config.getData = function() { return Config.data; }; Config.large = function() { return { cell: { width: 300, height: 300 }, facet: { cell: { width: 150, height: 150 } }, scale: {useRawDomain: false}, mark: { tickThickness: 2 } }; }; Config.small = function() { return { facet: { cell: { width: 150, height: 150 } }, mark: { tickThickness: 2 } }; }; Config.updateDataset = function(dataset, type) { if (dataset.values) { Config.data.values = dataset.values; delete Config.data.url; Config.data.formatType = undefined; } else { Config.data.url = dataset.url; delete Config.data.values; Config.data.formatType = type; } }; return Config; });
Make tick thicker to facilitate hovering
Make tick thicker to facilitate hovering cc: da39a3ee5e6b4b0d3255bfef95601890afd80709@zeningqu
JavaScript
bsd-3-clause
vega/vega-lite-ui,uwdata/vega-lite-ui,uwdata/vega-lite-ui,vega/vega-lite-ui,uwdata/vega-lite-ui,vega/vega-lite-ui
--- +++ @@ -29,7 +29,10 @@ height: 150 } }, - scale: {useRawDomain: false} + scale: {useRawDomain: false}, + mark: { + tickThickness: 2 + } }; }; @@ -40,6 +43,9 @@ width: 150, height: 150 } + }, + mark: { + tickThickness: 2 } }; };
29ed8407f945a36d0c2ad41eebd48d4ac7ef29db
server/discord/utils/dmail/index.js
server/discord/utils/dmail/index.js
const r = require('./../../../db'); const config = require('config'); const check = id => new Promise((resolve, reject) => { r.table('registrations') .get(id) .run(r.conn, (err1, res) => { if (err1) { reject('Could not search RethonkDB'); } else if (!res) { reject(`You or the guild are not registered! Please register for ${config.get('name')} using the \`register\` command`); } else { resolve(res); } }); }); const name = string => string.replace(/ /g, '+').replace(/\W/g, '=').toLowerCase(); module.exports.check = check; module.exports.name = name;
const r = require('./../../../db'); const config = require('config'); const check = id => new Promise((resolve, reject) => { r.table('registrations') .get(id) .run(r.conn, (err1, res) => { if (err1) { reject('Could not search RethonkDB'); } else if (!res) { reject(`You or the guild are not registered! Please register for ${config.get('name')} using the \`register\` command`); } else { resolve(res); } }); }); const name = string => string.replace(/ /g, '+').replace(/[^\w\d!#$&'*+\-/=?^_`{|}~\u007F-\uFFFF]+/g, '=').toLowerCase(); module.exports.check = check; module.exports.name = name;
Support most ASCII characters and all Unicode above U+007F
Support most ASCII characters and all Unicode above U+007F
JavaScript
mit
moustacheminer/discordmail,moustacheminer/discordmail
--- +++ @@ -16,7 +16,7 @@ }); }); -const name = string => string.replace(/ /g, '+').replace(/\W/g, '=').toLowerCase(); +const name = string => string.replace(/ /g, '+').replace(/[^\w\d!#$&'*+\-/=?^_`{|}~\u007F-\uFFFF]+/g, '=').toLowerCase(); module.exports.check = check; module.exports.name = name;
412ee4ba7e2992fb0ed5e967f81cc436e1a16804
load_models.js
load_models.js
// This require this file to load all the models into the // interactive note console process.env.NODE_ENV = 'development' require('coffee-script') o = require('./models/organization') b = require('./models/badge') u = require('./models/user') module.exports = { Badge: b, Organization: o, User: u }
// Require this file to load all the models into the // interactive note console process.env.NODE_ENV = 'development' require('coffee-script') o = require('./models/organization') b = require('./models/badge') u = require('./models/user') module.exports = { Badge: b, Organization: o, User: u }
Remove extra word for more better englishes
Remove extra word for more better englishes
JavaScript
mit
EverFi/Sash,EverFi/Sash,EverFi/Sash
--- +++ @@ -1,4 +1,4 @@ -// This require this file to load all the models into the +// Require this file to load all the models into the // interactive note console process.env.NODE_ENV = 'development'
f6cebdad9813026b2909fadc4e43adcdc4d78b10
src/node/hooks/express/padurlsanitize.js
src/node/hooks/express/padurlsanitize.js
var padManager = require('../../db/PadManager'); var url = require('url'); exports.expressCreateServer = function (hook_name, args, cb) { //redirects browser to the pad's sanitized url if needed. otherwise, renders the html args.app.param('pad', function (req, res, next, padId) { //ensure the padname is valid and the url doesn't end with a / if(!padManager.isValidPadId(padId) || /\/$/.test(req.url)) { res.status(404).send('Such a padname is forbidden'); } else { padManager.sanitizePadId(padId, function(sanitizedPadId) { //the pad id was sanitized, so we redirect to the sanitized version if(sanitizedPadId != padId) { var real_url = sanitizedPadId; var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; res.header('Location', real_url); res.status(302).send('You should be redirected to <a href="' + real_url + '">' + real_url + '</a>'); } //the pad id was fine, so just render it else { next(); } }); } }); }
var padManager = require('../../db/PadManager'); var url = require('url'); exports.expressCreateServer = function (hook_name, args, cb) { //redirects browser to the pad's sanitized url if needed. otherwise, renders the html args.app.param('pad', function (req, res, next, padId) { //ensure the padname is valid and the url doesn't end with a / if(!padManager.isValidPadId(padId) || /\/$/.test(req.url)) { res.status(404).send('Such a padname is forbidden'); } else { padManager.sanitizePadId(padId, function(sanitizedPadId) { //the pad id was sanitized, so we redirect to the sanitized version if(sanitizedPadId != padId) { var real_url = sanitizedPadId; real_url = encodeURIComponent(real_url); var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; res.header('Location', real_url); res.status(302).send('You should be redirected to <a href="' + real_url + '">' + real_url + '</a>'); } //the pad id was fine, so just render it else { next(); } }); } }); }
Fix decode error if pad name contains special characters and is sanitized
Fix decode error if pad name contains special characters and is sanitized
JavaScript
apache-2.0
University-of-Potsdam-MM/etherpad-lite,ether/etherpad-lite,2-B/etherpad-lite,joequant/etherpad-lite,tiblu/etherpad-lite,xavidotron/etherpad-lite,asac/etherpad-lite,aptivate/etherpad-lite,joequant/etherpad-lite,KonradMil/etherpad-lite,joequant/etherpad-lite,aptivate/etherpad-lite,webzwo0i/etherpad-lite,ether/etherpad-lite,rschiang/etherpad-lite,University-of-Potsdam-MM/etherpad-lite,cmbirk/etherpad-lite,kentonv/etherpad-lite,tiblu/etherpad-lite,KonradMil/etherpad-lite,lpagliari/etherpad-lite,cloudfoundry-community/etherpad-lite-cf,Stackato-Apps/etherpad-lite,2-B/etherpad-lite,lpagliari/etherpad-lite,asac/etherpad-lite,cloudfoundry-community/etherpad-lite-cf,rschiang/etherpad-lite,cmbirk/etherpad-lite,University-of-Potsdam-MM/etherpad-lite,2-B/etherpad-lite,ktdev/etherpad-lite,storytouch/etherpad-lite,asac/etherpad-lite,cmbirk/etherpad-lite,xavidotron/etherpad-lite,cmbirk/etherpad-lite,Stackato-Apps/etherpad-lite,tiblu/etherpad-lite,xavidotron/etherpad-lite,webzwo0i/etherpad-lite,rschiang/etherpad-lite,storytouch/etherpad-lite,neynah/etherpad-lite,cloudfoundry-community/etherpad-lite-cf,kentonv/etherpad-lite,tiblu/etherpad-lite,2-B/etherpad-lite,webzwo0i/etherpad-lite,kentonv/etherpad-lite,KonradMil/etherpad-lite,storytouch/etherpad-lite,ktdev/etherpad-lite,rschiang/etherpad-lite,ktdev/etherpad-lite,aptivate/etherpad-lite,lpagliari/etherpad-lite,Stackato-Apps/etherpad-lite,University-of-Potsdam-MM/etherpad-lite,ktdev/etherpad-lite,asac/etherpad-lite,KonradMil/etherpad-lite,Stackato-Apps/etherpad-lite,joequant/etherpad-lite,xavidotron/etherpad-lite,neynah/etherpad-lite,aptivate/etherpad-lite,webzwo0i/etherpad-lite,neynah/etherpad-lite,cloudfoundry-community/etherpad-lite-cf,neynah/etherpad-lite,ether/etherpad-lite,lpagliari/etherpad-lite,kentonv/etherpad-lite
--- +++ @@ -16,6 +16,7 @@ if(sanitizedPadId != padId) { var real_url = sanitizedPadId; + real_url = encodeURIComponent(real_url); var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; res.header('Location', real_url);
12c4395a7939f3b435060ce701fd9002c6be2d8f
src/sampleActivities.js
src/sampleActivities.js
const activitiesByTimestamp = { // activityTimestamps: [1488058736421, 1488058788421, 1488058446421, 1488051326421, 1488051326555] 1488058736421: { text: "hang at Golden Gate park 🍺", }, 1488078736421: { text: "soak up some 🌞 at Dolores park", }, 1488058788421: { text: "climb at Planet Granite -- 3 hours", }, 1488058446421: { text: "run 4.5 miles 🏃", }, 1488059646421: { text: "surfing 🏄 with Salar in Santa Cruz", }, 1488051326421: { text: "read Infinite Jest -- 40 pages", }, 1488051326555: { text: "read Code by Petzold -- 90 pages", } } export default activitiesByTimestamp;
const activitiesByTimestamp = { 1488058736421: { text: "hang at Golden Gate park 🍺", }, 1488078736421: { text: "soak up some 🌞 at Dolores park", }, 1487558788421: { text: "climb at Planet Granite -- 3 hours", }, 1488058446421: { text: "run 4.5 miles 🏃", }, 1486959646421: { text: "surfing 🏄 with Salar in Santa Cruz", }, 1488051326421: { text: "read Infinite Jest -- 40 pages", }, 1488051326555: { text: "read Code by Petzold -- 90 pages", } } export default activitiesByTimestamp;
Add some other dates into sample activities
Add some other dates into sample activities
JavaScript
mit
mknudsen01/today,mknudsen01/today
--- +++ @@ -1,18 +1,17 @@ const activitiesByTimestamp = { - // activityTimestamps: [1488058736421, 1488058788421, 1488058446421, 1488051326421, 1488051326555] 1488058736421: { text: "hang at Golden Gate park 🍺", }, 1488078736421: { text: "soak up some 🌞 at Dolores park", }, - 1488058788421: { + 1487558788421: { text: "climb at Planet Granite -- 3 hours", }, 1488058446421: { text: "run 4.5 miles 🏃", }, - 1488059646421: { + 1486959646421: { text: "surfing 🏄 with Salar in Santa Cruz", }, 1488051326421: {
eb2724c64a6bf129bf70127bf3901535c89ba504
src/scene/BasicScene.js
src/scene/BasicScene.js
define(function(require){ var scene = new THREE.Object3D(); var camera = new THREE.PerspectiveCamera(75, 16 / 9, 0.1, 5000); camera.position.set(0, 0, 5); camera.lookAt(new THREE.Vector3(0, 0, 0)); var cube = new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({color: 0xFF00FF}) ); scene.add(cube); return { scene: scene, camera: camera, render: function(time){ cube.rotation.x = time; cube.rotation.y = time; }, onEvent: function(event) { }, init: function(args){ } }; });
define(function(require){ var scene = new THREE.Object3D(); var camera = new THREE.PerspectiveCamera(75, 16 / 9, 0.1, 5000); camera.position.set(0, 0, 5); camera.lookAt(new THREE.Vector3(0, 0, 0)); var cube = new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({color: 0xFF88FF}) ); scene.add(cube); return { scene: scene, camera: camera, render: function(time){ cube.rotation.x = time; cube.rotation.y = time; }, onEvent: function(event) { }, init: function(args){ } }; });
Change colour of the cube for basic scene.
Change colour of the cube for basic scene.
JavaScript
mit
Suva/AnotherAutumn,Suva/AnotherAutumn,Suva/AnotherAutumn,Suva/AnotherAutumn,Suva/AnotherAutumn
--- +++ @@ -8,7 +8,7 @@ var cube = new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), - new THREE.MeshBasicMaterial({color: 0xFF00FF}) + new THREE.MeshBasicMaterial({color: 0xFF88FF}) ); scene.add(cube);
f17b368d6b462bcde11948b3241fcffcba167df2
src/index.js
src/index.js
const notify = (events) => ({ dispatch }) => next => action => { const returnValue = next(action); events.forEach( event => { if (event.catch.indexOf(action.type) !== -1) { dispatch(event.dispatch()); } }); return returnValue; }; export default notify;
const notify = (events) => ({ dispatch }) => next => action => { const returnValue = next(action); events.forEach( event => { if (event.catch.indexOf(action.type) !== -1) { if (event.dispatch instanceof Function) dispatch(event.dispatch()); else if (event.dispatch instanceof Array) { event.dispatch.forEach( fn => setTimeout(() => { dispatch(fn()) }, 0) ); } else throw new Error('Expected dispatch value to be a function or an array of functions.'); } }); return returnValue; }; export default notify;
Allow to dispatch an array of actions in parallel.
Allow to dispatch an array of actions in parallel.
JavaScript
mit
zalmoxisus/redux-notify
--- +++ @@ -2,7 +2,11 @@ const returnValue = next(action); events.forEach( event => { if (event.catch.indexOf(action.type) !== -1) { - dispatch(event.dispatch()); + if (event.dispatch instanceof Function) dispatch(event.dispatch()); + else if (event.dispatch instanceof Array) { + event.dispatch.forEach( fn => setTimeout(() => { dispatch(fn()) }, 0) ); + } + else throw new Error('Expected dispatch value to be a function or an array of functions.'); } }); return returnValue;
cdf3136cde02d459d1c7e670afcb7217cb357f97
src/index.js
src/index.js
const path = require('path'); let version; module.exports = { Client: require('./client/Client'), Shard: require('./sharding/Shard'), ShardingManager: require('./sharding/ShardingManager'), Collection: require('./util/Collection'), get version() { if (!version) version = require(path.join(__dirname, '..', 'package.json')).version; return version; }, };
const path = require('path'); module.exports = { Client: require('./client/Client'), Shard: require('./sharding/Shard'), ShardingManager: require('./sharding/ShardingManager'), Collection: require('./util/Collection'), version: require(path.join(__dirname, '..', 'package.json')).version, };
Make version a regular property instead of getter
Make version a regular property instead of getter
JavaScript
apache-2.0
robflop/discord.js,devsnek/discord.js,zajrik/discord.js,robflop/discord.js,aemino/discord.js,Lewdcario/discord.js,zajrik/discord.js,SpaceEEC/discord.js,appellation/discord.js,hydrabolt/discord.js,meew0/discord.js,aemino/discord.js,robflop/discord.js,hydrabolt/discord.js,Drahcirius/discord.js,Drahcirius/discord.js,CodeMan99/discord.js,Lewdcario/discord.js,appellation/discord.js,CodeMan99/discord.js,CodeMan99/discord.js,SpaceEEC/discord.js,aemino/discord.js,Drahcirius/discord.js,appellation/discord.js,zajrik/discord.js,devsnek/discord.js,Lewdcario/discord.js,hydrabolt/discord.js,devsnek/discord.js,SpaceEEC/discord.js
--- +++ @@ -1,15 +1,9 @@ const path = require('path'); - -let version; module.exports = { Client: require('./client/Client'), Shard: require('./sharding/Shard'), ShardingManager: require('./sharding/ShardingManager'), Collection: require('./util/Collection'), - - get version() { - if (!version) version = require(path.join(__dirname, '..', 'package.json')).version; - return version; - }, + version: require(path.join(__dirname, '..', 'package.json')).version, };
2af1f21d2496cb192973c27bff321527534e2c7c
lib/publications.js
lib/publications.js
privacyOptions = { // true means exposed _id: true, commentCount: true, createdAt: true, email_hash: true, isInvited: true, karma: true, postCount: true, slug: true, username: true, 'profile.name': true, 'profile.notifications': true, 'profile.bio': true, 'profile.github': true, 'profile.site': true, 'profile.twitter': true, 'services.twitter.profile_image_url': true, 'services.facebook.id': true, 'services.twitter.screenName': true, 'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code 'votes.downvotedComments': true, 'votes.downvotedPosts': true, 'votes.upvotedComments': true, 'votes.upvotedPosts': true }; // minimum required properties to display avatars avatarOptions = { _id: true, email_hash: true, slug: true, username: true, 'profile.name': true, 'profile.github': true, 'profile.twitter': true, 'services.twitter.profile_image_url': true, 'services.facebook.id': true, 'services.twitter.screenName': true, 'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code }
privacyOptions = { // true means exposed _id: true, commentCount: true, createdAt: true, email_hash: true, isInvited: true, karma: true, postCount: true, slug: true, username: true, 'profile.name': true, 'profile.notifications': true, 'profile.bio': true, 'profile.github': true, 'profile.site': true, 'profile.twitter': true, 'services.twitter.profile_image_url': true, 'services.twitter.profile_image_url_https': true, 'services.facebook.id': true, 'services.twitter.screenName': true, 'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code 'votes.downvotedComments': true, 'votes.downvotedPosts': true, 'votes.upvotedComments': true, 'votes.upvotedPosts': true }; // minimum required properties to display avatars avatarOptions = { _id: true, email_hash: true, slug: true, username: true, 'profile.name': true, 'profile.github': true, 'profile.twitter': true, 'services.twitter.profile_image_url': true, 'services.facebook.id': true, 'services.twitter.screenName': true, 'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code }
Fix broken twitter avatars - services.twitter.profile_image_url_https field wasn't being published
Fix broken twitter avatars - services.twitter.profile_image_url_https field wasn't being published
JavaScript
mit
Discordius/Telescope,simbird/Test,ahmadassaf/Telescope,zires/Telescope,rtluu/immersive,sharakarasic/telescope-coderdojola,Leeibrah/telescope,georules/iwishcitiescould,acidsound/Telescope,tepk/Telescope,simbird/Test,veerjainATgmail/Telescope,TribeMedia/Telescope,STANAPO/Telescope,Daz2345/Telescope,queso/Telescope,sophearak/Telescope,LuisHerranz/Telescope,caglarsayin/Telescope,evilhei/itForum,wunderkraut/WunderShare,NodeJSBarenko/Telescope,sdeveloper/Telescope,Code-for-Miami/miami-graph-telescope,sungwoncho/Telescope,rtluu/immersive,evilhei/itForum,Scalingo/Telescope,SachaG/bjjbot,jkuruzovich/projecthunt,youprofit/Telescope,Leeibrah/telescope,azukiapp/Telescope,elamotte/indieshunt,Air2air/Telescope,sophearak/Telescope,rizakaynak/Telescope,jonmc12/heypsycho,jkuruzovich/projecthunt,IQ2022/Telescope,sdeveloper/Telescope,WeAreWakanda/telescope,almogdesign/Telescope,msavin/Telescope,rafaecheve/startupstudygroup,Discordius/Telescope,aykutyaman/Telescope,weld-co/weld-telescope,Code-for-Miami/miami-graph-telescope,Heyho-letsgo/frenchmeteor,azukiapp/Telescope,lpatmo/cb-links,MeteorHudsonValley/Telescope,tylermalin/Screenings,SachaG/fundandexit,automenta/sernyl,sing1ee/Telescope,nwabdou85/tagsira,cydoval/Telescope,adhikariaman01/Telescope,ryeskelton/Telescope,em0ney/Telescope,sing1ee/Telescope,bharatjilledumudi/india-shop,WeAreWakanda/telescope,faaez/Telescope,baptistemac/Telescope,VulcanJS/Vulcan,dominictracey/Telescope,zarkem/ironhacks,NYUMusEdLab/fork-cb,georules/iwishcitiescould,haribabuthilakar/fh,Healdb/Telescope,simbird/Test,aozora/Telescope,mavidser/Telescope,basemm911/questionsociety,HelloMeets/HelloMakers,lambtron/goodwillhunt.org,ibrahimcesar/Screenings,wangleihd/Telescope,MeteorHudsonValley/Telescope,covernal/Telescope,jbschaff/StartupNews,acidsound/Telescope,StEight/Telescope,msavin/Telescope,yourcelf/Telescope,wduntak/tibetalk,enginbodur/TelescopeLatest,braskinfvr/storytellers,geverit4/Telescope,parkeasz/Telescope,em0ney/Telescope,Scalingo/Telescope,ourcities/conectacao,hoihei/Telescope,meteorhacks/Telescope,Scalingo/Telescope,Alekzanther/LawScope,zarkem/ironhacks,manriquef/Vulcan,meteorclub/crater.io,nikhilno1/Telescope,Leeibrah/telescope,huaiyudavid/rentech,hoihei/Telescope,JstnEdr/Telescope,sethbonnie/StartupNews,danieltynerbryan/ProductNews,queso/Telescope,nathanmelenbrink/theRecord,Healdb/Telescope,evilhei/itForum,liamdarmody/telescope_app,SachaG/Gamba,sophearak/Telescope,bharatjilledumudi/india-shop,nwabdou85/tagsira_,caglarsayin/Telescope,SSOCIETY/webpages,StEight/Telescope,TribeMedia/Telescope,codebuddiesdotorg/cb-v2,Air2air/Telescope,theartsnetwork/artytrends,nwabdou85/tagsira_,rizakaynak/Telescope,theartsnetwork/artytrends,SachaG/Gamba,iraasta/quickformtest,geoclicks/Telescope,nathanmelenbrink/theRecord,TelescopeJS/CrunchHunt,tepk/Telescope,Alekzanther/LawScope,maxtor3569/Telescope,lpatmo/cb,azukiapp/Telescope,lpatmo/cb2,julienlapointe/telescope-nova-social-news,queso/Telescope,liamdarmody/telescope_app,metstrike/Telescope,delgermurun/Telescope,SachaG/swpsub,ryeskelton/Telescope,cloudunicorn/fundandexit,mr1azl/Telescope,silky/GitXiv,Discordius/Lesswrong2,johndpark/Telescope,JstnEdr/Telescope,gzingraf/GreenLight-Pix,aykutyaman/Telescope,ibrahimcesar/Screenings,VulcanJS/Vulcan,Eynaliyev/Screenings,gzingraf/GreenLight-Pix,Discordius/Lesswrong2,Discordius/Telescope,ahmadassaf/Telescope,capensisma/Asteroid,parkeasz/Telescope,wduntak/tibetalk,yourcelf/Telescope,TribeMedia/Telescope,nhlennox/gbjobs,codebuddiesdotorg/cb-v2,IQ2022/Telescope,almogdesign/Telescope,eruwinu/presto,samim23/GitXiv,Daz2345/Telescope,TelescopeJS/Screenings,tupeloTS/telescopety,Eynaliyev/Screenings,cmrberry/startup-stories,tepk/Telescope,haribabuthilakar/fh,adhikariaman01/Telescope,mr1azl/Telescope,tylermalin/Screenings,Eynaliyev/Screenings,LocalFoodSupply/CrunchHunt,tupeloTS/grittynashville,baptistemac/Telescope,gzingraf/GreenLight-Pix,SachaG/fundandexit,cydoval/Telescope,automenta/sernyl,nhlennox/gbjobs,Daz2345/dhPulse,manriquef/Vulcan,johndpark/Telescope,codebuddiesdotorg/cb-v2,nikhilno1/Telescope,arbfay/Telescope,fr0zen/viajavaga,maxtor3569/Telescope,bharatjilledumudi/StockX,STANAPO/Telescope,TribeMedia/Screenings,LocalFoodSupply/CrunchHunt,edjv711/presto,guillaumj/Telescope,faaez/Telescope,julienlapointe/telescope-nova-social-news,SachaG/Gamba,sethbonnie/StartupNews,mr1azl/Telescope,LuisHerranz/Telescope,aozora/Telescope,edjv711/presto,dominictracey/Telescope,manriquef/Vulcan,almogdesign/Telescope,SachaG/bjjbot,AdmitHub/Telescope,huaiyudavid/rentech,delgermurun/Telescope,GeoffAbbott/easyLife,Air2air/Telescope,jrmedia/oilgas,arbfay/Telescope,sethbonnie/StartupNews,aichane/digigov,bharatjilledumudi/StockX,jrmedia/oilgas,lpatmo/cb-links,lpatmo/cb-links,meteorclub/crater.io,mavidser/Telescope,samim23/GitXiv,StEight/Telescope,SSOCIETY/webpages,wende/quickformtest,kakedis/Telescope,HelloMeets/HelloMakers,jonmc12/heypsycho,cydoval/Telescope,meurio/conectacao,dominictracey/Telescope,SachaG/Zensroom,lewisnyman/Telescope,Discordius/Telescope,delgermurun/Telescope,fr0zen/viajavaga,dima7b/stewardsof,iraasta/quickformtest,bengott/Telescope,xamfoo/Telescope,rizakaynak/Telescope,NodeJSBarenko/Telescope,jamesrhymer/iwishcitiescould,aichane/digigov,bshenk/projectIterate,dima7b/stewardsof,HelloMeets/HelloMakers,lambtron/goodwillhunt.org,parkeasz/Telescope,rafaecheve/startupstudygroup,nishanbose/Telescope,KarimHmaissi/Codehunt,bengott/Telescope,Discordius/Lesswrong2,yourcelf/Telescope,lewisnyman/Telescope,zires/Telescope,guillaumj/Telescope,sabon/great-balls-of-fire,youprofit/Telescope,wunderkraut/WunderShare,covernal/Telescope,zires/Telescope,Daz2345/dhPulse,basemm911/questionsociety,nhlennox/gbjobs,cloudunicorn/fundandexit,julienlapointe/telescope-nova-social-news,kakedis/Telescope,sharakarasic/telescope-coderdojola,bshenk/projectIterate,wunderkraut/WunderShare,nishanbose/Telescope,tommytwoeyes/Telescope,enginbodur/TelescopeLatest,elamotte/indieshunt,Alekzanther/LawScope,cmrberry/startup-stories,xamfoo/change-route-in-iron-router,guillaumj/Telescope,arbfay/Telescope,capensisma/Asteroid,nwabdou85/tagsira,TelescopeJS/CrunchHunt,GeoffAbbott/easyLife,acidsound/Telescope,wende/quickformtest,Code-for-Miami/miami-graph-telescope,theartsnetwork/artytrends,ibrahimcesar/Screenings,wooplaza/wpmob,xamfoo/change-route-in-iron-router,tylermalin/Screenings,Daz2345/Telescope,sabon/great-balls-of-fire,Heyho-letsgo/frenchmeteor,metstrike/Telescope,automenta/sernyl,sungwoncho/Telescope,nathanmelenbrink/theRecord,wende/quickformtest,TribeMedia/Screenings,Discordius/Lesswrong2,sdeveloper/Telescope,TodoTemplates/Telescope,hoihei/Telescope,NodeJSBarenko/Telescope,mavidser/Telescope,danieltynerbryan/ProductNews,SachaG/swpsub,geverit4/Telescope,tupeloTS/telescopety,aichane/digigov,SachaG/Zensroom,STANAPO/Telescope,aykutyaman/Telescope,meteorhacks/Telescope,jamesrhymer/iwishcitiescould,bharatjilledumudi/StockX,msavin/Telescope,huaiyudavid/rentech,georules/iwishcitiescould,KarimHmaissi/Codehunt,nishanbose/Telescope,jrmedia/oilgas,sing1ee/Telescope,TodoTemplates/Telescope,bshenk/projectIterate,adhikariaman01/Telescope,faaez/Telescope,Healdb/Telescope,lewisnyman/Telescope,tupeloTS/grittynashville,TribeMedia/Screenings,sabon/great-balls-of-fire,weld-co/weld-telescope,capensisma/Asteroid,ryeskelton/Telescope,AdmitHub/Telescope,silky/GitXiv,geverit4/Telescope,sungwoncho/Telescope,pombredanne/Telescope,wooplaza/wpmob,cloudunicorn/fundandexit,jamesrhymer/iwishcitiescould,wangleihd/Telescope,rtluu/immersive,pombredanne/Telescope,bharatjilledumudi/india-shop,maxtor3569/Telescope,WeAreWakanda/telescope,Daz2345/dhPulse,wduntak/tibetalk,veerjainATgmail/Telescope,iraasta/quickformtest,lpatmo/cb2,covernal/Telescope,geoclicks/Telescope,tommytwoeyes/Telescope,caglarsayin/Telescope,braskinfvr/storytellers,tupeloTS/telescopety,eruwinu/presto,meurio/conectacao,tupeloTS/grittynashville,ahmadassaf/Telescope,youprofit/Telescope,xamfoo/change-route-in-iron-router,wangleihd/Telescope,jonmc12/heypsycho,danieltynerbryan/ProductNews,xamfoo/Telescope,metstrike/Telescope,geoclicks/Telescope,SachaG/swpsub,SachaG/bjjbot,zarkem/ironhacks,veerjainATgmail/Telescope,em0ney/Telescope,SachaG/fundandexit,dima7b/stewardsof,johndpark/Telescope,bengott/Telescope,MeteorHudsonValley/Telescope,NYUMusEdLab/fork-cb,edjv711/presto,IQ2022/Telescope,silky/GitXiv,SachaG/Zensroom,enginbodur/TelescopeLatest,jbschaff/StartupNews,tommytwoeyes/Telescope,lpatmo/cb2,LuisHerranz/Telescope,TelescopeJS/Screenings,JstnEdr/Telescope,samim23/GitXiv,kakedis/Telescope,TodoTemplates/Telescope,pombredanne/Telescope,aozora/Telescope,eruwinu/presto,SSOCIETY/webpages,jbschaff/StartupNews,basemm911/questionsociety,lpatmo/cb,TelescopeJS/Screenings,ourcities/conectacao
--- +++ @@ -15,6 +15,7 @@ 'profile.site': true, 'profile.twitter': true, 'services.twitter.profile_image_url': true, + 'services.twitter.profile_image_url_https': true, 'services.facebook.id': true, 'services.twitter.screenName': true, 'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code
4de767d8c6bd350dcba2f36339ad52f465b6c629
src/utils/renderDate.js
src/utils/renderDate.js
import moment from 'moment'; const DefaultDateFormat = 'YYYY-MM-DD'; const DefaultTimeFormat = 'HH:mm:ss'; const DefaultDateTimeFormat = 'YYYY-MM-DD HH:mm:ss'; export default function renderDate(date, formFormat, displayFormat) { let format; if (displayFormat) format = displayFormat; else if (formFormat === 'time') format = DefaultTimeFormat; else if (formFormat === 'dateTime') format = DefaultDateTimeFormat; else format = DefaultDateFormat; return moment(new Date(date)).format(format); }
import moment from 'moment'; const DefaultDateFormat = 'YYYY-MM-DD'; const DefaultTimeFormat = 'HH:mm:ss'; const DefaultDateTimeFormat = 'YYYY-MM-DD HH:mm:ss'; export default function renderDate(date, formFormat, displayFormat) { if (!date) return ''; let format; if (displayFormat) format = displayFormat; else if (formFormat === 'time') format = DefaultTimeFormat; else if (formFormat === 'dateTime') format = DefaultDateTimeFormat; else format = DefaultDateFormat; return moment(new Date(date)).format(format); }
Fix "Invalid date" bug in date related components
fix: Fix "Invalid date" bug in date related components
JavaScript
mit
cantonjs/re-admin,cantonjs/re-admin
--- +++ @@ -5,6 +5,7 @@ const DefaultDateTimeFormat = 'YYYY-MM-DD HH:mm:ss'; export default function renderDate(date, formFormat, displayFormat) { + if (!date) return ''; let format; if (displayFormat) format = displayFormat; else if (formFormat === 'time') format = DefaultTimeFormat;
e24e3c50970cabb78acb6375fa8dceabb74fc06c
src/agcScriptTagHelper.js
src/agcScriptTagHelper.js
/* global angular */ (function() { angular.module("googlechart") .factory("agcScriptTagHelper", agcScriptTagHelperFactory); agcScriptTagHelperFactory.$inject = ["$q"]; function agcScriptTagHelperFactory($q) { /** Add a script tag to the document's head section and return an angular * promise that resolves when the script has loaded. */ function agcScriptTagHelper(url) { var deferred = $q.defer(); var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.src = url; if (script.addEventListener) { // Standard browsers (including IE9+) script.addEventListener('load', onLoad, false); script.onerror = onError; } else { // IE8 and below script.onreadystatechange = function () { if (script.readyState === 'loaded' || script.readyState === 'complete') { script.onreadystatechange = null; onLoad(); } }; } head.appendChild(script); function onLoad() { deferred.resolve(); } function onError() { deferred.reject(); } return deferred.promise; } return agcScriptTagHelper; } })();
/* global angular */ (function() { angular.module("googlechart") .factory("agcScriptTagHelper", agcScriptTagHelperFactory); agcScriptTagHelperFactory.$inject = ["$q", "$document"]; function agcScriptTagHelperFactory($q, $document) { /** Add a script tag to the document's head section and return an angular * promise that resolves when the script has loaded. */ function agcScriptTagHelper(url) { var deferred = $q.defer(); var head = $document.getElementsByTagName('head')[0]; var script = $document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.src = url; if (script.addEventListener) { // Standard browsers (including IE9+) script.addEventListener('load', onLoad, false); script.onerror = onError; } else { // IE8 and below script.onreadystatechange = function () { if (script.readyState === 'loaded' || script.readyState === 'complete') { script.onreadystatechange = null; onLoad(); } }; } head.appendChild(script); function onLoad() { deferred.resolve(); } function onError() { deferred.reject(); } return deferred.promise; } return agcScriptTagHelper; } })();
Use $document for unit test suppport.
[refactor] Use $document for unit test suppport.
JavaScript
mit
angular-google-chart/angular-google-chart,nbering/angular-google-chart,nbering/angular-google-chart,angular-google-chart/angular-google-chart
--- +++ @@ -3,8 +3,8 @@ angular.module("googlechart") .factory("agcScriptTagHelper", agcScriptTagHelperFactory); - agcScriptTagHelperFactory.$inject = ["$q"]; - function agcScriptTagHelperFactory($q) + agcScriptTagHelperFactory.$inject = ["$q", "$document"]; + function agcScriptTagHelperFactory($q, $document) { /** Add a script tag to the document's head section and return an angular * promise that resolves when the script has loaded. @@ -12,8 +12,8 @@ function agcScriptTagHelper(url) { var deferred = $q.defer(); - var head = document.getElementsByTagName('head')[0]; - var script = document.createElement('script'); + var head = $document.getElementsByTagName('head')[0]; + var script = $document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.src = url;
6c28462ee6b375b005e4ed4b183f1c395bee55c6
src/js/client/util/index.js
src/js/client/util/index.js
import scripts from './scripts'; import shortcut from './shortcut'; import setUserRequire from './require'; module.exports = { scripts, setUserRequire, shortcut }
import scripts from './scripts'; import shortcut from './shortcut'; import setUserRequire from './require'; import log from './log'; module.exports = { scripts, setUserRequire, shortcut, log }
Add log to module exports
Add log to module exports
JavaScript
mit
simonlovesyou/AutoRobot
--- +++ @@ -1,10 +1,12 @@ import scripts from './scripts'; import shortcut from './shortcut'; import setUserRequire from './require'; +import log from './log'; module.exports = { scripts, setUserRequire, - shortcut + shortcut, + log }
dabbed7a84a8b40fefb8503234de2b2fdb58a338
lib/api/socket-adapter.js
lib/api/socket-adapter.js
const uuidV4 = require('uuid/v4'); class SocketAdapter { constructor(uuid) { this.uuid = uuid; this.conn = { remoteAddress: `socket-adapter: ${this.uuid}`, }; this.pair = null; this.callbacks = {}; } trigger(name, data) { this.callbacks[name](data); } emit(name, data) { if (!this.pair) { throw new Error('Trying to emit on an unpaired socket adapter'); } this.pair.trigger(name, data); } on(name, callback) { this.callbacks[name] = callback; } } function createAdapterPair() { const adapter1 = new SocketAdapter(uuidV4()); const adapter2 = new SocketAdapter(uuidV4()); adapter1.pair = adapter2; adapter2.pair = adapter1; return [adapter1, adapter2]; } module.exports = createAdapterPair;
const uuidV4 = require('uuid/v4'); class SocketAdapter { constructor(uuid) { this.uuid = uuid; this.conn = { remoteAddress: `socket-adapter: ${this.uuid}`, }; this.pair = null; this.callbacks = {}; } trigger(name, data) { if (this.callbacks[name]) { this.callbacks[name](data); } } emit(name, data) { if (!this.pair) { throw new Error('Trying to emit on an unpaired socket adapter'); } this.pair.trigger(name, data); } on(name, callback) { this.callbacks[name] = callback; } } function createAdapterPair() { const adapter1 = new SocketAdapter(uuidV4()); const adapter2 = new SocketAdapter(uuidV4()); adapter1.pair = adapter2; adapter2.pair = adapter1; return [adapter1, adapter2]; } module.exports = createAdapterPair;
Fix unregistered socket adapter triggers
Fix unregistered socket adapter triggers
JavaScript
mit
frostburn/panel-league,frostburn/panel-league
--- +++ @@ -11,7 +11,9 @@ } trigger(name, data) { - this.callbacks[name](data); + if (this.callbacks[name]) { + this.callbacks[name](data); + } } emit(name, data) {
c990c04bf6307c1fc36f30772574c7280d10398c
lib/notification-badge.js
lib/notification-badge.js
Template.notificationBadge.helpers({ count: function () { // TODO: find a better way ? this._count = this._count || this.count; if (this.count !== this._count) { $('.notification-count') .css({ opacity: 0 }) .css({ top: '-3px' }) .animate({ top: '5px', opacity: 1 }); } return this.count; } });
Template.notificationBadge.helpers({ count: function () { // access template instance instead of 'this', // which only returns the data context var self = Template.instance(); self._count = self._count || this.count; if (this.count !== self._count) { Meteor.defer(function () { $('.notification-count') .css({ opacity: 0 }) .css({ top: '-20px' }) .animate({ top: '-8px', opacity: 1 }); }); self._count = this.count; } return this.count; } });
Fix animation and count checking
Fix animation and count checking
JavaScript
mit
erasaur/notification-badge
--- +++ @@ -1,13 +1,20 @@ Template.notificationBadge.helpers({ count: function () { - // TODO: find a better way ? - this._count = this._count || this.count; + // access template instance instead of 'this', + // which only returns the data context + var self = Template.instance(); - if (this.count !== this._count) { - $('.notification-count') - .css({ opacity: 0 }) - .css({ top: '-3px' }) - .animate({ top: '5px', opacity: 1 }); + self._count = self._count || this.count; + + if (this.count !== self._count) { + Meteor.defer(function () { + $('.notification-count') + .css({ opacity: 0 }) + .css({ top: '-20px' }) + .animate({ top: '-8px', opacity: 1 }); + }); + + self._count = this.count; } return this.count;
f15b2e65c990436ab64da1d2f5506d4b5c127b02
js/script.js
js/script.js
window.onload=function(){ var theNumber = _.random(1, 100); var theList = $("#list"); var theBanner = $("#triumph"); $("#submit").click(function() { var theGuess = $("#guess").val(); $("#guess").val(""); if (theGuess === theNumber) { $("#submit").prop('disabled', true); $("#guess").prop('disabled', true); theBanner.text("That's right! " + theGuess + " is the number of which I am thinking."); theBanner.append('<br /><button onClick="location.reload(true);" >Play again</button>'); } else if (theGuess < theNumber) { theList.append("<li>" + getRandomPhrase() + theGuess + " is too low.</li>"); } else { theList.append("<li>" + getRandomPhrase() + theGuess + " is too high</li>"); } }); $("#guess").keyup(function(event) { if (event.keyCode === 13) { $("#submit").click(); } }); function getRandomPhrase() { var phrases = [ "No. ", "Nope. ", "Guess again. ", "Give it another try. ", "That's not it. ", "Well, not quite. ", "Okay. You can try again. ", "No reason to give up now. ", "Nah. ", "Naw. ", "I hope you get it next time. " ] var index = _.random(0, phrases.length - 1); return phrases[index]; } }
window.onload=function(){ var theNumber = _.random(1, 100); var theList = $("#list"); var theBanner = $("#triumph"); $("#submit").click(function() { var theGuess = $("#guess").val(); $("#guess").val(""); if (theGuess == theNumber) { $("#submit").prop('disabled', true); $("#guess").prop('disabled', true); theBanner.text("That's right! " + theGuess + " is the number of which I am thinking."); theBanner.append('<br /><button onClick="location.reload(true);" >Play again</button>'); } else if (theGuess < theNumber) { theList.append("<li>" + getRandomPhrase() + theGuess + " is too low.</li>"); } else { theList.append("<li>" + getRandomPhrase() + theGuess + " is too high</li>"); } }); $("#guess").keyup(function(event) { if (event.keyCode === 13) { $("#submit").click(); } }); function getRandomPhrase() { var phrases = [ "No. ", "Nope. ", "Guess again. ", "Give it another try. ", "That's not it. ", "Well, not quite. ", "Okay. You can try again. ", "No reason to give up now. ", "Nah. ", "Naw. ", "I hope you get it next time. " ] var index = _.random(0, phrases.length - 1); return phrases[index]; } }
Use '==' because '===' causes undesired behavior
Use '==' because '===' causes undesired behavior
JavaScript
mit
tdreid/Guezzmo,tdreid/Guezzmo
--- +++ @@ -6,7 +6,7 @@ $("#submit").click(function() { var theGuess = $("#guess").val(); $("#guess").val(""); - if (theGuess === theNumber) { + if (theGuess == theNumber) { $("#submit").prop('disabled', true); $("#guess").prop('disabled', true);
4374c40aac4674a7e163c994a114f9a9cbf97d27
routes/api/github.js
routes/api/github.js
var GitHub = require( '../../lib/Webmaker.js' ).github; module.exports = { tags: function( req, res ) { GitHub.tags( req.params.repo, function( err, tags ) { if ( err ) { res.json( 500, { error: 'Unable to get tags for repo ' + repo + '.' } ); return; } res.json( tags ); }); }, commits: function( req, res ) { GitHub.commits( req.params.repo, function( err, commits ) { if ( err ) { res.json( 500, { error: 'Unable to get commits for repo ' + req.params.repo + '.' } ); return; } res.json( commits ); }); }, };
var GitHub = require( '../../lib/Webmaker.js' ).github; module.exports = { tags: function( req, res ) { GitHub.tags( req.params.repo, function( err, tags ) { if ( err ) { res.json( 500, { error: 'Unable to get tags for repo ' + req.params.repo + '.' } ); return; } res.json( tags ); }); }, commits: function( req, res ) { GitHub.commits( req.params.repo, function( err, commits ) { if ( err ) { res.json( 500, { error: 'Unable to get commits for repo ' + req.params.repo + '.' } ); return; } res.json( commits ); }); }, };
Fix typo in tags error message.
Fix typo in tags error message.
JavaScript
mpl-2.0
alicoding/dashboard.webmaker.org,alicoding/dashboard.webmaker.org
--- +++ @@ -4,7 +4,7 @@ tags: function( req, res ) { GitHub.tags( req.params.repo, function( err, tags ) { if ( err ) { - res.json( 500, { error: 'Unable to get tags for repo ' + repo + '.' } ); + res.json( 500, { error: 'Unable to get tags for repo ' + req.params.repo + '.' } ); return; } res.json( tags );
7c92d068c2cb19663f3058b6d5f45b0fbd8a64bf
tests/spec/utilities.js
tests/spec/utilities.js
describe("Utilities", function() { it("should get the domain", function() { expect(getDomain('http://www.google.com')).toMatch('www.google.com'); expect(getDomain('http://www.google.com/')).toMatch('www.google.com'); expect(getDomain('http://www.google.com/kitty')).toMatch('www.google.com'); expect(getDomain('https://www.google.com')).toMatch('www.google.com'); expect(getDomain('https://www.google.com/')).toMatch('www.google.com'); expect(getDomain('https://www.google.com/kitty')).toMatch('www.google.com'); }); it("should get the hostname", function() { expect(getDomain('http://www.google.com')).toMatch('google.com'); expect(getDomain('http://www.google.com/')).toMatch('google.com'); expect(getDomain('http://www.google.com/kitty')).toMatch('google.com'); expect(getDomain('https://www.google.com')).toMatch('google.com'); expect(getDomain('https://www.google.com/')).toMatch('google.com'); expect(getDomain('https://www.google.com/kitty')).toMatch('google.com'); }); });
describe("Utilities", function() { it("should get the domain", function() { expect(getDomain('http://www.google.com')).toMatch('www.google.com'); expect(getDomain('http://www.google.com/')).toMatch('www.google.com'); expect(getDomain('http://www.google.com/kitty')).toMatch('www.google.com'); expect(getDomain('https://www.google.com')).toMatch('www.google.com'); expect(getDomain('https://www.google.com/')).toMatch('www.google.com'); expect(getDomain('https://www.google.com/kitty')).toMatch('www.google.com'); }); it("should get the hostname", function() { expect(getDomain('http://www.google.com')).toMatch('google.com'); expect(getDomain('http://www.google.com/')).toMatch('google.com'); expect(getDomain('http://www.google.com/kitty')).toMatch('google.com'); expect(getDomain('https://www.google.com')).toMatch('google.com'); expect(getDomain('https://www.google.com/')).toMatch('google.com'); expect(getDomain('https://www.google.com/kitty')).toMatch('google.com'); }); }); describe("An array", function() { it("should insert an element at an arbitrary index", function() { var arr = [1, 2, 3, 4]; arr.insertAtIndex(0, 1); expect(arr).toEqual([1, 0, 2, 3, 4]); }); });
Add test for reordering elements in an Array.
Add test for reordering elements in an Array.
JavaScript
mit
AntarcticApps/Tiles,AntarcticApps/Tiles
--- +++ @@ -19,3 +19,11 @@ expect(getDomain('https://www.google.com/kitty')).toMatch('google.com'); }); }); + +describe("An array", function() { + it("should insert an element at an arbitrary index", function() { + var arr = [1, 2, 3, 4]; + arr.insertAtIndex(0, 1); + expect(arr).toEqual([1, 0, 2, 3, 4]); + }); +});
074e2c12fede2c51d3757bb06d4d761b716af17e
config/babel.umd.js
config/babel.umd.js
module.exports = { modules: false, presets: [ ["latest", { es2015: { modules: false } }], "es2015-rollup", "react", "stage-0" ] };
module.exports = { babelrc: false, presets: [ ["latest", { es2015: { modules: false } }], "es2015-rollup", "react", "stage-0" ] };
Fix issue with babel config error in UMD build.
build: Fix issue with babel config error in UMD build.
JavaScript
mit
chrisdarroch/skatejs,skatejs/skatejs,skatejs/skatejs,chrisdarroch/skatejs,skatejs/skatejs
--- +++ @@ -1,5 +1,5 @@ module.exports = { - modules: false, + babelrc: false, presets: [ ["latest", { es2015: { modules: false } }], "es2015-rollup",
b6d0bc97db074b04123c0ab42c8f6e49a22e402b
server/css-bundle.js
server/css-bundle.js
'use strict'; var autoprefixer = require('autoprefixer-core') , cssAid = require('css-aid/process') , cssAidRules = [require('css-aid/rules/variables')] , getFiles = require('./css-bundle-get-files'); module.exports = function (indexPath/*, options */) { return getFiles(indexPath, arguments[1])(function (data) { return cssAid(autoprefixer.process(data.reduce(function (content, data) { return content + '/* ' + data.filename + ' */\n\n' + data.content + '\n'; }, '').slice(0, -1)).css, cssAidRules); }); };
'use strict'; var autoprefixer = require('autoprefixer') , cssAid = require('css-aid/process') , cssAidRules = [require('css-aid/rules/variables')] , getFiles = require('./css-bundle-get-files'); module.exports = function (indexPath/*, options */) { return getFiles(indexPath, arguments[1])(function (data) { return cssAid(autoprefixer.process(data.reduce(function (content, data) { return content + '/* ' + data.filename + ' */\n\n' + data.content + '\n'; }, '').slice(0, -1)).css, cssAidRules); }); };
Update to use autoprefixer directly
Update to use autoprefixer directly
JavaScript
mit
egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations
--- +++ @@ -1,6 +1,6 @@ 'use strict'; -var autoprefixer = require('autoprefixer-core') +var autoprefixer = require('autoprefixer') , cssAid = require('css-aid/process') , cssAidRules = [require('css-aid/rules/variables')] , getFiles = require('./css-bundle-get-files');
627a61ab32ac65ee0955c64f7f01209468c41cdd
lib/index.js
lib/index.js
import MemoryFileSystem from 'memory-fs' import tty from 'tty' import path from 'path' import webpack from 'webpack' export default function plugin (config) { const compiler = webpack(config) compiler.outputFileSystem = new MemoryFileSystem() return function (files, metalsmith, done) { compiler.run((err, stats) => { if (err) { done(err) return } const info = stats.toString({ chunkModules: false, colors: isStdoutATTY() // Output colors iff stdout has a controlling terminal }) if (stats.hasErrors()) { done(info) return } console.log(info) compiler.outputFileSystem.readdirSync(config.output.path).forEach(file => { const filePath = path.join(config.output.path, file) const key = path.relative(metalsmith.destination(), filePath) files[key] = { contents: compiler.outputFileSystem.readFileSync(filePath) } }) return done() }) } } function isStdoutATTY () { return tty.isatty(1 /* stdout */) }
import MemoryFileSystem from 'memory-fs' import tty from 'tty' import path from 'path' import webpack from 'webpack' export default function plugin (config) { const compiler = webpack(config) compiler.outputFileSystem = new MemoryFileSystem() return function (files, metalsmith, done) { compiler.run((err, stats) => { if (err) { done(err) return } const info = stats.toString({ chunkModules: false, colors: isStdoutATTY() // Output colors iff stdout has a controlling terminal }) if (stats.hasErrors()) { done(info) return } console.log(info) /* * Webpack requires the output path `config.output.path` to be an *absolute* path, * but metalsmith `files` expects keys that are file paths relative to metalsmith's * build directory. * * Read webpack's output files and assign them relative paths in metalsmith's `files` */ compiler.outputFileSystem.readdirSync(config.output.path).forEach(filename => { const filePath = path.join(config.output.path, filename) const key = path.relative(metalsmith.destination(), filePath) files[key] = { contents: compiler.outputFileSystem.readFileSync(filePath) } }) return done() }) } } function isStdoutATTY () { return tty.isatty(1 /* stdout */) }
Add comment to describe the output files
Add comment to describe the output files
JavaScript
mit
elliottsj/metalsmith-plugin-webpack
--- +++ @@ -21,8 +21,15 @@ return } console.log(info) - compiler.outputFileSystem.readdirSync(config.output.path).forEach(file => { - const filePath = path.join(config.output.path, file) + /* + * Webpack requires the output path `config.output.path` to be an *absolute* path, + * but metalsmith `files` expects keys that are file paths relative to metalsmith's + * build directory. + * + * Read webpack's output files and assign them relative paths in metalsmith's `files` + */ + compiler.outputFileSystem.readdirSync(config.output.path).forEach(filename => { + const filePath = path.join(config.output.path, filename) const key = path.relative(metalsmith.destination(), filePath) files[key] = { contents: compiler.outputFileSystem.readFileSync(filePath)
bca29aa0ce8043b1918688dd2a1dcfa0d2c9bae9
test/api/highlightAuto.js
test/api/highlightAuto.js
'use strict'; var bluebird = require('bluebird'); var fs = bluebird.promisifyAll(require('fs')); var hljs = require('../../build'); var path = require('path'); var utility = require('../utility'); function testAutoDetection(language) { var languagePath = utility.buildPath('detect', language); it('should have test for ' + language, function(done) { fs.exists(languagePath, function(testExistence) { testExistence.should.be.true; done(); }); }); it('should be detected as ' + language, function(done) { fs.readdirAsync(languagePath) .map(function(example) { var filename = path.join(languagePath, example); return fs.readFileAsync(filename, 'utf-8'); }) .each(function(content) { var expected = language, actual = hljs.highlightAuto(content).language; actual.should.equal(expected); }) .finally(done); }); } describe('.highlightAuto', function() { var languages = hljs.listLanguages(); languages.forEach(testAutoDetection); });
'use strict'; var bluebird = require('bluebird'); var fs = bluebird.promisifyAll(require('fs')); var hljs = require('../../build'); var path = require('path'); var utility = require('../utility'); function testAutoDetection(language) { var languagePath = utility.buildPath('detect', language); it('should have test for ' + language, function(done) { fs.exists(languagePath, function(testExistence) { testExistence.should.be.true; done(); }); }); it('should be detected as ' + language, function(done) { fs.readdirAsync(languagePath) .map(function(example) { var filename = path.join(languagePath, example); return fs.readFileAsync(filename, 'utf-8'); }) .each(function(content) { var expected = language, actual = hljs.highlightAuto(content).language; actual.should.equal(expected); }) .done(function () { done(); }, function (error) { done(error); }); }); } describe('.highlightAuto', function() { var languages = hljs.listLanguages(); languages.forEach(testAutoDetection); });
Fix detection tests silent fails
Fix detection tests silent fails CC @sourrust
JavaScript
bsd-3-clause
CausalityLtd/highlight.js,lizhil/highlight.js,Sannis/highlight.js,StanislawSwierc/highlight.js,ehornbostel/highlight.js,krig/highlight.js,axter/highlight.js,weiyibin/highlight.js,robconery/highlight.js,kayyyy/highlight.js,0x7fffffff/highlight.js,adam-lynch/highlight.js,devmario/highlight.js,highlightjs/highlight.js,ehornbostel/highlight.js,tenbits/highlight.js,VoldemarLeGrand/highlight.js,axter/highlight.js,liang42hao/highlight.js,highlightjs/highlight.js,taoger/highlight.js,devmario/highlight.js,martijnrusschen/highlight.js,Ankirama/highlight.js,isagalaev/highlight.js,snegovick/highlight.js,aurusov/highlight.js,cicorias/highlight.js,dublebuble/highlight.js,kayyyy/highlight.js,christoffer/highlight.js,jean/highlight.js,dYale/highlight.js,kevinrodbe/highlight.js,cicorias/highlight.js,robconery/highlight.js,SibuStephen/highlight.js,lead-auth/highlight.js,kayyyy/highlight.js,STRML/highlight.js,MakeNowJust/highlight.js,bluepichu/highlight.js,STRML/highlight.js,adam-lynch/highlight.js,snegovick/highlight.js,kevinrodbe/highlight.js,kba/highlight.js,1st1/highlight.js,dbkaplun/highlight.js,sourrust/highlight.js,teambition/highlight.js,Delermando/highlight.js,MakeNowJust/highlight.js,tenbits/highlight.js,adam-lynch/highlight.js,Ajunboys/highlight.js,ilovezy/highlight.js,weiyibin/highlight.js,teambition/highlight.js,J2TeaM/highlight.js,lizhil/highlight.js,aurusov/highlight.js,aurusov/highlight.js,xing-zhi/highlight.js,dYale/highlight.js,SibuStephen/highlight.js,dublebuble/highlight.js,J2TeaM/highlight.js,Ankirama/highlight.js,1st1/highlight.js,palmin/highlight.js,dbkaplun/highlight.js,J2TeaM/highlight.js,dublebuble/highlight.js,martijnrusschen/highlight.js,weiyibin/highlight.js,teambition/highlight.js,ponylang/highlight.js,VoldemarLeGrand/highlight.js,dx285/highlight.js,Delermando/highlight.js,dYale/highlight.js,alex-zhang/highlight.js,taoger/highlight.js,ilovezy/highlight.js,martijnrusschen/highlight.js,CausalityLtd/highlight.js,kba/highlight.js,kba/highlight.js,snegovick/highlight.js,STRML/highlight.js,dx285/highlight.js,Sannis/highlight.js,lizhil/highlight.js,highlightjs/highlight.js,cicorias/highlight.js,ilovezy/highlight.js,ponylang/highlight.js,abhishekgahlot/highlight.js,dx285/highlight.js,devmario/highlight.js,axter/highlight.js,christoffer/highlight.js,daimor/highlight.js,jean/highlight.js,christoffer/highlight.js,bluepichu/highlight.js,abhishekgahlot/highlight.js,ehornbostel/highlight.js,Amrit01/highlight.js,carlokok/highlight.js,Ankirama/highlight.js,liang42hao/highlight.js,xing-zhi/highlight.js,palmin/highlight.js,delebash/highlight.js,jean/highlight.js,carlokok/highlight.js,kevinrodbe/highlight.js,liang42hao/highlight.js,alex-zhang/highlight.js,yxxme/highlight.js,yxxme/highlight.js,ysbaddaden/highlight.js,StanislawSwierc/highlight.js,robconery/highlight.js,taoger/highlight.js,xing-zhi/highlight.js,aristidesstaffieri/highlight.js,krig/highlight.js,yxxme/highlight.js,Amrit01/highlight.js,dbkaplun/highlight.js,sourrust/highlight.js,ysbaddaden/highlight.js,alex-zhang/highlight.js,palmin/highlight.js,bluepichu/highlight.js,carlokok/highlight.js,CausalityLtd/highlight.js,brennced/highlight.js,krig/highlight.js,daimor/highlight.js,aristidesstaffieri/highlight.js,sourrust/highlight.js,delebash/highlight.js,ysbaddaden/highlight.js,aristidesstaffieri/highlight.js,1st1/highlight.js,highlightjs/highlight.js,isagalaev/highlight.js,Ajunboys/highlight.js,0x7fffffff/highlight.js,Delermando/highlight.js,brennced/highlight.js,carlokok/highlight.js,abhishekgahlot/highlight.js,SibuStephen/highlight.js,Ajunboys/highlight.js,daimor/highlight.js,tenbits/highlight.js,brennced/highlight.js,Sannis/highlight.js,delebash/highlight.js,Amrit01/highlight.js,ponylang/highlight.js,MakeNowJust/highlight.js,VoldemarLeGrand/highlight.js,0x7fffffff/highlight.js
--- +++ @@ -29,7 +29,11 @@ actual.should.equal(expected); }) - .finally(done); + .done(function () { + done(); + }, function (error) { + done(error); + }); }); }
d915a20733462e619234116bed5bc51ee121f60c
test/spec/test_captcha.js
test/spec/test_captcha.js
describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); });
describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); it("Captcha object is not null", function(){ expect(captcha).not.toBeNull(); }); });
Add test to chekc if captcha object is null. The test fails
Add test to chekc if captcha object is null. The test fails
JavaScript
mit
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
--- +++ @@ -2,4 +2,7 @@ it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); + it("Captcha object is not null", function(){ + expect(captcha).not.toBeNull(); + }); });
c910d489215a0231ea626479057d71902f4a0758
lib/redis.js
lib/redis.js
'use strict'; var debug = require('debug')('fundation:redis'); var Redis = require('ioredis'); // // Redis // module.exports = function(app) { // Check if there is any configuration for Redis var server = app.get('config').redis; if ( !server ) { return; } return new Promise(function(resolve, reject) { debug('Setting up Redis'); var client = new Redis({ sentinels: [ { host: server.host, port: server.port } ], name: server.name }); client.on('error', function(err) { console.error('Redis error: ' + err); app.set('redis', false); resolve(true); }); client.on('ready', function(err) { app.set('redis', client); resolve(true); }); }); };
'use strict'; var debug = require('debug')('fundation:redis'); var Redis = require('ioredis'); // // Redis // module.exports = function(app) { // Check if there is any configuration for Redis var server = app.get('config').redis; if ( !server ) { return; } return new Promise(function(resolve, reject) { debug('Setting up Redis'); var client = new Redis({ sentinels: [ { host: server.host, port: server.port } ], name: server.name, sentinelRetryStrategy : (times) => { if (times >= 5) { return null; } return Math.min(times * 10, 1000); } }); client.on('error', function(err) { console.error('Redis error: ' + err); app.set('redis', false); resolve(true); }); client.on('ready', function(err) { app.set('redis', client); resolve(true); }); }); };
Add Redis sentinelRetryStrategy function in Redis config to prevent constant retries
Add Redis sentinelRetryStrategy function in Redis config to prevent constant retries
JavaScript
mit
fundation/fundation
--- +++ @@ -25,7 +25,14 @@ port: server.port } ], - name: server.name + name: server.name, + sentinelRetryStrategy : (times) => { + if (times >= 5) { + return null; + } + + return Math.min(times * 10, 1000); + } }); client.on('error', function(err) {
d516cc28ca767dda67179798711494d26ba1c197
lib/setup.js
lib/setup.js
var $ = require('jquery'); module.exports = function(namespace) { var toggleSelector = '[data-' + namespace + '-toggle]'; var openClass = namespace + '--open'; var body = $(document.body).addClass(namespace); $(document) .on('click.' + namespace, toggleSelector, function(e) { e.preventDefault(); var expanded = body .toggleClass(openClass) .hasClass(openClass) ; $(toggleSelector) .attr('aria-expanded', (expanded ? 'true' : 'false')) .trigger(namespace + ':' + (expanded ? 'open' : 'close'), [this]); }) ; };
var $ = require('jquery'); module.exports = function(namespace) { var toggleSelector = '[data-' + namespace + '-toggle]'; var openClass = namespace + '--open'; var root = $('html').addClass(namespace); $(document) .on('click.' + namespace, toggleSelector, function(e) { e.preventDefault(); var expanded = root .toggleClass(openClass) .hasClass(openClass) ; $(toggleSelector) .attr('aria-expanded', (expanded ? 'true' : 'false')) .trigger(namespace + ':' + (expanded ? 'open' : 'close'), [this]); }) ; };
Fix adding root class to html, not body
Fix adding root class to html, not body
JavaScript
mit
dotsunited/off-canvas-navigation,dotsunited/off-canvas-navigation
--- +++ @@ -4,13 +4,13 @@ var toggleSelector = '[data-' + namespace + '-toggle]'; var openClass = namespace + '--open'; - var body = $(document.body).addClass(namespace); + var root = $('html').addClass(namespace); $(document) .on('click.' + namespace, toggleSelector, function(e) { e.preventDefault(); - var expanded = body + var expanded = root .toggleClass(openClass) .hasClass(openClass) ;
e44d438f960df6931a547a83b9b6388ecf5a0ab6
warp/static/js/project.js
warp/static/js/project.js
/* global document, $ */ /* Project specific Javascript goes here. */ /* Formatting hack to get around crispy-forms unfortunate hardcoding in helpers.FormHelper: if template_pack == 'bootstrap4': grid_colum_matcher = re.compile('\w*col-(xs|sm|md|lg|xl)-\d+\w*') using_grid_layout = (grid_colum_matcher.match(self.label_class) or grid_colum_matcher.match(self.field_class)) if using_grid_layout: items['using_grid_layout'] = True Issues with the above approach: 1. Fragile: Assumes Bootstrap 4's API doesn't change (it does) 2. Unforgiving: Doesn't allow for any variation in template design 3. Really Unforgiving: No way to override this behavior 4. Undocumented: No mention in the documentation, or it's too hard for me to find */ $('.form-group').removeClass('row'); const registerCSRFTokenAjaxFilter = () => { const csrfToken = document.getElementsByName('csrfmiddlewaretoken')[0].value; $.ajaxPrefilter((options, originalOptions, jqXHR) => { jqXHR.setRequestHeader('X-CSRFToken', csrfToken); }); }; registerCSRFTokenAjaxFilter();
/* global document, $ */ /* Project specific Javascript goes here. */ /* Formatting hack to get around crispy-forms unfortunate hardcoding in helpers.FormHelper: if template_pack == 'bootstrap4': grid_colum_matcher = re.compile('\w*col-(xs|sm|md|lg|xl)-\d+\w*') using_grid_layout = (grid_colum_matcher.match(self.label_class) or grid_colum_matcher.match(self.field_class)) if using_grid_layout: items['using_grid_layout'] = True Issues with the above approach: 1. Fragile: Assumes Bootstrap 4's API doesn't change (it does) 2. Unforgiving: Doesn't allow for any variation in template design 3. Really Unforgiving: No way to override this behavior 4. Undocumented: No mention in the documentation, or it's too hard for me to find */ $('.form-group').removeClass('row'); const registerCSRFTokenAjaxFilter = () => { const csrfTokenElement = document.getElementsByName('csrfmiddlewaretoken')[0]; if (!csrfTokenElement) { return; } const csrfToken = document.getElementsByName('csrfmiddlewaretoken')[0].value; $.ajaxPrefilter((options, originalOptions, jqXHR) => { jqXHR.setRequestHeader('X-CSRFToken', csrfToken); }); }; registerCSRFTokenAjaxFilter();
Add defensive logic to csrf-ajax-filter
Add defensive logic to csrf-ajax-filter
JavaScript
mit
SaturDJang/warp,SaturDJang/warp,SaturDJang/warp,SaturDJang/warp
--- +++ @@ -22,6 +22,10 @@ $('.form-group').removeClass('row'); const registerCSRFTokenAjaxFilter = () => { + const csrfTokenElement = document.getElementsByName('csrfmiddlewaretoken')[0]; + if (!csrfTokenElement) { + return; + } const csrfToken = document.getElementsByName('csrfmiddlewaretoken')[0].value; $.ajaxPrefilter((options, originalOptions, jqXHR) => { jqXHR.setRequestHeader('X-CSRFToken', csrfToken);
36c13c4d4e7ffd312cbb1efa9ba881b3258a01a2
specs/integration.js
specs/integration.js
var chai = require('chai'); var expect = chai.expect; var models = require('../server/db/models'); var request = require('request'); var localServerUri = 'http://127.0.0.1:3000/'; var GETUri = localServerUri + '?x=100.123456&y=-50.323&z=14.4244'; var testData = {x: 100.123456, y: -50.323, z: 14.4244, message: 'hello database!'}; describe('server to database integration', function() { it('should persist valid POST request to database', function(done) { request.post({url:localServerUri, form: testData}, function(err, response, body) { models.retrieve(testData, function(messages) { var messageString = messages[0].messageString; expect(messageString).to.equal(testData.message); done(); }); }); }); it('should GET messages from databases', function(done) { request(GETUri, function(err, response, body) { var messages = JSON.parse(response.body); expect(messages).to.be.a('array'); done(); }); }); });
var chai = require('chai'); var expect = chai.expect; var models = require('../server/db/models'); var request = require('request'); var localServerUri = 'http://127.0.0.1:3000/'; var GETUri = localServerUri + '?x=100.123456&y=-50.323&z=14.4244'; var testData = {x: 100.123456, y: -50.323, z: 14.4244, message: 'hello database!'}; describe('server to database integration', function() { after(function() { models.removeData('marks', 'x', 100.123459); models.removeData('messages', 'messageString', "'hello database!'"); }); it('should persist valid POST request to database', function(done) { request.post({url:localServerUri, form: testData}, function(err, response, body) { models.retrieve(testData, function(messages) { var messageString = messages[0].messageString; expect(messageString).to.equal(testData.message); done(); }); }); }); it('should GET messages from databases', function(done) { request(GETUri, function(err, response, body) { var messages = JSON.parse(response.body); expect(messages).to.be.a('array'); done(); }); }); });
Remove test data from database after tests are run
Remove test data from database after tests are run
JavaScript
mit
scottdixon/uncovery,team-oath/uncovery,team-oath/uncovery,team-oath/uncovery,scottdixon/uncovery,scottdixon/uncovery,scottdixon/uncovery,team-oath/uncovery
--- +++ @@ -7,6 +7,12 @@ var testData = {x: 100.123456, y: -50.323, z: 14.4244, message: 'hello database!'}; describe('server to database integration', function() { + + after(function() { + models.removeData('marks', 'x', 100.123459); + models.removeData('messages', 'messageString', "'hello database!'"); + }); + it('should persist valid POST request to database', function(done) { request.post({url:localServerUri, form: testData}, function(err, response, body) { models.retrieve(testData, function(messages) {
71e4557ac4e36f717b5e8d3da394ca6b18ca4f37
webpack/webpack.config.js
webpack/webpack.config.js
const path = require('path'); const webpack = require('webpack'); const banner = require('./banner'); module.exports = { entry: './src/api/v4/index.js', output: { path: path.resolve(__dirname, '../dist/public'), filename: 'carto.js', library: 'carto', libraryTarget: 'umd' }, plugins: [ // Include only the lastest camshaft-reference new webpack.IgnorePlugin(/^\.\/((?!0\.59\.4).)*\/reference\.json$/), new webpack.BannerPlugin(banner) ] };
const path = require('path'); const webpack = require('webpack'); const banner = require('./banner'); module.exports = { entry: './src/api/v4/index.js', output: { path: path.resolve(__dirname, '../dist/public'), filename: 'carto.js', library: 'carto', libraryTarget: 'umd' }, devtool: 'sourcemap', plugins: [ // Include only the lastest camshaft-reference new webpack.IgnorePlugin(/^\.\/((?!0\.59\.4).)*\/reference\.json$/), new webpack.BannerPlugin(banner) ] };
Add sourcemap generation to build script
Add sourcemap generation to build script
JavaScript
bsd-3-clause
splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js
--- +++ @@ -10,6 +10,7 @@ library: 'carto', libraryTarget: 'umd' }, + devtool: 'sourcemap', plugins: [ // Include only the lastest camshaft-reference new webpack.IgnorePlugin(/^\.\/((?!0\.59\.4).)*\/reference\.json$/),
dbb8974ac01d634eac952f5e927b98505bc76fff
src/server/pullRequest.js
src/server/pullRequest.js
'use strict'; var R = require('ramda'); function onPrClose() { } function writeSuccess(res, result) { res.send(':)'); } function writeFailure(res, err) { res.send(':('); } function pullRequestRouteHandler(req, res) { var body = req.body; var onSucess = R.curry(writeSuccess)(res); var onFail = R.curry(writeFailure)(res); var ghAction = body.action; var ghEventType = req.header('X-Github-Event') if(ghEventType !== 'pull_request') { res.status(403) .send('Pull requests only!'); } if(ghAction === 'closed') { onPrClose(body) .then(onSuccess, onFail); } else { res.status(403) .send('We only want "closed" PR events right now.'); } } module.exports = pullRequestRouteHandler;
'use strict'; var R = require('ramda'); function onPrClose() { return q.resolve(); } function writeSuccess(res, result) { res.send(':)'); } function writeFailure(res, err) { res.send(':('); } function pullRequestRouteHandler(req, res) { var body = req.body; var onSucess = R.curry(writeSuccess)(res); var onFail = R.curry(writeFailure)(res); var ghAction = body.action; var ghEventType = req.header('X-Github-Event') if(ghEventType !== 'pull_request') { res.status(403) .send('Pull requests only!'); } if(ghAction === 'closed') { onPrClose(body) .then(onSuccess, onFail); } else { res.status(403) .send('We only want "closed" PR events right now.'); } } module.exports = pullRequestRouteHandler;
Resolve promise in PR handler
Resolve promise in PR handler
JavaScript
mit
rafkhan/the-clusternator,alanthai/the-clusternator,rafkhan/the-clusternator,rangle/the-clusternator,bennett000/the-clusternator,rangle/the-clusternator,alanthai/the-clusternator,rangle/the-clusternator,bennett000/the-clusternator,bennett000/the-clusternator
--- +++ @@ -4,7 +4,7 @@ function onPrClose() { - + return q.resolve(); } function writeSuccess(res, result) {
cca37003d0931d4f446eb8c80e18a31fa35fd4e0
src/stringify/anything.js
src/stringify/anything.js
import _ from '../wrap/lodash' import isMatcher from '../matchers/is-matcher' import * as stringifyObject from 'stringify-object-es5' export default (anything) => { if (_.isString(anything)) { return stringifyString(anything) } else if (isMatcher(anything)) { return anything.__name } else { return stringifyObject(anything, { indent: ' ', singleQuotes: false, inlineCharacterLimit: 65, transform (obj, prop, originalResult) { if (isMatcher(obj[prop])) { return obj[prop].__name } else { return originalResult } } }) } } var stringifyString = (string) => _.includes(string, '\n') ? `"""\n${string}\n"""` : `"${string.replace(new RegExp('"', 'g'), '\\"')}"`
import _ from '../wrap/lodash' import isMatcher from '../matchers/is-matcher' import * as stringifyObject from 'stringify-object-es5' export default (anything) => { if (_.isString(anything)) { return stringifyString(anything) } else if (isMatcher(anything)) { return anything.__name } else if (anything && anything[Symbol("__is_proxy")]) { return anything.toString() } else { return stringifyObject(anything, { indent: ' ', singleQuotes: false, inlineCharacterLimit: 65, transform (obj, prop, originalResult) { if (isMatcher(obj[prop])) { return obj[prop].__name } else { return originalResult } } }) } } var stringifyString = (string) => _.includes(string, '\n') ? `"""\n${string}\n"""` : `"${string.replace(new RegExp('"', 'g'), '\\"')}"`
Use toString when printing proxy description
Use toString when printing proxy description
JavaScript
mit
testdouble/testdouble.js,testdouble/testdouble.js,testdouble/testdouble.js
--- +++ @@ -7,6 +7,8 @@ return stringifyString(anything) } else if (isMatcher(anything)) { return anything.__name + } else if (anything && anything[Symbol("__is_proxy")]) { + return anything.toString() } else { return stringifyObject(anything, { indent: ' ',
a3f1459bbfd7edaad9eefc4c64306a85c85b2f3d
src/script/components/dashcaseFilter.js
src/script/components/dashcaseFilter.js
app.filter('dashcase', function () { return function (input) { input = input.replace(/\s+/g, '-') .toLowerCase() .replace('ä', 'ae') .replace('ö', 'oe') .replace('ü', 'ue') .replace('ß', 'ss') .replace(/[^a-z0-9-]/g, ''); return input; }; });
app.filter('dashcase', function () { return function (input) { return input.toLowerCase() .replace(/\s+/g, '-') .replace(/ä/g, 'ae') .replace(/ö/g, 'oe') .replace(/ü/g, 'ue') .replace(/\u00df/g, 'ss') .replace(/[^a-z0-9-]/g, ''); }; });
Fix bug with German umlauts in dashcase filter
Fix bug with German umlauts in dashcase filter
JavaScript
mit
stekhn/portfolio,stekhn/portfolio,stekhn/portfolio
--- +++ @@ -2,14 +2,12 @@ return function (input) { - input = input.replace(/\s+/g, '-') - .toLowerCase() - .replace('ä', 'ae') - .replace('ö', 'oe') - .replace('ü', 'ue') - .replace('ß', 'ss') + return input.toLowerCase() + .replace(/\s+/g, '-') + .replace(/ä/g, 'ae') + .replace(/ö/g, 'oe') + .replace(/ü/g, 'ue') + .replace(/\u00df/g, 'ss') .replace(/[^a-z0-9-]/g, ''); - - return input; }; });
248c21e5d391ef985b7aab2992f3237234b8054f
frontend/components/modals/promoteModal.js
frontend/components/modals/promoteModal.js
import React, { Component } from 'react'; import Dialog from 'material-ui/lib/dialog'; import FlatButton from 'material-ui/lib/flat-button'; import RaisedButton from 'material-ui/lib/raised-button'; // NOTE: For emit `onTouchTap` event. import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); export default class PromoteModal extends Component { constructor(props) { super(props); this.state = { open: false }; } handleOpen() { this.setState({ open: true }); } handleClose() { this.props.onHidePromoteModal(); this.setState({ open: this.props.open }); } render() { const actions = [ <FlatButton label="Cancel" primary={true} onTouchTap={this.handleClose.bind(this)} />, <FlatButton label="Submit" primary={true} onTouchTap={this.handleClose.bind(this)} /> ]; return ( <div> <Dialog title="" actions={actions} modal={true} open={this.props.open} /> </div> ); } }
import React, { Component } from 'react'; import Dialog from 'material-ui/lib/dialog'; import FlatButton from 'material-ui/lib/flat-button'; import RaisedButton from 'material-ui/lib/raised-button'; // NOTE: For emit `onTouchTap` event. import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); export default class PromoteModal extends Component { constructor(props) { super(props); this.state = { open: false }; } handleClose() { this.props.onHidePromoteModal(); this.setState({ open: this.props.open }); } render() { const actions = [ <FlatButton label="Cancel" primary={true} onTouchTap={this.handleClose.bind(this)} />, <FlatButton label="Submit" primary={true} onTouchTap={this.handleClose.bind(this)} /> ]; return ( <div> <Dialog title="" actions={actions} modal={true} open={this.props.open} /> </div> ); } }
Remove handleOpen function. because it is unnecessary.
Remove handleOpen function. because it is unnecessary.
JavaScript
mit
mgi166/usi-front,mgi166/usi-front
--- +++ @@ -11,10 +11,6 @@ constructor(props) { super(props); this.state = { open: false }; - } - - handleOpen() { - this.setState({ open: true }); } handleClose() {
80e7eebae4772ee6659330e36f515f70430133a9
test/reducers/example-reducer.test.js
test/reducers/example-reducer.test.js
import * as actionTypes from "../../src/actions/types"; import exampleReducer from "../../src/reducers/example-reducer"; describe("exampleReducer", () => { test("initial state", () => { expect(exampleReducer(undefined, {})).toEqual({example: ""}); }); test ("when action type is EXAMPLE_ACTION", () => { expect(exampleReducer(undefined, {type: actionTypes.EXAMPLE_ACTION, text: "Testing"})) .toEqual({example: "Testing"}); }); });
import * as actionTypes from "../../src/actions/types"; import exampleReducer from "../../src/reducers/example-reducer"; describe("exampleReducer", () => { test("initial state", () => { expect(exampleReducer(undefined, {})).toEqual({example: ""}); }); test ("when action type is EXAMPLE_ACTION", () => { expect(exampleReducer(undefined, {type: actionTypes.EXAMPLE_ACTION, text: "Testing"})) .toEqual({example: "Testing"}); expect(exampleReducer({example: "Prior text"}, {type: actionTypes.EXAMPLE_ACTION, text: "Testing"})) .toEqual({example: "Testing"}); }); });
Test exampleReducer with prior state
Test exampleReducer with prior state
JavaScript
mit
tiere/react-starter,tiere/react-starter
--- +++ @@ -9,5 +9,8 @@ test ("when action type is EXAMPLE_ACTION", () => { expect(exampleReducer(undefined, {type: actionTypes.EXAMPLE_ACTION, text: "Testing"})) .toEqual({example: "Testing"}); + + expect(exampleReducer({example: "Prior text"}, {type: actionTypes.EXAMPLE_ACTION, text: "Testing"})) + .toEqual({example: "Testing"}); }); });
ffabc205276183238c8d6dc1676724508a035c8d
app/common/views/visualisations/volumetrics/number.js
app/common/views/visualisations/volumetrics/number.js
define([ 'extensions/views/single_stat' ], function (SingleStatView) { var NumberView = SingleStatView.extend({ changeOnSelected: true, labelPrefix: '', formatValue: function(value) { return this.formatNumericLabel(value); }, getValue: function () { return this.formatValue(this.collection.at(0).get(this.valueAttr)); }, getLabel: function () { var periodLabel = this.model.get('period') || "week"; var events = this.collection.at(0).get("weeks"), unavailableEvents = events.total - events.available, label = [ this.labelPrefix, 'last', events.total, this.pluralise(periodLabel, events.total) ]; if (unavailableEvents > 0) { label = label.concat([ "<span class='unavailable'>(" + unavailableEvents, this.pluralise(periodLabel, unavailableEvents), "unavailable)</span>" ]); } return label.join(' '); }, getValueSelected: function (selection) { return this.formatValue(selection.selectedModel.get(this.selectionValueAttr)); }, getLabelSelected: function (selection) { return this.formatPeriod(selection.selectedModel, 'week'); } }); return NumberView; });
define([ 'extensions/views/single_stat' ], function (SingleStatView) { var NumberView = SingleStatView.extend({ changeOnSelected: true, labelPrefix: '', formatValue: function(value) { return this.formatNumericLabel(value); }, getValue: function () { return this.formatValue(this.collection.at(0).get(this.valueAttr)); }, getLabel: function () { var periodLabel = this.model.get('period') || "week"; var events = this.collection.at(0).get("weeks"), unavailableEvents = events.total - events.available, label = [ this.labelPrefix, 'last', events.total, this.pluralise(periodLabel, events.total) ]; if (unavailableEvents > 0) { label = label.concat([ "<span class='unavailable'>(" + unavailableEvents, this.pluralise(periodLabel, unavailableEvents), "unavailable)</span>" ]); } return label.join(' '); }, getValueSelected: function (selection) { var val; if (selection.selectedGroupIndex !== null) { val = selection.selectedModel.get(this.selectionValueAttr); } else { val = null; } return this.formatValue(val); }, getLabelSelected: function (selection) { var val; if (selection.selectedGroupIndex !== null) { return this.formatPeriod(selection.selectedModel, 'week'); } else { return ''; } } }); return NumberView; });
Add temporary fix for problem where selected model on hover does not exist
Add temporary fix for problem where selected model on hover does not exist
JavaScript
mit
tijmenb/spotlight,alphagov/spotlight,alphagov/spotlight,keithiopia/spotlight,keithiopia/spotlight,alphagov/spotlight,tijmenb/spotlight,tijmenb/spotlight,keithiopia/spotlight
--- +++ @@ -38,11 +38,23 @@ }, getValueSelected: function (selection) { - return this.formatValue(selection.selectedModel.get(this.selectionValueAttr)); + var val; + if (selection.selectedGroupIndex !== null) { + val = selection.selectedModel.get(this.selectionValueAttr); + } else { + val = null; + } + return this.formatValue(val); }, getLabelSelected: function (selection) { - return this.formatPeriod(selection.selectedModel, 'week'); + var val; + if (selection.selectedGroupIndex !== null) { + return this.formatPeriod(selection.selectedModel, 'week'); + } else { + return ''; + } + } });
d9e6d766e7326f0cf96ad172864caa795cc02fdf
app/modules/deliberation/directives/showDiscussion.js
app/modules/deliberation/directives/showDiscussion.js
angular.module('pcApp.deliberation.directives.showDiscussion', [ 'pcApp.adhocracyEmbedder.services.adhocracy', ]) .directive('showDiscussion', ['Adhocracy', function (Adhocracy) { return { restrict: 'E', scope: { path: '@' }, link: function(scope, element, attrs) { Adhocracy.then(function (adh) { element.append(adh.getIframe('comment-listing', { path: scope.path })) }); } }; }]);
angular.module('pcApp.deliberation.directives.showDiscussion', [ 'pcApp.adhocracyEmbedder.services.adhocracy', ]) .directive('showDiscussion', ['API_CONF', 'Adhocracy', function (API_CONF, Adhocracy) { return { restrict: 'E', scope: { key: '@' }, link: function(scope, element, attrs) { Adhocracy.then(function (adh) { element.append(adh.getIframe('create-or-show-comment-listing', { "pool-path": API_CONF.ADHOCRACY_BACKEND_URL + '/adhocracy/', key: scope.key })) }); } }; }]);
Adjust show-discussion directive to actual functionality
Adjust show-discussion directive to actual functionality This now embeds the adhocracy create-or-show-comment-listing widget, which creates new commentables on the fly. This can be used as the following: <show-discussion ng-if="metric.id" data-key="metric_{{ metric.id }}"></show-discussion>
JavaScript
agpl-3.0
bullz/policycompass-frontend,cbotsikas/policycompass-frontend,policycompass/policycompass-frontend,almey/policycompass-frontend,FabiApfelkern/policycompass-frontend,mmilaprat/policycompass-frontend,policycompass/policycompass-frontend,policycompass/policycompass-frontend,almey/policycompass-frontend,bullz/policycompass-frontend,cbotsikas/policycompass-frontend,bullz/policycompass-frontend,mmilaprat/policycompass-frontend,FabiApfelkern/policycompass-frontend,FabiApfelkern/policycompass-frontend,mmilaprat/policycompass-frontend,almey/policycompass-frontend,cbotsikas/policycompass-frontend
--- +++ @@ -2,16 +2,17 @@ 'pcApp.adhocracyEmbedder.services.adhocracy', ]) -.directive('showDiscussion', ['Adhocracy', function (Adhocracy) { +.directive('showDiscussion', ['API_CONF', 'Adhocracy', function (API_CONF, Adhocracy) { return { restrict: 'E', scope: { - path: '@' + key: '@' }, link: function(scope, element, attrs) { Adhocracy.then(function (adh) { - element.append(adh.getIframe('comment-listing', { - path: scope.path + element.append(adh.getIframe('create-or-show-comment-listing', { + "pool-path": API_CONF.ADHOCRACY_BACKEND_URL + '/adhocracy/', + key: scope.key })) }); }
c2cecbfa182b27d93a4c40a602d97ee77ef5949d
fullcalendar-rightclick.js
fullcalendar-rightclick.js
/*! * fullcalendar-rightclick v1.1 * Docs & License: https://github.com/mherrmann/fullcalendar-rightclick * (c) 2015 Michael Herrmann */ (function($) { var fc = $.fullCalendar; var AgendaView = fc.views.agenda; var originalRender = AgendaView.prototype.render; AgendaView.prototype.render = function() { originalRender.call(this); this.registerDayRightclickListener(); this.registerEventRightclickListener(); }; AgendaView.prototype.registerDayRightclickListener = function() { var that = this; this.el.on('contextmenu', '.fc-widget-content .fc-slats', function(ev) { that.coordMap.build(); var cell = that.coordMap.getCell(ev.pageX, ev.pageY); if (cell) return that.trigger('dayRightclick', null, cell.start, ev); } ); }; AgendaView.prototype.registerEventRightclickListener = function() { var that = this; this.el.on('contextmenu', '.fc-event-container > *', function(ev) { var seg = $(this).data('fc-seg'); return that.trigger('eventRightclick', this, seg.event, ev); }); } })(jQuery);
/*! * fullcalendar-rightclick v1.2 * Docs & License: https://github.com/mherrmann/fullcalendar-rightclick * (c) 2015 Michael Herrmann */ (function($) { function monkeyPatchViewClass(View, dayCssClass) { var originalRender = View.prototype.render; View.prototype.render = function() { originalRender.call(this); this.registerDayRightclickListener(); this.registerEventRightclickListener(); }; View.prototype.registerDayRightclickListener = function() { var that = this; this.el.on('contextmenu', '.fc-widget-content ' + dayCssClass, function(ev) { that.coordMap.build(); var cell = that.coordMap.getCell(ev.pageX, ev.pageY); if (cell) return that.trigger( 'dayRightclick', null, cell.start, ev ); } ); }; View.prototype.registerEventRightclickListener = function() { var that = this; this.el.on('contextmenu', '.fc-event-container > *', function(ev) { var seg = $(this).data('fc-seg'); return that.trigger('eventRightclick', this, seg.event, ev); }); } } var fc = $.fullCalendar; monkeyPatchViewClass(fc.views.agenda, '.fc-slats'); monkeyPatchViewClass(fc.views.basic, '.fc-content-skeleton'); })(jQuery);
Add support for FullCalendar's month view.
Add support for FullCalendar's month view.
JavaScript
mit
mherrmann/fullcalendar-rightclick,mherrmann/fullcalendar-rightclick
--- +++ @@ -1,34 +1,39 @@ /*! - * fullcalendar-rightclick v1.1 + * fullcalendar-rightclick v1.2 * Docs & License: https://github.com/mherrmann/fullcalendar-rightclick * (c) 2015 Michael Herrmann */ (function($) { + function monkeyPatchViewClass(View, dayCssClass) { + var originalRender = View.prototype.render; + View.prototype.render = function() { + originalRender.call(this); + this.registerDayRightclickListener(); + this.registerEventRightclickListener(); + }; + View.prototype.registerDayRightclickListener = function() { + var that = this; + this.el.on('contextmenu', '.fc-widget-content ' + dayCssClass, + function(ev) { + that.coordMap.build(); + var cell = that.coordMap.getCell(ev.pageX, ev.pageY); + if (cell) + return that.trigger( + 'dayRightclick', null, cell.start, ev + ); + } + ); + }; + View.prototype.registerEventRightclickListener = function() { + var that = this; + this.el.on('contextmenu', '.fc-event-container > *', function(ev) { + var seg = $(this).data('fc-seg'); + return that.trigger('eventRightclick', this, seg.event, ev); + }); + } + } var fc = $.fullCalendar; - var AgendaView = fc.views.agenda; - var originalRender = AgendaView.prototype.render; - AgendaView.prototype.render = function() { - originalRender.call(this); - this.registerDayRightclickListener(); - this.registerEventRightclickListener(); - }; - AgendaView.prototype.registerDayRightclickListener = function() { - var that = this; - this.el.on('contextmenu', '.fc-widget-content .fc-slats', - function(ev) { - that.coordMap.build(); - var cell = that.coordMap.getCell(ev.pageX, ev.pageY); - if (cell) - return that.trigger('dayRightclick', null, cell.start, ev); - } - ); - }; - AgendaView.prototype.registerEventRightclickListener = function() { - var that = this; - this.el.on('contextmenu', '.fc-event-container > *', function(ev) { - var seg = $(this).data('fc-seg'); - return that.trigger('eventRightclick', this, seg.event, ev); - }); - } + monkeyPatchViewClass(fc.views.agenda, '.fc-slats'); + monkeyPatchViewClass(fc.views.basic, '.fc-content-skeleton'); })(jQuery);
5244b12616b2c7546d6d78f7914b22a15961a3e0
modules/contextStorage.js
modules/contextStorage.js
'use strict' var context = {/* user id */}; //TODO: Replace with node-cache /*Example: { command: '/track', stage: 'askForTrack', parameters: [ 'Mike Oldfield' ] } */ context.save = function (userId, command, stage, parameters) { context[userId] = {}; context[userId].command = command; context[userId].stage = stage; if (!context[userId].parameters) { context[userId].parameters = [parameters]; } else { context[userId].parameters.push(parameters); } }; context.delete = function (userId) { delete context[userId]; }; module.exports = context;
'use strict' var context = {/* user id */}; //TODO: Replace with node-cache /*Example: { command: '/track', stage: 'askForTrack', parameters: [ 'Mike Oldfield' ] } */ context.save = function (userId, command, stage, parameters) { context[userId] = {}; context[userId].command = command; context[userId].stage = stage; if (!context[userId].parameters) { context[userId].parameters = [parameters]; } else { context[userId].parameters.push(parameters); } }; context.pop = function (userId) { return context.parameters.pop(); }; context.delete = function (userId) { delete context[userId]; }; module.exports = context;
Add ability to pop parameters
Add ability to pop parameters
JavaScript
mit
TheBeastOfCaerbannog/last-fm-bot
--- +++ @@ -24,6 +24,10 @@ } }; +context.pop = function (userId) { + return context.parameters.pop(); +}; + context.delete = function (userId) { delete context[userId]; };
15df3d995d8177651d0806e26f000b85bebd1ce4
client/js/src/security/authentication.js
client/js/src/security/authentication.js
(function() { 'use strict'; angular.module('pub.security.authentication', []) .factory('authentication', [ '$q', '$http', 'securityContext', function($q, $http, securityContext) { var authentication = { requestSecurityContext: function() { debugger; if (securityContext.authenticated) { return $q.when(securityContext); } else { var deferred = $q.defer(); $http.get('/users/current', null).success(function(user) { deferred.resolve(securityContext.setAuthentication(user)); }) return deferred.promise; } }, login: function(user, success, error) { $http.post('/login', user, null) .success(function(user) { success(user); securityContext.setAuthentication(user); }) .error(error); }, logout: function(success, error) { securityContext.reset(); $http.get('/logout').success(success).error(error); } } return authentication; } ]); }());
(function() { 'use strict'; angular.module('pub.security.authentication', []) .factory('authentication', [ '$q', '$http', 'securityContext', function($q, $http, securityContext) { var authentication = { requestSecurityContext: function() { if (securityContext.authenticated) { return $q.when(securityContext); } else { var deferred = $q.defer(); $http.get('/users/current', null).success(function(user) { deferred.resolve(securityContext.setAuthentication(user)); }) return deferred.promise; } }, login: function(user, success, error) { $http.post('/login', user, null) .success(function(user) { success(user); securityContext.setAuthentication(user); }) .error(error); }, logout: function(success, error) { securityContext.reset(); $http.get('/logout').success(success).error(error); } } return authentication; } ]); }());
Remove dubugger; statement from auth controller.
Remove dubugger; statement from auth controller.
JavaScript
mit
carlospaelinck/publications-js,carlospaelinck/publications-js
--- +++ @@ -11,7 +11,6 @@ var authentication = { requestSecurityContext: function() { - debugger; if (securityContext.authenticated) { return $q.when(securityContext);
968ef346f21ebe8048feb1c725c0c31fd77879c1
src/routers/group_router.js
src/routers/group_router.js
import {validate_request} from '../utils/errors' import express from 'express' function validate_request_body(request, response, next_handler) { request.checkBody({ 'screen_name': { notEmpty: { errorMessage: 'parameter is required', }, }, }) validate_request(request, next_handler) } const all_groups_router = express.Router() all_groups_router.route('/groups') .get((request, response) => { response.json({}) }) .post(validate_request_body, (request, response) => { response.json({ group: request.body, }) }) const one_group_router = express.Router() one_group_router.param('group_id', (request, response, next_handler) => { request.checkParams('group_id', 'parameter is required').notEmpty() request .checkParams('group_id', 'parameter must be a MongoDB ObjectId') .isMongoId() validate_request(request, next_handler) }) one_group_router.route('/groups/:group_id') .delete((request, response) => { response.json({ group_id: request.params.group_id, }) }) export const group_router = express.Router() group_router.use(all_groups_router) group_router.use(one_group_router)
import {check_authentication, validate_request} from '../utils/errors' import express from 'express' function validate_request_body(request, response, next_handler) { request.checkBody({ 'screen_name': { notEmpty: { errorMessage: 'parameter is required', }, }, }) validate_request(request, next_handler) } const all_groups_router = express.Router() all_groups_router.route('/groups') .get(check_authentication, (request, response) => { response.json({}) }) .post(check_authentication, validate_request_body, (request, response) => { response.json({ group: request.body, }) }) const one_group_router = express.Router() one_group_router.param('group_id', (request, response, next_handler) => { request.checkParams('group_id', 'parameter is required').notEmpty() request .checkParams('group_id', 'parameter must be a MongoDB ObjectId') .isMongoId() validate_request(request, next_handler) }) one_group_router.route('/groups/:group_id') .delete(check_authentication, (request, response) => { response.json({ group_id: request.params.group_id, }) }) export const group_router = express.Router() group_router.use(all_groups_router) group_router.use(one_group_router)
Check an authentication in the group router
Check an authentication in the group router
JavaScript
mit
thewizardplusplus/vk-group-stats,thewizardplusplus/vk-group-stats
--- +++ @@ -1,4 +1,4 @@ -import {validate_request} from '../utils/errors' +import {check_authentication, validate_request} from '../utils/errors' import express from 'express' function validate_request_body(request, response, next_handler) { @@ -15,10 +15,10 @@ const all_groups_router = express.Router() all_groups_router.route('/groups') - .get((request, response) => { + .get(check_authentication, (request, response) => { response.json({}) }) - .post(validate_request_body, (request, response) => { + .post(check_authentication, validate_request_body, (request, response) => { response.json({ group: request.body, }) @@ -34,7 +34,7 @@ validate_request(request, next_handler) }) one_group_router.route('/groups/:group_id') - .delete((request, response) => { + .delete(check_authentication, (request, response) => { response.json({ group_id: request.params.group_id, })
625ba111d23a074c638df40b95c21fa9c36a5868
src/recursion/pascalsTriangle.js
src/recursion/pascalsTriangle.js
/** * Pascal's triangle is defined as the rth column of the nth row is n! / ( r! x (n - r)!) * * @param {Integer} n * @return {Array} int array where each value represents a level in the triangle. */ function pascalsTriangle(n) { // Check if n is 0. if (!n) return []; // Start with the first level already made. var triangle = [[1]]; // Add each level after the first. for (var i = 0; i < n - 1; i++) { // Each level starts with 1. var level = [1]; for (var j = 1; j < triangle[i].length; j++) { level[j] = triangle[i][j] + triangle[i][j - 1]; } // Each level ends with 1. level.push(1); triangle.push(level); } return triangle; } module.exports = pascalsTriangle;
/** * Pascal's triangle is defined as the rth column of the nth row is n! / ( r! x (n - r)!) * * @param {Integer} n * @return {Array} int array where each value represents a level in the triangle. */ function pascalsTriangle(n) { // Check if the triangle is empty. if (!n) return []; return pascalsTriangleRecursive(n, [[1]]); } function pascalsTriangleRecursive(n, triangle) { // jshint ignore:line if (n <= 1) return triangle; // Each level starts with 1; var level = [1]; var above = triangle[triangle.length - 1]; // A direct child level has exactly one more value. for (var i = 1; i < above.length; i ++) { level[i] = above[i] + above[i - 1]; } // Each level ends with 1. level.push(1); triangle.push(level); return pascalsTriangleRecursive(n - 1, triangle); } function pascalsTriangleIterative(n) { // jshint ignore:line // Check if n is 0. if (!n) return []; // Start with the first level already made. var triangle = [[1]]; // Add each level after the first. for (var i = 0; i < n - 1; i++) { // Each level starts with 1. var level = [1]; for (var j = 1; j < triangle[i].length; j++) { level[j] = triangle[i][j] + triangle[i][j - 1]; } // Each level ends with 1. level.push(1); triangle.push(level); } return triangle; } module.exports = pascalsTriangle;
Add recursive solution for pascals triangle
Add recursive solution for pascals triangle
JavaScript
mit
vinnyoodles/algorithms,vinnyoodles/algorithms,vinnyoodles/algorithms
--- +++ @@ -5,6 +5,32 @@ * @return {Array} int array where each value represents a level in the triangle. */ function pascalsTriangle(n) { + // Check if the triangle is empty. + if (!n) return []; + + return pascalsTriangleRecursive(n, [[1]]); +} + +function pascalsTriangleRecursive(n, triangle) { // jshint ignore:line + if (n <= 1) return triangle; + + // Each level starts with 1; + var level = [1]; + var above = triangle[triangle.length - 1]; + + // A direct child level has exactly one more value. + for (var i = 1; i < above.length; i ++) { + level[i] = above[i] + above[i - 1]; + } + + // Each level ends with 1. + level.push(1); + triangle.push(level); + + return pascalsTriangleRecursive(n - 1, triangle); +} + +function pascalsTriangleIterative(n) { // jshint ignore:line // Check if n is 0. if (!n) return [];
a5164cf372f181da57ce972a5de8e3a91e2f4a5d
src/redux/reducer.js
src/redux/reducer.js
import * as actType from './action-types'; const initialState = { loadingApi: undefined, runtimeApi: undefined, }; function loadApi(state = initialState, action) { switch (action.type) { case actType.START_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'started'}); case actType.FINISH_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'finished', runtimeApi: action.payload}); case actType.FAIL_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'failed'}); default: return state; } } export default loadApi;
import * as actType from './action-types'; const initialState = { loadingApi: undefined, runtimeApi: undefined, error: undefined }; function loadApi(state = initialState, action) { switch (action.type) { case actType.START_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'started'}); case actType.FINISH_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'finished', runtimeApi: action.payload}); case actType.FAIL_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'failed', error: action.payload}); default: return state; } } export default loadApi;
Add error state and fail payload
Add error state and fail payload
JavaScript
apache-2.0
pcardune/pyret-ide,pcardune/pyret-ide
--- +++ @@ -3,6 +3,7 @@ const initialState = { loadingApi: undefined, runtimeApi: undefined, + error: undefined }; function loadApi(state = initialState, action) { @@ -12,7 +13,7 @@ case actType.FINISH_LOAD_RUNTIME: return Object.assign({}, state, {loadingApi: 'finished', runtimeApi: action.payload}); case actType.FAIL_LOAD_RUNTIME: - return Object.assign({}, state, {loadingApi: 'failed'}); + return Object.assign({}, state, {loadingApi: 'failed', error: action.payload}); default: return state; }
66d004e2b1f4fb5a269587519bb4a47b25935648
test/specs/issues.spec.js
test/specs/issues.spec.js
'use strict' const vuedoc = require('../..') /* global describe it expect */ describe('issues', () => { describe('#21 - undefined default value is rendering as a non string', () => { it('undefined default value is rendering as a non string', () => { const filecontent = ` <script> export default { props: { value: { type: Boolean, default: undefined } } } </script> ` const options = { filecontent } const expected = [ '# Props', '', '| Name | Type | Description | Default |', '| --------- | --------- | ----------- | ----------- |', '| `v-model` | `Boolean` | | `undefined` |' ].join('\n') return vuedoc.md(options).then((doc) => expect(doc.trim()).toEqual(expected)) }) }) })
'use strict' const vuedoc = require('../..') /* global describe it expect */ describe('issues', () => { describe('#21 - undefined default value is rendering as a non string', () => { it('undefined default value is rendering as a non string', () => { const filecontent = ` <script> export default { props: { value: { type: Boolean, default: undefined } } } </script> ` const options = { filecontent } const expected = [ '# Props', '', '| Name | Type | Description | Default |', '| --------- | --------- | ----------- | ----------- |', '| `v-model` | `Boolean` | | `undefined` |' ].join('\n') return vuedoc.md(options).then((doc) => expect(doc.trim()).toEqual(expected)) }) }) describe('#7 - Spread Operator not working in component methods', () => { it('should parse without errors', () => { const options = { filecontent: ` <script> import { mapActions, mapMutations, mapGetters } from 'vuex'; export default { methods: { ...mapActions(['storeAction']), ...mapMutations(['storeMutation']), }, computed: { ...mapGetters(['storeGetter']), } } </script> ` } const expected = [].join('\n') return vuedoc.md(options).then((doc) => expect(doc.trim()).toEqual(expected)) }) }) })
Add a test for Spread Operator
Add a test for Spread Operator This closes #7
JavaScript
mit
vuedoc/md,vuedoc/md
--- +++ @@ -32,4 +32,30 @@ return vuedoc.md(options).then((doc) => expect(doc.trim()).toEqual(expected)) }) }) + + describe('#7 - Spread Operator not working in component methods', () => { + it('should parse without errors', () => { + const options = { + filecontent: ` + <script> + import { mapActions, mapMutations, mapGetters } from 'vuex'; + + export default { + methods: { + ...mapActions(['storeAction']), + ...mapMutations(['storeMutation']), + }, + computed: { + ...mapGetters(['storeGetter']), + } + } + </script> + ` + } + + const expected = [].join('\n') + + return vuedoc.md(options).then((doc) => expect(doc.trim()).toEqual(expected)) + }) + }) })
04984d3ca2479e98cdec679d707d129eeb30af60
db/create.js
db/create.js
#!/usr/bin/env node var exec = require('child_process').exec; var dbconfig = require(process.cwd() + '/config/database'); var envconfig = dbconfig[process.env.FP_NODE_ENV]; if (!envconfig) throw('invalid environment variable'); function parse (value) { if (typeof(value) == 'object') { return process.env[value.ENV]; } else { return value; } } var user = parse(envconfig.user), host = parse(envconfig.host), port = parse(envconfig.port), pass = parse(envconfig.password), db = parse(envconfig.database); if (!db) throw('Database name must be specified in an environment variable.'); var query = 'psql -c "CREATE DATABASE ' + db + ';"'; if (user) query += ' -U ' + user; if (host) query += ' -h ' + host; if (port) query += ' -p ' + port; if (pass) query += ' -w ' + pass; exec(query, function (err, res) { if (err) throw(err); console.log(res); console.log(db + ' database created successfully!'); });
#!/usr/bin/env node var exec = require('child_process').exec; var dbconfig = require(process.cwd() + '/config/database'); var envconfig = dbconfig[process.env.FP_NODE_ENV]; if (!envconfig) throw('invalid environment variable'); function parse (value) { if (typeof(value) == 'object') { return process.env[value.ENV]; } else { return value; } } var user = parse(envconfig.user), host = parse(envconfig.host), port = parse(envconfig.port), pass = parse(envconfig.password), db = parse(envconfig.database); if (!db) throw('Database name must be specified in an environment variable.'); var query = 'psql -c "CREATE DATABASE ' + db + ';"'; if (user) query += ' -U ' + user; if (host) query += ' -h ' + host; if (port) query += ' -p ' + port; if (pass) query += ' -w' + pass; exec(query, function (err, res) { if (err) throw(err); console.log(res); console.log(db + ' database created successfully!'); });
Remove space between flag and password
Remove space between flag and password
JavaScript
bsd-3-clause
codeforamerica/fast_pass
--- +++ @@ -28,7 +28,7 @@ if (user) query += ' -U ' + user; if (host) query += ' -h ' + host; if (port) query += ' -p ' + port; -if (pass) query += ' -w ' + pass; +if (pass) query += ' -w' + pass; exec(query, function (err, res) { if (err) throw(err);
14db900ae0d48c8b80f9089bcc6192f229a2ec91
src/engines/json/validationError.js
src/engines/json/validationError.js
/** * Error * * @constructor */ var ValidationError = function() { this.length = 0; }; ValidationError.prototype.push = function(item) { this[this.length] = item; this.length += 1; }; /** * GetProperties */ ValidationError.prototype.getProperties = function() { return pluck(this, 'property'); }; ValidationError.prototype.getMessages = function() { };
/** * Error * * @constructor */ var ValidationError = function() { this.length = 0; }; ValidationError.prototype.push = function(error) { this[this.length] = { property: error.property, propertyValue: error.propertyValue, attributeName: error.attributeName, attributeValue: error.attributeValue, message: error.message, // Deprecated validator: error.attributeName, validatorName: error.attributeName, validatoValue: error.attributeValue }; this.length += 1; }; /** * GetProperties */ ValidationError.prototype.getProperties = function() { return pluck(this, 'property'); }; /** * GetMessages */ ValidationError.prototype.getMessages = function() { return pluck(this, 'message'); };
Add a compatibility layer to the ‘Error’ object
Add a compatibility layer to the ‘Error’ object
JavaScript
mit
Baggz/Amanda,apiaryio/Amanda,apiaryio/Amanda
--- +++ @@ -7,9 +7,25 @@ this.length = 0; }; -ValidationError.prototype.push = function(item) { - this[this.length] = item; +ValidationError.prototype.push = function(error) { + + this[this.length] = { + + property: error.property, + propertyValue: error.propertyValue, + attributeName: error.attributeName, + attributeValue: error.attributeValue, + message: error.message, + + // Deprecated + validator: error.attributeName, + validatorName: error.attributeName, + validatoValue: error.attributeValue + + }; + this.length += 1; + }; /** @@ -19,6 +35,9 @@ return pluck(this, 'property'); }; +/** + * GetMessages + */ ValidationError.prototype.getMessages = function() { - + return pluck(this, 'message'); };
7e6b7463cb3c6a81d32f8bbb3d4a5af0dad57737
test/apk_test_v24.js
test/apk_test_v24.js
var assert = require("assert"); var parseApk = require(".."); describe("APK V24", function () { var output = null; before(function (done) { parseApk(__dirname + "/samples/test_v24.apk", function (err, out) { if (err) { return done(err); } output = out; done(); }); }); it("Parses correctly", function () { assert.notEqual(null, output); }); it("Starts with a manifest tag", function () { assert.equal(output.manifest.length, 1); }); it("Has a package name", function () { assert.equal(output.manifest[0]["@package"], "org.rubenv.testapk"); }); it("Has a package version", function () { assert.equal(output.manifest[0]["@platformBuildVersionCode"], "21"); }); it("Has an application tag", function () { var manifest = output.manifest[0]; assert.equal(manifest.application.length, 1); }); });
var assert = require("assert"); var parseApk = require(".."); describe("APK V24", function () { var output = null; before(function (done) { parseApk(__dirname + "/samples/test_v24.apk", function (err, out) { if (err) { return done(err); } output = out; done(); }); }); it("Parses correctly", function () { assert.notEqual(null, output); }); it("Starts with a manifest tag", function () { assert.equal(output.manifest.length, 1); }); it("Has a package name", function () { assert.equal(output.manifest[0]["@package"], "com.idotools.bookstore"); }); it("Has a package version", function () { assert.equal(output.manifest[0]["@platformBuildVersionCode"], "24"); }); it("Has an application tag", function () { var manifest = output.manifest[0]; assert.equal(manifest.application.length, 1); }); });
Change test_v24 to the correct item.
Change test_v24 to the correct item.
JavaScript
mit
rubenv/node-apk-parser
--- +++ @@ -23,11 +23,11 @@ }); it("Has a package name", function () { - assert.equal(output.manifest[0]["@package"], "org.rubenv.testapk"); + assert.equal(output.manifest[0]["@package"], "com.idotools.bookstore"); }); it("Has a package version", function () { - assert.equal(output.manifest[0]["@platformBuildVersionCode"], "21"); + assert.equal(output.manifest[0]["@platformBuildVersionCode"], "24"); }); it("Has an application tag", function () {
ac87ce6e6055531f6e33a8def6014be7ad53f44b
test/notSupported.js
test/notSupported.js
/*global describe, it */ /*exported should */ /*jshint -W030 */ var should = require('should'), supertest = require('supertest'), app = require('../app'); describe('notSupported', function() { it('should not support anything', function(done) { supertest(app). get('/api/v1/'). expect(500, function(err, res) { should.equal(res.body.request_type, 'atomic'); should.equal(res.body.response_code, 500); res.body.resource_status.should.be.length(1); should.equal(res.body.resource_status[0].resource, '*'); should.equal(res.body.resource_status[0].response_code, '500'); res.body.resource_status[0].errors.should.be.length(1); should.equal( res.body.resource_status[0].errors[0].code, 'NOT_SUPPORTED'); done(); }); }); });
/*global describe, it */ /*exported should */ /*jshint -W030 */ var should = require('should'), supertest = require('supertest'), app = require('../app'); describe('notSupported', function() { it('should not support any resources', function(done) { supertest(app). get('/api/v1/questions'). expect(500, function(err, res) { should.equal(res.body.request_type, 'atomic'); should.equal(res.body.response_code, 500); res.body.resource_status.should.be.length(1); should.equal(res.body.resource_status[0].resource, '*'); should.equal(res.body.resource_status[0].response_code, '500'); res.body.resource_status[0].errors.should.be.length(1); should.equal( res.body.resource_status[0].errors[0].code, 'NOT_SUPPORTED'); done(); }); }); it('should 404 non-api requests', function(done) { supertest(app). get('/allTheThings'). expect(404, done); }); });
Test AEP and non-API 404s
Test AEP and non-API 404s Signed-off-by: shaisachs <47bd79f9420edf5d0991d1e2710179d4e040d480@ngpvan.com>
JavaScript
apache-2.0
joshco/osdi-service,NGPVAN/osdi-service
--- +++ @@ -8,9 +8,9 @@ describe('notSupported', function() { - it('should not support anything', function(done) { + it('should not support any resources', function(done) { supertest(app). - get('/api/v1/'). + get('/api/v1/questions'). expect(500, function(err, res) { should.equal(res.body.request_type, 'atomic'); should.equal(res.body.response_code, 500); @@ -25,4 +25,10 @@ }); }); + it('should 404 non-api requests', function(done) { + supertest(app). + get('/allTheThings'). + expect(404, done); + }); + });
bfe5961922d3b73e1f3dfef126bab4c0064a8afd
client/js/directives/give-focus-directive.js
client/js/directives/give-focus-directive.js
"use strict"; angular.module("hikeio"). directive("giveFocus", ["$timeout", function($timeout) { return { link: function(scope, element, attributes) { scope.$watch(attributes.giveFocus, function(value) { if (value) { $timeout(function() { element.focus(); }); } }); } }; }]);
"use strict"; angular.module("hikeio"). directive("giveFocus", ["$timeout", function($timeout) { return { link: function(scope, element, attributes) { scope.$watch(attributes.giveFocus, function(value) { if (value) { $timeout(function() { element.focus(); // Set focus to the end of the input // http://stackoverflow.com/questions/1056359/set-mouse-focus-and-move-cursor-to-end-of-input-using-jquery if (element.is("input")) { var val = element.val(); element.val(""); element.val(val); } }); } }); } }; }]);
Set focus to the end of the input when giving focus, matters on the preopulated add dialog.
Set focus to the end of the input when giving focus, matters on the preopulated add dialog.
JavaScript
mit
zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io
--- +++ @@ -8,6 +8,14 @@ if (value) { $timeout(function() { element.focus(); + + // Set focus to the end of the input + // http://stackoverflow.com/questions/1056359/set-mouse-focus-and-move-cursor-to-end-of-input-using-jquery + if (element.is("input")) { + var val = element.val(); + element.val(""); + element.val(val); + } }); } });
57c67f110ddbfcc17ae6ab83170018bd778c0062
web_client/views/layout/HeaderView.js
web_client/views/layout/HeaderView.js
import View from '../View'; import HeaderAnalysesView from './HeaderAnalysesView'; import HeaderUserView from './HeaderUserView'; import HeaderImageView from './HeaderImageView'; import router from '../../router'; import events from '../../events'; import headerTemplate from '../../templates/layout/header.pug'; import '../../stylesheets/layout/header.styl'; var HeaderView = View.extend({ events: { 'click .g-app-title': function () { router.navigate('', {trigger: true}); } }, initialize() { this.listenTo(events, 'h:imageOpened', this._setImageText); return View.prototype.initialize.apply(this, arguments); }, render() { this.$el.html(headerTemplate()); this.$('a[title]').tooltip({ placement: 'bottom', delay: {show: 300} }); new HeaderUserView({ el: this.$('.h-current-user-wrapper'), parentView: this }).render(); new HeaderImageView({ el: this.$('.h-image-menu-wrapper'), parentView: this }).render(); new HeaderAnalysesView({ el: this.$('.h-analyses-wrapper'), parentView: this }).render(); return this; }, _setImageText(img) { console.log(img); } }); export default HeaderView;
import View from '../View'; import HeaderAnalysesView from './HeaderAnalysesView'; import HeaderUserView from './HeaderUserView'; import HeaderImageView from './HeaderImageView'; import router from '../../router'; import headerTemplate from '../../templates/layout/header.pug'; import '../../stylesheets/layout/header.styl'; var HeaderView = View.extend({ events: { 'click .g-app-title': function () { router.navigate('', {trigger: true}); } }, initialize() { return View.prototype.initialize.apply(this, arguments); }, render() { this.$el.html(headerTemplate()); this.$('a[title]').tooltip({ placement: 'bottom', delay: {show: 300} }); new HeaderUserView({ el: this.$('.h-current-user-wrapper'), parentView: this }).render(); new HeaderImageView({ el: this.$('.h-image-menu-wrapper'), parentView: this }).render(); new HeaderAnalysesView({ el: this.$('.h-analyses-wrapper'), parentView: this }).render(); return this; } }); export default HeaderView;
Remove _setImageText in image header
Remove _setImageText in image header
JavaScript
apache-2.0
DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK
--- +++ @@ -3,7 +3,6 @@ import HeaderUserView from './HeaderUserView'; import HeaderImageView from './HeaderImageView'; import router from '../../router'; -import events from '../../events'; import headerTemplate from '../../templates/layout/header.pug'; import '../../stylesheets/layout/header.styl'; @@ -16,7 +15,6 @@ }, initialize() { - this.listenTo(events, 'h:imageOpened', this._setImageText); return View.prototype.initialize.apply(this, arguments); }, @@ -44,10 +42,6 @@ }).render(); return this; - }, - - _setImageText(img) { - console.log(img); } });
adb12ea094d1e4b82d45489ff3bccf84b5a7791f
src/styles/PrinterStyles.js
src/styles/PrinterStyles.js
export const printStyles = `<style> div { border-radius: 0px !important; box-shadow: none !important; } @media print { @page { margin: 0; } body { margin: 0 0; } img {visibility: hidden; } } </style>`;
export const printStyles = `<style> div { border-width: 0px ! important; border-radius: 0px !important; box-shadow: none !important;} img { visibility: hidden; } @media print { @page { margin: 0; } body { margin: 0 0; } } </style>`;
Fix pdf image appearing and borders appering
[styling]: Fix pdf image appearing and borders appering
JavaScript
mit
AndrewTHuang/fear-the-repo,sujaypatel16/fear-the-repo,dont-fear-the-repo/fear-the-repo,dont-fear-the-repo/fear-the-repo,AndrewTHuang/fear-the-repo,sujaypatel16/fear-the-repo
--- +++ @@ -1,13 +1,15 @@ export const printStyles = `<style> - div { - border-radius: 0px !important; - box-shadow: none !important; } +div { + border-width: 0px ! important; + border-radius: 0px !important; + box-shadow: none !important;} - @media print { - @page { margin: 0; } - body { margin: 0 0; } - img {visibility: hidden; } - } + img { + visibility: hidden; } +@media print { + @page { margin: 0; } + body { margin: 0 0; } +} </style>`;
514a9f2a5b58adefd596d6551373c48397f12076
chromeapi.js
chromeapi.js
(function() { // Find the parent window, which has its parent set to itself. var parentWindow = window; while (parentWindow.parent !== parentWindow) { parentWindow = parentWindow.parent; } function failFunc(msg) { parentWindow.alert('fail: ' + msg); } var onLaunchedListeners = []; chrome = {}; chrome.app = {}; chrome.app.runtime = {}; chrome.app.runtime.onLaunched = {}; chrome.app.runtime.onLaunched.addListener = function(func) { onLaunchedListeners.push(func); }; chrome.app.runtime.onLaunched.fire = function() { for (var i = 0, f; f = onLaunchedListeners[i]; ++i) { f(); } }; chrome.app.window = {}; chrome.app.window.create = function(filePath, opt_options, opt_callback) { console.log('fetching ' + filePath); var xhr = new XMLHttpRequest(); xhr.open('GET', filePath, true); xhr.onload = function() { console.log('found ' + filePath); document.open(); document.write(xhr.responseText); document.close(); }; xhr.onerror = failFunc('xhr'); xhr.send(); }; })();
(function() { // Find the parent window, which has its parent set to itself. var parentWindow = window; while (parentWindow.parent !== parentWindow) { parentWindow = parentWindow.parent; } var onLaunchedListeners = []; chrome = {}; chrome.app = {}; chrome.app.runtime = {}; chrome.app.runtime.onLaunched = {}; chrome.app.runtime.onLaunched.addListener = function(func) { onLaunchedListeners.push(func); }; chrome.app.runtime.onLaunched.fire = function() { for (var i = 0, f; f = onLaunchedListeners[i]; ++i) { f(); } }; chrome.app.window = {}; chrome.app.window.create = function(filePath, opt_options, opt_callback) { console.log('fetching ' + filePath); var xhr = new XMLHttpRequest(); xhr.open('GET', filePath, true); xhr.onload = function() { console.log('found ' + filePath); document.open(); document.write(xhr.responseText); document.close(); }; xhr.onerror = function() { alert('XHR failed'); }; xhr.send(); }; })();
Fix XHR failed alerts firing incorrectly.
Fix XHR failed alerts firing incorrectly.
JavaScript
bsd-3-clause
hgl888/mobile-chrome-apps,hgl888/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,guozanhua/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,chirilo/mobile-chrome-apps,hgl888/mobile-chrome-apps,wudkj/mobile-chrome-apps,chirilo/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,wudkj/mobile-chrome-apps,wudkj/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,chirilo/mobile-chrome-apps,hgl888/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,guozanhua/mobile-chrome-apps,hgl888/mobile-chrome-apps,chirilo/mobile-chrome-apps,hgl888/mobile-chrome-apps,hgl888/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,guozanhua/mobile-chrome-apps,guozanhua/mobile-chrome-apps,wudkj/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps
--- +++ @@ -3,10 +3,6 @@ var parentWindow = window; while (parentWindow.parent !== parentWindow) { parentWindow = parentWindow.parent; - } - - function failFunc(msg) { - parentWindow.alert('fail: ' + msg); } var onLaunchedListeners = []; @@ -33,7 +29,9 @@ document.write(xhr.responseText); document.close(); }; - xhr.onerror = failFunc('xhr'); + xhr.onerror = function() { + alert('XHR failed'); + }; xhr.send(); }; })();
e46fd7eb7d2040145d3aab2fe0e097856c4de20d
tests/test-loader.js
tests/test-loader.js
// TODO: load based on params Ember.keys(requirejs._eak_seen).filter(function(key) { return (/\_test/).test(key); }).forEach(function(moduleName) { require(moduleName, null, null, true); });
// TODO: load based on params Ember.keys(requirejs._eak_seen).filter(function(key) { return (/\-test/).test(key); }).forEach(function(moduleName) { require(moduleName, null, null, true); });
Fix test loader for dasherized file names.
Fix test loader for dasherized file names. Commit 036df2e2c00aee broke the test loader so that no test modules were found or loaded, and no tests run.
JavaScript
mit
tobobo/vice-frontend,mtian/ember-app-kit-azure,stefanpenner/ember-app-kit,digitalplaywright/eak-simple-auth-blog-client,achambers/appkit-hanging-test-example,michaelorionmcmanus/eak-bootstrap,shin1ohno/want-js,grese/miner-app-OLD,grese/miner-app-OLD,lucaspottersky/ember-lab-eak,tomclose/minimal_eak_test_stub_problem,tobobo/thyme-frontend,tomclose/test_loading_problem,stefanpenner/ember-app-kit,ghempton/ember-libs-example,kiwiupover/ember-weather,kiwiupover/ember-weather,Anshdesire/ember-app-kit,tobobo/thyme-frontend,lucaspottersky/ember-lab-eak,Anshdesire/ember-app-kit,shin1ohno/EmberAppKit,aboveproperty/ember-app-kit-karma,sajt/ember-weather,sajt/ember-weather,digitalplaywright/eak-simple-auth,mtian/ember-app-kit-azure
--- +++ @@ -1,6 +1,6 @@ // TODO: load based on params Ember.keys(requirejs._eak_seen).filter(function(key) { - return (/\_test/).test(key); + return (/\-test/).test(key); }).forEach(function(moduleName) { require(moduleName, null, null, true); });
217ad8ea81bc57b3bc9830d83b6798bdd11a03e5
packages/components/containers/domains/AddressesSection.js
packages/components/containers/domains/AddressesSection.js
import React from 'react'; import { c } from 'ttag'; import PropTypes from 'prop-types'; import { Alert, Button, PrimaryButton, Block } from 'react-components'; const AddressesSection = ({ onRedirect }) => { return ( <> <Alert>{c('Info for domain modal') .t`Addresses must be connected to an user account. Click Add user to add a new user account with its own login and inbox that you can connect addresses to.`}</Alert> <Block> <PrimaryButton className="mr1" onClick={() => onRedirect('/settings/addresses')}>{c('Action') .t`Add address`}</PrimaryButton> <Button onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</Button> </Block> </> ); }; AddressesSection.propTypes = { onRedirect: PropTypes.func.isRequired }; export default AddressesSection;
import React from 'react'; import { c } from 'ttag'; import PropTypes from 'prop-types'; import { Alert, PrimaryButton, Block } from 'react-components'; const AddressesSection = ({ onRedirect }) => { return ( <> <Alert>{c('Info for domain modal') .t`If you have a subscription plan with multi-user support, you can add users to your domain by clicking on the button below.`}</Alert> <Block> <PrimaryButton onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</PrimaryButton> </Block> <Alert>{c('Info for domain modal') .t`Already have all the users you need? Click on the button below to add addresses to your users. More addresses can be purchased by customizing your plan from the subscription section.`}</Alert> <Block> <PrimaryButton onClick={() => onRedirect('/settings/addresses')}>{c('Action') .t`Add address`}</PrimaryButton> </Block> </> ); }; AddressesSection.propTypes = { onRedirect: PropTypes.func.isRequired }; export default AddressesSection;
Update text for addresses section
Update text for addresses section
JavaScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,17 +1,21 @@ import React from 'react'; import { c } from 'ttag'; import PropTypes from 'prop-types'; -import { Alert, Button, PrimaryButton, Block } from 'react-components'; +import { Alert, PrimaryButton, Block } from 'react-components'; const AddressesSection = ({ onRedirect }) => { return ( <> <Alert>{c('Info for domain modal') - .t`Addresses must be connected to an user account. Click Add user to add a new user account with its own login and inbox that you can connect addresses to.`}</Alert> + .t`If you have a subscription plan with multi-user support, you can add users to your domain by clicking on the button below.`}</Alert> <Block> - <PrimaryButton className="mr1" onClick={() => onRedirect('/settings/addresses')}>{c('Action') + <PrimaryButton onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</PrimaryButton> + </Block> + <Alert>{c('Info for domain modal') + .t`Already have all the users you need? Click on the button below to add addresses to your users. More addresses can be purchased by customizing your plan from the subscription section.`}</Alert> + <Block> + <PrimaryButton onClick={() => onRedirect('/settings/addresses')}>{c('Action') .t`Add address`}</PrimaryButton> - <Button onClick={() => onRedirect('/settings/members')}>{c('Action').t`Add user`}</Button> </Block> </> );
a12ef315f9f8996b7b0a9036f4c82ba168e09c51
test/javascript/public/test/settings.js
test/javascript/public/test/settings.js
QUnit.config.urlConfig.push({ id: "jquery", label: "jQuery version", value: ["3.2.1", "3.2.0", "3.1.1", "3.0.0", "2.2.4", "2.1.4", "2.0.3", "1.12.4", "1.11.3"], tooltip: "What jQuery Core version to test against" }); /* Hijacks normal form submit; lets it submit to an iframe to prevent * navigating away from the test suite */ $(document).on('submit', function(e) { if (!e.isDefaultPrevented()) { var form = $(e.target), action = form.attr('action'), name = 'form-frame' + jQuery.guid++, iframe = $('<iframe name="' + name + '" />'); if (action && action.indexOf('iframe') < 0) form.attr('action', action + '?iframe=true') form.attr('target', name); $('#qunit-fixture').append(iframe); form.trigger('iframe:loading'); } });
QUnit.config.urlConfig.push({ id: "jquery", label: "jQuery version", value: ["3.2.1", "3.2.1.slim", "3.1.1", "3.1.1.slim", "3.0.0", "3.0.0.slim", "2.2.4", "2.1.4", "2.0.3", "1.12.4", "1.11.3"], tooltip: "What jQuery Core version to test against" }); /* Hijacks normal form submit; lets it submit to an iframe to prevent * navigating away from the test suite */ $(document).on('submit', function(e) { if (!e.isDefaultPrevented()) { var form = $(e.target), action = form.attr('action'), name = 'form-frame' + jQuery.guid++, iframe = $('<iframe name="' + name + '" />'); if (action && action.indexOf('iframe') < 0) form.attr('action', action + '?iframe=true') form.attr('target', name); $('#qunit-fixture').append(iframe); form.trigger('iframe:loading'); } });
Test against jQuery slim 3.x
Test against jQuery slim 3.x
JavaScript
mit
DavyJonesLocker/client_side_validations,DavyJonesLocker/client_side_validations,DavyJonesLocker/client_side_validations
--- +++ @@ -1,7 +1,7 @@ QUnit.config.urlConfig.push({ id: "jquery", label: "jQuery version", - value: ["3.2.1", "3.2.0", "3.1.1", "3.0.0", "2.2.4", "2.1.4", "2.0.3", "1.12.4", "1.11.3"], + value: ["3.2.1", "3.2.1.slim", "3.1.1", "3.1.1.slim", "3.0.0", "3.0.0.slim", "2.2.4", "2.1.4", "2.0.3", "1.12.4", "1.11.3"], tooltip: "What jQuery Core version to test against" });
70ca3912f97118b3f583eca4299114c8ecc67e52
minivents.js
minivents.js
function Events(target){ var events = {}, i, list, args, A = Array; target = target || this /** * On: listen to events */ target.on = function(type, func, ctx){ events[type] || (events[type] = []) events[type].push({f:func, c:ctx}) } /** * Off: stop listening to event / specific callback */ target.off = function(type, func){ list = events[type] || [] i = list.length = func ? list.length : 0 while(i-->0) func == list[i].f && list.splice(i,1) } /** * Emit: send event, callbacks will be triggered */ target.emit = function(){ args = A.apply([], arguments) list = events[args.shift()] || [] i = list.length for(j=0;j<i;j++) list[j].f.apply(list[j].c, args) }; } var u, module, cjs = module != u; (!cjs ? window : module)[(cjs ? 'exports' : 'Events')] = Events;
function Events(target){ var events = {}, i, list, args, A = Array; target = target || this /** * On: listen to events */ target.on = function(type, func, ctx){ events[type] || (events[type] = []) events[type].push({f:func, c:ctx}) } /** * Off: stop listening to event / specific callback */ target.off = function(type, func){ list = events[type] || [] i = list.length = func ? list.length : 0 while(i-->0) func == list[i].f && list.splice(i,1) } /** * Emit: send event, callbacks will be triggered */ target.emit = function(){ args = A.apply([], arguments) list = events[args.shift()] || [] i = list.length for(j=0;j<i;j++) list[j].f.apply(list[j].c, args) }; } var u, module, cjs = module != u; (cjs ? module : window)[(cjs ? 'exports' : 'Events')] = Events;
Remove \!, switch ternary outs
Remove \!, switch ternary outs
JavaScript
mit
allouis/minivents,Aestek/minivents,remy/minivents,callpage/minivents,samlin08/minivents,objectliteral/multivents
--- +++ @@ -27,4 +27,4 @@ }; } var u, module, cjs = module != u; -(!cjs ? window : module)[(cjs ? 'exports' : 'Events')] = Events; +(cjs ? module : window)[(cjs ? 'exports' : 'Events')] = Events;
76a39b70604d5f5fd31c4bc3c878204026a1c05a
tasks/webpack-dev-server.js
tasks/webpack-dev-server.js
var path = require('path'); module.exports = { 'dev': { 'webpack': require(path.join(process.cwd(), 'tasks/config/webpack.js')), 'publicPath': '/public/', 'keepalive': true, 'port': 3000, 'hot': true, 'historyApiFallback': true } };
var path = require('path'); module.exports = { 'dev': { 'webpack': require(path.join(process.cwd(), 'tasks/config/webpack.js')), 'publicPath': '/public/', 'keepalive': true, 'port': 8080, 'hot': true, 'historyApiFallback': true } };
Set default port to 8080
Set default port to 8080
JavaScript
mit
msikma/react-hot-boilerplate,msikma/react-hot-boilerplate
--- +++ @@ -5,7 +5,7 @@ 'webpack': require(path.join(process.cwd(), 'tasks/config/webpack.js')), 'publicPath': '/public/', 'keepalive': true, - 'port': 3000, + 'port': 8080, 'hot': true, 'historyApiFallback': true }
29c079971ecd241a69ccde5bee41f3a0170ab753
game/Wall.js
game/Wall.js
try { window; } catch(e) { var utility = require('./../game/utility'); } function Wall(start_x, start_y, end_x, end_y) { this.start_x = start_x; this.start_y = start_y; this.end_x = end_x; this.end_y = end_y } Wall.prototype.init = function(){ } Wall.prototype.update = function() { } Wall.prototype.render = function(ctx, wall_next, coeff) { // Currently not used as this is treated serverside. } Wall.prototype.getState = function() { return { start_x: this.start_x, start_y: this.start_y, end_x: this.end_x, end_y: this.end_y, } } module.exports = Wall;
try { window; } catch(e) { var utility = require('./../game/utility'); } function Wall(start_x, start_y, end_x, end_y) { this.start_x = start_x; this.start_y = start_y; this.end_x = end_x; this.end_y = end_y } Wall.prototype.init = function(){ } Wall.prototype.update = function() { } Wall.prototype.render = function(ctx, wall_next, coeff) { // Currently not used as this is treated serverside. ctx.translate(this.start_x * GU, this.start_y * GU); ctx.strokeStyle = 'black'; ctx.beginPath(); ctx.lineTo((this.end_x - this.start_x) * GU, (this.end_y - this.start_y) * GU); ctx.stroke(); } Wall.prototype.getState = function() { return { start_x: this.start_x, start_y: this.start_y, end_x: this.end_x, end_y: this.end_y, } } module.exports = Wall;
Add render function to wall.js
Add render function to wall.js
JavaScript
apache-2.0
ninjadev/globalgamejam2016,ninjadev/globalgamejam2016
--- +++ @@ -19,6 +19,14 @@ Wall.prototype.render = function(ctx, wall_next, coeff) { // Currently not used as this is treated serverside. + ctx.translate(this.start_x * GU, this.start_y * GU); + + ctx.strokeStyle = 'black'; + ctx.beginPath(); + ctx.lineTo((this.end_x - this.start_x) * GU, + (this.end_y - this.start_y) * GU); + ctx.stroke(); + } Wall.prototype.getState = function() {
b0948a2a74242a7b37cbf08880e5fb979d8e85c3
packages/lesswrong/lib/modules/indexes.js
packages/lesswrong/lib/modules/indexes.js
import { Comments, Posts } from 'meteor/example-forum'; // Recent Comments query index\ Comments._ensureIndex({'postedAt': -1, '_id': -1}); // Top Posts query index Posts._ensureIndex({'status': -1, 'draft': -1, 'isFuture': -1, 'sticky': -1, 'score': -1, '_id': -1});
import { Comments, Posts } from 'meteor/example-forum'; import { Votes } from "meteor/vulcan:voting"; // Recent Comments query index\ Comments._ensureIndex({'postedAt': -1, '_id': -1}); // Top Posts query index Posts._ensureIndex({'status': -1, 'draft': -1, 'isFuture': -1, 'sticky': -1, 'score': -1, '_id': -1}); // Votes by document (comment) ID Votes._ensureIndex({ "documentId": 1 });
Add a missing index (votes by document)
Add a missing index (votes by document)
JavaScript
mit
Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -1,4 +1,5 @@ import { Comments, Posts } from 'meteor/example-forum'; +import { Votes } from "meteor/vulcan:voting"; // Recent Comments query index\ @@ -6,3 +7,6 @@ // Top Posts query index Posts._ensureIndex({'status': -1, 'draft': -1, 'isFuture': -1, 'sticky': -1, 'score': -1, '_id': -1}); + +// Votes by document (comment) ID +Votes._ensureIndex({ "documentId": 1 });
f72ab3d284c2b751263de3847c0b908e86d156bc
javascript/userswitcher.js
javascript/userswitcher.js
(function($){ $.entwine('userswitcher', function($){ $('form.userswitcher select').entwine({ onchange : function(){ this.parents('form:first').submit(); } }); $('form.userswitcher .Actions').entwine({ onmatch : function(){ this.hide(); } }); $('body').entwine({ onmatch : function(){ var base = $('base').prop('href'), isCMS = this.hasClass('cms') ? 1 : ''; $.get(base + 'userswitcher/UserSwitcherFormHTML/', {userswitchercms: isCMS}).done(function(data){ var body = $('body'); if(body.hasClass('cms')){ $('.cms-login-status').append(data); }else{ $('body').append(data); } }); } }); }); })(jQuery);
(function($){ $.entwine('userswitcher', function($){ $('form.userswitcher select').entwine({ onchange : function(){ this.parents('form:first').submit(); this._super(); } }); $('form.userswitcher .Actions').entwine({ onmatch : function(){ this.hide(); this._super(); } }); $('body').entwine({ onmatch : function(){ var base = $('base').prop('href'), isCMS = this.hasClass('cms') ? 1 : ''; $.get(base + 'userswitcher/UserSwitcherFormHTML/', {userswitchercms: isCMS}).done(function(data){ var body = $('body'); if(body.hasClass('cms')){ $('.cms-login-status').append(data); }else{ $('body').append(data); } }); this._super(); } }); }); })(jQuery);
Add this._super calls to avoid weird JS breaking behaviour
fix(this._super): Add this._super calls to avoid weird JS breaking behaviour
JavaScript
bsd-3-clause
sheadawson/silverstripe-userswitcher,sheadawson/silverstripe-userswitcher
--- +++ @@ -4,12 +4,14 @@ $('form.userswitcher select').entwine({ onchange : function(){ this.parents('form:first').submit(); + this._super(); } }); $('form.userswitcher .Actions').entwine({ onmatch : function(){ this.hide(); + this._super(); } }); @@ -28,7 +30,7 @@ } }); - + this._super(); } });
1bd478df6fe6a2a43871d6914a9cc197353a6a06
any-db-postgres/index.js
any-db-postgres/index.js
var pg = require('pg') , Transaction = require('any-db').Transaction , pgNative = null try { pgNative = pg.native } catch (__e) {} exports.forceJS = false exports.createConnection = function (opts, callback) { var backend = chooseBackend() , conn = new backend.Client(opts) conn.begin = Transaction.createBeginMethod(exports.createQuery) if (callback) { conn.connect(function (err) { if (err) callback(err) else callback(null, conn) }) } else { conn.connect() } return conn } // Create a Query object that conforms to the Any-DB interface exports.createQuery = function (stmt, params, callback) { var backend = chooseBackend() return new backend.Query(stmt, params, callback) } function chooseBackend () { return (exports.forceJS || !pgNative) ? pg : pgNative }
var pg = require('pg') , Transaction = require('any-db').Transaction , pgNative = null try { pgNative = pg.native } catch (__e) {} exports.forceJS = false exports.createConnection = function (opts, callback) { var backend = chooseBackend() , conn = new backend.Client(opts) conn.begin = begin if (callback) { conn.connect(function (err) { if (err) callback(err) else callback(null, conn) }) } else { conn.connect() } return conn } // Create a Query object that conforms to the Any-DB interface exports.createQuery = function (stmt, params, callback) { var backend = chooseBackend() return new backend.Query(stmt, params, callback) } function chooseBackend () { return (exports.forceJS || !pgNative) ? pg : pgNative } var Transaction = require('any-db').Transaction var begin = Transaction.createBeginMethod(exports.createQuery)
Use a single shared 'begin' function in postgres adapter
Use a single shared 'begin' function in postgres adapter
JavaScript
mit
grncdr/node-any-db,MignonCornet/node-any-db
--- +++ @@ -10,7 +10,7 @@ var backend = chooseBackend() , conn = new backend.Client(opts) - conn.begin = Transaction.createBeginMethod(exports.createQuery) + conn.begin = begin if (callback) { conn.connect(function (err) { @@ -33,3 +33,8 @@ function chooseBackend () { return (exports.forceJS || !pgNative) ? pg : pgNative } + +var Transaction = require('any-db').Transaction + +var begin = Transaction.createBeginMethod(exports.createQuery) +
bbf74b2599b124849c59019e181f22e1801293f6
tests/test-01-instantiation.js
tests/test-01-instantiation.js
describe('Syrup Instantiation', function() { it('should instantiate without throwing an error', function() { require('../index.js'); }); });
describe('Syrup Instantiation', function() { it('should instantiate without throwing an error', function() { require('../index.js'); }); it('should instantiate with a faker object as a property', function() { let assert = require('assert'); assert(typeof require('../index.js').faker == 'object'); }); });
Check for instantiation of faker on the Syrup class
Check for instantiation of faker on the Syrup class
JavaScript
mpl-2.0
thejsninja/syrup
--- +++ @@ -2,4 +2,8 @@ it('should instantiate without throwing an error', function() { require('../index.js'); }); + it('should instantiate with a faker object as a property', function() { + let assert = require('assert'); + assert(typeof require('../index.js').faker == 'object'); + }); });
8228b123661c6dedf988fe6d5ac2be247f7a6a9f
src/components/Sidebar.js
src/components/Sidebar.js
import React, { Component } from 'react' import { string, oneOfType, arrayOf, node } from 'prop-types' import { Helmet } from 'react-helmet' import pick from '../utils/pick' import commonPropTypes from './commonPropTypes' class Sidebar extends Component { static propTypes = { ...commonPropTypes, id: string.isRequired, side: string, children: oneOfType([ arrayOf(node), node ]) } static defaultProps = { side: '', children: [] } get properties() { return pick(this.props, ...[ ...Object.keys(commonPropTypes), 'id', 'side' ]) } render() { const { children } = this.props return [ <Helmet key="helmet"> <script async="" custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" /> </Helmet>, <amp-sidebar {...{ ...this.properties }} key="sidebar"> {children} </amp-sidebar> ] } } export default Sidebar
import React, { Component } from 'react' import { string, oneOfType, arrayOf, node } from 'prop-types' import { Helmet } from 'react-helmet' import pick from '../utils/pick' import commonPropTypes from './commonPropTypes' class Sidebar extends Component { static propTypes = { ...commonPropTypes, id: string.isRequired, side: string, children: oneOfType([ arrayOf(node), node ]) } static defaultProps = { side: null, children: [] } get properties() { return pick(this.props, ...[ ...Object.keys(commonPropTypes), 'id', 'side' ]) } render() { const { children } = this.props return [ <Helmet key="helmet"> <script async="" custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" /> </Helmet>, <amp-sidebar {...{ ...this.properties }} key="sidebar"> {children} </amp-sidebar> ] } } export default Sidebar
Use null as default prop so it's not rendered
Use null as default prop so it's not rendered
JavaScript
mit
verkstedt/react-amp-components
--- +++ @@ -17,7 +17,7 @@ } static defaultProps = { - side: '', + side: null, children: [] }
686f957171786496adae8426e2112b8e7201acc8
app/components/routes.js
app/components/routes.js
import React from 'react' import { Router, Route, hashHistory, IndexRoute } from 'react-router' import App from './App' import Home from './Home' import NewGameContainer from './containers/NewGameContainer' import Games from './Games' export default ( <Router history={hashHistory}> <Route path='/' component={App}> <IndexRoute component={Home} /> <Route path='/game/new' component={NewGameContainer} /> <Route path='/game/:id' component={Home} /> <Route path='/game' component={Games} /> </Route> </Router> )
import React from 'react' import { Router, Route, hashHistory, IndexRoute } from 'react-router' import App from './App' import Home from './Home' import NewGameContainer from './containers/NewGameContainer' import GamesContainer from './containers/GamesContainer' export default ( <Router history={hashHistory}> <Route path='/' component={App}> <IndexRoute component={Home} /> <Route path='/game/new' component={NewGameContainer} /> <Route path='/game/:id' component={Home} /> <Route path='/game' component={GamesContainer} /> </Route> </Router> )
Correct Games route component to GamesContainer
Correct Games route component to GamesContainer
JavaScript
mit
georgeF105/handball-scoring,georgeF105/handball-scoring
--- +++ @@ -4,7 +4,7 @@ import App from './App' import Home from './Home' import NewGameContainer from './containers/NewGameContainer' -import Games from './Games' +import GamesContainer from './containers/GamesContainer' export default ( <Router history={hashHistory}> @@ -12,7 +12,7 @@ <IndexRoute component={Home} /> <Route path='/game/new' component={NewGameContainer} /> <Route path='/game/:id' component={Home} /> - <Route path='/game' component={Games} /> + <Route path='/game' component={GamesContainer} /> </Route> </Router> )
e73c97463f71717a42ed2f13d02e2ef42c071267
wagtail/wagtailadmin/static_src/wagtailadmin/js/submenu.js
wagtail/wagtailadmin/static_src/wagtailadmin/js/submenu.js
$(function() { var $explorer = $('#explorer'); $('.nav-main .submenu-trigger').on('click', function() { if ($(this).closest('li').find('.nav-submenu').length) { // Close other active submenus first, if any if ($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')) { $('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active'); } $(this).closest('li').toggleClass('submenu-active'); $('.nav-wrapper').toggleClass('submenu-active'); return false; } }); $(document).on('keydown click', function(e) { if ($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)) { $('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active'); } }); });
$(function() { $('.nav-main .submenu-trigger').on('click', function() { if ($(this).closest('li').find('.nav-submenu').length) { // Close other active submenus first, if any if ($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')) { $('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active'); } $(this).closest('li').toggleClass('submenu-active'); $('.nav-wrapper').toggleClass('submenu-active'); return false; } }); $(document).on('keydown click', function(e) { if ($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)) { $('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active'); } }); });
Remove useless JS referencing explorer
Remove useless JS referencing explorer
JavaScript
bsd-3-clause
rsalmaso/wagtail,rsalmaso/wagtail,FlipperPA/wagtail,mixxorz/wagtail,takeflight/wagtail,FlipperPA/wagtail,nimasmi/wagtail,jnns/wagtail,FlipperPA/wagtail,gasman/wagtail,takeflight/wagtail,mikedingjan/wagtail,nimasmi/wagtail,zerolab/wagtail,wagtail/wagtail,kaedroho/wagtail,zerolab/wagtail,takeflight/wagtail,kaedroho/wagtail,wagtail/wagtail,mixxorz/wagtail,jnns/wagtail,thenewguy/wagtail,iansprice/wagtail,gasman/wagtail,rsalmaso/wagtail,torchbox/wagtail,nealtodd/wagtail,wagtail/wagtail,mixxorz/wagtail,takeflight/wagtail,nimasmi/wagtail,jnns/wagtail,thenewguy/wagtail,thenewguy/wagtail,timorieber/wagtail,zerolab/wagtail,jnns/wagtail,FlipperPA/wagtail,rsalmaso/wagtail,timorieber/wagtail,iansprice/wagtail,torchbox/wagtail,kaedroho/wagtail,mixxorz/wagtail,torchbox/wagtail,timorieber/wagtail,thenewguy/wagtail,kaedroho/wagtail,zerolab/wagtail,wagtail/wagtail,nealtodd/wagtail,gasman/wagtail,nimasmi/wagtail,mikedingjan/wagtail,timorieber/wagtail,iansprice/wagtail,zerolab/wagtail,nealtodd/wagtail,gasman/wagtail,wagtail/wagtail,gasman/wagtail,mixxorz/wagtail,torchbox/wagtail,mikedingjan/wagtail,kaedroho/wagtail,mikedingjan/wagtail,nealtodd/wagtail,thenewguy/wagtail,iansprice/wagtail,rsalmaso/wagtail
--- +++ @@ -1,6 +1,4 @@ $(function() { - var $explorer = $('#explorer'); - $('.nav-main .submenu-trigger').on('click', function() { if ($(this).closest('li').find('.nav-submenu').length) {
7f1f44bd33cb95a5b891abec74682c75c7b9c37e
examples/counter/store/configureStore.js
examples/counter/store/configureStore.js
import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import invariant from 'redux-immutable-state-invariant'; import devTools from 'remote-redux-devtools'; import reducer from '../reducers'; export default function configureStore(initialState) { const store = createStore(reducer, initialState, compose( applyMiddleware(invariant(), thunk), devTools({ realtime: true }) )); if (module.hot) { // Enable Webpack hot module replacement for reducers module.hot.accept('../reducers', () => { const nextReducer = require('../reducers').default; store.replaceReducer(nextReducer); }); } return store; }
import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import invariant from 'redux-immutable-state-invariant'; import { composeWithDevTools } from 'remote-redux-devtools'; import reducer from '../reducers'; export default function configureStore(initialState) { const store = createStore(reducer, initialState, composeWithDevTools( applyMiddleware(invariant(), thunk), )({ realtime: true })); if (module.hot) { // Enable Webpack hot module replacement for reducers module.hot.accept('../reducers', () => { const nextReducer = require('../reducers').default; store.replaceReducer(nextReducer); }); } return store; }
Update counter example to use `composeWithDevTools`
Update counter example to use `composeWithDevTools`
JavaScript
mit
zalmoxisus/redux-remote-monitor,zalmoxisus/remote-redux-devtools
--- +++ @@ -1,15 +1,14 @@ import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import invariant from 'redux-immutable-state-invariant'; -import devTools from 'remote-redux-devtools'; +import { composeWithDevTools } from 'remote-redux-devtools'; import reducer from '../reducers'; export default function configureStore(initialState) { - const store = createStore(reducer, initialState, compose( + const store = createStore(reducer, initialState, composeWithDevTools( applyMiddleware(invariant(), thunk), - devTools({ realtime: true }) - )); + )({ realtime: true })); if (module.hot) { // Enable Webpack hot module replacement for reducers