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
cbb27012bb0c8ffc338d92b2cf3ef4449a65e4a4
src/config.js
src/config.js
const config = Object.assign({ development: { api: { trade_events: { host: 'https://intrasearch.govwizely.com/v1/trade_events', }, }, }, production: { api: { trade_events: { host: 'https://intrasearch.export.gov/v1/trade_events', }, }, }, }); export default config[process.env.NODE_ENV];
import assign from 'object-assign'; const config = assign({ development: { api: { trade_events: { host: 'https://intrasearch.govwizely.com/v1/trade_events', }, }, }, production: { api: { trade_events: { host: 'https://intrasearch.export.gov/v1/trade_events', }, }, }, }); export default config[process.env.NODE_ENV];
Use object-assign instead of Object.assign
Use object-assign instead of Object.assign
JavaScript
mit
GovWizely/trade-event-search-app,GovWizely/trade-event-search-app
--- +++ @@ -1,4 +1,6 @@ -const config = Object.assign({ +import assign from 'object-assign'; + +const config = assign({ development: { api: { trade_events: {
8295d27a906f850cefd86321d212162cba7ef296
local-cli/wrong-react-native.js
local-cli/wrong-react-native.js
#!/usr/bin/env node /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ console.error([ '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', 'To fix the issue, run:\033[0m', 'npm uninstall -g react-native', 'npm install -g react-native-cli' ].join('\n')); process.exit(1);
#!/usr/bin/env node /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ var script = process.argv[1]; var installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1; if (installedGlobally) { console.error([ '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', 'To fix the issue, run:\033[0m', 'npm uninstall -g react-native', 'npm install -g react-native-cli' ].join('\n')); process.exit(1); } else { require('./cli').run(); }
Fix usage of react-native cli inside package.json scripts
Fix usage of react-native cli inside package.json scripts Summary: IIRC we made `wrong-react-native` to warn people in case they installed `react-native` globally (instead of `react-native-cli` what the guide suggests). To do that we added `bin` entry to React Native's `package.json` that points to `local-cli/wrong-react-native.js` However, this means that if we have a project that uses `react-native` package and has call to `react-native` CLI inside its package.json, npm will execute *local* override (which just prints a confusing in this context error message). In fact, the template we generate with `react-native init` has `react-native start` as `start` script, which makes it useless. Let's fix it by making `wrong-react-native` script smarter – it can detect that it has been executed from local `node_modules` and run the actual CLI. cc vjeux ide Closes https://github.com/facebook/react-native/pull/7243 Differential Revision: D3226645 Pulled By: frantic fb-gh-sync-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7 fbshipit-source-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
JavaScript
bsd-3-clause
CodeLinkIO/react-native,imjerrybao/react-native,shrutic123/react-native,tszajna0/react-native,gitim/react-native,DanielMSchmidt/react-native,jadbox/react-native,ndejesus1227/react-native,tsjing/react-native,exponent/react-native,naoufal/react-native,martinbigio/react-native,mironiasty/react-native,browniefed/react-native,corbt/react-native,InterfaceInc/react-native,makadaw/react-native,doochik/react-native,happypancake/react-native,jhen0409/react-native,shrutic123/react-native,dikaiosune/react-native,InterfaceInc/react-native,rickbeerendonk/react-native,nickhudkins/react-native,Bhullnatik/react-native,myntra/react-native,DannyvanderJagt/react-native,salanki/react-native,facebook/react-native,jadbox/react-native,jadbox/react-native,gitim/react-native,jaggs6/react-native,catalinmiron/react-native,BretJohnson/react-native,tsjing/react-native,tadeuzagallo/react-native,makadaw/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,arthuralee/react-native,facebook/react-native,negativetwelve/react-native,skevy/react-native,cdlewis/react-native,hoangpham95/react-native,luqin/react-native,wenpkpk/react-native,negativetwelve/react-native,dikaiosune/react-native,skatpgusskat/react-native,arthuralee/react-native,hammerandchisel/react-native,tgoldenberg/react-native,farazs/react-native,Swaagie/react-native,cdlewis/react-native,Ehesp/react-native,Swaagie/react-native,esauter5/react-native,cosmith/react-native,doochik/react-native,cosmith/react-native,BretJohnson/react-native,htc2u/react-native,jadbox/react-native,alin23/react-native,Maxwell2022/react-native,CntChen/react-native,wenpkpk/react-native,hoastoolshop/react-native,forcedotcom/react-native,imjerrybao/react-native,rickbeerendonk/react-native,browniefed/react-native,cpunion/react-native,formatlos/react-native,shrutic/react-native,PlexChat/react-native,csatf/react-native,myntra/react-native,pandiaraj44/react-native,nickhudkins/react-native,foghina/react-native,imDangerous/react-native,aaron-goshine/react-native,rickbeerendonk/react-native,eduardinni/react-native,arthuralee/react-native,aaron-goshine/react-native,ndejesus1227/react-native,jaggs6/react-native,peterp/react-native,thotegowda/react-native,BretJohnson/react-native,PlexChat/react-native,cdlewis/react-native,dikaiosune/react-native,xiayz/react-native,CodeLinkIO/react-native,hoastoolshop/react-native,pandiaraj44/react-native,cdlewis/react-native,jevakallio/react-native,jhen0409/react-native,htc2u/react-native,frantic/react-native,DanielMSchmidt/react-native,adamjmcgrath/react-native,peterp/react-native,jadbox/react-native,tadeuzagallo/react-native,Guardiannw/react-native,xiayz/react-native,naoufal/react-native,lelandrichardson/react-native,pandiaraj44/react-native,catalinmiron/react-native,Swaagie/react-native,luqin/react-native,catalinmiron/react-native,alin23/react-native,dikaiosune/react-native,aljs/react-native,catalinmiron/react-native,xiayz/react-native,tadeuzagallo/react-native,peterp/react-native,hoangpham95/react-native,orenklein/react-native,ptomasroos/react-native,jevakallio/react-native,christopherdro/react-native,PlexChat/react-native,pandiaraj44/react-native,shrutic123/react-native,Bhullnatik/react-native,ndejesus1227/react-native,brentvatne/react-native,peterp/react-native,ankitsinghania94/react-native,Maxwell2022/react-native,foghina/react-native,formatlos/react-native,orenklein/react-native,tarkus/react-native-appletv,Maxwell2022/react-native,frantic/react-native,farazs/react-native,happypancake/react-native,hoangpham95/react-native,esauter5/react-native,forcedotcom/react-native,catalinmiron/react-native,farazs/react-native,gitim/react-native,adamjmcgrath/react-native,shrutic123/react-native,tgoldenberg/react-native,clozr/react-native,BretJohnson/react-native,facebook/react-native,nathanajah/react-native,foghina/react-native,charlesvinette/react-native,CntChen/react-native,javache/react-native,javache/react-native,corbt/react-native,jevakallio/react-native,martinbigio/react-native,tsjing/react-native,InterfaceInc/react-native,skevy/react-native,Swaagie/react-native,callstack-io/react-native,chnfeeeeeef/react-native,csatf/react-native,nickhudkins/react-native,cosmith/react-native,InterfaceInc/react-native,chnfeeeeeef/react-native,corbt/react-native,gilesvangruisen/react-native,jhen0409/react-native,xiayz/react-native,thotegowda/react-native,negativetwelve/react-native,eduardinni/react-native,aljs/react-native,Livyli/react-native,PlexChat/react-native,Andreyco/react-native,tszajna0/react-native,ptmt/react-native-macos,foghina/react-native,tgoldenberg/react-native,CntChen/react-native,mironiasty/react-native,negativetwelve/react-native,hoangpham95/react-native,brentvatne/react-native,tadeuzagallo/react-native,Maxwell2022/react-native,CntChen/react-native,Emilios1995/react-native,DannyvanderJagt/react-native,htc2u/react-native,janicduplessis/react-native,cpunion/react-native,skatpgusskat/react-native,Bhullnatik/react-native,farazs/react-native,salanki/react-native,esauter5/react-native,salanki/react-native,Guardiannw/react-native,ankitsinghania94/react-native,tsjing/react-native,lelandrichardson/react-native,myntra/react-native,chnfeeeeeef/react-native,Livyli/react-native,kesha-antonov/react-native,mironiasty/react-native,salanki/react-native,janicduplessis/react-native,ptmt/react-native-macos,chnfeeeeeef/react-native,shrutic/react-native,imjerrybao/react-native,ptmt/react-native-macos,htc2u/react-native,xiayz/react-native,myntra/react-native,eduardinni/react-native,csatf/react-native,adamjmcgrath/react-native,adamjmcgrath/react-native,martinbigio/react-native,esauter5/react-native,forcedotcom/react-native,janicduplessis/react-native,jaggs6/react-native,jevakallio/react-native,rickbeerendonk/react-native,browniefed/react-native,forcedotcom/react-native,peterp/react-native,wenpkpk/react-native,exponentjs/react-native,gitim/react-native,doochik/react-native,skevy/react-native,ndejesus1227/react-native,InterfaceInc/react-native,Guardiannw/react-native,mrspeaker/react-native,iodine/react-native,cpunion/react-native,christopherdro/react-native,Andreyco/react-native,browniefed/react-native,CntChen/react-native,mironiasty/react-native,facebook/react-native,naoufal/react-native,jhen0409/react-native,lprhodes/react-native,exponentjs/react-native,farazs/react-native,forcedotcom/react-native,Emilios1995/react-native,doochik/react-native,tarkus/react-native-appletv,doochik/react-native,alin23/react-native,Maxwell2022/react-native,Guardiannw/react-native,doochik/react-native,christopherdro/react-native,brentvatne/react-native,lelandrichardson/react-native,facebook/react-native,doochik/react-native,Livyli/react-native,Livyli/react-native,esauter5/react-native,clozr/react-native,javache/react-native,naoufal/react-native,pandiaraj44/react-native,mrspeaker/react-native,Bhullnatik/react-native,iodine/react-native,Purii/react-native,tarkus/react-native-appletv,wenpkpk/react-native,shrutic123/react-native,luqin/react-native,thotegowda/react-native,eduardinni/react-native,skatpgusskat/react-native,aljs/react-native,gre/react-native,alin23/react-native,gre/react-native,gre/react-native,Emilios1995/react-native,browniefed/react-native,callstack-io/react-native,browniefed/react-native,catalinmiron/react-native,exponentjs/react-native,gilesvangruisen/react-native,peterp/react-native,adamjmcgrath/react-native,jaggs6/react-native,makadaw/react-native,salanki/react-native,clozr/react-native,Andreyco/react-native,luqin/react-native,negativetwelve/react-native,charlesvinette/react-native,ptmt/react-native-macos,InterfaceInc/react-native,ptomasroos/react-native,shrutic123/react-native,hammerandchisel/react-native,chnfeeeeeef/react-native,nathanajah/react-native,happypancake/react-native,jhen0409/react-native,hammerandchisel/react-native,hoangpham95/react-native,jaggs6/react-native,lprhodes/react-native,clozr/react-native,Livyli/react-native,cpunion/react-native,javache/react-native,luqin/react-native,exponent/react-native,ptmt/react-native-macos,CodeLinkIO/react-native,jasonnoahchoi/react-native,iodine/react-native,lelandrichardson/react-native,jaggs6/react-native,satya164/react-native,jasonnoahchoi/react-native,Maxwell2022/react-native,gre/react-native,Swaagie/react-native,tarkus/react-native-appletv,corbt/react-native,tszajna0/react-native,gre/react-native,cdlewis/react-native,tgoldenberg/react-native,makadaw/react-native,tgoldenberg/react-native,Livyli/react-native,cpunion/react-native,Andreyco/react-native,forcedotcom/react-native,doochik/react-native,htc2u/react-native,aljs/react-native,cosmith/react-native,DannyvanderJagt/react-native,dikaiosune/react-native,lelandrichardson/react-native,thotegowda/react-native,iodine/react-native,tsjing/react-native,csatf/react-native,corbt/react-native,aaron-goshine/react-native,kesha-antonov/react-native,foghina/react-native,kesha-antonov/react-native,tgoldenberg/react-native,nickhudkins/react-native,orenklein/react-native,christopherdro/react-native,jadbox/react-native,PlexChat/react-native,callstack-io/react-native,tadeuzagallo/react-native,kesha-antonov/react-native,nathanajah/react-native,mironiasty/react-native,Swaagie/react-native,lprhodes/react-native,farazs/react-native,makadaw/react-native,lprhodes/react-native,csatf/react-native,rickbeerendonk/react-native,Purii/react-native,gitim/react-native,cdlewis/react-native,kesha-antonov/react-native,Purii/react-native,htc2u/react-native,orenklein/react-native,tszajna0/react-native,cosmith/react-native,satya164/react-native,forcedotcom/react-native,shrutic/react-native,formatlos/react-native,salanki/react-native,DanielMSchmidt/react-native,gre/react-native,csatf/react-native,adamjmcgrath/react-native,Swaagie/react-native,wenpkpk/react-native,Purii/react-native,mironiasty/react-native,rickbeerendonk/react-native,Guardiannw/react-native,hammerandchisel/react-native,DannyvanderJagt/react-native,aljs/react-native,gilesvangruisen/react-native,arthuralee/react-native,alin23/react-native,christopherdro/react-native,charlesvinette/react-native,gilesvangruisen/react-native,formatlos/react-native,martinbigio/react-native,alin23/react-native,nickhudkins/react-native,DannyvanderJagt/react-native,myntra/react-native,brentvatne/react-native,naoufal/react-native,hoangpham95/react-native,imDangerous/react-native,lelandrichardson/react-native,jhen0409/react-native,pandiaraj44/react-native,mrspeaker/react-native,thotegowda/react-native,rickbeerendonk/react-native,Bhullnatik/react-native,hoastoolshop/react-native,exponentjs/react-native,iodine/react-native,Emilios1995/react-native,jasonnoahchoi/react-native,BretJohnson/react-native,adamjmcgrath/react-native,imDangerous/react-native,cosmith/react-native,PlexChat/react-native,luqin/react-native,exponentjs/react-native,happypancake/react-native,dikaiosune/react-native,Ehesp/react-native,formatlos/react-native,nickhudkins/react-native,tgoldenberg/react-native,corbt/react-native,alin23/react-native,makadaw/react-native,martinbigio/react-native,mrspeaker/react-native,DanielMSchmidt/react-native,DanielMSchmidt/react-native,forcedotcom/react-native,janicduplessis/react-native,imjerrybao/react-native,Swaagie/react-native,orenklein/react-native,Purii/react-native,BretJohnson/react-native,htc2u/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,PlexChat/react-native,Livyli/react-native,mironiasty/react-native,imDangerous/react-native,gre/react-native,Ehesp/react-native,brentvatne/react-native,Ehesp/react-native,pandiaraj44/react-native,satya164/react-native,tadeuzagallo/react-native,ankitsinghania94/react-native,mrspeaker/react-native,hoangpham95/react-native,skatpgusskat/react-native,salanki/react-native,jasonnoahchoi/react-native,lprhodes/react-native,tsjing/react-native,mironiasty/react-native,ptomasroos/react-native,Emilios1995/react-native,facebook/react-native,shrutic/react-native,Andreyco/react-native,martinbigio/react-native,aaron-goshine/react-native,Guardiannw/react-native,mrspeaker/react-native,gilesvangruisen/react-native,satya164/react-native,wenpkpk/react-native,BretJohnson/react-native,thotegowda/react-native,Emilios1995/react-native,Maxwell2022/react-native,kesha-antonov/react-native,salanki/react-native,aaron-goshine/react-native,nathanajah/react-native,jevakallio/react-native,esauter5/react-native,jadbox/react-native,facebook/react-native,lprhodes/react-native,Guardiannw/react-native,gitim/react-native,imDangerous/react-native,DanielMSchmidt/react-native,orenklein/react-native,gitim/react-native,formatlos/react-native,gilesvangruisen/react-native,jadbox/react-native,janicduplessis/react-native,martinbigio/react-native,Bhullnatik/react-native,InterfaceInc/react-native,farazs/react-native,CodeLinkIO/react-native,hammerandchisel/react-native,ankitsinghania94/react-native,ptomasroos/react-native,exponentjs/react-native,imjerrybao/react-native,shrutic/react-native,dikaiosune/react-native,satya164/react-native,jasonnoahchoi/react-native,jasonnoahchoi/react-native,naoufal/react-native,tsjing/react-native,exponent/react-native,Bhullnatik/react-native,jaggs6/react-native,rickbeerendonk/react-native,happypancake/react-native,callstack-io/react-native,imDangerous/react-native,happypancake/react-native,doochik/react-native,shrutic123/react-native,charlesvinette/react-native,nickhudkins/react-native,Andreyco/react-native,brentvatne/react-native,Ehesp/react-native,iodine/react-native,exponent/react-native,hammerandchisel/react-native,catalinmiron/react-native,imDangerous/react-native,arthuralee/react-native,jevakallio/react-native,Purii/react-native,hammerandchisel/react-native,clozr/react-native,exponent/react-native,charlesvinette/react-native,tszajna0/react-native,janicduplessis/react-native,skatpgusskat/react-native,farazs/react-native,eduardinni/react-native,tszajna0/react-native,christopherdro/react-native,makadaw/react-native,xiayz/react-native,satya164/react-native,hoangpham95/react-native,jasonnoahchoi/react-native,satya164/react-native,Livyli/react-native,cpunion/react-native,ndejesus1227/react-native,shrutic/react-native,lprhodes/react-native,naoufal/react-native,makadaw/react-native,tszajna0/react-native,frantic/react-native,DannyvanderJagt/react-native,cpunion/react-native,browniefed/react-native,skevy/react-native,aljs/react-native,jasonnoahchoi/react-native,aaron-goshine/react-native,clozr/react-native,aljs/react-native,wenpkpk/react-native,aaron-goshine/react-native,BretJohnson/react-native,lprhodes/react-native,eduardinni/react-native,csatf/react-native,hoastoolshop/react-native,myntra/react-native,gilesvangruisen/react-native,CntChen/react-native,cosmith/react-native,hoastoolshop/react-native,tadeuzagallo/react-native,callstack-io/react-native,Ehesp/react-native,Purii/react-native,myntra/react-native,eduardinni/react-native,skevy/react-native,janicduplessis/react-native,ptomasroos/react-native,esauter5/react-native,thotegowda/react-native,luqin/react-native,makadaw/react-native,shrutic/react-native,tarkus/react-native-appletv,Emilios1995/react-native,aljs/react-native,dikaiosune/react-native,jaggs6/react-native,nickhudkins/react-native,brentvatne/react-native,mrspeaker/react-native,orenklein/react-native,Bhullnatik/react-native,hoastoolshop/react-native,wenpkpk/react-native,shrutic123/react-native,formatlos/react-native,CntChen/react-native,skevy/react-native,nathanajah/react-native,ptomasroos/react-native,myntra/react-native,imDangerous/react-native,brentvatne/react-native,thotegowda/react-native,clozr/react-native,jhen0409/react-native,javache/react-native,ndejesus1227/react-native,adamjmcgrath/react-native,kesha-antonov/react-native,jevakallio/react-native,negativetwelve/react-native,cdlewis/react-native,tgoldenberg/react-native,mironiasty/react-native,exponentjs/react-native,negativetwelve/react-native,alin23/react-native,cosmith/react-native,naoufal/react-native,CodeLinkIO/react-native,tarkus/react-native-appletv,hammerandchisel/react-native,aaron-goshine/react-native,javache/react-native,mrspeaker/react-native,lelandrichardson/react-native,frantic/react-native,exponentjs/react-native,cdlewis/react-native,nathanajah/react-native,csatf/react-native,DannyvanderJagt/react-native,orenklein/react-native,tadeuzagallo/react-native,nathanajah/react-native,peterp/react-native,eduardinni/react-native,myntra/react-native,callstack-io/react-native,CntChen/react-native,ankitsinghania94/react-native,foghina/react-native,tszajna0/react-native,shrutic/react-native,happypancake/react-native,PlexChat/react-native,cpunion/react-native,rickbeerendonk/react-native,charlesvinette/react-native,facebook/react-native,gilesvangruisen/react-native,lelandrichardson/react-native,Ehesp/react-native,Andreyco/react-native,christopherdro/react-native,xiayz/react-native,imjerrybao/react-native,foghina/react-native,corbt/react-native,kesha-antonov/react-native,chnfeeeeeef/react-native,clozr/react-native,foghina/react-native,xiayz/react-native,janicduplessis/react-native,DanielMSchmidt/react-native,skevy/react-native,facebook/react-native,esauter5/react-native,javache/react-native,jhen0409/react-native,imjerrybao/react-native,InterfaceInc/react-native,catalinmiron/react-native,Andreyco/react-native,imjerrybao/react-native,farazs/react-native,javache/react-native,martinbigio/react-native,CodeLinkIO/react-native,DannyvanderJagt/react-native,kesha-antonov/react-native,gre/react-native,CodeLinkIO/react-native,browniefed/react-native,Purii/react-native,formatlos/react-native,jevakallio/react-native,chnfeeeeeef/react-native,ankitsinghania94/react-native,happypancake/react-native,ptmt/react-native-macos,Guardiannw/react-native,luqin/react-native,callstack-io/react-native,nathanajah/react-native,tsjing/react-native,tarkus/react-native-appletv,CodeLinkIO/react-native,ndejesus1227/react-native,iodine/react-native,charlesvinette/react-native,htc2u/react-native,negativetwelve/react-native,hoastoolshop/react-native,DanielMSchmidt/react-native,christopherdro/react-native,exponent/react-native,skatpgusskat/react-native,corbt/react-native,tarkus/react-native-appletv,ptmt/react-native-macos,frantic/react-native,Emilios1995/react-native,chnfeeeeeef/react-native,ndejesus1227/react-native,peterp/react-native,Ehesp/react-native,ptomasroos/react-native,cdlewis/react-native,brentvatne/react-native,ptomasroos/react-native,pandiaraj44/react-native,exponent/react-native,gitim/react-native,charlesvinette/react-native,satya164/react-native,callstack-io/react-native,iodine/react-native,jevakallio/react-native,negativetwelve/react-native,hoastoolshop/react-native,skevy/react-native,exponent/react-native,ptmt/react-native-macos,javache/react-native,Maxwell2022/react-native,formatlos/react-native
--- +++ @@ -9,11 +9,17 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -console.error([ - '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', - 'To fix the issue, run:\033[0m', - 'npm uninstall -g react-native', - 'npm install -g react-native-cli' -].join('\n')); +var script = process.argv[1]; +var installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1; -process.exit(1); +if (installedGlobally) { + console.error([ + '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', + 'To fix the issue, run:\033[0m', + 'npm uninstall -g react-native', + 'npm install -g react-native-cli' + ].join('\n')); + process.exit(1); +} else { + require('./cli').run(); +}
1aac1de738fdef73676948be8e4d5d8fc18eb27c
caspy/static/js/api.js
caspy/static/js/api.js
(function(){ var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']); mod.config(['$resourceProvider', function($resourceProvider) { $resourceProvider.defaults.stripTrailingSlashes = false; }] ); mod.factory('caspyAPI', ['$q', '$http', '$resource', 'Constants', function($q, $http, $resource, Constants) { var api = { root: null , resources: {} , resolve: function(name) { var d = $q.defer(); if (typeof api.root[name] === 'undefined') { d.reject(new Error(name + ' endpoint not available')); } else { d.resolve(api.root[name]); } return d.promise; } , get_endpoint: function(name) { if (api.root) return api.resolve(name); return $http.get(Constants.apiRootUrl) .then(function(response) { api.root = response.data; return api.resolve(name); }) } , get_resource: function(name) { if (typeof api.resources[name] !== 'undefined') return api.resources[name]; return api.resources[name] = api.get_endpoint(name) .then(api.build_resource); } , build_resource: function(endpoint) { return $resource(endpoint); } }; return api; }] ); })();
(function(){ var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']); mod.config(['$resourceProvider', function($resourceProvider) { $resourceProvider.defaults.stripTrailingSlashes = false; }] ); mod.factory('caspyAPI', ['$q', '$http', '$resource', 'Constants', function($q, $http, $resource, Constants) { var api = { root: null , resources: {} , get_resource: function(name) { if (typeof api.resources[name] !== 'undefined') return api.resources[name]; return api.resources[name] = api.get_endpoint(name) .then(api.build_resource); } , get_endpoint: function(name) { if (api.root) return api.resolve(name); return $http.get(Constants.apiRootUrl) .then(function(response) { api.root = response.data; return api.resolve(name); }) } , build_resource: function(endpoint) { return $resource(endpoint); } , resolve: function(name) { var d = $q.defer(); if (typeof api.root[name] === 'undefined') { d.reject(new Error(name + ' endpoint not available')); } else { d.resolve(api.root[name]); } return d.promise; } }; return api; }] ); })();
Put higher level functions first
Put higher level functions first
JavaScript
bsd-3-clause
altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy
--- +++ @@ -14,15 +14,11 @@ root: null , resources: {} - , resolve: function(name) { - var d = $q.defer(); - if (typeof api.root[name] === 'undefined') { - d.reject(new Error(name + ' endpoint not available')); - } - else { - d.resolve(api.root[name]); - } - return d.promise; + , get_resource: function(name) { + if (typeof api.resources[name] !== 'undefined') + return api.resources[name]; + return api.resources[name] = api.get_endpoint(name) + .then(api.build_resource); } , get_endpoint: function(name) { @@ -35,15 +31,19 @@ }) } - , get_resource: function(name) { - if (typeof api.resources[name] !== 'undefined') - return api.resources[name]; - return api.resources[name] = api.get_endpoint(name) - .then(api.build_resource); + , build_resource: function(endpoint) { + return $resource(endpoint); } - , build_resource: function(endpoint) { - return $resource(endpoint); + , resolve: function(name) { + var d = $q.defer(); + if (typeof api.root[name] === 'undefined') { + d.reject(new Error(name + ' endpoint not available')); + } + else { + d.resolve(api.root[name]); + } + return d.promise; } };
cb754daf342cdea42225efca3834966bd5328fba
src/footer.js
src/footer.js
/* backgrid http://github.com/wyuenho/backgrid Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors Licensed under the MIT @license. */ /** A Footer is a generic class that only defines a default tag `tfoot` and number of required parameters in the initializer. @abstract @class Backgrid.Footer @extends Backbone.View */ var Footer = Backgrid.Footer = Backbone.View.extend({ /** @property */ tagName: "tfoot", /** Initializer. @param {Object} options @param {*} options.parent The parent view class of this footer. @param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata. @param {Backbone.Collection} options.collection @throws {TypeError} If options.columns or options.collection is undefined. */ initialize: function (options) { Backgrid.requireOptions(options, ["columns", "collection"]); this.parent = options.parent; this.columns = options.columns; if (!(this.columns instanceof Backbone.Collection)) { this.columns = new Backgrid.Columns(this.columns); } } });
/* backgrid http://github.com/wyuenho/backgrid Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors Licensed under the MIT @license. */ /** A Footer is a generic class that only defines a default tag `tfoot` and number of required parameters in the initializer. @abstract @class Backgrid.Footer @extends Backbone.View */ var Footer = Backgrid.Footer = Backbone.View.extend({ /** @property */ tagName: "tfoot", /** Initializer. @param {Object} options @param {*} options.parent The parent view class of this footer. @param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata. @param {Backbone.Collection} options.collection @throws {TypeError} If options.columns or options.collection is undefined. */ initialize: function (options) { Backgrid.requireOptions(options, ["columns", "collection"]); this.columns = options.columns; if (!(this.columns instanceof Backbone.Collection)) { this.columns = new Backgrid.Columns(this.columns); } } });
Remove extraneous parent reference from Footer
Remove extraneous parent reference from Footer
JavaScript
mit
goodwall/backgrid,blackducksoftware/backgrid,wyuenho/backgrid,wyuenho/backgrid,digideskio/backgrid,qferr/backgrid,bryce-gibson/backgrid,aboieriu/backgrid,ludoo0d0a/backgrid,bryce-gibson/backgrid,blackducksoftware/backgrid,aboieriu/backgrid,digideskio/backgrid,Acquisio/backgrid,kirill-zhirnov/backgrid,crealytics/backgrid,ludoo0d0a/backgrid,kirill-zhirnov/backgrid,getjaco/backgrid,jesseditson/backgrid,qferr/backgrid,goodwall/backgrid,jesseditson/backgrid,getjaco/backgrid,Acquisio/backgrid
--- +++ @@ -32,7 +32,6 @@ */ initialize: function (options) { Backgrid.requireOptions(options, ["columns", "collection"]); - this.parent = options.parent; this.columns = options.columns; if (!(this.columns instanceof Backbone.Collection)) { this.columns = new Backgrid.Columns(this.columns);
c51089b4f5be53d7657aecf9cfa721ced5895fa4
lib/health.js
lib/health.js
var express = require('express'); var geocode = require('./geocode'); var mongoose = require('./mongo'); var otp = require('./otp'); /** * Expose `router` */ var router = module.exports = express.Router(); /** * Main check */ router.all('/', checkGeocoder, checkOTP, function(req, res) { var checks = { api: true, db: mongoose.connection.readyState === 1, geocoder: !req.geocoder, logger: 'not implemented', otp: !req.otp, worker: 'not implemented' }; // TODO: implement checks res.status(200).send(checks); }); /** * OTP */ router.all('/otp', checkOTP, function(req, res) { if (!req.otp) { res.status(204).end(); } else { res.status(400).send(req.otp); } }); /** * Check Geocoder */ function checkGeocoder(req, res, next) { geocode.suggest('1133 15th St NW, Washington, DC', function(err, suggestions) { req.geocoder = err; next(); }); } /** * Check OTP */ function checkOTP(req, res, next) { otp.get({ url: '/index/routes' }, function(err, routes) { req.otp = err; next(); }); }
var express = require('express'); var geocode = require('./geocode'); var mongoose = require('./mongo'); var otp = require('./otp'); /** * Expose `router` */ var router = module.exports = express.Router(); /** * Main check */ router.all('/', checkGeocoder, checkOTP, function(req, res) { var checks = { api: true, db: mongoose.connection.readyState === 1, geocoder: !req.geocoder, logger: 'not implemented', otp: !req.otp, worker: 'not implemented' }; // TODO: implement checks res.status(200).send(checks); }); /** * OTP */ router.all('/otp', checkOTP, function(req, res) { if (!req.otp) { res.status(204).end(); } else { res.status(400).send(req.otp); } }); /** * Check Geocoder */ function checkGeocoder(req, res, next) { geocode.encode('1133 15th St NW, Washington, DC', function(err, suggestions) { req.geocoder = err; next(); }); } /** * Check OTP */ function checkOTP(req, res, next) { otp.get({ url: '/index/routes' }, function(err, routes) { req.otp = err; next(); }); }
Use encode to check geocoder status
Use encode to check geocoder status
JavaScript
bsd-3-clause
amigocloud/modified-tripplanner,tismart/modeify,miraculixx/modeify,miraculixx/modeify,tismart/modeify,arunnair80/modeify,amigocloud/modeify,tismart/modeify,amigocloud/modeify,miraculixx/modeify,arunnair80/modeify-1,arunnair80/modeify-1,arunnair80/modeify,miraculixx/modeify,amigocloud/modeify,amigocloud/modified-tripplanner,tismart/modeify,arunnair80/modeify,amigocloud/modified-tripplanner,amigocloud/modeify,amigocloud/modified-tripplanner,arunnair80/modeify,arunnair80/modeify-1,arunnair80/modeify-1
--- +++ @@ -44,7 +44,7 @@ */ function checkGeocoder(req, res, next) { - geocode.suggest('1133 15th St NW, Washington, DC', function(err, suggestions) { + geocode.encode('1133 15th St NW, Washington, DC', function(err, suggestions) { req.geocoder = err; next(); });
8d46d03dd81046fb1e9821ab5e3c4c85e7eba747
lib/modules/storage/class_static_methods/is_secured.js
lib/modules/storage/class_static_methods/is_secured.js
function isSecured(operation) { if (_.has(this.schema.secured, operation)) { return this.schema.secured[operation]; } else { return this.schema.secured.common || false; } }; export default isSecured;
import _ from 'lodash'; function isSecured(operation) { if (_.has(this.schema.secured, operation)) { return this.schema.secured[operation]; } else { return this.schema.secured.common || false; } }; export default isSecured;
Fix lack of loads import
Fix lack of loads import
JavaScript
mit
jagi/meteor-astronomy
--- +++ @@ -1,3 +1,5 @@ +import _ from 'lodash'; + function isSecured(operation) { if (_.has(this.schema.secured, operation)) { return this.schema.secured[operation];
f6397f79ef1471f87aa113a4dc4bab900e07935c
lib/routes.js
lib/routes.js
var addFollowers = require('./follow'); var checkAuth = require('./check_auth'); var checkPrivilege = require('./privilege_check'); var githubOAuth = require('./github_oauth'); var users = require('./db').get('users'); module.exports = function(app) { app.get('/me', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.find({ following: req.session.user.login }, function(err, following) { res.json({ privilege: privilege, following: following }); }); }); }); app.get('/user', checkAuth, function(req, res) { return res.json(req.session.user); }); app.post('/follow/:login', function(req, res) { if (!req.session.user) { return res.status(401).json({ error: 'Not logged in' }); } var amount = req.body.amount; if (!amount) { amount = 10; } addFollowers(req.session.user.login, -1, function(err, result) { res.json(result); }); }); githubOAuth.addRoutes(app, function(err, token, res, ignore, req) { if (token.error) { return res.send('There was an error logging in: ' + token.error_description); } req.session.token = token.access_token; res.redirect('/'); }); };
var addFollowers = require('./follow'); var checkAuth = require('./check_auth'); var checkPrivilege = require('./privilege_check'); var githubOAuth = require('./github_oauth'); var users = require('./db').get('users'); module.exports = function(app) { app.get('/me', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.find({ following: req.session.user.login }, function(err, following) { res.json({ privilege: privilege, following: following }); }); }); }); app.get('/user', checkAuth, function(req, res) { return res.json(req.session.user); }); app.post('/follow/:login', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.findOne({ login: req.session.user.login }, function(error, user) { var amount = privilege.following - user.following; addFollowers(req.session.user.login, amount, function(err, result) { res.json(result); }); }); }); }); githubOAuth.addRoutes(app, function(err, token, res, ignore, req) { if (token.error) { return res.send('There was an error logging in: ' + token.error_description); } req.session.token = token.access_token; res.redirect('/'); }); };
Add privilege check on follow button
Add privilege check on follow button
JavaScript
mit
simplyianm/ghfollowers,legoboy0215/ghfollowers,simplyianm/ghfollowers,legoboy0215/ghfollowers
--- +++ @@ -23,20 +23,16 @@ return res.json(req.session.user); }); - app.post('/follow/:login', function(req, res) { - if (!req.session.user) { - return res.status(401).json({ - error: 'Not logged in' + app.post('/follow/:login', checkAuth, function(req, res) { + checkPrivilege(req.session.user.login, function(err, privilege) { + users.findOne({ + login: req.session.user.login + }, function(error, user) { + var amount = privilege.following - user.following; + addFollowers(req.session.user.login, amount, function(err, result) { + res.json(result); + }); }); - } - - var amount = req.body.amount; - if (!amount) { - amount = 10; - } - - addFollowers(req.session.user.login, -1, function(err, result) { - res.json(result); }); });
3bed3dbca37e1e2072581ae8fc1a532c63c1afd7
js/plugins/EncryptedInsightStorage.js
js/plugins/EncryptedInsightStorage.js
var cryptoUtil = require('../util/crypto'); var InsightStorage = require('./InsightStorage'); var inherits = require('inherits'); function EncryptedInsightStorage(config) { InsightStorage.apply(this, [config]); } inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { if (err) { return callback(err); } var decryptedJson = cryptoUtil.decrypt(key, body); if (!decryptedJson) { return callback('Internal Error'); } return callback(null, decryptedJson); } ]); }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); }; module.exports = EncryptedInsightStorage;
var cryptoUtil = require('../util/crypto'); var InsightStorage = require('./InsightStorage'); var inherits = require('inherits'); function EncryptedInsightStorage(config) { InsightStorage.apply(this, [config]); } inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { if (err) { return callback(err); } var decryptedJson = cryptoUtil.decrypt(key, body); if (!decryptedJson) { return callback('Internal Error'); } return callback(null, decryptedJson); } ]); }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { var key = cryptoUtil.kdf(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); }; module.exports = EncryptedInsightStorage;
Use the same kdf for Insight Storage
Use the same kdf for Insight Storage
JavaScript
mit
LedgerHQ/copay,troggy/unicoisa,Bitcoin-com/Wallet,BitGo/copay,wallclockbuilder/copay,msalcala11/copay,cmgustavo/copay,BitGo/copay,Kirvx/copay,DigiByte-Team/copay,mpolci/copay,Neurosploit/copay,payloadtech/wallet,mzpolini/copay,mpolci/copay,wallclockbuilder/copay,wallclockbuilder/copay,ObsidianCryptoVault/copay,fr34k8/copay,ionux/copay,habibmasuro/copay,Neurosploit/copay,robjohnson189/copay,msalcala11/copay,msalcala11/copay,jameswalpole/copay,JDonadio/copay,urv2/wallet,Tetpay/copay,gabrielbazan7/copay,gabrielbazan7/copay,kleetus/copay,wallclockbuilder/copay,troggy/unicoisa,julianromera/copay,DigiByte-Team/copay,troggy/copay,habibmasuro/copay,kleetus/copay,BitGo/copay,gabrielbazan7/copay,wyrdmantis/copay,solderzzc/copay,jameswalpole/copay,isocolsky/copay,bitchk-wallet/copay,ajp8164/copay,solderzzc/copay,payloadtech/wallet,troggy/colu-copay-wallet,wyrdmantis/copay,johnsmith76/Lite-Wallet,fr34k8/copay,urv2/wallet,matiu/copay,payloadpk/wallet,philosodad/copay,gabrielbazan7/copay,Bitcoin-com/Wallet,DigiByte-Team/copay,tanojaja/copay,wyrdmantis/copay,johnsmith76/Lite-Wallet,mpolci/copay,Neurosploit/copay,Groestlcoin/GroestlPay,Kirvx/copay,bitchk-wallet/copay,DigiByte-Team/copay,matiu/copay,robjohnson189/copay,MonetaryUnit/copay,JDonadio/copay,isocolsky/copay,CryptArc/platinumpay,ionux/copay,bitjson/copay,Neurosploit/copay,dabura667/copay,payloadpk/wallet,troggy/colu-copay-wallet,janko33bd/copay,willricketts/copay,troggy/colu-copay-wallet,ObsidianCryptoVault/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,bankonme/copay,mzpolini/copay,matiu/copay,JDonadio/copay,troggy/copay,javierbitpay/copay,startcoin-project/startwallet,Kirvx/copay,julianromera/copay,jameswalpole/copay,DigiByte-Team/copay,payloadpk/wallet,johnsmith76/Lite-Wallet,startcoin-project/startwallet,javierbitpay/copay,solderzzc/copay,LedgerHQ/copay,Bitcoin-com/Wallet,troggy/unicoisa,bankonme/copay,bankonme/copay,fr34k8/copay,cobit-wallet/cobit,cobit-wallet/cobit,julianromera/copay,tanojaja/copay,kleetus/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,Kirvx/copay,bitjson/copay,willricketts/copay,jmaurice/copay,ionux/copay,jmaurice/copay,payloadpk/wallet,bechi/copay,mzpolini/copay,robjohnson189/copay,isocolsky/copay,mpolci/copay,ObsidianCryptoVault/copay,cmgustavo/copay,digibyte/digibytego,JDonadio/copay,isocolsky/copay,cobit-wallet/cobit,Groestlcoin/GroestlPay,digibyte/digibytego,MonetaryUnit/copay,ztalker/copay,troggy/colu-copay-wallet,bitchk-wallet/copay,MonetaryUnit/copay,BitGo/copay,bankonme/copay,javierbitpay/copay,ajp8164/copay,hideoussquid/aur-copay,troggy/copay,julianromera/copay,payloadtech/wallet,CryptArc/platinumpay,troggy/unicoisa,CryptArc/platinumpay,dabura667/copay,jmaurice/copay,cmgustavo/copay,fr34k8/copay,bechi/copay,mzpolini/copay,msalcala11/copay,ionux/copay,habibmasuro/copay,robjohnson189/copay,startcoin-project/startwallet,philosodad/copay,philosodad/copay,CryptArc/platinumpay,ztalker/copay,startcoin-project/startwallet,DigiByte-Team/copay,ObsidianCryptoVault/copay,hideoussquid/aur-copay,janko33bd/copay,wyrdmantis/copay,Tetpay/copay,tanojaja/copay,payloadtech/wallet,bechi/copay,kleetus/copay,willricketts/copay,dabura667/copay,matiu/copay,urv2/wallet,cmgustavo/copay,ztalker/copay,habibmasuro/copay,willricketts/copay,jameswalpole/copay,janko33bd/copay,LedgerHQ/copay,philosodad/copay,digibyte/digibytego,johnsmith76/Lite-Wallet,Bitcoin-com/Wallet,ztalker/copay,DigiByte-Team/copay,jmaurice/copay,ajp8164/copay,solderzzc/copay,troggy/copay,bitjson/copay,MonetaryUnit/copay,urv2/wallet,tanojaja/copay,LedgerHQ/copay,bitjson/copay,javierbitpay/copay
--- +++ @@ -8,7 +8,7 @@ inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { - var key = cryptoUtil.kdfbinary(this.password + this.email); + var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { if (err) { @@ -24,13 +24,13 @@ }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { - var key = cryptoUtil.kdfbinary(this.password + this.email); + var key = cryptoUtil.kdf(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { - var key = cryptoUtil.kdfbinary(this.password + this.email); + var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); };
197b667ca677c5961c9c1d116fb86032bd2ef861
app/assets/javascripts/application.js
app/assets/javascripts/application.js
//= require jquery $(function() { $('.login-trello').click(function() { Trello.authorize({ type: "redirect", name: "Reportrello", scope: { read: true, write: true } }); }); })
//= require jquery $(function() { $('.login-trello').click(function() { Reportrello.authorize(); }); Reportrello = { authorize: function() { var self = this Trello.authorize({ type: 'popup', name: 'Reportrello', fragment: 'postmessage', scope: { read: true, write: true }, expiration: 'never', success: function() { self.getMe(); }, error: function() { alert("Failed authentication"); } }); }, getMe: function() { var token = localStorage.getItem('trello_token'); Trello.rest( 'GET', 'members/me', { fields: 'username,fullName,avatar', token: token }, function (object) { location.href = '/authentication/?user[token]=' + token + '&user[username]=' + object.username + '&user[fullname]=' + object.fullName }, function (a) { alert("Failed authentication"); } ); }, newReport: function() { } } })
Add JS to authentication and get user information by token
Add JS to authentication and get user information by token
JavaScript
mit
SauloSilva/reportrello,SauloSilva/reportrello,SauloSilva/reportrello
--- +++ @@ -2,13 +2,50 @@ $(function() { $('.login-trello').click(function() { - Trello.authorize({ - type: "redirect", - name: "Reportrello", - scope: { - read: true, - write: true - } - }); + Reportrello.authorize(); }); + + Reportrello = { + authorize: function() { + var self = this + + Trello.authorize({ + type: 'popup', + name: 'Reportrello', + fragment: 'postmessage', + scope: { + read: true, + write: true + }, + expiration: 'never', + success: function() { + self.getMe(); + }, + error: function() { + alert("Failed authentication"); + } + }); + }, + + getMe: function() { + var token = localStorage.getItem('trello_token'); + + Trello.rest( + 'GET', + 'members/me', + { + fields: 'username,fullName,avatar', + token: token + }, + function (object) { + location.href = '/authentication/?user[token]=' + token + '&user[username]=' + object.username + '&user[fullname]=' + object.fullName + }, + function (a) { alert("Failed authentication"); } + ); + }, + + newReport: function() { + + } + } })
3578177e3e10ebb0c5c0403b2df13fa472c70edb
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree .
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require turbolinks //= require_tree .
Enable JavaScript code of bootstrap
Enable JavaScript code of bootstrap
JavaScript
mit
eqot/petroglyph3,eqot/petroglyph3
--- +++ @@ -12,5 +12,6 @@ // //= require jquery //= require jquery_ujs +//= require twitter/bootstrap //= require turbolinks //= require_tree .
9716b2cd82d4f4a778f798b88838a5685db2b7ea
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require turbolinks //= require_tree .
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require turbolinks //= require rails-ujs //= require_tree .
Enable rails-ujs to make working REST methods on link by js
Enable rails-ujs to make working REST methods on link by js
JavaScript
mit
gadzorg/gram2_api_server,gadzorg/gram2_api_server,gadzorg/gram2_api_server
--- +++ @@ -11,4 +11,5 @@ // about supported directives. // //= require turbolinks +//= require rails-ujs //= require_tree .
e467997d760eeb7c3b9282a645568e4b3bcc13e8
app/services/stripe.js
app/services/stripe.js
/* global Stripe */ import config from '../config/environment'; import Ember from 'ember'; var debug = config.LOG_STRIPE_SERVICE; function createToken (card) { if (debug) { Ember.Logger.info('StripeService: getStripeToken - card:', card); } // manually start Ember loop Ember.run.begin(); return new Ember.RSVP.Promise(function (resolve, reject) { Stripe.card.createToken(card, function (status, response) { if (debug) { Ember.Logger.info('StripeService: createToken handler - status %s, response:', status, response); } if (response.error) { reject(response); return Ember.run.end(); } resolve(response); Ember.run.end(); }); }); } export default Ember.Object.extend({ createToken: createToken });
/* global Stripe */ import config from '../config/environment'; import Ember from 'ember'; var debug = config.LOG_STRIPE_SERVICE; function createToken (card) { if (debug) { Ember.Logger.info('StripeService: getStripeToken - card:', card); } // manually start Ember loop Ember.run.begin(); return new Ember.RSVP.Promise(function (resolve, reject) { Stripe.card.createToken(card, function (status, response) { if (debug) { Ember.Logger.info('StripeService: createToken handler - status %s, response:', status, response); } if (response.error) { reject(response); return Ember.run.end(); } resolve(response); Ember.run.end(); }); }); } function createBankAccountToken(bankAccount) { if (debug) { Ember.Logger.info('StripeService: getStripeToken - bankAccount:', bankAccount); } // manually start Ember loop Ember.run.begin(); return new Ember.RSVP.Promise(function (resolve, reject) { Stripe.bankAccount.createToken(bankAccount, function (status, response) { if (debug) { Ember.Logger.info('StripeService: createBankAccountToken handler - status %s, response:', status, response); } if (response.error) { reject(response); return Ember.run.end(); } resolve(response); Ember.run.end(); }); }); } export default Ember.Object.extend({ createToken: createToken, createBankAccountToken: createBankAccountToken, });
Add a create bank account token method to the service
Add a create bank account token method to the service
JavaScript
mit
iezer/ember-stripe-service,iezer/ember-stripe-service,sescobb27/ember-stripe-service,samselikoff/ember-stripe-service,samselikoff/ember-stripe-service,ride/ember-stripe-service,fastly/ember-stripe-service,fastly/ember-stripe-service,sescobb27/ember-stripe-service,ride/ember-stripe-service
--- +++ @@ -30,6 +30,34 @@ }); } +function createBankAccountToken(bankAccount) { + if (debug) { + Ember.Logger.info('StripeService: getStripeToken - bankAccount:', bankAccount); + } + + // manually start Ember loop + Ember.run.begin(); + + return new Ember.RSVP.Promise(function (resolve, reject) { + Stripe.bankAccount.createToken(bankAccount, function (status, response) { + + if (debug) { + Ember.Logger.info('StripeService: createBankAccountToken handler - status %s, response:', status, response); + } + + if (response.error) { + reject(response); + return Ember.run.end(); + } + + resolve(response); + + Ember.run.end(); + }); + }); +} + export default Ember.Object.extend({ - createToken: createToken + createToken: createToken, + createBankAccountToken: createBankAccountToken, });
fecd1be97cfd7539a738effe8a870ed71470b56a
src/lib/HttpApi.js
src/lib/HttpApi.js
export default class HttpApi { constructor (prefix = '') { this.prefix = prefix this.opts = { credentials: 'same-origin', headers: new Headers({ 'Content-Type': 'application/json', }) } return this.callApi } callApi = (method, url, opts = {}) => { opts = Object.assign({}, this.opts, opts) opts.method = method if (typeof opts.body === 'object') { opts.body = JSON.stringify(opts.body) } return fetch(`/api/${this.prefix}${url}`, opts) .then(res => { if (res.ok) { const type = res.headers.get('Content-Type') return (type && type.includes('application/json')) ? res.json() : res.text() } // error return res.text().then(txt => { return Promise.reject(new Error(txt)) }) }) } }
export default class HttpApi { constructor (prefix = '') { this.prefix = prefix this.opts = { credentials: 'same-origin', headers: new Headers({ 'Content-Type': 'application/json', }) } return this.callApi } callApi = (method, url, opts = {}) => { opts = Object.assign({}, this.opts, opts) opts.method = method if (typeof opts.body === 'object') { opts.body = JSON.stringify(opts.body) } return fetch(`/api/${this.prefix}${url}`, opts) .then(res => { if (res.ok) { const type = res.headers.get('Content-Type') return (type && type.includes('application/json')) ? res.json() : res } // error return res.text().then(txt => { return Promise.reject(new Error(txt)) }) }) } }
Fix fetch api when returning non-JSON
Fix fetch api when returning non-JSON
JavaScript
isc
bhj/karaoke-forever,bhj/karaoke-forever
--- +++ @@ -23,7 +23,7 @@ .then(res => { if (res.ok) { const type = res.headers.get('Content-Type') - return (type && type.includes('application/json')) ? res.json() : res.text() + return (type && type.includes('application/json')) ? res.json() : res } // error
700f316c0ca9aa873181111752ba99b0f17a1d35
src-es6/test/classTest.js
src-es6/test/classTest.js
import test from 'tape' import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..' test('Polygon#contains', t => { t.plan(5) //Disable warning about missing 'new'. That's what we are testing /*jshint -W064 */ /*eslint-disable new-cap */ t.throws(()=> Polygon(), TypeError) t.throws(()=> Rectangle(), TypeError) t.throws(()=> Vector(), TypeError) t.throws(()=> Circle(), TypeError) t.throws(()=> ShapeEventEmitter(), TypeError) /*eslint-enable new-cap */ })
import test from 'tape' import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..' test('Classtest', t => { t.plan(5) //Disable warning about missing 'new'. That's what we are testing /*jshint -W064 */ /*eslint-disable new-cap */ t.throws(()=> Polygon(), TypeError) t.throws(()=> Rectangle(), TypeError) t.throws(()=> Vector(), TypeError) t.throws(()=> Circle(), TypeError) t.throws(()=> ShapeEventEmitter(), TypeError) /*eslint-enable new-cap */ })
Fix name for the classtest
Fix name for the classtest
JavaScript
mit
tillarnold/shapes
--- +++ @@ -1,7 +1,7 @@ import test from 'tape' import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..' -test('Polygon#contains', t => { +test('Classtest', t => { t.plan(5) //Disable warning about missing 'new'. That's what we are testing /*jshint -W064 */
1cf21242ccd82a54bf1b0da0f61184065f3bd765
WebContent/js/moe-list.js
WebContent/js/moe-list.js
/* Cached Variables *******************************************************************************/ var context = sessionStorage.getItem('context'); var rowThumbnails = document.querySelector('.row-thumbnails'); /* Initialization *********************************************************************************/ rowThumbnails.addEventListener("click", moeRedirect, false); function moeRedirect(event) { var target = event.target; var notImage = target.className !== 'thumbnail-image'; if(notImage) return; var pageId = target.getAttribute('data-page-id'); window.location.href = context + '/page/' + pageId; } var thumbnails = window.document.querySelectorAll('.thumbnail'); var tallestThumbnailSize = 0; thumbnails.forEach(function(value, key, listObj, argument) { var offsetHeight = listObj[key].offsetHeight; if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; }); thumbnails.forEach(function(value, key, listObj, argument) { listObj[key].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); }); //After thumbnail processing, remove the page-loading blocker document.querySelector('body').classList.remove('content-loading');
/* Cached Variables *******************************************************************************/ var context = sessionStorage.getItem('context'); var rowThumbnails = document.querySelector('.row-thumbnails'); /* Initialization *********************************************************************************/ rowThumbnails.addEventListener("click", moeRedirect, false); function moeRedirect(event) { var target = event.target; var notImage = target.className !== 'thumbnail-image'; if(notImage) return; var pageId = target.getAttribute('data-page-id'); window.location.href = context + '/page/' + pageId; } var thumbnails = window.document.querySelectorAll('.thumbnail'); var tallestThumbnailSize = 0; for (var i = 0; i < thumbnails.length; i++) { var offsetHeight = thumbnails[i].offsetHeight; if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; }; for (var i = 0; i < thumbnails.length; i++) { thumbnails[i].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); }; //After thumbnail processing, remove the page-loading blocker document.querySelector('body').classList.remove('content-loading');
Change nodelist.foreach to a normal for loop
Change nodelist.foreach to a normal for loop This should bring much greater browser compatibility the the nodelist foreach allowing it to work on all the major browser vendors. Fixes #95
JavaScript
mit
NYPD/moe-sounds,NYPD/moe-sounds
--- +++ @@ -21,16 +21,14 @@ var thumbnails = window.document.querySelectorAll('.thumbnail'); var tallestThumbnailSize = 0; -thumbnails.forEach(function(value, key, listObj, argument) { - var offsetHeight = listObj[key].offsetHeight; - if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; -}); +for (var i = 0; i < thumbnails.length; i++) { + var offsetHeight = thumbnails[i].offsetHeight; + if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; +}; -thumbnails.forEach(function(value, key, listObj, argument) { - listObj[key].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); -}); - +for (var i = 0; i < thumbnails.length; i++) { + thumbnails[i].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); +}; //After thumbnail processing, remove the page-loading blocker document.querySelector('body').classList.remove('content-loading'); -
0a5d4a96c4f656ff2aa154274dc19cfa3f4d3d17
openstack_dashboard/static/fiware/contextualHelp.js
openstack_dashboard/static/fiware/contextualHelp.js
$( document ).ready(function () { $('.contextual-help').click(function (){ $(this).find('i').toggleClass('active'); }); $('body').click(function (e) { $('[data-toggle="popover"]').each(function () { //the 'is' for buttons that trigger popups //the 'has' for icons within a button that triggers a popup if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { $(this).popover('hide'); $(this).find('i').removeClass('active'); } }); }); });
$( document ).ready(function () { $('.contextual-help').click(function (){ $(this).find('i').toggleClass('active'); }); $('body').click(function (e) { $('[data-toggle="popover"].contextual-help').each(function () { //the 'is' for buttons that trigger popups //the 'has' for icons within a button that triggers a popup if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { $(this).popover('hide'); $(this).find('i').removeClass('active'); } }); }); });
Improve usability of contextual-help popovers
Improve usability of contextual-help popovers
JavaScript
apache-2.0
ging/horizon,ging/horizon,ging/horizon,ging/horizon
--- +++ @@ -4,7 +4,7 @@ }); $('body').click(function (e) { - $('[data-toggle="popover"]').each(function () { + $('[data-toggle="popover"].contextual-help').each(function () { //the 'is' for buttons that trigger popups //the 'has' for icons within a button that triggers a popup if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
6655280140920d0697a5bf1ef8cff12c7bcee5d0
src/twig.header.js
src/twig.header.js
/** * Twig.js 0.8.2 * * @copyright 2011-2015 John Roepke and the Twig.js Contributors * @license Available under the BSD 2-Clause License * @link https://github.com/justjohn/twig.js */ var Twig = (function (Twig) { Twig.VERSION = "0.8.2"; return Twig; })(Twig || {});
/** * Twig.js 0.8.2-1 * * @copyright 2011-2015 John Roepke and the Twig.js Contributors * @license Available under the BSD 2-Clause License * @link https://github.com/justjohn/twig.js */ var Twig = (function (Twig) { Twig.VERSION = "0.8.2-1"; return Twig; })(Twig || {});
Bump internal Twig.js version to "0.8.2-1"
Bump internal Twig.js version to "0.8.2-1"
JavaScript
bsd-2-clause
FoxyCart/twig.js,FoxyCart/twig.js,FoxyCart/twig.js
--- +++ @@ -1,5 +1,5 @@ /** - * Twig.js 0.8.2 + * Twig.js 0.8.2-1 * * @copyright 2011-2015 John Roepke and the Twig.js Contributors * @license Available under the BSD 2-Clause License @@ -8,7 +8,7 @@ var Twig = (function (Twig) { - Twig.VERSION = "0.8.2"; + Twig.VERSION = "0.8.2-1"; return Twig; })(Twig || {});
f4ac2aad1922930d4c27d4841e5665714a509a14
src/command-line/index.js
src/command-line/index.js
var program = require("commander"); var pkg = require("../../package.json"); var fs = require("fs"); var mkdirp = require("mkdirp"); var Helper = require("../helper"); program.version(pkg.version, "-v, --version"); program.option(""); program.option(" --home <path>" , "home path"); require("./start"); require("./config"); require("./list"); require("./add"); require("./remove"); require("./reset"); require("./edit"); var argv = program.parseOptions(process.argv); if (program.home) { Helper.HOME = program.home; } var config = Helper.HOME + "/config.js"; if (!fs.existsSync(config)) { mkdirp.sync(Helper.HOME); fs.writeFileSync( config, fs.readFileSync(__dirname + "/../../defaults/config.js") ); console.log("Config created:"); console.log(config); } program.parse(argv.args); if (!program.args.length) { program.parse(process.argv.concat("start")); }
var program = require("commander"); var pkg = require("../../package.json"); var fs = require("fs"); var mkdirp = require("mkdirp"); var Helper = require("../helper"); program.version(pkg.version, "-v, --version"); program.option(""); program.option(" --home <path>" , "home path"); var argv = program.parseOptions(process.argv); if (program.home) { Helper.HOME = program.home; } var config = Helper.HOME + "/config.js"; if (!fs.existsSync(config)) { mkdirp.sync(Helper.HOME); fs.writeFileSync( config, fs.readFileSync(__dirname + "/../../defaults/config.js") ); console.log("Config created:"); console.log(config); } require("./start"); require("./config"); require("./list"); require("./add"); require("./remove"); require("./reset"); require("./edit"); program.parse(argv.args); if (!program.args.length) { program.parse(process.argv.concat("start")); }
Fix loading config before HOME variable is set
Fix loading config before HOME variable is set
JavaScript
mit
realies/lounge,ScoutLink/lounge,realies/lounge,rockhouse/lounge,rockhouse/lounge,FryDay/lounge,williamboman/lounge,rockhouse/lounge,sebastiencs/lounge,sebastiencs/lounge,libertysoft3/lounge-autoconnect,metsjeesus/lounge,FryDay/lounge,williamboman/lounge,williamboman/lounge,metsjeesus/lounge,ScoutLink/lounge,sebastiencs/lounge,MaxLeiter/lounge,thelounge/lounge,FryDay/lounge,metsjeesus/lounge,thelounge/lounge,realies/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge,ScoutLink/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge
--- +++ @@ -7,14 +7,6 @@ program.version(pkg.version, "-v, --version"); program.option(""); program.option(" --home <path>" , "home path"); - -require("./start"); -require("./config"); -require("./list"); -require("./add"); -require("./remove"); -require("./reset"); -require("./edit"); var argv = program.parseOptions(process.argv); if (program.home) { @@ -32,6 +24,14 @@ console.log(config); } +require("./start"); +require("./config"); +require("./list"); +require("./add"); +require("./remove"); +require("./reset"); +require("./edit"); + program.parse(argv.args); if (!program.args.length) {
2135e956f28bafdfe11786d3157f52ea05bccf33
config/env/production.js
config/env/production.js
'use strict'; module.exports = { db: 'mongodb://localhost/mean', app: { name: 'MEAN - A Modern Stack - Production' }, facebook: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/facebook/callback' }, twitter: { clientID: 'CONSUMER_KEY', clientSecret: 'CONSUMER_SECRET', callbackURL: 'http://localhost:3000/auth/twitter/callback' }, github: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/github/callback' }, google: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/google/callback' }, linkedin: { clientID: 'API_KEY', clientSecret: 'SECRET_KEY', callbackURL: 'http://localhost:3000/auth/linkedin/callback' } };
'use strict'; module.exports = { app: { name: 'MEAN - A Modern Stack - Production' }, facebook: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/facebook/callback' }, twitter: { clientID: 'CONSUMER_KEY', clientSecret: 'CONSUMER_SECRET', callbackURL: 'http://localhost:3000/auth/twitter/callback' }, github: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/github/callback' }, google: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/google/callback' }, linkedin: { clientID: 'API_KEY', clientSecret: 'SECRET_KEY', callbackURL: 'http://localhost:3000/auth/linkedin/callback' } };
Use MONGOHQ_URL for database connection in prod
Use MONGOHQ_URL for database connection in prod
JavaScript
bsd-2-clause
asm-products/barrtr,asm-products/barrtr
--- +++ @@ -1,7 +1,6 @@ 'use strict'; module.exports = { - db: 'mongodb://localhost/mean', app: { name: 'MEAN - A Modern Stack - Production' },
a92f5fd72560341022223b039b9282f0c360627e
addon/transitions/fade.js
addon/transitions/fade.js
import opacity from 'ember-animated/motions/opacity'; /** Fades inserted, removed, and kept sprites. ```js import fade from 'ember-animated/transitions/fade' export default Component.extend({ transition: fade }); ``` ```hbs {{#animated-if use=transition}} ... {{/animated-if}} ``` @function fade @export default */ export default function*({ removedSprites, insertedSprites, keptSprites, duration, }) { // We yield Promise.all here because we want to wait for this // step before starting what comes after. yield Promise.all( removedSprites.map(s => { if (s.revealed) { return opacity(s, { to: 0, duration: duration / 2, }); } }), ); // Once all fading out has happened, we can fade in the inserted // or kept sprites. Note that we get keptSprites if some things // were fading out and then we get interrupted and decide to // keep them around after all. insertedSprites.concat(keptSprites).map(s => opacity(s, { to: 1, duration: duration / 2, }), ); }
import opacity from 'ember-animated/motions/opacity'; /** Fades inserted, removed, and kept sprites. ```js import fade from 'ember-animated/transitions/fade'; export default Component.extend({ transition: fade }); ``` ```hbs {{#animated-if use=transition}} ... {{/animated-if}} ``` @function fade @export default */ export default function*({ removedSprites, insertedSprites, keptSprites, duration, }) { // We yield Promise.all here because we want to wait for this // step before starting what comes after. yield Promise.all( removedSprites.map(s => { if (s.revealed) { return opacity(s, { to: 0, duration: duration / 2, }); } }), ); // Once all fading out has happened, we can fade in the inserted // or kept sprites. Note that we get keptSprites if some things // were fading out and then we get interrupted and decide to // keep them around after all. insertedSprites.concat(keptSprites).map(s => opacity(s, { to: 1, duration: duration / 2, }), ); }
Add missing semicolon to example
Add missing semicolon to example Adds a missing semicolon to the fade transition example.
JavaScript
mit
ember-animation/ember-animated,ember-animation/ember-animated,ember-animation/ember-animated
--- +++ @@ -4,7 +4,7 @@ Fades inserted, removed, and kept sprites. ```js - import fade from 'ember-animated/transitions/fade' + import fade from 'ember-animated/transitions/fade'; export default Component.extend({ transition: fade
f6f3afda12313c5093774b47b62fa79789efccc0
dev/_/components/js/sourceModel.js
dev/_/components/js/sourceModel.js
// Source Model AV.source = Backbone.Model.extend({ url: 'php/redirect.php/source', defaults: { name: '', type: 'raw', contentType: 'txt', data: '' }, }); // Source Model Tests // test_source = new AV.source({ // name: 'The Wind and the Rain', // type: 'raw', // contentType: 'txt', // data: "When that I was and a little tiny boy, with a hey-ho, the wind and the rain, a foolish thing was but a toy, for the rain it raineth every day." // }); // alert('potato'); // test_source.save( { // success: function () { // alert('success'); // }, // error: function(d){ // alert('everything is terrible'); // } // }); other_test = new AV.source(); other_test.url = 'php/redirect.php/source/15'; other_test.fetch(); // Source Model End
// Source Model AV.Source = Backbone.Model.extend({ url: 'php/redirect.php/source', defaults: { name: '', type: 'raw', contentType: 'txt', data: '' }, }); // Source Model Tests // test_Source = new AV.Source({ // name: 'The Wind and the Rain', // type: 'raw', // contentType: 'txt', // data: "When that I was and a little tiny boy, with a hey-ho, the wind and "+ // the rain, a foolish thing was but a toy, for the rain it raineth every day." // }); // alert('potato'); // test_Source.save( { // success: function () { // alert('success'); // }, // error: function(d){ // alert('everything is terrible'); // } // }); // other_test = new AV.Source(); // other_test.url = 'php/redirect.php/Source/15'; // other_test.fetch(); // alert(other_test.name); // Source Model End
Add some tests, they're commented out right now. Things work!
Add some tests, they're commented out right now. Things work!
JavaScript
bsd-3-clause
Swarthmore/juxtaphor,Swarthmore/juxtaphor
--- +++ @@ -1,5 +1,5 @@ // Source Model -AV.source = Backbone.Model.extend({ +AV.Source = Backbone.Model.extend({ url: 'php/redirect.php/source', defaults: { name: '', @@ -11,14 +11,15 @@ // Source Model Tests -// test_source = new AV.source({ +// test_Source = new AV.Source({ // name: 'The Wind and the Rain', // type: 'raw', // contentType: 'txt', -// data: "When that I was and a little tiny boy, with a hey-ho, the wind and the rain, a foolish thing was but a toy, for the rain it raineth every day." +// data: "When that I was and a little tiny boy, with a hey-ho, the wind and "+ +// the rain, a foolish thing was but a toy, for the rain it raineth every day." // }); // alert('potato'); -// test_source.save( { +// test_Source.save( { // success: function () { // alert('success'); // }, @@ -27,9 +28,9 @@ // } // }); -other_test = new AV.source(); -other_test.url = 'php/redirect.php/source/15'; -other_test.fetch(); - +// other_test = new AV.Source(); +// other_test.url = 'php/redirect.php/Source/15'; +// other_test.fetch(); +// alert(other_test.name); // Source Model End
74e17f622ac60623e4461c5c472e740f292855f6
test/index.js
test/index.js
var callisto = require('callisto'); var users = require('./lib/users.js'); var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.Database('database.db3'); callisto.server({ port: 8090, root: 'www' }); callisto.addModule('users', users);
var callisto = require('callisto'); var users = require('./lib/users.js'); var sqlite3 = require('sqlite3').verbose(); global.db = new sqlite3.Database('database.db3'); callisto.server({ port: 8090, root: 'www' }); callisto.addModule('users', users);
Add db to the global variables
Add db to the global variables
JavaScript
mit
codingvillage/callisto,codingvillage/callisto
--- +++ @@ -1,7 +1,8 @@ var callisto = require('callisto'); var users = require('./lib/users.js'); var sqlite3 = require('sqlite3').verbose(); -var db = new sqlite3.Database('database.db3'); +global.db = new sqlite3.Database('database.db3'); + callisto.server({ port: 8090,
625fc78ee616baedf64aa37357403b4b72c7363c
src/js/select2/i18n/th.js
src/js/select2/i18n/th.js
define(function () { // Thai return { inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร'; return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร'; return message; }, loadingMore: function () { return 'กำลังค้นข้อมูลเพิ่ม…'; }, maximumSelected: function (args) { var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ'; return message; }, noResults: function () { return 'ไม่พบข้อมูล'; }, searching: function () { return 'กำลังค้นข้อมูล…'; } }; });
define(function () { // Thai return { errorLoading: function () { return 'ไม่สามารถค้นข้อมูลได้'; }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร'; return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร'; return message; }, loadingMore: function () { return 'กำลังค้นข้อมูลเพิ่ม…'; }, maximumSelected: function (args) { var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ'; return message; }, noResults: function () { return 'ไม่พบข้อมูล'; }, searching: function () { return 'กำลังค้นข้อมูล…'; } }; });
Add errorLoading translation of Thai language.
Add errorLoading translation of Thai language. This closes https://github.com/select2/select2/pull/4521.
JavaScript
mit
bottomline/select2,select2/select2,ZaArsProgger/select2,inway/select2,ZaArsProgger/select2,iestruch/select2,inway/select2,bottomline/select2,iestruch/select2,select2/select2
--- +++ @@ -1,6 +1,9 @@ define(function () { // Thai return { + errorLoading: function () { + return 'ไม่สามารถค้นข้อมูลได้'; + }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum;
263e6691ad0cda4c2adaee1aca584316fedcf382
test/index.js
test/index.js
var assert = require('assert') var mongo = require('../') var db = mongo('mongodb://read:read@ds031617.mongolab.com:31617/esdiscuss') before(function (done) { this.timeout(10000) db._get(done) }) describe('read only operation', function () { it('db.getCollectionNames', function (done) { db.getCollectionNames() .then(function (names) { assert(names.indexOf('contents') != -1) assert(names.indexOf('headers') != -1) assert(names.indexOf('history') != -1) assert(names.indexOf('messages') != -1) assert(names.indexOf('topics') != -1) }) .nodeify(done) }) it('db.collection("name").find().limit(10)', function (done) { db.collection('headers').find().limit(10) .then(function (headers) { assert(Array.isArray(headers)) assert(headers.length === 10) }) .nodeify(done) }) })
var assert = require('assert') var mongo = require('../') var db = mongo('mongodb://read:read@ds031617.mongolab.com:31617/esdiscuss') before(function (done) { this.timeout(10000) db._get(done) }) describe('read only operation', function () { it('db.getCollectionNames', function (done) { db.getCollectionNames() .then(function (names) { assert(names.indexOf('contents') != -1) assert(names.indexOf('headers') != -1) assert(names.indexOf('history') != -1) assert(names.indexOf('messages') != -1) assert(names.indexOf('topics') != -1) }) .nodeify(done) }) it('db.collection("name").find().limit(10)', function (done) { db.collection('headers').find().limit(10) .then(function (headers) { assert(Array.isArray(headers)) assert(headers.length === 10) }) .nodeify(done) }) it('db.collection("name").find().count()', function (done) { db.collection('headers').count() .then(function (count) { assert(typeof count === 'number'); assert(count > 0); }) .nodeify(done) }) })
Add test case for `count` method
Add test case for `count` method
JavaScript
mit
then/mongod,then/then-mongo
--- +++ @@ -27,4 +27,12 @@ }) .nodeify(done) }) + it('db.collection("name").find().count()', function (done) { + db.collection('headers').count() + .then(function (count) { + assert(typeof count === 'number'); + assert(count > 0); + }) + .nodeify(done) + }) })
74632c81aa309e7d4cfab2bc4fb80effd49da773
test/index.js
test/index.js
'use strict'; var test = require('tape'); var isError = require('../index.js'); test('isError is a function', function t(assert) { assert.equal(typeof isError, 'function'); assert.end(); }); test('returns true for error', function t(assert) { assert.equal(isError(new Error('foo')), true); assert.equal(isError(Error('foo')), true); assert.end(); }); test('returns false for non-error', function t(assert) { assert.equal(isError(null), false); assert.equal(isError(undefined), false); assert.equal(isError({message: 'hi'}), false); assert.end(); });
'use strict'; var test = require('tape'); var vm = require('vm'); var isError = require('../index.js'); test('isError is a function', function t(assert) { assert.equal(typeof isError, 'function'); assert.end(); }); test('returns true for error', function t(assert) { assert.equal(isError(new Error('foo')), true); assert.equal(isError(Error('foo')), true); assert.end(); }); test('returns false for non-error', function t(assert) { assert.equal(isError(null), false); assert.equal(isError(undefined), false); assert.equal(isError({message: 'hi'}), false); assert.end(); }); test('errors that inherit from Error', function t(assert) { var error = Object.create(new Error()); assert.equal(isError(error), true); assert.end(); }); test('errors from other contexts', function t(assert) { var error = vm.runInNewContext('new Error()'); assert.equal(isError(error), true); assert.end(); }); test('errors that inherit from Error in another context', function t(assert) { var error = vm.runInNewContext('Object.create(new Error())'); assert.equal(isError(error), true); assert.end(); });
Add breaking tests for foreign/inherited errors
Add breaking tests for foreign/inherited errors
JavaScript
mit
Raynos/is-error
--- +++ @@ -1,6 +1,7 @@ 'use strict'; var test = require('tape'); +var vm = require('vm'); var isError = require('../index.js'); @@ -21,3 +22,21 @@ assert.equal(isError({message: 'hi'}), false); assert.end(); }); + +test('errors that inherit from Error', function t(assert) { + var error = Object.create(new Error()); + assert.equal(isError(error), true); + assert.end(); +}); + +test('errors from other contexts', function t(assert) { + var error = vm.runInNewContext('new Error()'); + assert.equal(isError(error), true); + assert.end(); +}); + +test('errors that inherit from Error in another context', function t(assert) { + var error = vm.runInNewContext('Object.create(new Error())'); + assert.equal(isError(error), true); + assert.end(); +});
ce11c728c6aba22c377c9abd563aebc03df71964
core/client/views/settings/tags/settings-menu.js
core/client/views/settings/tags/settings-menu.js
var TagsSettingsMenuView = Ember.View.extend({ saveText: Ember.computed('controller.model.isNew', function () { return this.get('controller.model.isNew') ? 'Add Tag' : 'Save Tag'; }), // This observer loads and resets the uploader whenever the active tag changes, // ensuring that we can reuse the whole settings menu. updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () { var uploader = this.get('controller.uploaderReference'), image = this.get('controller.activeTag.image'); if (uploader && uploader[0]) { if (image) { uploader[0].uploaderUi.initWithImage(); } else { uploader[0].uploaderUi.initWithDropzone(); } } }) }); export default TagsSettingsMenuView;
var TagsSettingsMenuView = Ember.View.extend({ saveText: Ember.computed('controller.model.isNew', function () { return this.get('controller.model.isNew') ? 'Add Tag' : 'Save Tag'; }), // This observer loads and resets the uploader whenever the active tag changes, // ensuring that we can reuse the whole settings menu. updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () { var uploader = this.get('controller.uploaderReference'), image = this.get('controller.activeTag.image'); if (uploader && uploader[0]) { if (image) { uploader[0].uploaderUi.initWithImage(); } else { uploader[0].uploaderUi.reset(); } } }) }); export default TagsSettingsMenuView;
Reset upload component on tag switch
Reset upload component on tag switch Closes #4755
JavaScript
mit
sangcu/Ghost,thinq4yourself/Unmistakable-Blog,JohnONolan/Ghost,ThorstenHans/Ghost,optikalefx/Ghost,wemakeweb/Ghost,jomahoney/Ghost,lanffy/Ghost,tidyui/Ghost,rollokb/Ghost,shrimpy/Ghost,fredeerock/atlabghost,ClarkGH/Ghost,letsjustfixit/Ghost,UsmanJ/Ghost,rito/Ghost,TribeMedia/Ghost,BlueHatbRit/Ghost,e10/Ghost,NovaDevelopGroup/Academy,llv22/Ghost,yundt/seisenpenji,cysys/ghost-openshift,mohanambati/Ghost,Azzurrio/Ghost,Trendy/Ghost,mlabieniec/ghost-env,ashishapy/ghostpy,BayPhillips/Ghost,wspandihai/Ghost,k2byew/Ghost,VillainyStudios/Ghost,ManRueda/Ghost,delgermurun/Ghost,axross/ghost,JonSmith/Ghost,rizkyario/Ghost,TribeMedia/Ghost,no1lov3sme/Ghost,singular78/Ghost,ignasbernotas/nullifer,gcamana/Ghost,lukekhamilton/Ghost,kwangkim/Ghost,Coding-House/Ghost,anijap/PhotoGhost,situkangsayur/Ghost,handcode7/Ghost,Kikobeats/Ghost,k2byew/Ghost,IbrahimAmin/Ghost,flomotlik/Ghost,vainglori0us/urban-fortnight,Trendy/Ghost,chevex/undoctrinate,JonathanZWhite/Ghost,pollbox/ghostblog,sajmoon/Ghost,Dnlyc/Ghost,lukaszklis/Ghost,tidyui/Ghost,JulienBrks/Ghost,ckousik/Ghost,katrotz/blog.katrotz.space,novaugust/Ghost,edsadr/Ghost,TryGhost/Ghost,lukw00/Ghost,NikolaiIvanov/Ghost,davidmenger/nodejsfan,weareleka/blog,ddeveloperr/Ghost,jeonghwan-kim/Ghost,pathayes/FoodBlog,Romdeau/Ghost,rafaelstz/Ghost,load11/ghost,lethalbrains/Ghost,panezhang/Ghost,Coding-House/Ghost,cysys/ghost-openshift,vishnuharidas/Ghost,mayconxhh/Ghost,ErisDS/Ghost,carlyledavis/Ghost,tmp-reg/Ghost,jamesslock/Ghost,alecho/Ghost,Xibao-Lv/Ghost,bsansouci/Ghost,dYale/blog,kortemy/Ghost,duyetdev/islab,madole/diverse-learners,PaulBGD/Ghost-Plus,jin/Ghost,bbmepic/Ghost,Sebastian1011/Ghost,bastianbin/Ghost,memezilla/Ghost,dbalders/Ghost,jeonghwan-kim/Ghost,notno/Ghost,daihuaye/Ghost,kevinansfield/Ghost,wallmarkets/Ghost,neynah/GhostSS,blankmaker/Ghost,diancloud/Ghost,akveo/akveo-blog,diancloud/Ghost,MadeOnMars/Ghost,daihuaye/Ghost,tanbo800/Ghost,shannonshsu/Ghost,ryansukale/ux.ryansukale.com,sangcu/Ghost,gcamana/Ghost,patterncoder/patterncoder,rizkyario/Ghost,dggr/Ghost-sr,ryansukale/ux.ryansukale.com,qdk0901/Ghost,optikalefx/Ghost,praveenscience/Ghost,mohanambati/Ghost,Japh/shortcoffee,Loyalsoldier/Ghost,jorgegilmoreira/ghost,vainglori0us/urban-fortnight,pedroha/Ghost,melissaroman/ghost-blog,rameshponnada/Ghost,greenboxindonesia/Ghost,metadevfoundation/Ghost,akveo/akveo-blog,omaracrystal/Ghost,notno/Ghost,aschmoe/jesse-ghost-app,influitive/crafters,bosung90/Ghost,Kaenn/Ghost,tyrikio/Ghost,situkangsayur/Ghost,Rovak/Ghost,Japh/shortcoffee,NovaDevelopGroup/Academy,greyhwndz/Ghost,skmezanul/Ghost,imjerrybao/Ghost,mattchupp/blog,camilodelvasto/herokughost,KnowLoading/Ghost,ManRueda/Ghost,benstoltz/Ghost,morficus/Ghost,zackslash/Ghost,dggr/Ghost-sr,riyadhalnur/Ghost,GarrethDottin/Habits-Design,carlosmtx/Ghost,allanjsx/Ghost,Japh/Ghost,ITJesse/Ghost-zh,ygbhf/Ghost,ClarkGH/Ghost,telco2011/Ghost,jomofrodo/ccb-ghost,sebgie/Ghost,Yarov/yarov,sfpgmr/Ghost,vloom/blog,velimir0xff/Ghost,trunk-studio/Ghost,RufusMbugua/TheoryOfACoder,allanjsx/Ghost,daimaqiao/Ghost-Bridge,smedrano/Ghost,wangjun/Ghost,LeandroNascimento/Ghost,sifatsultan/js-ghost,blankmaker/Ghost,dai-shi/Ghost,etanxing/Ghost,acburdine/Ghost,mdbw/ghost,kevinansfield/Ghost,psychobunny/Ghost,ladislas/ghost,v3rt1go/Ghost,Xibao-Lv/Ghost,Netazoic/bad-gateway,aroneiermann/GhostJade,acburdine/Ghost,lukekhamilton/Ghost,letsjustfixit/Ghost,Elektro1776/javaPress,darvelo/Ghost,jacostag/Ghost,tksander/Ghost,pbevin/Ghost,patrickdbakke/ghost-spa,disordinary/Ghost,gabfssilva/Ghost,diogogmt/Ghost,r1N0Xmk2/Ghost,jacostag/Ghost,obsoleted/Ghost,Kikobeats/Ghost,nmukh/Ghost,lanffy/Ghost,sceltoas/Ghost,JonSmith/Ghost,metadevfoundation/Ghost,hnarayanan/narayanan.co,smaty1/Ghost,thomasalrin/Ghost,Shauky/Ghost,rmoorman/Ghost,telco2011/Ghost,johngeorgewright/blog.j-g-w.info,karmakaze/Ghost,alecho/Ghost,sunh3/Ghost,laispace/laiblog,phillipalexander/Ghost,letsjustfixit/Ghost,dqj/Ghost,gabfssilva/Ghost,Azzurrio/Ghost,bisoe/Ghost,dYale/blog,rouanw/Ghost,dqj/Ghost,carlosmtx/Ghost,hoxoa/Ghost,jiangjian-zh/Ghost,exsodus3249/Ghost,NikolaiIvanov/Ghost,nmukh/Ghost,etdev/blog,wspandihai/Ghost,bastianbin/Ghost,atandon/Ghost,codeincarnate/Ghost,shannonshsu/Ghost,icowan/Ghost,Remchi/Ghost,pensierinmusica/Ghost,ghostchina/Ghost-zh,zhiyishou/Ghost,liftup/ghost,lowkeyfred/Ghost,bisoe/Ghost,ErisDS/Ghost,manishchhabra/Ghost,kaychaks/kaushikc.org,mlabieniec/ghost-env,yangli1990/Ghost,johnnymitch/Ghost,r14r/fork_nodejs_ghost,smaty1/Ghost,trunk-studio/Ghost,kolorahl/Ghost,PDXIII/Ghost-FormMailer,zeropaper/Ghost,Bunk/Ghost,PDXIII/Ghost-FormMailer,schematical/Ghost,patterncoder/patterncoder,javorszky/Ghost,dbalders/Ghost,johngeorgewright/blog.j-g-w.info,memezilla/Ghost,PeterCxy/Ghost,makapen/Ghost,Netazoic/bad-gateway,velimir0xff/Ghost,pensierinmusica/Ghost,melissaroman/ghost-blog,ballPointPenguin/Ghost,UsmanJ/Ghost,dai-shi/Ghost,tchapi/igneet-blog,jgillich/Ghost,dymx101/Ghost,leonli/ghost,schneidmaster/theventriloquist.us,Loyalsoldier/Ghost,dgem/Ghost,Rovak/Ghost,developer-prosenjit/Ghost,gleneivey/Ghost,ananthhh/Ghost,klinker-apps/ghost,NamedGod/Ghost,Klaudit/Ghost,psychobunny/Ghost,yundt/seisenpenji,Smile42RU/Ghost,singular78/Ghost,ITJesse/Ghost-zh,jorgegilmoreira/ghost,telco2011/Ghost,delgermurun/Ghost,Feitianyuan/Ghost,thomasalrin/Ghost,janvt/Ghost,woodyrew/Ghost,olsio/Ghost,ngosinafrica/SiteForNGOs,jiachenning/Ghost,r14r/fork_nodejs_ghost,jiachenning/Ghost,allanjsx/Ghost,darvelo/Ghost,jaswilli/Ghost,flpms/ghost-ad,UnbounDev/Ghost,ineitzke/Ghost,achimos/ghost_as,lf2941270/Ghost,Sebastian1011/Ghost,ljhsai/Ghost,sfpgmr/Ghost,greenboxindonesia/Ghost,wangjun/Ghost,TryGhost/Ghost,lukw00/Ghost,devleague/uber-hackathon,load11/ghost,NovaDevelopGroup/Academy,uploadcare/uploadcare-ghost-demo,Brunation11/Ghost,SkynetInc/steam,arvidsvensson/Ghost,ngosinafrica/SiteForNGOs,GroupxDev/javaPress,davidmenger/nodejsfan,AlexKVal/Ghost,weareleka/blog,tandrewnichols/ghost,benstoltz/Ghost,veyo-care/Ghost,r1N0Xmk2/Ghost,julianromera/Ghost,BayPhillips/Ghost,ManRueda/manrueda-blog,woodyrew/Ghost,sebgie/Ghost,singular78/Ghost,hoxoa/Ghost,jomofrodo/ccb-ghost,bosung90/Ghost,KnowLoading/Ghost,anijap/PhotoGhost,ManRueda/manrueda-blog,JohnONolan/Ghost,ErisDS/Ghost,veyo-care/Ghost,cqricky/Ghost,FredericBernardo/Ghost,Kikobeats/Ghost,sebgie/Ghost,tyrikio/Ghost,djensen47/Ghost,devleague/uber-hackathon,dylanchernick/ghostblog,schematical/Ghost,no1lov3sme/Ghost,neynah/GhostSS,adam-paterson/blog,manishchhabra/Ghost,PepijnSenders/whatsontheotherside,YY030913/Ghost,yanntech/Ghost,javorszky/Ghost,dbalders/Ghost,ddeveloperr/Ghost,pbevin/Ghost,lowkeyfred/Ghost,edurangel/Ghost,Netazoic/bad-gateway,tandrewnichols/ghost,codeincarnate/Ghost,edsadr/Ghost,kaychaks/kaushikc.org,denzelwamburu/denzel.xyz,hnarayanan/narayanan.co,VillainyStudios/Ghost,ryanbrunner/crafters,mnitchie/Ghost,jaswilli/Ghost,augbog/Ghost,camilodelvasto/herokughost,tmp-reg/Ghost,stridespace/Ghost,Klaudit/Ghost,hyokosdeveloper/Ghost,ryanbrunner/crafters,cqricky/Ghost,liftup/ghost,petersucks/blog,francisco-filho/Ghost,zackslash/Ghost,panezhang/Ghost,duyetdev/islab,Alxandr/Blog,e10/Ghost,mhhf/ghost-latex,ignasbernotas/nullifer,GarrethDottin/Habits-Design,LeandroNascimento/Ghost,rafaelstz/Ghost,morficus/Ghost,ineitzke/Ghost,javimolla/Ghost,cwonrails/Ghost,klinker-apps/ghost,ballPointPenguin/Ghost,djensen47/Ghost,Feitianyuan/Ghost,Alxandr/Blog,pedroha/Ghost,trepafi/ghost-base,zeropaper/Ghost,ckousik/Ghost,jiangjian-zh/Ghost,cicorias/Ghost,jin/Ghost,olsio/Ghost,ManRueda/manrueda-blog,cncodog/Ghost-zh-codog,jamesslock/Ghost,jaguerra/Ghost,STANAPO/Ghost,carlyledavis/Ghost,jparyani/GhostSS,flpms/ghost-ad,rchrd2/Ghost,devleague/uber-hackathon,influitive/crafters,yangli1990/Ghost,rameshponnada/Ghost,aschmoe/jesse-ghost-app,atandon/Ghost,jgillich/Ghost,pollbox/ghostblog,bitjson/Ghost,PeterCxy/Ghost,handcode7/Ghost,madole/diverse-learners,SkynetInc/steam,mohanambati/Ghost,rouanw/Ghost,acburdine/Ghost,epicmiller/pages,kortemy/Ghost,dgem/Ghost,hyokosdeveloper/Ghost,prosenjit-itobuz/Ghost,epicmiller/pages,claudiordgz/Ghost,phillipalexander/Ghost,netputer/Ghost,daimaqiao/Ghost-Bridge,Remchi/Ghost,tanbo800/Ghost,sceltoas/Ghost,mayconxhh/Ghost,neynah/GhostSS,icowan/Ghost,ladislas/ghost,fredeerock/atlabghost,daimaqiao/Ghost-Bridge,greyhwndz/Ghost,bsansouci/Ghost,theonlypat/Ghost,vloom/blog,cncodog/Ghost-zh-codog,yanntech/Ghost,andrewconnell/Ghost,chris-yoon90/Ghost,schneidmaster/theventriloquist.us,arvidsvensson/Ghost,mtvillwock/Ghost,novaugust/Ghost,Kaenn/Ghost,Elektro1776/javaPress,ivanoats/ivanstorck.com,ghostchina/Ghost-zh,virtuallyearthed/Ghost,denzelwamburu/denzel.xyz,virtuallyearthed/Ghost,BlueHatbRit/Ghost,sifatsultan/js-ghost,laispace/laiblog,barbastan/Ghost,lukaszklis/Ghost,adam-paterson/blog,imjerrybao/Ghost,FredericBernardo/Ghost,hilerchyn/Ghost,ThorstenHans/Ghost,Bunk/Ghost,Dnlyc/Ghost,PaulBGD/Ghost-Plus,ljhsai/Ghost,kevinansfield/Ghost,sajmoon/Ghost,disordinary/Ghost,NamedGod/Ghost,v3rt1go/Ghost,leninhasda/Ghost,Netazoic/bad-gateway,cicorias/Ghost,developer-prosenjit/Ghost,cwonrails/Ghost,zumobi/Ghost,stridespace/Ghost,beautyOfProgram/Ghost,novaugust/Ghost,barbastan/Ghost,julianromera/Ghost,nneko/Ghost,netputer/Ghost,RufusMbugua/TheoryOfACoder,ashishapy/ghostpy,smedrano/Ghost,lf2941270/Ghost,katrotz/blog.katrotz.space,Japh/Ghost,Gargol/Ghost,theonlypat/Ghost,GroupxDev/javaPress,johnnymitch/Ghost,dymx101/Ghost,kwangkim/Ghost,rito/Ghost,jparyani/GhostSS,JonathanZWhite/Ghost,pathayes/FoodBlog,aroneiermann/GhostJade,davidenq/Ghost-Blog,JulienBrks/Ghost,xiongjungit/Ghost,hnq90/Ghost,beautyOfProgram/Ghost,andrewconnell/Ghost,petersucks/blog,rollokb/Ghost,syaiful6/Ghost,leonli/ghost,jomahoney/Ghost,thinq4yourself/Unmistakable-Blog,dylanchernick/ghostblog,hnq90/Ghost,Yarov/yarov,jparyani/GhostSS,chris-yoon90/Ghost,shrimpy/Ghost,obsoleted/Ghost,nneko/Ghost,Kaenn/Ghost,GroupxDev/javaPress,lethalbrains/Ghost,leninhasda/Ghost,syaiful6/Ghost,prosenjit-itobuz/Ghost,ManRueda/Ghost,Alxandr/Blog,augbog/Ghost,thehogfather/Ghost,mnitchie/Ghost,camilodelvasto/localghost,gleneivey/Ghost,hilerchyn/Ghost,jomofrodo/ccb-ghost,etanxing/Ghost,Romdeau/Ghost,vainglori0us/urban-fortnight,jaguerra/Ghost,mdbw/ghost,davidenq/Ghost-Blog,etdev/blog,riyadhalnur/Ghost,ASwitlyk/Ghost,uploadcare/uploadcare-ghost-demo,sunh3/Ghost,rmoorman/Ghost,praveenscience/Ghost,camilodelvasto/localghost,cwonrails/Ghost,TryGhost/Ghost,SachaG/bjjbot-blog,stridespace/Ghost,laispace/laiblog,ASwitlyk/Ghost,qdk0901/Ghost,JohnONolan/Ghost,davidenq/Ghost-Blog,llv22/Ghost,leonli/ghost,tadityar/Ghost,axross/ghost,STANAPO/Ghost,edurangel/Ghost,AnthonyCorrado/Ghost,ivantedja/ghost,omaracrystal/Ghost,ivanoats/ivanstorck.com,Jai-Chaudhary/Ghost,makapen/Ghost,zhiyishou/Ghost,claudiordgz/Ghost,Elektro1776/javaPress,YY030913/Ghost,Smile42RU/Ghost,zumobi/Ghost,wemakeweb/Ghost,tadityar/Ghost,ygbhf/Ghost,cncodog/Ghost-zh-codog,francisco-filho/Ghost,DesenTao/Ghost,bitjson/Ghost,jorgegilmoreira/ghost,kolorahl/Ghost,xiongjungit/Ghost,uniqname/everydaydelicious,MadeOnMars/Ghost,janvt/Ghost,mhhf/ghost-latex,ananthhh/Ghost,exsodus3249/Ghost,bbmepic/Ghost,mlabieniec/ghost-env,DesenTao/Ghost,AnthonyCorrado/Ghost,achimos/ghost_as,mtvillwock/Ghost,skmezanul/Ghost,thehogfather/Ghost,rizkyario/Ghost,cysys/ghost-openshift,rchrd2/Ghost,diogogmt/Ghost,wallmarkets/Ghost,UnbounDev/Ghost,sergeylukin/Ghost,Brunation11/Ghost,kortemy/Ghost,SachaG/bjjbot-blog,dggr/Ghost-sr,tksander/Ghost,AlexKVal/Ghost,sergeylukin/Ghost,PepijnSenders/whatsontheotherside,flomotlik/Ghost,mattchupp/blog,karmakaze/Ghost,Gargol/Ghost,IbrahimAmin/Ghost,javimolla/Ghost,Jai-Chaudhary/Ghost
--- +++ @@ -15,7 +15,7 @@ if (image) { uploader[0].uploaderUi.initWithImage(); } else { - uploader[0].uploaderUi.initWithDropzone(); + uploader[0].uploaderUi.reset(); } } })
9d75d13fcca1105093170e6b98d1e690fc9cbd29
system-test/env.js
system-test/env.js
const expect = require('chai').expect; const version = process.env.QB_VERSION; describe('check compiler version inside docker', function () { it('should have the same version', async () => { const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.eql(version); }).timeout(60000); });
const expect = require('chai').expect; const version = process.env.QB_VERSION; describe('check compiler version inside docker', function () { it('should have the same version', async () => { const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.eql(version); }).timeout(60000); }); describe('check available standards', function() { it('should contain multiple standards', async() =>{ const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -t fredtingaud/quick-bench:${version} /bin/bash -c "./std-versions"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.not.be.empty(); expect(result).to.contain('c++11'); }) })
Add a test for std-versions script
Add a test for std-versions script
JavaScript
bsd-2-clause
FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end
--- +++ @@ -15,3 +15,18 @@ expect(result).to.eql(version); }).timeout(60000); }); + +describe('check available standards', function() { + it('should contain multiple standards', async() =>{ + const exec = require('child_process').exec; + let options = { + timeout: 60000, + killSignal: 'SIGKILL' + }; + const result = await new Promise(resolve => exec(`docker run --rm -t fredtingaud/quick-bench:${version} /bin/bash -c "./std-versions"`, options, (error, stdout, stderr) => { + resolve(stdout + stderr); + })); + expect(result).to.not.be.empty(); + expect(result).to.contain('c++11'); + }) +})
210babd039054adf81522da01f55b10b5e0dc06f
tests/dev.js
tests/dev.js
var f_ = require('../index.js'); var TaskList = require('./TaskList'); var f_config = { functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED resetOnRetryAll: true, toLog: ['all'], desc: 'Test taskList', maxRetries: { all: 2 } }; TaskList = f_.augment(TaskList, f_config); var runSingle = function (){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.start(); }(); var runMultiple = function (){ var startTime = Date.now(); for(var i=0; i<10000; i+=1){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i; taskListInstance.start(); } var endTime = Date.now(), timeTaken = endTime - startTime; console.log(timeTaken); };
var f_ = require('../index.js'); var TaskList = require('./TaskList'); var f_config = { /** * `start` method is not given here, since we call it manualy * This is just a matter of personal taste, I do not like auto starts! */ functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED resetOnRetryAll: true, toLog: ['all'], desc: 'Test taskList', maxRetries: { all: 2 } }; TaskList = f_.augment(TaskList, f_config); var runSingle = function (){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.start(); }(); var runMultiple = function (){ var startTime = Date.now(); for(var i=0; i<10000; i+=1){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i; taskListInstance.start(); } var endTime = Date.now(), timeTaken = endTime - startTime; console.log(timeTaken); };
Comment about start method not being present in functionFlow
Comment about start method not being present in functionFlow
JavaScript
mit
opensoars/f_
--- +++ @@ -3,6 +3,11 @@ var TaskList = require('./TaskList'); var f_config = { + + /** + * `start` method is not given here, since we call it manualy + * This is just a matter of personal taste, I do not like auto starts! + */ functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED resetOnRetryAll: true,
e34ec4cde226f760dc21926e9f2fb504fdb7fdb5
src/Drivers/Cache/index.js
src/Drivers/Cache/index.js
'use strict' /** * Abstract base class that ensures required public methods are implemented by * inheriting classes. * * @example * * class BloomFilterCache extends Cache { * constructor() { * super() * } * * get(key) {} * put(key, value, milliseconds) {} * increment(key) {} * incrementExpiration(key, seconds) {} * } * */ class Cache { /** * Do not call this constructor directly. */ constructor() { if (new.target === Cache) { throw new TypeError('Cannot instantiate abstract base class: Cache') } const abstractMethods = [ 'get', 'put', 'increment', 'incrementExpiration' ].map(name => { const implemented = typeof this[name] === 'function' return { name, implemented } }) if (!abstractMethods.every(method => method.implemented)) { const message = 'Implementing class does not override abstract methods: ' const unimplemented = abstractMethods .filter(method => !method.implemented) .map(method => method.name) .join(', ') throw new TypeError(message + unimplemented) } } } module.exports = Cache
'use strict' /** * Abstract base class that ensures required public methods are implemented by * inheriting classes. * * @example * * class BloomFilterCache extends Cache { * constructor() { * super() * } * * get(key) {} * put(key, value, milliseconds) {} * increment(key) {} * incrementExpiration(key, seconds) {} * } * */ class Cache { /** * Do not call this constructor directly. */ constructor() { if (new.target === Cache) { throw new TypeError('Cannot instantiate abstract base class: Cache') } const abstractMethods = [ 'get', 'put', 'increment', 'incrementExpiration', 'secondsToExpiration' ].map(name => { const implemented = typeof this[name] === 'function' return { name, implemented } }) if (!abstractMethods.every(method => method.implemented)) { const message = 'Implementing class does not override abstract methods: ' const unimplemented = abstractMethods .filter(method => !method.implemented) .map(method => method.name) .join(', ') throw new TypeError(message + unimplemented) } } } module.exports = Cache
Mark secondsToExpiration as abstract method
Mark secondsToExpiration as abstract method
JavaScript
mit
masasron/adonis-throttle,masasron/adonis-throttle
--- +++ @@ -31,7 +31,8 @@ 'get', 'put', 'increment', - 'incrementExpiration' + 'incrementExpiration', + 'secondsToExpiration' ].map(name => { const implemented = typeof this[name] === 'function' return { name, implemented }
3f5e236d5a23f13e8f683a550d31ff44080ecb01
transforms.js
transforms.js
/** * Module dependencies */ var accounting = require('accounting') , util = require('util') , currency = require('currency-symbol-map'); /** * formatPrice - format currency code and price nicely * @param {Object} value * @returns {String} formatted price * @note Value is expected to be of the form: * { * CurrencyCode: [ 'EUR' ], * Amount: [ '130' ] // Cents * } */ module.exports.formatPrice = function (val) { var code = val && val.CurrencyCode && val.CurrencyCode[0] , amount = val && val.Amount && val.Amount[0]; if (!code || !amount) return null; return accounting.formatMoney(amount / 100, currency(code)); };
/** * Module dependencies */ var accounting = require('accounting') , util = require('util') , currency = require('currency-symbol-map'); /** * formatPrice - format currency code and price nicely * @param {Object} value * @returns {String} formatted price * @note Value is expected to be of the form: * { * CurrencyCode: [ 'EUR' ], * Amount: [ '130' ] // Cents * } */ module.exports.formatPrice = function (val) { var code = val && val.CurrencyCode && val.CurrencyCode[0] , amount = val && val.Amount && val.Amount[0] , decimal, thousand; if (!code || !amount) return null; // Set separator if (~['DE'].indexOf(this.country)) { decimal = ','; thousand = '.'; } else { decimal = '.'; thousand = ','; } return accounting.formatMoney(amount / 100, currency(code), 2, thousand, decimal); };
Format prices differently for germany
Format prices differently for germany
JavaScript
mit
urgeiolabs/aws-price
--- +++ @@ -17,9 +17,19 @@ */ module.exports.formatPrice = function (val) { var code = val && val.CurrencyCode && val.CurrencyCode[0] - , amount = val && val.Amount && val.Amount[0]; + , amount = val && val.Amount && val.Amount[0] + , decimal, thousand; if (!code || !amount) return null; - return accounting.formatMoney(amount / 100, currency(code)); + // Set separator + if (~['DE'].indexOf(this.country)) { + decimal = ','; + thousand = '.'; + } else { + decimal = '.'; + thousand = ','; + } + + return accounting.formatMoney(amount / 100, currency(code), 2, thousand, decimal); };
351e1eb2093ff4cfb87f17f6bcfccb95f0f589f0
source/assets/javascripts/locastyle/_toggle-text.js
source/assets/javascripts/locastyle/_toggle-text.js
var locastyle = locastyle || {}; locastyle.toggleText = (function() { 'use strict'; var config = { trigger: '[data-ls-module=toggleText]', triggerChange: 'toggleText:change' }; function eventHandler(el, target, text) { el.trigger(config.triggerChange, [target, text]); } function bindToggle(el) { var $target = el.data('target-text') ? $(el.data('target-text')) : el; var textChange = el.data('toggle-text'); var textOriginal = $target.text(); el.data('toggle-text', textOriginal); $target.text(textChange); eventHandler(el, $target, textChange); } function bindEventOnClick() { $(config.trigger).on('click.ls', function(event) { event.preventDefault(); bindToggle($(this)); event.stopPropagation(); }); } function unbind() { $(config.trigger).off('click.ls'); } function init() { unbind(); bindEventOnClick(); } return { init: init }; }());
var locastyle = locastyle || {}; locastyle.toggleText = (function() { 'use strict'; var config = { trigger: '[data-ls-module=toggleText]', triggerChange: 'toggleText:change' }; function eventHandler(el, target, text) { el.trigger(config.triggerChange, [target, text]); } function bindToggle(el) { var $target = el.data('target-text') ? $(el.data('target-text')) : el; var textChange = el.data('toggle-text'); var textOriginal = $target.text(); el.data('toggle-text', textOriginal); $target.text(textChange); eventHandler(el, $target, textChange); } function bindEventOnClick() { $(config.trigger).on('click.ls', function(event) { event.preventDefault(); bindToggle($(this)); }); } function unbind() { $(config.trigger).off('click.ls'); } function init() { unbind(); bindEventOnClick(); } return { init: init }; }());
Remove stop propagation from toggle text module
Remove stop propagation from toggle text module
JavaScript
mit
locaweb/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,locaweb/locawebstyle,locaweb/locawebstyle
--- +++ @@ -27,7 +27,6 @@ $(config.trigger).on('click.ls', function(event) { event.preventDefault(); bindToggle($(this)); - event.stopPropagation(); }); }
c090cf03c81639622df3f7d3b0414aea926d95a3
bonfires/sum-all-odd-fibonacci-numbers/logic.js
bonfires/sum-all-odd-fibonacci-numbers/logic.js
/* Bonfire: Sum All Odd Fibonacci Numbers */ function sumFibs(num) { var f1 = 1; var f2 = 1; function fib(){ } return num; } sumFibs(4);
/* Bonfire: Sum All Odd Fibonacci Numbers */ function sumFibs(num) { var tmp = num; while (num > 2){ } return num; } sumFibs(4);
Edit Fibonacci project in Bonfires Directory
Edit Fibonacci project in Bonfires Directory
JavaScript
mit
witblacktype/freeCodeCamp_projects,witblacktype/freeCodeCamp_projects
--- +++ @@ -2,10 +2,8 @@ function sumFibs(num) { - var f1 = 1; - var f2 = 1; - - function fib(){ + var tmp = num; + while (num > 2){ }
069d6ac19107f126cc71b37dad5d8d0821d3c249
app/controllers/stream.js
app/controllers/stream.js
import Ember from 'ember'; import ENV from 'plenario-explorer/config/environment'; export default Ember.Controller.extend({ modelArrived: Ember.observer('model', function() { const nodeList = this.get('model.nodes'); const nodeTuples = nodeList.map(node => { return [node.properties.id, node.properties]; }); const nodeMap = new Map(nodeTuples); this.set('nodeMap', nodeMap); // TODO: Move magic node id to environment config this.set('selectedNode', nodeMap.get(ENV.defaultNode)); }), actions: { onSelect(nodeId) { const newNode = this.get('nodeMap').get(nodeId); this.set('selectedNode', newNode); } } });
import Ember from 'ember'; // import ENV from 'plenario-explorer/config/environment'; export default Ember.Controller.extend({ modelArrived: Ember.observer('model', function() { const nodeList = this.get('model.nodes'); const nodeTuples = nodeList.map(node => { return [node.properties.id, node.properties]; }); const nodeMap = new Map(nodeTuples); this.set('nodeMap', nodeMap); this.set('selectedNode', nodeList[0].properties); }), actions: { onSelect(nodeId) { const newNode = this.get('nodeMap').get(nodeId); this.set('selectedNode', newNode); } } });
Set default node as first returned from API
Set default node as first returned from API
JavaScript
mit
UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer
--- +++ @@ -1,5 +1,5 @@ import Ember from 'ember'; -import ENV from 'plenario-explorer/config/environment'; +// import ENV from 'plenario-explorer/config/environment'; export default Ember.Controller.extend({ modelArrived: Ember.observer('model', function() { @@ -9,8 +9,7 @@ }); const nodeMap = new Map(nodeTuples); this.set('nodeMap', nodeMap); - // TODO: Move magic node id to environment config - this.set('selectedNode', nodeMap.get(ENV.defaultNode)); + this.set('selectedNode', nodeList[0].properties); }), actions: {
c8edf1a27fe1a9142793a071b079d079138c6851
schema/sorts/fair_sorts.js
schema/sorts/fair_sorts.js
import { GraphQLEnumType } from 'graphql'; export default { type: new GraphQLEnumType({ name: 'FairSorts', values: { created_at_asc: { value: 'created_at', }, created_at_desc: { value: '-created_at', }, start_at_asc: { value: 'start_at', }, start_at_desc: { value: '-start_at', }, name_asc: { value: 'name', }, name_desc: { value: '-name', }, }, }), };
import { GraphQLEnumType } from 'graphql'; export default { type: new GraphQLEnumType({ name: 'FairSorts', values: { CREATED_AT_ASC: { value: 'created_at', }, CREATED_AT_DESC: { value: '-created_at', }, START_AT_ASC: { value: 'start_at', }, START_AT_DESC: { value: '-start_at', }, NAME_ASC: { value: 'name', }, NAME_DESC: { value: '-name', }, }, }), };
Use uppercase for fair sort enum
Use uppercase for fair sort enum
JavaScript
mit
artsy/metaphysics,broskoski/metaphysics,artsy/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,craigspaeth/metaphysics,1aurabrown/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,artsy/metaphysics,craigspaeth/metaphysics
--- +++ @@ -4,22 +4,22 @@ type: new GraphQLEnumType({ name: 'FairSorts', values: { - created_at_asc: { + CREATED_AT_ASC: { value: 'created_at', }, - created_at_desc: { + CREATED_AT_DESC: { value: '-created_at', }, - start_at_asc: { + START_AT_ASC: { value: 'start_at', }, - start_at_desc: { + START_AT_DESC: { value: '-start_at', }, - name_asc: { + NAME_ASC: { value: 'name', }, - name_desc: { + NAME_DESC: { value: '-name', }, },
50b994a3873b14b50a28660547ea7d4a36e4d429
config/pathresolver.js
config/pathresolver.js
/*jslint node: true */ const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver; const path = require('path'); pathresolver.baseDir = function(req) { if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) { throw new Error("No valid user!"); } // Admin users can see all the directories if(req.user.global_roles.indexOf('admin') >= 0) { return process.env.DATA_DIR; } // Other users can only see their own directory return path.join(process.env.DATA_DIR, req.user.username); };
/*jslint node: true */ const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver; const path = require('path'); const fs = require('fs.extra'); pathresolver.baseDir = function(req) { if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) { throw new Error("No valid user!"); } // Admin users can see all the directories if(req.user.global_roles.indexOf('admin') >= 0) { return process.env.DATA_DIR; } // Other users can only see their own directory var baseDir = path.join(process.env.DATA_DIR, req.user.username); // Create the directory if it does not exist already fs.mkdirpSync(baseDir); return baseDir; };
Create user directories if they do not exist
Create user directories if they do not exist
JavaScript
agpl-3.0
fkoester/purring-flamingo,fkoester/purring-flamingo
--- +++ @@ -1,6 +1,7 @@ /*jslint node: true */ const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver; const path = require('path'); +const fs = require('fs.extra'); pathresolver.baseDir = function(req) { @@ -14,5 +15,10 @@ } // Other users can only see their own directory - return path.join(process.env.DATA_DIR, req.user.username); + var baseDir = path.join(process.env.DATA_DIR, req.user.username); + + // Create the directory if it does not exist already + fs.mkdirpSync(baseDir); + + return baseDir; };
c8ac6f48aae5a473f712231bbad389f9b788cfc7
discord-client/src/bot.js
discord-client/src/bot.js
const Discord = require('discord.js'); const { ChannelProcessor } = require('./channelProcessor'); const {discordApiToken } = require('./secrets.js'); const client = new Discord.Client(); const channelProcessorMap = {}; client.on('ready', () => { console.log('Bot is ready'); }); client.on('message', (message) => { const channel = message.channel; const channelID = message.channel.id; if(channelProcessorMap[channelID] == null) { const newChannelProcessor = new ChannelProcessor(channelID); newChannelProcessor.setOnHaikuFunction((haiku) => { channel.send( `${haiku.author} has created a beautiful Haiku! ${haiku.lines[0]} ${haiku.lines[1]} ${haiku.lines[2]}`); }); channelProcessorMap[channelID] = newChannelProcessor; } channelProcessorMap[channelID].processMessage(message); }); client.login(discordApiToken);
const Discord = require('discord.js'); const { ChannelProcessor } = require('./channelProcessor'); const {discordApiToken } = require('./secrets.js'); const client = new Discord.Client(); const channelProcessorMap = {}; client.on('ready', () => { console.log('Bot is ready'); }); client.on('message', (message) => { const channel = message.channel; const channelID = message.channel.id; if(channelProcessorMap[channelID] == null) { const newChannelProcessor = new ChannelProcessor(channelID); newChannelProcessor.setOnHaikuFunction((haiku) => { console.log( `Haiku triggered: author: ${haiku.author} lines: ${haiku.lines}`); channel.send( `${haiku.author} has created a beautiful Haiku! ${haiku.lines[0]} ${haiku.lines[1]} ${haiku.lines[2]}`); }); channelProcessorMap[channelID] = newChannelProcessor; } channelProcessorMap[channelID].processMessage(message); }); client.login(discordApiToken);
Add console logging upon haiku trigger
Add console logging upon haiku trigger
JavaScript
mit
bumblepie/haikubot
--- +++ @@ -16,11 +16,15 @@ if(channelProcessorMap[channelID] == null) { const newChannelProcessor = new ChannelProcessor(channelID); newChannelProcessor.setOnHaikuFunction((haiku) => { + console.log( + `Haiku triggered: + author: ${haiku.author} + lines: ${haiku.lines}`); channel.send( - `${haiku.author} has created a beautiful Haiku! - ${haiku.lines[0]} - ${haiku.lines[1]} - ${haiku.lines[2]}`); + `${haiku.author} has created a beautiful Haiku! + ${haiku.lines[0]} + ${haiku.lines[1]} + ${haiku.lines[2]}`); }); channelProcessorMap[channelID] = newChannelProcessor; }
cc472a3d07b2803c9e3b4cb80624d1c312d519f7
test/fetch.js
test/fetch.js
'use strict'; var http = require('http'); var assert = require('assertive'); var fetch = require('../lib/fetch'); describe('fetch', function() { var server; before('start echo server', function(done) { server = http.createServer(function(req, res) { res.writeHead(200, { 'Content-Type': 'application/json', }); res.end(JSON.stringify({ method: req.method, url: req.url, headers: req.headers, })); }); server.on('error', done); server.listen(3000, function() { done(); }); }); after('close echo server', function(done) { server.close(done); }); it('can fetch stuff', function() { var headers = { 'x-Fancy': 'stuff' }; headers['X-Fancy'] = 'other stuff'; return fetch('http://localhost:3000/foo', { headers: headers }) .json() .then(function(echo) { assert.equal('GET', echo.method); assert.equal('/foo', echo.url); assert.equal('overriding headers works thanks to key ordering', 'other stuff', echo.headers['x-fancy']); }); }); });
'use strict'; var http = require('http'); var assert = require('assertive'); var fetch = require('../lib/fetch'); describe('fetch', function() { var server; before('start echo server', function(done) { server = http.createServer(function(req, res) { var chunks = []; req.on('data', function(chunk) { chunks.push(chunk); }); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'application/json', }); res.end(JSON.stringify({ method: req.method, url: req.url, headers: req.headers, body: Buffer.concat(chunks).toString() })); }); }); server.on('error', done); server.listen(3000, function() { done(); }); }); after('close echo server', function(done) { server.close(done); }); it('can fetch stuff', function() { var headers = { 'x-Fancy': 'stuff' }; headers['X-Fancy'] = 'other stuff'; return fetch('http://localhost:3000/foo', { headers: headers }) .json() .then(function(echo) { assert.equal('GET', echo.method); assert.equal('/foo', echo.url); assert.equal('', echo.body); assert.equal('overriding headers works thanks to key ordering', 'other stuff', echo.headers['x-fancy']); }); }); });
Add test for empty body
Add test for empty body
JavaScript
bsd-3-clause
jkrems/srv-gofer
--- +++ @@ -11,14 +11,21 @@ before('start echo server', function(done) { server = http.createServer(function(req, res) { - res.writeHead(200, { - 'Content-Type': 'application/json', + var chunks = []; + req.on('data', function(chunk) { + chunks.push(chunk); }); - res.end(JSON.stringify({ - method: req.method, - url: req.url, - headers: req.headers, - })); + req.on('end', function() { + res.writeHead(200, { + 'Content-Type': 'application/json', + }); + res.end(JSON.stringify({ + method: req.method, + url: req.url, + headers: req.headers, + body: Buffer.concat(chunks).toString() + })); + }); }); server.on('error', done); server.listen(3000, function() { done(); }); @@ -36,6 +43,7 @@ .then(function(echo) { assert.equal('GET', echo.method); assert.equal('/foo', echo.url); + assert.equal('', echo.body); assert.equal('overriding headers works thanks to key ordering', 'other stuff', echo.headers['x-fancy']); });
f8339c53d8b89ebb913088be19954ad8d0c44517
src/providers/sh/index.js
src/providers/sh/index.js
module.exports = { title: 'now.sh', subcommands: new Set([ 'login', 'deploy', 'ls', 'list', 'alias', 'scale', 'certs', 'dns', 'domains', 'rm', 'remove', 'whoami', 'secrets', 'logs', 'upgrade', 'teams', 'switch' ]), get deploy() { return require('./deploy') }, get login() { return require('./login') }, get ls() { return require('./commands/bin/list') }, get list() { return require('./commands/bin/list') }, get alias() { return require('./commands/bin/alias') }, get scale() { return require('./commands/bin/scale') }, get certs() { return require('./commands/bin/certs') }, get dns() { return require('./commands/bin/dns') }, get domains() { return require('./commands/bin/domains') }, get rm() { return require('./commands/bin/remove') }, get remove() { return require('./commands/bin/remove') }, get whoami() { return require('./commands/bin/whoami') }, get secrets() { return require('./commands/bin/secrets') }, get logs() { return require('./commands/bin/logs') }, get upgrade() { return require('./commands/bin/upgrade') }, get teams() { return require('./commands/bin/teams') }, get switch() { return require('./commands/bin/teams') } }
const mainCommands = new Set([ 'help', 'list', 'remove', 'alias', 'domains', 'dns', 'certs', 'secrets', 'billing', 'upgrade', 'teams', 'logs', 'scale', 'logout', 'whoami' ]) const aliases = { list: ['ls'], remove: ['rm'], alias: ['ln', 'aliases'], domains: ['domain'], certs: ['cert'], secrets: ['secret'], billing: ['cc'], upgrade: ['downgrade'], teams: ['team', 'switch'], logs: ['log'] } const subcommands = new Set(mainCommands) // Add aliases to available sub commands for (const alias in aliases) { const items = aliases[alias] for (const item of items) { subcommands.add(item) } } const list = { title: 'now.sh', subcommands, get deploy() { return require('./deploy') }, get login() { return require('./login') } } for (const subcommand of mainCommands) { let handlers = [subcommand] if (aliases[subcommand]) { handlers = handlers.concat(aliases[subcommand]) } for (const handler of handlers) { Object.defineProperty(list, handler, { get() { return require(`./commands/bin/${subcommand}`) } }) } } module.exports = list
Support for all aliases added
Support for all aliases added
JavaScript
apache-2.0
zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli
--- +++ @@ -1,73 +1,70 @@ -module.exports = { +const mainCommands = new Set([ + 'help', + 'list', + 'remove', + 'alias', + 'domains', + 'dns', + 'certs', + 'secrets', + 'billing', + 'upgrade', + 'teams', + 'logs', + 'scale', + 'logout', + 'whoami' +]) + +const aliases = { + list: ['ls'], + remove: ['rm'], + alias: ['ln', 'aliases'], + domains: ['domain'], + certs: ['cert'], + secrets: ['secret'], + billing: ['cc'], + upgrade: ['downgrade'], + teams: ['team', 'switch'], + logs: ['log'] +} + +const subcommands = new Set(mainCommands) + +// Add aliases to available sub commands +for (const alias in aliases) { + const items = aliases[alias] + + for (const item of items) { + subcommands.add(item) + } +} + +const list = { title: 'now.sh', - subcommands: new Set([ - 'login', - 'deploy', - 'ls', - 'list', - 'alias', - 'scale', - 'certs', - 'dns', - 'domains', - 'rm', - 'remove', - 'whoami', - 'secrets', - 'logs', - 'upgrade', - 'teams', - 'switch' - ]), + subcommands, get deploy() { return require('./deploy') }, get login() { return require('./login') - }, - get ls() { - return require('./commands/bin/list') - }, - get list() { - return require('./commands/bin/list') - }, - get alias() { - return require('./commands/bin/alias') - }, - get scale() { - return require('./commands/bin/scale') - }, - get certs() { - return require('./commands/bin/certs') - }, - get dns() { - return require('./commands/bin/dns') - }, - get domains() { - return require('./commands/bin/domains') - }, - get rm() { - return require('./commands/bin/remove') - }, - get remove() { - return require('./commands/bin/remove') - }, - get whoami() { - return require('./commands/bin/whoami') - }, - get secrets() { - return require('./commands/bin/secrets') - }, - get logs() { - return require('./commands/bin/logs') - }, - get upgrade() { - return require('./commands/bin/upgrade') - }, - get teams() { - return require('./commands/bin/teams') - }, - get switch() { - return require('./commands/bin/teams') } } + +for (const subcommand of mainCommands) { + let handlers = [subcommand] + + if (aliases[subcommand]) { + handlers = handlers.concat(aliases[subcommand]) + } + + for (const handler of handlers) { + Object.defineProperty(list, handler, { + get() { + return require(`./commands/bin/${subcommand}`) + } + }) + } +} + +module.exports = list
d1709007440080cc4b1ced6dbebe0096164f15fb
model/file.js
model/file.js
'use strict'; var memoize = require('memoizee/plain') , validDb = require('dbjs/valid-dbjs') , defineFile = require('dbjs-ext/object/file') , defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file') , docMimeTypes = require('../utils/microsoft-word-doc-mime-types'); module.exports = memoize(function (db) { var File, JpegFile; validDb(db); File = defineFile(db); File.prototype.url = function () { return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null; }; JpegFile = defineJpegFile(db); File.prototype.defineProperties({ preview: { type: File, value: function () { return this.isPreviewGenerated ? this.generatedPreview : this; } }, isPreviewGenerated: { type: db.Boolean, value: true }, generatedPreview: { type: File, nested: true }, thumb: { type: JpegFile, nested: true } }); File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes); return File; }, { normalizer: require('memoizee/normalizers/get-1')() });
'use strict'; var memoize = require('memoizee/plain') , validDb = require('dbjs/valid-dbjs') , defineFile = require('dbjs-ext/object/file') , defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file') , docMimeTypes = require('../utils/microsoft-word-doc-mime-types'); module.exports = memoize(function (db) { var File, JpegFile; validDb(db); File = defineFile(db); File.prototype.url = function () { return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null; }; JpegFile = defineJpegFile(db); File.prototype.defineProperties({ preview: { type: File, value: function () { return this.isPreviewGenerated ? this.generatedPreview : this; } }, isPreviewGenerated: { type: db.Boolean, value: true }, generatedPreview: { type: File, nested: true }, thumb: { type: JpegFile, nested: true }, toJSON: { value: function (descriptor) { return { kind: 'file', url: this.url, thumbUrl: this.thumb.url }; } }, isEmpty: { value: function (ignore) { return !this.path; } } }); File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes); return File; }, { normalizer: require('memoizee/normalizers/get-1')() });
Add File methods for proper JSON snapshots
Add File methods for proper JSON snapshots
JavaScript
mit
egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations
--- +++ @@ -20,7 +20,11 @@ } }, isPreviewGenerated: { type: db.Boolean, value: true }, generatedPreview: { type: File, nested: true }, - thumb: { type: JpegFile, nested: true } + thumb: { type: JpegFile, nested: true }, + toJSON: { value: function (descriptor) { + return { kind: 'file', url: this.url, thumbUrl: this.thumb.url }; + } }, + isEmpty: { value: function (ignore) { return !this.path; } } }); File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes);
f1c0c236e8b6d3154781c9f30f91b3eae59b60e4
region-score-lead.meta.js
region-score-lead.meta.js
// ==UserScript== // @id iitc-plugin-region-score-lead@hansolo669 // @name IITC plugin: region score lead // @category Tweaks // @version 0.2.3 // @namespace https://github.com/hansolo669/iitc-tweaks // @updateURL https://iitc.reallyawesomedomain.com/region-score-lead.meta.js // @downloadURL https://iitc.reallyawesomedomain.com/region-score-lead.user.js // @description Small modification to the region scores to show the current mu lead. // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* // @match http://www.ingress.com/intel* // @include https://www.ingress.com/mission/* // @include http://www.ingress.com/mission/* // @match https://www.ingress.com/mission/* // @match http://www.ingress.com/mission/* // @grant none // ==/UserScript==
// ==UserScript== // @id iitc-plugin-region-score-lead@hansolo669 // @name IITC plugin: region score lead // @category Tweaks // @version 0.2.4 // @namespace https://github.com/hansolo669/iitc-tweaks // @updateURL https://iitc.reallyawesomedomain.com/region-score-lead.meta.js // @downloadURL https://iitc.reallyawesomedomain.com/region-score-lead.user.js // @description Small modification to the region scores to show the current mu lead. // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* // @match http://www.ingress.com/intel* // @include https://www.ingress.com/mission/* // @include http://www.ingress.com/mission/* // @match https://www.ingress.com/mission/* // @match http://www.ingress.com/mission/* // @grant none // ==/UserScript==
Fix for intel routing changes
Fix for intel routing changes
JavaScript
mit
hansolo669/iitc-tweaks,hansolo669/iitc-tweaks
--- +++ @@ -2,7 +2,7 @@ // @id iitc-plugin-region-score-lead@hansolo669 // @name IITC plugin: region score lead // @category Tweaks -// @version 0.2.3 +// @version 0.2.4 // @namespace https://github.com/hansolo669/iitc-tweaks // @updateURL https://iitc.reallyawesomedomain.com/region-score-lead.meta.js // @downloadURL https://iitc.reallyawesomedomain.com/region-score-lead.user.js
85db50188bcf660bdf83fc09c0c50eed9f0433c4
test/index.js
test/index.js
'use strict'; var assert = require('assert'); var chromedriver = require('chromedriver'); var browser = require('../'); chromedriver.start(); browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('20s'); after(function () { chromedriver.stop(); }); var getHeadingText = browser.async(function* (browser) { var heading = yield browser.elementByTagName('h1').text(); return heading; }); describe('www.example.com', function () { it('Has a header that reads "Example Domain"', browser(function* (browser) { yield browser.get('http://www.example.com'); var heading = yield getHeadingText(browser); assert(heading.trim() == 'Example Domain'); })); });
'use strict'; var assert = require('assert'); var chromedriver = require('chromedriver'); var browser = require('../'); var LOCAL = !process.env.CI; if (LOCAL) { chromedriver.start(); browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('5s'); after(function () { chromedriver.stop(); }); } else { browser.remote('ondemand.saucelabs.com', 80, 'sauce-runner', 'c71a5c75-7c28-483f-9053-56da13b40bc2').timeout('240s').operationTimeout('30s'); } var getHeadingText = browser.async(function* (browser) { var heading = yield browser.elementByTagName('h1').text(); return heading; }); describe('www.example.com', function () { it('Has a header that reads "Example Domain"', browser(function* (browser) { console.log('getting url'); yield browser.get('http://www.example.com'); console.log('getting heading text'); var heading = yield getHeadingText(browser); console.log('checking heading text'); assert(heading.trim() == 'Example Domain'); })); });
Support CI using sauce labs
Support CI using sauce labs
JavaScript
mit
ForbesLindesay/selenium-mocha
--- +++ @@ -4,11 +4,17 @@ var chromedriver = require('chromedriver'); var browser = require('../'); -chromedriver.start(); -browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('20s'); -after(function () { - chromedriver.stop(); -}); +var LOCAL = !process.env.CI; + +if (LOCAL) { + chromedriver.start(); + browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('5s'); + after(function () { + chromedriver.stop(); + }); +} else { + browser.remote('ondemand.saucelabs.com', 80, 'sauce-runner', 'c71a5c75-7c28-483f-9053-56da13b40bc2').timeout('240s').operationTimeout('30s'); +} var getHeadingText = browser.async(function* (browser) { var heading = yield browser.elementByTagName('h1').text(); @@ -17,8 +23,11 @@ describe('www.example.com', function () { it('Has a header that reads "Example Domain"', browser(function* (browser) { + console.log('getting url'); yield browser.get('http://www.example.com'); + console.log('getting heading text'); var heading = yield getHeadingText(browser); + console.log('checking heading text'); assert(heading.trim() == 'Example Domain'); })); });
67ad246f902b2c04a426d16d5fe877ffa1fee5d0
tests/integration/angular-meteor-session-spec.js
tests/integration/angular-meteor-session-spec.js
describe('$meteorSession service', function () { var $meteorSession, $rootScope, $scope; beforeEach(angular.mock.module('angular-meteor')); beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) { $meteorSession = _$meteorSession_; $rootScope = _$rootScope_; $scope = $rootScope.$new(); })); it('should update the scope variable when session variable changes', function () { Session.set('myVar', 3); $meteorSession('myVar').bind($scope, 'myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.myVar).toEqual(4); }); it('should update the session variable when the scope variable changes', function() { $scope.myVar = 3; $meteorSession('myVar').bind($scope, 'myVar'); $scope.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); });
describe('$meteorSession service', function () { var $meteorSession, $rootScope, $scope; beforeEach(angular.mock.module('angular-meteor')); beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) { $meteorSession = _$meteorSession_; $rootScope = _$rootScope_; $scope = $rootScope.$new(); })); it('should update the scope variable when session variable changes', function () { Session.set('myVar', 3); $meteorSession('myVar').bind($scope, 'myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.myVar).toEqual(4); }); it('should update the session variable when the scope variable changes', function() { $scope.myVar = 3; $meteorSession('myVar').bind($scope, 'myVar'); $scope.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); it('should update the scope variable nested property when session variable changes', function () { Session.set('myVar', 3); $scope.a ={ b:{ myVar: 3 } }; $meteorSession('myVar').bind($scope, 'a.b.myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.a.b.myVar).toEqual(4); }); it('should update the session variable when the scope variable nested property changes', function() { $scope.a ={ b:{ myVar: 3 } }; $meteorSession('myVar').bind($scope, 'a.b.myVar'); $scope.a.b.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); });
Add test for $meteorSession service to support scope variable nested property
Add test for $meteorSession service to support scope variable nested property
JavaScript
mit
IgorMinar/angular-meteor,omer72/angular-meteor,IgorMinar/angular-meteor,zhoulvming/angular-meteor,dszczyt/angular-meteor,craigmcdonald/angular-meteor,divramod/angular-meteor,aleksander351/angular-meteor,thomkaufmann/angular-meteor,Urigo/angular-meteor,Unavi/angular-meteor,manhtuongbkhn/angular-meteor,dszczyt/angular-meteor,michelalbers/angular-meteor,dj0nes/angular-meteor,kamilkisiela/angular-meteor,kyroskoh/angular-meteor,DAB0mB/angular-meteor,pbastowski/angular-meteor,aleksander351/angular-meteor,ccortezia/angular-meteor,idanwe/angular-meteor,efosao12/angular-meteor,gonengar/angular-meteor,dszczyt/angular-meteor,DAB0mB/angular-meteor,okland/angular-meteor,kyroskoh/angular-meteor,Wanderfalke/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,DAB0mB/angular-meteor,ccortezia/angular-meteor,okland/angular-meteor,mauricionr/angular-meteor,michelalbers/angular-meteor,dszczyt/angular-meteor,Tallyb/angular-meteor,omer72/angular-meteor,klenis/angular-meteor,barbatus/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,pbastowski/angular-meteor,barbatus/angular-meteor,ahmedshuhel/angular-meteor,thomkaufmann/angular-meteor,okland/angular-meteor,omer72/angular-meteor,MarkPhillips7/angular-meteor,simonv3/angular-meteor,divramod/angular-meteor,gonengar/angular-meteor,Unavi/angular-meteor,sebakerckhof/angular-meteor,michelalbers/angular-meteor,cuitianze/angular-meteor,ShMcK/angular-meteor,tgienger/angular-meteor,kyroskoh/angular-meteor,ahmedshuhel/angular-meteor,zhoulvming/angular-meteor,tgienger/angular-meteor,evanliomain/angular-meteor,alexandr2110pro/angular-meteor,nhducit/angular-meteor,efosao12/angular-meteor,ajbarry/angular-meteor,Unavi/angular-meteor,ahmedshuhel/angular-meteor,davidyaha/angular-meteor,mauricionr/angular-meteor,cuitianze/angular-meteor,dtruel/angular-meteor,idanwe/angular-meteor,evanliomain/angular-meteor,manhtuongbkhn/angular-meteor,gonengar/angular-meteor,gonengar/angular-meteor,efosao12/angular-meteor,mauricionr/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,zhoulvming/angular-meteor,IgorMinar/angular-meteor,klenis/angular-meteor,dj0nes/angular-meteor,evanliomain/angular-meteor,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,jonmc12/angular-meteor,alexandr2110pro/angular-meteor,ShMcK/angular-meteor,ahmedshuhel/angular-meteor,revspringjake/angular-meteor-tutorial,ajbarry/angular-meteor,craigmcdonald/angular-meteor,Urigo/angular-meteor-legacy,efosao12/angular-meteor,pbastowski/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,jonmc12/angular-meteor,Wanderfalke/angular-meteor,sebakerckhof/angular-meteor,zhoulvming/angular-meteor,kyroskoh/angular-meteor,evanliomain/angular-meteor,Wanderfalke/angular-meteor,revspringjake/angular-meteor-tutorial,nhducit/angular-meteor,michelalbers/angular-meteor,kamilkisiela/angular-meteor,divramod/angular-meteor,jonmc12/angular-meteor,barbatus/angular-meteor,dtruel/angular-meteor,mauricionr/angular-meteor,sebakerckhof/angular-meteor,okland/angular-meteor,kamilkisiela/angular-meteor,omer72/angular-meteor,simonv3/angular-meteor,mushkab/angular-meteor,mushkab/angular-meteor,Tallyb/angular-meteor,nhducit/angular-meteor,aleksander351/angular-meteor,tgienger/angular-meteor,tgienger/angular-meteor,pbastowski/angular-meteor,jonmc12/angular-meteor,Unavi/angular-meteor,dtruel/angular-meteor,alexandr2110pro/angular-meteor,mushkab/angular-meteor,darkbasic/angular-meteor,klenis/angular-meteor,divramod/angular-meteor,mushkab/angular-meteor,dj0nes/angular-meteor,alexandr2110pro/angular-meteor,dj0nes/angular-meteor,ajbarry/angular-meteor,nhducit/angular-meteor,thomkaufmann/angular-meteor,dtruel/angular-meteor,Wanderfalke/angular-meteor,klenis/angular-meteor,IgorMinar/angular-meteor,aleksander351/angular-meteor,ajbarry/angular-meteor,thomkaufmann/angular-meteor,MarkPhillips7/angular-meteor
--- +++ @@ -30,4 +30,35 @@ expect(Session.get('myVar')).toEqual(4); }); + + + it('should update the scope variable nested property when session variable changes', function () { + Session.set('myVar', 3); + $scope.a ={ + b:{ + myVar: 3 + } + }; + + $meteorSession('myVar').bind($scope, 'a.b.myVar'); + + Session.set('myVar', 4); + Tracker.flush(); // get the computations to run + + expect($scope.a.b.myVar).toEqual(4); + }); + + it('should update the session variable when the scope variable nested property changes', function() { + $scope.a ={ + b:{ + myVar: 3 + } + }; + $meteorSession('myVar').bind($scope, 'a.b.myVar'); + + $scope.a.b.myVar = 4; + $rootScope.$apply(); + + expect(Session.get('myVar')).toEqual(4); + }); });
67567c4809789b1896b470c621085125450cf845
src/renderer/ui/components/generic/PlatformSpecific.js
src/renderer/ui/components/generic/PlatformSpecific.js
import { Component, PropTypes } from 'react'; import os from 'os'; import semver from 'semver'; export const semverValidator = (props, propName, componentName) => { if (props[propName]) { return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`); } return null; }; export default class PlatformSpecific extends Component { static propTypes = { children: PropTypes.object, platform: PropTypes.string.isRequired, versionRange: semverValidator, }; render() { if (process.platform === this.props.platform) { if (!this.props.versionRange) return this.props.children; if (semver.validRange(this.props.versionRange) && semver.satisfies(os.release(), this.props.versionRange)) { return this.props.children; } } return null; } }
import { Component, PropTypes } from 'react'; import os from 'os'; import semver from 'semver'; const parsedOSVersion = semver.parse(os.release()); const osVersion = `${parsedOSVersion.major}.${parsedOSVersion.minor}.${parsedOSVersion.patch}`; export const semverValidator = (props, propName, componentName) => { if (props[propName]) { return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`); } return null; }; export default class PlatformSpecific extends Component { static propTypes = { children: PropTypes.object, platform: PropTypes.string.isRequired, versionRange: semverValidator, }; render() { if (process.platform === this.props.platform) { if (!this.props.versionRange) return this.props.children; if (semver.validRange(this.props.versionRange) && semver.satisfies(osVersion, this.props.versionRange)) { return this.props.children; } } return null; } }
Fix version tests on linux
Fix version tests on linux
JavaScript
mit
petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-
--- +++ @@ -1,6 +1,9 @@ import { Component, PropTypes } from 'react'; import os from 'os'; import semver from 'semver'; + +const parsedOSVersion = semver.parse(os.release()); +const osVersion = `${parsedOSVersion.major}.${parsedOSVersion.minor}.${parsedOSVersion.patch}`; export const semverValidator = (props, propName, componentName) => { if (props[propName]) { @@ -20,7 +23,7 @@ if (process.platform === this.props.platform) { if (!this.props.versionRange) return this.props.children; - if (semver.validRange(this.props.versionRange) && semver.satisfies(os.release(), this.props.versionRange)) { + if (semver.validRange(this.props.versionRange) && semver.satisfies(osVersion, this.props.versionRange)) { return this.props.children; } }
0aad07073773a20898d950c649a7fa74b22497fc
Emix.Web/ngApp/emixApp.js
Emix.Web/ngApp/emixApp.js
angular.module('emixApp', ['ngRoute', 'emixApp.controllers', 'emixApp.directives', 'emixApp.services', 'mgcrea.ngStrap', 'ngMorris', //'ngGoogleMap' 'pascalprecht.translate' ]) .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/dashboard', { controller: 'dashboard_index', templateUrl: 'ngApp/pages/dashboard/index.html' }) .when('/section', { controller: 'section_index', templateUrl: 'ngApp/pages/section/index.html' }) .otherwise({ redirectTo: '/dashboard' }); }]) .config(['$translateProvider', function ($translateProvider) { $translateProvider.useStaticFilesLoader({ prefix: Emix.Web.translationsFolder, suffix: '.json' }); $translateProvider.preferredLanguage('it_IT'); $translateProvider.storageKey('lang'); $translateProvider.storagePrefix('emix'); // $translateProvider.useLocalStorage(); }]); angular.module('emixApp.services', []); angular.module('emixApp.controllers', []); angular.module('emixApp.directives', []);
angular.module('emixApp', ['ngRoute', 'ngCookies', 'emixApp.controllers', 'emixApp.directives', 'emixApp.services', 'mgcrea.ngStrap', 'ngMorris', 'pascalprecht.translate' ]) .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/dashboard', { controller: 'dashboard_index', templateUrl: 'ngApp/pages/dashboard/index.html' }) .when('/section', { controller: 'section_index', templateUrl: 'ngApp/pages/section/index.html' }) .otherwise({ redirectTo: '/dashboard' }); }]) .config(['$translateProvider', function ($translateProvider) { $translateProvider.useStaticFilesLoader({ prefix: Emix.Web.translationsFolder, suffix: '.json' }); $translateProvider.preferredLanguage('it_IT'); $translateProvider.storageKey('lang'); $translateProvider.storagePrefix('emix'); $translateProvider.useLocalStorage(); }]); angular.module('emixApp.services', []); angular.module('emixApp.controllers', []); angular.module('emixApp.directives', []);
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
JavaScript
mit
sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed
--- +++ @@ -1,11 +1,11 @@ angular.module('emixApp', ['ngRoute', + 'ngCookies', 'emixApp.controllers', 'emixApp.directives', 'emixApp.services', 'mgcrea.ngStrap', 'ngMorris', - //'ngGoogleMap' 'pascalprecht.translate' ]) .config(['$routeProvider', function ($routeProvider) { @@ -35,8 +35,7 @@ $translateProvider.storageKey('lang'); $translateProvider.storagePrefix('emix'); - - // $translateProvider.useLocalStorage(); + $translateProvider.useLocalStorage(); }]); angular.module('emixApp.services', []);
e42f8f09fa04b1893a96479e004f06fa964efc67
test/assets/javascripts/specs/login-controller-spec.js
test/assets/javascripts/specs/login-controller-spec.js
'use strict'; describe('Login controller', function () { var scope; var loginCtrl; var $httpBackend; beforeEach(module('todo.controllers')); beforeEach(inject(function(_$httpBackend_, $controller, $rootScope) { $httpBackend = _$httpBackend_; scope = $rootScope.$new(); loginCtrl = $controller('LandingCtrl', { $scope: scope }); })); it('should submit the user credentials', inject(function($location, $rootScope) { $httpBackend.expectPOST('/login', {username: 'testuser', password: 'secret'}).respond(200, {username: 'testuser'}); scope.formData.username = 'testuser'; scope.formData.password = 'secret'; scope.setUsername(); $httpBackend.flush(); expect($rootScope.login.username).toBe('testuser'); expect($location.url()).toBe('/tasks'); })); });
'use strict'; describe('Login controller', function () { var scope; var loginCtrl; var $httpBackend; beforeEach(module('todo.controllers')); beforeEach(inject(function (_$httpBackend_, $controller, $rootScope) { $httpBackend = _$httpBackend_; scope = $rootScope.$new(); loginCtrl = $controller('LandingCtrl', { $scope: scope }); })); it('should submit the user credentials', inject(function ($location, $rootScope) { $httpBackend.expectPOST('/users/authenticate/userpass', {username: 'testuser', password: 'secret'}) .respond(200, {username: 'testuser'}); scope.formData.username = 'testuser'; scope.formData.password = 'secret'; scope.setUsername(); $httpBackend.flush(); expect($rootScope.login.username).toBe('testuser'); expect($location.url()).toBe('/tasks'); })); });
Fix login JS test to use SecureSocial endpoint.
Fix login JS test to use SecureSocial endpoint.
JavaScript
mit
timothygordon32/reactive-todolist,timothygordon32/reactive-todolist
--- +++ @@ -7,7 +7,7 @@ beforeEach(module('todo.controllers')); - beforeEach(inject(function(_$httpBackend_, $controller, $rootScope) { + beforeEach(inject(function (_$httpBackend_, $controller, $rootScope) { $httpBackend = _$httpBackend_; scope = $rootScope.$new(); @@ -16,8 +16,10 @@ }); })); - it('should submit the user credentials', inject(function($location, $rootScope) { - $httpBackend.expectPOST('/login', {username: 'testuser', password: 'secret'}).respond(200, {username: 'testuser'}); + it('should submit the user credentials', inject(function ($location, $rootScope) { + $httpBackend.expectPOST('/users/authenticate/userpass', + {username: 'testuser', password: 'secret'}) + .respond(200, {username: 'testuser'}); scope.formData.username = 'testuser'; scope.formData.password = 'secret';
62f676d0f493689dc877b12f9067c32179d81788
app/events/routes.js
app/events/routes.js
var eventSource = require('express-eventsource'), logger = require('radiodan-client').utils.logger('event-routes'); module.exports = function (app, eventBus, services) { var eventStream = eventSource(); // Shared eventsource // To send data call: eventStream.send(dataObj, 'eventName'); app.use('/', eventStream.middleware()); ['nowAndNext', 'nowPlaying', 'liveText'].forEach(function (topic) { services.events.on('*.' + topic, createMessageEmitter(topic)); }); function createMessageEmitter(topic) { return function (data, metadata) { eventStream.send({ topic: topic, serviceId: metadata.serviceId, data: data }); }; } ['settings.*', 'service.changed', 'power', 'exit', 'shutdown'].forEach(function (topic) { eventBus.on(topic, function (args) { if (args && args.length === 1) { args = args[0]; } eventStream.send({ topic: this.event, data: args }); }); }); return app; };
var eventSource = require('express-eventsource'), logger = require('radiodan-client').utils.logger('event-routes'); module.exports = function (app, eventBus, services) { var eventStream = eventSource(); // Shared eventsource // To send data call: eventStream.send(dataObj, 'eventName'); app.use('/', eventStream.middleware()); ['nowAndNext', 'nowPlaying', 'liveText'].forEach(function (topic) { services.events.on('*.' + topic, createMessageEmitter(topic)); }); function createMessageEmitter(topic) { return function (data, metadata) { eventStream.send({ topic: topic, serviceId: metadata.serviceId, data: data }); }; } ['settings.*', 'service.changed', 'power', 'exit', 'shutdown', 'audio'].forEach(function (topic) { eventBus.on(topic, function (args) { if (args && args.length === 1) { args = args[0]; } eventStream.send({ topic: this.event, data: args }); }); }); return app; };
Fix bug where volume changes not emitted to client through event stream
Fix bug where volume changes not emitted to client through event stream
JavaScript
apache-2.0
radiodan/magic-button,radiodan/magic-button
--- +++ @@ -18,7 +18,7 @@ }; } - ['settings.*', 'service.changed', 'power', 'exit', 'shutdown'].forEach(function (topic) { + ['settings.*', 'service.changed', 'power', 'exit', 'shutdown', 'audio'].forEach(function (topic) { eventBus.on(topic, function (args) { if (args && args.length === 1) { args = args[0];
78b046830969751e89f34683938a58154ec4ce1f
public/script/project.js
public/script/project.js
function sortProject(changeEvent) { var data = {}; // Get old and new index from event data.oldIndex = changeEvent.oldIndex; data.newIndex = changeEvent.newIndex; // Get filters data.filters = {}; data.filters = getCurrentFilters(); // Get project id from event item data.projectId = $(changeEvent.item).children('input.cb-completed').val(); console.log(data); // Make AJAX call to sort // TODO: Function to match index with task // TODO: Function to update sequences on update // TODO: make this queue-able }
function sortProject(changeEvent) { var data = {}; // Get old and new index from event data.oldIndex = changeEvent.oldIndex; data.newIndex = changeEvent.newIndex; // Get filters data.filters = {}; data.filters = getCurrentFilters(); // Get project id from event item data.projectId = $(changeEvent.item).children('input.cb-completed').val(); console.log(data); // Make AJAX call to sort // TODO: Function to match index with task // TODO: Function to update sequences on update // TODO: make this queue-able }
Clean up unfinished work + conflict
Clean up unfinished work + conflict
JavaScript
mit
BBBThunda/projectify,BBBThunda/projectify,BBBThunda/projectify
--- +++ @@ -21,5 +21,5 @@ // TODO: Function to update sequences on update // TODO: make this queue-able + } -
05975f56e6561e789dfb8fedaf4954cc751c787c
src/common.js
src/common.js
function findByIds(items, ids) { return ids .map((id) => { return items.find((item) => item.id === id) }) .filter((item) => item) } function findOneById(items, id) { return items.find((item) => item.id === id) } function findOneByAliases(items, aliases) { if (Array.isArray(aliases)) { return items.find((item) => { let { name, alias } = item return aliases.find((n) => n === name || (alias && alias.includes(n))) }) } return items.find((item) => { return item.name === aliases || (item.alias && item.alias.includes(aliases)) }) } module.exports = { findByIds, findOneById, findOneByAliases, }
function findByIds(items, ids) { return ids .map((id) => { return items.find((item) => item.id === id) }) .filter((item) => item) } function findOneById(items, id) { return items.find((item) => item.id === id) } function findOneByAliases(items, aliases) { if (Array.isArray(aliases)) { return items.find((item) => { let { name, alias } = item return aliases.find((n) => n === name || (alias && alias.includes(n))) }) } return items.find((item) => { return item.name === aliases || (item.alias && item.alias.includes(aliases)) }) } function findOneByName(items, field, name) { if (arguments.length === 2) { return findOneByAliases(items, field) } else if (typeof name === 'string') { return findOneByAliases(items, name) } let result for (let i = 0; i < name.length && items.length; i++) { result = findOneByName(items, name[i]) if (result) { items = findByIds(items, result[field]) } } return result } module.exports = { findByIds, findOneById, findOneByAliases, findOneByName, }
Add findOneByName for usage with nested names
Add findOneByName for usage with nested names
JavaScript
isc
alex-shnayder/comanche
--- +++ @@ -23,6 +23,26 @@ }) } +function findOneByName(items, field, name) { + if (arguments.length === 2) { + return findOneByAliases(items, field) + } else if (typeof name === 'string') { + return findOneByAliases(items, name) + } + + let result + + for (let i = 0; i < name.length && items.length; i++) { + result = findOneByName(items, name[i]) + + if (result) { + items = findByIds(items, result[field]) + } + } + + return result +} + module.exports = { - findByIds, findOneById, findOneByAliases, + findByIds, findOneById, findOneByAliases, findOneByName, }
10c8e31cfd598b8f736ba7cdc9d280b607b30042
src/config.js
src/config.js
import * as FrontendPrefsOptions from './utils/frontend-preferences-options'; const config = { api:{ host: 'http://localhost:3000', sentinel: null // keep always last }, auth: { cookieDomain: 'localhost', tokenPrefix: 'freefeed_', userStorageKey: 'USER_KEY', sentinel: null // keep always last }, captcha: { siteKey: '', sentinel: null // keep always last }, search: { searchEngine: null, sentinel: null // keep always last }, siteDomains: [ // for transform links in the posts, comments, etc. 'freefeed.net', 'gamma.freefeed.net' ], sentry: { publicDSN: null, sentinel: null // keep always last }, frontendPreferences: { clientId: 'net.freefeed', defaultValues: { displayNames: { displayOption: FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME, useYou: true }, realtimeActive: false, comments: { omitRepeatedBubbles: true, highlightComments: true, hiddenTypes: [] }, allowLinksPreview: false, readMoreStyle: 'modern', homefeed: { hideUsers: [] } } } }; export default config;
import * as FrontendPrefsOptions from './utils/frontend-preferences-options'; const config = { api:{ host: 'http://localhost:3000', sentinel: null // keep always last }, auth: { cookieDomain: 'localhost', tokenPrefix: 'freefeed_', userStorageKey: 'USER_KEY', sentinel: null // keep always last }, captcha: { siteKey: '', sentinel: null // keep always last }, search: { searchEngine: null, sentinel: null // keep always last }, siteDomains: [ // for transform links in the posts, comments, etc. 'freefeed.net', 'gamma.freefeed.net' ], sentry: { publicDSN: null, sentinel: null // keep always last }, frontendPreferences: { clientId: 'net.freefeed', defaultValues: { displayNames: { displayOption: FrontendPrefsOptions.DISPLAYNAMES_BOTH, useYou: true }, realtimeActive: false, comments: { omitRepeatedBubbles: true, highlightComments: true, hiddenTypes: [] }, allowLinksPreview: false, readMoreStyle: 'modern', homefeed: { hideUsers: [] } } } }; export default config;
Change default value of displayname setting
Change default value of displayname setting New default is: "Display name + username"
JavaScript
mit
davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client
--- +++ @@ -31,7 +31,7 @@ clientId: 'net.freefeed', defaultValues: { displayNames: { - displayOption: FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME, + displayOption: FrontendPrefsOptions.DISPLAYNAMES_BOTH, useYou: true }, realtimeActive: false,
6d22dabca3b69a06fb8f3fdc11469b6da7641bfd
src/config.js
src/config.js
// = Server config ============================================================= export const port = 3000 export const enableGraphiQL = true; export const logFile = 'store.log' // = App config ================================================================
// = Server config ============================================================= export const port = process.env.PORT || 3000 export const enableGraphiQL = true; export const logFile = 'store.log' // = App config ================================================================
Add ability to define port as environment variable
Add ability to define port as environment variable
JavaScript
mit
jukkah/comicstor
--- +++ @@ -1,6 +1,6 @@ // = Server config ============================================================= -export const port = 3000 +export const port = process.env.PORT || 3000 export const enableGraphiQL = true;
30f2923409e548ccc4626278509ae158bae6d5e0
web_clients/javascript_mvc/www/js/test/test-main.js
web_clients/javascript_mvc/www/js/test/test-main.js
var allTestFiles = []; var TEST_REGEXP = /_test\.js$/i; var pathToModule = function(path) { return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); }; Object.keys(window.__karma__.files).forEach(function(file) { if (TEST_REGEXP.test(file)) { // Normalize paths to RequireJS module names. allTestFiles.push(pathToModule(file)); } }); require.config({ baseUrl: '/base/js/vendor', paths: { jquery: 'jquery/jquery-2.1.1.min', squire: 'squire/Squire', client: '../client' } }); // Kick off Jasmine // NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. require( allTestFiles, window.__karma__.start );
(function() { 'use strict'; var test_files, coverage_files; function pathToModule(path) { return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); }; // Configure require's paths require.config({ baseUrl: '/base/js/vendor', paths: { jquery: 'jquery/jquery-2.1.1.min', squire: 'squire/Squire', client: '../client' } }); // Ensure all client files are included for code coverage coverage_files = []; Object.keys(window.__karma__.files).forEach(function(file) { var regex; // Only pick up client files regex = /^\/base\/js\/client\//; if( !regex.test(file) ) { return; } // Don't pick up main.js - we only want the modules, not to actually start anything up. if( file === '/base/js/client/main.js' ) { return; } // Convert to a require path coverage_files.push(pathToModule(file)); }); // Actually get coverage to see the files require(coverage_files, function() {}); // Find all test files to run in Jasmine test_files = []; Object.keys(window.__karma__.files).forEach(function(file) { var regex; regex = /_test\.js$/i; if (regex.test(file)) { // Normalize paths to RequireJS module names. test_files.push(pathToModule(file)); } }); // Kick off Jasmine // NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. require( test_files, window.__karma__.start ); })();
Include all client files for coverage reporting
Include all client files for coverage reporting Also: clean up test-main a bit from its original copypasta.
JavaScript
mit
xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz
--- +++ @@ -1,27 +1,62 @@ -var allTestFiles = []; -var TEST_REGEXP = /_test\.js$/i; +(function() { + 'use strict'; -var pathToModule = function(path) { - return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); -}; + var test_files, coverage_files; -Object.keys(window.__karma__.files).forEach(function(file) { - if (TEST_REGEXP.test(file)) { - // Normalize paths to RequireJS module names. - allTestFiles.push(pathToModule(file)); - } -}); + function pathToModule(path) { + return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); + }; -require.config({ - baseUrl: '/base/js/vendor', + // Configure require's paths + require.config({ + baseUrl: '/base/js/vendor', - paths: { - jquery: 'jquery/jquery-2.1.1.min', - squire: 'squire/Squire', - client: '../client' - } -}); + paths: { + jquery: 'jquery/jquery-2.1.1.min', + squire: 'squire/Squire', + client: '../client' + } + }); -// Kick off Jasmine -// NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. -require( allTestFiles, window.__karma__.start ); + // Ensure all client files are included for code coverage + coverage_files = []; + Object.keys(window.__karma__.files).forEach(function(file) { + var regex; + + // Only pick up client files + regex = /^\/base\/js\/client\//; + if( !regex.test(file) ) { + return; + } + + // Don't pick up main.js - we only want the modules, not to actually start anything up. + if( file === '/base/js/client/main.js' ) { + return; + } + + // Convert to a require path + coverage_files.push(pathToModule(file)); + }); + + // Actually get coverage to see the files + require(coverage_files, function() {}); + + + // Find all test files to run in Jasmine + test_files = []; + + Object.keys(window.__karma__.files).forEach(function(file) { + var regex; + + regex = /_test\.js$/i; + if (regex.test(file)) { + // Normalize paths to RequireJS module names. + test_files.push(pathToModule(file)); + } + }); + + // Kick off Jasmine + // NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. + require( test_files, window.__karma__.start ); + +})();
32c4655b62a4edf005b4233ad8b0ce8718c10537
client/templates/admin/posts/posts.js
client/templates/admin/posts/posts.js
Template.add_post.events({ 'submit .add_post_form': function(){ var title = event.target.title.value; var body - event.target.body.value; // Insert the post Posts.insert({ title: title, body: body }); FlashMessages.sendSucess('Post has been successfully added!'); Router.go('/admin/posts'); // Prevent submit return false; } });
Save post after submit the form
Save post after submit the form
JavaScript
mit
pH-7/pH7Ortfolio,pH-7/pH7Ortfolio
--- +++ @@ -0,0 +1,18 @@ +Template.add_post.events({ + 'submit .add_post_form': function(){ + var title = event.target.title.value; + var body - event.target.body.value; + + // Insert the post + Posts.insert({ + title: title, + body: body + }); + + FlashMessages.sendSucess('Post has been successfully added!'); + Router.go('/admin/posts'); + + // Prevent submit + return false; + } +});
637d929936c13fb6e5cb96630200df02f615b0a3
client/templates/register/register.js
client/templates/register/register.js
Template.register.rendered = function () { /* * Reset form select field values * to prevent an edge case bug for code push * where accommodations value was undefined */ $('#age').val(''); $('#registration_type').val(''); $('#accommodations').val(''); $('#carbon-tax').val(''); }; Template.register.helpers({ 'price': function () { /* * Get the dynamically calculated registration fee. */ //Set the registration object // from current registration details. try { var registration = { ageGroup: ageGroupVar.get(), type: registrationTypeVar.get(), accommodations: accommodationsVar.get(), days: daysVar.get(), firstTimeAttender: firstTimeAttenderVar.get(), linens: linensVar.get(), createdAt: new Date(), carbonTax: carbonTaxVar.get() }; } catch (error) { console.log(error.message); } // Calculate the price try { var registrationPrice = calculateRegistrationPrice(registration); } catch (error) { console.log(error.message); } return registrationPrice; } }); Template.register.events({ 'change form': function () { // Make sure all reactive vars are up to date. setReactiveVars(); }, 'keyup #carbon-tax': function () { setReactiveVars(); } });
Template.register.rendered = function () { /* * Reset form select field values * to prevent an edge case bug for code push * where accommodations value was undefined */ $('#age').val(''); $('#registration_type').val(''); $('#accommodations').val(''); $('#carbon-tax').val(''); }; Template.register.helpers({ 'price': function () { /* * Get the dynamically calculated registration fee. */ //Set the registration object // from current registration details. try { var registration = { ageGroup: ageGroupVar.get(), type: registrationTypeVar.get(), accommodations: accommodationsVar.get(), days: daysVar.get(), firstTimeAttender: firstTimeAttenderVar.get(), linens: linensVar.get(), createdAt: new Date(), carbonTax: carbonTaxVar.get(), donation: donationVar.get() }; } catch (error) { console.log(error.message); } // Calculate the price try { var registrationPrice = calculateRegistrationPrice(registration); } catch (error) { console.log(error.message); } return registrationPrice; } }); Template.register.events({ 'change form': function () { // Make sure all reactive vars are up to date. setReactiveVars(); }, 'keyup #carbon-tax': function () { setReactiveVars(); } });
Add donation field to calculation
Add donation field to calculation
JavaScript
agpl-3.0
quaker-io/pym-2015,quaker-io/pym-online-registration,quaker-io/pym-online-registration,quaker-io/pym-2015
--- +++ @@ -28,7 +28,8 @@ firstTimeAttender: firstTimeAttenderVar.get(), linens: linensVar.get(), createdAt: new Date(), - carbonTax: carbonTaxVar.get() + carbonTax: carbonTaxVar.get(), + donation: donationVar.get() }; } catch (error) { console.log(error.message);
0a0d0c90aab2d5cb50e67e11cac747342eda27ed
grunt/tasks/_browserify-bundles.js
grunt/tasks/_browserify-bundles.js
module.exports = { 'src-specs': { src: [ 'test/fail-tests-if-have-errors-in-src.js', 'test/spec/api/**/*', 'test/spec/core/**/*', 'test/spec/dataviews/**/*', 'test/spec/util/**/*', 'test/spec/geo/**/*', 'test/spec/ui/**/*', 'test/spec/vis/**/*', 'test/spec/windshaft/**/*', 'test/spec/windshaft-integration/**/*', 'test/spec/analysis/**/*', 'test/spec/engine.spec.js', // not actually used anywhere in cartodb.js, only for editor? // TODO can be (re)moved? '!test/spec/ui/common/tabpane.spec.js' ], dest: '<%= config.tmp %>/src-specs.js' }, cartodb: { src: 'src/cartodb.js', exclude: [ 'src/api/v4/' ], dest: '<%= config.dist %>/internal/cartodb.uncompressed.js' }, 'carto-public': { src: 'src/api/v4/index.js', dest: '<%= config.dist %>/public/carto.uncompressed.js', options: { external: [ 'leaflet' ] } } };
module.exports = { 'src-specs': { src: [ 'test/fail-tests-if-have-errors-in-src.js', 'test/spec/api/**/*', 'test/spec/core/**/*', 'test/spec/dataviews/**/*', 'test/spec/util/**/*', 'test/spec/geo/**/*', 'test/spec/ui/**/*', 'test/spec/vis/**/*', 'test/spec/windshaft/**/*', 'test/spec/windshaft-integration/**/*', 'test/spec/analysis/**/*', 'test/spec/engine.spec.js', // not actually used anywhere in cartodb.js, only for editor? // TODO can be (re)moved? '!test/spec/ui/common/tabpane.spec.js' ], dest: '<%= config.tmp %>/src-specs.js' }, cartodb: { src: 'src/cartodb.js', exclude: [ 'src/api/v4/' ], dest: '<%= config.dist %>/internal/cartodb.uncompressed.js' }, 'carto-public': { src: [ 'src/api/v4/index.js', 'node_modules/camshaft-reference/versions/0.59.4/reference.json' ], dest: '<%= config.dist %>/public/carto.uncompressed.js', options: { external: [ 'leaflet' ] } } };
Add latest camshaft reference in the bundle
Add latest camshaft reference in the bundle
JavaScript
bsd-3-clause
splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js
--- +++ @@ -30,7 +30,10 @@ }, 'carto-public': { - src: 'src/api/v4/index.js', + src: [ + 'src/api/v4/index.js', + 'node_modules/camshaft-reference/versions/0.59.4/reference.json' + ], dest: '<%= config.dist %>/public/carto.uncompressed.js', options: { external: [ 'leaflet' ]
791d07b503940051c19fc11187c67859c299b252
src/patterns/autosubmit.js
src/patterns/autosubmit.js
define([ '../jquery/autosubmit' ], function(require) { var autosubmit = { initContent: function(root) { $("[data-autosubmit]", root) .find("input[type-search]").andSelf() .patternAutosubmit(); } }; return autosubmit; }); // jshint indent: 4, browser: true, jquery: true, quotmark: double // vim: sw=4 expandtab
define([ '../jquery/autosubmit' ], function() { var autosubmit = { initContent: function(root) { $("[data-autosubmit]", root) .find("input[type-search]").andSelf() .patternAutosubmit(); } }; return autosubmit; }); // jshint indent: 4, browser: true, jquery: true, quotmark: double // vim: sw=4 expandtab
Fix error in define call
Fix error in define call
JavaScript
bsd-3-clause
Patternslib/require-experimental-build,Patternslib/Patterns-archive,Patternslib/Patterns-archive,Patternslib/Patterns-archive
--- +++ @@ -1,6 +1,6 @@ define([ '../jquery/autosubmit' -], function(require) { +], function() { var autosubmit = { initContent: function(root) { $("[data-autosubmit]", root)
84e2ef62b1faff132d69ad3384be68fb364d86c9
src/string.js
src/string.js
// ================================================================================================= // Core.js | String Functions // (c) 2014 Mathigon / Philipp Legner // ================================================================================================= (function() { M.extend(String.prototype, { endsWith: function(search) { var end = this.length; var start = end - search.length; return (this.substring(start, end) === search); }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, collapse: function() { return this.trim().replace(/\s+/g, ' '); }, toTitleCase: function() { return this.replace(/\S+/g, function(a){ return a.charAt(0).toUpperCase() + a.slice(1); }); }, words: function() { return this.strip().split(/\s+/); } }, true); if ( !String.prototype.contains ) { M.extend(String.prototype, { contains: function() { return String.prototype.indexOf.apply( this, arguments ) !== -1; } }, true); } })();
// ================================================================================================= // Core.js | String Functions // (c) 2014 Mathigon / Philipp Legner // ================================================================================================= (function() { M.extend(String.prototype, { strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, collapse: function() { return this.trim().replace(/\s+/g, ' '); }, toTitleCase: function() { return this.replace(/\S+/g, function(a){ return a.charAt(0).toUpperCase() + a.slice(1); }); }, words: function() { return this.strip().split(/\s+/); } }, true); if (!String.prototype.endsWith) { M.extend(String.prototype, { endsWith: function(search) { var end = this.length; var start = end - search.length; return (this.substring(start, end) === search); } }, true); } if (!String.prototype.contains) { M.extend(String.prototype, { contains: function() { return String.prototype.indexOf.apply( this, arguments ) !== -1; } }, true); } })();
Fix String endsWith prototype shadowing
Fix String endsWith prototype shadowing
JavaScript
mit
Mathigon/core.js
--- +++ @@ -8,11 +8,6 @@ M.extend(String.prototype, { - endsWith: function(search) { - var end = this.length; - var start = end - search.length; - return (this.substring(start, end) === search); - }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); @@ -34,9 +29,18 @@ }, true); - if ( !String.prototype.contains ) { + if (!String.prototype.endsWith) { M.extend(String.prototype, { + endsWith: function(search) { + var end = this.length; + var start = end - search.length; + return (this.substring(start, end) === search); + } + }, true); + } + if (!String.prototype.contains) { + M.extend(String.prototype, { contains: function() { return String.prototype.indexOf.apply( this, arguments ) !== -1; }
a8d74088d41f2bb83336dc242d512193e743385a
components/home/events.js
components/home/events.js
import React from 'react' import PropTypes from 'prop-types' import Link from 'next/link' import { translate } from 'react-i18next' import Section from './section' const Events = ({ t }) => ( <Section title={t('eventsSectionTitle')}> <Link href='/events'> <a>{t('eventsLink')}</a> </Link> <style jsx>{` @import 'colors'; a { color: $darkgrey; display: block; margin-top: 1em; &:focus, &:hover { color: $black; } } `}</style> </Section> ) Events.propTypes = { t: PropTypes.func.isRequired } export default translate('home')(Events)
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import Link from '../link' import Section from './section' const Events = ({ t }) => ( <Section title={t('eventsSectionTitle')}> <Link href='/events'> <a>{t('eventsLink')}</a> </Link> <style jsx>{` @import 'colors'; a { color: $darkgrey; display: block; margin-top: 1em; &:focus, &:hover { color: $black; } } `}</style> </Section> ) Events.propTypes = { t: PropTypes.func.isRequired } export default translate('home')(Events)
Fix link to event page
Fix link to event page
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -1,8 +1,8 @@ import React from 'react' import PropTypes from 'prop-types' -import Link from 'next/link' import { translate } from 'react-i18next' +import Link from '../link' import Section from './section' const Events = ({ t }) => (
8bfcc293065a51f365fe574dcf168c3c10af98a6
api/controllers/requestHandlers/handleSuggest.js
api/controllers/requestHandlers/handleSuggest.js
var elasticsearch = require('elasticsearch'); if (sails.config.useElastic === true) { var CLIENT = new elasticsearch.Client({ host: sails.config.elasticHost, log: sails.config.elasticLogLevel }) } module.exports = function(req, res) { if (!CLIENT) { return res.notFound() } if (!req.body || !req.body.q || !req.socket) { return res.badRequest() } var query = req.body.q; CLIENT.search({ index: 'search', from: 0, size: 100, body: { query: { query_string : { fields : ["name", "id"], query: query.replace(/\:/g, '\\:') + '*', analyze_wildcard: true } } } }, function(err, result) { if (err) { sails.log.warn(err); return res.serverError() } else { console.log(result[0]) sails.log.debug('Suggest options for %s: %d', query, result.hits.total); if (result.hits.total > 0) { return res.json(result.hits.hits) } else { return res.notFound() } } }) };
var elasticsearch = require('elasticsearch'); if (sails.config.useElastic === true) { var CLIENT = new elasticsearch.Client({ host: sails.config.elasticHost, log: sails.config.elasticLogLevel }) } module.exports = function(req, res) { if (!CLIENT) { return res.notFound() } if (!req.body || !req.body.q || !req.socket) { return res.badRequest() } var query = req.body.q; CLIENT.search({ index: 'search', from: 0, size: 100, body: { query: { query_string : { fields : ["name", "id"], query: query.replace(/\:/g, '\\\:') + '*', analyze_wildcard: true, default_operator: 'AND' } } } }, function(err, result) { if (err) { sails.log.warn(err); return res.serverError() } else { console.log(result[0]) sails.log.debug('Suggest options for %s: %d', query, result.hits.total); if (result.hits.total > 0) { return res.json(result.hits.hits) } else { return res.notFound() } } }) };
Allow searching for HPO term ID's and match only entries that contain all of the query words (instead of one of the query words).
Allow searching for HPO term ID's and match only entries that contain all of the query words (instead of one of the query words).
JavaScript
mit
molgenis/gene-network,molgenis/gene-network
--- +++ @@ -27,8 +27,9 @@ query: { query_string : { fields : ["name", "id"], - query: query.replace(/\:/g, '\\:') + '*', - analyze_wildcard: true + query: query.replace(/\:/g, '\\\:') + '*', + analyze_wildcard: true, + default_operator: 'AND' } } }
cf4e0ba45bb8da2f44ea3eccee25f38b69479f45
controllers/submission.js
controllers/submission.js
const Submission = require('../models/Submission'); const moment = require('moment'); /** * GET /submissions */ exports.getSubmissions = (req, res) => { const page = parseInt(req.query && req.query.page) || 0; Submission .find() .sort({ _id: -1 }) .populate('user') .populate('language') .skip(500 * page) .limit(500) .exec((err, submissions) => { res.render('submissions', { title: 'Submissions', submissions, moment, }); }); }; /** * GET /submissions/:submission */ exports.getSubmission = (req, res) => { const _id = req.params.submission; Submission .findOne({ _id }) .populate('user') .populate('language') .exec() .then((submission) => { if (submission === null) { return res.sendStatus(404); } res.render('submission', { title: 'Submission', submission, selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team, }); }); };
const Submission = require('../models/Submission'); const User = require('../models/User'); const moment = require('moment'); const Promise = require('bluebird'); /** * GET /submissions */ exports.getSubmissions = (req, res) => { Promise.try(() => { if (req.query.author) { return User.findOne({ email: `${req.query.author}@twitter.com` }); } return null; }).then((author) => { const page = parseInt(req.query && req.query.page) || 0; const query = {}; if (author) { query.user = author._id; } if (req.query.status) { query.status = req.query.status; } return Submission.find(query) .sort({ _id: -1 }) .populate('user') .populate('language') .skip(500 * page) .limit(500) .exec(); }).then((submissions) => { res.render('submissions', { title: 'Submissions', submissions, moment, }); }); }; /** * GET /submissions/:submission */ exports.getSubmission = (req, res) => { const _id = req.params.submission; Submission .findOne({ _id }) .populate('user') .populate('language') .exec() .then((submission) => { if (submission === null) { return res.sendStatus(404); } res.render('submission', { title: 'Submission', submission, selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team, }); }); };
Add author and status parameter
Add author and status parameter
JavaScript
mit
hakatashi/esolang-battle,hakatashi/esolang-battle,hakatashi/esolang-battle
--- +++ @@ -1,19 +1,38 @@ const Submission = require('../models/Submission'); +const User = require('../models/User'); const moment = require('moment'); +const Promise = require('bluebird'); /** * GET /submissions */ exports.getSubmissions = (req, res) => { - const page = parseInt(req.query && req.query.page) || 0; - Submission - .find() - .sort({ _id: -1 }) - .populate('user') - .populate('language') - .skip(500 * page) - .limit(500) - .exec((err, submissions) => { + Promise.try(() => { + if (req.query.author) { + return User.findOne({ email: `${req.query.author}@twitter.com` }); + } + + return null; + }).then((author) => { + const page = parseInt(req.query && req.query.page) || 0; + const query = {}; + + if (author) { + query.user = author._id; + } + + if (req.query.status) { + query.status = req.query.status; + } + + return Submission.find(query) + .sort({ _id: -1 }) + .populate('user') + .populate('language') + .skip(500 * page) + .limit(500) + .exec(); + }).then((submissions) => { res.render('submissions', { title: 'Submissions', submissions,
221ed0e89bf69a169d1110788e0be3e2d10c49f0
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
'use strict'; /** * Allocate a buffer using an octet array. * * @module @stdlib/buffer/from-array * * @example * var array2buffer = require( '@stdlib/type/buffer/from-array' ); * * var buf = array2buffer( [ 1, 2, 3, 4 ] ); * // returns <Buffer> */ // MODULES // var hasFrom = require( './has_from.js' ); // MAIN // var array2buffer; if ( hasFrom ) { array2buffer = require( './main.js' ); } else { array2buffer = require( './polyfill.js' ); } // EXPORTS // module.exports = array2buffer;
'use strict'; /** * Allocate a buffer using an octet array. * * @module @stdlib/buffer/from-array * * @example * var array2buffer = require( '@stdlib/type/buffer/from-array' ); * * var buf = array2buffer( [ 1, 2, 3, 4 ] ); * // returns <Buffer> */ // MODULES // var hasFrom = require( './has_from.js' ); var main = require( './main.js' ); var polyfill = require( './polyfill.js' ); // MAIN // var array2buffer; if ( hasFrom ) { array2buffer = main; } else { array2buffer = polyfill; } // EXPORTS // module.exports = array2buffer;
Refactor to avoid dynamic module resolution
Refactor to avoid dynamic module resolution
JavaScript
apache-2.0
stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib
--- +++ @@ -15,15 +15,17 @@ // MODULES // var hasFrom = require( './has_from.js' ); +var main = require( './main.js' ); +var polyfill = require( './polyfill.js' ); // MAIN // var array2buffer; if ( hasFrom ) { - array2buffer = require( './main.js' ); + array2buffer = main; } else { - array2buffer = require( './polyfill.js' ); + array2buffer = polyfill; }
3ac7f2a8044ad8febe16541e9b3683cf00fd1ae0
components/search/result/thumbnail.js
components/search/result/thumbnail.js
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import { GEODATA_API_URL } from '@env' const Thumbnail = ({ recordId, thumbnails, t }) => { const hasThumbnail = thumbnails && thumbnails.length > 0 const thumbnail = hasThumbnail ? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}` : '/static/images/datasets/default-thumbnail.svg' return ( <div> <img src={thumbnail} alt='' /> <style jsx>{` div { display: flex; justify-content: center; align-items: center; flex-shrink: 0; overflow: hidden; height: 180px; width: 180px; @media (max-width: 767px) { width: 100%; ${!hasThumbnail && (` display: none; `)} } } img { display: flex; height: 100%; @media (max-width: 767px) { max-width: 100%; height: auto; margin: auto; } } `}</style> </div> ) } Thumbnail.propTypes = { thumbnails: PropTypes.arrayOf(PropTypes.shape({ originalUrlHash: PropTypes.isRequired })), recordId: PropTypes.string.isRequired, t: PropTypes.func.isRequired } export default translate('search')(Thumbnail)
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import { GEODATA_API_URL } from '@env' const Thumbnail = ({ recordId, thumbnails, t }) => { const hasThumbnail = thumbnails && thumbnails.length > 0 const thumbnail = hasThumbnail ? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}` : '/static/images/datasets/default-thumbnail.svg' return ( <div> <img src={thumbnail} alt='' /> <style jsx>{` div { display: flex; justify-content: center; align-items: center; flex-shrink: 0; overflow: hidden; height: 180px; width: 180px; @media (max-width: 767px) { width: 100%; ${!hasThumbnail && (` display: none; `)} } } img { display: flex; max-height: 100%; @media (max-width: 767px) { max-width: 100%; max-height: none; height: auto; margin: auto; } } `}</style> </div> ) } Thumbnail.propTypes = { thumbnails: PropTypes.arrayOf(PropTypes.shape({ originalUrlHash: PropTypes.isRequired })), recordId: PropTypes.string.isRequired, t: PropTypes.func.isRequired } export default translate('search')(Thumbnail)
Fix search result image sizes
Fix search result image sizes
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -36,10 +36,11 @@ img { display: flex; - height: 100%; + max-height: 100%; @media (max-width: 767px) { max-width: 100%; + max-height: none; height: auto; margin: auto; }
5591b4615ec9e88f448ad2a9f777c85e659bd0a0
server/helpers/helpers.js
server/helpers/helpers.js
const handleError = (err, res) => { switch (err.code) { case 401: return res.status(401).send(err.message); case 404: return res.status(404).send(err.message); default: return res.status(400).send(err); } }; const handleSuccess = (code, body, res) => { switch (code) { case 201: return res.status(201).send(body); default: return res.status(200).send(body); } }; module.exports = { handleError, handleSuccess };
const handleError = (err, res) => { switch (err.code) { case 401: return res.status(401).json(err.message); case 404: return res.status(404).json(err.message); default: return res.status(400).json(err); } }; const handleSuccess = (code, body, res) => { switch (code) { case 201: return res.status(201).json(body); default: return res.status(200).json(body); } }; module.exports = { handleError, handleSuccess };
Refactor the helper methods to use json method instead of send method
Refactor the helper methods to use json method instead of send method
JavaScript
mit
johadi10/PostIt,johadi10/PostIt
--- +++ @@ -1,19 +1,19 @@ const handleError = (err, res) => { switch (err.code) { case 401: - return res.status(401).send(err.message); + return res.status(401).json(err.message); case 404: - return res.status(404).send(err.message); + return res.status(404).json(err.message); default: - return res.status(400).send(err); + return res.status(400).json(err); } }; const handleSuccess = (code, body, res) => { switch (code) { case 201: - return res.status(201).send(body); + return res.status(201).json(body); default: - return res.status(200).send(body); + return res.status(200).json(body); } }; module.exports = { handleError, handleSuccess };
c6335c604a1495d2526f6f395e429e065f9317af
test/endpoints/account.js
test/endpoints/account.js
'use strict'; var assert = require('assert'); var sinon = require('sinon'); var Account = require('../../lib/endpoints/account'); var Request = require('../../lib/request'); describe('endpoints/account', function () { describe('changePassword', function () { it('should set the request URL', function () { var request = new Request(); var account; var stub; stub = sinon.stub(request, 'post', function (url) { assert.strictEqual(url, '/account/changepassword'); }); account = new Account(request); account.changePassword(); assert.ok(stub.called); }); it('should set the request body', function () { var request = new Request(); var account; var stub; var expected = { password: 'password', }; stub = sinon.stub(request, 'post', function (url, data) { assert.deepEqual(data, expected); }); account = new Account(request); account.changePassword(expected); assert.ok(stub.called); }); }); describe('info', function () { it('should set the request URL', function () { var request = new Request(); var account; var stub; stub = sinon.stub(request, 'get', function (url) { assert.strictEqual(url, '/account/info'); }); account = new Account(request); account.info(); assert.ok(stub.called); }); }); });
'use strict'; const assert = require('assert'); const sinon = require('sinon'); const Account = require('../../lib/endpoints/account'); const Request = require('../../lib/request'); describe('endpoints/account', () => { describe('changePassword', () => { it('should set the request URL', () => { const request = new Request(); const account = new Account(request); const stub = sinon.stub(request, 'post', (url) => { assert.strictEqual(url, '/account/changepassword'); }); account.changePassword(); assert.ok(stub.called); }); it('should set the request body', () => { const request = new Request(); const account = new Account(request); const expected = { password: 'password', }; const stub = sinon.stub(request, 'post', (url, data) => { assert.deepEqual(data, expected); }); account.changePassword(expected); assert.ok(stub.called); }); }); describe('info', () => { it('should set the request URL', () => { const request = new Request(); const account = new Account(request); const stub = sinon.stub(request, 'get', (url) => { assert.strictEqual(url, '/account/info'); }); account.info(); assert.ok(stub.called); }); }); });
Rewrite Account tests to ES2015
Rewrite Account tests to ES2015
JavaScript
mit
jwilsson/glesys-api-node
--- +++ @@ -1,58 +1,50 @@ 'use strict'; -var assert = require('assert'); -var sinon = require('sinon'); +const assert = require('assert'); +const sinon = require('sinon'); -var Account = require('../../lib/endpoints/account'); -var Request = require('../../lib/request'); +const Account = require('../../lib/endpoints/account'); +const Request = require('../../lib/request'); -describe('endpoints/account', function () { - describe('changePassword', function () { - it('should set the request URL', function () { - var request = new Request(); - var account; - var stub; - - stub = sinon.stub(request, 'post', function (url) { +describe('endpoints/account', () => { + describe('changePassword', () => { + it('should set the request URL', () => { + const request = new Request(); + const account = new Account(request); + const stub = sinon.stub(request, 'post', (url) => { assert.strictEqual(url, '/account/changepassword'); }); - account = new Account(request); account.changePassword(); assert.ok(stub.called); }); - it('should set the request body', function () { - var request = new Request(); - var account; - var stub; - var expected = { + it('should set the request body', () => { + const request = new Request(); + const account = new Account(request); + const expected = { password: 'password', }; - stub = sinon.stub(request, 'post', function (url, data) { + const stub = sinon.stub(request, 'post', (url, data) => { assert.deepEqual(data, expected); }); - account = new Account(request); account.changePassword(expected); assert.ok(stub.called); }); }); - describe('info', function () { - it('should set the request URL', function () { - var request = new Request(); - var account; - var stub; - - stub = sinon.stub(request, 'get', function (url) { + describe('info', () => { + it('should set the request URL', () => { + const request = new Request(); + const account = new Account(request); + const stub = sinon.stub(request, 'get', (url) => { assert.strictEqual(url, '/account/info'); }); - account = new Account(request); account.info(); assert.ok(stub.called);
a151d88b94ee726f0450b93df5ede04124a81ded
packages/rendering/addon/-private/meta-for-field.js
packages/rendering/addon/-private/meta-for-field.js
export default function metaForField(content, fieldName) { if (!content) { return; } try { return content.constructor.metaForProperty(fieldName); } catch (err) { return; } }
import { camelize } from "@ember/string"; export default function metaForField(content, fieldName) { if (!content) { return; } fieldName = camelize(fieldName); try { return content.constructor.metaForProperty(fieldName); } catch (err) { return; } }
Fix field editors not appearing for field names that contain dashes
Fix field editors not appearing for field names that contain dashes
JavaScript
mit
cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack
--- +++ @@ -1,6 +1,9 @@ +import { camelize } from "@ember/string"; + export default function metaForField(content, fieldName) { if (!content) { return; } + fieldName = camelize(fieldName); try { return content.constructor.metaForProperty(fieldName); } catch (err) {
8c8c3ef0efabbcf07ead714b3fb79f1f7ed81a41
test/spec/test_captcha.js
test/spec/test_captcha.js
defaultConf = { height: 100, width: 300, fingerprintLength: 20 }; describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); var captcha = new Captcha(); it("Captcha object is not null", function(){ expect(captcha).not.toBeNull(); }); it('captcha object should be an instance of Captcha class', function(){ expect(captcha instanceof Captcha).toBeTruthy(); }); it('the height of the svg should be set to the configured height', function(){ expect(Number(captcha.height)).toEqual(defaultConf.height); }); it('the width of the svg should be set to the configured width', function(){ expect(Number(captcha.width)).toEqual(defaultConf.width); }); });
defaultConf = { height: 100, width: 300, fingerprintLength: 20 }; describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); var captcha = new Captcha(); it("Captcha object is not null", function(){ expect(captcha).not.toBeNull(); }); it('captcha object should be an instance of Captcha class', function(){ expect(captcha instanceof Captcha).toBeTruthy(); }); it('the height of the svg should be set to the configured height', function(){ expect(Number(captcha.height)).toEqual(defaultConf.height); }); it('the width of the svg should be set to the configured width', function(){ expect(Number(captcha.width)).toEqual(defaultConf.width); }); it('the length of the fingerprint should be set to the configured fingerprintLength', function(){ expect(Number(captcha.fingerprintLength)).toEqual(defaultConf.fingerprintLength); }); });
Add one more test and it fails
Add one more test and it fails
JavaScript
mit
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
--- +++ @@ -21,4 +21,7 @@ it('the width of the svg should be set to the configured width', function(){ expect(Number(captcha.width)).toEqual(defaultConf.width); }); + it('the length of the fingerprint should be set to the configured fingerprintLength', function(){ + expect(Number(captcha.fingerprintLength)).toEqual(defaultConf.fingerprintLength); + }); });
02ee190d7383336953c7dde6d3e4f50285a7d113
src/interface/common/Ad.js
src/interface/common/Ad.js
import React from 'react'; import PropTypes from 'prop-types'; class Ad extends React.PureComponent { static propTypes = { style: PropTypes.object, }; componentDidMount() { (window.adsbygoogle = window.adsbygoogle || []).push({}); } render() { const { style, ...others } = this.props; const props = {}; if (!others['data-ad-slot']) { // Default to responsive props['data-ad-slot'] = '5976455458'; props['data-ad-format'] = 'auto'; props['data-full-width-responsive'] = 'true'; } return ( <ins className="adsbygoogle" style={style ? { display: 'block', ...style } : { display: 'block' }} data-ad-client="ca-pub-8048055232081854" {...props} {...others} /> ); } } export default Ad;
import React from 'react'; import PropTypes from 'prop-types'; class Ad extends React.PureComponent { static propTypes = { style: PropTypes.object, }; componentDidMount() { try { (window.adsbygoogle = window.adsbygoogle || []).push({}); } catch (err) { // "adsbygoogle.push() error: No slot size for availableWidth=0" error that I can't explain console.error(err); } } render() { const { style, ...others } = this.props; const props = {}; if (!others['data-ad-slot']) { // Default to responsive props['data-ad-slot'] = '5976455458'; props['data-ad-format'] = 'auto'; props['data-full-width-responsive'] = 'true'; } return ( <ins className="adsbygoogle" style={style ? { display: 'block', ...style } : { display: 'block' }} data-ad-client="ca-pub-8048055232081854" {...props} {...others} /> ); } } export default Ad;
Fix crash caused by google adsense
Fix crash caused by google adsense
JavaScript
agpl-3.0
WoWAnalyzer/WoWAnalyzer,anom0ly/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,fyruna/WoWAnalyzer,fyruna/WoWAnalyzer,ronaldpereira/WoWAnalyzer,anom0ly/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer,ronaldpereira/WoWAnalyzer,yajinni/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,Juko8/WoWAnalyzer,ronaldpereira/WoWAnalyzer,sMteX/WoWAnalyzer,fyruna/WoWAnalyzer,yajinni/WoWAnalyzer,sMteX/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,Juko8/WoWAnalyzer
--- +++ @@ -7,7 +7,12 @@ }; componentDidMount() { - (window.adsbygoogle = window.adsbygoogle || []).push({}); + try { + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (err) { + // "adsbygoogle.push() error: No slot size for availableWidth=0" error that I can't explain + console.error(err); + } } render() {
a96f3a13dc3a80d18ca7bc2fec5268c453c24533
src/react-chayns-personfinder/utils/normalizeOutput.js
src/react-chayns-personfinder/utils/normalizeOutput.js
export default function normalizeOutput(type, value) { return { type, name: value.name, firstName: value.firstName, lastName: value.lastName, personId: value.personId, userId: value.userId, siteId: value.siteId, locationId: value.locationId, isFriend: value.isFriend, }; }
import { FRIEND_RELATION, LOCATION_RELATION, PERSON_RELATION, PERSON_UNRELATED, } from '../constants/relationTypes'; export default function normalizeOutput(type, value) { const newType = (type === PERSON_RELATION || type === PERSON_UNRELATED || type === FRIEND_RELATION) ? PERSON_RELATION : LOCATION_RELATION; return { type: newType, name: value.name, firstName: value.firstName, lastName: value.lastName, personId: value.personId, userId: value.userId, siteId: value.siteId, locationId: value.locationId, isFriend: value.isFriend, }; }
Add normalization of type to prevent wrong types
:bug: Add normalization of type to prevent wrong types
JavaScript
mit
TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components
--- +++ @@ -1,6 +1,15 @@ +import { + FRIEND_RELATION, + LOCATION_RELATION, + PERSON_RELATION, + PERSON_UNRELATED, +} from '../constants/relationTypes'; + export default function normalizeOutput(type, value) { + const newType = (type === PERSON_RELATION || type === PERSON_UNRELATED || type === FRIEND_RELATION) ? PERSON_RELATION : LOCATION_RELATION; + return { - type, + type: newType, name: value.name, firstName: value.firstName, lastName: value.lastName,
046b77894ef1df26a411ae2ca808936d920632c9
to.etc.domui/src/resources/themes/domui/style.props.js
to.etc.domui/src/resources/themes/domui/style.props.js
/* * "domui" stylesheet properties. */ font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; font_size="11px"; hdr_font_size="14px"; fixed_font_family='Courier New, Courier, monospace'; fixed_font_size="11px"; defaultbutton_height=23; window_title_font_size='15px';
/* * "blue" stylesheet properties. */ font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; //font_family='Verdana, Tahoma, helvetica, sans-serif'; font_size="11px"; hdr_font_size="14px"; fixed_font_family='Courier New, Courier, monospace'; fixed_font_size="11px"; //special_font = "Verdana, Tahoma, helvetica, sans-serif"; special_font = "Arial, Helvetica, sans-serif"; //special_font = "Biolinum2, Courier, serif"; special_font_size = "13px"; button_font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; button_font_size="11px"; defaultbutton_height=23; window_title_font_size='15px';
Make both style properties equal
Make both style properties equal
JavaScript
lgpl-2.1
fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui
--- +++ @@ -1,12 +1,21 @@ /* - * "domui" stylesheet properties. + * "blue" stylesheet properties. */ font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; +//font_family='Verdana, Tahoma, helvetica, sans-serif'; font_size="11px"; hdr_font_size="14px"; fixed_font_family='Courier New, Courier, monospace'; fixed_font_size="11px"; +//special_font = "Verdana, Tahoma, helvetica, sans-serif"; +special_font = "Arial, Helvetica, sans-serif"; +//special_font = "Biolinum2, Courier, serif"; +special_font_size = "13px"; + +button_font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; +button_font_size="11px"; + defaultbutton_height=23; window_title_font_size='15px';
f5484310a9e52d1c7786d111486882dd94959a98
src/website/app/demos/Flex/components/Flex.js
src/website/app/demos/Flex/components/Flex.js
/* @flow */ import { createStyledComponent, pxToEm } from '../../../../../library/styles'; import _Flex from '../../../../../library/Flex'; type Props = { gutterWidth?: number | string, theme: Object }; export const containerStyles = ({ gutterWidth: propGutterSize, theme }: Props) => { const gutterWidth = propGutterSize === undefined ? 'md' : propGutterSize; const gutter = typeof gutterWidth === 'number' ? pxToEm(gutterWidth / 2) : `${parseFloat(theme[`space_inline_${gutterWidth}`] || gutterWidth) / 2}em`; const offset = gutterWidth ? `calc(${gutter} - 4px)` : -4; return { position: 'relative', '&::before': { border: `1px dotted ${theme.color_theme_30}`, bottom: -4, content: '""', left: offset, position: 'absolute', right: offset, top: -4, zIndex: -1 } }; }; export default createStyledComponent(_Flex, (props) => ({ ...containerStyles(props) }));
/* @flow */ import { createStyledComponent, pxToEm } from '../../../../../library/styles'; import _Flex from '../../../../../library/Flex'; type Props = { gutterWidth?: number | string, theme: Object }; export const containerStyles = ({ gutterWidth: propGutterSize, theme }: Props) => { const gutterWidth = propGutterSize === undefined ? 'md' : propGutterSize; const gutter = typeof gutterWidth === 'number' ? pxToEm(gutterWidth / 2) : `${parseFloat(theme[`space_inline_${gutterWidth}`] || gutterWidth) / 2}em`; const offset = gutterWidth ? `calc(${gutter} - 4px)` : -4; return { position: 'relative', zIndex: 1, '&::before': { border: `1px dotted ${theme.color_theme_30}`, bottom: -4, content: '""', left: offset, position: 'absolute', right: offset, top: -4, zIndex: -1 } }; }; export default createStyledComponent(_Flex, (props) => ({ ...containerStyles(props) }));
Fix display issue with Layout examples
chore(website): Fix display issue with Layout examples
JavaScript
apache-2.0
mineral-ui/mineral-ui,mineral-ui/mineral-ui
--- +++ @@ -21,6 +21,7 @@ return { position: 'relative', + zIndex: 1, '&::before': { border: `1px dotted ${theme.color_theme_30}`,
979bf24a28e95f6975fde020b002426eafe5f3e6
static/js/activity-23andme-complete-import.js
static/js/activity-23andme-complete-import.js
$(function () { var params = {'data_type': '23andme_names'}; $.ajax({ 'type': 'GET', 'url': '/json-data/', 'data': params, 'success': function(data) { if (data.profiles && data.profiles.length > 0) { for (var i = 0; i < data.profiles.length; i++) { var radioElem = $('<input />'); radioElem.attr({'type' : 'radio', 'name' : 'profile_id', 'value' : data.profiles[i].id}); if (data.profiles.length == 1) { radioElem.attr('checked', true); } var labelElem = $('<label></label>'); labelElem.append(radioElem); labelElem.append(data.profiles[i].first_name + ' ' + data.profiles[i].last_name); var divElem = $('<div></div>'); divElem.attr('class', 'radio'); divElem.append(labelElem); $("#23andme-list-profiles").append(divElem); } $("#load-23andme-waiting").hide(); $("#23andme-complete-submit").css('visibility', 'visible'); } } }); });
$(function () { var params = {'data_type': '23andme_names'}; $.ajax({ 'type': 'GET', 'url': '/json-data/', 'data': params, 'success': function(data) { if (data.profiles && data.profiles.length > 0) { for (var i = 0; i < data.profiles.length; i++) { var radioElem = $('<input />'); radioElem.attr({'type' : 'radio', 'name' : 'profile_id', 'value' : data.profiles[i].id}); if (data.profiles.length == 1) { radioElem.attr('checked', true); } var labelElem = $('<label></label>'); labelElem.append(radioElem); labelElem.append(data.profiles[i].first_name + ' ' + data.profiles[i].last_name); var divElem = $('<div></div>'); divElem.attr('class', 'radio'); divElem.append(labelElem); $("#23andme-list-profiles").append(divElem); } $("#load-23andme-waiting").hide(); $("#23andme-complete-submit").css('visibility', 'visible'); } } }); });
Fix JS to use 2-space tabs
Fix JS to use 2-space tabs
JavaScript
mit
PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans
--- +++ @@ -1,32 +1,32 @@ $(function () { - var params = {'data_type': '23andme_names'}; + var params = {'data_type': '23andme_names'}; - $.ajax({ - 'type': 'GET', - 'url': '/json-data/', - 'data': params, - 'success': function(data) { - if (data.profiles && data.profiles.length > 0) { - for (var i = 0; i < data.profiles.length; i++) { - var radioElem = $('<input />'); - radioElem.attr({'type' : 'radio', - 'name' : 'profile_id', - 'value' : data.profiles[i].id}); - if (data.profiles.length == 1) { - radioElem.attr('checked', true); - } - var labelElem = $('<label></label>'); - labelElem.append(radioElem); - labelElem.append(data.profiles[i].first_name + ' ' + - data.profiles[i].last_name); - var divElem = $('<div></div>'); - divElem.attr('class', 'radio'); - divElem.append(labelElem); - $("#23andme-list-profiles").append(divElem); - } - $("#load-23andme-waiting").hide(); - $("#23andme-complete-submit").css('visibility', 'visible'); - } + $.ajax({ + 'type': 'GET', + 'url': '/json-data/', + 'data': params, + 'success': function(data) { + if (data.profiles && data.profiles.length > 0) { + for (var i = 0; i < data.profiles.length; i++) { + var radioElem = $('<input />'); + radioElem.attr({'type' : 'radio', + 'name' : 'profile_id', + 'value' : data.profiles[i].id}); + if (data.profiles.length == 1) { + radioElem.attr('checked', true); + } + var labelElem = $('<label></label>'); + labelElem.append(radioElem); + labelElem.append(data.profiles[i].first_name + ' ' + + data.profiles[i].last_name); + var divElem = $('<div></div>'); + divElem.attr('class', 'radio'); + divElem.append(labelElem); + $("#23andme-list-profiles").append(divElem); } - }); + $("#load-23andme-waiting").hide(); + $("#23andme-complete-submit").css('visibility', 'visible'); + } + } + }); });
0100ebf9a24675a16ec200caf894af862196589c
d3/js/wgaPipeline.js
d3/js/wgaPipeline.js
/** * Creates an object of type wgaPipeline for drawing whole genome alignment visualizations * @author Markus Ankenbrand <markus.ankenbrand@uni-wuerzburg.de> * @constructor * @param {Object} svg - jQuery object containing a svg DOM element. Visualizations will be drawn on this svg. Size may be changed by object methods. Previous content will be deleted. * @example * // initializes an wgaPipeline object (wga) on the svg element with id 'canvas' * var svg = $('#canvas'); * var wga = new wgaPipeline(svg); */ function WgaPipeline(svg) { this.svg = svg; this.data = {}; }
/** * Creates an object of type wgaPipeline for drawing whole genome alignment visualizations * @author Markus Ankenbrand <markus.ankenbrand@uni-wuerzburg.de> * @constructor * @param {Object} svg - jQuery object containing a svg DOM element. Visualizations will be drawn on this svg. Size may be changed by object methods. Previous content will be deleted. * @example * // initializes an wgaPipeline object (wga) on the svg element with id 'canvas' * var svg = $('#canvas'); * var wga = new wgaPipeline(svg); */ function WgaPipeline(svg) { this.svg = svg; this.data = {}; } WgaPipeline.prototype.setData = function() { };
Test for existence of setData method passes
Test for existence of setData method passes
JavaScript
mit
BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,AliTVTeam/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,AliTVTeam/AliTV
--- +++ @@ -12,3 +12,7 @@ this.svg = svg; this.data = {}; } + +WgaPipeline.prototype.setData = function() { + +};
c74647dae08d8d5f55a3d68de956a37b1fccec0e
assets/main.js
assets/main.js
function do_command(item, command, val) { var data = {}; data[item] = command; if (val != undefined) { data["value"] = val; } $.get("/CMD", data); } function do_scene(scene, action) { $.get("/api/scene/" + scene + "/command/" + (action?action:"")); } $(function() { $(".command").each(function() { var elm = $(this); elm.on(elm.data("event"), function() { if (elm.data("use-val") == "true") { do_command(elm.data("item"), elm.data("command"), elm.val()); } else { do_command(elm.data("item"), elm.data("command")); } }); }); $(".scene-control").each(function() { var elm = $(this); elm.click(function(evt) { do_scene(elm.data("scene"), elm.data("action")); }); }); });
function do_command(item, command, val) { var data = {}; if (val != undefined) { data["val"] = val; } $.get("/api/item/" + item + "/command/" + command, data); } function do_scene(scene, action) { $.get("/api/scene/" + scene + "/command/" + (action?action:"")); } $(function() { $(".command").each(function() { var elm = $(this); elm.on(elm.data("event"), function() { if (elm.data("use-val")) { do_command(elm.data("item"), elm.data("command"), elm.val()); } else { do_command(elm.data("item"), elm.data("command")); } }); }); $(".scene-control").each(function() { var elm = $(this); elm.click(function(evt) { do_scene(elm.data("scene"), elm.data("action")); }); }); });
Update javascript to use native API
Update javascript to use native API
JavaScript
mit
idiotic/idiotic-webui,idiotic/idiotic-webui,idiotic/idiotic-webui
--- +++ @@ -1,11 +1,10 @@ function do_command(item, command, val) { var data = {}; - data[item] = command; if (val != undefined) { - data["value"] = val; + data["val"] = val; } - $.get("/CMD", data); + $.get("/api/item/" + item + "/command/" + command, data); } function do_scene(scene, action) { @@ -16,7 +15,7 @@ $(".command").each(function() { var elm = $(this); elm.on(elm.data("event"), function() { - if (elm.data("use-val") == "true") { + if (elm.data("use-val")) { do_command(elm.data("item"), elm.data("command"), elm.val()); } else { do_command(elm.data("item"), elm.data("command"));
d90f7b2a0393318affbb02ff89a63ade1a8b0469
javascript/example_code/nodegetstarted/sample.js
javascript/example_code/nodegetstarted/sample.js
/ Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache-2.0 License on an "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND. // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at // https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-nodejs.html // Load the SDK and UUID var AWS = require('aws-sdk'); var uuid = require('uuid'); // Create unique bucket name var bucketName = 'node-sdk-sample-' + uuid.v4(); // Create name for uploaded object key var keyName = 'hello_world.txt'; // Create a promise on S3 service object var bucketPromise = new AWS.S3({apiVersion: '2006-03-01'}).createBucket({Bucket: bucketName}).promise(); // Handle promise fulfilled/rejected states bucketPromise.then( function(data) { // Create params for putObject call var objectParams = {Bucket: bucketName, Key: keyName, Body: 'Hello World!'}; // Create object upload promise var uploadPromise = new AWS.S3({apiVersion: '2006-03-01'}).putObject(objectParams).promise(); uploadPromise.then( function(data) { console.log("Successfully uploaded data to " + bucketName + "/" + keyName); }); }).catch( function(err) { console.error(err, err.stack); });
// Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache-2.0 License on an "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND. // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at // https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-nodejs.html // Load the SDK and UUID var AWS = require('aws-sdk'); var uuid = require('uuid'); // Create unique bucket name var bucketName = 'node-sdk-sample-' + uuid.v4(); // Create name for uploaded object key var keyName = 'hello_world.txt'; // Create a promise on S3 service object var bucketPromise = new AWS.S3({apiVersion: '2006-03-01'}).createBucket({Bucket: bucketName}).promise(); // Handle promise fulfilled/rejected states bucketPromise.then( function(data) { // Create params for putObject call var objectParams = {Bucket: bucketName, Key: keyName, Body: 'Hello World!'}; // Create object upload promise var uploadPromise = new AWS.S3({apiVersion: '2006-03-01'}).putObject(objectParams).promise(); uploadPromise.then( function(data) { console.log("Successfully uploaded data to " + bucketName + "/" + keyName); }); }).catch( function(err) { console.error(err, err.stack); });
Add a backslash for a comment
Add a backslash for a comment
JavaScript
apache-2.0
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples
--- +++ @@ -1,4 +1,4 @@ -/ Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache-2.0 License on an "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND. // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at
3bc142f44ebd589227eec3660c72640fdfa7a238
bl/pipeline.js
bl/pipeline.js
var TaskScheduler = require("./task").TaskScheduler; var colors = require("colors"); exports.execute = function(initialStep, context, cb) { var completedSteps = 0; var estimatedSteps = initialStep.remaining; var scheduler = new TaskScheduler({ maxConcurrency: 5, mode: "lifo" }, cb); scheduler.schedule(execute_step, initialStep.weight, initialStep.name, [initialStep, null]); function execute_step(step, item, cb) { step.handler(item, step.args, context, step_complete); function step_complete(err, items) { ++completedSteps; if(step.next) { if(err == null) { if(items == null) { items = []; } else if(items.length == undefined) { items = [items]; } estimatedSteps += (items.length - 1) * step.next.remaining; } else { estimatedSteps -= step.next.remaining; } } console.log("Completed %d steps of %d".green, completedSteps, estimatedSteps); if(step.next && err == null) { items.forEach(function(i) { scheduler.schedule(execute_step, step.next.weight, step.next.name, [step.next, i]); }); } cb(err); } } }
var TaskScheduler = require("./task").TaskScheduler; var colors = require("colors"); exports.execute = function(initialStep, context, cb) { var completedSteps = 0; var estimatedSteps = initialStep.remaining; var scheduler = new TaskScheduler({ maxConcurrency: 5, mode: "lifo" }, cb); scheduler.schedule(execute_step, initialStep.weight, initialStep.name, [initialStep, null]); function execute_step(step, item, cb) { step.handler(item, step.args, context, step_complete); function step_complete(err, items) { ++completedSteps; if(step.next) { if(err == null) { if(items == null) { items = []; } else if(items.length == undefined) { items = [items]; } estimatedSteps += (items.length - 1) * step.next.remaining; } else { estimatedSteps -= step.next.remaining; } } console.log("%s Completed %d steps of %d".green, new Date(), completedSteps, estimatedSteps); if(step.next && err == null) { items.forEach(function(i) { scheduler.schedule(execute_step, step.next.weight, step.next.name, [step.next, i]); }); } cb(err); } } }
Add current date to polling log messages.
Add current date to polling log messages.
JavaScript
mit
aaubry/feed-reader,aaubry/feed-reader
--- +++ @@ -32,7 +32,7 @@ } } - console.log("Completed %d steps of %d".green, completedSteps, estimatedSteps); + console.log("%s Completed %d steps of %d".green, new Date(), completedSteps, estimatedSteps); if(step.next && err == null) { items.forEach(function(i) {
56e784e7e966ccff9ba29b658ebd31406a868987
lib/paymaya/core/HttpConnection.js
lib/paymaya/core/HttpConnection.js
module.exports = HttpConnection; var request = require('requestretry'); var HttpConfig = require("./HttpConfig"); var PaymayaApiError = require("./PaymayaApiError"); function HttpConnection(httpConfig) { this._httpConfig = httpConfig; }; HttpConnection.prototype = { /* PUBLIC FUNCTIONS */ execute: function(data, callback) { var httpOptions = { url: this._httpConfig.getUrl(), method: this._httpConfig.getMethod(), headers: this._httpConfig.getHeaders(), maxAttempts: this._httpConfig.getMaximumRequestAttempt() }; if(data) { httpOptions['body'] = JSON.stringify(data); } request(httpOptions, function(err, response, body) { if(err) { return callback(err); } if(!body && response.statusCode >= 400) { var err = new PaymayaApiError(response.statusCode); return callback(err); } if(typeof body != 'object') { body = JSON.parse(body); } if(body.error) { var err = new PaymayaApiError(response.statusCode, body.error); return callback(err.message); } if(body.message) { return callback(body.message); } callback(null, body); }); } };
module.exports = HttpConnection; var request = require('requestretry'); var HttpConfig = require("./HttpConfig"); var PaymayaApiError = require("./PaymayaApiError"); function HttpConnection(httpConfig) { this._httpConfig = httpConfig; }; HttpConnection.prototype = { /* PUBLIC FUNCTIONS */ execute: function(data, callback) { var httpOptions = { url: this._httpConfig.getUrl(), method: this._httpConfig.getMethod(), headers: this._httpConfig.getHeaders(), maxAttempts: this._httpConfig.getMaximumRequestAttempt() }; if(data) { httpOptions['body'] = JSON.stringify(data); } request(httpOptions, function(err, response, body) { if(err) { return callback(err); } if(!body && response.statusCode >= 400) { var err = new PaymayaApiError(response.statusCode); return callback(err); } if(typeof body != 'object') { body = JSON.parse(body); } if(body.error) { var err = new PaymayaApiError(response.statusCode, body.error); return callback(err.message); } if(body.message && response.statusCode != 200) { return callback(body.message); } callback(null, body); }); } };
Modify displaying of error message
Modify displaying of error message
JavaScript
mit
PayMaya/PayMaya-Node-SDK
--- +++ @@ -42,7 +42,7 @@ return callback(err.message); } - if(body.message) { + if(body.message && response.statusCode != 200) { return callback(body.message); }
bb85a90b6941c8f6d20b2cc6e15359d7daf9b461
src/authentication/sessions.js
src/authentication/sessions.js
'use strict'; export default { setup, }; /** * Module dependencies. */ import SequelizeStore from 'koa-generic-session-sequelize'; import session from 'koa-generic-session'; /** * Prepares session middleware and methods without attaching to the stack * * @param {Object} router * @param {Object} settings * @param {Object} database * @param {Object} [store] Store for `koa-generic-sessions`. Uses the database if a store is not provided * @return {Object} */ function setup(router, settings, database, store) { // attach pre-authenticator middleware router.use(function(ctx, next) { // set the secret keys for Keygrip ctx.app.keys = settings.session.keys; // attach session methods ctx.identityDesk = { get(key) { if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { return ctx.session.identityDesk[key]; } else { return undefined; } }, set(values) { ctx.session = ctx.session || { identityDesk: { values } }; ctx.session.identityDesk = ctx.session.identityDesk || { values }; Object.assign(ctx.session.identityDesk, values); }, }; next(); }); // return the session middleware for later use return session({ key: 'identityDesk.sid', store: store || new SequelizeStore(database), }); }
'use strict'; export default { setup, }; /** * Module dependencies. */ import SequelizeStore from 'koa-generic-session-sequelize'; import convert from 'koa-convert'; import session from 'koa-generic-session'; /** * Prepares session middleware and methods without attaching to the stack * * @param {Object} settings * @param {Object} database * @param {Object} [store] Store for `koa-generic-sessions`. Uses the database if a store is not provided * @return {Object} */ function setup(settings, database, store) { return { // session middleware session: convert(session({ key: 'identityDesk.sid', store: store || new SequelizeStore(database), })), sessionMethods: function(ctx, next) { // set the secret keys for Keygrip ctx.app.keys = settings.session.keys; // attach session methods ctx.identityDesk = { get(key) { if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { return ctx.session.identityDesk[key]; } else { return undefined; } }, set(values) { ctx.session = ctx.session || { identityDesk: { values } }; ctx.session.identityDesk = ctx.session.identityDesk || { values }; Object.assign(ctx.session.identityDesk, values); }, }; next(); }, }; }
Add missing file from last commit
Add missing file from last commit
JavaScript
mit
HiFaraz/identity-desk
--- +++ @@ -9,46 +9,45 @@ */ import SequelizeStore from 'koa-generic-session-sequelize'; +import convert from 'koa-convert'; import session from 'koa-generic-session'; /** * Prepares session middleware and methods without attaching to the stack * - * @param {Object} router * @param {Object} settings * @param {Object} database * @param {Object} [store] Store for `koa-generic-sessions`. Uses the database if a store is not provided * @return {Object} */ -function setup(router, settings, database, store) { +function setup(settings, database, store) { + return { + // session middleware + session: convert(session({ + key: 'identityDesk.sid', + store: store || new SequelizeStore(database), + })), + sessionMethods: function(ctx, next) { + // set the secret keys for Keygrip + ctx.app.keys = settings.session.keys; - // attach pre-authenticator middleware - router.use(function(ctx, next) { - // set the secret keys for Keygrip - ctx.app.keys = settings.session.keys; + // attach session methods + ctx.identityDesk = { + get(key) { + if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { + return ctx.session.identityDesk[key]; + } else { + return undefined; + } + }, + set(values) { + ctx.session = ctx.session || { identityDesk: { values } }; + ctx.session.identityDesk = ctx.session.identityDesk || { values }; + Object.assign(ctx.session.identityDesk, values); + }, + }; - // attach session methods - ctx.identityDesk = { - get(key) { - if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { - return ctx.session.identityDesk[key]; - } else { - return undefined; - } - }, - set(values) { - ctx.session = ctx.session || { identityDesk: { values } }; - ctx.session.identityDesk = ctx.session.identityDesk || { values }; - Object.assign(ctx.session.identityDesk, values); - }, - }; - - next(); - }); - - // return the session middleware for later use - return session({ - key: 'identityDesk.sid', - store: store || new SequelizeStore(database), - }); + next(); + }, + }; }
4d6ef02203bb5c198c9a6574601c8664271ad44d
app/javascript/flavours/glitch/components/column_back_button_slim.js
app/javascript/flavours/glitch/components/column_back_button_slim.js
import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import Icon from 'mastodon/components/icon'; export default class ColumnBackButtonSlim extends React.PureComponent { static contextTypes = { router: PropTypes.object, }; handleClick = (event) => { // if history is exhausted, or we would leave mastodon, just go to root. if (window.history.state) { const state = this.context.router.history.location.state; if (event.shiftKey && state && state.mastodonBackSteps) { this.context.router.history.go(-state.mastodonBackSteps); } else { this.context.router.history.goBack(); } } else { this.context.router.history.push('/'); } } render () { return ( <div className='column-back-button--slim'> <div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button column-back-button--slim-button'> <Icon id='chevron-left' className='column-back-button__icon' fixedWidth /> <FormattedMessage id='column_back_button.label' defaultMessage='Back' /> </div> </div> ); } }
import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import Icon from 'flavours/glitch/components/icon'; export default class ColumnBackButtonSlim extends React.PureComponent { static contextTypes = { router: PropTypes.object, }; handleClick = (event) => { // if history is exhausted, or we would leave mastodon, just go to root. if (window.history.state) { const state = this.context.router.history.location.state; if (event.shiftKey && state && state.mastodonBackSteps) { this.context.router.history.go(-state.mastodonBackSteps); } else { this.context.router.history.goBack(); } } else { this.context.router.history.push('/'); } } render () { return ( <div className='column-back-button--slim'> <div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button column-back-button--slim-button'> <Icon id='chevron-left' className='column-back-button__icon' fixedWidth /> <FormattedMessage id='column_back_button.label' defaultMessage='Back' /> </div> </div> ); } }
Fix using wrong component in ColumnBackButtonSlim
Fix using wrong component in ColumnBackButtonSlim
JavaScript
agpl-3.0
im-in-space/mastodon,im-in-space/mastodon,glitch-soc/mastodon,im-in-space/mastodon,glitch-soc/mastodon,glitch-soc/mastodon,Kirishima21/mastodon,Kirishima21/mastodon,Kirishima21/mastodon,im-in-space/mastodon,Kirishima21/mastodon,glitch-soc/mastodon
--- +++ @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; -import Icon from 'mastodon/components/icon'; +import Icon from 'flavours/glitch/components/icon'; export default class ColumnBackButtonSlim extends React.PureComponent {
88e405fdaa97a224ad6683d39163a04d86982ede
src/components/video_detail.js
src/components/video_detail.js
import React from 'react'; // import VideoListItem from './video_list_item'; const VideoDetail = ({video}) => { const videoId = video.id.videoId; const url = `https://www.youtube.com/embed/${videoId}`; return ( <div className="video-detail col-md-8"> <div className="embed-responsive embed-responsive-16by9"> <iframe className="embed-responsive-item" src={url}></iframe> </div> <div className="details"> <div>{video.snippet.title}</div> <div>{video.snippet.description}</div> </div> </div> ); }; export default VideoDetail;
Add code to video detail component
Add code to video detail component
JavaScript
mit
izabelka/redux-simple-starter,izabelka/redux-simple-starter
--- +++ @@ -0,0 +1,20 @@ +import React from 'react'; +// import VideoListItem from './video_list_item'; + +const VideoDetail = ({video}) => { + const videoId = video.id.videoId; + const url = `https://www.youtube.com/embed/${videoId}`; + return ( + <div className="video-detail col-md-8"> + <div className="embed-responsive embed-responsive-16by9"> + <iframe className="embed-responsive-item" src={url}></iframe> + </div> + <div className="details"> + <div>{video.snippet.title}</div> + <div>{video.snippet.description}</div> + </div> + </div> + ); +}; + +export default VideoDetail;
1e2aa246a558447455dba80c4f49e5f9cdbb00c7
test/read-only-parallel.js
test/read-only-parallel.js
const test = require('tape') const BorrowState = require('../lib/module.js') const sleep50ms = require('./sleep.js') const countTo = require('./count-to.js') ;[true, false].forEach((unsafe) => { test(`read-only-parallel (${unsafe ? 'un' : ''}safe)`, (t) => { t.plan(3) t.timeoutAfter(100) let myState = new BorrowState() countTo(3).forEach(() => { myState.block('r') .then(sleep50ms) .then((state) => { t.ok(true) state.unblock() }) }) }) })
const test = require('tape') const BorrowState = require('../lib/module.js') const sleep50ms = require('./sleep.js') const countTo = require('./count-to.js') ;[true, false].forEach((unsafe) => { test(`read-only-parallel (${unsafe ? 'un' : ''}safe)`, (t) => { t.plan(6) t.timeoutAfter(100) let myState = new BorrowState() countTo(3).forEach(() => { t.ok(true) myState.block('r') .then(sleep50ms) .then((state) => { t.ok(true) state.unblock() }) }) }) })
Make sure to count up test additions
Make sure to count up test additions
JavaScript
isc
jamescostian/borrow-state
--- +++ @@ -6,10 +6,11 @@ ;[true, false].forEach((unsafe) => { test(`read-only-parallel (${unsafe ? 'un' : ''}safe)`, (t) => { - t.plan(3) + t.plan(6) t.timeoutAfter(100) let myState = new BorrowState() countTo(3).forEach(() => { + t.ok(true) myState.block('r') .then(sleep50ms) .then((state) => {
b948a9b149394932a0d3bf8a957a8792e23510ae
front_end/.eslintrc.js
front_end/.eslintrc.js
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. const path = require('path'); const rulesDirPlugin = require('eslint-plugin-rulesdir'); rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib'); module.exports = { 'overrides': [{ 'files': ['*.ts'], 'rules': { '@typescript-eslint/explicit-function-return-type': 2, 'rulesdir/kebab_case_events': 2, 'rulesdir/set_data_type_reference': 2, 'rulesdir/lit_html_data_as_type': 2, 'rulesdir/lit_no_style_interpolation': 2, } }] };
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. const path = require('path'); const rulesDirPlugin = require('eslint-plugin-rulesdir'); rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib'); module.exports = { 'overrides': [{ 'files': ['*.ts'], 'rules': { '@typescript-eslint/explicit-function-return-type': 2, 'rulesdir/kebab_case_events': 2, 'rulesdir/set_data_type_reference': 2, 'rulesdir/lit_html_data_as_type': 2, 'rulesdir/lit_no_style_interpolation': 2, '@typescript-eslint/naming-convention': [ 'error', { 'selector': 'property', 'modifiers': ['private', 'protected'], 'format': ['camelCase'], }, { 'selector': 'method', 'modifiers': ['private', 'protected'], 'format': ['camelCase'], } ] } }] };
Enforce camelCase for private and protected class members
Enforce camelCase for private and protected class members This encodes some of the TypeScript style guides about identifiers https://google.github.io/styleguide/tsguide.html#identifiers (in particular the rules our codebase already adheres to). The automatic enforcement will save time during code reviews. The current TypeScript migration produces a lot of public class properties and methods with leading underscores, so this CL only enforces the rule for protected and private class members; the rule can be enforced for public variables as well at a later point in time. Bug: chromium:1057042 Change-Id: Ic63b0a9b128f8b560020c015a0f91bbf72a9dd6d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2672026 Commit-Queue: Sigurd Schneider <f04d242e109628a27a0f75fd49a87722bcf291fd@chromium.org> Reviewed-by: Tim van der Lippe <dba8716ee7f8d16236046f74d2167cb94410f6ed@chromium.org>
JavaScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -16,6 +16,18 @@ 'rulesdir/set_data_type_reference': 2, 'rulesdir/lit_html_data_as_type': 2, 'rulesdir/lit_no_style_interpolation': 2, + '@typescript-eslint/naming-convention': [ + 'error', { + 'selector': 'property', + 'modifiers': ['private', 'protected'], + 'format': ['camelCase'], + }, + { + 'selector': 'method', + 'modifiers': ['private', 'protected'], + 'format': ['camelCase'], + } + ] } }] };
c7329c1c5347ca2f453c41aeb0f479edc4050187
app/assets/javascripts/hyrax/browse_everything.js
app/assets/javascripts/hyrax/browse_everything.js
//= require jquery.treetable //= require browse_everything/behavior // Show the files in the queue Blacklight.onLoad( function() { // We need to check this because https://github.com/samvera/browse-everything/issues/169 if ($('#browse-btn').length > 0) { $('#browse-btn').browseEverything() .done(function(data) { var evt = { isDefaultPrevented: function() { return false; } }; var files = $.map(data, function(d) { return { name: d.file_name, size: d.file_size, id: d.url } }); $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }}); }) } });
//= require jquery.treetable //= require browse_everything/behavior // Show the files in the queue function showBrowseEverythingFiles() { // We need to check this because https://github.com/samvera/browse-everything/issues/169 if ($('#browse-btn').length > 0) { $('#browse-btn').browseEverything() .done(function(data) { var evt = { isDefaultPrevented: function() { return false; } }; var files = $.map(data, function(d) { return { name: d.file_name, size: d.file_size, id: d.url } }); $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }}); }) } } $(document).on('click', '#browse-btn', showBrowseEverythingFiles);
Fix loading of browse-everything done event
Fix loading of browse-everything done event Avoids situations where the prototype browseEverything() function has not been defined yet.
JavaScript
apache-2.0
samvera/hyrax,samvera/hyrax,samvera/hyrax,samvera/hyrax
--- +++ @@ -2,7 +2,7 @@ //= require browse_everything/behavior // Show the files in the queue -Blacklight.onLoad( function() { +function showBrowseEverythingFiles() { // We need to check this because https://github.com/samvera/browse-everything/issues/169 if ($('#browse-btn').length > 0) { $('#browse-btn').browseEverything() @@ -12,4 +12,6 @@ $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }}); }) } -}); +} +$(document).on('click', '#browse-btn', showBrowseEverythingFiles); +
79ac8a1c0b3e48b3b29f24422ab189d5dccc8fa0
client/src/js/home/components/Welcome.js
client/src/js/home/components/Welcome.js
import React from "react"; import { get } from "lodash-es"; import { connect } from "react-redux"; import { Panel } from "react-bootstrap"; import { getSoftwareUpdates } from "../../updates/actions"; import { Icon } from "../../base"; class Welcome extends React.Component { componentDidMount () { this.props.onGet(); } render () { let version; if (this.props.version) { version = ( <small className="text-muted"> {this.props.version} </small> ); } return ( <div className="container"> <Panel> <Panel.Body> <h3>Virtool {version}</h3> <p>Viral infection diagnostics using next-generation sequencing</p> <a className="btn btn-default" href="http://www.virtool.ca/" target="_blank" rel="noopener noreferrer" > <Icon name="globe" /> Website </a> </Panel.Body> </Panel> </div> ); } } const mapStateToProps = (state) => ({ version: get(state.updates.software, "version") }); const mapDispatchToProps = (dispatch) => ({ onGet: () => { dispatch(getSoftwareUpdates()); } }); export default connect(mapStateToProps, mapDispatchToProps)(Welcome);
import React from "react"; import { get } from "lodash-es"; import { connect } from "react-redux"; import { Panel } from "react-bootstrap"; import { getSoftwareUpdates } from "../../updates/actions"; import { Icon } from "../../base"; class Welcome extends React.Component { componentDidMount () { this.props.onGet(); } render () { let version; if (this.props.version) { version = ( <small className="text-muted"> {this.props.version} </small> ); } return ( <div className="container"> <Panel> <Panel.Body> <h3>Virtool {version}</h3> <p>Viral infection diagnostics using next-generation sequencing</p> <a className="btn btn-default" href="http://www.virtool.ca/" target="_blank" rel="noopener noreferrer" > <Icon name="globe" /> Website </a> </Panel.Body> </Panel> </div> ); } } const mapStateToProps = (state) => ({ version: get(state.updates, "version") }); const mapDispatchToProps = (dispatch) => ({ onGet: () => { dispatch(getSoftwareUpdates()); } }); export default connect(mapStateToProps, mapDispatchToProps)(Welcome);
Fix home virtool version display
Fix home virtool version display
JavaScript
mit
virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool
--- +++ @@ -45,7 +45,7 @@ } const mapStateToProps = (state) => ({ - version: get(state.updates.software, "version") + version: get(state.updates, "version") }); const mapDispatchToProps = (dispatch) => ({
443a4ae12198f757370e95cf9e2de12aae9f710f
app/assets/javascripts/pages/new/new.component.js
app/assets/javascripts/pages/new/new.component.js
(function(){ 'use strict' const New = { templateUrl: 'pages/new/new.html' // templateUrl: 'components/bookmarks/bookmark-search.html', // controller: 'NewController' // controllerAs: 'model' } angular .module("shareMark") .component("new", New); }());
(function(){ 'use strict' const New = { templateUrl: 'pages/new/new.html', controller: 'NewController', controllerAs: 'model' } angular .module("shareMark") .component("new", New); }());
Update NewComponent to use NewController
Update NewComponent to use NewController
JavaScript
mit
Dom-Mc/shareMark,Dom-Mc/shareMark,Dom-Mc/shareMark
--- +++ @@ -2,16 +2,13 @@ 'use strict' const New = { - templateUrl: 'pages/new/new.html' - - // templateUrl: 'components/bookmarks/bookmark-search.html', - // controller: 'NewController' - // controllerAs: 'model' + templateUrl: 'pages/new/new.html', + controller: 'NewController', + controllerAs: 'model' } angular .module("shareMark") .component("new", New); - }());
17e546f1a58744f7fe2f4e80147f6df2a203a2ee
esbuild/frappe-html.js
esbuild/frappe-html.js
module.exports = { name: "frappe-html", setup(build) { let path = require("path"); let fs = require("fs/promises"); build.onResolve({ filter: /\.html$/ }, (args) => { return { path: path.join(args.resolveDir, args.path), namespace: "frappe-html", }; }); build.onLoad({ filter: /.*/, namespace: "frappe-html" }, (args) => { let filepath = args.path; let filename = path.basename(filepath).split(".")[0]; return fs .readFile(filepath, "utf-8") .then((content) => { content = JSON.stringify(scrub_html_template(content)); return { contents: `\n\tfrappe.templates['${filename}'] = ${content};\n`, watchFiles: [filepath], }; }) .catch(() => { return { contents: "", warnings: [ { text: `There was an error importing ${filepath}`, }, ], }; }); }); }, }; function scrub_html_template(content) { content = content.replace(/`/g, "\\`"); return content; }
module.exports = { name: "frappe-html", setup(build) { let path = require("path"); let fs = require("fs/promises"); build.onResolve({ filter: /\.html$/ }, (args) => { return { path: path.join(args.resolveDir, args.path), namespace: "frappe-html", }; }); build.onLoad({ filter: /.*/, namespace: "frappe-html" }, (args) => { let filepath = args.path; let filename = path.basename(filepath).split(".")[0]; return fs .readFile(filepath, "utf-8") .then((content) => { content = scrub_html_template(content); return { contents: `\n\tfrappe.templates['${filename}'] = \`${content}\`;\n`, watchFiles: [filepath], }; }) .catch(() => { return { contents: "", warnings: [ { text: `There was an error importing ${filepath}`, }, ], }; }); }); }, }; function scrub_html_template(content) { content = content.replace(/`/g, "\\`"); return content; }
Revert "fix: allow backtick in HTML templates as well"
Revert "fix: allow backtick in HTML templates as well" This reverts commit 2f96458bcb6dfe8b8db4ef0101036b09bfa7c5f5.
JavaScript
mit
StrellaGroup/frappe,StrellaGroup/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe
--- +++ @@ -18,9 +18,9 @@ return fs .readFile(filepath, "utf-8") .then((content) => { - content = JSON.stringify(scrub_html_template(content)); + content = scrub_html_template(content); return { - contents: `\n\tfrappe.templates['${filename}'] = ${content};\n`, + contents: `\n\tfrappe.templates['${filename}'] = \`${content}\`;\n`, watchFiles: [filepath], }; })
7f009627bc82b67f34f93430152da71767be0029
packages/rear-system-package/config/app-paths.js
packages/rear-system-package/config/app-paths.js
const fs = require('fs'); const path = require('path'); const resolveApp = require('rear-core/resolve-app'); const ownNodeModules = fs.realpathSync( path.join(__dirname, '..', 'node_modules') ); const AppPaths = { ownNodeModules, root: resolveApp('src'), appIndexJs: resolveApp('src', 'index.js'), // TODO: rename to appBuild ? dest: resolveApp('lib'), eslintConfig: path.join(ownNodeModules, 'eslint-config-rear', 'index.js'), flowBin: path.join(ownNodeModules, 'flow-bin'), eslintBin: path.join(ownNodeModules, 'eslint'), appNodeModules: resolveApp('node_modules'), } module.exports = AppPaths;
const fs = require('fs'); const path = require('path'); const resolveApp = require('rear-core/resolve-app'); let ownNodeModules; try { // Since this package is also used to build other packages // in this repo, we need to make sure its dependencies // are available when is symlinked by lerna. // Normally, modules are resolved from the app's node_modules. ownNodeModules = fs.realpathSync( path.join(__dirname, '..', 'node_modules') ); } catch (err) { ownNodeModules = resolveApp('node_modules'); } const AppPaths = { ownNodeModules, root: resolveApp('src'), appIndexJs: resolveApp('src', 'index.js'), dest: resolveApp('lib'), eslintConfig: path.join(ownNodeModules, 'eslint-config-rear', 'index.js'), flowBin: path.join(ownNodeModules, 'flow-bin'), eslintBin: path.join(ownNodeModules, 'eslint'), appNodeModules: resolveApp('node_modules'), } module.exports = AppPaths;
Fix an issue that prevented modules to be resolved
Fix an issue that prevented modules to be resolved rear-system-package's config/app-paths.js was trying to resolve node_modules from inside the dependency. This is needed when rear-system-package is symlinked. Normally node_modules paths should be resolved from the app's node_modules.
JavaScript
mit
erremauro/rear,rearjs/rear
--- +++ @@ -2,15 +2,24 @@ const path = require('path'); const resolveApp = require('rear-core/resolve-app'); -const ownNodeModules = fs.realpathSync( - path.join(__dirname, '..', 'node_modules') -); +let ownNodeModules; + +try { + // Since this package is also used to build other packages + // in this repo, we need to make sure its dependencies + // are available when is symlinked by lerna. + // Normally, modules are resolved from the app's node_modules. + ownNodeModules = fs.realpathSync( + path.join(__dirname, '..', 'node_modules') + ); +} catch (err) { + ownNodeModules = resolveApp('node_modules'); +} const AppPaths = { ownNodeModules, root: resolveApp('src'), appIndexJs: resolveApp('src', 'index.js'), - // TODO: rename to appBuild ? dest: resolveApp('lib'), eslintConfig: path.join(ownNodeModules, 'eslint-config-rear', 'index.js'), flowBin: path.join(ownNodeModules, 'flow-bin'),
8046548e86332e8b544563bcbc660a37b50ebd5e
test/index.js
test/index.js
var assert = require('assert'), capitalize = require('../index.js') describe('Capitalizer', function () { it('Capitalizes the first letter of a string', function () { assert.equal(capitalize('test'), 'Test') assert.equal(capitalize.first('test'), 'Test') }) it('Capitalizes all words in a string', function () { assert.equal( capitalize.all('this is a test sentence'), 'This Is A Test Sentence' ) }) it('Capitalizes all words in an array', function () { assert.equal( capitalize(['this', 'is', 'a', 'test', 'sentence']), ['This', 'Is', 'A', 'Test', 'Sentence'] ) }) it.skip('Recursively capitalizes all strings in an object', function () { assert.equal( capitalize({ name: 'john', hobby: 'chillin', address: { country: 'australia', street: 'wayne boulevard' } }), { name: 'John', hobby: 'Chillin', address: { country: 'Australia', street: 'Wayne boulevard' } } ) }) })
var assert = require('assert'), capitalize = require('../index.js') describe('Capitalizer', function () { it('Capitalizes the first letter of a string', function () { assert.equal(capitalize('test'), 'Test') assert.equal(capitalize.first('test'), 'Test') }) it('Capitalizes all words in a string', function () { assert.equal( capitalize.all('this is a test sentence'), 'This Is A Test Sentence' ) }) it('Capitalizes all words in an array', function () { assert.deepEqual( capitalize(['this', 'is', 'a', 'test', 'sentence']), ['This', 'Is', 'A', 'Test', 'Sentence'] ) }) it.skip('Recursively capitalizes all strings in an object', function () { assert.equal( capitalize({ name: 'john', hobby: 'chillin', address: { country: 'australia', street: 'wayne boulevard' } }), { name: 'John', hobby: 'Chillin', address: { country: 'Australia', street: 'Wayne boulevard' } } ) }) })
Test for deep equality of arrays
Test for deep equality of arrays
JavaScript
mit
adius/capitalizer
--- +++ @@ -19,7 +19,7 @@ it('Capitalizes all words in an array', function () { - assert.equal( + assert.deepEqual( capitalize(['this', 'is', 'a', 'test', 'sentence']), ['This', 'Is', 'A', 'Test', 'Sentence'] )
314b2f1b8350b64e29824257cef48f142d4c152f
test/index.js
test/index.js
'use strict'; const chai = require('chai'); const plate = require('../index'); const expect = chai.expect; describe('Those postal codes', function() { it('should be valid', function() { expect(plate.validate('10188')).to.be.true; expect(plate.validate('49080')).to.be.true; }); }); describe('Those postal codes', function() { it('should be invalid', function() { expect(plate.validate('90000')).to.be.false; expect(plate.validate('00000')).to.be.false; expect(plate.validate('1abcd')).to.be.false; expect(plate.validate('123456')).to.be.false; expect(plate.validate('1234')).to.be.false; expect(plate.validate('1 2 3 4')).to.be.false; }); }); describe('Those dirty postal codes', function() { it('should be cleaned', function() { expect(plate.clean(' 123 45 ')).to.equal('12345'); }); });
'use strict'; const chai = require('chai'); const postalCode = require('../index'); const expect = chai.expect; describe('Those postal codes', function() { it('should be valid', function() { expect(postalCode.validate('10188')).to.be.true; expect(postalCode.validate('49080')).to.be.true; }); }); describe('Those postal codes', function() { it('should be invalid', function() { expect(postalCode.validate('90000')).to.be.false; expect(postalCode.validate('00000')).to.be.false; expect(postalCode.validate('1abcd')).to.be.false; expect(postalCode.validate('123456')).to.be.false; expect(postalCode.validate('1234')).to.be.false; expect(postalCode.validate('1 2 3 4')).to.be.false; }); }); describe('Those dirty postal codes', function() { it('should be cleaned', function() { expect(postalCode.clean(' 123 45 ')).to.equal('12345'); }); });
Fix wrong naming in tests
Fix wrong naming in tests
JavaScript
mit
alefteris/greece-postal-code
--- +++ @@ -2,30 +2,30 @@ const chai = require('chai'); -const plate = require('../index'); +const postalCode = require('../index'); const expect = chai.expect; describe('Those postal codes', function() { it('should be valid', function() { - expect(plate.validate('10188')).to.be.true; - expect(plate.validate('49080')).to.be.true; + expect(postalCode.validate('10188')).to.be.true; + expect(postalCode.validate('49080')).to.be.true; }); }); describe('Those postal codes', function() { it('should be invalid', function() { - expect(plate.validate('90000')).to.be.false; - expect(plate.validate('00000')).to.be.false; - expect(plate.validate('1abcd')).to.be.false; - expect(plate.validate('123456')).to.be.false; - expect(plate.validate('1234')).to.be.false; - expect(plate.validate('1 2 3 4')).to.be.false; + expect(postalCode.validate('90000')).to.be.false; + expect(postalCode.validate('00000')).to.be.false; + expect(postalCode.validate('1abcd')).to.be.false; + expect(postalCode.validate('123456')).to.be.false; + expect(postalCode.validate('1234')).to.be.false; + expect(postalCode.validate('1 2 3 4')).to.be.false; }); }); describe('Those dirty postal codes', function() { it('should be cleaned', function() { - expect(plate.clean(' 123 45 ')).to.equal('12345'); + expect(postalCode.clean(' 123 45 ')).to.equal('12345'); }); });
b77fd67ee02329bd25fe224689dcd8434262c282
src/finders/JumpPointFinder.js
src/finders/JumpPointFinder.js
/** * @author aniero / https://github.com/aniero */ var DiagonalMovement = require('../core/DiagonalMovement'); var JPFNeverMoveDiagonally = require('./JPFNeverMoveDiagonally'); var JPFAlwaysMoveDiagonally = require('./JPFAlwaysMoveDiagonally'); var JPFMoveDiagonallyIfNoObstacles = require('./JPFMoveDiagonallyIfNoObstacles'); var JPFMoveDiagonallyIfAtMostOneObstacle = require('./JPFMoveDiagonallyIfAtMostOneObstacle'); /** * Path finder using the Jump Point Search algorithm * @param {object} opt * @param {function} opt.heuristic Heuristic function to estimate the distance * (defaults to manhattan). * @param {DiagonalMovement} opt.diagonalMovement Condition under which diagonal * movement will be allowed. */ function JumpPointFinder(opt) { if (opt.diagonalMovement === DiagonalMovement.Never) { return new JPFNeverMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.Always) { return new JPFAlwaysMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.OnlyWhenNoObstacles) { return new JPFMoveDiagonallyIfNoObstacles(opt); } else { return new JPFMoveDiagonallyIfAtMostOneObstacle(opt); } } module.exports = JumpPointFinder;
/** * @author aniero / https://github.com/aniero */ var DiagonalMovement = require('../core/DiagonalMovement'); var JPFNeverMoveDiagonally = require('./JPFNeverMoveDiagonally'); var JPFAlwaysMoveDiagonally = require('./JPFAlwaysMoveDiagonally'); var JPFMoveDiagonallyIfNoObstacles = require('./JPFMoveDiagonallyIfNoObstacles'); var JPFMoveDiagonallyIfAtMostOneObstacle = require('./JPFMoveDiagonallyIfAtMostOneObstacle'); /** * Path finder using the Jump Point Search algorithm * @param {object} opt * @param {function} opt.heuristic Heuristic function to estimate the distance * (defaults to manhattan). * @param {DiagonalMovement} opt.diagonalMovement Condition under which diagonal * movement will be allowed. */ function JumpPointFinder(opt) { opt = opt || {}; if (opt.diagonalMovement === DiagonalMovement.Never) { return new JPFNeverMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.Always) { return new JPFAlwaysMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.OnlyWhenNoObstacles) { return new JPFMoveDiagonallyIfNoObstacles(opt); } else { return new JPFMoveDiagonallyIfAtMostOneObstacle(opt); } } module.exports = JumpPointFinder;
Fix exception on missing options object
Fix exception on missing options object If the JumpPointFinder constructor was not passed the options object there was a ReferenceError.
JavaScript
bsd-3-clause
radify/PathFinding.js,radify/PathFinding.js
--- +++ @@ -16,6 +16,7 @@ * movement will be allowed. */ function JumpPointFinder(opt) { + opt = opt || {}; if (opt.diagonalMovement === DiagonalMovement.Never) { return new JPFNeverMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.Always) {
9edb7717b460685efaff9b2974daa9b776bd2921
share/spice/urban_dictionary/urban_dictionary.js
share/spice/urban_dictionary/urban_dictionary.js
// `ddg_spice_urban_dictionary` is a callback function that gets // "urban dictionary cool" or "urban dictionary ROTFL." // Note: This plugin can display adult content and profanity. function ddg_spice_urban_dictionary(response) { "use strict"; if (!(response || response.response.result_type === "exact" || response.list || response.list[0])) { return; } var word = response.list[0].word; var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); Spice.render({ data : { 'definition' : definition }, header1 : word + " (Urban Dictionary)", source_url : 'http://www.urbandictionary.com/define.php?term=' + word, source_name : 'Urban Dictionary', template_normal : 'urban_dictionary', force_big_header : true, }); }
// `ddg_spice_urban_dictionary` is a callback function that gets // "urban dictionary cool" or "urban dictionary ROTFL." // Note: This plugin can display adult content and profanity. function ddg_spice_urban_dictionary(response) { "use strict"; if (!(response || response.response.result_type === "exact" || response.list || response.list[0])) { return; } var word = response.list[0].word; var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); Spice.render({ data : { 'definition' : definition }, header1 : word + " (Urban Dictionary)", source_url : 'http://www.urbandictionary.com/define.php?term=' + word, source_name : 'Urban Dictionary', template_normal : 'urban_dictionary', force_big_header : true, }); }
Fix whitespace tabs-versus-spaces conflict in Urban_dictionary Spice.
Fix whitespace tabs-versus-spaces conflict in Urban_dictionary Spice.
JavaScript
apache-2.0
alexandernext/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,ppant/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,deserted/zeroclickinfo-spice,ppant/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,levaly/zeroclickinfo-spice,ppant/zeroclickinfo-spice,echosa/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,lerna/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,loganom/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,ppant/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,echosa/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,lernae/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,echosa/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,imwally/zeroclickinfo-spice,levaly/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lernae/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,sevki/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,soleo/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,P71/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,lernae/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,lerna/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,deserted/zeroclickinfo-spice,echosa/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,sevki/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,stennie/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,mayo/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,levaly/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,levaly/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,imwally/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,deserted/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,stennie/zeroclickinfo-spice,deserted/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,loganom/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,stennie/zeroclickinfo-spice,imwally/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,loganom/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,soleo/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,soleo/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,mayo/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,lernae/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,levaly/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,mayo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,stennie/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,deserted/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,loganom/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,sevki/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,sevki/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,imwally/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,lerna/zeroclickinfo-spice,P71/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lernae/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,deserted/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,imwally/zeroclickinfo-spice,soleo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,levaly/zeroclickinfo-spice,echosa/zeroclickinfo-spice
--- +++ @@ -6,20 +6,20 @@ function ddg_spice_urban_dictionary(response) { "use strict"; - if (!(response || response.response.result_type === "exact" - || response.list || response.list[0])) { - return; + if (!(response || response.response.result_type === "exact" + || response.list || response.list[0])) { + return; } - var word = response.list[0].word; - var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); + var word = response.list[0].word; + var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); - Spice.render({ - data : { 'definition' : definition }, - header1 : word + " (Urban Dictionary)", - source_url : 'http://www.urbandictionary.com/define.php?term=' + word, - source_name : 'Urban Dictionary', - template_normal : 'urban_dictionary', - force_big_header : true, - }); + Spice.render({ + data : { 'definition' : definition }, + header1 : word + " (Urban Dictionary)", + source_url : 'http://www.urbandictionary.com/define.php?term=' + word, + source_name : 'Urban Dictionary', + template_normal : 'urban_dictionary', + force_big_header : true, + }); }
01c7ea21e810e5c27ca8105c5e169c28b57975a8
examples/todo/static/assets/js/app.js
examples/todo/static/assets/js/app.js
var loadTodos = function() { $.ajax({ url: "/graphql?query={todoList{id,text,done}}" }).done(function(data) { console.log(data); var dataParsed = JSON.parse(data); var todos = dataParsed.data.todoList; if (!todos.length) { $('.todo-list-container').append('<p>There are no tasks for you today</p>'); } $.each(todos, function(i, v) { var doneHtml = '<input id="' + v.id + '" type="checkbox"' + (v.done ? ' checked="checked"' : '') + '>'; var labelHtml = '<label for="' + v.id + '">' + doneHtml + v.text + '</label>'; var itemHtml = '<div class="todo-item">' + labelHtml + '</div>'; $('.todo-list-container').append(itemHtml); }); }); }; $(document).ready(function() { loadTodos(); });
var handleTodoList = function(object) { var todos = object; if (!todos.length) { $('.todo-list-container').append('<p>There are no tasks for you today</p>'); } $.each(todos, function(i, v) { var doneHtml = '<input id="' + v.id + '" type="checkbox"' + (v.done ? ' checked="checked"' : '') + '>'; var labelHtml = '<label for="' + v.id + '">' + doneHtml + v.text + '</label>'; var itemHtml = '<div class="todo-item">' + labelHtml + '</div>'; $('.todo-list-container').append(itemHtml); }); }; var loadTodos = function() { $.ajax({ url: "/graphql?query={todoList{id,text,done}}" }).done(function(data) { console.log(data); var dataParsed = JSON.parse(data); handleTodoList(dataParsed.data.todoList); }); }; var addTodo = function(todoText) { if (!todoText || todoText === "") { alert('Please specify a task'); return; } $.ajax({ url: '/graphql?query=mutation+_{createTodo(text:"' + todoText + '"){id,text,done}}' }).done(function(data) { console.log(data); var dataParsed = JSON.parse(data); var todoList = [dataParsed.data.createTodo]; handleTodoList(todoList); }); }; $(document).ready(function() { $('.todo-add-form button').click(function(){ addTodo($('.todo-add-form #task').val()); $('.todo-add-form #task').val(''); }); loadTodos(); });
Add "Add task" functionality, use the mutation
Add "Add task" functionality, use the mutation
JavaScript
mit
kr15h/graphql
--- +++ @@ -1,25 +1,50 @@ +var handleTodoList = function(object) { + var todos = object; + + if (!todos.length) { + $('.todo-list-container').append('<p>There are no tasks for you today</p>'); + } + + $.each(todos, function(i, v) { + var doneHtml = '<input id="' + v.id + '" type="checkbox"' + (v.done ? ' checked="checked"' : '') + '>'; + var labelHtml = '<label for="' + v.id + '">' + doneHtml + v.text + '</label>'; + var itemHtml = '<div class="todo-item">' + labelHtml + '</div>'; + + $('.todo-list-container').append(itemHtml); + }); +}; + var loadTodos = function() { $.ajax({ url: "/graphql?query={todoList{id,text,done}}" }).done(function(data) { console.log(data); var dataParsed = JSON.parse(data); - var todos = dataParsed.data.todoList; + handleTodoList(dataParsed.data.todoList); + }); +}; - if (!todos.length) { - $('.todo-list-container').append('<p>There are no tasks for you today</p>'); - } +var addTodo = function(todoText) { + if (!todoText || todoText === "") { + alert('Please specify a task'); + return; + } - $.each(todos, function(i, v) { - var doneHtml = '<input id="' + v.id + '" type="checkbox"' + (v.done ? ' checked="checked"' : '') + '>'; - var labelHtml = '<label for="' + v.id + '">' + doneHtml + v.text + '</label>'; - var itemHtml = '<div class="todo-item">' + labelHtml + '</div>'; - - $('.todo-list-container').append(itemHtml); - }); + $.ajax({ + url: '/graphql?query=mutation+_{createTodo(text:"' + todoText + '"){id,text,done}}' + }).done(function(data) { + console.log(data); + var dataParsed = JSON.parse(data); + var todoList = [dataParsed.data.createTodo]; + handleTodoList(todoList); }); }; $(document).ready(function() { + $('.todo-add-form button').click(function(){ + addTodo($('.todo-add-form #task').val()); + $('.todo-add-form #task').val(''); + }); + loadTodos(); });
7888270cc70a99be1c0fc20945a9684d66a69134
examples/client/app.js
examples/client/app.js
angular.module('MyApp', ['ngResource', 'ngMessages', 'ngRoute', 'ngAuth', 'mgcrea.ngStrap']) .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeCtrl' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginCtrl' }) .when('/signup', { templateUrl: 'views/signup.html', controller: 'SignupCtrl' }) .when('/logout', { template: null, controller: 'LogoutCtrl' }) .when('/protected', { templateUrl: 'views/protected.html', controller: 'ProtectedCtrl' }) .otherwise({ redirectTo: '/' }); }]) .config(['AuthProvider', function(AuthProvider) { AuthProvider.configure({ apiUrl: '/api' }); }]);
angular.module('MyApp', ['ngResource', 'ngMessages', 'ngRoute', 'ngAuth', 'mgcrea.ngStrap']) .config(['$routeProvider', 'AuthProvider', function($routeProvider, AuthProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeCtrl' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginCtrl' }) .when('/signup', { templateUrl: 'views/signup.html', controller: 'SignupCtrl' }) .when('/logout', { template: null, controller: 'LogoutCtrl' }) .when('/protected', { templateUrl: 'views/protected.html', controller: 'ProtectedCtrl' }) .otherwise({ redirectTo: '/' }); AuthProvider.configure({ apiUrl: '/api' }); }]);
Move AuthProvider into first config block
Move AuthProvider into first config block
JavaScript
mit
hsr-ba-fs15-dat/satellizer,gshireesh/satellizer,bnicart/satellizer,jskrzypek/satellizer,jskrzypek/satellizer,johan--/satellizer,vebin/satellizer,TechyTimo/CoderHunt,celrenheit/satellizer,maciekrb/satellizer,maciekrb/satellizer,david300/satellizer,ELAPAKAHARI/satellizer,gregoriusxu/satellizer,maciekrb/satellizer,rick4470/satellizer,peterkim-ijet/satellizer,m-kostira/satellizer,redwood-strategic/satellizer,jskrzypek/satellizer,redwood-strategic/satellizer,david300/satellizer,hsr-ba-fs15-dat/satellizer,ELAPAKAHARI/satellizer,NikolayGalkin/satellizer,maciekrb/satellizer,gshireesh/satellizer,dgoguerra/satellizer,ezzaouia/satellizer,jonbgallant/satellizer,peterkim-ijet/satellizer,redwood-strategic/satellizer,ELAPAKAHARI/satellizer,ELAPAKAHARI/satellizer,redwood-strategic/satellizer,bartekmis/satellizer,gshireesh/satellizer,suratpyari/satellizer,amitport/satellizer,jskrzypek/satellizer,eduardomb/satellizer,xxryan1234/satellizer,Manumental32/satellizer,maciekrb/satellizer,david300/satellizer,eduardomb/satellizer,redwood-strategic/satellizer,eduardomb/satellizer,jskrzypek/satellizer,celrenheit/satellizer,xxryan1234/satellizer,eduardomb/satellizer,sahat/satellizer,ABPFrameWorkGroup/satellizer,zawmyolatt/satellizer,amitport/satellizer,peterkim-ijet/satellizer,xxryan1234/satellizer,redwood-strategic/satellizer,celrenheit/satellizer,romcyncynatus/satellizer,ELAPAKAHARI/satellizer,elanperach/satellizer,redwood-strategic/satellizer,marfarma/satellizer,maciekrb/satellizer,18098924759/satellizer,jayzeng/satellizer,celrenheit/satellizer,david300/satellizer,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,marceldiass/satellizer,xscharlie/satellizer,xxryan1234/satellizer,amitport/satellizer,amitport/satellizer,gshireesh/satellizer,ELAPAKAHARI/satellizer,xxryan1234/satellizer,AmreeshTyagi/satellizer,peterkim-ijet/satellizer,celrenheit/satellizer,NikolayGalkin/satellizer,david300/satellizer,IRlyDontKnow/satellizer,manojpm/satellizer,TheOneTheOnlyDavidBrown/satellizer,raycoding/satellizer,hsr-ba-fs15-dat/satellizer,NikolayGalkin/satellizer,shikhardb/satellizer,baratheraja/satellizer,celrenheit/satellizer,peterkim-ijet/satellizer,andyskw/satellizer,maciekrb/satellizer,peterkim-ijet/satellizer,eduardomb/satellizer,gshireesh/satellizer,amitport/satellizer,gshireesh/satellizer,viniciusferreira/satellizer,jskrzypek/satellizer,TechyTimo/CoderHunt,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,NikolayGalkin/satellizer,johan--/satellizer,eduardomb/satellizer,celrenheit/satellizer,eduardomb/satellizer,gshireesh/satellizer,david300/satellizer,jskrzypek/satellizer,maciekrb/satellizer,NikolayGalkin/satellizer,burasu/satellizer,NikolayGalkin/satellizer,david300/satellizer,celrenheit/satellizer,ELAPAKAHARI/satellizer,hsr-ba-fs15-dat/satellizer,TechyTimo/carbon,NikolayGalkin/satellizer,jskrzypek/satellizer,redwood-strategic/satellizer,david300/satellizer,SkydiverFL/satellizer,ELAPAKAHARI/satellizer,memezilla/satellizer,romcyncynatus/satellizer,hsr-ba-fs15-dat/satellizer,TechyTimo/carbon,peterkim-ijet/satellizer,shubham13jain/satellizer,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,xxryan1234/satellizer,thiagofesta/satellizer,heinbez/satellizer,sahat/satellizer,gshireesh/satellizer,eduardomb/satellizer,amitport/satellizer,eduardomb/satellizer,redwood-strategic/satellizer,NikolayGalkin/satellizer,amitport/satellizer,gshireesh/satellizer,themifycloud/satellizer,jianwang195823/satellizer,peterkim-ijet/satellizer,jskrzypek/satellizer,thandaanda/satellizer,david300/satellizer,expertmaksud/satellizer
--- +++ @@ -1,5 +1,5 @@ angular.module('MyApp', ['ngResource', 'ngMessages', 'ngRoute', 'ngAuth', 'mgcrea.ngStrap']) - .config(['$routeProvider', function($routeProvider) { + .config(['$routeProvider', 'AuthProvider', function($routeProvider, AuthProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', @@ -24,8 +24,7 @@ .otherwise({ redirectTo: '/' }); - }]) - .config(['AuthProvider', function(AuthProvider) { + AuthProvider.configure({ apiUrl: '/api' });
614b4d791cf3660f1e84550cc17e86c2d10f5c9f
iscan/static/iscan/env.js
iscan/static/iscan/env.js
(function (window) { window.__env = window.__env || {}; window.__env.hostUrl = 'https://' + window.location.hostname +'/'; window.__env.apiUrl = window.__env.hostUrl+'api/'; window.__env.intontationUrl = window.__env.hostUrl +'intonation/'; window.__env.annotatorUrl = window.__env.hostUrl +'annotator/api/'; window.__env.baseUrl = '/'; window.__env.siteName = 'ISCAN'; window.__env.enableDebug = true; }(this));
(function (window) { window.__env = window.__env || {}; if (window.location.port) { window.__env.hostUrl = 'https://' + window.location.hostname + ':' + window.location.port + '/'; } else { window.__env.hostUrl = 'https://' + window.location.hostname + '/'; } window.__env.apiUrl = window.__env.hostUrl + 'api/'; window.__env.intontationUrl = window.__env.hostUrl + 'intonation/'; window.__env.annotatorUrl = window.__env.hostUrl + 'annotator/api/'; window.__env.baseUrl = '/'; window.__env.siteName = 'ISCAN'; window.__env.enableDebug = true; }(this));
Fix for missing port on API requests
Fix for missing port on API requests
JavaScript
mit
MontrealCorpusTools/polyglot-server,MontrealCorpusTools/polyglot-server,MontrealCorpusTools/polyglot-server,MontrealCorpusTools/polyglot-server
--- +++ @@ -1,10 +1,15 @@ (function (window) { - window.__env = window.__env || {}; - window.__env.hostUrl = 'https://' + window.location.hostname +'/'; - window.__env.apiUrl = window.__env.hostUrl+'api/'; - window.__env.intontationUrl = window.__env.hostUrl +'intonation/'; - window.__env.annotatorUrl = window.__env.hostUrl +'annotator/api/'; - window.__env.baseUrl = '/'; - window.__env.siteName = 'ISCAN'; - window.__env.enableDebug = true; + window.__env = window.__env || {}; + if (window.location.port) { + window.__env.hostUrl = 'https://' + window.location.hostname + ':' + window.location.port + '/'; + } + else { + window.__env.hostUrl = 'https://' + window.location.hostname + '/'; + } + window.__env.apiUrl = window.__env.hostUrl + 'api/'; + window.__env.intontationUrl = window.__env.hostUrl + 'intonation/'; + window.__env.annotatorUrl = window.__env.hostUrl + 'annotator/api/'; + window.__env.baseUrl = '/'; + window.__env.siteName = 'ISCAN'; + window.__env.enableDebug = true; }(this));
a707a26bd606f8b10e5610dec5f8f2743b6c41a4
example/test.js
example/test.js
var Compile = require('./index2.js') compile = Compile('b11bf50b8a391d4e8560e97fd9d63460') //Source Code to be compiled remotely var sourceCode = 'print 3*20' //Programming Language Selection var language = 'Python' //Input for the program var testCases = '' //'Run' routine compiles the code and return the answer object compile.Run(sourceCode,language,testCases, function(answer, error){ console.log(answer.langId) console.log(answer.langName) console.log(answer.output) console.log(answer.source) }) // Languages Supported by the API compile.languageSupport(function(languages) { console.log(languages) })
var Compile = require('../index.js') compile = Compile('b11bf50b8a391d4e8560e97fd9d63460') //Source Code to be compiled remotely var sourceCode = 'print 3*20' //Programming Language Selection var language = 'Python' //Input for the program var testCases = '' //'Run' routine compiles the code and return the answer object compile.Run(sourceCode,language,testCases, function(answer, error){ console.log(answer.langId) console.log(answer.langName) console.log(answer.output) console.log(answer.source) }) // Languages Supported by the API compile.languageSupport(function(languages) { console.log(languages) })
Fix mistypo on relative index.js
Fix mistypo on relative index.js
JavaScript
mit
saru95/ideone-npm
--- +++ @@ -1,4 +1,4 @@ -var Compile = require('./index2.js') +var Compile = require('../index.js') compile = Compile('b11bf50b8a391d4e8560e97fd9d63460')
1771ab50f1a5d3dbe06871a26bdfa31882e393ac
test/setup.js
test/setup.js
// From https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md var jsdom = require('jsdom').jsdom; var exposedProperties = ['window', 'navigator', 'document']; global.document = jsdom(''); global.window = document.defaultView; Object.keys(document.defaultView).forEach((property) => { if (typeof global[property] === 'undefined') { exposedProperties.push(property); global[property] = document.defaultView[property]; } }); // For some reason, this property does not get set above. global.Image = global.window.Image; global.navigator = { userAgent: 'node.js' }; // HACK: Polyfil that allows codemirror to render in a JSDOM env. global.window.document.createRange = function createRange() { return { setEnd: () => {}, setStart: () => {}, getBoundingClientRect: () => { return { right: 0 }; }, getClientRects: () => { return [] } } }; var mock = require('mock-require'); mock('electron-json-storage', { 'get': function(key, callback){ callback(null, { theme: 'light' }); }, 'set': function(key, json, callback) { callback(null); }, }) mock('electron', { 'shell': { 'openExternal': function(url) { }, }, })
// From https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md var jsdom = require('jsdom').jsdom; var exposedProperties = ['window', 'navigator', 'document']; global.document = jsdom(''); global.window = document.defaultView; Object.keys(document.defaultView).forEach((property) => { if (typeof global[property] === 'undefined') { exposedProperties.push(property); global[property] = document.defaultView[property]; } }); // For some reason, this property does not get set above. global.Image = global.window.Image; global.navigator = { userAgent: 'node.js' }; // HACK: Polyfil that allows codemirror to render in a JSDOM env. global.window.document.createRange = function createRange() { return { setEnd: () => {}, setStart: () => {}, getBoundingClientRect: () => { return { right: 0 }; }, getClientRects: () => { return [] } } }; var mock = require('mock-require'); mock('electron-json-storage', { 'get': function(key, callback){ callback(null, { theme: 'light' }); }, 'set': function(key, json, callback) { callback(null); }, }) mock('electron', { 'shell': { 'openExternal': function(url) { }, }, 'remote': { 'require': function(module) { if (module === 'electron') { return { 'dialog': function() { }, }; } }, }, })
Add mocks for menu tests
Add mocks for menu tests
JavaScript
bsd-3-clause
jdetle/nteract,jdfreder/nteract,jdetle/nteract,nteract/nteract,0u812/nteract,0u812/nteract,nteract/nteract,captainsafia/nteract,temogen/nteract,jdetle/nteract,nteract/composition,rgbkrk/nteract,nteract/nteract,0u812/nteract,captainsafia/nteract,nteract/composition,temogen/nteract,rgbkrk/nteract,rgbkrk/nteract,captainsafia/nteract,jdetle/nteract,captainsafia/nteract,jdfreder/nteract,nteract/composition,0u812/nteract,temogen/nteract,nteract/nteract,rgbkrk/nteract,jdfreder/nteract,nteract/nteract,jdfreder/nteract,rgbkrk/nteract
--- +++ @@ -48,4 +48,13 @@ 'shell': { 'openExternal': function(url) { }, }, + 'remote': { + 'require': function(module) { + if (module === 'electron') { + return { + 'dialog': function() { }, + }; + } + }, + }, })
662828ef56046bc7830718ef897a4ebbefd50278
examples/utils/embedly.js
examples/utils/embedly.js
// @flow const getJSON = ( endpoint: string, data: ?{}, successCallback: ({ url: string, title: string, author_name: string, thumbnail_url: string, }) => void, ) => { const request = new XMLHttpRequest(); request.open("GET", endpoint, true); request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); request.onload = () => { if (request.status >= 200 && request.status < 400) { successCallback(JSON.parse(request.responseText)); } }; request.send(data); }; /* global EMBEDLY_API_KEY */ const key = typeof EMBEDLY_API_KEY === "undefined" ? "key" : EMBEDLY_API_KEY; const EMBEDLY_ENDPOINT = `https://api.embedly.com/1/oembed?key=${key}`; const get = ( url: string, callback: ({ url: string, title: string, author_name: string, thumbnail_url: string, }) => void, ) => { getJSON(`${EMBEDLY_ENDPOINT}&url=${encodeURIComponent(url)}`, null, callback); }; export default { get, };
// @flow type Embed = { url: string, title: string, author_name: string, thumbnail_url: string, html: string, }; const getJSON = ( endpoint: string, data: ?{}, successCallback: (embed: Embed) => void, ) => { const request = new XMLHttpRequest(); request.open("GET", endpoint, true); request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); request.onload = () => { if (request.status >= 200 && request.status < 400) { successCallback(JSON.parse(request.responseText)); } }; request.send(data); }; /* global EMBEDLY_API_KEY */ const key = typeof EMBEDLY_API_KEY === "undefined" ? "key" : EMBEDLY_API_KEY; const EMBEDLY_ENDPOINT = `https://api.embedly.com/1/oembed?key=${key}`; const get = (url: string, callback: (embed: Embed) => void) => { getJSON(`${EMBEDLY_ENDPOINT}&url=${encodeURIComponent(url)}`, null, callback); }; export default { get, };
Support retrieving embed HTML in Embedly integration
Support retrieving embed HTML in Embedly integration
JavaScript
mit
springload/draftail,springload/draftail,springload/draftail,springload/draftail
--- +++ @@ -1,14 +1,17 @@ // @flow + +type Embed = { + url: string, + title: string, + author_name: string, + thumbnail_url: string, + html: string, +}; const getJSON = ( endpoint: string, data: ?{}, - successCallback: ({ - url: string, - title: string, - author_name: string, - thumbnail_url: string, - }) => void, + successCallback: (embed: Embed) => void, ) => { const request = new XMLHttpRequest(); request.open("GET", endpoint, true); @@ -25,15 +28,7 @@ const key = typeof EMBEDLY_API_KEY === "undefined" ? "key" : EMBEDLY_API_KEY; const EMBEDLY_ENDPOINT = `https://api.embedly.com/1/oembed?key=${key}`; -const get = ( - url: string, - callback: ({ - url: string, - title: string, - author_name: string, - thumbnail_url: string, - }) => void, -) => { +const get = (url: string, callback: (embed: Embed) => void) => { getJSON(`${EMBEDLY_ENDPOINT}&url=${encodeURIComponent(url)}`, null, callback); };
05c19987d3f569aa892d50755c757a6356e4a9f1
environments/react/v15.js
environments/react/v15.js
/** * Js-coding-standards * * @author Robert Rossmann <rr.rossmann@me.com> * @copyright 2016 STRV * @license http://choosealicense.com/licenses/bsd-3-clause BSD-3-Clause License */ 'use strict' module.exports = { extends: [ './recommended.js', './accessibility.js', ], rules: { 'operator-linebreak': 0, 'require-jsdoc': 0, // Disallow Use of console // Turned off for React apps, console is quite useful in browsers 'no-console': 0, }, plugins: [ 'react', ], // Configures the react plugin to treat some rules with regard to this specific React.js version settings: { react: { version: '15.5', }, }, }
/** * Js-coding-standards * * @author Robert Rossmann <rr.rossmann@me.com> * @copyright 2016 STRV * @license http://choosealicense.com/licenses/bsd-3-clause BSD-3-Clause License */ 'use strict' module.exports = { extends: [ './recommended.js', './accessibility.js', ], rules: { 'operator-linebreak': 0, 'require-jsdoc': 0, }, plugins: [ 'react', ], // Configures the react plugin to treat some rules with regard to this specific React.js version settings: { react: { version: '15.5', }, }, }
Fix console still being turned off for react env
Fix console still being turned off for react env
JavaScript
bsd-3-clause
strvcom/js-coding-standards,strvcom/eslint-config-javascript,strvcom/eslint-config-javascript
--- +++ @@ -18,9 +18,6 @@ rules: { 'operator-linebreak': 0, 'require-jsdoc': 0, - // Disallow Use of console - // Turned off for React apps, console is quite useful in browsers - 'no-console': 0, }, plugins: [
d607447c7a4ee04fd559ba44f4fbb07ad42b8453
src/components/Counter.js
src/components/Counter.js
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as counterActions from '../actions/counterActions'; import { dispatch } from '../store'; @connect(state => ({ counter: state.counter, })) export class Counter extends Component { static propTypes = { counter: PropTypes.number, }; constructor(props) { super(props); } render() { return ( <div> <h2>Counter: {this.props.counter}</h2> <button onClick={() => dispatch(counterActions.decrement())}>-</button> <button onClick={() => dispatch(counterActions.increment())}>+</button> </div> ); } }
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as counterActions from '../actions/counterActions'; import { dispatch } from '../store'; @connect(state => ({ counter: state.counter, })) export class Counter extends Component { static propTypes = { counter: PropTypes.number, }; static defaultProps = { counter: 0, }; state = {}; constructor(props) { super(props); } render() { return ( <div> <h2>Counter: {this.props.counter}</h2> <button onClick={() => dispatch(counterActions.decrement())}>-</button> <button onClick={() => dispatch(counterActions.increment())}>+</button> </div> ); } }
Add defaultProps and initial state.
Add defaultProps and initial state.
JavaScript
mit
autozimu/react-hot-boilerplate,autozimu/react-hot-boilerplate
--- +++ @@ -10,6 +10,12 @@ static propTypes = { counter: PropTypes.number, }; + + static defaultProps = { + counter: 0, + }; + + state = {}; constructor(props) { super(props);
8999a66c88e56bc769bded0fe1ec17e0360682b5
src/core/cb.main/main.js
src/core/cb.main/main.js
function setup(options, imports, register) { // Import var server = imports.server.http; var port = imports.server.port; var watch = imports.watch; var workspace = imports.workspace; var logger = imports.logger.namespace("codebox"); // Start server server.listen(port); server.on('listening', function() { logger.log("Server is listening on ", port); watch.init(workspace.root) .then(function() { logger.log("Started Watch"); }) .fail(function(err) { logger.error("Failed to start Watch because of:"); logger.exception(err, false); }).fin(function() { // Register register(null, {}); }); }) } // Exports module.exports = setup;
function setup(options, imports, register) { // Import var server = imports.server.http; var port = imports.server.port; var watch = imports.watch; var workspace = imports.workspace; var logger = imports.logger.namespace("codebox"); // Start server server.listen(port); server.on('listening', function() { logger.log("Server is listening on ", port); }); watch.init(workspace.root) .then(function() { logger.log("Started Watch"); }) .fail(function(err) { logger.error("Failed to start Watch because of:"); logger.exception(err, false); }).fin(function() { // Register register(null, {}); }); } // Exports module.exports = setup;
Change init of watch and server
Change init of watch and server
JavaScript
apache-2.0
rajthilakmca/codebox,code-box/codebox,code-box/codebox,fly19890211/codebox,etopian/codebox,nobutakaoshiro/codebox,indykish/codebox,Ckai1991/codebox,fly19890211/codebox,CodeboxIDE/codebox,lcamilo15/codebox,kustomzone/codebox,lcamilo15/codebox,ronoaldo/codebox,ronoaldo/codebox,listepo/codebox,rajthilakmca/codebox,indykish/codebox,ahmadassaf/Codebox,Ckai1991/codebox,ahmadassaf/Codebox,etopian/codebox,quietdog/codebox,LogeshEswar/codebox,CodeboxIDE/codebox,quietdog/codebox,nobutakaoshiro/codebox,kustomzone/codebox,LogeshEswar/codebox,smallbal/codebox,blubrackets/codebox,listepo/codebox,rodrigues-daniel/codebox,blubrackets/codebox,smallbal/codebox,rodrigues-daniel/codebox
--- +++ @@ -11,18 +11,19 @@ server.on('listening', function() { logger.log("Server is listening on ", port); - watch.init(workspace.root) - .then(function() { - logger.log("Started Watch"); - }) - .fail(function(err) { - logger.error("Failed to start Watch because of:"); - logger.exception(err, false); - }).fin(function() { - // Register - register(null, {}); - }); + }); + + watch.init(workspace.root) + .then(function() { + logger.log("Started Watch"); }) + .fail(function(err) { + logger.error("Failed to start Watch because of:"); + logger.exception(err, false); + }).fin(function() { + // Register + register(null, {}); + }); } // Exports
715fec370fa84ee9687a3e1f34e942a37cdf9dd7
src/js/editing/History.js
src/js/editing/History.js
define(['summernote/core/range'], function (range) { /** * @class editing.History * * Editor History * */ var History = function ($editable) { var stack = [], stackOffset = -1; var editable = $editable[0]; var makeSnapshot = function () { var rng = range.create(); var emptyBookmark = {s: {path: [0], offset: 0}, e: {path: [0], offset: 0}}; return { contents: $editable.html(), bookmark: (rng ? rng.bookmark(editable) : emptyBookmark) }; }; var applySnapshot = function (snapshot) { if (snapshot.contents !== null) { $editable.html(snapshot.contents); } if (snapshot.bookmark !== null) { range.createFromBookmark(editable, snapshot.bookmark).select(); } }; /** * undo */ this.undo = function () { if (0 < stackOffset) { stackOffset--; applySnapshot(stack[stackOffset]); } }; /** * redo */ this.redo = function () { if (stack.length - 1 > stackOffset) { stackOffset++; applySnapshot(stack[stackOffset]); } }; /** * recorded undo */ this.recordUndo = function () { stackOffset++; // Wash out stack after stackOffset if (stack.length > stackOffset) { stack = stack.slice(0, stackOffset); } // Create new snapshot and push it to the end stack.push(makeSnapshot()); }; // Create first undo stack this.recordUndo(); }; return History; });
define(['summernote/core/range'], function (range) { /** * @class editing.History * * Editor History * */ var History = function ($editable) { var stack = [], stackOffset = -1; var editable = $editable[0]; var makeSnapshot = function () { var rng = range.create(); var emptyBookmark = {s: {path: [], offset: 0}, e: {path: [], offset: 0}}; return { contents: $editable.html(), bookmark: (rng ? rng.bookmark(editable) : emptyBookmark) }; }; var applySnapshot = function (snapshot) { if (snapshot.contents !== null) { $editable.html(snapshot.contents); } if (snapshot.bookmark !== null) { range.createFromBookmark(editable, snapshot.bookmark).select(); } }; /** * undo */ this.undo = function () { if (0 < stackOffset) { stackOffset--; applySnapshot(stack[stackOffset]); } }; /** * redo */ this.redo = function () { if (stack.length - 1 > stackOffset) { stackOffset++; applySnapshot(stack[stackOffset]); } }; /** * recorded undo */ this.recordUndo = function () { stackOffset++; // Wash out stack after stackOffset if (stack.length > stackOffset) { stack = stack.slice(0, stackOffset); } // Create new snapshot and push it to the end stack.push(makeSnapshot()); }; // Create first undo stack this.recordUndo(); }; return History; });
Fix script error when last undo.
Fix script error when last undo.
JavaScript
mit
bebeeteam/summernote,summernote/summernote,summernote/summernote,AshDevFr/winternote,summernote/summernote,bebeeteam/summernote,bebeeteam/summernote,AshDevFr/winternote,AshDevFr/winternote
--- +++ @@ -11,7 +11,7 @@ var makeSnapshot = function () { var rng = range.create(); - var emptyBookmark = {s: {path: [0], offset: 0}, e: {path: [0], offset: 0}}; + var emptyBookmark = {s: {path: [], offset: 0}, e: {path: [], offset: 0}}; return { contents: $editable.html(),
68bb8489b6fe7b2466159b2e5b9e08c21c466588
src/button.js
src/button.js
const React = require('react'); const classNames = require('classnames'); class Button extends React.Component { render() { const { className, children, type, ...props } = this.props; const buttonClassNames = classNames({ btn: true, 'btn-sm': this.props.size === 'small', 'btn-xs': this.props.size === 'extra-small', 'btn-lg': this.props.size === 'large', [`btn-${this.props.type}`]: true, }, className); return <button type="button" {...props} className={buttonClassNames} > {children} </button>; } } Button.propTypes = { size: React.PropTypes.oneOf([ 'small', 'extra-small', 'large', ]), type: React.PropTypes.oneOf([ 'default', 'danger', 'success', 'info' ]), className: React.PropTypes.string, children: React.PropTypes.node, }; Button.defaultProps = { type: 'default' }; module.exports = Button;
const React = require('react'); const classNames = require('classnames'); class Button extends React.Component { render() { const { className, children, theme, ...props } = this.props; const buttonClassNames = classNames({ btn: true, 'btn-sm': this.props.size === 'small', 'btn-xs': this.props.size === 'extra-small', 'btn-lg': this.props.size === 'large', [`btn-${this.props.theme}`]: true, }, className); return ( <button {...props} className={buttonClassNames}> {children} </button> ); } } Button.propTypes = { size: React.PropTypes.oneOf([ 'small', 'extra-small', 'large', ]), type: React.PropTypes.oneOf([ 'button', 'submit', ]), theme: React.PropTypes.oneOf([ 'default', 'danger', 'success', 'info' ]), className: React.PropTypes.string, children: React.PropTypes.node, }; Button.defaultProps = { type: 'button', theme: 'default' }; module.exports = Button;
Change `type` prop to `theme`
Change `type` prop to `theme`
JavaScript
mit
Opstarts/opstarts-ui
--- +++ @@ -6,7 +6,7 @@ const { className, children, - type, + theme, ...props } = this.props; @@ -15,16 +15,16 @@ 'btn-sm': this.props.size === 'small', 'btn-xs': this.props.size === 'extra-small', 'btn-lg': this.props.size === 'large', - [`btn-${this.props.type}`]: true, + [`btn-${this.props.theme}`]: true, }, className); - return <button - type="button" - {...props} - className={buttonClassNames} - > - {children} - </button>; + return ( + <button + {...props} + className={buttonClassNames}> + {children} + </button> + ); } } @@ -33,6 +33,9 @@ 'small', 'extra-small', 'large', ]), type: React.PropTypes.oneOf([ + 'button', 'submit', + ]), + theme: React.PropTypes.oneOf([ 'default', 'danger', 'success', 'info' ]), className: React.PropTypes.string, @@ -40,7 +43,8 @@ }; Button.defaultProps = { - type: 'default' + type: 'button', + theme: 'default' };