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 |
|---|---|---|---|---|---|---|---|---|---|---|
2042a3e49ee1e3ab461f79acd488d34b2d5ec219 | editor/js/Menubar.Status.js | editor/js/Menubar.Status.js | /**
* @author mrdoob / http://mrdoob.com/
*/
Menubar.Status = function ( editor ) {
var container = new UI.Panel();
container.setClass( 'menu right' );
var checkbox = new UI.Checkbox( editor.config.getKey( 'autosave' ) );
checkbox.onChange( function () {
editor.config.setKey( 'autosave', this.getValue() );
} );
container.add( checkbox );
var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'Autosave' );
container.add( title );
editor.signals.savingStarted.add( function () {
title.setTextDecoration( 'underline' );
} );
editor.signals.savingFinished.add( function () {
title.setTextDecoration( 'none' );
} );
return container;
};
| /**
* @author mrdoob / http://mrdoob.com/
*/
Menubar.Status = function ( editor ) {
var container = new UI.Panel();
container.setClass( 'menu right' );
var checkbox = new UI.Checkbox( editor.config.getKey( 'autosave' ) );
checkbox.onChange( function () {
var value = this.getValue();
editor.config.setKey( 'autosave', value );
if ( value === true ) {
editor.signals.sceneGraphChanged.dispatch();
}
} );
container.add( checkbox );
var title = new UI.Panel();
title.setClass( 'title' );
title.setTextContent( 'Autosave' );
container.add( title );
editor.signals.savingStarted.add( function () {
title.setTextDecoration( 'underline' );
} );
editor.signals.savingFinished.add( function () {
title.setTextDecoration( 'none' );
} );
return container;
};
| Save scene when enabling autosave. | Editor: Save scene when enabling autosave. | JavaScript | mit | srifqi/three.js,NicolasRannou/three.js,colombod/three.js,dhritzkiv/three.js,Zerschmetterling91/three.js,matgr1/three.js,njam/three.js,aardgoose/three.js,tamarintech/three.js,dushmis/three.js,stevenliujw/three.js,WoodMath/three.js,hacksalot/three.js,davidvmckay/three.js,ZhenxingWu/three.js,fta2012/three.js,AntTech/three.js,tdmsinc/three.js,takahirox/three.js,satori99/three.js,rlugojr/three.js,tamarintech/three.js,amakaroff82/three.js,Jonham/three.js,Seagat2011/three.js,elisee/three.js,rgaino/three.js,threejsworker/three.js,TristanVALCKE/three.js,sasha240100/three.js,elephantatwork/ZAAK.IO-EditorInternal,elisee/three.js,toxicFork/three.js,NicolasRannou/three.js,Samsy/three.js,elephantatwork/three.js,ondys/three.js,liusashmily/three.js,gsssrao/three.js,Aldrien-/three.js,robmyers/three.js,controlzee/three.js,toxicFork/three.js,godlzr/Three.js,eq0rip/three.js,stanford-gfx/three.js,matgr1/three.js,brianchirls/three.js,tdmsinc/three.js,byhj/three.js,pailhead/three.js,amazg/three.js,mese79/three.js,0merta/three.js,dhritzkiv/three.js,meizhoubao/three.js,mrdoob/three.js,Nitrillo/three.js,coderrick/three.js,vizorvr/three.js,DeanLym/three.js,unconed/three.js,MasterJames/three.js,JingYongWang/three.js,dimensia/three.js,p5150j/three.js,fomenyesu/three.js,rbarraud/three.js,jango2015/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,eq0rip/three.js,mese79/three.js,datalink747/three.js,huobaowangxi/three.js,pletzer/three.js,SatoshiKawabata/three.js,rbarraud/three.js,gdebojyoti/three.js,coffeine-009/three.js,lovewitty/three.js,mattholl/three.js,SET001/three.js,beni55/three.js,Joeldk/three.js,cc272309126/three.js,Liuer/three.js,carlosanunes/three.js,benaadams/three.js,coderrick/three.js,VimVincent/three.js,redheli/three.js,JeckoHeroOrg/three.js,Astrak/three.js,ducminhn/three.js,ngokevin/three.js,podgorskiy/three.js,lchl7890987/WebGL,swieder227/three.js,flimshaw/three.js,vizorvr/three.js,sasha240100/three.js,Stinkdigital/three.js,srifqi/three.js,easz/three.js,Astrak/three.js,missingdays/three.js-amd,lovewitty/three.js,surround-io/three.js,GammaGammaRay/three.js,blokhin/three.js,alexbelyeu/three.js,satori99/three.js,toxicFork/three.js,jpweeks/three.js,holmberd/three.js,Black-Alpha/three.js,mattholl/three.js,dubejf/three.js,sreith1/three.js,brickify/three.js,jayschwa/three.js,eq0rip/three.js,Samsung-Blue/three.js,Gheehnest/three.js,MasterJames/three.js,jzitelli/three.js,Gheehnest/three.js,benaadams/three.js,SatoshiKawabata/three.js,Gheehnest/three.js,jeromeetienne/three.js,snovak/three.js,rfm1201/rfm.three.js,dubejf/three.js,YajunQiu/three.js,humbletim/three.js,Fox32/three.js,spite/three.js,arodic/three.js,AlexanderMazaletskiy/three.js,takahirox/three.js,wuxinwei240/three.js,sttz/three.js,sufeiou/three.js,kkjeer/three.js,gigakiller/three.js,opensim-org/three.js,arodic/three.js,arodic/three.js,Delejnr/three.js,MetaStackers/three.js,liammagee/three.js,donmccurdy/three.js,blokhin/three.js,redheli/three.js,JeckoHeroOrg/three.js,quinonez/three.js,lag945/three.js,anvaka/three.js,AdactiveSAS/three.js,fernandojsg/three.js,Ludobaka/three.js,camellhf/three.js,VimVincent/three.js,quinonez/three.js,Nitrillo/three.js,AltspaceVR/three.js,camellhf/three.js,Hectate/three.js,DelvarWorld/three.js,jeromeetienne/three.js,hedgerh/three.js,agnivade/three.js,thomasxu1991/three.js,ngokevin/three.js,ngokevin/three.js,xundaokeji/three.js,BenediktS/three.js,Kakakakakku/three.js,yxxme/three.js,BrianSipple/three.js,jayschwa/three.js,bdysvik/three.js,ma-tech/three.js,timcastelijn/three.js,mese79/three.js,coloringchaos/three.js,MarcusLongmuir/three.js,erich666/three.js,tschw/three.js,JuudeDemos/three.js,Leeft/three.js,Samsung-Blue/three.js,IceCreamYou/three.js,gpranay4/three.js,erich666/three.js,matgr1/three.js,shanmugamss/three.js-modified,fkammer/three.js,wuxinwei240/three.js,archilogic-ch/three.js,mainelander/three.js,matthartman/oculus-matt,borismus/three.js,AltspaceVR/three.js,Fox32/three.js,jllodra/three.js,Aldrien-/three.js,BenediktS/three.js,Ymaril/three.js,ZhenxingWu/three.js,gigakiller/three.js,dubejf/three.js,dhritzkiv/three.js,camellhf/three.js,alexconlin/three.js,redheli/three.js,nhalloran/three.js,DelvarWorld/three.js,leitzler/three.js,rgaino/three.js,unphased/three.js,Amritesh/three.js,JeckoHeroOrg/three.js,brianchirls/three.js,lchl7890987/WebGL,Kasual666/WebGl,pailhead/three.js,mainelander/three.js,HongJunLi/three.js,sweetmandm/three.js,StefanHuzz/three.js,g-rocket/three.js,vizorvr/three.js,tdmsinc/three.js,kkjeer/three.js,RAtechntukan/three.js,surround-io/three.js,daoshengmu/three.js,mabo77/three.js,nraynaud/three.js,programulya/three.js,111t8e/three.js,mabo77/three.js,elisee/three.js,lchl7890987/WebGL,richtr/three.js,coderrick/three.js,supergometan/three.js,wuxinwei240/three.js,prika/three.js,elephantatwork/three.js,mess110/three.js,dushmis/three.js,digital360/three.js,QingchaoHu/three.js,mainelander/three.js,luxigo/three.js,wanby/three.js,JeckoHeroOrg/three.js,sunbc0120/three.js,NicolasRannou/three.js,sherousee/three.js,chuckfairy/three.js,anvaka/three.js,aleen42/three.js,fkammer/three.js,godlzr/Three.js,plepers/three.js,mhoangvslev/data-visualizer,rayantony/three.js,StefanHuzz/three.js,dglogik/three.js,wizztjh/three.js,carlosanunes/three.js,acrsteiner/three.js,gero3/three.js,edge/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,leitzler/three.js,anvaka/three.js,nraynaud/three.js,ValtoLibraries/ThreeJS,mindofmatthew/three.js,gpranay4/three.js,mhoangvslev/data-visualizer,gpranay4/three.js,ngokevin/three-dev,unphased/three.js,yrns/three.js,Jozain/three.js,mataron/three.js,nopjia/three.js,liusashmily/three.js,rlugojr/three.js,elephantatwork/three.js,DeanLym/three.js,HongJunLi/three.js,TristanVALCKE/three.js,rlugojr/three.js,GammaGammaRay/three.js,brickify/three.js,leeric92/three.js,q437634645/three.js,pletzer/three.js,Seagat2011/three.js,rougier/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,ThiagoGarciaAlves/three.js,rlugojr/three.js,swieder227/three.js,VimVincent/three.js,RAtechntukan/three.js,Wilt/three.js,rougier/three.js,mataron/three.js,jayhetee/three.js,RemusMar/three.js,StefanHuzz/three.js,Delejnr/three.js,huobaowangxi/three.js,richtr/three.js,Nitrillo/three.js,beni55/three.js,archcomet/three.js,GammaGammaRay/three.js,holmberd/three.js,jayschwa/three.js,Black-Alpha/three.js,mese79/three.js,stevenliujw/three.js,agnivade/three.js,SatoshiKawabata/three.js,takahirox/three.js,rfm1201/rfm.three.js,Joeldk/three.js,Zerschmetterling91/three.js,Itee/three.js,erich666/three.js,stevenliujw/three.js,coffeine-009/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,elephantatwork/ZAAK.IO-EditorInternal,prabhu-k/three.js,LaughingSun/three.js,unconed/three.js,rougier/three.js,gigakiller/three.js,Seagat2011/three.js,RAtechntukan/three.js,wuxinwei240/three.js,0merta/three.js,AdactiveSAS/three.js,hacksalot/three.js,Jericho25/three.js,lollerbus/three.js,Stinkdigital/three.js,programulya/three.js,WoodMath/three.js,Astrak/three.js,ValtoLibraries/ThreeJS,Jonham/three.js,julapy/three.js,sitexa/three.js,carlosanunes/three.js,ZhenxingWu/three.js,wavesoft/three.js,wanby/three.js,Wilt/three.js,liammagee/three.js,takahirox/three.js,Zerschmetterling91/three.js,JuudeDemos/three.js,masterex1000/three.js,dhritzkiv/three.js,lchl7890987/WebGL,podgorskiy/three.js,AltspaceVR/three.js,GGAlanSmithee/three.js,sufeiou/three.js,AVGP/three.js,gwindes/three.js,YajunQiu/three.js,archilogic-com/three.js,simonThiele/three.js,podgorskiy/three.js,mrkev/three.js,YajunQiu/three.js,jeromeetienne/three.js,applexiaohao/three.js,matthiascy/three.js,sreith1/three.js,jostschmithals/three.js,coffeine-009/three.js,TristanVALCKE/three.js,Delejnr/three.js,Jonham/three.js,jayschwa/three.js,AltspaceVR/three.js,fta2012/three.js,zhanglingkang/three.js,jzitelli/three.js,Jerdak/three.js,VimVincent/three.js,sebasbaumh/three.js,Meshu/three.js,datalink747/three.js,mattdesl/three.js,UnboundVR/three.js,NicolasRannou/three.js,mudithkr/three.js,alexbelyeu/three.js,SpookW/three.js,fraguada/three.js,Jerdak/three.js,brason/three.js,richtr/three.js,mattdesl/three.js,JingYongWang/three.js,fta2012/three.js,julapy/three.js,dyx/three.js,stanford-gfx/three.js,timcastelijn/three.js,thomasxu1991/three.js,dimensia/three.js,dyx/three.js,robmyers/three.js,DeanLym/three.js,lag945/three.js,robsix/3ditor,haozi23333/three.js,borismus/three.js,Amritesh/three.js,AntTech/three.js,rayantony/three.js,prabhu-k/three.js,fernandojsg/three.js,chaoallsome/three.js,Leeft/three.js,JamesHagerman/three.js,haozi23333/three.js,RAtechntukan/three.js,nopjia/three.js,SpinVR/three.js,AscensionFoundation/three.js,matthartman/oculus-matt,freekh/three.js,jostschmithals/three.js,supergometan/three.js,zhangwenyan/three.js,ndebeiss/three.js,AlexanderMazaletskiy/three.js,wizztjh/three.js,jayhetee/three.js,prika/three.js,amakaroff82/three.js,Jericho25/three.js,yifanhunyc/three.js,erich666/three.js,stevenliujw/three.js,brickify/three.js,jllodra/three.js,coloringchaos/three.js,SET001/three.js,Peekmo/three.js,SatoshiKawabata/three.js,lollerbus/three.js,jeffgoku/three.js,pharos3d/three.js,applexiaohao/three.js,dayo7116/three.js,Black-Alpha/three.js,crazyyaoyao/yaoyao,Zerschmetterling91/three.js,coffeine-009/three.js,leeric92/three.js,WoodMath/three.js,gwindes/three.js,matthiascy/three.js,Delejnr/three.js,JingYongWang/three.js,AlexanderMazaletskiy/three.js,sweetmandm/three.js,freekh/three.js,Coburn37/three.js,arodic/three.js,StefanHuzz/three.js,srifqi/three.js,jee7/three.js,unphased/three.js,MasterJames/three.js,ngokevin/three.js,byhj/three.js,edge/three.js,Joeldk/three.js,Wilt/three.js,GammaGammaRay/three.js,zbm2001/three.js,gwindes/three.js,Kasual666/WebGl,yifanhunyc/three.js,kaisalmen/three.js,NicolasRannou/three.js,holmberd/three.js,tamarintech/three.js,AntTech/three.js,amazg/three.js,spite/three.js,unconed/three.js,DelvarWorld/three.js,BrianSipple/three.js,dushmis/three.js,SET001/three.js,Samsung-Blue/three.js,Peekmo/three.js,MarcusLongmuir/three.js,UnboundVR/three.js,masterex1000/three.js,ondys/three.js,GastonBeaucage/three.js,vizorvr/three.js,TristanVALCKE/three.js,JamesHagerman/three.js,wanby/three.js,mess110/three.js,chaoallsome/three.js,AlexanderMazaletskiy/three.js,xundaokeji/three.js,shanmugamss/three.js-modified,YajunQiu/three.js,ilovezy/three.js,ValtoLibraries/ThreeJS,dforrer/three.js,arodic/three.js,AscensionFoundation/three.js,mkkellogg/three.js,spite/three.js,Jozain/three.js,Mohammed-Ashour/three.js,RemusMar/three.js,threejsworker/three.js,jllodra/three.js,sebasbaumh/three.js,GGAlanSmithee/three.js,ilovezy/three.js,fanzhanggoogle/three.js,rbarraud/three.js,zhanglingkang/three.js,applexiaohao/three.js,timcastelijn/three.js,humbletim/three.js,Wilt/three.js,Pro/three.js,alexconlin/three.js,stopyransky/three.js,colombod/three.js,zbm2001/three.js,snipermiller/three.js,erich666/three.js,pharos3d/three.js,simonThiele/three.js,Coburn37/three.js,GammaGammaRay/three.js,gsssrao/three.js,toguri/three.js,prika/three.js,lovewitty/three.js,Ludobaka/three.js,Leeft/three.js,RemusMar/three.js,gdebojyoti/three.js,ndebeiss/three.js,byhj/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,pletzer/three.js,Ludobaka/three.js,jango2015/three.js,Astrak/three.js,Black-Alpha/three.js,googlecreativelab/three.js,zodsoft/three.js,mkkellogg/three.js,sheafferusa/three.js,Kasual666/WebGl,Mohammed-Ashour/three.js,GGAlanSmithee/three.js,meizhoubao/three.js,rougier/three.js,SpookW/three.js,GGAlanSmithee/three.js,zhangwenyan/three.js,SpookW/three.js,WestLangley/three.js,Hectate/three.js,xundaokeji/three.js,wanby/three.js,liammagee/three.js,JeckoHeroOrg/three.js,jeffgoku/three.js,alienity/three.js,nadirhamid/three.js,sitexa/three.js,gveltri/three.js,nopjia/three.js,Itee/three.js,thomasxu1991/three.js,MetaStackers/three.js,matgr1/three.js,yrns/three.js,q437634645/three.js,nraynaud/three.js,makc/three.js.fork,GastonBeaucage/three.js,sufeiou/three.js,dyx/three.js,YajunQiu/three.js,surround-io/three.js,snipermiller/three.js,redheli/three.js,JamesHagerman/three.js,Wilt/three.js,unphased/three.js,anvaka/three.js,srifqi/three.js,jayschwa/three.js,brason/three.js,coffeine-009/three.js,mess110/three.js,amakaroff82/three.js,archilogic-com/three.js,fkammer/three.js,sufeiou/three.js,cadenasgmbh/three.js,mess110/three.js,Joeldk/three.js,hedgerh/three.js,bhouston/three.js,julapy/three.js,dushmis/three.js,missingdays/three.js-amd,ngokevin/three.js,Seagat2011/three.js,datalink747/three.js,tschw/three.js,framelab/three.js,r8o8s1e0/three.js,Samsy/three.js,gveltri/three.js,gdebojyoti/three.js,plepers/three.js,godlzr/Three.js,podgorskiy/three.js,beni55/three.js,WoodMath/three.js,zodsoft/three.js,gwindes/three.js,aleen42/three.js,Leeft/three.js,imshibaji/three.js,ondys/three.js,zhoushijie163/three.js,programulya/three.js,dubejf/three.js,googlecreativelab/three.js,hsimpson/three.js,elephantatwork/ZAAK.IO-EditorInternal,liusashmily/three.js,fraguada/three.js,mainelander/three.js,dforrer/three.js,carlosanunes/three.js,hsimpson/three.js,zeropaper/three.js,Ymaril/three.js,zodsoft/three.js,flimshaw/three.js,3DGEOM/three.js,gigakiller/three.js,Amritesh/three.js,Peekmo/three.js,gigakiller/three.js,applexiaohao/three.js,daoshengmu/three.js,haozi23333/three.js,BrianSipple/three.js,Aldrien-/three.js,Zerschmetterling91/three.js,Jericho25/three.js,nhalloran/three.js,Ymaril/three.js,IceCreamYou/three.js,missingdays/three.js-amd,eq0rip/three.js,Pro/three.js,alexconlin/three.js,fraguada/three.js,acrsteiner/three.js,yifanhunyc/three.js,SET001/three.js,datalink747/three.js,amakaroff82/three.js,matthartman/oculus-matt,StefanHuzz/three.js,mataron/three.js,stevenliujw/three.js,missingdays/three.js-amd,njam/three.js,ngokevin/three-dev,3DGEOM/three.js,archilogic-ch/three.js,GGAlanSmithee/three.js,liusashmily/three.js,matthiascy/three.js,Fox32/three.js,holmberd/three.js,pharos3d/three.js,masterex1000/three.js,zhangwenyan/three.js,davidvmckay/three.js,sasha240100/three.js,r8o8s1e0/three.js,jee7/three.js,fomenyesu/three.js,sebasbaumh/three.js,satori99/three.js,njam/three.js,JuudeDemos/three.js,edivancamargo/three.js,shinate/three.js,simonThiele/three.js,ilovezy/three.js,coloringchaos/three.js,acrsteiner/three.js,programulya/three.js,easz/three.js,mabo77/three.js,Hectate/three.js,masterex1000/three.js,fluxio/three.js,AntTech/three.js,mattdesl/three.js,UnboundVR/three.js,mudithkr/three.js,IceCreamYou/three.js,zodsoft/three.js,jeromeetienne/three.js,dimensia/three.js,sreith1/three.js,alexbelyeu/three.js,q437634645/three.js,arose/three.js,yuhualingfeng/three.js,LeoEatle/three.js,p5150j/three.js,LaughingSun/three.js,ondys/three.js,ikerr/three.js,cc272309126/three.js,ikerr/three.js,nadirhamid/three.js,meizhoubao/three.js,zatchgordon/webGL,ThiagoGarciaAlves/three.js,YajunQiu/three.js,zatchgordon/webGL,Nitrillo/three.js,Aldrien-/three.js,bdysvik/three.js,mindofmatthew/three.js,matgr1/three.js,hsimpson/three.js,camellhf/three.js,fluxio/three.js,toxicFork/three.js,jzitelli/three.js,kaisalmen/three.js,rgaino/three.js,dayo7116/three.js,HongJunLi/three.js,Samsy/three.js,leitzler/three.js,ilovezy/three.js,Ymaril/three.js,DelvarWorld/three.js,nopjia/three.js,crazyyaoyao/yaoyao,anvaka/three.js,haozi23333/three.js,BenediktS/three.js,Meshu/three.js,jostschmithals/three.js,davidvmckay/three.js,humbletim/three.js,BrianSipple/three.js,chuckfairy/three.js,Coburn37/three.js,fluxio/three.js,zhangwenyan/three.js,sunbc0120/three.js,billfeller/three.js,zbm2001/three.js,TristanVALCKE/three.js,jeromeetienne/three.js,threejsworker/three.js,imshibaji/three.js,MarcusLongmuir/three.js,3DGEOM/three.js,snipermiller/three.js,alexbelyeu/three.js,bdysvik/three.js,podgorskiy/three.js,LeoEatle/three.js,sasha240100/three.js,ducminhn/three.js,Fox32/three.js,MasterJames/three.js,flimshaw/three.js,pharos3d/three.js,meizhoubao/three.js,googlecreativelab/three.js,06wj/three.js,elephantatwork/ZAAK.IO-EditorInternal,Pro/three.js,surround-io/three.js,nraynaud/three.js,crazyyaoyao/yaoyao,AlexanderMazaletskiy/three.js,Pro/three.js,Pro/three.js,agnivade/three.js,fraguada/three.js,podgorskiy/three.js,fanzhanggoogle/three.js,Seagat2011/three.js,cc272309126/three.js,njam/three.js,AdactiveSAS/three.js,fomenyesu/three.js,0merta/three.js,spite/three.js,cc272309126/three.js,fkammer/three.js,zbm2001/three.js,fluxio/three.js,rayantony/three.js,shinate/three.js,coderrick/three.js,jayhetee/three.js,GammaGammaRay/three.js,jbaicoianu/three.js,Ymaril/three.js,mrdoob/three.js,edivancamargo/three.js,mattdesl/three.js,SatoshiKawabata/three.js,archilogic-com/three.js,nopjia/three.js,archcomet/three.js,byhj/three.js,jbaicoianu/three.js,Mohammed-Ashour/three.js,Meshu/three.js,hedgerh/three.js,sitexa/three.js,gsssrao/three.js,DelvarWorld/three.js,alienity/three.js,alexbelyeu/three.js,luxigo/three.js,kkjeer/three.js,pletzer/three.js,dglogik/three.js,dimensia/three.js,wavesoft/three.js,GastonBeaucage/three.js,JingYongWang/three.js,godlzr/Three.js,MetaStackers/three.js,nadirhamid/three.js,Leeft/three.js,jbaicoianu/three.js,HongJunLi/three.js,shanmugamss/three.js-modified,ilovezy/three.js,dushmis/three.js,Black-Alpha/three.js,AVGP/three.js,ondys/three.js,enche/three.js,fkammer/three.js,tdmsinc/three.js,QingchaoHu/three.js,r8o8s1e0/three.js,mrkev/three.js,ducminhn/three.js,amazg/three.js,zhanglingkang/three.js,Kasual666/WebGl,mudithkr/three.js,mrkev/three.js,SET001/three.js,gveltri/three.js,mhoangvslev/data-visualizer,rfm1201/rfm.three.js,jayhetee/three.js,Kakakakakku/three.js,StefanHuzz/three.js,yxxme/three.js,mrkev/three.js,ZAAK-ZURICHBERLIN/ZAAK.IO-Editor,srifqi/three.js,thomasxu1991/three.js,alexconlin/three.js,satori99/three.js,dushmis/three.js,Meshu/three.js,LeoEatle/three.js,chuckfairy/three.js,AscensionFoundation/three.js,tdmsinc/three.js,freekh/three.js,robsix/3ditor,ma-tech/three.js,carlosanunes/three.js,archcomet/three.js,gsssrao/three.js,3DGEOM/three.js,sebasbaumh/three.js,unconed/three.js,LeoEatle/three.js,archilogic-ch/three.js,gpranay4/three.js,pailhead/three.js,JamesHagerman/three.js,jayhetee/three.js,GastonBeaucage/three.js,JamesHagerman/three.js,meizhoubao/three.js,digital360/three.js,Peekmo/three.js,humbletim/three.js,Zerschmetterling91/three.js,technohippy/three.js,googlecreativelab/three.js,dforrer/three.js,blokhin/three.js,sheafferusa/three.js,beni55/three.js,coloringchaos/three.js,AdactiveSAS/three.js,BrianSipple/three.js,Meshu/three.js,chaoallsome/three.js,zhangwenyan/three.js,alienity/three.js,elisee/three.js,surround-io/three.js,gigakiller/three.js,3DGEOM/three.js,ZhenxingWu/three.js,leeric92/three.js,ikerr/three.js,aleen42/three.js,shinate/three.js,freekh/three.js,UnboundVR/three.js,sasha240100/three.js,timcastelijn/three.js,jayschwa/three.js,prika/three.js,gdebojyoti/three.js,blokhin/three.js,yrns/three.js,JamesHagerman/three.js,leeric92/three.js,daoshengmu/three.js,missingdays/three.js-amd,Mohammed-Ashour/three.js,supergometan/three.js,jango2015/three.js,Meshu/three.js,borismus/three.js,Seagat2011/three.js,dyx/three.js,digital360/three.js,AscensionFoundation/three.js,ndebeiss/three.js,squarefeet/three.js,threejsworker/three.js,coloringchaos/three.js,matthartman/oculus-matt,sweetmandm/three.js,sunbc0120/three.js,blokhin/three.js,r8o8s1e0/three.js,toguri/three.js,06wj/three.js,satori99/three.js,byhj/three.js,ilovezy/three.js,g-rocket/three.js,MarcusLongmuir/three.js,Mugen87/three.js,archilogic-ch/three.js,g-rocket/three.js,Benjamin-Dobell/three.js,fta2012/three.js,wavesoft/three.js,ThiagoGarciaAlves/three.js,benaadams/three.js,elephantatwork/three.js,beni55/three.js,billfeller/three.js,Jericho25/three.js,Joeldk/three.js,wavesoft/three.js,Jerdak/three.js,archcomet/three.js,yrns/three.js,edivancamargo/three.js,squarefeet/three.js,0merta/three.js,mindofmatthew/three.js,Coburn37/three.js,ducminhn/three.js,AntTech/three.js,Joeldk/three.js,mattdesl/three.js,SpookW/three.js,chuckfairy/three.js,wizztjh/three.js,rgaino/three.js,robmyers/three.js,Mohammed-Ashour/three.js,controlzee/three.js,yifanhunyc/three.js,holmberd/three.js,snipermiller/three.js,sitexa/three.js,byhj/three.js,jeromeetienne/three.js,DeanLym/three.js,takahirox/three.js,jeffgoku/three.js,IceCreamYou/three.js,sasha240100/three.js,yuhualingfeng/three.js,digital360/three.js,Kasual666/WebGl,zhoushijie163/three.js,JeckoHeroOrg/three.js,ZhenxingWu/three.js,prika/three.js,enche/three.js,WoodMath/three.js,fomenyesu/three.js,fraguada/three.js,fyoudine/three.js,nhalloran/three.js,dayo7116/three.js,0merta/three.js,gveltri/three.js,controlzee/three.js,jbaicoianu/three.js,applexiaohao/three.js,mkkellogg/three.js,jango2015/three.js,shanmugamss/three.js-modified,luxigo/three.js,ThiagoGarciaAlves/three.js,arose/three.js,imshibaji/three.js,p5150j/three.js,robmyers/three.js,coderrick/three.js,zhanglingkang/three.js,elephantatwork/three.js,fluxio/three.js,redheli/three.js,Mugen87/three.js,Cakin-Kwong/three.js,r8o8s1e0/three.js,jee7/three.js,amakaroff82/three.js,swieder227/three.js,mkkellogg/three.js,gpranay4/three.js,mhoangvslev/data-visualizer,MarcusLongmuir/three.js,unphased/three.js,jzitelli/three.js,technohippy/three.js,cadenasgmbh/three.js,controlzee/three.js,sitexa/three.js,srifqi/three.js,alexconlin/three.js,aleen42/three.js,gwindes/three.js,fanzhanggoogle/three.js,Aldrien-/three.js,Stinkdigital/three.js,Kakakakakku/three.js,amazg/three.js,edivancamargo/three.js,matthartman/oculus-matt,Kakakakakku/three.js,mindofmatthew/three.js,111t8e/three.js,luxigo/three.js,jayhetee/three.js,humbletim/three.js,sheafferusa/three.js,carlosanunes/three.js,lag945/three.js,ondys/three.js,Gheehnest/three.js,jbaicoianu/three.js,zeropaper/three.js,googlecreativelab/three.js,bdysvik/three.js,mataron/three.js,zatchgordon/webGL,UnboundVR/three.js,sheafferusa/three.js,NicolasRannou/three.js,mataron/three.js,Jonham/three.js,yuhualingfeng/three.js,BenediktS/three.js,MetaStackers/three.js,TristanVALCKE/three.js,crazyyaoyao/yaoyao,elisee/three.js,lollerbus/three.js,shanmugamss/three.js-modified,richtr/three.js,matgr1/three.js,nadirhamid/three.js,tschw/three.js,sole/three.js,zatchgordon/webGL,snipermiller/three.js,mabo77/three.js,plepers/three.js,mabo77/three.js,greggman/three.js,easz/three.js,shinate/three.js,dforrer/three.js,AscensionFoundation/three.js,daoshengmu/three.js,MasterJames/three.js,WoodMath/three.js,agnivade/three.js,liammagee/three.js,satori99/three.js,mese79/three.js,nhalloran/three.js,sunbc0120/three.js,q437634645/three.js,borismus/three.js,LeoEatle/three.js,arodic/three.js,matthiascy/three.js,acrsteiner/three.js,Jonham/three.js,Samsy/three.js,stopyransky/three.js,rgaino/three.js,Kakakakakku/three.js,njam/three.js,applexiaohao/three.js,imshibaji/three.js,tschw/three.js,sreith1/three.js,cc272309126/three.js,Jericho25/three.js,donmccurdy/three.js,huobaowangxi/three.js,mese79/three.js,DeanLym/three.js,simonThiele/three.js,edge/three.js,Jonham/three.js,MasterJames/three.js,holmberd/three.js,alienity/three.js,liusashmily/three.js,robmyers/three.js,njam/three.js,Jericho25/three.js,mattholl/three.js,ThiagoGarciaAlves/three.js,erich666/three.js,Benjamin-Dobell/three.js,shinate/three.js,dhritzkiv/three.js,enche/three.js,leeric92/three.js,toguri/three.js,zodsoft/three.js,edivancamargo/three.js,dubejf/three.js,googlecreativelab/three.js,ndebeiss/three.js,gero3/three.js,davidvmckay/three.js,jango2015/three.js,luxigo/three.js,nopjia/three.js,enche/three.js,wizztjh/three.js,yxxme/three.js,masterex1000/three.js,VimVincent/three.js,sweetmandm/three.js,MarcusLongmuir/three.js,snovak/three.js,aleen42/three.js,mess110/three.js,RemusMar/three.js,mrkev/three.js,richtr/three.js,Mugen87/three.js,bdysvik/three.js,dyx/three.js,jllodra/three.js,quinonez/three.js,easz/three.js,hedgerh/three.js,Delejnr/three.js,ngokevin/three-dev,hacksalot/three.js,wizztjh/three.js,leitzler/three.js,enche/three.js,LaughingSun/three.js,yifanhunyc/three.js,IceCreamYou/three.js,fluxio/three.js,p5150j/three.js,benaadams/three.js,dforrer/three.js,Nitrillo/three.js,sole/three.js,billfeller/three.js,sufeiou/three.js,fanzhanggoogle/three.js,Cakin-Kwong/three.js,sweetmandm/three.js,wavesoft/three.js,swieder227/three.js,robsix/3ditor,jllodra/three.js,LaughingSun/three.js,pharos3d/three.js,Stinkdigital/three.js,stopyransky/three.js,wuxinwei240/three.js,Hectate/three.js,yrns/three.js,sole/three.js,liammagee/three.js,gwindes/three.js,colombod/three.js,yrns/three.js,haozi23333/three.js,mess110/three.js,alexconlin/three.js,JingYongWang/three.js,wizztjh/three.js,Benjamin-Dobell/three.js,archilogic-com/three.js,edge/three.js,arose/three.js,ma-tech/three.js,arose/three.js,prabhu-k/three.js,edge/three.js,robmyers/three.js,Benjamin-Dobell/three.js,Astrak/three.js,lovewitty/three.js,mainelander/three.js,stevenliujw/three.js,amazg/three.js,flimshaw/three.js,gsssrao/three.js,rayantony/three.js,AltspaceVR/three.js,Jerdak/three.js,LeoEatle/three.js,dhritzkiv/three.js,rgaino/three.js,rbarraud/three.js,coloringchaos/three.js,huobaowangxi/three.js,sunbc0120/three.js,mudithkr/three.js,dubejf/three.js,wanby/three.js,crazyyaoyao/yaoyao,sttz/three.js,Samsung-Blue/three.js,Cakin-Kwong/three.js,eq0rip/three.js,jostschmithals/three.js,camellhf/three.js,quinonez/three.js,elephantatwork/ZAAK.IO-EditorInternal,rougier/three.js,archcomet/three.js,acrsteiner/three.js,snovak/three.js,dayo7116/three.js,unconed/three.js,eq0rip/three.js,Cakin-Kwong/three.js,Ludobaka/three.js,gsssrao/three.js,Mohammed-Ashour/three.js,nadirhamid/three.js,dforrer/three.js,toguri/three.js,ikerr/three.js,arose/three.js,toxicFork/three.js,yxxme/three.js,shinate/three.js,sebasbaumh/three.js,Kakakakakku/three.js,kkjeer/three.js,Pro/three.js,sreith1/three.js,Fox32/three.js,amazg/three.js,fyoudine/three.js,yuhualingfeng/three.js,RAtechntukan/three.js,technohippy/three.js,SpookW/three.js,technohippy/three.js,mattholl/three.js,imshibaji/three.js,supergometan/three.js,fraguada/three.js,Jozain/three.js,coffeine-009/three.js,humbletim/three.js,brason/three.js,jeffgoku/three.js,tdmsinc/three.js,edivancamargo/three.js,colombod/three.js,ma-tech/three.js,IceCreamYou/three.js,Black-Alpha/three.js,111t8e/three.js,RemusMar/three.js,rayantony/three.js,aleen42/three.js,Stinkdigital/three.js,archilogic-ch/three.js,ducminhn/three.js,amakaroff82/three.js,mkkellogg/three.js,lovewitty/three.js,JuudeDemos/three.js,anvaka/three.js,Peekmo/three.js,dayo7116/three.js,Leeft/three.js,prabhu-k/three.js,ndebeiss/three.js,Delejnr/three.js,brason/three.js,unphased/three.js,xundaokeji/three.js,yxxme/three.js,programulya/three.js,GastonBeaucage/three.js,ma-tech/three.js,beni55/three.js,wavesoft/three.js,enche/three.js,mabo77/three.js,leitzler/three.js,ValtoLibraries/ThreeJS,vizorvr/three.js,vizorvr/three.js,opensim-org/three.js,fernandojsg/three.js,AntTech/three.js,rayantony/three.js,yuhualingfeng/three.js,sole/three.js,Cakin-Kwong/three.js,snovak/three.js,brianchirls/three.js,leeric92/three.js,JuudeDemos/three.js,acrsteiner/three.js,zeropaper/three.js,lag945/three.js,rlugojr/three.js,hedgerh/three.js,toguri/three.js,stopyransky/three.js,gdebojyoti/three.js,yuhualingfeng/three.js,lag945/three.js,mkkellogg/three.js,Astrak/three.js,sheafferusa/three.js,stopyransky/three.js,tschw/three.js,sitexa/three.js,squarefeet/three.js,supergometan/three.js,Benjamin-Dobell/three.js,zatchgordon/webGL,wuxinwei240/three.js,GGAlanSmithee/three.js,gveltri/three.js,ma-tech/three.js,sherousee/three.js,Gheehnest/three.js,ducminhn/three.js,looeee/three.js,jbaicoianu/three.js,kkjeer/three.js,mhoangvslev/data-visualizer,Aldrien-/three.js,pharos3d/three.js,leitzler/three.js,freekh/three.js,jostschmithals/three.js,AVGP/three.js,lchl7890987/WebGL,spite/three.js,squarefeet/three.js,bdysvik/three.js,fomenyesu/three.js,timcastelijn/three.js,hedgerh/three.js,g-rocket/three.js,edge/three.js,AltspaceVR/three.js,snipermiller/three.js,Gheehnest/three.js,toguri/three.js,nadirhamid/three.js,dayo7116/three.js,agnivade/three.js,borismus/three.js,mhoangvslev/data-visualizer,flimshaw/three.js,chaoallsome/three.js,Fox32/three.js,SET001/three.js,zbm2001/three.js,redheli/three.js,mindofmatthew/three.js,fanzhanggoogle/three.js,LaughingSun/three.js,camellhf/three.js,hacksalot/three.js,matthiascy/three.js,prabhu-k/three.js,jeffgoku/three.js,thomasxu1991/three.js,xundaokeji/three.js,surround-io/three.js,111t8e/three.js,Ludobaka/three.js,gveltri/three.js,rougier/three.js,ValtoLibraries/ThreeJS,JingYongWang/three.js,masterex1000/three.js,nhalloran/three.js,tschw/three.js,snovak/three.js,BenediktS/three.js,Wilt/three.js,easz/three.js,looeee/three.js,tamarintech/three.js,RemusMar/three.js,Samsung-Blue/three.js,ngokevin/three-dev,aardgoose/three.js,SpinVR/three.js,brason/three.js,dyx/three.js,chuckfairy/three.js,lollerbus/three.js,technohippy/three.js,BrianSipple/three.js,AVGP/three.js,brickify/three.js,ThiagoGarciaAlves/three.js,prika/three.js,3DGEOM/three.js,benaadams/three.js,SpookW/three.js,brianchirls/three.js,tamarintech/three.js,rbarraud/three.js,brickify/three.js,r8o8s1e0/three.js,Hectate/three.js,ZhenxingWu/three.js,greggman/three.js,alexbelyeu/three.js,bhouston/three.js,UnboundVR/three.js,brianchirls/three.js,sole/three.js,sebasbaumh/three.js,squarefeet/three.js,archcomet/three.js,plepers/three.js,archilogic-ch/three.js,nraynaud/three.js,MetaStackers/three.js,zbm2001/three.js,mainelander/three.js,jzitelli/three.js,simonThiele/three.js,lovewitty/three.js,zeropaper/three.js,ngokevin/three-dev,colombod/three.js,snovak/three.js,111t8e/three.js,AdactiveSAS/three.js,jllodra/three.js,HongJunLi/three.js,VimVincent/three.js,datalink747/three.js,jango2015/three.js,tamarintech/three.js,spite/three.js,blokhin/three.js,godlzr/Three.js,borismus/three.js,technohippy/three.js,pletzer/three.js,xundaokeji/three.js,q437634645/three.js,haozi23333/three.js,missingdays/three.js-amd,mataron/three.js,sunbc0120/three.js,prabhu-k/three.js,ngokevin/three-dev,colombod/three.js,dimensia/three.js,Jozain/three.js,0merta/three.js,Benjamin-Dobell/three.js,simonThiele/three.js,lollerbus/three.js,mudithkr/three.js,ngokevin/three.js,jzitelli/three.js,brason/three.js,coderrick/three.js,lag945/three.js,benaadams/three.js,threejsworker/three.js,swieder227/three.js,Samsung-Blue/three.js,g-rocket/three.js,billfeller/three.js,AscensionFoundation/three.js,cc272309126/three.js,Nitrillo/three.js,datalink747/three.js,quinonez/three.js,111t8e/three.js,bhouston/three.js,controlzee/three.js,mattholl/three.js,supergometan/three.js,archilogic-com/three.js,Jerdak/three.js,kkjeer/three.js,nhalloran/three.js,swieder227/three.js,stopyransky/three.js,pletzer/three.js,liammagee/three.js,elephantatwork/three.js,easz/three.js,jpweeks/three.js,thomasxu1991/three.js,billfeller/three.js,bhouston/three.js,sreith1/three.js,Cakin-Kwong/three.js,mindofmatthew/three.js,sufeiou/three.js,sweetmandm/three.js,Kasual666/WebGl,p5150j/three.js,elisee/three.js,lollerbus/three.js,p5150j/three.js,framelab/three.js,brianchirls/three.js,elephantatwork/ZAAK.IO-EditorInternal,HongJunLi/three.js,huobaowangxi/three.js,Liuer/three.js,gpranay4/three.js,MetaStackers/three.js,chuckfairy/three.js,unconed/three.js,jeffgoku/three.js,Ymaril/three.js,sole/three.js,mattholl/three.js,alienity/three.js,Peekmo/three.js,digital360/three.js,davidvmckay/three.js,lchl7890987/WebGL,AlexanderMazaletskiy/three.js,controlzee/three.js,Coburn37/three.js,chaoallsome/three.js,framelab/three.js,ValtoLibraries/ThreeJS,daoshengmu/three.js,WestLangley/three.js,richtr/three.js,toxicFork/three.js,timcastelijn/three.js,flimshaw/three.js,liusashmily/three.js,BenediktS/three.js,Jerdak/three.js,davidvmckay/three.js,mattdesl/three.js,AdactiveSAS/three.js,yifanhunyc/three.js,meizhoubao/three.js,huobaowangxi/three.js,wanby/three.js,yxxme/three.js,agnivade/three.js,q437634645/three.js,zeropaper/three.js,Jozain/three.js,DeanLym/three.js,chaoallsome/three.js,Stinkdigital/three.js,mudithkr/three.js,SatoshiKawabata/three.js,GastonBeaucage/three.js,sheafferusa/three.js,RAtechntukan/three.js,zodsoft/three.js,imshibaji/three.js,sherousee/three.js,Samsy/three.js,brickify/three.js,g-rocket/three.js,fanzhanggoogle/three.js,bhouston/three.js,matthiascy/three.js,fkammer/three.js,mrkev/three.js,programulya/three.js,Ludobaka/three.js,zatchgordon/webGL,fomenyesu/three.js,rbarraud/three.js,luxigo/three.js,takahirox/three.js,shanmugamss/three.js-modified,makc/three.js.fork,archilogic-com/three.js,Hectate/three.js,nraynaud/three.js,freekh/three.js,billfeller/three.js,fta2012/three.js,squarefeet/three.js,Samsy/three.js,dimensia/three.js,ndebeiss/three.js,ikerr/three.js,LaughingSun/three.js,godlzr/Three.js,hacksalot/three.js,rlugojr/three.js,zhangwenyan/three.js,AVGP/three.js,zhanglingkang/three.js,plepers/three.js,Coburn37/three.js,Jozain/three.js,jostschmithals/three.js,daoshengmu/three.js,alienity/three.js,zhanglingkang/three.js,zeropaper/three.js,hacksalot/three.js,bhouston/three.js,quinonez/three.js,threejsworker/three.js,gdebojyoti/three.js,JuudeDemos/three.js | ---
+++
@@ -10,7 +10,15 @@
var checkbox = new UI.Checkbox( editor.config.getKey( 'autosave' ) );
checkbox.onChange( function () {
- editor.config.setKey( 'autosave', this.getValue() );
+ var value = this.getValue();
+
+ editor.config.setKey( 'autosave', value );
+
+ if ( value === true ) {
+
+ editor.signals.sceneGraphChanged.dispatch();
+
+ }
} );
container.add( checkbox ); |
678a5f6f558c833bc05de1f68120efed8cbcdb18 | frameworks/datastore/tests/models/record/core_methods.js | frameworks/datastore/tests/models/record/core_methods.js | // ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple, Inc. and contributors.
// License: Licened under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */
var MyApp;
module("SC.Record core methods", {
setup: function() {
MyApp = SC.Object.create({
store: SC.Store.create()
}) ;
MyApp.Foo = SC.Record.extend({});
MyApp.json = {
foo: "bar",
number: 123,
bool: YES,
array: [1,2,3]
};
MyApp.foo = MyApp.store.createRecord(MyApp.Foo, MyApp.json);
}
});
test("statusToString", function() {
var status = MyApp.store.readStatus(MyApp.foo);
equals(SC.Record.statusToString(status), 'EMPTY', 'status string should be EMPTY');
}); | // ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple, Inc. and contributors.
// License: Licened under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */
var MyApp;
module("SC.Record core methods", {
setup: function() {
MyApp = SC.Object.create({
store: SC.Store.create()
}) ;
MyApp.Foo = SC.Record.extend({});
MyApp.json = {
foo: "bar",
number: 123,
bool: YES,
array: [1,2,3]
};
MyApp.foo = MyApp.store.createRecord(MyApp.Foo, MyApp.json);
}
});
test("statusString", function() {
equals(MyApp.foo.statusString(), 'READY_NEW', 'status string should be READY_NEW');
}); | Fix SC.Record statusString unit test | Fix SC.Record statusString unit test
| JavaScript | mit | Eloqua/sproutcore,Eloqua/sproutcore,Eloqua/sproutcore | ---
+++
@@ -25,7 +25,6 @@
}
});
-test("statusToString", function() {
- var status = MyApp.store.readStatus(MyApp.foo);
- equals(SC.Record.statusToString(status), 'EMPTY', 'status string should be EMPTY');
+test("statusString", function() {
+ equals(MyApp.foo.statusString(), 'READY_NEW', 'status string should be READY_NEW');
}); |
ce627bb604bbb4ce42a14af38f5f7aceef11df4d | gulp/config.js | gulp/config.js | //
// https://github.com/kogakure/gulp-tutorial/blob/master/gulp/config.js
//
var banner = [
'/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * <%= pkg.author %>',
' * Version <%= pkg.version %>',
' * <%= pkg.license %> Licensed',
' */',
''].join('\n');
module.exports = {
banner: banner,
clean: {
files: [
'dist'
]
},
jshint: {
src: [
'index.js',
'gulpfile.js',
'src/**/*.js'
],
options: require('../config/jshint')
},
uglify: {
debug: {
output: {
beautify: true,
comments: true
},
compress: false,
mangle: false
},
dist: {
compress: true,
mangle: true
}
}
};
| //
// https://github.com/kogakure/gulp-tutorial/blob/master/gulp/config.js
//
var banner = [
'/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * <%= pkg.author %>',
' * Version <%= pkg.version %>',
' * <%= pkg.license %> Licensed',
' */',
''].join('\n');
module.exports = {
banner: banner,
clean: {
files: [
'dist'
]
},
jshint: {
src: [
'index.js',
'gulpfile.js',
'src/**/*.js',
'lib/**/*.js'
],
options: require('../config/jshint')
},
uglify: {
debug: {
output: {
beautify: true,
comments: true
},
compress: false,
mangle: false
},
dist: {
compress: true,
mangle: true
}
}
};
| Validate files under lib with jshint | Validate files under lib with jshint
| JavaScript | mit | cheton/i18next-text | ---
+++
@@ -21,7 +21,8 @@
src: [
'index.js',
'gulpfile.js',
- 'src/**/*.js'
+ 'src/**/*.js',
+ 'lib/**/*.js'
],
options: require('../config/jshint')
}, |
9686768f335f876d674183fd899125a5fb09e101 | lib/node_modules/@stdlib/buffer/from-string/lib/index.js | lib/node_modules/@stdlib/buffer/from-string/lib/index.js | 'use strict';
/**
* Allocate a buffer containing a provided string.
*
* @module @stdlib/buffer/from-string
*
* @example
* var string2buffer = require( '@stdlib/buffer/from-string' );
*
* var buf = string2buffer( 'beep boop' );
* // returns <Buffer>
*/
// MODULES //
var hasFrom = require( './has_from.js' );
// MAIN //
var string2buffer;
if ( hasFrom ) {
string2buffer = require( './main.js' );
} else {
string2buffer = require( './polyfill.js' );
}
// EXPORTS //
module.exports = string2buffer;
| 'use strict';
/**
* Allocate a buffer containing a provided string.
*
* @module @stdlib/buffer/from-string
*
* @example
* var string2buffer = require( '@stdlib/buffer/from-string' );
*
* var buf = string2buffer( 'beep boop' );
* // returns <Buffer>
*/
// MODULES //
var hasFrom = require( './has_from.js' );
var main = require( './main.js' );
var polyfill = require( './polyfill.js' );
// MAIN //
var string2buffer;
if ( hasFrom ) {
string2buffer = main;
} else {
string2buffer = polyfill;
}
// EXPORTS //
module.exports = string2buffer;
| 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 string2buffer;
if ( hasFrom ) {
- string2buffer = require( './main.js' );
+ string2buffer = main;
} else {
- string2buffer = require( './polyfill.js' );
+ string2buffer = polyfill;
}
|
ea020e5e5759189d2576aea6a58114ddb24dd001 | src/index.js | src/index.js | import React from 'react'
import ReactDOM from 'react-dom'
import { createGlobalStyle } from 'styled-components'
import { App } from './App'
import woff2 from './fonts/source-sans-pro-v11-latin-regular.woff2'
import woff from './fonts/source-sans-pro-v11-latin-regular.woff'
import registerServiceWorker from './registerServiceWorker'
const GlobalStyle = createGlobalStyle`
body {
margin: 0;
padding: 0;
font-family: 'Source Sans Pro', sans-serif;
overscroll-behavior-y: none;
}
/* source-sans-pro-regular - latin */
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
font-display: optional;
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'),
url(${woff2}) format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url(${woff}) format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
`
ReactDOM.render(
<>
<GlobalStyle />
<App />
</>,
document.getElementById('root')
)
registerServiceWorker()
| import React from 'react'
import ReactDOM from 'react-dom'
import { createGlobalStyle } from 'styled-components'
import { App } from './App'
import woff2 from './fonts/source-sans-pro-v11-latin-regular.woff2'
import woff from './fonts/source-sans-pro-v11-latin-regular.woff'
import registerServiceWorker from './registerServiceWorker'
const GlobalStyle = createGlobalStyle`
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 0;
font-family: 'Source Sans Pro', sans-serif;
overscroll-behavior-y: none;
}
/* source-sans-pro-regular - latin */
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
font-display: optional;
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'),
url(${woff2}) format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url(${woff}) format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
`
ReactDOM.render(
<>
<GlobalStyle />
<App />
</>,
document.getElementById('root')
)
registerServiceWorker()
| Use border-box style for all elements | Use border-box style for all elements
| JavaScript | mit | joelgeorgev/file-hash-verifier,joelgeorgev/file-hash-verifier | ---
+++
@@ -8,6 +8,14 @@
import registerServiceWorker from './registerServiceWorker'
const GlobalStyle = createGlobalStyle`
+ html {
+ box-sizing: border-box;
+ }
+
+ *, *:before, *:after {
+ box-sizing: inherit;
+ }
+
body {
margin: 0;
padding: 0; |
12ee708accce42f2bdeb557888590851df1ff12c | src/index.js | src/index.js | var Transmitter = function (config) {
var router = require('./router.js');
router(config);
var io = require('socket.io')(router.server);
// Socket.io connection handling
io.on('connection', function(socket){
console.log('PULSAR: client connected');
socket.on('disconnect', function() {
console.log('PULSAR: client disconnected');
});
});
var Processor = require('@dermah/pulsar-input-keyboard');
var processor = new Processor(config);
processor.on('pulse', pulse => {
io.emit('pulse', pulse)
});
processor.on('pulsar control', pulse => {
io.emit('pulsar control', pulse)
});
processor.on('pulse update', pulse => {
io.emit('pulse update', pulse);
});
}
module.exports = Transmitter;
| class Detector {
constructor(config) {
let router = require('./router.js');
router(config);
this.io = require('socket.io')(router.server);
// Socket.io connection handling
this.io.on('connection', function(socket){
console.log('PULSAR: client connected');
socket.on('disconnect', function() {
console.log('PULSAR: client disconnected');
});
});
}
detect (pulseType, pulse) {
this.io.emit(pulseType, pulse);
}
}
module.exports = Detector;
| Convert export to a class with a pulse detector function | Convert export to a class with a pulse detector function
| JavaScript | mit | Dermah/pulsar-transmitter | ---
+++
@@ -1,29 +1,21 @@
-var Transmitter = function (config) {
+class Detector {
+ constructor(config) {
+ let router = require('./router.js');
+ router(config);
- var router = require('./router.js');
- router(config);
+ this.io = require('socket.io')(router.server);
+ // Socket.io connection handling
+ this.io.on('connection', function(socket){
+ console.log('PULSAR: client connected');
+ socket.on('disconnect', function() {
+ console.log('PULSAR: client disconnected');
+ });
+ });
+ }
- var io = require('socket.io')(router.server);
- // Socket.io connection handling
- io.on('connection', function(socket){
- console.log('PULSAR: client connected');
- socket.on('disconnect', function() {
- console.log('PULSAR: client disconnected');
- });
- });
-
- var Processor = require('@dermah/pulsar-input-keyboard');
- var processor = new Processor(config);
-
- processor.on('pulse', pulse => {
- io.emit('pulse', pulse)
- });
- processor.on('pulsar control', pulse => {
- io.emit('pulsar control', pulse)
- });
- processor.on('pulse update', pulse => {
- io.emit('pulse update', pulse);
- });
+ detect (pulseType, pulse) {
+ this.io.emit(pulseType, pulse);
+ }
}
-module.exports = Transmitter;
+module.exports = Detector; |
78d557fc3c8bda380271c29f02b9a2b3cceb6b9a | src/index.js | src/index.js | /**
*
* ___| | | | |
* | | | | |
* | ___ |___ __|
* \____|_| _| _|
*
* @author Shinichirow KAMITO
* @license MIT
*/
import {
createStore,
destroyStore,
getAllStores,
destroyAllStores,
trigger,
regist
} from './core';
import dispatcher from './dispatcher';
let ch4 = {
createStore: createStore,
getAllStores: getAllStores,
destroyStore: destroyStore,
destroyAllStores: destroyAllStores,
trigger: trigger,
regist: regist,
dispatcher: dispatcher
};
export {
createStore,
destroyStore,
getAllStores,
destroyAllStores,
trigger,
regist,
dispatcher
}
export default ch4;
| /**
*
* ___| | | | |
* | | | | |
* | ___ |___ __|
* \____|_| _| _|
*
* @author Shinichirow KAMITO
* @license MIT
*/
import {
createStore,
destroyStore,
getAllStores,
destroyAllStores,
trigger,
regist
} from './core';
import dispatcher from './dispatcher';
import logger from './logger';
let ch4 = {
createStore: createStore,
getAllStores: getAllStores,
destroyStore: destroyStore,
destroyAllStores: destroyAllStores,
trigger: trigger,
regist: regist,
dispatcher: dispatcher,
logger: logger
};
export {
createStore,
destroyStore,
getAllStores,
destroyAllStores,
trigger,
regist,
dispatcher,
logger
}
export default ch4;
| Add logger to export modules. | Add logger to export modules.
| JavaScript | mit | kamito/ch4 | ---
+++
@@ -17,6 +17,7 @@
regist
} from './core';
import dispatcher from './dispatcher';
+import logger from './logger';
let ch4 = {
createStore: createStore,
@@ -25,7 +26,8 @@
destroyAllStores: destroyAllStores,
trigger: trigger,
regist: regist,
- dispatcher: dispatcher
+ dispatcher: dispatcher,
+ logger: logger
};
export {
@@ -35,6 +37,7 @@
destroyAllStores,
trigger,
regist,
- dispatcher
+ dispatcher,
+ logger
}
export default ch4; |
1f7a9bd17e7611c0afb13b4c9f546cb8c7ef06af | src/index.js | src/index.js | export function createSelectorCreator(valueEquals) {
return (selectors, resultFunc) => {
if (!Array.isArray(selectors)) {
selectors = [selectors];
}
const memoizedResultFunc = memoize(resultFunc, valueEquals);
return state => {
const params = selectors.map(selector => selector(state));
return memoizedResultFunc(...params);
}
};
}
export function createSelector(...args) {
return createSelectorCreator(defaultValueEquals)(...args);
}
export function defaultValueEquals(a, b) {
return a === b;
}
// the memoize function only caches one set of arguments. This
// actually good enough, rather surprisingly. This is because during
// calculation of a selector result the arguments won't
// change if called multiple times. If a new state comes in, we *want*
// recalculation if and only if the arguments are different.
function memoize(func, valueEquals) {
let lastArgs = null;
let lastResult = null;
return (...args) => {
if (lastArgs !== null && argsEquals(args, lastArgs, valueEquals)) {
return lastResult;
}
lastArgs = args;
lastResult = func(...args);
return lastResult;
}
}
function argsEquals(a, b, valueEquals) {
return a.every((value, index) => valueEquals(value, b[index]));
}
| export function createSelectorCreator(valueEquals) {
return (selectors, resultFunc) => {
if (!Array.isArray(selectors)) {
selectors = [selectors];
}
const memoizedResultFunc = memoize(resultFunc, valueEquals);
return state => {
const params = selectors.map(selector => selector(state));
return memoizedResultFunc(params);
}
};
}
export function createSelector(...args) {
return createSelectorCreator(defaultValueEquals)(...args);
}
export function defaultValueEquals(a, b) {
return a === b;
}
// the memoize function only caches one set of arguments. This
// actually good enough, rather surprisingly. This is because during
// calculation of a selector result the arguments won't
// change if called multiple times. If a new state comes in, we *want*
// recalculation if and only if the arguments are different.
function memoize(func, valueEquals) {
let lastArgs = null;
let lastResult = null;
return (args) => {
if (lastArgs !== null && argsEquals(args, lastArgs, valueEquals)) {
return lastResult;
}
lastArgs = args;
lastResult = func(...args);
return lastResult;
}
}
function argsEquals(a, b, valueEquals) {
return a.every((value, index) => valueEquals(value, b[index]));
}
| Remove unnecessary use of spread | Remove unnecessary use of spread
| JavaScript | mit | sericaia/reselect,chentsulin/reselect,faassen/reselect,SpainTrain/reselect,reactjs/reselect,chromakode/reselect,reactjs/reselect,tgriesser/reselect,scottcorgan/reselect,zalmoxisus/reselect,babsonmatt/reselect,rackt/reselect,ellbee/reselect | ---
+++
@@ -6,7 +6,7 @@
const memoizedResultFunc = memoize(resultFunc, valueEquals);
return state => {
const params = selectors.map(selector => selector(state));
- return memoizedResultFunc(...params);
+ return memoizedResultFunc(params);
}
};
}
@@ -27,7 +27,7 @@
function memoize(func, valueEquals) {
let lastArgs = null;
let lastResult = null;
- return (...args) => {
+ return (args) => {
if (lastArgs !== null && argsEquals(args, lastArgs, valueEquals)) {
return lastResult;
} |
79e51f7510a554c5fa900759f9ad55f9201c7715 | app/components/ocre-step.js | app/components/ocre-step.js | import Ember from 'ember';
import _ from 'lodash/lodash';
import steps from '../ressources/ocre-quest';
export default Ember.Component.extend({
progress: '',
stepIndex: 0,
target: 0,
onChange: () => {},
actions: {
update(item, delta) {
let progress = this.get('progress');
progress = progress.split('');
progress[item.index] = item.value + delta;
progress = progress.join('');
this.get('onChange')(progress, this.get('stepIndex'));
}
},
progressBars: Ember.computed('parsedItems', 'target', function() {
const parsedItems = this.get('parsedItems');
return _.times(this.get('target'), (index) => {
return _.filter(parsedItems, parsedItem => parsedItem.value > index).length / parsedItems.length;
});
}),
minimum: Ember.computed('progress', function() {
const progress = this.get('progress');
return Math.min(..._.map(progress.split(''), number => parseInt(number, 10)));
}),
parsedItems: Ember.computed('progress', function() {
const progress = this.get('progress');
const items = steps[this.get('stepIndex') - 1];
return _.map(items, (item, index) => {
const value = parseInt(progress[index], 10);
return {
name: item[0],
note: item[1],
index: index,
cantAdd: value >= 9,
cantRemove: value <= 1,
value: value
};
});
})
});
| import Ember from 'ember';
import _ from 'lodash/lodash';
import steps from '../ressources/ocre-quest';
export default Ember.Component.extend({
progress: '',
stepIndex: 0,
target: 0,
onChange: () => {},
actions: {
update(item, delta) {
let progress = this.get('progress');
progress = progress.split('');
progress[item.index] = item.value + delta;
progress = progress.join('');
this.get('onChange')(progress, this.get('stepIndex'));
}
},
progressBars: Ember.computed('parsedItems', 'target', function() {
const parsedItems = this.get('parsedItems');
return _.times(this.get('target'), (index) => {
return _.filter(parsedItems, parsedItem => parsedItem.value > index).length / parsedItems.length;
});
}),
minimum: Ember.computed('progress', function() {
const progress = this.get('progress');
return Math.min(..._.map(progress.split(''), number => parseInt(number, 10)));
}),
parsedItems: Ember.computed('progress', function() {
const progress = this.get('progress');
const items = steps[this.get('stepIndex') - 1];
return _.map(items, (item, index) => {
const value = parseInt(progress[index], 10);
return {
name: item[0],
note: item[1],
index: index,
cantAdd: value >= 9,
cantRemove: value <= 0,
value: value
};
});
})
});
| Fix the bug where a mob can't be put back to 0 | Fix the bug where a mob can't be put back to 0
| JavaScript | mit | pboutin/dofus-workbench,pboutin/dofus-workbench | ---
+++
@@ -43,7 +43,7 @@
note: item[1],
index: index,
cantAdd: value >= 9,
- cantRemove: value <= 1,
+ cantRemove: value <= 0,
value: value
};
}); |
c1bf4d635ecfb5f471f4d4230401ae3c0ded3468 | app/controllers/PhotoRow.js | app/controllers/PhotoRow.js | var FileLoader = require("file_loader");
var args = arguments[0] || {};
var url = "http://photos.tritarget.org/photos/washington2012/" + args.photo;
FileLoader.download(url)
.then(function(file) {
// Ti.API.info("Displaying image: " + file.getPath());
$.photo.image = file.getFile();
$.info.color = file.downloaded ? "#CF0000" : "#07D100";
$.info.text = (file.downloaded ? "Downloaded" : "Cached") +
"\n(" + file.id.substr(0, 12) + ")";
})
.fail(function(error) {
var message = error.message || error.error || error;
Ti.API.error("" + message + " loading cache with url: " + url);
// We don't want to throw an error here. That would be a mess.
})
.done();
$.title.text = args.photo;
/* vim:set ts=2 sw=2 et fdm=marker: */
| var FileLoader = require("file_loader");
var args = arguments[0] || {};
var url = "http://photos.tritarget.org/photos/washington2012/" + args.photo;
function updateRow(file) {
$.photo.image = file.getFile();
$.info.color = file.downloaded ? "#CF0000" : "#07D100";
$.info.text = (file.downloaded ? "Downloaded" : "Cached") +
"\n(" + file.id.substr(0, 12) + ")";
}
function onError(error) {
var message = error.message || error.error || error;
Ti.API.error("" + message + " loading cache with url: " + url);
// We don't want to throw an error here. That would be a mess.
}
if (args.use_promises) {
FileLoader.download(url).then(updateRow).fail(onError).done();
}
else {
FileLoader.download(url, {
onload: updateRow,
onerror: onError,
});
}
$.title.text = args.photo;
/* vim:set ts=2 sw=2 et fdm=marker: */
| Add support for choosing promises or callbacks | Add support for choosing promises or callbacks
For testing and demo
| JavaScript | mit | sukima/TiCachedImages,0x00evil/TiCachedImages,0x00evil/TiCachedImages,sukima/TiCachedImages | ---
+++
@@ -3,20 +3,28 @@
var args = arguments[0] || {};
var url = "http://photos.tritarget.org/photos/washington2012/" + args.photo;
-FileLoader.download(url)
- .then(function(file) {
- // Ti.API.info("Displaying image: " + file.getPath());
- $.photo.image = file.getFile();
- $.info.color = file.downloaded ? "#CF0000" : "#07D100";
- $.info.text = (file.downloaded ? "Downloaded" : "Cached") +
- "\n(" + file.id.substr(0, 12) + ")";
- })
- .fail(function(error) {
- var message = error.message || error.error || error;
- Ti.API.error("" + message + " loading cache with url: " + url);
- // We don't want to throw an error here. That would be a mess.
- })
- .done();
+function updateRow(file) {
+ $.photo.image = file.getFile();
+ $.info.color = file.downloaded ? "#CF0000" : "#07D100";
+ $.info.text = (file.downloaded ? "Downloaded" : "Cached") +
+ "\n(" + file.id.substr(0, 12) + ")";
+}
+
+function onError(error) {
+ var message = error.message || error.error || error;
+ Ti.API.error("" + message + " loading cache with url: " + url);
+ // We don't want to throw an error here. That would be a mess.
+}
+
+if (args.use_promises) {
+ FileLoader.download(url).then(updateRow).fail(onError).done();
+}
+else {
+ FileLoader.download(url, {
+ onload: updateRow,
+ onerror: onError,
+ });
+}
$.title.text = args.photo;
/* vim:set ts=2 sw=2 et fdm=marker: */ |
cd93d090958b3b4c058cabe384668725d23622b1 | app/components/layer-file/component.js | app/components/layer-file/component.js | import Ember from 'ember';
export default Ember.Component.extend({
showSelect: false,
noFileFound: true,
didRender() {
if(!this.get('layer.settings.values.downloadLink')){
this.get('node.files').then((result)=>{
result.objectAt(0).get('files').then((files)=>{
if(files.length === 0){
this.set('noFileFound', true);
return false;
}else{
this.set('noFileFound', false);
}
let fileDatesLinks = {}
let fileModifiedDates = []
for(let i = 0; i < files.length; i++){
fileModifiedDates.push(files.objectAt(i).get('dateModified'));
fileDatesLinks[files.objectAt(i).get('dateModified')] = files.objectAt(i).get('links').download;
}
let mostRecentDate = new Date(Math.max.apply(null,fileModifiedDates));
this.set('layer.settings.values.downloadLink' , fileDatesLinks[mostRecentDate]);
});
});
}
},
actions: {
fileDetail(file) {
this.set('showSelect', false);
this.set('layer.settings.values.downloadLink' , file.data.links.download)
},
showSelect(){
this.set('showSelect', true);
},
hideSelect(){
this.set('showSelect', false);
}
}
});
| import Ember from 'ember';
export default Ember.Component.extend({
showSelect: false,
noFileFound: true, //make computed property that observers the layers.[] and if change see if there is a file
didRender() {
console.log(this.get('layer.settings.values.downloadLink') , this.get('noFileFound'))
if(!this.get('layer.settings.values.downloadLink')){
this.get('node.files').then((result)=>{
result.objectAt(0).get('files').then((files)=>{
console.log("files.length" , files.length);
if(files.length === 0){
this.set('noFileFound', true);
return false;
}else{
this.set('noFileFound', false);
}
let fileDatesLinks = {}
let fileModifiedDates = []
for(let i = 0; i < files.length; i++){
fileModifiedDates.push(files.objectAt(i).get('dateModified'));
fileDatesLinks[files.objectAt(i).get('dateModified')] = files.objectAt(i).get('links').download;
}
let mostRecentDate = new Date(Math.max.apply(null,fileModifiedDates));
this.set('layer.settings.values.downloadLink' , fileDatesLinks[mostRecentDate]);
});
});
}else{
this.set('noFileFound', false);
}
},
actions: {
fileDetail(file) {
this.set('showSelect', false);
this.set('layer.settings.values.downloadLink' , file.data.links.download)
},
showSelect(){
this.set('showSelect', true);
},
hideSelect(){
this.set('showSelect', false);
}
}
});
| Fix 'No Files Found" showing when files are found | Fix 'No Files Found" showing when files are found
| JavaScript | apache-2.0 | caneruguz/osfpages,caneruguz/osfpages,Rytiggy/osfpages,Rytiggy/osfpages | ---
+++
@@ -2,11 +2,14 @@
export default Ember.Component.extend({
showSelect: false,
- noFileFound: true,
+ noFileFound: true, //make computed property that observers the layers.[] and if change see if there is a file
didRender() {
+
+ console.log(this.get('layer.settings.values.downloadLink') , this.get('noFileFound'))
if(!this.get('layer.settings.values.downloadLink')){
this.get('node.files').then((result)=>{
result.objectAt(0).get('files').then((files)=>{
+ console.log("files.length" , files.length);
if(files.length === 0){
this.set('noFileFound', true);
return false;
@@ -23,6 +26,8 @@
this.set('layer.settings.values.downloadLink' , fileDatesLinks[mostRecentDate]);
});
});
+ }else{
+ this.set('noFileFound', false);
}
},
actions: {
@@ -36,5 +41,5 @@
hideSelect(){
this.set('showSelect', false);
}
- }
+ }
}); |
bd812f12f00375232dd413e17a4356d8320f9c80 | lib/vttregion-extended.js | lib/vttregion-extended.js | // If we're in Node.js then require VTTRegion so we can extend it, otherwise assume
// VTTRegion is on the global.
if (typeof module !== "undefined" && module.exports) {
this.VTTRegion = require("./vttregion").VTTRegion;
}
// Extend VTTRegion with methods to convert to JSON, from JSON, and construct a
// VTTRegion from an options object. The primary purpose of this is for use in the
// vtt.js test suite. It's also useful if you need to work with VTTRegions in
// JSON format.
(function(root) {
root.VTTRegion.create = function(options) {
var region = new root.VTTRegion();
for (var key in options) {
if (region.hasOwnProperty(key)) {
region[key] = options[key];
}
}
return region;
};
root.VTTRegion.create = function(json) {
return this.create(JSON.parse(json));
};
}(this));
| // If we're in Node.js then require VTTRegion so we can extend it, otherwise assume
// VTTRegion is on the global.
if (typeof module !== "undefined" && module.exports) {
this.VTTRegion = require("./vttregion").VTTRegion;
}
// Extend VTTRegion with methods to convert to JSON, from JSON, and construct a
// VTTRegion from an options object. The primary purpose of this is for use in the
// vtt.js test suite. It's also useful if you need to work with VTTRegions in
// JSON format.
(function(root) {
root.VTTRegion.create = function(options) {
var region = new root.VTTRegion();
for (var key in options) {
if (region.hasOwnProperty(key)) {
region[key] = options[key];
}
}
return region;
};
root.VTTRegion.fromJSON = function(json) {
return this.create(JSON.parse(json));
};
}(this));
| Fix accidental change of fromJSON() to create(). | Fix accidental change of fromJSON() to create().
| JavaScript | apache-2.0 | gkatsev/vtt.js,mozilla/vtt.js,gkatsev/vtt.js,mozilla/vtt.js | ---
+++
@@ -20,7 +20,7 @@
return region;
};
- root.VTTRegion.create = function(json) {
+ root.VTTRegion.fromJSON = function(json) {
return this.create(JSON.parse(json));
};
|
4a5944329d737b0671a5a094e428e23b803b359c | lib/constants.js | lib/constants.js | var fs = require('fs')
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString())
exports.VERSION = pkg.version
exports.DEFAULT_PORT = process.env.PORT || 9876
exports.DEFAULT_HOSTNAME = process.env.IP || 'localhost'
// log levels
exports.LOG_DISABLE = 'OFF'
exports.LOG_ERROR = 'ERROR'
exports.LOG_WARN = 'WARN'
exports.LOG_INFO = 'INFO'
exports.LOG_DEBUG = 'DEBUG'
// Default patterns for the pattern layout.
exports.COLOR_PATTERN = '%[%p [%c]: %]%m'
exports.NO_COLOR_PATTERN = '%p [%c]: %m'
// Default console appender
exports.CONSOLE_APPENDER = {
type: 'console',
layout: {
type: 'pattern',
pattern: exports.COLOR_PATTERN
}
}
exports.EXIT_CODE = '\x1FEXIT'
| var fs = require('fs')
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString())
exports.VERSION = pkg.version
exports.DEFAULT_PORT = process.env.PORT || 9876
exports.DEFAULT_HOSTNAME = process.env.IP || 'localhost'
// log levels
exports.LOG_DISABLE = 'OFF'
exports.LOG_ERROR = 'ERROR'
exports.LOG_WARN = 'WARN'
exports.LOG_INFO = 'INFO'
exports.LOG_DEBUG = 'DEBUG'
// Default patterns for the pattern layout.
exports.COLOR_PATTERN = '%[%d{DATE}:%p [%c]: %]%m'
exports.NO_COLOR_PATTERN = '%d{DATE}:%p [%c]: %m'
// Default console appender
exports.CONSOLE_APPENDER = {
type: 'console',
layout: {
type: 'pattern',
pattern: exports.COLOR_PATTERN
}
}
exports.EXIT_CODE = '\x1FEXIT'
| Add date/time stamp to log output | feat(logger): Add date/time stamp to log output
The `"%d{DATE}"` in the log pattern adds a date and time stamp to log
lines.
So you get output like this from karma's logging:
```
30 06 2015 15:19:56.562:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-43808925
```
The date and time are handy for figuring out if karma is running slowly.
| JavaScript | mit | clbond/karma,powerkid/karma,brianmhunt/karma,hitesh97/karma,simudream/karma,karma-runner/karma,skycocker/karma,vtsvang/karma,SamuelMarks/karma,unional/karma,tomkuk/karma,gayancliyanage/karma,kahwee/karma,IsaacChapman/karma,Sanjo/karma,rhlass/karma,clbond/karma,kahwee/karma,maksimr/karma,maksimr/karma,skycocker/karma,chrisirhc/karma,panrafal/karma,mprobst/karma,KrekkieD/karma,KrekkieD/karma,harme199497/karma,buley/karma,skycocker/karma,karma-runner/karma,youprofit/karma,skycocker/karma,simudream/karma,aiboy/karma,pedrotcaraujo/karma,hitesh97/karma,gayancliyanage/karma,oyiptong/karma,IsaacChapman/karma,maksimr/karma,brianmhunt/karma,harme199497/karma,shirish87/karma,jamestalmage/karma,brianmhunt/karma,pmq20/karma,astorije/karma,jjoos/karma,astorije/karma,pmq20/karma,unional/karma,hitesh97/karma,buley/karma,IveWong/karma,buley/karma,karma-runner/karma,mprobst/karma,oyiptong/karma,johnjbarton/karma,tomkuk/karma,vtsvang/karma,xiaoking/karma,wesleycho/karma,powerkid/karma,IsaacChapman/karma,chrisirhc/karma,jjoos/karma,johnjbarton/karma,IveWong/karma,simudream/karma,unional/karma,mprobst/karma,codedogfish/karma,Dignifiedquire/karma,xiaoking/karma,Klaudit/karma,panrafal/karma,panrafal/karma,astorije/karma,jamestalmage/karma,pedrotcaraujo/karma,Sanjo/karma,kahwee/karma,clbond/karma,timebackzhou/karma,Klaudit/karma,ernsheong/karma,wesleycho/karma,timebackzhou/karma,stevemao/karma,SamuelMarks/karma,KrekkieD/karma,harme199497/karma,powerkid/karma,codedogfish/karma,pmq20/karma,Sanjo/karma,patrickporto/karma,gayancliyanage/karma,aiboy/karma,marthinus-engelbrecht/karma,youprofit/karma,jamestalmage/karma,astorije/karma,gayancliyanage/karma,IsaacChapman/karma,vtsvang/karma,Dignifiedquire/karma,codedogfish/karma,rhlass/karma,pedrotcaraujo/karma,oyiptong/karma,patrickporto/karma,simudream/karma,clbond/karma,hitesh97/karma,Dignifiedquire/karma,powerkid/karma,kahwee/karma,ernsheong/karma,chrisirhc/karma,Dignifiedquire/karma,shirish87/karma,stevemao/karma,timebackzhou/karma,Sanjo/karma,johnjbarton/karma,timebackzhou/karma,chrisirhc/karma,patrickporto/karma,pedrotcaraujo/karma,aiboy/karma,david-garcia-nete/karma,shirish87/karma,jamestalmage/karma,wesleycho/karma,buley/karma,youprofit/karma,codedogfish/karma,wesleycho/karma,johnjbarton/karma,marthinus-engelbrecht/karma,xiaoking/karma,IveWong/karma,stevemao/karma,brianmhunt/karma,jjoos/karma,Klaudit/karma,david-garcia-nete/karma,rhlass/karma,marthinus-engelbrecht/karma,Klaudit/karma,jjoos/karma,david-garcia-nete/karma,oyiptong/karma,aiboy/karma,KrekkieD/karma,tomkuk/karma,youprofit/karma,marthinus-engelbrecht/karma,tomkuk/karma,vtsvang/karma,ernsheong/karma,karma-runner/karma,rhlass/karma,IveWong/karma,SamuelMarks/karma,stevemao/karma,xiaoking/karma,patrickporto/karma,pmq20/karma,unional/karma,harme199497/karma | ---
+++
@@ -15,8 +15,8 @@
exports.LOG_DEBUG = 'DEBUG'
// Default patterns for the pattern layout.
-exports.COLOR_PATTERN = '%[%p [%c]: %]%m'
-exports.NO_COLOR_PATTERN = '%p [%c]: %m'
+exports.COLOR_PATTERN = '%[%d{DATE}:%p [%c]: %]%m'
+exports.NO_COLOR_PATTERN = '%d{DATE}:%p [%c]: %m'
// Default console appender
exports.CONSOLE_APPENDER = { |
3601d7ce7c5e2863c27e0a0c5a08746cbaddfcba | app/assets/javascripts/global.js | app/assets/javascripts/global.js | $(document)
.ready(function() {
// fix menu when passed
$('.masthead')
.visibility({
once: false,
onBottomPassed: function() {
$('.fixed.menu').transition('fade in');
},
onBottomPassedReverse: function() {
$('.fixed.menu').transition('fade out');
}
})
;
// create sidebar and attach to menu open
$('.ui.sidebar')
.sidebar('attach events', '.toc.item')
;
})
;
| $(document)
.ready(function() {
// fix menu when passed
$('.masthead')
.visibility({
once: false,
onBottomPassed: function() {
$('.fixed.menu').transition('fade in');
},
onBottomPassedReverse: function() {
$('.fixed.menu').transition('fade out');
}
});
// create sidebar and attach to menu open
$('.ui.sidebar')
.sidebar('attach events', '.toc.item');
$('.message .close')
.on('click', function() {
$(this)
.closest('.message')
.transition('fade');
});
});
| Make the flash message dismissable | Make the flash message dismissable
| JavaScript | bsd-3-clause | payloadtech/payload,payloadtech/payload,amingilani/starter-web-app,amingilani/starter-web-app,payloadtech/payload,amingilani/starter-web-app | ---
+++
@@ -1,23 +1,27 @@
$(document)
- .ready(function() {
+ .ready(function() {
- // fix menu when passed
- $('.masthead')
- .visibility({
- once: false,
- onBottomPassed: function() {
- $('.fixed.menu').transition('fade in');
- },
- onBottomPassedReverse: function() {
- $('.fixed.menu').transition('fade out');
- }
- })
- ;
+ // fix menu when passed
+ $('.masthead')
+ .visibility({
+ once: false,
+ onBottomPassed: function() {
+ $('.fixed.menu').transition('fade in');
+ },
+ onBottomPassedReverse: function() {
+ $('.fixed.menu').transition('fade out');
+ }
+ });
- // create sidebar and attach to menu open
- $('.ui.sidebar')
- .sidebar('attach events', '.toc.item')
- ;
+ // create sidebar and attach to menu open
+ $('.ui.sidebar')
+ .sidebar('attach events', '.toc.item');
- })
-;
+ $('.message .close')
+ .on('click', function() {
+ $(this)
+ .closest('.message')
+ .transition('fade');
+ });
+
+ }); |
52213504d4c43fe43f572dc8bf84113a9af07797 | routes/index.js | routes/index.js | var express = require('express');
var request = require('request');
var http = require('http');
var router = express.Router();
var fixtures = require('./fixtures');
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'FootScores' });
});
/* GET any leagues matches */
router.get('/fixtures/:id', function(req, res, next) {
var matches = fixtures.getMatches(req.params.id, function(data) {
res.render('matches', {matches: data});
});
});
module.exports = router;
| var express = require('express');
var request = require('request');
var http = require('http');
var router = express.Router();
var fixtures = require('./fixtures');
var database = require('../database/mongo');
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'FootScores' });
});
/* GET any leagues matches */
router.get('/fixtures/:id', function(req, res, next) {
var matches = fixtures.getMatchesByCompetition(req.params.id, function(data) {
res.render('matches', {matches: data});
});
});
router.get('/matches', function(req, res, next) {
database.getConnection(function(db) {
fixtures.serveMatches(db.collection('partidos'));
});
res.render('matches', {matches: {}});
});
module.exports = router;
| Change names to be more self-explanatory | Change names to be more self-explanatory
| JavaScript | mit | ngomez22/FootScores,ngomez22/FootScores | ---
+++
@@ -3,6 +3,7 @@
var http = require('http');
var router = express.Router();
var fixtures = require('./fixtures');
+var database = require('../database/mongo');
/* GET home page. */
router.get('/', function(req, res, next) {
@@ -11,9 +12,16 @@
/* GET any leagues matches */
router.get('/fixtures/:id', function(req, res, next) {
- var matches = fixtures.getMatches(req.params.id, function(data) {
+ var matches = fixtures.getMatchesByCompetition(req.params.id, function(data) {
res.render('matches', {matches: data});
});
});
+router.get('/matches', function(req, res, next) {
+ database.getConnection(function(db) {
+ fixtures.serveMatches(db.collection('partidos'));
+ });
+ res.render('matches', {matches: {}});
+});
+
module.exports = router; |
368c10724ead9b725bbd75f31a7922fcbe6fc0aa | app/javascript/helpers/string.js | app/javascript/helpers/string.js | /* FILE string.js */
(function () {
this.sparks.string = {};
var str = sparks.string;
str.strip = function (s) {
s = s.replace(/\s*([^\s]*)\s*/, '$1');
return s;
};
// Remove a dot in the string, and then remove 0's on both sides
// e.g. '20100' => '201', '0.0020440' => '2044'
str.stripZerosAndDots = function (s) {
s = s.replace('.', '');
s = s.replace(/0*([^0].*)/, '$1');
s = s.replace(/(.*[^0])0*/, '$1');
return s;
};
str.stripZeros = function (s) {
s = s.replace(/0*([^0].*)/, '$1');
s = s.replace(/(.*[^0])0*/, '$1');
return s;
};
})();
| /* FILE string.js */
(function () {
this.sparks.string = {};
var str = sparks.string;
str.strip = function (s) {
s = s.replace(/\s*([^\s]*)\s*/, '$1');
return s;
};
// Remove a dot in the string, and then remove 0's on both sides
// e.g. '20100' => '201', '0.0020440' => '2044'
str.stripZerosAndDots = function (s) {
s = s.replace('.', '');
s = s.replace(/0*([^0].*)/, '$1');
s = s.replace(/(.*[^0])0*/, '$1');
return s;
};
str.stripZeros = function (s) {
s = s.replace(/0*([^0].*)/, '$1');
s = s.replace(/(.*[^0])0*/, '$1');
return s;
};
String.prototype.capFirst = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
})();
| Add capitalize-first function to String | Add capitalize-first function to String | JavaScript | apache-2.0 | concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks | ---
+++
@@ -26,5 +26,10 @@
return s;
};
+
+ String.prototype.capFirst = function() {
+ return this.charAt(0).toUpperCase() + this.slice(1);
+ }
+
})(); |
84854a6494b5c9f1a56be857ba2fc8762883f1c9 | app/mixins/pagination-support.js | app/mixins/pagination-support.js | import Ember from 'ember';
export default Ember.Mixin.create({
hasPaginationSupport: true,
total: 0,
page: 0,
pageSize: 10,
didRequestPage: Ember.K,
first: function () {
return this.get('page') * this.get('pageSize') + 1;
}.property('page', 'pageSize').cacheable(),
last: function () {
return Math.min((this.get('page') + 1) * this.get('pageSize'), this.get('total'));
}.property('page', 'pageSize', 'total').cacheable(),
hasPrevious: function () {
return this.get('page') > 0;
}.property('page').cacheable(),
hasNext: function () {
return this.get('last') < this.get('total');
}.property('last', 'total').cacheable(),
nextPage: function () {
if (this.get('hasNext')) {
this.incrementProperty('page');
}
},
previousPage: function () {
if (this.get('hasPrevious')) {
this.decrementProperty('page');
}
},
totalPages: function () {
return Math.ceil(this.get('total') / this.get('pageSize'));
}.property('total', 'pageSize').cacheable(),
pageDidChange: function () {
this.didRequestPage(this.get('page'));
}.observes('page')
});
| import Ember from 'ember';
export default Ember.Mixin.create({
hasPaginationSupport: true,
total: 0,
page: 0,
pageSize: 10,
didRequestPage: Ember.K,
first: function () {
return this.get('page') * this.get('pageSize') + 1;
}.property('page', 'pageSize'),
last: function () {
return Math.min((this.get('page') + 1) * this.get('pageSize'), this.get('total'));
}.property('page', 'pageSize', 'total'),
hasPrevious: function () {
return this.get('page') > 0;
}.property('page'),
hasNext: function () {
return this.get('last') < this.get('total');
}.property('last', 'total'),
nextPage: function () {
if (this.get('hasNext')) {
this.incrementProperty('page');
}
},
previousPage: function () {
if (this.get('hasPrevious')) {
this.decrementProperty('page');
}
},
totalPages: function () {
return Math.ceil(this.get('total') / this.get('pageSize'));
}.property('total', 'pageSize'),
pageDidChange: function () {
this.didRequestPage(this.get('page'));
}.observes('page')
});
| Fix deprecation warnings for Ember 1.10.0. | Fix deprecation warnings for Ember 1.10.0.
| JavaScript | apache-2.0 | davidvmckay/Klondike,Stift/Klondike,davidvmckay/Klondike,jochenvangasse/Klondike,jochenvangasse/Klondike,themotleyfool/Klondike,Stift/Klondike,fhchina/Klondike,jochenvangasse/Klondike,fhchina/Klondike,themotleyfool/Klondike,fhchina/Klondike,themotleyfool/Klondike,Stift/Klondike,davidvmckay/Klondike | ---
+++
@@ -9,19 +9,19 @@
first: function () {
return this.get('page') * this.get('pageSize') + 1;
- }.property('page', 'pageSize').cacheable(),
+ }.property('page', 'pageSize'),
last: function () {
return Math.min((this.get('page') + 1) * this.get('pageSize'), this.get('total'));
- }.property('page', 'pageSize', 'total').cacheable(),
+ }.property('page', 'pageSize', 'total'),
hasPrevious: function () {
return this.get('page') > 0;
- }.property('page').cacheable(),
+ }.property('page'),
hasNext: function () {
return this.get('last') < this.get('total');
- }.property('last', 'total').cacheable(),
+ }.property('last', 'total'),
nextPage: function () {
if (this.get('hasNext')) {
@@ -37,7 +37,7 @@
totalPages: function () {
return Math.ceil(this.get('total') / this.get('pageSize'));
- }.property('total', 'pageSize').cacheable(),
+ }.property('total', 'pageSize'),
pageDidChange: function () {
this.didRequestPage(this.get('page')); |
6cce0db72acfc12bf7fae13346be29928976b641 | public/modules/core/controllers/sound-test.client.controller.js | public/modules/core/controllers/sound-test.client.controller.js | 'use strict';
angular.module('core').controller('SoundTestController', ['$scope', 'TrialData',
function($scope, TrialData) {
/* global io */
var socket = io();
socket.on('oscMessageSent', function(data) {
console.log('socket "oscMessageSent" event received with data: ' + data);
});
socket.emit('sendOSCMessage', {
oscType: 'message',
address: '/eim/control/startSoundTest',
args: {
type: 'string',
value: TrialData.data.metadata.session_number
}
});
$scope.stopSoundTest = function() {
socket.emit('sendOSCMessage', {
oscType: 'message',
address: '/eim/control/stopSoundTest',
args: {
type: 'string',
value: TrialData.data.metadata.session_number
}
});
};
$scope.trialDataJson = function() {
return TrialData.toJson();
};
}
]); | 'use strict';
angular.module('core').controller('SoundTestController', ['$scope', 'TrialData',
function($scope, TrialData) {
/* global io */
var socket = io();
socket.on('oscMessageSent', function(data) {
console.log('socket "oscMessageSent" event received with data: ' + data);
});
socket.emit('sendOSCMessage', {
oscType: 'message',
address: '/eim/control/soundTest',
args: [
{
type: 'integer',
value: 1
},
{
type: 'string',
value: TrialData.data.metadata.session_number
}
]
});
$scope.stopSoundTest = function() {
socket.emit('sendOSCMessage', {
oscType: 'message',
address: '/eim/control/soundTest',
args: [
{
type: 'integer',
value: 0
},
{
type: 'string',
value: TrialData.data.metadata.session_number
}
]
});
};
// Send stop sound test message when controller is destroyed
$scope.$on('$destroy', $scope.stopSoundTest);
$scope.trialDataJson = function() {
return TrialData.toJson();
};
}
]); | Reformat SoundTest OSC; stop sound test on SoundTest destroy | Reformat SoundTest OSC; stop sound test on SoundTest destroy
| JavaScript | mit | brennon/eim,brennon/eim,brennon/eim,brennon/eim | ---
+++
@@ -12,23 +12,38 @@
socket.emit('sendOSCMessage', {
oscType: 'message',
- address: '/eim/control/startSoundTest',
- args: {
- type: 'string',
- value: TrialData.data.metadata.session_number
- }
+ address: '/eim/control/soundTest',
+ args: [
+ {
+ type: 'integer',
+ value: 1
+ },
+ {
+ type: 'string',
+ value: TrialData.data.metadata.session_number
+ }
+ ]
});
$scope.stopSoundTest = function() {
socket.emit('sendOSCMessage', {
oscType: 'message',
- address: '/eim/control/stopSoundTest',
- args: {
- type: 'string',
- value: TrialData.data.metadata.session_number
- }
+ address: '/eim/control/soundTest',
+ args: [
+ {
+ type: 'integer',
+ value: 0
+ },
+ {
+ type: 'string',
+ value: TrialData.data.metadata.session_number
+ }
+ ]
});
};
+
+ // Send stop sound test message when controller is destroyed
+ $scope.$on('$destroy', $scope.stopSoundTest);
$scope.trialDataJson = function() {
return TrialData.toJson(); |
4f93585a82adcc93b713cfd983d5343a23e262b3 | app/renderer/reducers/player.js | app/renderer/reducers/player.js | import {
SEEK,
SET_DURATION,
SET_CURRENT_SONG,
CHANGE_VOLUME,
CHANGE_CURRENT_SECONDS,
PLAY,
PAUSE
} from './../actions/actionTypes'
const initialState = {
isPlaying: false,
playFromSeconds: 0,
totalSeconds: 0,
currentSeconds: 0,
currentSong: {
title: '',
artist: '',
album: '',
albumArt: '',
src: ''
},
volume: 1
}
const player = (state = initialState, action) => {
switch (action.type) {
case PLAY:
return {
...state,
isPlaying: true
}
case PAUSE:
return {
...state,
isPlaying: false
}
case SEEK:
return {
...state,
playFromSeconds: action.playFromSeconds
}
case SET_CURRENT_SONG:
return {
...state,
currentSong: {
id: action.id,
title: action.title,
artist: action.artist,
album: action.album,
albumArt: action.albumArt,
src: action.src
}
}
case SET_DURATION:
return {
...state,
totalSeconds: action.totalSeconds
}
case CHANGE_VOLUME:
return {
...state,
volume: action.volume
}
case CHANGE_CURRENT_SECONDS:
return {
...state,
currentSeconds: action.currentSeconds
}
default:
return state
}
}
export default player
| import {
SEEK,
SET_DURATION,
SET_CURRENT_SONG,
CHANGE_VOLUME,
CHANGE_CURRENT_SECONDS,
PLAY,
PAUSE
} from './../actions/actionTypes'
const initialState = {
isPlaying: false,
playFromSeconds: 0,
totalSeconds: 0,
currentSeconds: 0,
currentSong: {
id: '',
title: '',
artist: '',
album: '',
albumArt: '',
src: ''
},
volume: 1
}
const player = (state = initialState, action) => {
switch (action.type) {
case PLAY:
return {
...state,
isPlaying: true
}
case PAUSE:
return {
...state,
isPlaying: false
}
case SEEK:
return {
...state,
playFromSeconds: action.playFromSeconds
}
case SET_CURRENT_SONG:
return {
...state,
currentSong: {
id: action.id,
title: action.title,
artist: action.artist,
album: action.album,
albumArt: action.albumArt,
src: action.src
}
}
case SET_DURATION:
return {
...state,
totalSeconds: action.totalSeconds
}
case CHANGE_VOLUME:
return {
...state,
volume: action.volume
}
case CHANGE_CURRENT_SECONDS:
return {
...state,
currentSeconds: action.currentSeconds
}
default:
return state
}
}
export default player
| Add missing id in initial state | Add missing id in initial state
| JavaScript | mit | AbsoluteZero273/Deezic | ---
+++
@@ -14,6 +14,7 @@
totalSeconds: 0,
currentSeconds: 0,
currentSong: {
+ id: '',
title: '',
artist: '',
album: '', |
e844bc03546c0189ba47bf1ff7915079abf2ca31 | app/service/containers/route.js | app/service/containers/route.js | import Ember from 'ember';
import MultiStatsSocket from 'ui/utils/multi-stats';
export default Ember.Route.extend({
statsSocket: null,
model() {
return this.modelFor('service').get('service');
},
activate() {
var stats = MultiStatsSocket.create({
resource: this.modelFor('service').get('service'),
linkName: 'containerStats',
});
this.set('statsSocket',stats);
stats.on('dataPoint', (data) => {
var controller = this.get('controller');
if ( controller )
{
controller.onDataPoint(data);
}
});
},
deactivate() {
this.get('statsSocket').close();
}
});
| import Ember from 'ember';
import MultiStatsSocket from 'ui/utils/multi-stats';
export default Ember.Route.extend({
statsSocket: null,
model() {
var promises = [];
// Load the hosts for the instances if they're not already there
var service = this.modelFor('service').get('service');
service.get('instances').forEach((instance) => {
if ( !instance.get('primaryHost') )
{
promises.push(instance.importLink('hosts'));
}
});
return Ember.RSVP.all(promises).then(() => {
return service;
});
},
activate() {
var stats = MultiStatsSocket.create({
resource: this.modelFor('service').get('service'),
linkName: 'containerStats',
});
this.set('statsSocket',stats);
stats.on('dataPoint', (data) => {
var controller = this.get('controller');
if ( controller )
{
controller.onDataPoint(data);
}
});
},
deactivate() {
this.get('statsSocket').close();
}
});
| Fix unknown host on services | Fix unknown host on services
| JavaScript | apache-2.0 | vincent99/ui,westlywright/ui,lvuch/ui,rancherio/ui,pengjiang80/ui,vincent99/ui,rancherio/ui,nrvale0/ui,rancher/ui,nrvale0/ui,pengjiang80/ui,ubiquityhosting/rancher_ui,westlywright/ui,pengjiang80/ui,westlywright/ui,nrvale0/ui,rancher/ui,vincent99/ui,rancherio/ui,lvuch/ui,rancher/ui,ubiquityhosting/rancher_ui,lvuch/ui,ubiquityhosting/rancher_ui | ---
+++
@@ -5,7 +5,20 @@
statsSocket: null,
model() {
- return this.modelFor('service').get('service');
+ var promises = [];
+
+ // Load the hosts for the instances if they're not already there
+ var service = this.modelFor('service').get('service');
+ service.get('instances').forEach((instance) => {
+ if ( !instance.get('primaryHost') )
+ {
+ promises.push(instance.importLink('hosts'));
+ }
+ });
+
+ return Ember.RSVP.all(promises).then(() => {
+ return service;
+ });
},
activate() { |
8e1cba95872a228b21a76b1fb2edec7bc86af86b | app/src/Components/Base/Root.js | app/src/Components/Base/Root.js | import React from 'react'
import PropTypes from 'prop-types'
import { Provider } from 'react-redux'
import { BrowserRouter } from 'react-router-dom'
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';
import BaseDataView from './BaseDataView'
function getCookieValue(a) {
var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)');
return b ? b.pop() : '';
}
const client = new ApolloClient({
uri: process.env.REACT_APP_GRAPHQL_API_URL + 'graphql',
headers: {
'Authorization': 'Bearer ' + getCookieValue('token')
}
// options: { mode: 'no-cors' }
});
window.apiUrl = process.env.REACT_APP_FLASK_API_URL;
const Root = ({ store }) => (
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<BaseDataView />
</BrowserRouter>
</Provider>
</ApolloProvider>
)
Root.propTypes = {
store: PropTypes.object.isRequired
}
export default Root
| import React from 'react'
import PropTypes from 'prop-types'
import { Provider } from 'react-redux'
import { BrowserRouter } from 'react-router-dom'
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';
import BaseDataView from './BaseDataView'
function getCookieValue(a) {
var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)');
return b ? b.pop() : '';
}
const client = new ApolloClient({
uri: process.env.REACT_APP_FLASK_API_URL + 'graphql',
headers: {
'Authorization': 'Bearer ' + getCookieValue('token')
}
// options: { mode: 'no-cors' }
});
window.apiUrl = process.env.REACT_APP_FLASK_API_URL;
const Root = ({ store }) => (
<ApolloProvider client={client}>
<Provider store={store}>
<BrowserRouter>
<BaseDataView />
</BrowserRouter>
</Provider>
</ApolloProvider>
)
Root.propTypes = {
store: PropTypes.object.isRequired
}
export default Root
| Use correct uri for AppolloClient | Use correct uri for AppolloClient
| JavaScript | apache-2.0 | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | ---
+++
@@ -14,7 +14,7 @@
const client = new ApolloClient({
- uri: process.env.REACT_APP_GRAPHQL_API_URL + 'graphql',
+ uri: process.env.REACT_APP_FLASK_API_URL + 'graphql',
headers: {
'Authorization': 'Bearer ' + getCookieValue('token')
} |
2402f07c8ce1114389bac47c49b318d931134cdb | web_app/public/js/app.js | web_app/public/js/app.js | 'use strict';
// Declare app level module which depends on filters, and services
var app = angular.module( 'myApp', [
'ngRoute',
'myApp.controllers',
'myApp.filters',
'myApp.services',
'myApp.directives',
// 3rd party dependencies
'btford.socket-io'
] );
app.config( function ( $routeProvider, $locationProvider ) {
$routeProvider.
when( '/home', {
templateUrl: 'partials/home',
controller: 'HomeCtrl'
} ).
when( '/artist/:artistURI', {
templateUrl: 'partials/artist',
controller: 'ArtistCtrl'
} ).
when( '/album/:albumURI', {
templateUrl: 'partials/album',
controller: 'AlbumCtrl'
} ).
otherwise( {
redirectTo: '/home'
} );
$locationProvider.html5Mode( true );
});
| 'use strict';
// Declare app level module which depends on filters, and services
var app = angular.module( 'myApp', [
'ngRoute',
'myApp.controllers',
'myApp.filters',
'myApp.services',
'myApp.directives',
// 3rd party dependencies
'btford.socket-io',
'fully-loaded'
] );
app.config( function ( $routeProvider, $locationProvider ) {
$routeProvider.
when( '/home', {
templateUrl: 'partials/home',
controller: 'HomeCtrl'
} ).
when( '/artist/:artistURI', {
templateUrl: 'partials/artist',
controller: 'ArtistCtrl'
} ).
when( '/album/:albumURI', {
templateUrl: 'partials/album',
controller: 'AlbumCtrl'
} ).
otherwise( {
redirectTo: '/home'
} );
$locationProvider.html5Mode( true );
});
| Install this the right way | Install this the right way
| JavaScript | mit | projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox | ---
+++
@@ -11,7 +11,8 @@
'myApp.directives',
// 3rd party dependencies
- 'btford.socket-io'
+ 'btford.socket-io',
+ 'fully-loaded'
] );
app.config( function ( $routeProvider, $locationProvider ) { |
5de143e2e7268f50b55fedc392f7408e78355c28 | src/client/assets/javascripts/app/App.js | src/client/assets/javascripts/app/App.js | import React, { PropTypes } from 'react';
const App = ({ children }) => (
<div className="page-container">
{children}
</div>
);
App.propTypes = {
children: PropTypes.element.isRequired
};
export default App;
| import React, { PropTypes } from 'react';
const App = (props) => (
<div className="page-container">
{React.cloneElement({...props}.children, {...props})}
</div>
);
App.propTypes = {
children: PropTypes.element.isRequired
};
export default App;
| Fix warning messages regarding refs and key | Fix warning messages regarding refs and key
| JavaScript | mit | dead-in-the-water/ditw,nicksp/redux-webpack-es6-boilerplate,cloady/battleship,cloady/battleship,nicksp/redux-webpack-es6-boilerplate,richbai90/CS2810,dead-in-the-water/ditw,richbai90/CS2810,richbai90/CS2810,richbai90/CS2810 | ---
+++
@@ -1,8 +1,8 @@
import React, { PropTypes } from 'react';
-const App = ({ children }) => (
+const App = (props) => (
<div className="page-container">
- {children}
+ {React.cloneElement({...props}.children, {...props})}
</div>
);
|
c14e89ab83e035103c58ed57c3681b64278c4a75 | lib/utils/cmd.js | lib/utils/cmd.js | const fs = require('fs');
const path = require('path');
/**
* Finds package.json file from either the directory the script was called from or a supplied path.
*
* console.log(findPackageFileInPath());
* console.log(findPackageFileInPath('./package.json'));
* console.log(findPackageFileInPath('~/git/github/doxdox/'));
*
* @param {String} [input] Directory or file.
* @return {String} Path to package.json file.
* @public
*/
module.exports.findPackageFileInPath = input => {
if (!input) {
input = process.cwd();
}
if (fs.existsSync(input)) {
const stat = fs.statSync(input);
if (stat.isDirectory()) {
return path.resolve(path.join(input, '/package.json'));
} else if (stat.isFile()) {
return path.resolve(path.join(path.dirname(input), '/package.json'));
}
}
return null;
};
| const fs = require('fs');
const path = require('path');
/**
* Finds package.json file from either the directory the script was called from or a supplied path.
*
* console.log(findPackageFileInPath());
* console.log(findPackageFileInPath('./package.json'));
* console.log(findPackageFileInPath('~/git/github/doxdox/'));
*
* @param {String} [input] Directory or file.
* @return {String} Path to package.json file.
* @public
*/
const findPackageFileInPath = input => {
if (!input) {
input = process.cwd();
}
if (fs.existsSync(input)) {
const stat = fs.statSync(input);
if (stat.isDirectory()) {
return path.resolve(path.join(input, '/package.json'));
} else if (stat.isFile()) {
return path.resolve(path.join(path.dirname(input), '/package.json'));
}
}
return null;
};
module.exports = {
findPackageFileInPath
};
| Change how method is exported. | Change how method is exported.
| JavaScript | mit | neogeek/doxdox | ---
+++
@@ -13,7 +13,7 @@
* @public
*/
-module.exports.findPackageFileInPath = input => {
+const findPackageFileInPath = input => {
if (!input) {
@@ -40,3 +40,7 @@
return null;
};
+
+module.exports = {
+ findPackageFileInPath
+}; |
f1ab62de1b6c7bbe13e67361311f8cb14a38813e | src/helpers/find-root.js | src/helpers/find-root.js | 'use babel'
/* @flow */
import Path from 'path'
import {findCached} from './common'
import {CONFIG_FILE_NAME} from '../defaults'
export function findRoot(directory: string): string {
const configFile = findCached(directory, CONFIG_FILE_NAME)
if (configFile !== null) {
return Path.dirname(String(configFile))
} else return directory
}
| 'use babel'
/* @flow */
import Path from 'path'
import {findCached} from './common'
import {CONFIG_FILE_NAME} from '../defaults'
export async function findRoot(directory: string): Promise<string> {
const configFile = await findCached(directory, CONFIG_FILE_NAME)
if (configFile) {
return Path.dirname(configFile)
} else return directory
}
| Upgrade findRoot to be async | :new: Upgrade findRoot to be async
| JavaScript | mit | steelbrain/UCompiler | ---
+++
@@ -6,9 +6,9 @@
import {findCached} from './common'
import {CONFIG_FILE_NAME} from '../defaults'
-export function findRoot(directory: string): string {
- const configFile = findCached(directory, CONFIG_FILE_NAME)
- if (configFile !== null) {
- return Path.dirname(String(configFile))
+export async function findRoot(directory: string): Promise<string> {
+ const configFile = await findCached(directory, CONFIG_FILE_NAME)
+ if (configFile) {
+ return Path.dirname(configFile)
} else return directory
} |
2ee0ebe084b73502b15a4a2f885a37a42abe7586 | app/templates/Gruntfile.js | app/templates/Gruntfile.js | /*!
* Generator-Gnar Gruntfile
* http://gnarmedia.com
* @author Adam Murphy
*/
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
/**
* Grunt module
*/
module.exports = function (grunt) {
/**
* Generator-Gnar Grunt config
*/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Set project info
*/
project: {
src: 'src',
dist: 'dist',
assets: '<%= project.dist %>/assets',
css: [
'<%= project.src %>/scss/style.scss'
],
js: [
'<%= project.src %>/js/*.js'
]
}
});
/**
* Default task
* Run `grunt` on the command line
*/
grunt.registerTask('default', [
]);
};
| /*!
* Generator-Gnar Gruntfile
* http://gnarmedia.com
* @author Adam Murphy
*/
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
/**
* Grunt module
*/
module.exports = function (grunt) {
/**
* Generator-Gnar Grunt config
*/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Set project info
*/
project: {
src: 'src',
dist: 'dist',
assets: '<%= project.dist %>/assets',
css: [
'<%= project.src %>/scss/style.scss'
],
js: [
'<%= project.src %>/js/*.js'
],
html: [
'<%= project.src %>/html/*.html'
]
}
});
/**
* Default task
* Run `grunt` on the command line
*/
grunt.registerTask('default', [
]);
};
| Add html property to project object | Add html property to project object
| JavaScript | mit | gnarmedia/gnenerator-gnar | ---
+++
@@ -32,6 +32,9 @@
],
js: [
'<%= project.src %>/js/*.js'
+ ],
+ html: [
+ '<%= project.src %>/html/*.html'
]
}
|
f0d015f6b45f599518e247c24c152fa5f17ba017 | esm-samples/jsapi-custom-workers/webpack.config.js | esm-samples/jsapi-custom-workers/webpack.config.js | const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: {
index: ['./src/index.css', './src/index.js']
},
node: false,
output: {
path: path.join(__dirname, 'dist'),
chunkFilename: 'chunks/[id].js',
clean: true
},
devServer: {
static: './dist',
compress: true,
port: 3001,
},
module: {
rules: [
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
]
},
plugins: [
new HtmlWebPackPlugin({
title: 'ArcGIS API for JavaScript',
template: './public/index.html',
filename: './index.html',
chunksSortMode: 'none',
inlineSource: '.(css)$'
}),
new MiniCssExtractPlugin({
filename: "[name].[chunkhash].css",
chunkFilename: "[id].css"
})
]
};
| const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: {
index: ['./src/index.css', './src/index.js']
},
node: false,
output: {
path: path.join(__dirname, 'dist'),
chunkFilename: 'chunks/[id].js'
},
devServer: {
static: path.join(__dirname, 'dist'),
compress: true,
port: 3001,
},
module: {
rules: [
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
]
},
plugins: [
new HtmlWebPackPlugin({
title: 'ArcGIS API for JavaScript',
template: './public/index.html',
filename: './index.html',
chunksSortMode: 'none',
inlineSource: '.(css)$'
}),
new MiniCssExtractPlugin({
filename: "[name].[chunkhash].css",
chunkFilename: "[id].css"
})
]
};
| Update webpack static, remove webpack clean so dist builds work again. | Update webpack static, remove webpack clean so dist builds work again.
| JavaScript | apache-2.0 | Esri/jsapi-resources,Esri/jsapi-resources,Esri/jsapi-resources | ---
+++
@@ -10,11 +10,10 @@
node: false,
output: {
path: path.join(__dirname, 'dist'),
- chunkFilename: 'chunks/[id].js',
- clean: true
+ chunkFilename: 'chunks/[id].js'
},
devServer: {
- static: './dist',
+ static: path.join(__dirname, 'dist'),
compress: true,
port: 3001,
}, |
16e45622c0de9f26679cd0cdcbe6f301d3d6fd16 | src/js/schemas/service-schema/EnvironmentVariables.js | src/js/schemas/service-schema/EnvironmentVariables.js | import {Hooks} from 'PluginSDK';
let EnvironmentVariables = {
description: 'Set environment variables for each task your service launches in addition to those set by Mesos.',
type: 'object',
title: 'Environment Variables',
properties: {
variables: {
type: 'array',
duplicable: true,
addLabel: 'Add Environment Variable',
getter: function (service) {
let variableMap = service.getEnvironmentVariables();
if (variableMap == null) {
return [{}];
}
return Object.keys(variableMap).map(function (key) {
return Hooks.applyFilter('variablesGetter', {
key,
value: variableMap[key]
}, service);
});
},
itemShape: {
properties: {
key: {
title: 'Key',
type: 'string'
},
value: {
title: 'Value',
type: 'string'
}
}
}
}
}
};
module.exports = EnvironmentVariables;
| import {Hooks} from 'PluginSDK';
let EnvironmentVariables = {
description: 'Set environment variables for each task your service launches in addition to those set by Mesos.',
type: 'object',
title: 'Environment Variables',
properties: {
variables: {
type: 'array',
duplicable: true,
addLabel: 'Add Environment Variable',
getter: function (service) {
let variableMap = service.getEnvironmentVariables();
if (variableMap == null) {
return [];
}
return Object.keys(variableMap).map(function (key) {
return Hooks.applyFilter('variablesGetter', {
key,
value: variableMap[key]
}, service);
});
},
itemShape: {
properties: {
key: {
title: 'Key',
type: 'string'
},
value: {
title: 'Value',
type: 'string'
}
}
}
}
}
};
module.exports = EnvironmentVariables;
| Remove empty object from variables array | Remove empty object from variables array
| JavaScript | apache-2.0 | dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui | ---
+++
@@ -12,7 +12,7 @@
getter: function (service) {
let variableMap = service.getEnvironmentVariables();
if (variableMap == null) {
- return [{}];
+ return [];
}
return Object.keys(variableMap).map(function (key) {
return Hooks.applyFilter('variablesGetter', { |
485e7c6a5c29f5e9f89048ef819ed2338cd54830 | src/schema/infoSchema.js | src/schema/infoSchema.js | "use strict";
const Joi = require('joi');
const contactSchema = require('./contactSchema');
const licenseSchema = require('./licenseSchema');
const pathsSchema = require('./pathsSchema');
module.exports = Joi.object({
'title': Joi.string()
.required(),
'description': Joi.string(),
'termsOfService': Joi.string(),
'contact': contactSchema.required(),
'license': licenseSchema,
'paths': pathsSchema
});
| "use strict";
const Joi = require('joi');
const contactSchema = require('./contactSchema');
const licenseSchema = require('./licenseSchema');
const pathsSchema = require('./pathsSchema');
module.exports = Joi.object({
'title': Joi.string()
.required(),
'description': Joi.string(),
'termsOfService': Joi.string(),
'contact': contactSchema.required(),
'license': licenseSchema,
'paths': pathsSchema,
'permissionProvider': Joi.func()
});
| Add permission provider to the info schema | Add permission provider to the info schema
| JavaScript | mit | Teagan42/Deepthought-Routing | ---
+++
@@ -13,5 +13,6 @@
'termsOfService': Joi.string(),
'contact': contactSchema.required(),
'license': licenseSchema,
- 'paths': pathsSchema
+ 'paths': pathsSchema,
+ 'permissionProvider': Joi.func()
}); |
f1749939532bd2e7aa659e2261aac94ded794285 | client/main.js | client/main.js | import Vue from 'vue'
import App from './App'
import I18n from 'vue-i18n'
import Cookie from 'vue-cookie'
import { sync } from 'vuex-router-sync'
import router from './router'
import store from './store'
import en from 'locales/en'
import ja from 'locales/ja'
if (process.env.NODE_ENV === 'production') {
// Enable Progressive Web App
require('./pwa')
// Redirect HTTP to HTTPS
if (window.location.protocol === 'http:') {
window.location.protocol = 'https'
}
}
sync(store, router)
const locales = {
en: en,
ja: ja
}
Vue.use(Cookie)
Vue.use(I18n)
// Check if language cookie has been set
// If so, use it
// Else use English
Vue.config.lang = Vue.cookie.get('lang') ? Vue.cookie.get('lang') : 'en'
// Set fallback used for untranslated strings
Vue.config.fallbackLang = 'en'
Object.keys(locales).forEach(lang => {
Vue.locale(lang, locales[lang])
})
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
| import Vue from 'vue'
import App from './App'
import I18n from 'vue-i18n'
import Cookie from 'vue-cookie'
import { sync } from 'vuex-router-sync'
import router from './router'
import store from './store'
import en from 'locales/en'
import ja from 'locales/ja'
if (process.env.NODE_ENV === 'production') {
// Enable Progressive Web App
require('./pwa')
// Redirect HTTP to HTTPS
// if (window.location.protocol === 'http:') {
// window.location.protocol = 'https'
// }
}
sync(store, router)
const locales = {
en: en,
ja: ja
}
Vue.use(Cookie)
Vue.use(I18n)
// Check if language cookie has been set
// If so, use it
// Else use English
Vue.config.lang = Vue.cookie.get('lang') ? Vue.cookie.get('lang') : 'en'
// Set fallback used for untranslated strings
Vue.config.fallbackLang = 'en'
Object.keys(locales).forEach(lang => {
Vue.locale(lang, locales[lang])
})
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
| Use Cloudflare for HTTPS redirect | Use Cloudflare for HTTPS redirect
| JavaScript | mit | wopian/hibari,wopian/hibari | ---
+++
@@ -13,9 +13,9 @@
require('./pwa')
// Redirect HTTP to HTTPS
- if (window.location.protocol === 'http:') {
- window.location.protocol = 'https'
- }
+ // if (window.location.protocol === 'http:') {
+ // window.location.protocol = 'https'
+ // }
}
sync(store, router) |
3f594741d55735c20ae1b7f083222e9d10e35fb5 | js/Main.js | js/Main.js | // Main JavaScript Document
var cards = [];
var mainContent = document.getElementId('main-content');
var mainContentRegion = new ZingTouch.Region(mainContent);
//Create the card object template
function contentCard(title, img, desc, link) {
"use strict";
this.title = title;
this.img = img;
this.desc = desc;
this.link = link;
}
var cardPicker = function() {
}; | // Main JavaScript Document
var cards = [];
var mainContent = document.getElementId('main-content');
var mainContentRegion = new ZingTouch.Region(mainContent);
//Create the card object template
function contentCard(title, img, desc, link) {
"use strict";
this.title = title;
this.img = img;
this.desc = desc;
this.link = link;
}
var cardPicker = (function() {
"use strict";
var cards = [];
var index = 0;
function next() {
index = index++ < cards.length ? index : 0;
return cards(index);
}
function current() {
return cards(index);
}
return {
next: next,
current: current
};
})(); | Create Card Object template and Card Picker | Create Card Object template and Card Picker
| JavaScript | mit | AnthonyGordon1/sneaker-app,AnthonyGordon1/sneaker-app | ---
+++
@@ -5,13 +5,31 @@
//Create the card object template
function contentCard(title, img, desc, link) {
- "use strict";
- this.title = title;
- this.img = img;
- this.desc = desc;
- this.link = link;
+ "use strict";
+ this.title = title;
+ this.img = img;
+ this.desc = desc;
+ this.link = link;
}
-var cardPicker = function() {
+var cardPicker = (function() {
+ "use strict";
+ var cards = [];
+ var index = 0;
-};
+ function next() {
+ index = index++ < cards.length ? index : 0;
+ return cards(index);
+ }
+
+ function current() {
+ return cards(index);
+ }
+
+ return {
+ next: next,
+ current: current
+ };
+
+
+})(); |
b0a2e9415545bd7ee6d592c3a270b2d308b80a73 | src/main/webapp/resources/js/modules/notifications.js | src/main/webapp/resources/js/modules/notifications.js | import Noty from "noty";
import "noty/src/noty.scss";
import "noty/src/themes/sunset.scss";
export function showNotification({ text, type = "success" }) {
return new Noty({
theme: "sunset",
timeout: 3500, // [integer|boolean] delay for closing event in milliseconds. Set false for sticky notifications
layout: "bottomRight",
progressBar: true,
type,
text,
animation: {
open: "animated fadeInUp",
close: "animated fadeOutDown"
}
}).show();
}
// TODO: Remove this after all notification usages are through a webpack bundle.
window.notifications = (function() {
return { show: showNotification };
})();
| import Noty from "noty";
import "noty/src/noty.scss";
import "noty/src/themes/relax.scss";
export function showNotification({ text, type = "success" }) {
return new Noty({
theme: "relax",
timeout: 3500, // [integer|boolean] delay for closing event in milliseconds. Set false for sticky notifications
layout: "bottomRight",
progressBar: true,
type,
text,
animation: {
open: "animated fadeInUp",
close: "animated fadeOutDown"
}
}).show();
}
// TODO: Remove this after all notification usages are through a webpack bundle.
window.notifications = (function() {
return { show: showNotification };
})();
| Update to use relax theme | Update to use relax theme
| JavaScript | apache-2.0 | phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida | ---
+++
@@ -1,10 +1,10 @@
import Noty from "noty";
import "noty/src/noty.scss";
-import "noty/src/themes/sunset.scss";
+import "noty/src/themes/relax.scss";
export function showNotification({ text, type = "success" }) {
return new Noty({
- theme: "sunset",
+ theme: "relax",
timeout: 3500, // [integer|boolean] delay for closing event in milliseconds. Set false for sticky notifications
layout: "bottomRight",
progressBar: true, |
0ba67c44d9151fe6286603180e48d1f217344d26 | client/util.js | client/util.js | var validateFloat = function(val) {
if (typeof val != 'undefined') {
val = parseFloat(val);
if (! isNaN(val)) {
if (val > -99999 ) {
return val;
}
}
}
return Infinity;
};
var enableFilter = function (id) {
var f = window.app.filters.get(id);
// FIXME: data keys are assumed to be lower case, but this is not checked/ensured
var id_lower = id.toLowerCase();
f._dx = window.app.crossfilter.dimension( function(d) {return validateFloat(d[id_lower]);});
f.active = true;
};
var disableFilter = function (id) {
var f = window.app.filters.get(id);
f._dx.dispose();
delete f._dx;
};
module.exports = {
validateFloat: validateFloat,
enableFilter: enableFilter,
disableFilter: disableFilter,
};
| var validateFloat = function(val) {
if (typeof val != 'undefined') {
val = parseFloat(val);
if (! isNaN(val)) {
if (val > -99999 ) {
return val;
}
}
}
return Infinity;
};
var enableFilter = function (id) {
var f = window.app.filters.get(id);
// FIXME: data keys are assumed to be lower case, but this is not checked/ensured
var id_lower = id.toLowerCase();
f._dx = window.app.crossfilter.dimension( function(d) {return validateFloat(d[id_lower]);});
f.active = true;
};
var disableFilter = function (id) {
var f = window.app.filters.get(id);
f._dx.dispose();
delete f._dx;
f.active = false;
};
module.exports = {
validateFloat: validateFloat,
enableFilter: enableFilter,
disableFilter: disableFilter,
};
| Fix bug where filter was not set to inacative | Fix bug where filter was not set to inacative
| JavaScript | apache-2.0 | summerinthecity/uhitool,jspaaks/spot,NLeSC/spot,jspaaks/spot,jiskattema/uhitool,summerinthecity/uhitool,jiskattema/uhitool | ---
+++
@@ -25,6 +25,8 @@
f._dx.dispose();
delete f._dx;
+
+ f.active = false;
};
module.exports = { |
204de9d56b72ce5387af7bdd5dffab60d16e31e9 | nodejs/config.js | nodejs/config.js | require('dotenv').config({
silent: true,
})
let makeHostConfig = (env, prefix) => {
let host = env[prefix + '_HOST'] || '127.0.0.1'
let port = parseInt(env[prefix + '_PORT'], 10) || 3030
let https = env[prefix + '_HTTPS'] === 'true' || env[prefix + '_HTTPS'] === true
let default_port, protocol
if (https) {
default_port = 443
protocol = 'https'
} else {
default_port = 80
protocol = 'http'
}
let url = protocol + '://' + host + (port === default_port ? '' : ':' + port)
return {
host,
port,
url,
protocol,
https,
}
}
const env = process.env.APP_ENV || 'local'
const atom = {
announcement_url: process.env.ATOM_PLUGIN_ANNOUNCEMENT_URL || '#',
}
module.exports = {
node: makeHostConfig(process.env, 'NODE'),
api: makeHostConfig(process.env, 'API'),
external: makeHostConfig(process.env, 'APP'),
websocket: makeHostConfig(process.env, 'ECHO'),
debug: process.env.APP_DEBUG === 'true' || process.env.APP_DEBUG === true,
env,
production: env === 'production',
dev: env !== 'production',
atom,
analytics_track_id: process.env.GOOGLE_ANALYTICS_TRACK_ID
}
| require('dotenv').config({
silent: true,
})
let makeHostConfig = (env, prefix) => {
let host = env[prefix + '_HOST'] || '127.0.0.1'
let port = parseInt(env[prefix + '_PORT'], 10) || 3030
let https = env[prefix + '_HTTPS'] === 'true' || env[prefix + '_HTTPS'] === true
let default_port, protocol
if (https) {
default_port = 443
protocol = 'https'
} else {
default_port = 80
protocol = 'http'
}
let url = protocol + '://' + host + (port === default_port ? '' : ':' + port)
return {
host,
port,
url,
protocol,
https,
}
}
const env = process.env.APP_ENV || 'local'
const atom = {
announcement_url: process.env.ATOM_PLUGIN_ANNOUNCEMENT_URL || '#',
}
module.exports = {
node: makeHostConfig(process.env, 'NODE'),
api: makeHostConfig(process.env, 'API'),
external: makeHostConfig(process.env, 'APP'),
websocket: {
host: process.env.ECHO_HOST || 'localhost',
port: process.env.ECHO_PORT || '6002',
},
debug: process.env.APP_DEBUG === 'true' || process.env.APP_DEBUG === true,
env,
production: env === 'production',
dev: env !== 'production',
atom,
analytics_track_id: process.env.GOOGLE_ANALYTICS_TRACK_ID
}
| Implement HTTPS support for Docker | Implement HTTPS support for Docker
| JavaScript | mit | viblo-asia/api-proxy | ---
+++
@@ -38,7 +38,10 @@
node: makeHostConfig(process.env, 'NODE'),
api: makeHostConfig(process.env, 'API'),
external: makeHostConfig(process.env, 'APP'),
- websocket: makeHostConfig(process.env, 'ECHO'),
+ websocket: {
+ host: process.env.ECHO_HOST || 'localhost',
+ port: process.env.ECHO_PORT || '6002',
+ },
debug: process.env.APP_DEBUG === 'true' || process.env.APP_DEBUG === true,
env,
production: env === 'production', |
796488305ab4f2231a58bd18474268bd8c7b5952 | components/EditableEntry.js | components/EditableEntry.js | /**
* @flow
*/
import React from 'react';
import { StyleSheet, TextInput } from 'react-native';
import PropTypes from 'prop-types';
import Box from './Box';
class EditableEntry extends React.Component {
render() {
return (
<Box numberOfLines={1}>
<TextInput
style={styles.textInput}
onChangeText={(text) => this.props.onChangeText(text)}
onSubmitEditing={(event) => this.props.onSubmit(event.nativeEvent.text)}
autoFocus={true}
value={this.props.text}
/>
</Box>
);
}
}
EditableEntry.propTypes = {
text: PropTypes.string.isRequired,
onChangeText: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired
};
const styles = StyleSheet.create({
textInput: {
paddingTop: 6,
paddingLeft: 6,
height: 28,
color: '#27ae60',
alignItems: 'center',
justifyContent: 'center',
fontSize: 14,
fontFamily: 'Helvetica',
fontStyle: 'italic',
fontWeight: 'bold',
},
});
export default EditableEntry; | /**
* @flow
*/
import React from 'react';
import { StyleSheet, TextInput } from 'react-native';
import PropTypes from 'prop-types';
import Box from './Box';
class EditableEntry extends React.Component {
render() {
return (
<Box numberOfLines={1}>
<TextInput
style={styles.textInput}
onChangeText={(text) => this.props.onChangeText(text)}
onSubmitEditing={(event) => this.props.onSubmit(event.nativeEvent.text)}
autoFocus={true}
value={this.props.text}
returnKeyType="done"
/>
</Box>
);
}
}
EditableEntry.propTypes = {
text: PropTypes.string.isRequired,
onChangeText: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired
};
const styles = StyleSheet.create({
textInput: {
paddingTop: 6,
paddingLeft: 6,
height: 28,
color: '#27ae60',
alignItems: 'center',
justifyContent: 'center',
fontSize: 14,
fontFamily: 'Helvetica',
fontStyle: 'italic',
fontWeight: 'bold',
},
});
export default EditableEntry; | Add a returnKeyType to the input keyboard | Add a returnKeyType to the input keyboard
| JavaScript | mit | nikhilsaraf/react-native-todo-app | ---
+++
@@ -17,6 +17,7 @@
onSubmitEditing={(event) => this.props.onSubmit(event.nativeEvent.text)}
autoFocus={true}
value={this.props.text}
+ returnKeyType="done"
/>
</Box>
); |
65bbd24974974672c60eea3f250564be6a4bfead | webroot/rsrc/js/application/differential/behavior-user-select.js | webroot/rsrc/js/application/differential/behavior-user-select.js | /**
* @provides javelin-behavior-differential-user-select
* @requires javelin-behavior
* javelin-dom
* javelin-stratcom
*/
JX.behavior('differential-user-select', function() {
var unselectable;
function isOnRight(node) {
return node.parentNode.firstChild != node.previousSibling;
}
JX.Stratcom.listen(
'mousedown',
null,
function(e) {
var key = 'differential-unselectable';
if (unselectable) {
JX.DOM.alterClass(unselectable, key, false);
}
var diff = e.getNode('differential-diff');
var td = e.getNode('tag:td');
if (diff && td && isOnRight(td)) {
unselectable = diff;
JX.DOM.alterClass(diff, key, true);
}
});
});
| /**
* @provides javelin-behavior-differential-user-select
* @requires javelin-behavior
* javelin-dom
* javelin-stratcom
*/
JX.behavior('differential-user-select', function() {
var unselectable;
function isOnRight(node) {
return node.previousSibling &&
node.parentNode.firstChild != node.previousSibling;
}
JX.Stratcom.listen(
'mousedown',
null,
function(e) {
var key = 'differential-unselectable';
if (unselectable) {
JX.DOM.alterClass(unselectable, key, false);
}
var diff = e.getNode('differential-diff');
var td = e.getNode('tag:td');
if (diff && td && isOnRight(td)) {
unselectable = diff;
JX.DOM.alterClass(diff, key, true);
}
});
});
| Enable selecting text in Differential shield and gap | Enable selecting text in Differential shield and gap
Test Plan:
Selected text in shield.
Selected text in right side.
Reviewers: epriestley, btrahan
Reviewed By: btrahan
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3522
| JavaScript | apache-2.0 | vuamitom/phabricator,r4nt/phabricator,denisdeejay/phabricator,Automattic/phabricator,Automattic/phabricator,hshackathons/phabricator-deprecated,wangjun/phabricator,telerik/phabricator,zhihu/phabricator,devurandom/phabricator,christopher-johnson/phabricator,huaban/phabricator,matthewrez/phabricator,aswanderley/phabricator,sharpwhisper/phabricator,huaban/phabricator,Khan/phabricator,dannysu/phabricator,aswanderley/phabricator,Automattic/phabricator,leolujuyi/phabricator,kanarip/phabricator,memsql/phabricator,akkakks/phabricator,parksangkil/phabricator,vuamitom/phabricator,kwoun1982/phabricator,hach-que/unearth-phabricator,huangjimmy/phabricator-1,wikimedia/phabricator-phabricator,phacility/phabricator,coursera/phabricator,tanglu-org/tracker-phabricator,akkakks/phabricator,jwdeitch/phabricator,wikimedia/phabricator,Khan/phabricator,christopher-johnson/phabricator,folsom-labs/phabricator,r4nt/phabricator,Soluis/phabricator,wusuoyongxin/phabricator,a20012251/phabricator,apexstudios/phabricator,tanglu-org/tracker-phabricator,folsom-labs/phabricator,Symplicity/phabricator,WuJiahu/phabricator,aik099/phabricator,devurandom/phabricator,MicroWorldwide/phabricator,aswanderley/phabricator,wikimedia/phabricator-phabricator,kalbasit/phabricator,devurandom/phabricator,kalbasit/phabricator,benchling/phabricator,NigelGreenway/phabricator,akkakks/phabricator,folsom-labs/phabricator,UNCC-OpenProjects/Phabricator,tanglu-org/tracker-phabricator,Soluis/phabricator,WuJiahu/phabricator,shl3807/phabricator,cjxgm/p.cjprods.org,librewiki/phabricator,huangjimmy/phabricator-1,MicroWorldwide/phabricator,akkakks/phabricator,Automatic/phabricator,freebsd/phabricator,wikimedia/phabricator,benchling/phabricator,wikimedia/phabricator,wangjun/phabricator,NigelGreenway/phabricator,optimizely/phabricator,codevlabs/phabricator,wusuoyongxin/phabricator,a20012251/phabricator,gsinkovskiy/phabricator,kanarip/phabricator,NigelGreenway/phabricator,ide/phabricator,Automatic/phabricator,Khan/phabricator,sharpwhisper/phabricator,shrimpma/phabricator,phacility/phabricator,christopher-johnson/phabricator,matthewrez/phabricator,eSpark/phabricator,jwdeitch/phabricator,MicroWorldwide/phabricator,librewiki/phabricator,zhihu/phabricator,aswanderley/phabricator,schlaile/phabricator,NigelGreenway/phabricator,aik099/phabricator,christopher-johnson/phabricator,r4nt/phabricator,uhd-urz/phabricator,vinzent/phabricator,shrimpma/phabricator,eSpark/phabricator,ryancford/phabricator,vuamitom/phabricator,hach-que/unearth-phabricator,ryancford/phabricator,vuamitom/phabricator,librewiki/phabricator,codevlabs/phabricator,gsinkovskiy/phabricator,kwoun1982/phabricator,huaban/phabricator,leolujuyi/phabricator,kwoun1982/phabricator,telerik/phabricator,wxstars/phabricator,r4nt/phabricator,parksangkil/phabricator,uhd-urz/phabricator,coursera/phabricator,dannysu/phabricator,codevlabs/phabricator,hach-que/unearth-phabricator,Soluis/phabricator,leolujuyi/phabricator,Drooids/phabricator,wxstars/phabricator,aik099/phabricator,ide/phabricator,wusuoyongxin/phabricator,denisdeejay/phabricator,sharpwhisper/phabricator,Khan/phabricator,cjxgm/p.cjprods.org,kanarip/phabricator,ide/phabricator,eSpark/phabricator,librewiki/phabricator,optimizely/phabricator,UNCC-OpenProjects/Phabricator,shl3807/phabricator,aswanderley/phabricator,shrimpma/phabricator,optimizely/phabricator,freebsd/phabricator,ide/phabricator,devurandom/phabricator,huangjimmy/phabricator-1,coursera/phabricator,hshackathons/phabricator-deprecated,christopher-johnson/phabricator,telerik/phabricator,phacility/phabricator,uhd-urz/phabricator,Automatic/phabricator,cjxgm/p.cjprods.org,denisdeejay/phabricator,leolujuyi/phabricator,matthewrez/phabricator,apexstudios/phabricator,wikimedia/phabricator,optimizely/phabricator,UNCC-OpenProjects/Phabricator,wxstars/phabricator,zhihu/phabricator,vinzent/phabricator,memsql/phabricator,zhihu/phabricator,devurandom/phabricator,schlaile/phabricator,vinzent/phabricator,huaban/phabricator,wxstars/phabricator,codevlabs/phabricator,huangjimmy/phabricator-1,eSpark/phabricator,denisdeejay/phabricator,jwdeitch/phabricator,Symplicity/phabricator,memsql/phabricator,gsinkovskiy/phabricator,eSpark/phabricator,UNCC-OpenProjects/Phabricator,memsql/phabricator,parksangkil/phabricator,memsql/phabricator,Drooids/phabricator,schlaile/phabricator,optimizely/phabricator,Symplicity/phabricator,kanarip/phabricator,hach-que/phabricator,hach-que/unearth-phabricator,freebsd/phabricator,WuJiahu/phabricator,r4nt/phabricator,hach-que/phabricator,ryancford/phabricator,hach-que/phabricator,shl3807/phabricator,benchling/phabricator,matthewrez/phabricator,folsom-labs/phabricator,MicroWorldwide/phabricator,codevlabs/phabricator,devurandom/phabricator,ryancford/phabricator,zhihu/phabricator,sharpwhisper/phabricator,Soluis/phabricator,dannysu/phabricator,WuJiahu/phabricator,kwoun1982/phabricator,coursera/phabricator,benchling/phabricator,phacility/phabricator,freebsd/phabricator,wangjun/phabricator,tanglu-org/tracker-phabricator,hach-que/phabricator,a20012251/phabricator,kanarip/phabricator,hshackathons/phabricator-deprecated,hshackathons/phabricator-deprecated,a20012251/phabricator,uhd-urz/phabricator,shl3807/phabricator,kwoun1982/phabricator,wikimedia/phabricator-phabricator,akkakks/phabricator,librewiki/phabricator,hshackathons/phabricator-deprecated,kalbasit/phabricator,NigelGreenway/phabricator,zhihu/phabricator,hach-que/unearth-phabricator,sharpwhisper/phabricator,vinzent/phabricator,wikimedia/phabricator-phabricator,wangjun/phabricator,hach-que/phabricator,wusuoyongxin/phabricator,aik099/phabricator,Soluis/phabricator,shrimpma/phabricator,Symplicity/phabricator,wikimedia/phabricator-phabricator,gsinkovskiy/phabricator,vinzent/phabricator,tanglu-org/tracker-phabricator,a20012251/phabricator,dannysu/phabricator,vuamitom/phabricator,Automatic/phabricator,Drooids/phabricator,apexstudios/phabricator,parksangkil/phabricator,kalbasit/phabricator,huangjimmy/phabricator-1,uhd-urz/phabricator,Drooids/phabricator,cjxgm/p.cjprods.org,schlaile/phabricator,cjxgm/p.cjprods.org,gsinkovskiy/phabricator,dannysu/phabricator,folsom-labs/phabricator,jwdeitch/phabricator | ---
+++
@@ -10,7 +10,8 @@
var unselectable;
function isOnRight(node) {
- return node.parentNode.firstChild != node.previousSibling;
+ return node.previousSibling &&
+ node.parentNode.firstChild != node.previousSibling;
}
JX.Stratcom.listen( |
9d7031b6dcf8c8ce6a36cdfc73c9d467a44517b5 | js/game.js | js/game.js | var Game = function(boardString){
var board = '';
this.board = '';
if (arguments.length === 1) {
this.board = this.toArray(boardString);
} else {
function random() {
return Math.floor(Math.random() * 10 + 6);
};
var firstTwo = random(), secondTwo = random();
for ( var i = 0; i < 16; i++ ) {
if (i === firstTwo || i === secondTwo) {
board += '2';
} else {
board += '0';
};
};
this.board = this.toArray(board);
}
};
Game.prototype = {
toString: function() {
for( var i = 0; i < 16; i += 4){
this.array = this.board.slice(0 + i, 4 + i)
console.log(this.array)
}
},
toArray: function(chars) {
var boardArray = [];
for( var i = 0; i < 16; i += 4) {
var subarray = chars.slice(0 + i, 4 + i);
boardArray.push(subarray.split(''));
}
return boardArray;
}
};
| var Game = function(boardString){
var board = '';
this.board = '';
if (arguments.length === 1) {
this.board = this.toArray(boardString);
} else {
function random() {
return Math.floor(Math.random() * 10 + 6);
};
var firstTwo = random(), secondTwo = random();
for ( var i = 0; i < 16; i++ ) {
if (i === firstTwo || i === secondTwo) {
board += '2';
} else {
board += '0';
};
};
this.board = this.toArray(board);
}
};
Game.prototype = {
toString: function() {
this.board.forEach(function(row) {
console.log(row.join(''));
});
},
toArray: function(chars) {
var boardArray = [];
for( var i = 0; i < 16; i += 4) {
var subarray = chars.slice(0 + i, 4 + i);
boardArray.push(subarray.split(''));
}
return boardArray;
}
};
| Modify toString method for board array format | Modify toString method for board array format
| JavaScript | mit | suprfrye/galaxy-256,suprfrye/galaxy-256 | ---
+++
@@ -22,10 +22,9 @@
Game.prototype = {
toString: function() {
- for( var i = 0; i < 16; i += 4){
- this.array = this.board.slice(0 + i, 4 + i)
- console.log(this.array)
- }
+ this.board.forEach(function(row) {
+ console.log(row.join(''));
+ });
},
toArray: function(chars) { |
b795f71c87be22da3892c6cc9eca607b229c66bf | packages/ember-data/lib/instance-initializers/initialize-store-service.js | packages/ember-data/lib/instance-initializers/initialize-store-service.js | /**
Configures a registry for use with an Ember-Data
store.
@method initializeStore
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
export default function initializeStoreService(applicationOrRegistry) {
var registry, container;
if (applicationOrRegistry.registry && applicationOrRegistry.container) {
// initializeStoreService was registered with an
// instanceInitializer. The first argument is the application
// instance.
registry = applicationOrRegistry.registry;
container = applicationOrRegistry.container;
} else {
// initializeStoreService was called by an initializer instead of
// an instanceInitializer. The first argument is a registy. This
// case allows ED to support Ember pre 1.12
registry = applicationOrRegistry;
container = registry.container();
}
// Eagerly generate the store so defaultStore is populated.
var store = container.lookup('store:application');
registry.register('service:store', store, { instantiate: false });
}
| /**
Configures a registry for use with an Ember-Data
store.
@method initializeStore
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
export default function initializeStoreService(applicationOrRegistry) {
var registry, container;
if (applicationOrRegistry.registry && applicationOrRegistry.container) {
// initializeStoreService was registered with an
// instanceInitializer. The first argument is the application
// instance.
registry = applicationOrRegistry.registry;
container = applicationOrRegistry.container;
} else {
// initializeStoreService was called by an initializer instead of
// an instanceInitializer. The first argument is a registy. This
// case allows ED to support Ember pre 1.12
registry = applicationOrRegistry;
if (registry.container) { // Support Ember 1.10 - 1.11
container = registry.container();
} else { // Support Ember 1.9
container = registry;
}
}
// Eagerly generate the store so defaultStore is populated.
var store = container.lookup('store:application');
registry.register('service:store', store, { instantiate: false });
}
| Support for Ember 1.9's container API after `store:application` refactor. | Support for Ember 1.9's container API after `store:application` refactor.
| JavaScript | mit | andrejunges/data,Turbo87/ember-data,fpauser/data,Turbo87/ember-data,gniquil/data,flowjzh/data,Kuzirashi/data,tstirrat/ember-data,webPapaya/data,gkaran/data,eriktrom/data,minasmart/data,dustinfarris/data,danmcclain/data,workmanw/data,ryanpatrickcook/data,jgwhite/data,minasmart/data,HeroicEric/data,ryanpatrickcook/data,offirgolan/data,usecanvas/data,minasmart/data,XrXr/data,bcardarella/data,seanpdoyle/data,faizaanshamsi/data,hibariya/data,stefanpenner/data,jgwhite/data,flowjzh/data,Robdel12/data,zoeesilcock/data,splattne/data,rtablada/data,fpauser/data,davidpett/data,hibariya/data,Eric-Guo/data,jgwhite/data,workmanw/data,heathharrelson/data,eriktrom/data,zoeesilcock/data,pdud/data,PrecisionNutrition/data,Kuzirashi/data,gabriel-letarte/data,sammcgrail/data,usecanvas/data,davidpett/data,acburdine/data,nickiaconis/data,dustinfarris/data,tarzan/data,hibariya/data,Robdel12/data,yaymukund/data,gabriel-letarte/data,gniquil/data,danmcclain/data,davidpett/data,tarzan/data,wecc/data,bf4/data,EmberSherpa/data,greyhwndz/data,acburdine/data,pdud/data,andrejunges/data,zoeesilcock/data,ryanpatrickcook/data,arenoir/data,bcardarella/data,lostinpatterns/data,seanpdoyle/data,davidpett/data,fsmanuel/data,heathharrelson/data,fsmanuel/data,swarmbox/data,duggiefresh/data,whatthewhat/data,topaxi/data,acburdine/data,PrecisionNutrition/data,Eric-Guo/data,Eric-Guo/data,bf4/data,tstirrat/ember-data,Robdel12/data,pdud/data,Kuzirashi/data,courajs/data,simaob/data,sebweaver/data,duggiefresh/data,PrecisionNutrition/data,arenoir/data,workmanw/data,hibariya/data,vikram7/data,whatthewhat/data,thaume/data,fpauser/data,lostinpatterns/data,InboxHealth/data,whatthewhat/data,sebweaver/data,sammcgrail/data,wecc/data,gkaran/data,vikram7/data,sammcgrail/data,sebweaver/data,vikram7/data,dustinfarris/data,gniquil/data,EmberSherpa/data,XrXr/data,minasmart/data,bcardarella/data,eriktrom/data,heathharrelson/data,gabriel-letarte/data,H1D/data,H1D/data,mphasize/data,Turbo87/ember-data,jgwhite/data,lostinpatterns/data,andrejunges/data,eriktrom/data,EmberSherpa/data,seanpdoyle/data,InboxHealth/data,Kuzirashi/data,XrXr/data,sammcgrail/data,dustinfarris/data,courajs/data,offirgolan/data,swarmbox/data,lostinpatterns/data,splattne/data,andrejunges/data,tarzan/data,mphasize/data,rtablada/data,nickiaconis/data,faizaanshamsi/data,thaume/data,thaume/data,duggiefresh/data,vikram7/data,pdud/data,tarzan/data,splattne/data,heathharrelson/data,arenoir/data,usecanvas/data,danmcclain/data,bf4/data,tstirrat/ember-data,flowjzh/data,topaxi/data,webPapaya/data,thaume/data,wecc/data,rtablada/data,offirgolan/data,bf4/data,simaob/data,sebastianseilund/data,swarmbox/data,ryanpatrickcook/data,mphasize/data,H1D/data,splattne/data,topaxi/data,yaymukund/data,duggiefresh/data,simaob/data,yaymukund/data,seanpdoyle/data,workmanw/data,webPapaya/data,fsmanuel/data,sebastianseilund/data,XrXr/data,H1D/data,stefanpenner/data,simaob/data,nickiaconis/data,nickiaconis/data,mphasize/data,Turbo87/ember-data,flowjzh/data,greyhwndz/data,faizaanshamsi/data,webPapaya/data,stefanpenner/data,InboxHealth/data,swarmbox/data,bcardarella/data,sebweaver/data,courajs/data,tstirrat/ember-data,greyhwndz/data,rtablada/data,Robdel12/data,arenoir/data,sebastianseilund/data,whatthewhat/data,greyhwndz/data,gabriel-letarte/data,gniquil/data,fsmanuel/data,danmcclain/data,acburdine/data,faizaanshamsi/data,fpauser/data,InboxHealth/data,PrecisionNutrition/data,yaymukund/data,zoeesilcock/data,usecanvas/data,topaxi/data,gkaran/data,sebastianseilund/data,EmberSherpa/data,gkaran/data,offirgolan/data,courajs/data,HeroicEric/data,stefanpenner/data,wecc/data,Eric-Guo/data,HeroicEric/data,HeroicEric/data | ---
+++
@@ -18,7 +18,11 @@
// an instanceInitializer. The first argument is a registy. This
// case allows ED to support Ember pre 1.12
registry = applicationOrRegistry;
- container = registry.container();
+ if (registry.container) { // Support Ember 1.10 - 1.11
+ container = registry.container();
+ } else { // Support Ember 1.9
+ container = registry;
+ }
}
// Eagerly generate the store so defaultStore is populated.
var store = container.lookup('store:application'); |
81248f3d84a40336e9d9d0e9a4f5c43441d0e381 | main.js | main.js | var app = require('http').createServer(handler);
var io = require('socket.io').listen(app);
var fs = require('fs');
var util = require('util');
var Tail = require('tail').Tail;
var static = require('node-static');
var file = new static.Server('./web', {cache: 6}); //cache en secondes
function handler (req, res) {
if( req.url == '/') {
file.serveFile('/index.html', 200, {}, req, res);
}
req.addListener('end', function() {
file.serve(req, res);
}).resume();
}
app.listen(1337, '0.0.0.0');
function followFile(socket, file) {
try {
tail = new Tail(file);
} catch (err) {
socket.emit('cant follow', {reason: err.code, file: file});
return;
}
tail.on("line", function(data) {
socket.emit('line', {file:file, data:data});
});
socket.emit('followed', {file: file});
}
io.sockets.on('connection', function (socket) {
socket.on('follow', function(data) {
followFile(socket, data.file);
});
}); | var app = require('http').createServer(handler);
var io = require('socket.io').listen(app);
var fs = require('fs');
var util = require('util');
var Tail = require('tail').Tail;
var static = require('node-static');
var file = new static.Server('./web', {cache: 6}); //cache en secondes
var loadNbLines = 10;
function handler (req, res) {
if( req.url == '/') {
file.serveFile('/index.html', 200, {}, req, res);
}
req.addListener('end', function() {
file.serve(req, res);
}).resume();
}
app.listen(1337, '0.0.0.0');
function followFile(socket, file) {
try {
tail = new Tail(file);
} catch (err) {
socket.emit('cant follow', {reason: err.code, file: file});
return;
}
fs.readFile(file, {encoding: "utf-8"}, function(err, data) {
parts = data.split("\n");
len = parts.length;
if (len <= loadNbLines)
start = 0;
else
start = len - loadNbLines - 1;
for (i = start; i < len; i++) {
socket.emit('line', {file:file, data:parts[i]});
}
});
tail.on("line", function(data) {
socket.emit('line', {file:file, data:data});
});
socket.emit('followed', {file: file});
}
io.sockets.on('connection', function (socket) {
socket.on('follow', function(data) {
followFile(socket, data.file);
});
}); | Read 10 lines from the file when starting to follow | Read 10 lines from the file when starting to follow | JavaScript | mit | feuloren/logreader | ---
+++
@@ -6,6 +6,8 @@
var static = require('node-static');
var file = new static.Server('./web', {cache: 6}); //cache en secondes
+
+var loadNbLines = 10;
function handler (req, res) {
if( req.url == '/') {
@@ -26,6 +28,17 @@
socket.emit('cant follow', {reason: err.code, file: file});
return;
}
+ fs.readFile(file, {encoding: "utf-8"}, function(err, data) {
+ parts = data.split("\n");
+ len = parts.length;
+ if (len <= loadNbLines)
+ start = 0;
+ else
+ start = len - loadNbLines - 1;
+ for (i = start; i < len; i++) {
+ socket.emit('line', {file:file, data:parts[i]});
+ }
+ });
tail.on("line", function(data) {
socket.emit('line', {file:file, data:data}); |
2e5ed8a3bbf39be10cc528047345b43c9595eecf | client/app/components/printerList/index.js | client/app/components/printerList/index.js | import React, { PropTypes } from 'react';
import style from './style.css';
import Printer from '../printer';
class PrinterListComponent extends React.Component {
getPrinterComponent(key) {
return (<Printer
{...this.props.printers[key]} key={key}
toggleSelected={() => { this.props.toggleSelected(key); }} />);
}
generatePrinterList() {
let keys = Object.keys(this.props.printers);
let printerRows = [];
if (keys.length > 0) {
let howManyTimes = Math.floor(keys.length / 2);
for (let i = 0; i < howManyTimes; i+=1) {
console.log(Math.floor(keys.length/2));
printerRows.push(
<div key={i}>
{this.getPrinterComponent(keys[i * 2])}
{ keys[(i * 2) + 1] && this.getPrinterComponent(keys[(i * 2) + 1])}
</div>);
}
return printerRows;
}
return (<div></div>);
}
render() {
return (
<div className={style.printerList}>
{this.generatePrinterList()}
</div>);
}
}
PrinterListComponent.propTypes = {
printers: PropTypes.object.isRequired,
toggleSelected: PropTypes.func.isRequired,
};
export default PrinterListComponent;
| import React, { PropTypes } from 'react';
import style from './style.css';
import Printer from '../printer';
class PrinterListComponent extends React.Component {
getPrinterComponent(key) {
return (<Printer
{...this.props.printers[key]} key={key}
toggleSelected={() => { this.props.toggleSelected(key); }} />);
}
generatePrinterList() {
let keys = Object.keys(this.props.printers);
let printerRows = [];
if (keys.length > 0) {
let howManyTimes = Math.ceil(keys.length / 2);
for (let i = 0; i < howManyTimes; i+=1) {
printerRows.push(
<div key={i}>
{this.getPrinterComponent(keys[i * 2])}
{ keys[(i * 2) + 1] && this.getPrinterComponent(keys[(i * 2) + 1])}
</div>);
}
return printerRows;
}
return (<div></div>);
}
render() {
return (
<div className={style.printerList}>
{this.generatePrinterList()}
</div>);
}
}
PrinterListComponent.propTypes = {
printers: PropTypes.object.isRequired,
toggleSelected: PropTypes.func.isRequired,
};
export default PrinterListComponent;
| Fix last printer not showing when there was odd number of printers | Fix last printer not showing when there was odd number of printers
| JavaScript | agpl-3.0 | MakersLab/farm-client,MakersLab/farm-client | ---
+++
@@ -15,9 +15,8 @@
let keys = Object.keys(this.props.printers);
let printerRows = [];
if (keys.length > 0) {
- let howManyTimes = Math.floor(keys.length / 2);
+ let howManyTimes = Math.ceil(keys.length / 2);
for (let i = 0; i < howManyTimes; i+=1) {
- console.log(Math.floor(keys.length/2));
printerRows.push(
<div key={i}>
{this.getPrinterComponent(keys[i * 2])} |
bc548adb239f564fa0815fa050a9c0e9d6f59ed7 | main.js | main.js | import Bot from 'telegram-api/build';
import Message from 'telegram-api/types/Message';
import subscribe from './commands/subscribe';
import doc from './commands/doc';
let bot = new Bot({
token: '121143906:AAFJz_-Bjwq_8KQqTmyY2MtlcPb-bX_1O7M'
});
bot.start();
const welcome = new Message().text(`Hello!
I give you services to search across various sources such as MDN, GitHub, etc.
Commands:
/subscribe - Subscribe to /r/javascript and get a message for each new message
/unsubscribe - Unsubscribe
/doc [subject] - Search MDN for the given subject`);
bot.command('start', message => {
bot.send(welcome.to(message.chat.id));
});
subscribe(bot);
doc(bot);
| import Bot from 'telegram-api/build';
import Message from 'telegram-api/types/Message';
import subscribe from './commands/subscribe';
import doc from './commands/doc';
let bot = new Bot({
token: '121143906:AAFJz_-Bjwq_8KQqTmyY2MtlcPb-bX_1O7M'
});
bot.start();
const COMMANDS = `Commands:
/subscribe - Subscribe to /r/javascript and get a message for each new message
/unsubscribe - Unsubscribe
/doc [subject] - Search MDN for the given subject
/github [subject] - Search GitHub for a repository
/npm [subject] - Search NPM for a package`;
const start = new Message().text(`Hello!
I give you services to search across various sources such as MDN, GitHub, etc.
${COMMANDS}`);
bot.command('start', message => {
bot.send(start.to(message.chat.id));
});
const help = new Message().text(COMMANDS);
bot.command('help', message => {
bot.send(help.to(message.chat.id));
});
subscribe(bot);
doc(bot);
| Add help command Add github and npm to commands | Add help command
Add github and npm to commands
| JavaScript | artistic-2.0 | mdibaiee/webdevrobot | ---
+++
@@ -9,15 +9,25 @@
bot.start();
-const welcome = new Message().text(`Hello!
+const COMMANDS = `Commands:
+/subscribe - Subscribe to /r/javascript and get a message for each new message
+/unsubscribe - Unsubscribe
+/doc [subject] - Search MDN for the given subject
+/github [subject] - Search GitHub for a repository
+/npm [subject] - Search NPM for a package`;
+
+const start = new Message().text(`Hello!
I give you services to search across various sources such as MDN, GitHub, etc.
-Commands:
-/subscribe - Subscribe to /r/javascript and get a message for each new message
-/unsubscribe - Unsubscribe
-/doc [subject] - Search MDN for the given subject`);
+${COMMANDS}`);
+
bot.command('start', message => {
- bot.send(welcome.to(message.chat.id));
+ bot.send(start.to(message.chat.id));
+});
+
+const help = new Message().text(COMMANDS);
+bot.command('help', message => {
+ bot.send(help.to(message.chat.id));
});
|
d23a9060c4174db9b99a2e54924223e79ac5a828 | packages/custom/voteeHome/public/tests/voteeHome.spec.js | packages/custom/voteeHome/public/tests/voteeHome.spec.js | 'use strict';
(function() {
describe("voteeHome", function() {
beforeEach(function() {
module('mean');
module('mean.voteeHome');
});
var $controller;
var $scope;
beforeEach(inject(function(_$controller_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
}));
describe("voteeHome controller", function() {
beforeEach(function() {
$scope = {};
var controller = $controller('VoteeHomeController', { $scope: $scope });
});
it("stub", function() {
expect(true).toBe(true);
});
});
describe("header controller", function() {
beforeEach(function() {
$scope = {};
var controller = $controller('VoteeHeaderController', { $scope: $scope });
});
it("Has a menu",
function() {
expect($scope.menus).toBeDefined();
expect($scope.menus).not.toBeNull();
expect($scope.menus.length).not.toBe(0);
});
});
});
}());
| 'use strict';
(function() {
describe("voteeHome", function() {
beforeEach(function() {
module('mean');
module('mean.voteeHome');
});
var $controller;
var $scope;
beforeEach(inject(function(_$controller_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
}));
describe("voteeHome controller", function() {
beforeEach(function() {
$scope = {};
var controller = $controller('VoteeHomeController', { $scope: $scope });
});
it('should expose some global scope', function() {
expect(true).toBeTruthy();
});
});
describe("header controller", function() {
beforeEach(function() {
$scope = {};
var controller = $controller('VoteeHeaderController', { $scope: $scope });
});
it("Has a menu",
function() {
expect($scope.menus).toBeDefined();
expect($scope.menus).not.toBeNull();
expect($scope.menus.length).not.toBe(0);
});
});
});
}());
| Use the 'should expose some global scope' test | Use the 'should expose some global scope' test
As seen in examples when there doesn't seem to be anything else to test. | JavaScript | mit | lewkoo/Votee,lewkoo/Votee,lewkoo/Votee | ---
+++
@@ -23,8 +23,8 @@
var controller = $controller('VoteeHomeController', { $scope: $scope });
});
- it("stub", function() {
- expect(true).toBe(true);
+ it('should expose some global scope', function() {
+ expect(true).toBeTruthy();
});
});
|
ce9abc43dbc217d800f833cff36ee3e51e85a2e9 | assignFAST/assignFASTExample.js | assignFAST/assignFASTExample.js | /*
javascript in this file controls the html page demonstrating the autosubject functionality
*/
/**************************************************************************************/
/* Set up and initialization */
/**************************************************************************************/
/*
initial setup - called from onLoad
attaches the autocomplete function to the search box
*/
var currentSuggestIndexDefault = "suggestall"; //initial default value
function setUpPage(number) {
// connect the autoSubject to the input areas
$('#keyword' + number).autocomplete( {
source: autoSubjectExample,
minLength: 1,
select: function(event, ui) {
$('#fastID' + number).val(ui.item.idroot);
$('#fastType' + number).val(ui.item.tag);
$('#fastInd' + number).val(ui.item.indicator);
} //end select
}
).data( "autocomplete" )._renderItem = function( ul, item ) { formatSuggest(ul, item);};
} //end setUpPage()
/*
example style - simple reformatting
*/
function autoSubjectExample(request, response) {
currentSuggestIndex = currentSuggestIndexDefault;
autoSubject(request, response, exampleStyle);
}
/*
For this example, replace the common subfield break of -- with /
*/
function exampleStyle(res) {
return res["auth"].replace("--","/") + ' (' + getTypeFromTag(res['tag']) + ')';
}
| /*
javascript in this file controls the html page demonstrating the autosubject functionality
*/
/**************************************************************************************/
/* Set up and initialization */
/**************************************************************************************/
/*
initial setup - called from onLoad
attaches the autocomplete function to the search box
*/
var currentSuggestIndexDefault = "suggest50"; //initial default value
function setUpPage(number) {
// connect the autoSubject to the input areas
$('#keyword' + number).autocomplete( {
source: autoSubjectExample,
minLength: 1,
select: function(event, ui) {
$('#fastID' + number).val(ui.item.idroot);
$('#fastType' + number).val(ui.item.tag);
$('#fastInd' + number).val(ui.item.indicator);
} //end select
}
).data( "autocomplete" )._renderItem = function( ul, item ) { formatSuggest(ul, item);};
} //end setUpPage()
/*
example style - simple reformatting
*/
function autoSubjectExample(request, response) {
currentSuggestIndex = currentSuggestIndexDefault;
autoSubject(request, response, exampleStyle);
}
/*
For this example, replace the common subfield break of -- with /
*/
function exampleStyle(res) {
return res["auth"].replace("--","/");
}
| Revert "Display the tag/facet of the selected term in the input" | Revert "Display the tag/facet of the selected term in the input"
This reverts commit f85613a9af711a4aeb27b3bbe6efe8592e8318ce.
| JavaScript | mit | dkudeki/metadata-maker,dkudeki/metadata-maker | ---
+++
@@ -13,7 +13,7 @@
*/
-var currentSuggestIndexDefault = "suggestall"; //initial default value
+var currentSuggestIndexDefault = "suggest50"; //initial default value
function setUpPage(number) {
// connect the autoSubject to the input areas
@@ -42,5 +42,5 @@
For this example, replace the common subfield break of -- with /
*/
function exampleStyle(res) {
- return res["auth"].replace("--","/") + ' (' + getTypeFromTag(res['tag']) + ')';
+ return res["auth"].replace("--","/");
} |
81b1d18eff0f5734aa64b780897bd8f7bb1bdb31 | models/user.js | models/user.js | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var UserSchema = new Schema(
{
lastName : String,
firstName : String,
username : String,
passwordHash : String,
privateKey : String,
picture : String,
level : String,
description : String,
created : Date,
birthday : Date,
universityGroup : String,
website : String,
});
module.exports = mongoose.model('User', UserSchema);
| var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var UserSchema = new Schema(
{
lastName : String,
firstName : String,
username : String,
email : String,
passwordHash : String,
privateKey : String,
picture : String,
level : String,
description : String,
created : Date,
birthday : Date,
universityGroup : String,
website : String,
});
module.exports = mongoose.model('User', UserSchema);
| Add Email field to User | Add Email field to User
| JavaScript | mit | asso-labeli/labeli-api,asso-labeli/labeli-api,asso-labeli/labeli-api | ---
+++
@@ -6,6 +6,7 @@
lastName : String,
firstName : String,
username : String,
+ email : String,
passwordHash : String,
privateKey : String,
picture : String, |
be01e76023213f35d99f69ffc440906022e218ee | src/js/select2/i18n/hu.js | src/js/select2/i18n/hu.js | define(function () {
// Hungarian
return {
errorLoading: function () {
return 'Az eredmények betöltése nem sikerült.';
},
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
return 'Túl hosszú. ' + overChars + ' karakterrel több, mint kellene.';
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
return 'Túl rövid. Még ' + remainingChars + ' karakter hiányzik.';
},
loadingMore: function () {
return 'Töltés…';
},
maximumSelected: function (args) {
return 'Csak ' + args.maximum + ' elemet lehet kiválasztani.';
},
noResults: function () {
return 'Nincs találat.';
},
searching: function () {
return 'Keresés…';
},
removeAllItems: function () {
return 'Távolítson el minden elemet';
}
};
});
| define(function () {
// Hungarian
return {
errorLoading: function () {
return 'Az eredmények betöltése nem sikerült.';
},
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
return 'Túl hosszú. ' + overChars + ' karakterrel több, mint kellene.';
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
return 'Túl rövid. Még ' + remainingChars + ' karakter hiányzik.';
},
loadingMore: function () {
return 'Töltés…';
},
maximumSelected: function (args) {
return 'Csak ' + args.maximum + ' elemet lehet kiválasztani.';
},
noResults: function () {
return 'Nincs találat.';
},
searching: function () {
return 'Keresés…';
},
removeAllItems: function () {
return 'Távolítson el minden elemet';
},
removeItem: function () {
return 'Elem eltávolítása';
},
search: function() {
return 'Keresés';
}
};
});
| Update Hungarian translation for new strings | Update Hungarian translation for new strings
Updated Hungarian translation. | JavaScript | mit | select2/select2,select2/select2 | ---
+++
@@ -28,6 +28,12 @@
},
removeAllItems: function () {
return 'Távolítson el minden elemet';
+ },
+ removeItem: function () {
+ return 'Elem eltávolítása';
+ },
+ search: function() {
+ return 'Keresés';
}
};
}); |
36a42af4fa6a02fa45c357020269ca52ca9e27d1 | modules/udp.js | modules/udp.js | module.exports = {
events: {
udp: function (bot, msg, rinfo) {
if (rinfo.address === bot.config.get('yakc.ip')) {
bot.fireEvents('yakc', msg.toString(), rinfo)
} else {
bot.notice(bot.config.get('udp.channel'), msg.toString())
}
}
}
}
| module.exports = {
events: {
udp: function (bot, msg, rinfo) {
if (rinfo.address === bot.config.get('yakc.ip')) {
bot.fireEvents('yakc', msg.toString(), rinfo)
} else {
bot.notice(bot.config.get('udp.channel'), msg.toString())
// copy https://github.com/zuzak/twitter-irc-udp messages from verified users:
if (msg.toString().includes('✓')) {
bot.notice(bot.config.get('irc.control'), msg.toString())
}
}
}
}
}
| Copy interesting tweets to control channel | Copy interesting tweets to control channel
| JavaScript | isc | zuzakistan/civilservant,zuzakistan/civilservant | ---
+++
@@ -5,6 +5,11 @@
bot.fireEvents('yakc', msg.toString(), rinfo)
} else {
bot.notice(bot.config.get('udp.channel'), msg.toString())
+
+ // copy https://github.com/zuzak/twitter-irc-udp messages from verified users:
+ if (msg.toString().includes('✓')) {
+ bot.notice(bot.config.get('irc.control'), msg.toString())
+ }
}
}
} |
36c93b468c7957a5b793c4eacb1a739c61100ef3 | src/Overview.js | src/Overview.js | /* global fetch */
import React from 'react';
import TotalWidget from './TotalWidget';
import NextTripWidget from './NextTripWidget';
import TripTable from './TripTable';
import Map from './Map';
import './scss/overview.scss';
class Overview extends React.Component {
constructor() {
super();
this.loading = true;
this.state = {
trips: []
};
}
componentDidMount() {
this.getData();
}
getData() {
fetch('http://localhost:4444/trips')
.then((response) => {
return response.json();
})
.then((trips) => {
this.loading = false;
this.setState({ trips });
});
}
render() {
return (
<div className="container">
{ this.loading ? <span>Loading..</span> :
<section>
<div className="row">
<NextTripWidget
color="light"
nextTrip={this.state.trips.next}
/>
<TotalWidget
color="medium"
totals={this.state.trips.total}
/>
</div>
<Map
countries={this.state.trips.allCountries}
selector="visitedMap"
/>
<TripTable
trips={this.state.trips.visited}
/>
<h1>Wishlist</h1>
<Map
countries={this.state.trips.wishlist}
selector="wishlistMap"
/>
</section>
}
</div>
);
}
}
export default Overview;
| /* global fetch document */
import React from 'react';
import TotalWidget from './TotalWidget';
import NextTripWidget from './NextTripWidget';
import TripTable from './TripTable';
import Map from './Map';
import './scss/overview.scss';
class Overview extends React.Component {
constructor() {
super();
this.loading = true;
this.state = {
trips: []
};
}
componentDidMount() {
this.getData();
}
getData() {
fetch(`${document.location.protocol}//${document.location.hostname}:4444/trips`)
.then((response) => {
return response.json();
})
.then((trips) => {
this.loading = false;
this.setState({ trips });
});
}
render() {
return (
<div className="container">
{ this.loading ? <span>Loading..</span> :
<section>
<div className="row">
<NextTripWidget
color="light"
nextTrip={this.state.trips.next}
/>
<TotalWidget
color="medium"
totals={this.state.trips.total}
/>
</div>
<Map
countries={this.state.trips.allCountries}
selector="visitedMap"
/>
<TripTable
trips={this.state.trips.visited}
/>
<h1>Wishlist</h1>
<Map
countries={this.state.trips.wishlist}
selector="wishlistMap"
/>
</section>
}
</div>
);
}
}
export default Overview;
| Make fetch URL less specific | Make fetch URL less specific
| JavaScript | mpl-2.0 | MichaelKohler/where,MichaelKohler/where | ---
+++
@@ -1,4 +1,4 @@
-/* global fetch */
+/* global fetch document */
import React from 'react';
import TotalWidget from './TotalWidget';
@@ -22,7 +22,7 @@
}
getData() {
- fetch('http://localhost:4444/trips')
+ fetch(`${document.location.protocol}//${document.location.hostname}:4444/trips`)
.then((response) => {
return response.json();
}) |
8b2d2153271eec59b4b2d43a75ba9a83ed432a5d | client/components/login.js | client/components/login.js | Accounts.ui.config({
requestPermissions: {
github: ['user', 'repo', 'gist']
}
})
//
// Accounts.onLogin(function () {
// Router.go('/profile')
// })
Template.login.helpers({
currentUser: function () {
return Meteor.user()
}
})
Template.login.events({
})
| Accounts.ui.config({
requestPermissions: {
github: ['user', 'public_gist']
}
})
//
// Accounts.onLogin(function () {
// Router.go('/profile')
// })
Template.login.helpers({
currentUser: function () {
return Meteor.user()
}
})
Template.login.events({
})
| Update access request for public gists | Update access request for public gists
| JavaScript | isc | caalberts/code-hangout,caalberts/code-hangout | ---
+++
@@ -1,9 +1,9 @@
Accounts.ui.config({
requestPermissions: {
- github: ['user', 'repo', 'gist']
+ github: ['user', 'public_gist']
}
})
-//
+//
// Accounts.onLogin(function () {
// Router.go('/profile')
// }) |
d25293f6af7ce9d646d64c681b59983d442eab42 | js/main.js | js/main.js | $(document).ready(function(){
// Include common elements
$("#footer").load("common/footer.html");
$("#header").load("common/header.html", function()
{
// Add current navigation class based on url
locations = location.pathname.split("/");
$('#topnav a[href^="' + locations[locations.length - 1] + '"]').parent().addClass('current');
/**
* Handles toggling the navigation menu for small screens.
*/
var button = document.getElementById( 'topnav' ).getElementsByTagName( 'div' )[0],
menu = document.getElementById( 'topnav' ).getElementsByTagName( 'ul' )[0];
if ( undefined === button )
return false;
if ( undefined === menu || ! menu.childNodes.length )
{
button.style.display = 'none';
return false;
}
button.onclick = function()
{
if ( -1 == menu.className.indexOf( 'srt-menu' ) )
menu.className = 'srt-menu';
if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
button.className = button.className.replace( ' toggled-on', '' );
menu.className = menu.className.replace( ' toggled-on', '' );
} else {
button.className += ' toggled-on';
menu.className += ' toggled-on';
}
};
});
});
| $(document).ready(function(){
// Include common elements
$("#footer").load("common/footer.html");
$("#header").load("common/header.html", function()
{
// Add current navigation class based on url
locations = location.pathname.split("/");
current = $('#topnav a[href^="' + locations[locations.length - 1] + '"]')
if (current.length == 0)
{
current = $('#topnav a[href^="index.html"]');
}
current.parent().addClass('current');
/**
* Handles toggling the navigation menu for small screens.
*/
var button = document.getElementById( 'topnav' ).getElementsByTagName( 'div' )[0],
menu = document.getElementById( 'topnav' ).getElementsByTagName( 'ul' )[0];
if ( undefined === button )
return false;
if ( undefined === menu || ! menu.childNodes.length )
{
button.style.display = 'none';
return false;
}
button.onclick = function()
{
if ( -1 == menu.className.indexOf( 'srt-menu' ) )
menu.className = 'srt-menu';
if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
button.className = button.className.replace( ' toggled-on', '' );
menu.className = menu.className.replace( ' toggled-on', '' );
} else {
button.className += ' toggled-on';
menu.className += ' toggled-on';
}
};
});
});
| Select first nav li by default | Select first nav li by default
| JavaScript | mit | mbdimitrova/bmi-fmi,mbdimitrova/bmi-fmi | ---
+++
@@ -6,7 +6,12 @@
{
// Add current navigation class based on url
locations = location.pathname.split("/");
- $('#topnav a[href^="' + locations[locations.length - 1] + '"]').parent().addClass('current');
+ current = $('#topnav a[href^="' + locations[locations.length - 1] + '"]')
+ if (current.length == 0)
+ {
+ current = $('#topnav a[href^="index.html"]');
+ }
+ current.parent().addClass('current');
/**
* Handles toggling the navigation menu for small screens. |
b30d1d1e94b6c65babb2c9351cfe49153926d3b9 | js/main.js | js/main.js | var updatePreviewTarget = function(data, status) {
$('.spinner').hide();
$('#preview-target').html(data);
renderLatexExpressions();
}
var renderLatexExpressions = function() {
$('.latex-container').each(
function(index) {
katex.render(
this.textContent,
this,
{ displayMode: $(this).data('displaymode') == 'block' }
);
}
);
}
var main = function() {
$('div code').each(function(i, block) {
hljs.highlightBlock(block);
});
$('button#preview').click(
function() {
$('#preview-target').html('');
$('.spinner').show();
$('h1.preview').text($('input[name=title]').val())
$.post('/note_preview', {text: $('#note-txt').val()}, updatePreviewTarget);
}
);
renderLatexExpressions();
};
function searchRedirect(event, searchpage) {
var term = (arguments.length == 2) ? document.getElementById('mainsearch').value : document.getElementById('searchbox').value;
window.location = '/search/' + term + '/';
event.preventDefault(event);
}
$(main);
| var updatePreviewTarget = function(data, status) {
$('.spinner').hide();
$('#preview-target').html(data);
renderLatexExpressions();
}
var renderLatexExpressions = function() {
$('.latex-container').each(
function(index) {
katex.render(
this.textContent,
this,
{ displayMode: $(this).data('displaymode') == 'block' }
);
}
);
}
var main = function() {
$('div code').each(function(i, block) {
hljs.highlightBlock(block);
});
$('button#preview').click(
function() {
$('#preview-target').html('');
$('.spinner').show();
$('h1.preview').text($('input[name=title]').val())
$.post('/note_preview', {text: $('#note-txt').val()}, updatePreviewTarget);
}
);
renderLatexExpressions();
$("textarea[name='footnotes']").focusin(function(){
$(this).height($(this).height() + 300);
}).focusout(function(){
$(this).height($(this).height() - 300);
});
};
function searchRedirect(event, searchpage) {
var term = (arguments.length == 2) ? document.getElementById('mainsearch').value : document.getElementById('searchbox').value;
window.location = '/search/' + term + '/';
event.preventDefault(event);
}
$(main);
| Make footnote textarea expand upon focus | Make footnote textarea expand upon focus
| JavaScript | mit | erettsegik/erettsegik.hu,erettsegik/erettsegik.hu,erettsegik/erettsegik.hu | ---
+++
@@ -31,6 +31,12 @@
);
renderLatexExpressions();
+
+ $("textarea[name='footnotes']").focusin(function(){
+ $(this).height($(this).height() + 300);
+ }).focusout(function(){
+ $(this).height($(this).height() - 300);
+ });
};
function searchRedirect(event, searchpage) { |
08229bff7728a349aa93eb0dc8db248106cbda97 | scripts/export_map.js | scripts/export_map.js | var casper = require('casper').create();
// casper.on('remote.message', function(message) {
// console.log(message);
// });
var out_dir = 'static/tmp/';
var key = casper.cli.get(0);
var url = casper.cli.get(1);
var filepath = out_dir + key + '.png';
casper.start();
casper.viewport(1024, 650).thenOpen(url, function() {
this.wait(1000);
this.capture(filepath);
casper.echo(filepath);
});
casper.run();
| var casper = require('casper').create();
// casper.on('remote.message', function(message) {
// console.log(message);
// });
var out_dir = 'static/tmp/';
var key = casper.cli.get(0);
var url = casper.cli.get(1);
var filepath = out_dir + key + '.png';
casper.start();
casper.viewport(1024, 650).thenOpen(url, function() {
casper.then(function() {
this.wait(2000, (function() {
return function() {
casper.capture(filepath);
casper.echo(filepath);
}
})())
});
});
casper.run();
| Use casper.wait to wait until image are loaded and transitioned | Use casper.wait to wait until image are loaded and transitioned
| JavaScript | mit | AstunTechnology/NRW_FishMapMon,AstunTechnology/NRW_FishMapMon,AstunTechnology/NRW_FishMapMon,AstunTechnology/NRW_FishMapMon | ---
+++
@@ -13,9 +13,14 @@
casper.start();
casper.viewport(1024, 650).thenOpen(url, function() {
- this.wait(1000);
- this.capture(filepath);
- casper.echo(filepath);
+ casper.then(function() {
+ this.wait(2000, (function() {
+ return function() {
+ casper.capture(filepath);
+ casper.echo(filepath);
+ }
+ })())
+ });
});
casper.run(); |
b13fd8658d216732d4e54e40e029a8246e73202d | main.js | main.js | 'use strict';
var app = require('app');
var dribbbleapi = require('./dribbbleapi');
var mainWindow = null;
var dribbbleData = null;
var menubar = require('menubar')
var mb = menubar({
index: 'file://' + __dirname + '/app/index.html',
icon: __dirname + '/app/assets/HotshotIcon.png',
width: 400,
height: 700,
'max-width': 440,
'min-height': 300,
'min-width': 300,
preloadWindow: true
});
app.on('window-all-closed', function() {
app.quit();
});
mb.on('show', function(){
// mb.window.webContents.send('focus');
mb.window.openDevTools();
});
| 'use strict';
var app = require('app');
var mainWindow = null;
var dribbbleData = null;
var menubar = require('menubar')
var mb = menubar({
index: 'file://' + __dirname + '/app/index.html',
icon: __dirname + '/app/assets/HotshotIcon.png',
width: 400,
height: 700,
'max-width': 440,
'min-height': 300,
'min-width': 300,
preloadWindow: true
});
app.on('window-all-closed', function() {
app.quit();
});
mb.on('show', function(){
// mb.window.webContents.send('focus');
mb.window.openDevTools();
});
| Remove reference to deleted dribbbleApi.js | Remove reference to deleted dribbbleApi.js
| JavaScript | cc0-1.0 | andrewnaumann/hotshot,andrewnaumann/hotshot | ---
+++
@@ -1,6 +1,5 @@
'use strict';
var app = require('app');
-var dribbbleapi = require('./dribbbleapi');
var mainWindow = null;
var dribbbleData = null; |
21f7adb8f7e293f205c7b0813726c10a2a1224f1 | tests/dummy/config/dependency-lint.js | tests/dummy/config/dependency-lint.js | /* eslint-env node */
'use strict';
module.exports = {
allowedVersions: {
'ember-in-element-polyfill': '*',
'ember-get-config': '0.3.0 || 0.4.0 || 0.5.0',
'@embroider/util': '*',
},
};
| /* eslint-env node */
'use strict';
module.exports = {
allowedVersions: {
'ember-in-element-polyfill': '*',
},
};
| Remove unneeded dependency lint overrides | Remove unneeded dependency lint overrides
| JavaScript | mit | ilios/common,ilios/common | ---
+++
@@ -4,7 +4,5 @@
module.exports = {
allowedVersions: {
'ember-in-element-polyfill': '*',
- 'ember-get-config': '0.3.0 || 0.4.0 || 0.5.0',
- '@embroider/util': '*',
},
}; |
14fb941b6db1aa53e7906a46e8cf7f6d4abb6d94 | Rightmove_Enhancement_Suite.user.js | Rightmove_Enhancement_Suite.user.js | // ==UserScript==
// @name Rightmove Enhancement Suite
// @namespace https://github.com/chigley/
// @description Keyboard shortcuts
// @include http://www.rightmove.co.uk/*
// @version 1
// @grant GM_addStyle
// @grant GM_getResourceText
// @resource style style.css
// ==/UserScript==
var $ = unsafeWindow.jQuery;
GM_addStyle(GM_getResourceText("style"));
$("#summaries li").mouseenter(function () {
$(this).addClass("hovered");
});
$("#summaries li").mouseleave(function () {
$(this).removeClass("hovered");
});
| // ==UserScript==
// @name Rightmove Enhancement Suite
// @namespace https://github.com/chigley/
// @description Keyboard shortcuts
// @include http://www.rightmove.co.uk/*
// @version 1
// @grant GM_addStyle
// @grant GM_getResourceText
// @resource style style.css
// ==/UserScript==
var $ = unsafeWindow.jQuery;
GM_addStyle(GM_getResourceText("style"));
$("[name=summary-list-item]").mouseenter(function () {
$(this).addClass("hovered");
});
$("[name=summary-list-item]").mouseleave(function () {
$(this).removeClass("hovered");
});
| Fix selector to only match list items | Fix selector to only match list items
| JavaScript | mit | chigley/rightmove-enhancement-suite | ---
+++
@@ -13,10 +13,10 @@
GM_addStyle(GM_getResourceText("style"));
-$("#summaries li").mouseenter(function () {
+$("[name=summary-list-item]").mouseenter(function () {
$(this).addClass("hovered");
});
-$("#summaries li").mouseleave(function () {
+$("[name=summary-list-item]").mouseleave(function () {
$(this).removeClass("hovered");
}); |
c2b47f8a3c1d3f844152127c9218d90dfa66bbf2 | packages/storefront/app/routes/yebo/taxons/show.js | packages/storefront/app/routes/yebo/taxons/show.js | // Ember!
import Ember from 'ember';
import SearchRoute from 'yebo-ember-storefront/mixins/search-route';
/**
* Taxons show page
* This page shows products related to the current taxon
*/
export default Ember.Route.extend(SearchRoute, {
/**
* Define the search rules
*/
searchRules(query, params) {
// Create a new taxonomy rule
let rule = new YeboSDK.Products.Rules.taxonomy([]);
// Set its values
rule.values = [params.taxon];
// Set it into the query
query.and(rule);
},
// Change the current controller
setupController: function(controller, model) {
// This is indispensable, if out, the model won't be passed to the view
controller.set('model', model);
// the component that requires current taxon and taxonomies is in application
let appController = this.controllerFor('application');
// Define some values
let taxon = model.taxon;
let taxonomies = model.taxonomies;
// Set the values to the application controller
appController.set('currentTaxonomy', taxon.get('taxonomy'));
appController.set('taxonomies', taxonomies);
},
/**
* This values will be returned into the route (with the route model)
*/
searchModel(params) {
// Search all the taxonomies and the current taxon
return {
taxonomies: this.yebo.store.findAll('taxonomy'),
taxon: this.yebo.store.find('taxon', params.taxon),
};
}
});
| // Ember!
import Ember from 'ember';
import SearchRoute from 'yebo-ember-storefront/mixins/search-route';
/**
* Taxons show page
* This page shows products related to the current taxon
*/
export default Ember.Route.extend(SearchRoute, {
/**
* Define the search rules
*/
searchRules(query, params) {
// Create a new taxonomy rule
let rule = new YeboSDK.Products.Rules.taxonomy([]);
// Set its values
rule.values = [params.taxon];
// Set it into the query
query.and(rule);
},
// Change the current controller
setupController: function(controller, model) {
// This is indispensable, if out, the model won't be passed to the view
controller.set('model', model);
// the component that requires current taxon and taxonomies is in application
let appController = this.controllerFor('application');
// Define some values
let taxon = model.taxon;
let taxonomies = model.taxonomies;
// Set the values to the application controller
appController.set('currentTaxonomy', taxon.get('taxonomy'));
appController.set('taxonomies', taxonomies);
},
/**
* This values will be returned into the route (with the route model)
*/
searchModel(params) {
// Search all the taxonomies and the current taxon
return Ember.RSVP.hash({
taxonomies: this.yebo.store.findAll('taxonomy'),
taxon: this.yebo.store.find('taxon', params.taxon),
});
}
});
| Return a promise in the searchModel method | Return a promise in the searchModel method
| JavaScript | mit | yebo-ecommerce/ember,yebo-ecommerce/ember,yebo-ecommerce/ember | ---
+++
@@ -43,9 +43,9 @@
*/
searchModel(params) {
// Search all the taxonomies and the current taxon
- return {
+ return Ember.RSVP.hash({
taxonomies: this.yebo.store.findAll('taxonomy'),
taxon: this.yebo.store.find('taxon', params.taxon),
- };
+ });
}
}); |
764743d6b08899286262a50203b11410d90f9694 | cypress/support/commands.js | cypress/support/commands.js | // ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//mm
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('setRadioInput', (selector, value) => {
const selectorValue = value === 'Yes' ? '0' : '1'
cy.get(`#${selector}-${selectorValue}`).check();
})
Cypress.Commands.add('setTextInput', (selector, value) => {
cy.get(`#${selector}`).type(value);
})
| // ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//mm
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('setRadioInput', (selector, value) => {
const selectorValue = value === 'Yes' ? '0' : '1'
cy.get(`#${selector}-${selectorValue}`).check();
})
Cypress.Commands.add('setTextInput', (selector, value) => {
cy.get(`#${selector}`).type(value);
})
Cypress.Commands.add('setCheckboxInput', (selector) => {
cy.get(`#${selector}`).check();
})
| Add functionality for filling in checkboxes | Add functionality for filling in checkboxes | JavaScript | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -32,3 +32,7 @@
Cypress.Commands.add('setTextInput', (selector, value) => {
cy.get(`#${selector}`).type(value);
})
+
+Cypress.Commands.add('setCheckboxInput', (selector) => {
+ cy.get(`#${selector}`).check();
+}) |
205535d3723b96163f74e4d18a3dd3a5fa84dcf9 | screens/MemoriesScreen.js | screens/MemoriesScreen.js | import React from "react";
import {
Text
} from "react-native";
export default class MemoriesScreen extends React.Component {
render() {
return (
<Text>My memories</Text>
);
}
}
MemoriesScreen.route = {
navigationBar: {
title: "My memories",
}
};
| import React from "react";
import {
Text
} from "react-native";
var memory = {
eventName: "Tree planting",
eventDate: Date(),
image: require("../static/content/images/memories/01.jpg")
};
var userData = {
name: "Sara",
image: require("../static/content/images/people/users/01_sara_douglas.jpg"),
memories: []
};
for (var i = 0; i < 10; i++) {
userData.memories.push(memory);
}
export default class MemoriesScreen extends React.Component {
render() {
return (
<Text>My memories</Text>
);
}
}
MemoriesScreen.route = {
navigationBar: {
title: "My memories",
}
};
| Add sample data example to memories screen for UI dev | Add sample data example to memories screen for UI dev
| JavaScript | mit | ottobonn/roots | ---
+++
@@ -2,6 +2,22 @@
import {
Text
} from "react-native";
+
+var memory = {
+ eventName: "Tree planting",
+ eventDate: Date(),
+ image: require("../static/content/images/memories/01.jpg")
+};
+
+var userData = {
+ name: "Sara",
+ image: require("../static/content/images/people/users/01_sara_douglas.jpg"),
+ memories: []
+};
+
+for (var i = 0; i < 10; i++) {
+ userData.memories.push(memory);
+}
export default class MemoriesScreen extends React.Component {
render() { |
8caa309f6a807555825f277e5f277007544b9957 | js/end_game.js | js/end_game.js | var endGame = function(game){
if (game.player.lives > 0) {
missBall(game.ball, game.player)
} else if (game.player.lives <= 0 ){
gameOver()
}
}
var missBall = function(ball, player){
if ( ball.bottomEdge().y == canvas.height){
return player.loseLife()
}
return false
}
function gameOver() {
console.log('game over!')
alert('Game Over!');
window.location.reload()
}
| var endGame = function(game){
if (game.player.lives > 0) {
missBall(game.ball, game.player)
} else if (game.player.lives <= 0 ){
gameOver()
}
if (stillBricks(game.bricks)) {
winGame()
}
}
var missBall = function(ball, player){
if ( ball.bottomEdge().y == canvas.height){
console.log("Lost Life")
return player.loseLife()
};
}
function gameOver() {
console.log('game over!')
alert('Game Over!');
window.location.reload()
}
function winGame() {
console.log("You Win!")
alert("You are the Winner")
window.location.reload()
}
var stillBricks = function (bricks) {
var counter = 0
for (var layer in bricks){
bricks[layer].map(function(brick){
if (brick == null){
counter += 1;
};
});
}
if (counter == 16){
return true
}
}
| Implement win game prompt after all bricks destroyed | Implement win game prompt after all bricks destroyed
| JavaScript | mit | theomarkkuspaul/Brick-Breaker,theomarkkuspaul/Brick-Breaker | ---
+++
@@ -5,13 +5,16 @@
} else if (game.player.lives <= 0 ){
gameOver()
}
+ if (stillBricks(game.bricks)) {
+ winGame()
+ }
}
var missBall = function(ball, player){
if ( ball.bottomEdge().y == canvas.height){
+ console.log("Lost Life")
return player.loseLife()
- }
- return false
+ };
}
function gameOver() {
@@ -19,3 +22,23 @@
alert('Game Over!');
window.location.reload()
}
+
+function winGame() {
+ console.log("You Win!")
+ alert("You are the Winner")
+ window.location.reload()
+}
+
+var stillBricks = function (bricks) {
+ var counter = 0
+ for (var layer in bricks){
+ bricks[layer].map(function(brick){
+ if (brick == null){
+ counter += 1;
+ };
+ });
+ }
+ if (counter == 16){
+ return true
+ }
+} |
7388412cc4908793883e0de2348f8b44b72e2256 | js/main.js | js/main.js | document.addEventListener('DOMContentLoaded', function() {
var searchButton = document.getElementById('search');
searchButton.addEventListener('click', (function() {
var query = document.getElementById('form').query.value;
var engine = document.querySelector('input[name="engine"]:checked').value;
var urls = {
'hackage': 'https://www.haskell.org/hoogle/?hoogle=',
'lts': 'https://www.stackage.org/lts/hoogle?q=',
'nightly': 'https://www.stackage.org/nightly/hoogle?q='
};
var url = urls[engine] + query;
chrome.tabs.create({url: url});
}));
});
| document.addEventListener('DOMContentLoaded', function() {
var searchButton = document.getElementById('search');
document.querySelector('input[name="engine"]:checked').focus();
searchButton.addEventListener('click', (function() {
var query = document.getElementById('form').query.value;
var engine = document.querySelector('input[name="engine"]:checked').value;
var urls = {
'hackage': 'https://www.haskell.org/hoogle/?hoogle=',
'lts': 'https://www.stackage.org/lts/hoogle?q=',
'nightly': 'https://www.stackage.org/nightly/hoogle?q='
};
var url = urls[engine] + query;
chrome.tabs.create({url: url});
}));
});
| Add focus on the first radio button | Add focus on the first radio button
| JavaScript | mit | yu-i9/HoogleSwitcher,yu-i9/HoogleSwitcher | ---
+++
@@ -1,5 +1,6 @@
document.addEventListener('DOMContentLoaded', function() {
var searchButton = document.getElementById('search');
+ document.querySelector('input[name="engine"]:checked').focus();
searchButton.addEventListener('click', (function() {
var query = document.getElementById('form').query.value; |
5641a9bc6a72b30572840e4067c9421ecd973f27 | app/assets/javascripts/angular/main/register-controller.js | app/assets/javascripts/angular/main/register-controller.js | (function(){
'use strict';
angular
.module('secondLead')
.controller('RegisterCtrl', [
'Restangular',
'$state',
'store',
'UserModel',
function (Restangular, $state, store, UserModel) {
var register = this;
register.newUser = {};
register.onSubmit = function () {
UserModel.register(register.newUser)
.then(function(response){
if (response.errors){
register.error = response.errors[0];
} else {
store.set('jwt',response.token);
store.set('user',response.user);
$state.go('user.lists', {userID: response.user.id});
register.reset();
}
});
};
register.reset = function () {
register.newUser = {};
};
}])
})(); | (function(){
'use strict';
angular
.module('secondLead')
.controller('RegisterCtrl', [
'Restangular',
'$state',
'store',
'UserModel',
function (Restangular, $state, store, UserModel) {
var register = this;
register.newUser = {};
register.onSubmit = function () {
UserModel.register(register.newUser)
.then(function(response){
if (response.errors){
register.error = response.errors[0];
} else {
UserModel.setLoggedIn(true);
store.set('jwt',response.token);
store.set('user',response.user);
$state.go('user.lists', {userID: response.user.id});
register.reset();
}
});
};
register.reset = function () {
register.newUser = {};
};
}])
})(); | Add update to usermodel upon signup with register controller | Add update to usermodel upon signup with register controller
| JavaScript | mit | ac-adekunle/secondlead,ac-adekunle/secondlead,ac-adekunle/secondlead | ---
+++
@@ -21,6 +21,7 @@
if (response.errors){
register.error = response.errors[0];
} else {
+ UserModel.setLoggedIn(true);
store.set('jwt',response.token);
store.set('user',response.user);
$state.go('user.lists', {userID: response.user.id}); |
917b47168540b27682825b50155aaf34ecef3b62 | compassion.colleague/ua.js | compassion.colleague/ua.js | var cadence = require('cadence')
var util = require('util')
function UserAgent (ua) {
this._ua = ua
}
UserAgent.prototype.send = cadence(function (async, properties, body) {
var url = util.format('http://%s/kibitz', properties.location)
this._ua.fetch({
url: url,
post: {
islandName: properties.islandName,
colleagueId: properties.colleagueId,
kibitz: body
},
nullify: true
}, async())
})
module.exports = UserAgent
| var cadence = require('cadence')
var util = require('util')
function UserAgent (ua) {
this._ua = ua
}
UserAgent.prototype.send = cadence(function (async, properties, body) {
var url = util.format('http://%s/kibitz', properties.location)
this._ua.fetch({
url: url,
post: {
key: '(' + properties.islandName + ')' + properties.colleagueId,
post: { kibitz: body }
},
nullify: true
}, async())
})
module.exports = UserAgent
| Adjust user agent for new keyed protocol. | Adjust user agent for new keyed protocol.
| JavaScript | mit | bigeasy/compassion | ---
+++
@@ -10,9 +10,8 @@
this._ua.fetch({
url: url,
post: {
- islandName: properties.islandName,
- colleagueId: properties.colleagueId,
- kibitz: body
+ key: '(' + properties.islandName + ')' + properties.colleagueId,
+ post: { kibitz: body }
},
nullify: true
}, async()) |
4025d7a5b28d6b3b88af5d78b5b31c304d0afca6 | assets/src/stories-editor/helpers/test/addAMPExtraProps.js | assets/src/stories-editor/helpers/test/addAMPExtraProps.js | /**
* Internal dependencies
*/
import { addAMPExtraProps } from '../';
describe( 'addAMPExtraProps', () => {
it( 'does not modify non-child blocks', () => {
const props = addAMPExtraProps( {}, { name: 'foo/bar' }, {} );
expect( props ).toStrictEqual( {} );
} );
it( 'generates a unique ID', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, {} );
expect( props ).toHaveProperty( 'id' );
} );
it( 'uses the existing anchor attribute as the ID', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { anchor: 'foo' } );
expect( props ).toStrictEqual( { id: 'foo' } );
} );
it( 'adds a font family attribute', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { ampFontFamily: 'Roboto' } );
expect( props ).toMatchObject( { 'data-font-family': 'Roboto' } );
} );
it( 'adds inline CSS for rotation', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { rotationAngle: 90.54321 } );
expect( props ).toMatchObject( { style: { transform: 'rotate(90deg)' } } );
} );
} );
| /**
* Internal dependencies
*/
import { addAMPExtraProps } from '../';
describe( 'addAMPExtraProps', () => {
it( 'does not modify non-child blocks', () => {
const props = addAMPExtraProps( {}, { name: 'foo/bar' }, {} );
expect( props ).toStrictEqual( {} );
} );
it( 'adds a font family attribute', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { ampFontFamily: 'Roboto' } );
expect( props ).toMatchObject( { 'data-font-family': 'Roboto' } );
} );
it( 'adds inline CSS for rotation', () => {
const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { rotationAngle: 90.54321 } );
expect( props ).toMatchObject( { style: { transform: 'rotate(90deg)' } } );
} );
} );
| Remove tests that are not relevant anymore. | Remove tests that are not relevant anymore.
| JavaScript | apache-2.0 | ampproject/amp-toolbox-php,ampproject/amp-toolbox-php | ---
+++
@@ -8,18 +8,6 @@
const props = addAMPExtraProps( {}, { name: 'foo/bar' }, {} );
expect( props ).toStrictEqual( {} );
- } );
-
- it( 'generates a unique ID', () => {
- const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, {} );
-
- expect( props ).toHaveProperty( 'id' );
- } );
-
- it( 'uses the existing anchor attribute as the ID', () => {
- const props = addAMPExtraProps( {}, { name: 'amp/amp-story-text' }, { anchor: 'foo' } );
-
- expect( props ).toStrictEqual( { id: 'foo' } );
} );
it( 'adds a font family attribute', () => { |
e5c906b30e793d73972b133cc3099f48a0a1a919 | adapter.js | adapter.js | (function() {
var global = this;
var karma = global.__karma__;
karma.start = function(runner) {
var suites = global.__karma_benchmark_suites__;
var hasTests = !!suites.length;
var errors = [];
if (!hasTests) {
return complete();
}
runNextSuite();
function logResult(event) {
var suite = this;
var result = event.target;
karma.result({
id: result.id,
description: suite.name+': '+result.name,
suite: [],
success: errors.length === 0,
log: errors,
skipped: false,
time: result.stats.mean * 1000,
benchmark: {
suite: suite.name,
name: result.name,
stats: result.stats,
count: result.count,
cycles: result.cycles,
error: result.error,
hz: result.hz
}
});
}
function logError(evt) {
errors.push(evt.target.error);
}
function runNextSuite() {
if (!suites.length) {
return complete();
}
suites.shift()
.on('cycle', logResult)
.on('abort error', logError)
.on('complete', runNextSuite)
.run({
async: true
});
}
function complete() {
karma.complete({
coverage: global.__coverage__
});
}
};
}).call(this);
| (function() {
var global = this;
var karma = global.__karma__;
karma.start = function(runner) {
var suites = global.__karma_benchmark_suites__;
var hasTests = !!suites.length;
var errors = [];
if (!hasTests) {
return complete();
}
runNextSuite();
function logResult(event) {
var suite = this;
var result = event.target;
karma.result({
id: result.id,
description: suite.name+': '+result.name,
suite: [],
success: errors.length === 0,
log: errors,
skipped: false,
time: result.stats.mean * 1000,
benchmark: {
suite: suite.name,
name: result.name,
stats: result.stats,
count: result.count,
cycles: result.cycles,
error: result.error,
hz: result.hz
}
});
// Reset errors
errors = [];
}
function logError(evt) {
errors.push(evt.target.error.toString());
}
function runNextSuite() {
if (!suites.length) {
return complete();
}
suites.shift()
.on('cycle', logResult)
.on('abort error', logError)
.on('complete', runNextSuite)
.run({
async: true
});
}
function complete() {
karma.complete({
coverage: global.__coverage__
});
}
};
}).call(this);
| Fix logging of errors, Karma expects a string. Reset errors after every cycle. | Fix logging of errors, Karma expects a string. Reset errors after every cycle.
| JavaScript | mit | JamieMason/karma-benchmark,JamieMason/karma-benchmark | ---
+++
@@ -35,10 +35,13 @@
hz: result.hz
}
});
+
+ // Reset errors
+ errors = [];
}
function logError(evt) {
- errors.push(evt.target.error);
+ errors.push(evt.target.error.toString());
}
function runNextSuite() { |
474fbf5b088004ad676fe71b15f3031755b02b74 | src/index.js | src/index.js | import middleware from './internal/middleware'
export default middleware
export { runSaga } from './internal/runSaga'
export { END, eventChannel, channel } from './internal/channel'
export { buffers } from './internal/buffers'
export { takeEvery, takeLatest } from './internal/sagaHelpers'
import { CANCEL } from './internal/proc'
import * as effects from './effects'
import * as utils from './utils'
export function delay(ms, val=true) {
let timeoutId;
const promise = new Promise((resolve) => {
timeoutId = setTimeout(resolve, ms, val);
});
promise[CANCEL] = () => clearTimeout(timeoutId);
return promise;
}
export {
CANCEL,
effects,
utils
}
| import middleware from './internal/middleware'
export default middleware
export { runSaga } from './internal/runSaga'
export { END, eventChannel, channel } from './internal/channel'
export { buffers } from './internal/buffers'
export { takeEvery, takeLatest } from './internal/sagaHelpers'
import { CANCEL } from './internal/proc'
import * as effects from './effects'
import * as utils from './utils'
export function delay(ms, val=true) {
let timeoutId;
const promise = new Promise((resolve) => {
timeoutId = setTimeout(() => resolve(val), ms);
});
promise[CANCEL] = () => clearTimeout(timeoutId);
return promise;
}
export {
CANCEL,
effects,
utils
}
| Replace `setTimeout` call with 2-args version | Replace `setTimeout` call with 2-args version
| JavaScript | mit | yelouafi/redux-saga,eiriklv/redux-saga,HansDP/redux-saga,baldwmic/redux-saga,redux-saga/redux-saga,yelouafi/redux-saga,redux-saga/redux-saga,HansDP/redux-saga,eiriklv/redux-saga,granmoe/redux-saga,baldwmic/redux-saga,ipluser/redux-saga,granmoe/redux-saga,ipluser/redux-saga | ---
+++
@@ -14,7 +14,7 @@
export function delay(ms, val=true) {
let timeoutId;
const promise = new Promise((resolve) => {
- timeoutId = setTimeout(resolve, ms, val);
+ timeoutId = setTimeout(() => resolve(val), ms);
});
promise[CANCEL] = () => clearTimeout(timeoutId); |
3a1caf79f987bfa48d53ae06e1a4156fd09a313a | js/models/geonames-data.js | js/models/geonames-data.js | (function(app) {
'use strict';
var dom = app.dom || require('../dom.js');
var GeoNamesData = function(url) {
this._url = url;
this._loadPromise = null;
this._data = [];
};
GeoNamesData.prototype.load = function() {
if (!this._loadPromise) {
this._loadPromise = dom.loadJSON(this._url).then(function(data) {
this._data = data;
}.bind(this));
}
return this._loadPromise;
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = GeoNamesData;
} else {
app.GeoNamesData = GeoNamesData;
}
})(this.app || (this.app = {}));
| (function(app) {
'use strict';
var dom = app.dom || require('../dom.js');
var Events = app.Events || require('../base/events.js');
var GeoNamesData = function(url) {
this._url = url;
this._loadPromise = null;
this._data = [];
this._events = new Events();
};
GeoNamesData.prototype.on = function() {
return Events.prototype.on.apply(this._events, arguments);
};
GeoNamesData.prototype.load = function() {
if (!this._loadPromise) {
this._events.emit('loading');
this._loadPromise = dom.loadJSON(this._url).then(function(data) {
this._data = data;
this._events.emit('loaded');
}.bind(this));
}
return this._loadPromise;
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = GeoNamesData;
} else {
app.GeoNamesData = GeoNamesData;
}
})(this.app || (this.app = {}));
| Make events of GeoNames data | Make events of GeoNames data
| JavaScript | mit | ionstage/loclock,ionstage/loclock | ---
+++
@@ -2,17 +2,25 @@
'use strict';
var dom = app.dom || require('../dom.js');
+ var Events = app.Events || require('../base/events.js');
var GeoNamesData = function(url) {
this._url = url;
this._loadPromise = null;
this._data = [];
+ this._events = new Events();
+ };
+
+ GeoNamesData.prototype.on = function() {
+ return Events.prototype.on.apply(this._events, arguments);
};
GeoNamesData.prototype.load = function() {
if (!this._loadPromise) {
+ this._events.emit('loading');
this._loadPromise = dom.loadJSON(this._url).then(function(data) {
this._data = data;
+ this._events.emit('loaded');
}.bind(this));
}
return this._loadPromise; |
90ef58c5a31967bf1e172f792bdbff3fba9e7f4a | src/_assets/scripts/components/app/reddit.posts.js | src/_assets/scripts/components/app/reddit.posts.js | import React from 'react';
import { BaseViewComponent } from '../higher-order/index.js';
class RedditPosts extends BaseViewComponent {
constructor(props) {
super(props);
}
render() {
return (
<div className="posts">
<div className="posts-fetch">
<p onClick={this.props.fetchPosts}>Fetch posts</p>
</div>
<div className="posts-list">
{this.props.posts.map(function renderPosts(post) {
return (
<div key={post.id} className="posts">
<p>{post.title}</p>
</div>
);
})}
</div>
</div>
);
}
}
RedditPosts.propTypes = {
posts: React.PropTypes.array.isRequired,
fetchPosts: React.PropTypes.func.isRequired
};
export default RedditPosts;
| import React from 'react';
import { Avatar, List, ListItem } from 'material-ui';
import { BaseViewComponent } from '../higher-order/index.js';
class RedditPosts extends BaseViewComponent {
constructor(props) {
super(props);
}
render() {
return (
<div className="posts">
<div className="posts-fetch">
<p onClick={this.props.fetchPosts}>Fetch posts</p>
</div>
<div className="posts-list">
<List>
{this.props.posts.map(function renderPosts(post) {
let avatar = (<Avatar src={post.thumbnail} />);
return (
<ListItem leftAvatar={avatar}>
<div key={post.id} className="posts">
{post.title}
</div>
</ListItem>
);
})}
</List>
</div>
</div>
);
}
}
RedditPosts.propTypes = {
posts: React.PropTypes.array.isRequired,
fetchPosts: React.PropTypes.func.isRequired
};
export default RedditPosts;
| Make songs-list a list of list-items | Make songs-list a list of list-items
| JavaScript | mit | yanglinz/reddio,yanglinz/reddio | ---
+++
@@ -1,4 +1,5 @@
import React from 'react';
+import { Avatar, List, ListItem } from 'material-ui';
import { BaseViewComponent } from '../higher-order/index.js';
class RedditPosts extends BaseViewComponent {
@@ -14,14 +15,19 @@
</div>
<div className="posts-list">
+ <List>
{this.props.posts.map(function renderPosts(post) {
+ let avatar = (<Avatar src={post.thumbnail} />);
return (
- <div key={post.id} className="posts">
- <p>{post.title}</p>
- </div>
+ <ListItem leftAvatar={avatar}>
+ <div key={post.id} className="posts">
+ {post.title}
+ </div>
+ </ListItem>
);
})}
+ </List>
</div>
</div>
); |
9fec01f2148a57035bea95fc93f56937473cb510 | chrome/browser/resources/net_internals/http_cache_view.js | chrome/browser/resources/net_internals/http_cache_view.js | // Copyright (c) 2011 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.
/**
* This view displays information on the HTTP cache.
* @constructor
*/
function HttpCacheView() {
const mainBoxId = 'http-cache-view-tab-content';
const statsDivId = 'http-cache-view-cache-stats';
DivView.call(this, mainBoxId);
this.statsDiv_ = $(statsDivId);
// Register to receive http cache info.
g_browser.addHttpCacheInfoObserver(this);
}
inherits(HttpCacheView, DivView);
HttpCacheView.prototype.onLoadLogFinish = function(data) {
return this.onHttpCacheInfoChanged(data.httpCacheInfo);
};
HttpCacheView.prototype.onHttpCacheInfoChanged = function(info) {
this.statsDiv_.innerHTML = '';
if (!info)
return false;
// Print the statistics.
var statsUl = addNode(this.statsDiv_, 'ul');
for (var statName in info.stats) {
var li = addNode(statsUl, 'li');
addTextNode(li, statName + ': ' + info.stats[statName]);
}
return true;
};
| // Copyright (c) 2011 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.
/**
* This view displays information on the HTTP cache.
*/
var HttpCacheView = (function() {
// IDs for special HTML elements in http_cache_view.html
const MAIN_BOX_ID = 'http-cache-view-tab-content';
const STATS_DIV_ID = 'http-cache-view-cache-stats';
// We inherit from DivView.
var superClass = DivView;
/**
* @constructor
*/
function HttpCacheView() {
// Call superclass's constructor.
superClass.call(this, MAIN_BOX_ID);
this.statsDiv_ = $(STATS_DIV_ID);
// Register to receive http cache info.
g_browser.addHttpCacheInfoObserver(this);
}
cr.addSingletonGetter(HttpCacheView);
HttpCacheView.prototype = {
// Inherit the superclass's methods.
__proto__: superClass.prototype,
onLoadLogFinish: function(data) {
return this.onHttpCacheInfoChanged(data.httpCacheInfo);
},
onHttpCacheInfoChanged: function(info) {
this.statsDiv_.innerHTML = '';
if (!info)
return false;
// Print the statistics.
var statsUl = addNode(this.statsDiv_, 'ul');
for (var statName in info.stats) {
var li = addNode(statsUl, 'li');
addTextNode(li, statName + ': ' + info.stats[statName]);
}
return true;
}
};
return HttpCacheView;
})();
| Refactor HttpCacheView to be defined inside an anonymous namespace. | Refactor HttpCacheView to be defined inside an anonymous namespace.
BUG=90857
Review URL: http://codereview.chromium.org/7544008
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@94868 0039d316-1c4b-4281-b951-d872f2087c98
| JavaScript | bsd-3-clause | ropik/chromium,adobe/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,adobe/chromium,ropik/chromium,ropik/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,yitian134/chromium | ---
+++
@@ -4,38 +4,54 @@
/**
* This view displays information on the HTTP cache.
- * @constructor
*/
-function HttpCacheView() {
- const mainBoxId = 'http-cache-view-tab-content';
- const statsDivId = 'http-cache-view-cache-stats';
- DivView.call(this, mainBoxId);
+var HttpCacheView = (function() {
+ // IDs for special HTML elements in http_cache_view.html
+ const MAIN_BOX_ID = 'http-cache-view-tab-content';
+ const STATS_DIV_ID = 'http-cache-view-cache-stats';
- this.statsDiv_ = $(statsDivId);
+ // We inherit from DivView.
+ var superClass = DivView;
- // Register to receive http cache info.
- g_browser.addHttpCacheInfoObserver(this);
-}
+ /**
+ * @constructor
+ */
+ function HttpCacheView() {
+ // Call superclass's constructor.
+ superClass.call(this, MAIN_BOX_ID);
-inherits(HttpCacheView, DivView);
+ this.statsDiv_ = $(STATS_DIV_ID);
-HttpCacheView.prototype.onLoadLogFinish = function(data) {
- return this.onHttpCacheInfoChanged(data.httpCacheInfo);
-};
+ // Register to receive http cache info.
+ g_browser.addHttpCacheInfoObserver(this);
+ }
-HttpCacheView.prototype.onHttpCacheInfoChanged = function(info) {
- this.statsDiv_.innerHTML = '';
+ cr.addSingletonGetter(HttpCacheView);
- if (!info)
- return false;
+ HttpCacheView.prototype = {
+ // Inherit the superclass's methods.
+ __proto__: superClass.prototype,
- // Print the statistics.
- var statsUl = addNode(this.statsDiv_, 'ul');
- for (var statName in info.stats) {
- var li = addNode(statsUl, 'li');
- addTextNode(li, statName + ': ' + info.stats[statName]);
- }
- return true;
-};
+ onLoadLogFinish: function(data) {
+ return this.onHttpCacheInfoChanged(data.httpCacheInfo);
+ },
+ onHttpCacheInfoChanged: function(info) {
+ this.statsDiv_.innerHTML = '';
+
+ if (!info)
+ return false;
+
+ // Print the statistics.
+ var statsUl = addNode(this.statsDiv_, 'ul');
+ for (var statName in info.stats) {
+ var li = addNode(statsUl, 'li');
+ addTextNode(li, statName + ': ' + info.stats[statName]);
+ }
+ return true;
+ }
+ };
+
+ return HttpCacheView;
+})(); |
9b12e26b863386ae30b34d5756a45f598b1e0ba0 | packages/components/containers/members/MemberAddresses.js | packages/components/containers/members/MemberAddresses.js | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { msgid, c } from 'ttag';
import { SimpleDropdown, DropdownMenu } from 'react-components';
const MemberAddresses = ({ member, addresses }) => {
const list = addresses.map(({ ID, Email }) => (
<div key={ID} className="inbl w100 pt0-5 pb0-5 pl1 pr1 ellipsis">
{Email}
</div>
));
const n = list.length;
const addressesTxt = ` ${c('Info').ngettext(msgid`address`, `addresses`, n)}`;
const contentDropDown = (
<>
{n}
<span className="nomobile">{addressesTxt}</span>
</>
); // trick for responsive and mobile display
return (
<>
<SimpleDropdown className="pm-button--link" content={contentDropDown}>
<DropdownMenu>{list}</DropdownMenu>
<div className="alignright p1">
<Link className="pm-button" to={`/settings/addresses/${member.ID}`}>{c('Link').t`Manage`}</Link>
</div>
</SimpleDropdown>
</>
);
};
MemberAddresses.propTypes = {
member: PropTypes.object.isRequired,
addresses: PropTypes.array.isRequired,
};
export default MemberAddresses;
| import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { msgid, c } from 'ttag';
import { SimpleDropdown, DropdownMenu } from 'react-components';
const MemberAddresses = ({ member, addresses }) => {
const list = addresses.map(({ ID, Email }) => (
<div key={ID} className="w100 flex flex-nowrap pl1 pr1 pt0-5 pb0-5">
{Email}
</div>
));
const n = list.length;
const addressesTxt = ` ${c('Info').ngettext(msgid`address`, `addresses`, n)}`;
const contentDropDown = (
<>
{n}
<span className="nomobile">{addressesTxt}</span>
</>
); // trick for responsive and mobile display
return (
<>
<SimpleDropdown className="pm-button--link" content={contentDropDown}>
<div className="dropDown-item pt0-5 pb0-5 pl1 pr1 flex">
<Link className="pm-button w100 aligncenter" to={`/settings/addresses/${member.ID}`}>{c('Link')
.t`Manage`}</Link>
</div>
<DropdownMenu>{list}</DropdownMenu>
</SimpleDropdown>
</>
);
};
MemberAddresses.propTypes = {
member: PropTypes.object.isRequired,
addresses: PropTypes.array.isRequired,
};
export default MemberAddresses;
| Fix dropdown width in adresses settings | Fix dropdown width in adresses settings
| JavaScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -6,7 +6,7 @@
const MemberAddresses = ({ member, addresses }) => {
const list = addresses.map(({ ID, Email }) => (
- <div key={ID} className="inbl w100 pt0-5 pb0-5 pl1 pr1 ellipsis">
+ <div key={ID} className="w100 flex flex-nowrap pl1 pr1 pt0-5 pb0-5">
{Email}
</div>
));
@@ -22,10 +22,11 @@
return (
<>
<SimpleDropdown className="pm-button--link" content={contentDropDown}>
+ <div className="dropDown-item pt0-5 pb0-5 pl1 pr1 flex">
+ <Link className="pm-button w100 aligncenter" to={`/settings/addresses/${member.ID}`}>{c('Link')
+ .t`Manage`}</Link>
+ </div>
<DropdownMenu>{list}</DropdownMenu>
- <div className="alignright p1">
- <Link className="pm-button" to={`/settings/addresses/${member.ID}`}>{c('Link').t`Manage`}</Link>
- </div>
</SimpleDropdown>
</>
); |
11ee849dab45f6f3d8f3a6fd23d179b561937ece | packages/tslint/index.js | packages/tslint/index.js | /**
* Tslint webpack block.
*
* @see https://github.com/wbuchwalter/tslint-loader
*/
module.exports = tslint
/**
* @param {object} [options] See https://github.com/wbuchwalter/tslint-loader#usage
* @return {Function}
*/
function tslint (options) {
options = options || {}
const loader = (context, extra) => Object.assign({
test: context.fileType('application/x-typescript'),
loaders: [ 'tslint-loader' ]
}, extra)
const module = (context) => ({
loaders: [ loader(context, { enforce: 'pre' }) ]
})
const setter = (context) => ({
module: module(context),
plugins: [
new context.webpack.LoaderOptionsPlugin({
options: {
tslint: options
}
})
]
})
return Object.assign(setter, { pre })
}
function pre (context) {
const registeredTypes = context.fileType.all()
if (!('application/x-typescript' in registeredTypes)) {
context.fileType.add('application/x-typescript', /\.(ts|tsx)$/)
}
}
| /**
* Tslint webpack block.
*
* @see https://github.com/wbuchwalter/tslint-loader
*/
module.exports = tslint
/**
* @param {object} [options] See https://github.com/wbuchwalter/tslint-loader#usage
* @return {Function}
*/
function tslint (options) {
options = options || {}
const setter = (context, helpers) => prevConfig => {
const _addLoader = helpers.addLoader({
test: context.fileType('application/x-typescript'),
loaders: [ 'tslint-loader' ],
enforce: 'pre'
})
const _addPlugin = helpers.addPlugin(
new context.webpack.LoaderOptionsPlugin({
options: {
tslint: options
}
})
)
return _addLoader(_addPlugin(prevConfig))
}
return Object.assign(setter, { pre })
}
function pre (context) {
const registeredTypes = context.fileType.all()
if (!('application/x-typescript' in registeredTypes)) {
context.fileType.add('application/x-typescript', /\.(ts|tsx)$/)
}
}
| Update tslint block to use new API | Update tslint block to use new API
| JavaScript | mit | andywer/webpack-blocks,andywer/webpack-blocks,andywer/webpack-blocks | ---
+++
@@ -13,31 +13,29 @@
function tslint (options) {
options = options || {}
- const loader = (context, extra) => Object.assign({
- test: context.fileType('application/x-typescript'),
- loaders: [ 'tslint-loader' ]
- }, extra)
-
- const module = (context) => ({
- loaders: [ loader(context, { enforce: 'pre' }) ]
- })
-
- const setter = (context) => ({
- module: module(context),
- plugins: [
+ const setter = (context, helpers) => prevConfig => {
+ const _addLoader = helpers.addLoader({
+ test: context.fileType('application/x-typescript'),
+ loaders: [ 'tslint-loader' ],
+ enforce: 'pre'
+ })
+ const _addPlugin = helpers.addPlugin(
new context.webpack.LoaderOptionsPlugin({
options: {
tslint: options
}
})
- ]
- })
+ )
+
+ return _addLoader(_addPlugin(prevConfig))
+ }
return Object.assign(setter, { pre })
}
function pre (context) {
const registeredTypes = context.fileType.all()
+
if (!('application/x-typescript' in registeredTypes)) {
context.fileType.add('application/x-typescript', /\.(ts|tsx)$/)
} |
4b120aabea20e0f8631b61cc1d9ea4a306b03aad | cypress/integration/list_view.js | cypress/integration/list_view.js | context('List View', () => {
before(() => {
cy.login('Administrator', 'qwe');
cy.visit('/desk');
cy.window().its('frappe').then(frappe => {
frappe.call("frappe.tests.test_utils.setup_workflow");
cy.reload();
});
});
it('Bulk Workflow Action', () => {
cy.go_to_list('ToDo');
cy.get('.level-item.list-row-checkbox.hidden-xs').click({ multiple: true, force: true });
});
});
| context('List View', () => {
before(() => {
cy.login('Administrator', 'qwe');
cy.visit('/desk');
cy.window().its('frappe').then(frappe => {
frappe.call("frappe.tests.test_utils.setup_workflow");
cy.reload();
});
});
it('enables "Actions" button', () => {
const actions = ['Approve', 'Reject', 'Edit', 'Assign To', 'Print','Delete'];
cy.go_to_list('ToDo');
cy.get('.level-item.list-row-checkbox.hidden-xs').click({ multiple: true, force: true });
cy.get('.btn.btn-primary.btn-sm.dropdown-toggle').contains('Actions').should('be.visible').click();
cy.get('.dropdown-menu li:visible').should('have.length', 6).each((el, index) => {
cy.wrap(el).contains(actions[index]);
}).then((elements) => {
cy.server();
cy.route({
method: 'POST',
url:'api/method/frappe.model.workflow.bulk_workflow_approval'
}).as('bulk-approval');
cy.route({
method: 'GET',
url:'api/method/frappe.desk.reportview.get*'
}).as('update-list');
cy.wrap(elements).contains('Approve').click();
cy.wait(['@bulk-approval', '@update-list']);
cy.get('.list-row-container:visible').each(el => {
cy.wrap(el).contains('Approved');
});
});
});
});
| Update list view UI test | test: Update list view UI test
| JavaScript | mit | vjFaLk/frappe,almeidapaulopt/frappe,almeidapaulopt/frappe,yashodhank/frappe,mhbu50/frappe,saurabh6790/frappe,yashodhank/frappe,almeidapaulopt/frappe,adityahase/frappe,adityahase/frappe,frappe/frappe,vjFaLk/frappe,saurabh6790/frappe,mhbu50/frappe,frappe/frappe,mhbu50/frappe,StrellaGroup/frappe,StrellaGroup/frappe,adityahase/frappe,vjFaLk/frappe,yashodhank/frappe,StrellaGroup/frappe,saurabh6790/frappe,yashodhank/frappe,almeidapaulopt/frappe,frappe/frappe,adityahase/frappe,saurabh6790/frappe,mhbu50/frappe,vjFaLk/frappe | ---
+++
@@ -7,9 +7,29 @@
cy.reload();
});
});
- it('Bulk Workflow Action', () => {
+ it('enables "Actions" button', () => {
+ const actions = ['Approve', 'Reject', 'Edit', 'Assign To', 'Print','Delete'];
cy.go_to_list('ToDo');
cy.get('.level-item.list-row-checkbox.hidden-xs').click({ multiple: true, force: true });
+ cy.get('.btn.btn-primary.btn-sm.dropdown-toggle').contains('Actions').should('be.visible').click();
+ cy.get('.dropdown-menu li:visible').should('have.length', 6).each((el, index) => {
+ cy.wrap(el).contains(actions[index]);
+ }).then((elements) => {
+ cy.server();
+ cy.route({
+ method: 'POST',
+ url:'api/method/frappe.model.workflow.bulk_workflow_approval'
+ }).as('bulk-approval');
+ cy.route({
+ method: 'GET',
+ url:'api/method/frappe.desk.reportview.get*'
+ }).as('update-list');
+ cy.wrap(elements).contains('Approve').click();
+ cy.wait(['@bulk-approval', '@update-list']);
+ cy.get('.list-row-container:visible').each(el => {
+ cy.wrap(el).contains('Approved');
+ });
+ });
});
});
|
aee10877af895edd2a8016ddf547ed3f89aed51c | app/config.js | app/config.js | // Use this file to change prototype configuration.
// Note: prototype config can be overridden using environment variables (eg on heroku)
module.exports = {
// Service name used in header. Eg: 'Renew your passport'
serviceName: '[Service Name]',
// Default port that prototype runs on
port: '3000',
// Enable or disable password protection on production
useAuth: 'true',
// Automatically stores form data, and send to all views
useAutoStoreData: 'true',
// Enable or disable built-in docs and examples.
useDocumentation: 'true',
// Force HTTP to redirect to HTTPs on production
useHttps: 'true',
// Cookie warning - update link to service's cookie page.
cookieText: 'GOV.UK uses cookies to make the site simpler. <a href="#">Find out more about cookies</a>',
// Enable or disable Browser Sync
useBrowserSync: 'true'
}
| // Use this file to change prototype configuration.
// Note: prototype config can be overridden using environment variables (eg on heroku)
module.exports = {
// Service name used in header. Eg: 'Renew your passport'
serviceName: 'Dart crossing charge',
// Default port that prototype runs on
port: '3000',
// Enable or disable password protection on production
useAuth: 'true',
// Automatically stores form data, and send to all views
useAutoStoreData: 'true',
// Enable or disable built-in docs and examples.
useDocumentation: 'true',
// Force HTTP to redirect to HTTPs on production
useHttps: 'true',
// Cookie warning - update link to service's cookie page.
cookieText: 'GOV.UK uses cookies to make the site simpler. <a href="#">Find out more about cookies</a>',
// Enable or disable Browser Sync
useBrowserSync: 'true'
}
| Update service name to Dart crossing charge for testing | Update service name to Dart crossing charge for testing | JavaScript | mit | soniaturcotte/make-adhoc-payment,soniaturcotte/make-adhoc-payment,soniaturcotte/make-adhoc-payment | ---
+++
@@ -4,7 +4,7 @@
module.exports = {
// Service name used in header. Eg: 'Renew your passport'
- serviceName: '[Service Name]',
+ serviceName: 'Dart crossing charge',
// Default port that prototype runs on
port: '3000', |
908eb28bac7678ddfc89e9009caea52c47f602f7 | src/Leaves/Admin/Products/ProductVariations/ProductVariationsViewBridge.js | src/Leaves/Admin/Products/ProductVariations/ProductVariationsViewBridge.js | scms.create('ProductVariationsViewBridge', function(){
return {
attachEvents:function () {
var self = this;
$(this.viewNode, '.product-variation-tab').click(function(event) {
if (!event.target.classList.contains('fa')) {
self.changeTab($(this).parent());
} else {
if (confirm('Are you sure you want to remove this variation?')) {
self.raiseServerEvent('VariationDelete', $(this).data('id'));
}
}
});
},
changeTab:function(tab){
var lastSelected = $('.product-list-tabs.active a');
this.raiseProgressiveServerEvent('changeVariation', lastSelected.data('id'), tab.data('id'));
lastSelected.removeClass('active');
tab.addClass('active');
}
};
}); | scms.create('ProductVariationsViewBridge', function(){
return {
attachEvents:function () {
var self = this;
$('.product-variation-tab', this.viewNode).click(function(event) {
if (!event.target.classList.contains('fa')) {
self.changeTab($(this).parent());
} else {
if (confirm('Are you sure you want to remove this variation?')) {
self.raiseServerEvent('VariationDelete', $(this).data('id'));
}
}
});
},
changeTab:function(tab){
var lastSelected = $('.product-list-tabs.active');
this.raiseProgressiveServerEvent('changeVariation', lastSelected.data('id'), tab.data('id'));
lastSelected.removeClass('active');
tab.addClass('active');
}
};
}); | Fix for active class not being set properly | Fix for active class not being set properly
| JavaScript | apache-2.0 | rojr/SuperCMS,rojr/SuperCMS | ---
+++
@@ -3,7 +3,7 @@
attachEvents:function () {
var self = this;
- $(this.viewNode, '.product-variation-tab').click(function(event) {
+ $('.product-variation-tab', this.viewNode).click(function(event) {
if (!event.target.classList.contains('fa')) {
self.changeTab($(this).parent());
} else {
@@ -16,7 +16,7 @@
},
changeTab:function(tab){
- var lastSelected = $('.product-list-tabs.active a');
+ var lastSelected = $('.product-list-tabs.active');
this.raiseProgressiveServerEvent('changeVariation', lastSelected.data('id'), tab.data('id'));
|
5796d850680779441489c60730d1655d8ee5444a | js/validate.js | js/validate.js | var ContextElement = require('./contextElement')
module.exports = function (el, cb) {
if ( ! (el instanceof ContextElement)) return cb('Given element is not a ContextElement.')
var attributes = el.getMapping().attributes
for (var i in attributes) {
var attr = attributes[i]
if ( ! Array.isArray(attr.metadatas)) continue
var value = el.getAttributeValue(attr.name)
attr.metadatas.forEach(function (meta) {
if (meta.name === 'min' && meta.type === 'number') {
value = Math.max(value, meta.value)
} else if (meta.name === 'min' && meta.type === 'number') {
value = Math.min(value, meta.value)
}
})
el.setAttributeValue(attr.name, value)
}
cb()
}
| var ContextElement = require('./contextElement')
var validators = {
min: function (current, valid) { return Math.max(current, valid) },
max: function (current, valid) { return Math.min(current, valid) },
}
module.exports = function (el, cb) {
if ( ! (el instanceof ContextElement)) return cb('Given element is not a ContextElement.')
var attributes = el.getMapping().attributes
for (var i in attributes) {
var attr = attributes[i]
if ( ! Array.isArray(attr.metadatas)) continue
var value = el.getAttributeValue(attr.name)
attr.metadatas.forEach(function (meta) {
var fn = validators[meta.name]
if (typeof fn !== 'function') {
console.error('No validator for meta', meta)
return
}
value = fn(value, meta.value)
})
el.setAttributeValue(attr.name, value)
}
cb()
}
| Make it easy to add validators. | Make it easy to add validators.
| JavaScript | mit | kukua/concava | ---
+++
@@ -1,4 +1,9 @@
var ContextElement = require('./contextElement')
+
+var validators = {
+ min: function (current, valid) { return Math.max(current, valid) },
+ max: function (current, valid) { return Math.min(current, valid) },
+}
module.exports = function (el, cb) {
if ( ! (el instanceof ContextElement)) return cb('Given element is not a ContextElement.')
@@ -13,11 +18,12 @@
var value = el.getAttributeValue(attr.name)
attr.metadatas.forEach(function (meta) {
- if (meta.name === 'min' && meta.type === 'number') {
- value = Math.max(value, meta.value)
- } else if (meta.name === 'min' && meta.type === 'number') {
- value = Math.min(value, meta.value)
+ var fn = validators[meta.name]
+ if (typeof fn !== 'function') {
+ console.error('No validator for meta', meta)
+ return
}
+ value = fn(value, meta.value)
})
el.setAttributeValue(attr.name, value) |
5ea5cf60359a2105a49bf54b7b5c7a9a4ecd7855 | tests/system/test-simple-image-resize.js | tests/system/test-simple-image-resize.js | const numberOfPlannedTests = 6
casper.test.begin('test-simple-image-resize', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryForm', {
my_file : `${fixturePath}/1.jpg`,
width_field : '400',
height_field: '400',
})
this.evaluate(function () { $('#entryForm').submit() })
this.waitFor(function () {
return curr !== this.getCurrentUrl()
})
})
casper.then(function () {
this.test.assertTextExists('ASSEMBLY_COMPLETED')
})
casper.run(function () {
this.test.done()
})
})
| const numberOfPlannedTests = 5
casper.test.begin('test-simple-image-resize', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryForm', {
my_file : `${fixturePath}/1.jpg`,
width_field : '400',
height_field: '400',
})
this.evaluate(function () { $('#entryForm').submit() })
this.waitFor(function () {
return curr !== this.getCurrentUrl()
})
})
casper.then(function () {
this.test.assertTextExists('ASSEMBLY_COMPLETED')
})
casper.run(function () {
this.test.done()
})
})
| Change num of planned tests. | Change num of planned tests.
| JavaScript | mit | transloadit/jquery-sdk,transloadit/jquery-sdk,transloadit/jquery-sdk | ---
+++
@@ -1,4 +1,4 @@
-const numberOfPlannedTests = 6
+const numberOfPlannedTests = 5
casper.test.begin('test-simple-image-resize', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}`, function () {
}) |
b14dd5a3691cc906209194ba82becfad17a9abde | src/index.js | src/index.js | /**
* _____ __
* / ___// /_ _____
* \__ \/ / / / / _ \
* ___/ / / /_/ / __/
* /____/_/\__, /\___/
* /____/
* Copyright 2017 Slye Development Team. All Rights Reserved.
* Licence: MIT License
*/
const tree = require('./core/tree');
const compile = require('./core/compile');
const modules = require('./core/modules');
const blocks = require('./core/blocks');
const configs = require('./core/config');
const cache = require('./core/cache');
var esy_lang = {
tree : tree,
compile : compile,
cache : cache,
configs : configs,
block : blocks.add,
modules : modules._esy(esy_lang)
};
module.exports = esy_lang;
| /**
* _____ __
* / ___// /_ _____
* \__ \/ / / / / _ \
* ___/ / / /_/ / __/
* /____/_/\__, /\___/
* /____/
* Copyright 2017 Slye Development Team. All Rights Reserved.
* Licence: MIT License
*/
const tree = require('./core/tree');
const compile = require('./core/compile');
const modules = require('./core/modules');
const blocks = require('./core/blocks');
const configs = require('./core/config');
const cache = require('./core/cache');
const glob = require('glob');
const path = require('path');
var esy_lang = {
tree : tree,
compile : compile,
cache : cache,
configs : configs,
block : blocks.add,
};
esy_lang['modules'] = modules._esy(esy_lang);
// Load modules
(function () {
var modules = glob.sync('../modules/*/index.js', {cwd: __dirname}),
len = modules.length,
i = 0;
for(;i < len;i++)
esy_lang.modules.load(path.join(__dirname, modules[i]))
})();
module.exports = esy_lang;
| Load modules from modules dir | Load modules from modules dir
| JavaScript | mit | Slye-team/esy-language | ---
+++
@@ -15,6 +15,8 @@
const blocks = require('./core/blocks');
const configs = require('./core/config');
const cache = require('./core/cache');
+const glob = require('glob');
+const path = require('path');
var esy_lang = {
tree : tree,
@@ -22,7 +24,16 @@
cache : cache,
configs : configs,
block : blocks.add,
- modules : modules._esy(esy_lang)
};
+esy_lang['modules'] = modules._esy(esy_lang);
+
+// Load modules
+(function () {
+ var modules = glob.sync('../modules/*/index.js', {cwd: __dirname}),
+ len = modules.length,
+ i = 0;
+ for(;i < len;i++)
+ esy_lang.modules.load(path.join(__dirname, modules[i]))
+})();
module.exports = esy_lang; |
df1b6c8807ea91bb0f8f5fa5131427699e1d05ca | ignite-base/App/Containers/Styles/ListviewExampleStyle.js | ignite-base/App/Containers/Styles/ListviewExampleStyle.js | // @flow
import { StyleSheet } from 'react-native'
import { ApplicationStyles, Metrics, Colors } from '../../Themes/'
export default StyleSheet.create({
...ApplicationStyles.screen,
container: {
flex: 1,
marginTop: Metrics.navBarHeight,
backgroundColor: Colors.background
},
row: {
flex: 1,
backgroundColor: Colors.fire,
marginVertical: Metrics.smallMargin,
justifyContent: 'center'
},
boldLabel: {
fontWeight: 'bold',
alignSelf: 'center',
color: Colors.snow,
textAlign: 'center',
marginBottom: Metrics.smallMargin
},
label: {
textAlign: 'center',
color: Colors.snow
},
listContent: {
marginTop: Metrics.baseMargin
}
})
| // @flow
import { StyleSheet } from 'react-native'
import { ApplicationStyles, Metrics, Colors } from '../../Themes/'
export default StyleSheet.create({
...ApplicationStyles.screen,
container: {
flex: 1,
marginTop: Metrics.navBarHeight,
backgroundColor: Colors.background
},
row: {
flex: 1,
backgroundColor: Colors.fire,
marginVertical: Metrics.smallMargin,
justifyContent: 'center'
},
boldLabel: {
fontWeight: 'bold',
alignSelf: 'center',
color: Colors.snow,
textAlign: 'center',
marginVertical: Metrics.smallMargin
},
label: {
textAlign: 'center',
color: Colors.snow,
marginBottom: Metrics.smallMargin
},
listContent: {
marginTop: Metrics.baseMargin
}
})
| Modify listview styles for search listview and general margin | Modify listview styles for search listview and general margin
| JavaScript | mit | ruddell/ignite,infinitered/ignite,infinitered/ignite,infinitered/ignite,infinitered/ignite,infinitered/ignite,infinitered/ignite,ruddell/ignite,infinitered/ignite,ruddell/ignite,infinitered/ignite | ---
+++
@@ -21,11 +21,12 @@
alignSelf: 'center',
color: Colors.snow,
textAlign: 'center',
- marginBottom: Metrics.smallMargin
+ marginVertical: Metrics.smallMargin
},
label: {
textAlign: 'center',
- color: Colors.snow
+ color: Colors.snow,
+ marginBottom: Metrics.smallMargin
},
listContent: {
marginTop: Metrics.baseMargin |
7dc9c68f59884e13e93dd9d79eff89da545b9315 | js/site.js | js/site.js | // Here be the site javascript!
$(document).ready(function () {
$(".button-collapse").sideNav();
$('.scrollspy').scrollSpy();
$("form").submit(function (event) {
event.preventDefault();
$("#send-msg").attr("disabled", true);
$("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-spinner").toggleClass("fa-spin");
var msg = $("#message").val();
var mail = $("#email").val();
var subject = $("#subject").val();
payload = {subject: subject, email: mail, message: msg};
// Send mail to the local python mail server
$.ajax({
type: "POST",
url: "http://46.101.248.58:5000/sendmail",
crossDomain: true,
data: payload,
complete: function (data, status, req) {
$("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-spinner").toggleClass("fa-spin");
$("#message").val("");
$("#email").val("");
$("#subject").val("");
$("#send-msg").attr("disabled", false);
$('#modal1').openModal();
}
});
});
}); | // Here be the site javascript!
$(document).ready(function () {
$(".button-collapse").sideNav();
$('.scrollspy').scrollSpy();
$("form").submit(function (event) {
event.preventDefault();
$("#send-msg").attr("disabled", true);
$("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-spinner").toggleClass("fa-spin");
var msg = $("#message").val();
var mail = $("#email").val();
var subject = $("#subject").val();
payload = {subject: subject, email: mail, message: msg};
// Send mail to the local python mail server
$.ajax({
type: "POST",
url: "http://mattij.com:5000/sendmail",
crossDomain: true,
data: payload,
complete: function (data, status, req) {
$("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-spinner").toggleClass("fa-spin");
$("#message").val("");
$("#email").val("");
$("#subject").val("");
$("#send-msg").attr("disabled", false);
$('#modal1').openModal();
}
});
});
}); | Add url to contact form | Add url to contact form
| JavaScript | mit | melonmanchan/My-Website,melonmanchan/My-Website,melonmanchan/My-Website,melonmanchan/My-Website | ---
+++
@@ -17,7 +17,7 @@
// Send mail to the local python mail server
$.ajax({
type: "POST",
- url: "http://46.101.248.58:5000/sendmail",
+ url: "http://mattij.com:5000/sendmail",
crossDomain: true,
data: payload,
complete: function (data, status, req) { |
83bfffe5280fb58d27525f18495e0c3ddd8fa6a4 | favit/static/js/favorite.js | favit/static/js/favorite.js | function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
});
$('.btn.favorite').click(function() {
var $obj = $(this);
var target_id = $obj.attr('id').split('_')[1];
$obj.prop('disabled', true);
$.ajax({
url: $obj.attr('href'),
type: 'POST',
data: {target_model: $obj.attr('model'),
target_object_id: target_id},
success: function(response) {
if (response.status == 'added') {
$obj.children().removeClass('icon-star-empty').addClass('icon-star');}
else {
$obj.children().removeClass('icon-star').addClass('icon-star-empty');}
$obj.parent('.favorite').children('.fav-count').text(response.fav_count);
$obj.prop('disabled', false);
}
});
});
| $('.btn.favorite').click(function() {
var $obj = $(this);
var target_id = $obj.attr('id').split('_')[1];
$obj.prop('disabled', true);
$.ajax({
url: $obj.attr('href'),
type: 'POST',
data: {target_model: $obj.attr('model'),
target_object_id: target_id},
success: function(response) {
if (response.status == 'added') {
$obj.children().removeClass('icon-star-empty').addClass('icon-star');}
else {
$obj.children().removeClass('icon-star').addClass('icon-star-empty');}
$obj.parent('.favorite').children('.fav-count').text(response.fav_count);
$obj.prop('disabled', false);
}
});
});
| Remove jQuery ajax CSRF headers setting | Remove jQuery ajax CSRF headers setting
This should not be done by a library, this is standard Django configuration that should be in any project that uses ajax posting.
Also, this conflicts with custom CSRF settings, like different cookie name. | JavaScript | mit | mjroson/django-favit,streema/django-favit,mjroson/django-favit,streema/django-favit,streema/django-favit,mjroson/django-favit | ---
+++
@@ -1,26 +1,3 @@
-function getCookie(name) {
- var cookieValue = null;
- if (document.cookie && document.cookie != '') {
- var cookies = document.cookie.split(';');
- for (var i = 0; i < cookies.length; i++) {
- var cookie = jQuery.trim(cookies[i]);
- // Does this cookie string begin with the name we want?
- if (cookie.substring(0, name.length + 1) == (name + '=')) {
- cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
- break;
- }
- }
- }
- return cookieValue;
-}
-
-var csrftoken = getCookie('csrftoken');
-$.ajaxSetup({
- beforeSend: function(xhr) {
- xhr.setRequestHeader("X-CSRFToken", csrftoken);
- }
-});
-
$('.btn.favorite').click(function() {
var $obj = $(this);
var target_id = $obj.attr('id').split('_')[1]; |
651fd66f865d4a091a507ef935cf204522ff687e | src/background/contexts/speeddial/SpeeddialContext.js | src/background/contexts/speeddial/SpeeddialContext.js |
var SpeeddialContext = function() {
this.properties = {};
global.opr.speeddial.get(function(speeddialProperties) {
this.properties.url = speeddialProperties.url;
this.properties.title = speeddialProperties.title;
// Set WinTabs feature to LOADED
deferredComponentsLoadStatus['SPEEDDIAL_LOADED'] = true;
}.bind(this));
};
SpeeddialContext.prototype.constructor = SpeeddialContext;
SpeeddialContext.prototype.__defineGetter__('url', function() {
return this.properties.url || "";
}); // read
SpeeddialContext.prototype.__defineSetter__('url', function(val) {
global.opr.speeddial.update({ 'url': val }, function(speeddialProperties) {
this.properties.url = speeddialProperties.url;
}.bind(this));
}); // write
SpeeddialContext.prototype.__defineGetter__('title', function() {
return this.properties.title || "";
}); // read
SpeeddialContext.prototype.__defineSetter__('title', function(val) {
global.opr.speeddial.update({ 'title': val }, function(speeddialProperties) {
this.properties.title = speeddialProperties.title;
}.bind(this));
}); // write
|
var SpeeddialContext = function() {
this.properties = {};
global.opr.speeddial.get(function(speeddialProperties) {
this.properties.url = speeddialProperties.url;
this.properties.title = speeddialProperties.title;
// Set WinTabs feature to LOADED
deferredComponentsLoadStatus['SPEEDDIAL_LOADED'] = true;
}.bind(this));
};
SpeeddialContext.prototype.constructor = SpeeddialContext;
SpeeddialContext.prototype.__defineGetter__('url', function() {
return this.properties.url || "";
}); // read
SpeeddialContext.prototype.__defineSetter__('url', function(val) {
this.properties.url = val;
global.opr.speeddial.update({ 'url': val }, function() {});
}); // write
SpeeddialContext.prototype.__defineGetter__('title', function() {
return this.properties.title || "";
}); // read
SpeeddialContext.prototype.__defineSetter__('title', function(val) {
this.properties.title = val;
global.opr.speeddial.update({ 'title': val }, function() {});
}); // write
| Update Speed Dial API implementation to set attributes independent of Chromium call to update attributes. | Update Speed Dial API implementation to set attributes independent of Chromium call to update attributes.
| JavaScript | mit | operasoftware/operaextensions.js,operasoftware/operaextensions.js,operasoftware/operaextensions.js | ---
+++
@@ -21,9 +21,9 @@
SpeeddialContext.prototype.__defineSetter__('url', function(val) {
- global.opr.speeddial.update({ 'url': val }, function(speeddialProperties) {
- this.properties.url = speeddialProperties.url;
- }.bind(this));
+ this.properties.url = val;
+
+ global.opr.speeddial.update({ 'url': val }, function() {});
}); // write
@@ -33,8 +33,8 @@
SpeeddialContext.prototype.__defineSetter__('title', function(val) {
- global.opr.speeddial.update({ 'title': val }, function(speeddialProperties) {
- this.properties.title = speeddialProperties.title;
- }.bind(this));
+ this.properties.title = val;
+
+ global.opr.speeddial.update({ 'title': val }, function() {});
}); // write |
48229ca6df978a16a071259083b0a3655d66cfd8 | lib/Node/prototype/_replace-content.js | lib/Node/prototype/_replace-content.js | 'use strict';
var normalize = require('../../Document/prototype/normalize');
module.exports = function (child/*, …child*/) {
var oldNodes = this.childNodes, df, nu, i = 0, old;
df = normalize.apply(this.ownerDocument, arguments);
while ((nu = df.firstChild)) {
old = oldNodes[i++];
if (old !== nu) {
if (old) this.replaceChild(nu, old);
else this.appendChild(nu);
}
}
while (oldNodes.length > i) this.removeChild(oldNodes[i]);
return this;
};
| 'use strict';
var normalize = require('../../Document/prototype/normalize')
, isDF = require('../../DocumentFragment/is-document-fragment');
module.exports = function (child/*, …child*/) {
var oldNodes = this.childNodes, dom, nu, i = 0, old;
dom = normalize.apply(this.ownerDocument, arguments);
if (isDF(dom)) {
while ((nu = dom.firstChild)) {
old = oldNodes[i++];
if (old !== nu) {
if (old) this.replaceChild(nu, old);
else this.appendChild(nu);
}
}
} else if (dom) {
old = oldNodes[i++];
if (old !== dom) {
if (old) this.replaceChild(dom, old);
else this.appendChild(dom);
}
}
while (oldNodes.length > i) this.removeChild(oldNodes[i]);
return this;
};
| Update up to change in normalize | Update up to change in normalize
| JavaScript | mit | medikoo/dom-ext | ---
+++
@@ -1,15 +1,25 @@
'use strict';
-var normalize = require('../../Document/prototype/normalize');
+var normalize = require('../../Document/prototype/normalize')
+ , isDF = require('../../DocumentFragment/is-document-fragment');
module.exports = function (child/*, …child*/) {
- var oldNodes = this.childNodes, df, nu, i = 0, old;
- df = normalize.apply(this.ownerDocument, arguments);
- while ((nu = df.firstChild)) {
+ var oldNodes = this.childNodes, dom, nu, i = 0, old;
+ dom = normalize.apply(this.ownerDocument, arguments);
+
+ if (isDF(dom)) {
+ while ((nu = dom.firstChild)) {
+ old = oldNodes[i++];
+ if (old !== nu) {
+ if (old) this.replaceChild(nu, old);
+ else this.appendChild(nu);
+ }
+ }
+ } else if (dom) {
old = oldNodes[i++];
- if (old !== nu) {
- if (old) this.replaceChild(nu, old);
- else this.appendChild(nu);
+ if (old !== dom) {
+ if (old) this.replaceChild(dom, old);
+ else this.appendChild(dom);
}
}
while (oldNodes.length > i) this.removeChild(oldNodes[i]); |
d2a8b435cd8af2788f213163dad7d12bddb4bc11 | lib/dictionaries/jscs/requireSpaceAfterKeywords.js | lib/dictionaries/jscs/requireSpaceAfterKeywords.js | /**
* @fileoverview Translation for `requireSpaceAfterKeywords` (JSCS) to ESLint
* @author Breno Lima de Freitas <https://breno.io>
* @copyright 2016 Breno Lima de Freitas. All rights reserved.
* See LICENSE file in root directory for full license.
*/
'use strict'
//------------------------------------------------------------------------------
// Rule Translation Definition
//------------------------------------------------------------------------------
module.exports = 2;
| /**
* @fileoverview Translation for `requireSpaceAfterKeywords` (JSCS) to ESLint
* @author Breno Lima de Freitas <https://breno.io>
* @copyright 2016 Breno Lima de Freitas. All rights reserved.
* See LICENSE file in root directory for full license.
*/
'use strict'
//------------------------------------------------------------------------------
// Rule Translation Definition
//------------------------------------------------------------------------------
module.exports = {
name: 'keyword-spacing',
truthy: [
2,
'always'
]
};
| Fix `missing rule name` eslint conversion error | Fix `missing rule name` eslint conversion error
| JavaScript | mit | brenolf/polyjuice | ---
+++
@@ -11,4 +11,10 @@
// Rule Translation Definition
//------------------------------------------------------------------------------
-module.exports = 2;
+module.exports = {
+ name: 'keyword-spacing',
+ truthy: [
+ 2,
+ 'always'
+ ]
+}; |
b759f8c8cb9dee4797dd9dd1741d3dc274403eba | tests/spec/SpecHelper.js | tests/spec/SpecHelper.js | beforeEach(function() {
this.addMatchers({
toBeLessThan: function(expected) {
return this.actual < expected;
},
toHaveAllValuesInRange: function (low, high) {
for (var idx = 0; idx < this.actual.length; idx += 1) {
if (this.actual[idx] < low || this.actual[idx] > high) {
return false;
}
}
return true;
}
});
});
| beforeEach(function() {
this.addMatchers({
toBeLessThan: function(expected) {
return this.actual < expected;
},
toHaveAllValuesInRange: function (low, high) {
for (var idx = 0; idx < this.actual.length; idx += 1) {
if (this.actual[idx] < low || this.actual[idx] > high) {
return false;
}
}
return true;
}
});
});
function setIfUndefined(variable, defaultValue) {
variable = (typeof variable === "undefined") ? defaultValue : variable;
return variable;
}
| Add test helper to set default values on variables | Add test helper to set default values on variables
| JavaScript | mit | sbnb/capensis-steganography | ---
+++
@@ -14,3 +14,7 @@
});
});
+function setIfUndefined(variable, defaultValue) {
+ variable = (typeof variable === "undefined") ? defaultValue : variable;
+ return variable;
+} |
283d7b238b0a778971a9b77d929acf697b4bd501 | lib/resolve-script/find-executables.js | lib/resolve-script/find-executables.js | var _ = require('lodash')
var globFirst = require('./glob-first')
var log = require('../run/log')
var path = require('path')
var async = require('async')
var isExecutable = require('./is-executable')
module.exports = function (patterns, cb) {
globFirst(patterns, function (er, results) {
if (er) return cb(er)
async.map(results, function (result, cb) {
isExecutable(result, function (er, itIsExecutable) {
if (itIsExecutable) {
cb(er, path.resolve(result))
} else {
log(
'Warning: scripty - ignoring script "' + result + '" because it' +
' was not executable. Run `chmod +x "' + result + '" if you want' +
' scripty to run it.'
)
cb(er, undefined)
}
})
}, function (er, results) {
cb(er, _.compact(results))
})
})
}
| var _ = require('lodash')
var globFirst = require('./glob-first')
var log = require('../run/log')
var path = require('path')
var async = require('async')
var isExecutable = require('./is-executable')
module.exports = function (patterns, cb) {
globFirst(patterns, function (er, results) {
if (er) return cb(er)
async.map(results, function (result, cb) {
isExecutable(result, function (er, itIsExecutable) {
if (itIsExecutable) {
cb(er, path.resolve(result))
} else {
log(
'Warning: scripty - ignoring script "%s" because it' +
' was not executable. Run `chmod +x "%s" if you want' +
' scripty to run it.', result, result)
cb(er, undefined)
}
})
}, function (er, results) {
cb(er, _.compact(results))
})
})
}
| Leverage util.format for printf-style logging | Leverage util.format for printf-style logging
| JavaScript | mit | testdouble/scripty,testdouble/scripty | ---
+++
@@ -15,10 +15,9 @@
cb(er, path.resolve(result))
} else {
log(
- 'Warning: scripty - ignoring script "' + result + '" because it' +
- ' was not executable. Run `chmod +x "' + result + '" if you want' +
- ' scripty to run it.'
- )
+ 'Warning: scripty - ignoring script "%s" because it' +
+ ' was not executable. Run `chmod +x "%s" if you want' +
+ ' scripty to run it.', result, result)
cb(er, undefined)
}
}) |
d9c4ad44e8646db294a1b46b6d10955125d2da9c | src/index.js | src/index.js | // TODO consider using https://babeljs.io/docs/plugins/transform-runtime/ instead of babel-polyfill
import "babel-polyfill"
import React from "react"
import { render } from "react-dom"
import { createStore, applyMiddleware } from "redux"
import { Provider } from "react-redux"
import createSagaMiddleware from "redux-saga"
import debounce from "lodash.debounce"
import { getToken, setToken } from "./lib/auth"
import { loginSuccess } from "./actions"
import reducers from "./reducers"
import { rootSaga } from "./sagas"
import "./main.scss"
import App from "./containers/App"
const container = document.getElementById("app")
const sagaMiddleware = createSagaMiddleware()
const store = createStore(
reducers,
// eslint-disable-next-line
process.env.NODE_ENV !== "production" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
applyMiddleware(sagaMiddleware),
)
sagaMiddleware.run(rootSaga)
const token = getToken()
if (token) {
store.dispatch(loginSuccess(token))
}
store.subscribe(debounce(() => {
console.log("setting token", store.getState().auth.token)
setToken(store.getState().auth.token)
}, 500, {
leading: true,
trailing: false,
}))
render(
<Provider store={store}>
<App />
</Provider>,
container,
)
| // TODO consider using https://babeljs.io/docs/plugins/transform-runtime/ instead of babel-polyfill
import "babel-polyfill"
import React from "react"
import { render } from "react-dom"
import { createStore, applyMiddleware } from "redux"
import { Provider } from "react-redux"
import createSagaMiddleware from "redux-saga"
import debounce from "lodash.debounce"
import { getToken, setToken } from "./lib/auth"
import { loginSuccess } from "./actions"
import reducers from "./reducers"
import { rootSaga } from "./sagas"
import "./main.scss"
import App from "./containers/App"
const container = document.getElementById("app")
const sagaMiddleware = createSagaMiddleware()
const store = createStore(
reducers,
// eslint-disable-next-line
process.env.NODE_ENV !== "production" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
applyMiddleware(sagaMiddleware),
)
sagaMiddleware.run(rootSaga)
let token = getToken()
if (token) {
store.dispatch(loginSuccess(token))
}
store.subscribe(debounce(() => {
const newToken = store.getState().auth.token
if (newToken !== token) {
token = newToken
setToken(newToken)
}
}, 500, {
leading: true,
trailing: false,
}))
render(
<Provider store={store}>
<App />
</Provider>,
container,
)
| Save token to localStorage only if it changes | Save token to localStorage only if it changes
| JavaScript | isc | bostrom/harvest-balance,bostrom/harvest-balance | ---
+++
@@ -23,13 +23,16 @@
)
sagaMiddleware.run(rootSaga)
-const token = getToken()
+let token = getToken()
if (token) {
store.dispatch(loginSuccess(token))
}
store.subscribe(debounce(() => {
- console.log("setting token", store.getState().auth.token)
- setToken(store.getState().auth.token)
+ const newToken = store.getState().auth.token
+ if (newToken !== token) {
+ token = newToken
+ setToken(newToken)
+ }
}, 500, {
leading: true,
trailing: false, |
56d3feba455c9776a17e311b2cfb294f321ade8e | lib/exprexo.js | lib/exprexo.js | const router = require('./router')
const express = require('express')
const cors = require('cors')
/**
* Creates a new server with the given options.
* @param {Object} options configurable options.
* @param {Function} callback function to be called on start.
* @return {Object} express app instance.
*/
function createServer (options, callback) {
const app = express()
app.use(cors())
// TODO morgan as verbose?
// app.use(logger('dev'))
// app.use(logger('combined'))
// TODO create favicon
app.use('/favicon.ico', function (req, res) {
res.sendStatus(200)
})
app.use('/', router(options))
app.listen(options.port, callback)
return app
}
module.exports = createServer
| const router = require('./router')
const express = require('express')
const cors = require('cors')
/**
* Creates a new server with the given options.
* @param {Object} options configurable options.
* @param {Function} callback function to be called on start.
* @return {Object} express app instance.
*/
function createServer (options, callback) {
const app = express()
app.use(cors())
// For parsing `application/json`.
app.use(express.json())
// For parsing `application/x-www-form-urlencoded`.
app.use(express.urlencoded({ extended: true }))
// TODO morgan as verbose?
// app.use(logger('dev'))
// app.use(logger('combined'))
// TODO create favicon
app.use('/favicon.ico', function (req, res) {
res.sendStatus(200)
})
app.use('/', router(options))
app.listen(options.port, callback)
return app
}
module.exports = createServer
| Add parsers as a default. | feat: Add parsers as a default.
* Add parser middleware for parsing `application/json`.
* Add parser middleware for parsing `application/x-www-form-urlencoded`.
BREAKING CHANGE: `req.body` will not longer be `undefined`,
will include a parsed json instead with the request payload.
| JavaScript | mit | exprexo/exprexo | ---
+++
@@ -12,6 +12,10 @@
const app = express()
app.use(cors())
+ // For parsing `application/json`.
+ app.use(express.json())
+ // For parsing `application/x-www-form-urlencoded`.
+ app.use(express.urlencoded({ extended: true }))
// TODO morgan as verbose?
// app.use(logger('dev')) |
78e4bb29dce00ed1a5edcd296790dcbb0959f40b | src/index.js | src/index.js | /* eslint-disable no-console */
console.log('hi');
// Old ES5 way of creating a Class Component
// var HelloWorld = React.createClass({
// render: function() {
// return (
// <h1>Hello world!</h1>
// );
// };
// });
//Old ES5 Stateless Functional Component
// var HelloWorld = function(props) {
// return (
// <h1>Hello World!</h1>
// );
// };
| /* eslint-disable no-console */
console.log('hi');
// Old ES5 way of creating a Class Component
// var HelloWorld = React.createClass({
// render: function() {
// return (
// <h1>Hello world!</h1>
// );
// };
// });
//Old ES5 Stateless Functional Component
// var HelloWorld = function(props) {
// return (
// <h1>Hello World!</h1>
// );
// };
//ES6 Stateless Functional Component
// const HelloWorld = (props) => {
// return (
// <h1>Hello ES6 World!</h1>
// )
// };
//Even simpler ES6 Statelss Functional Component
// const HelloWorld = props => (
// <h1>Hello ES6 World, simplified!</h1>
// );
| Add ES6 examples for component creation | Add ES6 examples for component creation
| JavaScript | mit | mtheoryx/react-redux-es6,mtheoryx/react-redux-es6 | ---
+++
@@ -15,3 +15,15 @@
// <h1>Hello World!</h1>
// );
// };
+
+//ES6 Stateless Functional Component
+// const HelloWorld = (props) => {
+// return (
+// <h1>Hello ES6 World!</h1>
+// )
+// };
+
+//Even simpler ES6 Statelss Functional Component
+// const HelloWorld = props => (
+// <h1>Hello ES6 World, simplified!</h1>
+// ); |
79ff48d6a9ea971e23087791dba13c8faf4086a4 | src/index.js | src/index.js | import createFormatters from './createFormatters';
// Check for globally defined Immutable and add an install method to it.
if (typeof Immutable !== "undefined") {
Immutable.installDevTools = install.bind(null, Immutable);
}
// I imagine most people are using Immutable as a CommonJS module though...
let installed = false;
function install(Immutable) {
if (typeof window === "undefined") {
throw new Error("Can only install immutable-devtools in a browser environment.");
}
// Don't install more than once.
if (installed === true) {
return;
}
window.devtoolsFormatters = window.devtoolsFormatters || [];
const {
RecordFormatter,
OrderedMapFormatter,
OrderedSetFormatter,
ListFormatter,
MapFormatter,
SetFormatter,
StackFormatter
} = createFormatters(Immutable);
window.devtoolsFormatters.push(
RecordFormatter,
OrderedMapFormatter,
OrderedSetFormatter,
ListFormatter,
MapFormatter,
SetFormatter,
StackFormatter
);
installed = true;
}
module.exports = install;
export default install;
| import createFormatters from './createFormatters';
// Check for globally defined Immutable and add an install method to it.
if (typeof Immutable !== "undefined") {
Immutable.installDevTools = install.bind(null, Immutable);
}
// I imagine most people are using Immutable as a CommonJS module though...
let installed = false;
function install(Immutable) {
const gw = typeof window === "undefined" ? global : window;
// Don't install more than once.
if (installed === true) {
return;
}
gw.devtoolsFormatters = gw.devtoolsFormatters || [];
const {
RecordFormatter,
OrderedMapFormatter,
OrderedSetFormatter,
ListFormatter,
MapFormatter,
SetFormatter,
StackFormatter
} = createFormatters(Immutable);
gw.devtoolsFormatters.push(
RecordFormatter,
OrderedMapFormatter,
OrderedSetFormatter,
ListFormatter,
MapFormatter,
SetFormatter,
StackFormatter
);
installed = true;
}
module.exports = install;
export default install;
| Add support for server side Immutable DevTools | Add support for server side Immutable DevTools
Fixes issue #31 | JavaScript | bsd-3-clause | andrewdavey/immutable-devtools,andrewdavey/immutable-devtools | ---
+++
@@ -9,16 +9,14 @@
let installed = false;
function install(Immutable) {
- if (typeof window === "undefined") {
- throw new Error("Can only install immutable-devtools in a browser environment.");
- }
+ const gw = typeof window === "undefined" ? global : window;
// Don't install more than once.
if (installed === true) {
return;
}
- window.devtoolsFormatters = window.devtoolsFormatters || [];
+ gw.devtoolsFormatters = gw.devtoolsFormatters || [];
const {
RecordFormatter,
@@ -30,7 +28,7 @@
StackFormatter
} = createFormatters(Immutable);
- window.devtoolsFormatters.push(
+ gw.devtoolsFormatters.push(
RecordFormatter,
OrderedMapFormatter,
OrderedSetFormatter, |
26a5db8b6f14d411fc9f05ff016e35558a6c18da | src/index.js | src/index.js | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Odometer from 'odometer';
export default class ReactOdometer extends Component {
static propTypes = {
value: PropTypes.number.isRequired,
options: PropTypes.object,
};
componentDidMount() {
this.odometer = new Odometer({
el: ReactDOM.findDOMNode(this),
value: this.props.value,
...this.props.options,
});
}
componentDidUpdate() {
this.odometer.update(this.props.value);
}
render() {
return React.createElement('div');
}
}
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Odometer from 'odometer';
export default class ReactOdometer extends Component {
static defaultProps = {
options: {},
};
static propTypes = {
value: PropTypes.number.isRequired,
options: PropTypes.object,
};
componentDidMount() {
const { value, options } = this.props;
this.odometer = new Odometer({
el: this.node,
value,
...options,
});
}
componentDidUpdate() {
this.odometer.update(this.props.value);
}
render() {
return React.createElement('div', {
ref: (node) => {
this.node = node;
},
});
}
}
| Use ref instead of findDOMNode | Use ref instead of findDOMNode
| JavaScript | mit | inferusvv/react-odometerjs | ---
+++
@@ -1,19 +1,23 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-import ReactDOM from 'react-dom';
import Odometer from 'odometer';
export default class ReactOdometer extends Component {
+ static defaultProps = {
+ options: {},
+ };
+
static propTypes = {
value: PropTypes.number.isRequired,
options: PropTypes.object,
};
componentDidMount() {
+ const { value, options } = this.props;
this.odometer = new Odometer({
- el: ReactDOM.findDOMNode(this),
- value: this.props.value,
- ...this.props.options,
+ el: this.node,
+ value,
+ ...options,
});
}
@@ -22,6 +26,10 @@
}
render() {
- return React.createElement('div');
+ return React.createElement('div', {
+ ref: (node) => {
+ this.node = node;
+ },
+ });
}
} |
405b7f10323ba2780a2e2f2376430bf467d9582a | lib/weather.js | lib/weather.js | const needle = require('needle');
const config = require('../config');
const _ = require('lodash');
const weather = {
getWeatherInfo: function(req, res){
//TODO add country/city validation here
const url = getOpenWeatherUrl(req);
needle.get(url, function(error, response) {
if (!error && response.statusCode === 200){
res.status(200).send(_.get(response, 'body.weather[0].description'));
}else{
console.log(error, response);
res.status(404);
res.send('Error retrieving data');
}
});
},
};
function getOpenWeatherUrl(req) {
const city = req.query.city;
const country = req.query.country;
const url = config.base_url + '?appid=' + process.env.API_KEY + '&q=' + city + ',' + country;
return url;
}
module.exports = weather; | const needle = require('needle');
const _ = require('lodash');
const config = require('../config');
const countriesCities = require('../countries-cities');
const weather = {
getWeatherInfo: function(req, res){
const city = req.query.city? req.query.city.toLowerCase():req.query.city;
const country = req.query.country?req.query.country.toLowerCase(): req.query.country;
const validationResult = validateCityAndCountry(city, country);
if(validationResult.message!=='ok'){
res.status(400);
res.json({"status":"400", "message":validationResult.message});
return;
}
const url = getOpenWeatherUrl(city, country);
needle.get(url, function(error, response) {
if (!error && response.statusCode === 200){
res.status(200).send(_.get(response, 'body.weather[0].description'));
}else{
console.log(error, response);
res.status(404).send('Error retrieving data');
}
});
},
};
function getOpenWeatherUrl(city, country) {
return config.base_url + '?appid=' + process.env.API_KEY + '&q=' + city + ',' + country;
}
function validateCityAndCountry(city, country){
if(country && countriesCities[country]){
if(city && countriesCities[country].indexOf(city)!==-1){
return {message: "ok"}
}else{
return {message: "Invalid city " + city + "- pass the full name of a city in "+country.toUpperCase()}
}
}else{
return {message: "Invalid country " + country + "- pass two character ISO-3166 code"}
}
}
module.exports = weather; | Add validation for city and country | Add validation for city and country
| JavaScript | mit | umasudhan/weather | ---
+++
@@ -1,30 +1,45 @@
const needle = require('needle');
+const _ = require('lodash');
+
const config = require('../config');
-const _ = require('lodash');
+const countriesCities = require('../countries-cities');
const weather = {
getWeatherInfo: function(req, res){
- //TODO add country/city validation here
- const url = getOpenWeatherUrl(req);
+ const city = req.query.city? req.query.city.toLowerCase():req.query.city;
+ const country = req.query.country?req.query.country.toLowerCase(): req.query.country;
+ const validationResult = validateCityAndCountry(city, country);
+ if(validationResult.message!=='ok'){
+ res.status(400);
+ res.json({"status":"400", "message":validationResult.message});
+ return;
+ }
+ const url = getOpenWeatherUrl(city, country);
needle.get(url, function(error, response) {
if (!error && response.statusCode === 200){
res.status(200).send(_.get(response, 'body.weather[0].description'));
}else{
console.log(error, response);
- res.status(404);
- res.send('Error retrieving data');
+ res.status(404).send('Error retrieving data');
}
});
},
-
-
};
-function getOpenWeatherUrl(req) {
- const city = req.query.city;
- const country = req.query.country;
- const url = config.base_url + '?appid=' + process.env.API_KEY + '&q=' + city + ',' + country;
- return url;
+function getOpenWeatherUrl(city, country) {
+ return config.base_url + '?appid=' + process.env.API_KEY + '&q=' + city + ',' + country;
+}
+
+function validateCityAndCountry(city, country){
+ if(country && countriesCities[country]){
+ if(city && countriesCities[country].indexOf(city)!==-1){
+ return {message: "ok"}
+ }else{
+ return {message: "Invalid city " + city + "- pass the full name of a city in "+country.toUpperCase()}
+ }
+ }else{
+ return {message: "Invalid country " + country + "- pass two character ISO-3166 code"}
+ }
}
module.exports = weather; |
5162dba0bcf51d1d86c64deebe289000eb966ad5 | lib/short-url-controller.js | lib/short-url-controller.js | "use strict";
let db = require('./db');
function generateStub(length) {
let result = ""
for(let i = 0; i < length; i++) {
let value = Math.round(Math.random() * 35)
if (value > 9)
result += String.fromCharCode(value + 87);
else
result += value
}
return result;
}
function shortenUrl(req, res) {
let url = req.params.url;
let nurl = generateStub(5);
let collision = false;
while(collision) {
db.oneOrNone('select exists(select * from urls where nurl = $1 limit 1);', nurl)
.then(function(data) {
if (data.exists) {
nurl = generateStub(5);
collision = true;
} else
collision = false;
}).catch(function(error) {
console.log('Error: ' + error);
res.send(500);
});
}
db.none('insert into urls(url, nurl) values($1, $2);', [url, nurl]);
res.jsonp({
"oldurl" : url,
"newurl" : req.host + '/' + nurl
});
}
module.exports = shortenUrl;
| "use strict";
let db = require('./db');
function generateBase36Stub(length) {
let result = ""
for(let i = 0; i < length; i++) {
let value = Math.round(Math.random() * 35)
if (value > 9)
result += String.fromCharCode(value + 87);
else
result += value
}
return result;
}
function shortenUrl(req, res) {
let url = req.params.url;
let nurl = generateBase36Stub(5);
let collision = false;
while(collision) {
db.oneOrNone('select exists(select * from urls where nurl = $1 limit 1);', nurl)
.then(function(data) {
if (data.exists) {
nurl = generateBase36Stub(5);
collision = true;
} else
collision = false;
}).catch(function(error) {
console.log('Error: ' + error);
res.send(500);
});
}
db.none('insert into urls(url, nurl) values($1, $2);', [url, nurl]);
res.jsonp({
"oldurl" : url,
"newurl" : req.host + '/' + nurl
});
}
module.exports = shortenUrl;
| Make function name more descript | Make function name more descript
| JavaScript | mit | glynnw/url-shortener,glynnw/url-shortener | ---
+++
@@ -1,7 +1,7 @@
"use strict";
let db = require('./db');
-function generateStub(length) {
+function generateBase36Stub(length) {
let result = ""
for(let i = 0; i < length; i++) {
let value = Math.round(Math.random() * 35)
@@ -15,14 +15,14 @@
function shortenUrl(req, res) {
let url = req.params.url;
- let nurl = generateStub(5);
+ let nurl = generateBase36Stub(5);
let collision = false;
while(collision) {
db.oneOrNone('select exists(select * from urls where nurl = $1 limit 1);', nurl)
.then(function(data) {
if (data.exists) {
- nurl = generateStub(5);
+ nurl = generateBase36Stub(5);
collision = true;
} else
collision = false; |
1d1075a1eec288c1372ccd001c197fab29f71980 | lib/skeletonDependencies.js | lib/skeletonDependencies.js | export default {
connect: '3.5.0',
'server-destroy': '1.0.1',
'connect-modrewrite': '0.9.0',
winston: '2.3.0',
'find-port': '2.0.1',
rimraf: '2.5.4',
shelljs: '0.7.5',
lodash: '4.17.2',
request: '2.79.0',
queue: '4.0.0',
reify: '0.4.4',
send: '0.14.1',
'fs-plus': '2.9.3'
};
| export default {
connect: '3.5.0',
'server-destroy': '1.0.1',
'connect-modrewrite': '0.9.0',
winston: '2.3.0',
'find-port': '2.0.1',
rimraf: '2.5.4',
shelljs: '0.7.5',
lodash: '4.17.4',
request: '2.79.0',
queue: '4.0.1',
reify: '0.4.4',
send: '0.14.1',
'fs-plus': '2.9.3'
};
| Update skeleton app default dependencies | Update skeleton app default dependencies
| JavaScript | mit | wojtkowiak/meteor-desktop,wojtkowiak/meteor-desktop | ---
+++
@@ -6,9 +6,9 @@
'find-port': '2.0.1',
rimraf: '2.5.4',
shelljs: '0.7.5',
- lodash: '4.17.2',
+ lodash: '4.17.4',
request: '2.79.0',
- queue: '4.0.0',
+ queue: '4.0.1',
reify: '0.4.4',
send: '0.14.1',
'fs-plus': '2.9.3' |
d8384f73dd7b4e8b447634b3111fc58ae19e1435 | content.js | content.js |
var themes = [
"faded",
"grayscale",
"sepia",
"wide-blur",
"overexposed",
"flip-hue",
"none"
];
function defaultTheme() {
return "faded";
}
document.body.classList.add("ugly-http-status-loaded");
if (!window.isSecureContext) {
chrome.storage.local.get({
theme: "default"
}, function(items) {
var theme = items.theme;
if (themes.indexOf(theme) === -1) {
theme = defaultTheme();
}
document.body.classList.add("ugly-http-theme-" + theme);
});
}
|
var themes = [
"faded",
"grayscale",
"sepia",
"wide-blur",
"overexposed",
"flip-hue",
"none"
];
function defaultTheme() {
return "faded";
}
if (!window.isSecureContext) {
chrome.storage.local.get({
theme: "default"
}, function(items) {
var theme = items.theme;
if (themes.indexOf(theme) === -1) {
theme = defaultTheme();
}
document.body.classList.add("ugly-http-theme-" + theme);
});
}
setTimeout(function() {
document.body.classList.add("ugly-http-status-loaded");
}, 10);
| Remove loading dimmer briefly *after* applying theme. | Remove loading dimmer briefly *after* applying theme.
Otherwise, the page can briefly flash in full color before the theme is applied.
| JavaScript | mit | lgarron/ugly-http-extension,lgarron/ugly-http-extension | ---
+++
@@ -13,7 +13,6 @@
return "faded";
}
-document.body.classList.add("ugly-http-status-loaded");
if (!window.isSecureContext) {
chrome.storage.local.get({
theme: "default"
@@ -26,3 +25,6 @@
document.body.classList.add("ugly-http-theme-" + theme);
});
}
+setTimeout(function() {
+document.body.classList.add("ugly-http-status-loaded");
+}, 10); |
4ca56946ccc518ce57188ef64e9327f97f6f30be | tests/unit/utils/build-provider-asset-path-test.js | tests/unit/utils/build-provider-asset-path-test.js | import buildProviderAssetPath from 'preprint-service/utils/build-provider-asset-path';
import { module, test } from 'qunit';
module('Unit | Utility | build provider asset path');
// Replace this with your real tests.
test('it works', function(assert) {
let result = buildProviderAssetPath();
assert.ok(result);
});
| import config from 'ember-get-config';
import buildProviderAssetPath from 'preprint-service/utils/build-provider-asset-path';
import { module, test } from 'qunit';
module('Unit | Utility | build provider asset path');
test('build correct path for domain', function(assert) {
let result = buildProviderAssetPath('foo', 'bar.baz', true);
assert.equal(result, `${config.providerAssetsURL}foo/bar.baz`);
});
test('build correct path for non-domain', function(assert) {
let result = buildProviderAssetPath('foo', 'bar.baz', false);
assert.equal(result, `${config.providerAssetsURL}foo/bar.baz`);
});
| Update buildProviderAssetPath unit test to do something useful | Update buildProviderAssetPath unit test to do something useful
| JavaScript | apache-2.0 | baylee-d/ember-preprints,CenterForOpenScience/ember-preprints,laurenrevere/ember-preprints,laurenrevere/ember-preprints,CenterForOpenScience/ember-preprints,baylee-d/ember-preprints | ---
+++
@@ -1,10 +1,15 @@
+import config from 'ember-get-config';
import buildProviderAssetPath from 'preprint-service/utils/build-provider-asset-path';
import { module, test } from 'qunit';
module('Unit | Utility | build provider asset path');
-// Replace this with your real tests.
-test('it works', function(assert) {
- let result = buildProviderAssetPath();
- assert.ok(result);
+test('build correct path for domain', function(assert) {
+ let result = buildProviderAssetPath('foo', 'bar.baz', true);
+ assert.equal(result, `${config.providerAssetsURL}foo/bar.baz`);
});
+
+test('build correct path for non-domain', function(assert) {
+ let result = buildProviderAssetPath('foo', 'bar.baz', false);
+ assert.equal(result, `${config.providerAssetsURL}foo/bar.baz`);
+}); |
ca9dfe7879ff24cf241e6edbc7c3507562193d77 | DynamixelServo.Quadruped.WebInterface/wwwroot/js/VideoStreaming.js | DynamixelServo.Quadruped.WebInterface/wwwroot/js/VideoStreaming.js | let videoImage = document.getElementById('video_image');
videoImage.src = `http://${document.domain}:8080/?action=stream`;
let cameraJoystick = {
zone: videoImage,
color: 'red'
};
let cameraJoystickManager = nipplejs.create(cameraJoystick);
const clickTimeout = 500;
var lastStartClick = Date.now();
cameraJoystickManager.on('added',
function (evt, nipple) {
nipple.on('move',
function (evt, arg) {
var json = JSON.stringify({
joystickType: 'camera',
angle: arg.angle.radian,
MessageType: 'movement',
distance: arg.distance
});
serverSocket.send(json);
});
nipple.on('start',
function () {
if (Date.now() - lastStartClick < clickTimeout) {
const json = JSON.stringify(
{ joystickType: 'camera', MessageType: 'reset' });
serverSocket.send(json);
} else {
const json = JSON.stringify(
{ joystickType: 'camera', MessageType: 'start' });
serverSocket.send(json);
}
lastStartClick = Date.now();
});
nipple.on('end',
function () {
var json = JSON.stringify({
joystickType: 'camera',
MessageType: 'stop'
});
serverSocket.send(json);
});
}); | let videoImage = document.getElementById('video_image');
videoImage.src = `http://${document.domain}:8080/?action=stream`;
let cameraJoystick = {
zone: videoImage,
color: 'red'
};
let cameraJoystickManager = nipplejs.create(cameraJoystick);
const clickTimeout = 500;
var lastStopClick = Date.now();
cameraJoystickManager.on('added',
function (evt, nipple) {
nipple.on('move',
function (evt, arg) {
var json = JSON.stringify({
joystickType: 'camera',
angle: arg.angle.radian,
MessageType: 'movement',
distance: arg.distance
});
serverSocket.send(json);
});
nipple.on('start',
function () {
const json = JSON.stringify(
{ joystickType: 'camera', MessageType: 'start' });
serverSocket.send(json);
});
nipple.on('end',
function () {
if (Date.now() - lastStopClick < clickTimeout) {
const json = JSON.stringify(
{ joystickType: 'camera', MessageType: 'reset' });
serverSocket.send(json);
} else {
var json = JSON.stringify({
joystickType: 'camera',
MessageType: 'stop'
});
serverSocket.send(json);
}
lastStopClick = Date.now();
});
}); | Move reset to on stop | Move reset to on stop
| JavaScript | apache-2.0 | dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo | ---
+++
@@ -6,7 +6,7 @@
};
let cameraJoystickManager = nipplejs.create(cameraJoystick);
const clickTimeout = 500;
-var lastStartClick = Date.now();
+var lastStopClick = Date.now();
cameraJoystickManager.on('added',
function (evt, nipple) {
nipple.on('move',
@@ -21,23 +21,23 @@
});
nipple.on('start',
function () {
- if (Date.now() - lastStartClick < clickTimeout) {
+ const json = JSON.stringify(
+ { joystickType: 'camera', MessageType: 'start' });
+ serverSocket.send(json);
+ });
+ nipple.on('end',
+ function () {
+ if (Date.now() - lastStopClick < clickTimeout) {
const json = JSON.stringify(
{ joystickType: 'camera', MessageType: 'reset' });
serverSocket.send(json);
} else {
- const json = JSON.stringify(
- { joystickType: 'camera', MessageType: 'start' });
+ var json = JSON.stringify({
+ joystickType: 'camera',
+ MessageType: 'stop'
+ });
serverSocket.send(json);
}
- lastStartClick = Date.now();
- });
- nipple.on('end',
- function () {
- var json = JSON.stringify({
- joystickType: 'camera',
- MessageType: 'stop'
- });
- serverSocket.send(json);
+ lastStopClick = Date.now();
});
}); |
72c21eee8ad0dfc11b10a70fc2da23ded965b4ec | speclib/jasmineHelpers.js | speclib/jasmineHelpers.js | beforeEach(function () {
this.addMatchers({
// Expects that property is synchronous
toHold: function () {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
var r = jsc.check(actual, { quiet: true });
var counterExampleText = r === true ? "" : "Counter example found: " + JSON.stringify(r.counterexample);
this.message = function() {
return "Expected property to " + notText + " to not hold." + counterExampleText;
};
return r === true;
},
});
}); | beforeEach(function () {
this.addMatchers({
// Expects that property is synchronous
toHold: function () {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
/* global window */
var quiet = window && !(/verbose=true/).test(window.location.search);
var r = jsc.check(actual, { quiet: quiet });
var counterExampleText = r === true ? "" : "Counter example found: " + JSON.stringify(r.counterexample);
this.message = function() {
return "Expected property to " + notText + " to not hold." + counterExampleText;
};
return r === true;
},
});
}); | Add verbose=true flag to toHold matcher | Add verbose=true flag to toHold matcher
| JavaScript | mit | vilppuvuorinen/jsverify,StoneCypher/jsverify,jsverify/jsverify,jsverify/jsverify,dmitriid/jsverify,izaakschroeder/jsverify,StoneCypher/jsverify | ---
+++
@@ -4,8 +4,10 @@
toHold: function () {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
+ /* global window */
+ var quiet = window && !(/verbose=true/).test(window.location.search);
- var r = jsc.check(actual, { quiet: true });
+ var r = jsc.check(actual, { quiet: quiet });
var counterExampleText = r === true ? "" : "Counter example found: " + JSON.stringify(r.counterexample);
|
6625342ffa4c5746a19eef757e539f32290f2925 | lib/irc.js | lib/irc.js | /* eslint no-console: 0 */
'use strict';
const irc = require('irc');
const server = process.env.IRC_SERVER;
const user = process.env.IRC_USER;
const channel = process.env.IRC_CHANNEL;
const client = module.exports.client = new irc.Client(server, user, {
debug: true,
autoConnect: false,
autoRejoin: true,
channels: [channel],
showErrors: true,
});
client.connect(5, function() {
console.log(arguments);
});
if (process.env.NODE_ENV !== 'testing') {
client.on('registered', function clientOnRegisterd(message) {
console.log(new Date(), '[IRC]', message.args[1]);
});
}
client.on('error', function clientOnError(error) {
console.error(error);
console.error('Shutting Down...');
process.exit(1);
});
module.exports.notify = function ircPost(nodes, callback) {
nodes.forEach(function nodesForEach(node) {
// let name = `[${node.name}](${jenkins}/computer/${node.name})`;
if (node.offline) {
client.say(channel, `Jenkins slave ${node.name} is offline`);
} else {
client.say(channel, `Jenkins slave ${node.name} is online`);
}
});
callback(null);
};
| /* eslint no-console: 0 */
'use strict';
const irc = require('irc');
const server = process.env.IRC_SERVER;
const user = process.env.IRC_USER;
const channel = process.env.IRC_CHANNEL;
const client = module.exports.client = new irc.Client(server, user, {
autoConnect: false,
autoRejoin: true,
channels: [channel],
showErrors: true,
});
client.connect(5, function() {
console.log(new Date(), '[IRC]', 'Connected!');
});
if (process.env.NODE_ENV !== 'testing') {
client.on('registered', function clientOnRegisterd(message) {
console.log(new Date(), '[IRC]', message.args[1]);
});
}
client.on('error', function clientOnError(error) {
console.error(error);
console.error('Shutting Down...');
process.exit(1);
});
module.exports.notify = function ircPost(nodes, callback) {
nodes.forEach(function nodesForEach(node) {
// let name = `[${node.name}](${jenkins}/computer/${node.name})`;
if (node.offline) {
client.say(channel, `Jenkins slave ${node.name} is offline`);
} else {
client.say(channel, `Jenkins slave ${node.name} is online`);
}
});
callback(null);
};
| Make IRC handler a bit less verbose | Make IRC handler a bit less verbose
| JavaScript | mit | Starefossen/jenkins-monitor | ---
+++
@@ -8,7 +8,6 @@
const channel = process.env.IRC_CHANNEL;
const client = module.exports.client = new irc.Client(server, user, {
- debug: true,
autoConnect: false,
autoRejoin: true,
channels: [channel],
@@ -16,7 +15,7 @@
});
client.connect(5, function() {
- console.log(arguments);
+ console.log(new Date(), '[IRC]', 'Connected!');
});
if (process.env.NODE_ENV !== 'testing') { |
b8fb8cb98d070481c4ec88230c3f21325129ffde | library.js | library.js | (function(Reddit) {
"use strict";
var anchor = '<a href="http://reddit.com$1" target="_blank">$1</a>';
Reddit.parse = function(postContent, callback) {
var regex = /(\/r\/\w+)/g;
if (postContent.match(regex)) {
postContent = postContent.replace(regex, anchor);
}
callback(null, postContent);
};
}(module.exports));
| (function(Reddit) {
"use strict";
var anchor = '<a href="http://reddit.com$1" target="_blank">$1</a>';
Reddit.parse = function(postContent, callback) {
var regex = /(?:^|\s)(\/r\/\w+)/g;
if (postContent.match(regex)) {
postContent = postContent.replace(regex, anchor);
}
callback(null, postContent);
};
}(module.exports));
| Update regex Only match if /r/* is the beginning of the string or if it is prefixed by a whitespace | Update regex
Only match if /r/* is the beginning of the string or if it is prefixed by a whitespace
| JavaScript | bsd-2-clause | Schamper/nodebb-plugin-reddit | ---
+++
@@ -3,7 +3,7 @@
var anchor = '<a href="http://reddit.com$1" target="_blank">$1</a>';
Reddit.parse = function(postContent, callback) {
- var regex = /(\/r\/\w+)/g;
+ var regex = /(?:^|\s)(\/r\/\w+)/g;
if (postContent.match(regex)) {
postContent = postContent.replace(regex, anchor); |
1252f56a802deb2528cfabb2b7cdcedc4d17a1fe | models/vote.js | models/vote.js | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var VoteSchema = new Schema(
{
value : Number,
created : {type : Date, default : Date.now},
lastEdited : {type : Date, default : Date.now},
project : {type: mongoose.Schema.Types.ObjectId, ref: 'Project'},
author : {type: mongoose.Schema.Types.ObjectId, ref: 'User'}
});
module.exports = mongoose.model('Vote', VoteSchema);
| var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var VoteSchema = new Schema(
{
value : Number,
created : {type : Date, default : Date.now},
lastEdited : {type : Date, default : Date.now},
project : {type: mongoose.Schema.Types.ObjectId, ref: 'Project'},
author : {type: mongoose.Schema.Types.ObjectId, ref: 'User'}
});
module.exports = mongoose.model('Vote', VoteSchema);
module.exports.Value = {};
module.exports.Value.Negative = -1;
module.exports.Value.Neutral = 0;
module.exports.Value.Positive = 1;
| Add value constants to Vote model | Add value constants to Vote model
| JavaScript | mit | asso-labeli/labeli-api,asso-labeli/labeli-api,asso-labeli/labeli-api | ---
+++
@@ -11,3 +11,8 @@
});
module.exports = mongoose.model('Vote', VoteSchema);
+
+module.exports.Value = {};
+module.exports.Value.Negative = -1;
+module.exports.Value.Neutral = 0;
+module.exports.Value.Positive = 1; |
1b17a79157db5681fb31fd8d911ee2d47a645b9d | wdio.conf.js | wdio.conf.js | exports.config = {
specs: [
"./e2e-tests/**/*.tests.js"
],
exclude: [],
maxInstances: 10,
sync: true,
logLevel: "result",
coloredLogs: true,
screenshotPath: "./error-screenshots",
baseUrl: "http://the8-dev.azurewebsites.net",
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: "jasmine",
jasmineNodeOpts: {
defaultTimeoutInterval: 10000
},
reporters: ["spec", "json"],
reporterOptions: {
outputDir: "./e2e-tests/test-results"
},
services: ["selenium-standalone"],
capabilities: [
{
maxInstances: 5,
browserName: "chrome"
}
]
}
| exports.config = {
specs: [
"./e2e-tests/**/*.tests.js"
],
exclude: [],
maxInstances: 10,
sync: true,
logLevel: "result",
coloredLogs: true,
screenshotPath: "./error-screenshots",
baseUrl: "http://the8-dev.azurewebsites.net",
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: "jasmine",
jasmineNodeOpts: {
defaultTimeoutInterval: 10000
},
reporters: ["spec", "json"],
reporterOptions: {
outputDir: "./e2e-tests/test-results"
},
services: ["phantomjs"],
capabilities: [
{
maxInstances: 5,
browserName: "chrome"
}
]
}
| Use PhantomJS for e2e tests | Use PhantomJS for e2e tests | JavaScript | mit | joekrie/the8,joekrie/the8,joekrie/the8 | ---
+++
@@ -20,7 +20,7 @@
reporterOptions: {
outputDir: "./e2e-tests/test-results"
},
- services: ["selenium-standalone"],
+ services: ["phantomjs"],
capabilities: [
{
maxInstances: 5, |
de57ef6dcbf79559c50bb6b9298578def2c98529 | src/app/lib/api_limits.js | src/app/lib/api_limits.js | const Promise = require('bluebird');
const PERIOD_TIME = 30000;
const REQUESTS_PER_PERIOD = 10;
function currentTime() {
return Date.now();
}
class APILimiter {
constructor() {
this.lastPeriod = 0;
this.requests = 0;
}
makeRequest() {
if(this._isPeriodTimedOut()) {
this._beginPeriod();
}
this.requests = this.requests + 1;
if(this.requests >= REQUESTS_PER_PERIOD) {
LOG.warn("Max requests reached! Requests are getting delayed.");
}
}
awaitFreeLimit() {
if(this.canMakeRequest()) {
return Promise.resolve();
} else {
return Promise.delay(PERIOD_TIME - (currentTime() - this.lastPeriod));
}
}
canMakeRequest() {
return this._isPeriodTimedOut() || this.requests < REQUESTS_PER_PERIOD;
}
_beginPeriod() {
this.lastPeriod = currentTime();
this.requests = 0;
}
_isPeriodTimedOut() {
return currentTime() - this.lastPeriod > PERIOD_TIME;
}
}
module.exports = APILimiter; | const Promise = require('bluebird');
const PERIOD_TIME = 30000;
const REQUESTS_PER_PERIOD = 10;
function currentTime() {
return Date.now();
}
class APILimiter {
constructor() {
this.lastPeriod = 0;
this.requests = 0;
}
makeRequest() {
if(this._isPeriodTimedOut()) {
this._beginPeriod();
}
this.requests = this.requests + 1;
if(this.requests >= REQUESTS_PER_PERIOD) {
LOG.warn("Max requests reached! Requests are getting delayed.");
}
}
awaitFreeLimit() {
if(this.canMakeRequest()) {
return Promise.resolve();
} else {
return Promise.delay(PERIOD_TIME - (currentTime() - this.lastPeriod)).then(() => {
return this.awaitFreeLimit();
});
}
}
canMakeRequest() {
return this._isPeriodTimedOut() || this.requests < REQUESTS_PER_PERIOD;
}
_beginPeriod() {
this.lastPeriod = currentTime();
this.requests = 0;
}
_isPeriodTimedOut() {
return currentTime() - this.lastPeriod > PERIOD_TIME;
}
}
module.exports = APILimiter; | Make sure to wait for a free limit even after delay | Make sure to wait for a free limit even after delay
We have to (possibly) wait again after initially delaying the request
when reaching the API Limit.
Reason being that more requests get piled up than the next limit is
allowing to get through. By waiting for the limit again we ensure that
if more requests than the limit would allow got queued up, don't allow
all of them to go through.
This is subtle but is still important to not run into limits as we're
trying to avoid those.
| JavaScript | mit | kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop | ---
+++
@@ -29,7 +29,9 @@
if(this.canMakeRequest()) {
return Promise.resolve();
} else {
- return Promise.delay(PERIOD_TIME - (currentTime() - this.lastPeriod));
+ return Promise.delay(PERIOD_TIME - (currentTime() - this.lastPeriod)).then(() => {
+ return this.awaitFreeLimit();
+ });
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.