commit
stringlengths
40
40
old_file
stringlengths
4
264
new_file
stringlengths
4
264
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
624
message
stringlengths
15
4.7k
lang
stringclasses
3 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
bc19de3950abae46adf992dfa77ee890e8ed6aa9
src/DELETE/sanitizeArguments/index.js
src/DELETE/sanitizeArguments/index.js
const is = require('is'); const url = require('url'); /** * Returns an object containing the required properties to make an * http request. * @module DELETE/sanitizeArguments * @param {array} a - Arguments * @return {object} args - "Sanitized" arguments */ module.exports = function sanitizeArguments(a = []) { const args = {}; // The first argument can either be an url string or an options object if (is.string(a[0])) args.url = a[0]; else if (is.object(a[0])) args.options = a[0]; // Lets always use an request options object if (!args.options) args.options = {}; if (args.url) { const urlObj = url.parse(args.url); args.options.hostname = urlObj.hostname; args.options.port = urlObj.port; args.options.path = urlObj.path; args.options.method = 'DELETE'; if (args.url.indexOf('https') !== -1) args.options.protocol = 'https:'; else args.options.protocol = 'http:'; } // Is there a callback? if (is.function(a[1])) args.cb = a[1]; return args; };
const is = require('is'); const url = require('url'); /** * Returns an object containing the required properties to make an * http request. * @module DELETE/sanitizeArguments * @param {array} a - Arguments * @return {object} args - "Sanitized" arguments */ module.exports = function sanitizeArguments(a = []) { const args = {}; // The first argument can either be an url string or an options object if (is.string(a[0])) args.url = a[0]; else if (is.object(a[0])) args.options = a[0]; // Lets always use an request options object if (!args.options) args.options = {}; // Fill request object with data from url (if set) if (args.url) { const urlObj = url.parse(args.url); args.options.hostname = urlObj.hostname; args.options.port = urlObj.port; args.options.path = urlObj.path; args.options.method = 'DELETE'; if (args.url.indexOf('https') !== -1) args.options.protocol = 'https:'; else args.options.protocol = 'http:'; } // Is there a callback? if (is.function(a[1])) args.cb = a[1]; return args; };
DELETE correct options object + protocol handling
DELETE correct options object + protocol handling
JavaScript
mit
opensoars/ezreq
93fa682de8cd2ed950432c64c32c352579cfa7cd
views/board.js
views/board.js
import React from 'react'; import Invocation from './invocation'; import StatusLine from './status_line'; export default React.createClass({ getInitialState() { return {vcsData: { isRepository: true, branch: 'name', status: 'clean' }}; }, componentWillMount() { this.props.terminal .on('invocation', this.forceUpdate.bind(this)) .on('vcs-data', (data) => { this.setState({vcsData: data}) }); }, handleKeyDown(event) { // Ctrl+l if (event.ctrlKey && event.keyCode === 76) { this.props.terminal.clearInvocations(); event.stopPropagation(); event.preventDefault(); } }, render() { var invocations = this.props.terminal.invocations.map((invocation) => { return ( <Invocation key={invocation.id} invocation={invocation}/> ) }); return ( <div id="board" onKeyDown={this.handleKeyDown}> <div id="invocations"> {invocations} </div> <StatusLine currentWorkingDirectory={this.props.terminal.currentDirectory} vcsData={this.state.vcsData}/> </div> ); } });
import React from 'react'; import Invocation from './invocation'; import StatusLine from './status_line'; export default React.createClass({ getInitialState() { return {vcsData: { isRepository: true, branch: 'name', status: 'clean' }}; }, componentWillMount() { this.props.terminal .on('invocation', this.forceUpdate.bind(this)) .on('vcs-data', (data) => { this.setState({vcsData: data}) }); }, handleKeyDown(event) { // Ctrl+L. if (event.ctrlKey && event.keyCode === 76) { this.props.terminal.clearInvocations(); event.stopPropagation(); event.preventDefault(); } // Cmd+D. if (event.metaKey && event.keyCode === 68) { window.DEBUG = !window.DEBUG; event.stopPropagation(); event.preventDefault(); this.forceUpdate(); console.log(`Debugging mode has been ${window.DEBUG ? 'enabled' : 'disabled'}.`); } }, render() { var invocations = this.props.terminal.invocations.map((invocation) => { return ( <Invocation key={invocation.id} invocation={invocation}/> ) }); return ( <div id="board" onKeyDown={this.handleKeyDown}> <div id="invocations"> {invocations} </div> <StatusLine currentWorkingDirectory={this.props.terminal.currentDirectory} vcsData={this.state.vcsData}/> </div> ); } });
Add a shortcut to toggle debug mode.
Add a shortcut to toggle debug mode.
JavaScript
mit
Young55555/black-screen,rocky-jaiswal/black-screen,over300laughs/black-screen,rocky-jaiswal/black-screen,smaty1/black-screen,drew-gross/black-screen,noikiy/black-screen,toxic88/black-screen,AnalogRez/black-screen,RyanTech/black-screen,alessandrostone/black-screen,mzgnr/black-screen,jbhannah/black-screen,jassyboy/black-screen,jbhannah/black-screen,N00D13/black-screen,shockone/black-screen,Thundabrow/black-screen,Ribeiro/black-screen,gastrodia/black-screen,rob3ns/black-screen,smaty1/black-screen,gastrodia/black-screen,RyanTech/black-screen,gabrielbellamy/black-screen,jonadev95/black-screen,AnalogRez/black-screen,Cavitt/black-screen,habibmasuro/black-screen,bestwpw/black-screen,Thundabrow/black-screen,JimLiu/black-screen,AnalogRez/black-screen,skomski/black-screen,kustomzone/black-screen,littlecodeshop/black-screen,rakesh-mohanta/black-screen,Thundabrow/black-screen,habibmasuro/black-screen,toxic88/black-screen,Cavitt/black-screen,bodiam/black-screen,jacobmarshall/black-screen,w9jds/black-screen,rob3ns/black-screen,genecyber/black-screen,railsware/upterm,alice-gh/black-screen-1,bodiam/black-screen,noikiy/black-screen,taraszerebecki/black-screen,kingland/black-screen,vshatskyi/black-screen,genecyber/black-screen,over300laughs/black-screen,Serg09/black-screen,w9jds/black-screen,stefohnee/black-screen,bodiam/black-screen,Dangku/black-screen,over300laughs/black-screen,kaze13/black-screen,Serg09/black-screen,littlecodeshop/black-screen,jassyboy/black-screen,bestwpw/black-screen,jqk6/black-screen,Suninus/black-screen,adamliesko/black-screen,kingland/black-screen,smaty1/black-screen,alessandrostone/black-screen,vshatskyi/black-screen,gabrielbellamy/black-screen,vshatskyi/black-screen,Dangku/black-screen,stefohnee/black-screen,geksilla/black-screen,ammaroff/black-screen,black-screen/black-screen,kingland/black-screen,geksilla/black-screen,geksilla/black-screen,jacobmarshall/black-screen,Serg09/black-screen,Dangku/black-screen,jonadev95/black-screen,kustomzone/black-screen,kustomzone/black-screen,adamliesko/black-screen,toxic88/black-screen,j-allard/black-screen,Young55555/black-screen,noikiy/black-screen,kaze13/black-screen,williara/black-screen,alessandrostone/black-screen,jonadev95/black-screen,ammaroff/black-screen,skomski/black-screen,jqk6/black-screen,stefohnee/black-screen,drew-gross/black-screen,N00D13/black-screen,drew-gross/black-screen,williara/black-screen,rakesh-mohanta/black-screen,drew-gross/black-screen,genecyber/black-screen,gastrodia/black-screen,cyrixhero/black-screen,railsware/upterm,alice-gh/black-screen-1,Young55555/black-screen,jqk6/black-screen,jacobmarshall/black-screen,bestwpw/black-screen,rocky-jaiswal/black-screen,shockone/black-screen,ammaroff/black-screen,w9jds/black-screen,williara/black-screen,rob3ns/black-screen,mzgnr/black-screen,habibmasuro/black-screen,Cavitt/black-screen,Suninus/black-screen,jbhannah/black-screen,JimLiu/black-screen,cyrixhero/black-screen,cyrixhero/black-screen,rakesh-mohanta/black-screen,taraszerebecki/black-screen,Suninus/black-screen,black-screen/black-screen,RyanTech/black-screen,jassyboy/black-screen,Ribeiro/black-screen,black-screen/black-screen,JimLiu/black-screen,vshatskyi/black-screen,N00D13/black-screen,gabrielbellamy/black-screen,taraszerebecki/black-screen,adamliesko/black-screen,littlecodeshop/black-screen,alice-gh/black-screen-1,skomski/black-screen,kaze13/black-screen,Ribeiro/black-screen,j-allard/black-screen,j-allard/black-screen,mzgnr/black-screen
74eed05c7175e7fe96d54286f7feaaf68fcc3085
addon/services/ember-ambitious-forms.js
addon/services/ember-ambitious-forms.js
import Ember from 'ember' import AFField, { DEFAULT_CONFIG as FIELD_DEFAULT_CONFIG } from '../components/af-field' import i18n from '../mixins/i18n' import loc from '../mixins/loc' import restless from '../mixins/restless' import validations from '../mixins/validations' const AF_FIELD_MIXINS = { i18n, loc, restless, validations } export default Ember.Service.extend({ config: Object.assign({}, FIELD_DEFAULT_CONFIG, { prompt: 'Select', fieldPlugins: [] }), configure (arg) { if (typeof arg === 'function') { arg(this.config) } else { Ember.$.extend(true, this.config, arg) } // TODO: localize plugin logic instead of tossing them onto the base class this.config.fieldPlugins.forEach((plugin) => { if (plugin instanceof Ember.Mixin) { AFField.reopen(plugin) } else if (AF_FIELD_MIXINS[plugin]) { AFField.reopen(AF_FIELD_MIXINS[plugin]) } else { Ember.warn(`Not a valid plugin: ${plugin}`) } }) return this } })
import Ember from 'ember' import { DEFAULT_CONFIG as FIELD_DEFAULT_CONFIG } from '../components/af-field' import i18n from '../mixins/i18n' import loc from '../mixins/loc' import restless from '../mixins/restless' import validations from '../mixins/validations' const AF_FIELD_MIXINS = { i18n, loc, restless, validations } export default Ember.Service.extend({ config: Object.assign({}, FIELD_DEFAULT_CONFIG, { prompt: 'Select', fieldPlugins: [] }), configure (arg) { if (typeof arg === 'function') { arg(this.config) } else { Ember.$.extend(true, this.config, arg) } let afFieldClass = Ember.getOwner(this).resolveRegistration('component:af-field') this.config.fieldPlugins.forEach((plugin) => { if (plugin instanceof Ember.Mixin) { afFieldClass.reopen(plugin) } else if (AF_FIELD_MIXINS[plugin]) { afFieldClass.reopen(AF_FIELD_MIXINS[plugin]) } else { Ember.warn(`Not a valid plugin: ${plugin}`) } }) return this } })
Load addons into resolver AFField instead of global AFField
Load addons into resolver AFField instead of global AFField
JavaScript
mit
dough-com/ember-ambitious-forms,dough-com/ember-ambitious-forms
11c687b1d5bb1eb5a09c7efb6086ee6d3f536d0e
tests/test-files/preserve-simple-binary-expressions/input.js
tests/test-files/preserve-simple-binary-expressions/input.js
a * b; 10*5; 10 * 5; 10e5*5; 10 * (5 + 10); 10*(5 + 10);
a * b; a*b; 10*5; 10 * 5; 10e5*5; 10 * (5 + 10); 10*(5 + 10);
Add test for two variables being multiplied who lack a space in between.
Add test for two variables being multiplied who lack a space in between.
JavaScript
mit
Mark-Simulacrum/attractifier,Mark-Simulacrum/pretty-generator
29de57f99e6946e6db7257d650b860eaf2f58a7d
app/assets/javascripts/carnival/advanced_search.js
app/assets/javascripts/carnival/advanced_search.js
$(document).ready(function(){ $("#advanced_search_toggler").click(function(e){ $('body').append('<div class="as-form-overlay">') $("#advanced_search_toggler").toggleClass('is-opened') $("#advanced_search_form").toggle(); $(".as-form-overlay").click(function(e){ $(".as-form-overlay").remove(); $("#advanced_search_form").hide(); $(".select2-drop").hide(); return false; }); return false; }); $("#search_button").click(function(e){ e.preventDefault(); var queryParams = []; Carnival.submitIndexForm(); }); $("#clear_button").click(function(e){ e.preventDefault(); $($(this).parent().parent().parent()).trigger("reset") $("#advanced_search_form input").each(function(){ var inputValue = $(this).val(); $(this).val(''); }); $("#advanced_search_form select").each(function(){ var inputValue = $(this).val(); $(this).val(''); }); Carnival.submitIndexForm(); }); });
$(document).ready(function(){ $("#advanced_search_toggler").click(function(e){ $('body').append('<div class="as-form-overlay">') $("#advanced_search_toggler").toggleClass('is-opened') $("#advanced_search_form").toggle(); $('#advanced_search_form').find('input').focus(); $(".as-form-overlay").click(function(e){ $(".as-form-overlay").remove(); $("#advanced_search_form").hide(); $(".select2-drop").hide(); return false; }); return false; }); $("#search_button").click(function(e){ e.preventDefault(); var queryParams = []; Carnival.submitIndexForm(); }); $("#clear_button").click(function(e){ e.preventDefault(); $($(this).parent().parent().parent()).trigger("reset") $("#advanced_search_form input").each(function(){ var inputValue = $(this).val(); $(this).val(''); }); $("#advanced_search_form select").each(function(){ var inputValue = $(this).val(); $(this).val(''); }); Carnival.submitIndexForm(); }); });
Set focus on the first advanced search field
Set focus on the first advanced search field
JavaScript
mit
cartolari/carnival,dsakuma/carnival,dsakuma/carnival,Vizir/carnival,dsakuma/carnival,cartolari/carnival,dsakuma/carnival,Vizir/carnival,cartolari/carnival,Vizir/carnival,cartolari/carnival,Vizir/carnival,cartolari/carnival,Vizir/carnival,dsakuma/carnival
bebd287f6a3552fcd0eabfa28afd522da32a6478
etc/protractorConfSauce.js
etc/protractorConfSauce.js
var pr = process.env.TRAVIS_PULL_REQUEST; var souceUser = process.env.SAUCE_USERNAME || "liqd"; var sauceKey = process.env.SAUCE_ACCESS_KEY; var name = ((pr === "false") ? "" : "#" + pr + " ") + process.env.TRAVIS_COMMIT; var common = require("./protractorCommon.js"); var local = { sauceUser: souceUser, sauceKey: sauceKey, capabilities: { "browserName": "chrome", "tunnel-identifier": process.env.TRAVIS_JOB_NUMBER, "build": process.env.TRAVIS_BUILD_NUMBER, "name": name }, allScriptsTimeout: 21000, getPageTimeout: 20000, jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 120000, isVerbose: true, includeStackTrace: true } }; exports.config = Object.assign({}, common.config, local);
var pr = process.env.TRAVIS_PULL_REQUEST; var souceUser = process.env.SAUCE_USERNAME || "liqd"; var sauceKey = process.env.SAUCE_ACCESS_KEY; var name = ((pr === "false") ? "" : "#" + pr + " ") + process.env.TRAVIS_COMMIT; var common = require("./protractorCommon.js"); var local = { sauceUser: souceUser, sauceKey: sauceKey, directConnect: false, capabilities: { "browserName": "chrome", "tunnel-identifier": process.env.TRAVIS_JOB_NUMBER, "build": process.env.TRAVIS_BUILD_NUMBER, "name": name }, allScriptsTimeout: 21000, getPageTimeout: 20000, jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 120000, isVerbose: true, includeStackTrace: true } }; exports.config = Object.assign({}, common.config, local);
Disable direct connect for sauce labs
Disable direct connect for sauce labs
JavaScript
agpl-3.0
liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator
d718fa64b1b3ab4fc0aa9c678faf15477a205dce
app/assets/javascripts/views/components/Editor/fields/virtualKeyboard.js
app/assets/javascripts/views/components/Editor/fields/virtualKeyboard.js
import React, {Component, PropTypes} from 'react'; import t from 'tcomb-form'; function renderInput(locals) { const onChange = function (event) { locals.onChange(event.target.value); }; const triggerRealInputChange = function (event) { locals.onChange(document.getElementById('virtual-keyboard-helper-' + locals.attrs.name).value); }; return <div> <input type="text" label={locals.label} name={locals.attrs.name} value={locals.value} onChange={onChange} style={{display: 'none'}} /> <input type="text" id={'virtual-keyboard-helper-' + locals.attrs.name} className="form-control" label={locals.label} onBlur={triggerRealInputChange} /> </div>; } const textboxTemplate = t.form.Form.templates.textbox.clone({ renderInput }) export default class VirtualKeyboardFactory extends t.form.Textbox { getTemplate() { return textboxTemplate } }
import React, {Component, PropTypes} from 'react'; import t from 'tcomb-form'; function renderInput(locals) { const onChange = function (event) { locals.onChange(event.target.value); }; const triggerRealInputChange = function (event) { locals.onChange(document.getElementById('virtual-keyboard-helper-' + locals.attrs.name).value); }; return <div> <input type="text" label={locals.label} name={locals.attrs.name} value={locals.value} onChange={onChange} style={{display: 'none'}} /> <input type="text" id={'virtual-keyboard-helper-' + locals.attrs.name} value={locals.value} className="form-control" label={locals.label} onBlur={triggerRealInputChange} /> </div>; } const textboxTemplate = t.form.Form.templates.textbox.clone({ renderInput }) export default class VirtualKeyboardFactory extends t.form.Textbox { getTemplate() { return textboxTemplate } }
Fix bug with moving up and down
Fix bug with moving up and down
JavaScript
apache-2.0
First-Peoples-Cultural-Council/fv-web-ui,First-Peoples-Cultural-Council/fv-web-ui,First-Peoples-Cultural-Council/fv-web-ui,First-Peoples-Cultural-Council/fv-web-ui,First-Peoples-Cultural-Council/fv-web-ui
49500617b9ffe668dd4883c9190cac4c1ca15781
indico/htdocs/js/utils/i18n.js
indico/htdocs/js/utils/i18n.js
(function(global) { "use strict"; var default_i18n = new Jed({ locale_data: TRANSLATIONS, domain: "indico" }); global.i18n = default_i18n; global.$T = _.bind(default_i18n.gettext, default_i18n); ['gettext', 'ngettext', 'pgettext', 'npgettext', 'translate'].forEach(function(method_name) { global.$T[method_name] = _.bind(default_i18n[method_name], default_i18n); }); global.$T.domain = _.memoize(function(domain) { return new Jed({ locale_data: TRANSLATIONS, domain: domain }); }); }(window));
(function(global) { "use strict"; var default_i18n = new Jed({ locale_data: global.TRANSLATIONS, domain: "indico" }); global.i18n = default_i18n; global.$T = _.bind(default_i18n.gettext, default_i18n); ['gettext', 'ngettext', 'pgettext', 'npgettext', 'translate'].forEach(function(method_name) { global.$T[method_name] = _.bind(default_i18n[method_name], default_i18n); }); global.$T.domain = _.memoize(function(domain) { return new Jed({ locale_data: global.TRANSLATIONS, domain: domain }); }); }(window));
Make it more obvious that TRANSLATIONS is global
Make it more obvious that TRANSLATIONS is global
JavaScript
mit
ThiefMaster/indico,OmeGak/indico,mvidalgarcia/indico,indico/indico,ThiefMaster/indico,DirkHoffmann/indico,pferreir/indico,DirkHoffmann/indico,mvidalgarcia/indico,ThiefMaster/indico,pferreir/indico,indico/indico,mic4ael/indico,pferreir/indico,mic4ael/indico,mic4ael/indico,DirkHoffmann/indico,OmeGak/indico,mvidalgarcia/indico,pferreir/indico,mic4ael/indico,mvidalgarcia/indico,DirkHoffmann/indico,indico/indico,OmeGak/indico,indico/indico,ThiefMaster/indico,OmeGak/indico
0939f9e32aa620132b444799f864056a097ead2d
test/e2e/main.js
test/e2e/main.js
'use strict'; describe('Sign up page', function () { var watchButton; beforeEach(function () { watchButton = element('.btn-primary'); }); it('should have Watch/Unwatch disabled by default', function() { expect(watchButton.attr('disabled')).toBeTruthy(); }); it('should enable Watch/Unwatch button', function() { input('#email').enter('banan@fluga.com'); expect(watchButton.attr('disabled')).toBeTruthy(); input('#url').enter('http://github.com'); expect(watchButton.attr('disabled')).toBeFalsy(); }); });
'use strict'; describe('Sign up page', function () { var watchButton; beforeEach(function () { watchButton = element('.btn-primary'); }); it('should have Watch enabled by default', function() { expect(watchButton.attr('disabled')).toBeFalsy(); }); it('should enable Watch/Unwatch button', function() { input('#email').enter('banan@fluga.com'); expect(watchButton.attr('disabled')).toBeTruthy(); input('#url').enter('http://github.com'); expect(watchButton.attr('disabled')).toBeFalsy(); }); });
Update default behavior of Watch button
Update default behavior of Watch button
JavaScript
mit
seriema/npmalerts-web,seriema/npmalerts-web
59745c5117613e7822056fe75ceb502ef702853d
example/user/controller.js
example/user/controller.js
var users = require('./user-dump'), Promise = require('bluebird') module.exports = { get : Get, add : Add }; function Get(request,reply) { setTimeout(function() { reply.data = users; reply.continue(); },500); } function Add(request,reply) { setTimeout(function() { users.push({name : request.payload.name,id : (users.length + 1)}); reply.continue(); },500); }
var users = require('./stub'), Promise = require('bluebird') module.exports = { get : Get, add : Add }; function Get(request,reply) { setTimeout(function() { reply.data = users; reply.continue(); },500); } function Add(request,reply) { setTimeout(function() { users.push({name : request.payload.name,id : (users.length + 1)}); reply.continue(); },500); }
Use correct file name for db stub
Use correct file name for db stub
JavaScript
mit
Pranay92/hapi-next
7a7a6905f01aa99f5ff2c75cee165cf691dde8eb
ui/src/shared/components/FancyScrollbar.js
ui/src/shared/components/FancyScrollbar.js
import React, {Component, PropTypes} from 'react' import classnames from 'classnames' import {Scrollbars} from 'react-custom-scrollbars' class FancyScrollbar extends Component { constructor(props) { super(props) } static defaultProps = { autoHide: true, autoHeight: false, } render() { const {autoHide, autoHeight, children, className, maxHeight} = this.props return ( <Scrollbars className={classnames('fancy-scroll--container', { [className]: className, })} autoHide={autoHide} autoHideTimeout={1000} autoHideDuration={250} autoHeight={autoHeight} autoHeightMax={maxHeight} renderTrackHorizontal={props => <div {...props} className="fancy-scroll--track-h" />} renderTrackVertical={props => <div {...props} className="fancy-scroll--track-v" />} renderThumbHorizontal={props => <div {...props} className="fancy-scroll--thumb-h" />} renderThumbVertical={props => <div {...props} className="fancy-scroll--thumb-v" />} renderView={props => <div {...props} className="fancy-scroll--view" />} > {children} </Scrollbars> ) } } const {bool, node, number, string} = PropTypes FancyScrollbar.propTypes = { children: node.isRequired, className: string, autoHide: bool, autoHeight: bool, maxHeight: number, } export default FancyScrollbar
import React, {Component, PropTypes} from 'react' import classnames from 'classnames' import {Scrollbars} from 'react-custom-scrollbars' class FancyScrollbar extends Component { constructor(props) { super(props) } static defaultProps = { autoHide: true, autoHeight: false, } handleMakeDiv = className => props => { return <div {...props} className={`fancy-scroll--${className}`} /> } render() { const {autoHide, autoHeight, children, className, maxHeight} = this.props return ( <Scrollbars className={classnames('fancy-scroll--container', { [className]: className, })} autoHide={autoHide} autoHideTimeout={1000} autoHideDuration={250} autoHeight={autoHeight} autoHeightMax={maxHeight} renderTrackHorizontal={this.handleMakeDiv('track-h')} renderTrackVertical={this.handleMakeDiv('track-v')} renderThumbHorizontal={this.handleMakeDiv('thumb-h')} renderThumbVertical={this.handleMakeDiv('thumb-v')} renderView={this.handleMakeDiv('view')} > {children} </Scrollbars> ) } } const {bool, node, number, string} = PropTypes FancyScrollbar.propTypes = { children: node.isRequired, className: string, autoHide: bool, autoHeight: bool, maxHeight: number, } export default FancyScrollbar
Update FancyScrollBar to use arrow properties
Update FancyScrollBar to use arrow properties
JavaScript
mit
mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,influxdata/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,li-ang/influxdb,nooproblem/influxdb,li-ang/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb,nooproblem/influxdb,influxdb/influxdb,influxdb/influxdb,influxdata/influxdb
eca69d314c990f7523742277cd104ef5371a49d2
test/dummy/app/assets/javascripts/application.js
test/dummy/app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into including all the files listed below. // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically // be included in the compiled file accessible from http://example.com/assets/application.js // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // //= require jquery //= require jquery_ujs //= require_tree .
// This is a manifest file that'll be compiled into including all the files listed below. // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically // be included in the compiled file accessible from http://example.com/assets/application.js // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // //= require_tree .
Remove jQuery from the assets
Remove jQuery from the assets
JavaScript
mit
Soluciones/kpi,Soluciones/kpi,Soluciones/kpi
1c84ae2c3ebe985ed1e5348cd4ee2cdb4aee1be3
test/mriTests.js
test/mriTests.js
"use strict" const mocha = require('mocha'); const expect = require('chai').expect; const fs = require('fs'); const mri = require('../src/mri'); describe("Detect CSharp functions", function(){ it("should detect functions", function(){ const expected = ["DiscoverTestsToExecute", "GetTestsThatCall", "GetTestsThatCall", "GetCallsInMethod", "GetTestMethodsInAssembly"]; const code = fs.readFileSync('test/testRepo/aFile.cs').toString(); const result = mri.getCSharpFunctionNamesFrom(code); expect(result).to.have.ordered.deep.members(expected); }); });
"use strict" const mocha = require('mocha'); const expect = require('chai').expect; const fs = require('fs'); const mri = require('../src/mri'); describe("Detect CSharp functions", function(){ it("should detect functions", function(){ this.timeout(5000); const expected = ["DiscoverTestsToExecute", "GetTestsThatCall", "GetTestsThatCall", "GetCallsInMethod", "GetTestMethodsInAssembly"]; const code = fs.readFileSync('test/testRepo/aFile.cs').toString(); const result = mri.getCSharpFunctionNamesFrom(code); expect(result).to.have.ordered.deep.members(expected); }); });
Add timeout to mri tests
Add timeout to mri tests
JavaScript
mit
vgaltes/CrystalGazer,vgaltes/CrystalGazer
ad3279b9d7642dbe53e951ea7d7131e637c4e589
tests/lib/rules/no-const-outside-module-scope.js
tests/lib/rules/no-const-outside-module-scope.js
'use strict'; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ var rule = require('../../../lib/rules/no-const-outside-module-scope'); var RuleTester = require('eslint').RuleTester; //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ var ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, sourceType: 'module' } }); ruleTester.run('no-const-outside-module-scope', rule, { valid: [ 'const FOOBAR = 5;', 'export const FOOBAR = 5;' ], invalid: [{ code: '{ const FOOBAR = 5; }', errors: [{ message: '`const` should only be used in module scope (not inside functions/blocks).' }] }, { code: 'function foobar() { const FOOBAR = 5; return FOOBAR; }', errors: [{ message: '`const` should only be used in module scope (not inside functions/blocks).' }] }] });
'use strict'; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ var rule = require('../../../lib/rules/no-const-outside-module-scope'); var RuleTester = require('eslint').RuleTester; //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ var ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 6, sourceType: 'module' } }); ruleTester.run('no-const-outside-module-scope', rule, { valid: [ 'const FOOBAR = 5;', 'export const FOOBAR = 5;' ], invalid: [{ code: '{ const FOOBAR = 5; }', output: '{ let FOOBAR = 5; }', errors: [{ message: '`const` should only be used in module scope (not inside functions/blocks).' }] }, { code: 'function foobar() { const FOOBAR = 5; return FOOBAR; }', output: 'function foobar() { let FOOBAR = 5; return FOOBAR; }', errors: [{ message: '`const` should only be used in module scope (not inside functions/blocks).' }] }] });
Add output returned by the fixer
Test: Add output returned by the fixer
JavaScript
mit
Turbo87/eslint-plugin-ember-internal
fa126551f8dafa5171aca253e6add5ecc7b928b5
src/docs/components/SpinningDoc.js
src/docs/components/SpinningDoc.js
// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import Spinning from 'grommet/components/icons/Spinning'; import DocsArticle from '../../components/DocsArticle'; import Code from '../../components/Code'; export default class SpinningDoc extends Component { render () { return ( <DocsArticle title='Spinning'> <section> <p>An indeterminate spinning/busy icon. This should be used sparingly. If at all possible, use Meter with % to indicate progress. For content loading situations, Meter, Chart, and Distribution already have visuals for when the data has not arrived yet. In general, there should not be more than one Spinning icon on the screen at a time.</p> <Spinning /> </section> <section> <h2>Usage</h2> <Code preamble={ `import Spinning from 'grommet/components/Spinning';`}> <Spinning /> </Code> </section> </DocsArticle> ); } };
// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import Spinning from 'grommet/components/icons/Spinning'; import DocsArticle from '../../components/DocsArticle'; import Code from '../../components/Code'; export default class SpinningDoc extends Component { render () { return ( <DocsArticle title='Spinning'> <section> <p>An indeterminate spinning/busy icon. This should be used sparingly. If at all possible, use Meter with % to indicate progress. For content loading situations, Meter, Chart, and Distribution already have visuals for when the data has not arrived yet. In general, there should not be more than one Spinning icon on the screen at a time.</p> <Spinning /> </section> <section> <h2>Usage</h2> <Code preamble={ `import Spinning from 'grommet/components/icons/Spinning';`}> <Spinning /> </Code> </section> </DocsArticle> ); } };
Fix import path of Spinning usage
Fix import path of Spinning usage
JavaScript
apache-2.0
grommet/grommet-docs,grommet/grommet-docs
b2403270ce82fdae09db5e07b07ea6f92bb955d6
core-plugins/shared/1/as/webapps/project-viewer/html/js/config/config.js
core-plugins/shared/1/as/webapps/project-viewer/html/js/config/config.js
/** * This is the default (fallback) configuration file for the web application. */ // Create empty CONFIG object as fallback if it does not exist. var CONFIG = CONFIG || {}; // Default configuration. var DEFAULT_CONFIG = {};
/** * This is the default (fallback) configuration file for the web application. */ // Default configuration. var DEFAULT_CONFIG = {};
Remove duplicate declaration of CONFIG.
Remove duplicate declaration of CONFIG.
JavaScript
apache-2.0
aarpon/obit_shared_core_technology,aarpon/obit_shared_core_technology,aarpon/obit_shared_core_technology
02f49e650e067a9dac49998bf2ddfdcf38b23eb8
Resources/lib/Como/Models.js
Resources/lib/Como/Models.js
module.exports = function (Como) { var models = {}, // include underscore utility-belt _ = require('/lib/Underscore/underscore.min'); _.each(Como.config.models, function (m) { var _m = require('/app/models/' + m.name), mName = m.name.toLowerCase(); models[mName] = new _m(Como); if (m.truncate) { models[mName].truncate(); } }); return models; };
module.exports = function (Como) { var models = {}, // include underscore utility-belt _ = require('/lib/Underscore/underscore.min'); _.each(Como.config.models, function (m) { var _m = require('/app/models/' + m.name), mName = m.name.toLowerCase(); models[mName] = new _m(Como); //if (m.truncate) { models[mName].truncate(); } }); return models; };
Truncate during app start causing error, disable it for now.
Truncate during app start causing error, disable it for now.
JavaScript
apache-2.0
geekzy/tiapp-como
ce7365ee16191777ad76d4009e2e0d21cde204fe
app/initializers/session.js
app/initializers/session.js
export default { name: 'app.session', initialize(container, application) { application.inject('controller', 'session', 'service:session'); application.inject('route', 'session', 'service:session'); } };
export default { name: 'app.session', initialize(application) { application.inject('controller', 'session', 'service:session'); application.inject('route', 'session', 'service:session'); } };
Fix a deprecation warning about `initialize` arguments
Fix a deprecation warning about `initialize` arguments This shows up in the browser console. Fixed as suggested at: http://emberjs.com/deprecations/v2.x/#toc_initializer-arity
JavaScript
apache-2.0
Susurrus/crates.io,achanda/crates.io,achanda/crates.io,steveklabnik/crates.io,achanda/crates.io,rust-lang/crates.io,steveklabnik/crates.io,Susurrus/crates.io,steveklabnik/crates.io,rust-lang/crates.io,rust-lang/crates.io,achanda/crates.io,steveklabnik/crates.io,Susurrus/crates.io,rust-lang/crates.io,Susurrus/crates.io
41abdbad1fc8af309a852770478a0a517c0a6395
DebugGlobals.js
DebugGlobals.js
/** * Globals we expose on the window object for manual debugging with the Chrome * console. * * TODO: Consider disabling this for release builds. * * @flow */ import * as actions from './actions' import store from './store' import parseExpression from './parseExpression' /** * Parse the given expression text and place the expression on the screen. */ const makeExpression = (exprString: string) => { const userExpr = parseExpression(exprString); const screenExpr = { expr: userExpr, x: 100, y: 100, }; store.dispatch(actions.addExpression(screenExpr)); }; window.DebugGlobals = { store, actions, makeExpression, };
/** * Globals we expose on the window object for manual debugging with the Chrome * console. * * @flow */ import {NativeModules} from 'react-native' import * as actions from './actions' import store from './store' import parseExpression from './parseExpression' /** * Parse the given expression text and place the expression on the screen. */ const makeExpression = (exprString: string) => { const userExpr = parseExpression(exprString); const screenExpr = { expr: userExpr, x: 100, y: 100, }; store.dispatch(actions.addExpression(screenExpr)); refreshNative(); }; // Only run when we're running in Chrome. We detect this by checking if we're in // the debuggerWorker.js web worker, which defines a messageHandlers global. if (__DEV__ && window.messageHandlers !== undefined) { window.DebugGlobals = { store, actions, makeExpression, }; // Set a callback to be run regularly. This ensures that pending calls to // native code are flushed in a relatively timely manner, so we can run // things like redux actions from the Chrome console and have them take // effect immediately. setInterval(() => {}, 100); console.log( 'Created debug globals. Access them on the DebugGlobals object.'); }
Update debug globals code to allow modifications from the Chrome console
Update debug globals code to allow modifications from the Chrome console Previously, refreshes wouldn't happen until the next call from native code. Now, we run a setInterval that runs all the time to force any Chrome-triggered events to get flushed.
JavaScript
mit
alangpierce/LambdaCalculusPlayground,alangpierce/LambdaCalculusPlayground,alangpierce/LambdaCalculusPlayground
0e91b9b2a063a22bf1033777452c8c87cb399829
src/app/index.route.js
src/app/index.route.js
function routerConfig ($stateProvider, $urlRouterProvider) { 'ngInject'; $stateProvider // Holding page .state('holding-page', { url: '/', views: { 'content': { templateUrl: 'app/holding-page/holding-page.html' } } }) // Home page .state('home', { url: '/home', views: { 'content': { templateUrl: 'app/home/home.html', controller: 'HomeController', controllerAs: 'home' } } }) // Projects .state('ambr', { url: '/ambr', views: { 'content': { templateUrl: 'app/projects/ambr/ambr.html' } } }) .state('layla-moran', { url: '/layla-moran', views: { 'content': { templateUrl: 'app/projects/layla/layla.html' } } }); $urlRouterProvider.otherwise('/'); } export default routerConfig;
function routerConfig ($stateProvider, $urlRouterProvider) { 'ngInject'; $stateProvider // Holding page .state('holding-page', { url: '/', views: { 'content': { templateUrl: 'app/holding-page/holding-page.html' } } }) // Home page .state('home', { url: '/home', views: { 'content': { templateUrl: 'app/home/home.html', controller: 'HomeController', controllerAs: 'home' } } }) // Projects .state('eufn', { url: '/eufn', views: { 'content': { templateUrl: 'app/projects/eufn/eufn.html' } } }) .state('lancastrians', { url: '/lancastrians', views: { 'content': { templateUrl: 'app/projects/lancastrians/lancastrians.html' } } }) .state('layla-moran', { url: '/layla-moran', views: { 'content': { templateUrl: 'app/projects/layla/layla.html' } } }) .state('ambr', { url: '/ambr', views: { 'content': { templateUrl: 'app/projects/ambr/ambr.html' } } }); $urlRouterProvider.otherwise('/'); } export default routerConfig;
Add routing for EUFN and Lancastrians projects
Add routing for EUFN and Lancastrians projects
JavaScript
mit
RobEasthope/lazarus,RobEasthope/lazarus
657ea31a8373be43b33d80cfe58915e294ec21ea
index.js
index.js
var persist = require('./lib/persist'); module.exports = persist;
var persist = require('./lib/persist'); /** * @param String db MongoDB connection string * @param Array data * @return promise * This module makes use of the node-promise API. * Operate on the singular result argument passed to a `then` callback, as follows: * * persist(db, data).then(function (result) { * // Operate on the mongodb documents * }, function (error) { * // Handle errors * }) */ module.exports = persist;
Add a more useful comment
Add a more useful comment
JavaScript
mit
imgges/persist
0e3db15aa1c142c5028a0da35f0da42a237aa306
index.js
index.js
'use strict'; module.exports = function(prompts) { // This method will only show prompts that haven't been supplied as options. This makes the generator more composable. const filteredPrompts = []; const props = new Map(); prompts.forEach(function prompts(prompt) { this.option(prompt.name); const option = this.options[prompt.name]; if (option === undefined) { // No option supplied, user will be prompted filteredPrompts.push(prompt); } else { // Options supplied, add to props props[prompt.name] = option; } }, this); if (filteredPrompts.length) { return this.prompt(filteredPrompts).then(function mergeProps(mergeProps) { // Merge mergeProps into props/ Object.assign(props, mergeProps); return props; }); } // No prompting required call the callback right away. return Promise.resolve(props); };
'use strict'; module.exports = function(prompts) { // This method will only show prompts that haven't been supplied as options. This makes the generator more composable. const filteredPrompts = []; const props = new Map(); prompts.forEach(function prompts(prompt) { const option = this.options[prompt.name]; if (option === undefined) { // No option supplied, user will be prompted filteredPrompts.push(prompt); } else { // Options supplied, add to props props[prompt.name] = option; } }, this); if (filteredPrompts.length) { return this.prompt(filteredPrompts).then(function mergeProps(mergeProps) { // Merge mergeProps into props/ Object.assign(props, mergeProps); return props; }); } // No prompting required call the callback right away. return Promise.resolve(props); };
Fix to allow non boolean options
Fix to allow non boolean options
JavaScript
mit
artefact-group/yeoman-option-or-prompt
c631ca483da85d04ef13afcf9e9c0f78a74cfc61
index.js
index.js
exports.register = function(plugin, options, next) { // Wait 10 seconds for existing connections to close then exit. var stop = function() { plugin.servers[0].stop({ timeout: 10 * 1000 }, function() { process.exit(); }); }; process.on('SIGTERM', stop); process.on('SIGINT', stop); next(); }; exports.register.attributes = { pkg: require('./package.json') };
exports.register = function(server, options, next) { // Wait 10 seconds for existing connections to close then exit. var stop = function() { server.connections[0].stop({ timeout: 10 * 1000 }, function() { process.exit(); }); }; process.on('SIGTERM', stop); process.on('SIGINT', stop); next(); }; exports.register.attributes = { pkg: require('./package.json') };
Upgrade for compatability with Hapi 8
Upgrade for compatability with Hapi 8
JavaScript
mit
KyleAMathews/hapi-death
8044a284695bb16567d50c4bb58a965f7d181bfe
index.js
index.js
var path = require('path'); module.exports = function (source) { if (this.cacheable) { this.cacheable(); } var filename = path.basename(this.resourcePath), matches = 0, processedSource; processedSource = source.replace(/React\.createClass\s*\(\s*\{/g, function (match) { matches++; return '__hotUpdateAPI.createClass({'; }); if (!matches) { return source; } return [ 'var __hotUpdateAPI = (function () {', ' var React = require("react");', ' var getHotUpdateAPI = require(' + JSON.stringify(require.resolve('./getHotUpdateAPI')) + ');', ' return getHotUpdateAPI(React, ' + JSON.stringify(filename) + ', module.id);', '})();', processedSource, 'if (module.hot) {', ' module.hot.accept(function (err) {', ' if (err) {', ' console.error("Cannot not apply hot update to " + ' + JSON.stringify(filename) + ' + ": " + err.message);', ' }', ' });', ' module.hot.dispose(function () {', ' var nextTick = require(' + JSON.stringify(require.resolve('next-tick')) + ');', ' nextTick(__hotUpdateAPI.updateMountedInstances);', ' });', '}' ].join('\n'); };
var path = require('path'); module.exports = function (source) { if (this.cacheable) { this.cacheable(); } var filename = path.basename(this.resourcePath), matches = 0, processedSource; processedSource = source.replace(/[Rr]eact\.createClass\s*\(/g, function (match) { matches++; return '__hotUpdateAPI.createClass('; }); if (!matches) { return source; } return [ 'var __hotUpdateAPI = (function () {', ' var React = require("react");', ' var getHotUpdateAPI = require(' + JSON.stringify(require.resolve('./getHotUpdateAPI')) + ');', ' return getHotUpdateAPI(React, ' + JSON.stringify(filename) + ', module.id);', '})();', processedSource, 'if (module.hot) {', ' module.hot.accept(function (err) {', ' if (err) {', ' console.error("Cannot not apply hot update to " + ' + JSON.stringify(filename) + ' + ": " + err.message);', ' }', ' });', ' module.hot.dispose(function () {', ' var nextTick = require(' + JSON.stringify(require.resolve('next-tick')) + ');', ' nextTick(__hotUpdateAPI.updateMountedInstances);', ' });', '}' ].join('\n'); };
Allow lowercase React import and using an object reference
Allow lowercase React import and using an object reference
JavaScript
mit
gaearon/react-hot-loader,gaearon/react-hot-loader
f2bbd2ed9f3a7cac8075d1ddb1b294c5069b0589
prototype.spawn.js
prototype.spawn.js
module.exports = function () { StructureSpawn.prototype.createCustomCreep = function(energy, roleName) { var numberOfParts = Math.floor(energy / 350); var body = []; for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; i < numberOfParts; i++) { body.push(CARRY); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } return this.createCreep(body, undefined, {role: roleName, working: false }); }; };
module.exports = function () { StructureSpawn.prototype.createCustomCreep = function(energy, roleName) { var numberOfParts = Math.floor(energy / 350); var body = []; for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; i < numberOfParts; i++) { body.push(CARRY); } for (let i = 0; i < numberOfParts; i++) { body.push(CARRY); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } for (let i = 0; i < numberOfParts; i++) { body.push(MOVE); } return this.createCreep(body, undefined, {role: roleName, working: false }); }; };
WORK WORK CARRY CARRY MOVE MOVE MOVE
WORK WORK CARRY CARRY MOVE MOVE MOVE
JavaScript
mit
Raltrwx/Ralt-Screeps
7c3bcda4f834cfab2fdd4caa32b59ea6c8082176
release.js
release.js
var shell = require('shelljs') if (exec('git status --porcelain').stdout) { console.error('Git working directory not clean. Please commit all chances to release a new package to npm.') process.exit(2) } var versionIncrement = process.argv[process.argv.length - 1] var versionIncrements = ['major', 'minor', 'patch'] if (versionIncrements.indexOf(versionIncrement) < 0) { console.error('Usage: node release.js major|minor|patch') process.exit(1) } exec('npm test') var geotag = execOptional('npm run geotag') if (geotag.code == 0) { exec('git commit -m "Geotag package for release" package.json') } exec('npm version ' + versionIncrement) exec('git push') exec('git push --tags') exec('npm publish') function exec (cmd) { var ret = shell.exec(cmd, { silent: true }) if (ret.code !== 0) { console.error(ret.stdout) process.exit(1) } return ret } function execOptional (cmd) { var ret = shell.exec(cmd, { silent: true }) if (ret.code !== 0) { console.log(ret.stdout) } return ret }
var shell = require('shelljs') if (exec('git status --porcelain').stdout) { console.error('Git working directory not clean. Please commit all chances to release a new package to npm.') process.exit(2) } var versionIncrement = process.argv[process.argv.length - 1] var versionIncrements = ['major', 'minor', 'patch'] if (versionIncrements.indexOf(versionIncrement) < 0) { console.error('Usage: node release.js major|minor|patch') process.exit(1) } exec('npm test') var geotag = execOptional('npm run geotag') if (geotag.code === 0) { exec('git commit -m "Geotag package for release" package.json') } exec('npm version ' + versionIncrement) exec('git push') exec('git push --tags') exec('npm publish') function exec (cmd) { var ret = shell.exec(cmd, { silent: true }) if (ret.code !== 0) { console.error(ret.stdout) process.exit(1) } return ret } function execOptional (cmd) { var ret = shell.exec(cmd, { silent: true }) if (ret.code !== 0) { console.log(ret.stdout) } return ret }
Use === instead of == to please the standard
Use === instead of == to please the standard
JavaScript
mit
mafintosh/mongojs
29aae66080fcdff0fe62486d445c6a3a9aeff406
app/assets/javascripts/forest/admin/partials/forest_tables.js
app/assets/javascripts/forest/admin/partials/forest_tables.js
// Forest tables $(document).on('mouseenter', '.forest-table tbody tr', function() { var $row = $(this); $row.addClass('active'); $(document).one('turbolinks:before-cache.forestTables', function() { $row.removeClass('active'); }); }); $(document).on('mouseleave', '.forest-table tbody tr', function() { var $row = $(this); $row.removeClass('active'); }); $(document).on('click', '.forest-table tbody tr', function(e) { var $row = $(this); if ( !$(e.target).closest('a').length ) { var $button = $row.find('a.forest-table__link:first'); if ( !$button.length ) { $button = $row.find('a.btn-primary:first'); } var url = $button.attr('href'); if ( url ) { Turbolinks.visit(url); } } });
// Forest tables $(document).on('mouseenter', '.forest-table tbody tr', function() { var $row = $(this); $row.addClass('active'); $(document).one('turbolinks:before-cache.forestTables', function() { $row.removeClass('active'); }); }); $(document).on('mouseleave', '.forest-table tbody tr', function() { var $row = $(this); $row.removeClass('active'); }); $(document).on('click', '.forest-table tbody tr', function(e) { var $row = $(this); if ( !$(e.target).closest('a').length ) { var $button = $row.find('a.forest-table__link:first'); if ( !$button.length ) { $button = $row.find('a.btn-primary:first'); } var url = $button.attr('href'); if ( url ) { if ( e.metaKey || e.ctrlKey ) { window.open( url, '_blank' ); } else if ( e.shiftKey ) { window.open( url, '_blank' ); window.focus(); } else { Turbolinks.visit(url); } } } });
Allow modifier key press when opening table rows
Allow modifier key press when opening table rows
JavaScript
mit
dylanfisher/forest,dylanfisher/forest,dylanfisher/forest
1d46cc1e616d64cdae5b29e9f777c309b3ea08f7
SPAWithAngularJS/module3/directives/controllersInsideDirective/js/app.shoppingListDirective.js
SPAWithAngularJS/module3/directives/controllersInsideDirective/js/app.shoppingListDirective.js
// app.shoppingListDirective.js (function() { "use strict"; angular.module("ShoppingListDirectiveApp") .directive("shoppingList", ShoppingList); function ShoppingList() { const templateUrl = "../templates/shoppingList.view.html"; const ddo = { restrict: "E", templateUrl, scope: { list: "<", title: "@" }, controller: "ShoppingListDirectiveController as l", bindToController: true }; return ddo; } })();
// app.shoppingListDirective.js (function() { "use strict"; angular.module("ShoppingListDirectiveApp") .directive("shoppingList", ShoppingList); function ShoppingList() { const templateUrl = "../templates/shoppingList.view.html"; const ddo = { restrict: "E", templateUrl, scope: { list: "<", title: "@" }, controller: "ShoppingListDirectiveController as ShoppingListDirectiveCtrl", bindToController: true }; return ddo; } })();
Edit controllerAs label for ShoppingListDirectiveController
Edit controllerAs label for ShoppingListDirectiveController
JavaScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
446503cb5c27964f693b0d931b52ff18f862b159
assets/js/external-links.js
assets/js/external-links.js
//// External Links // Open external links in a new tab. $(function () { $('a').each(function () { if ( $(this).href.indexOf(window.location.host) == -1 ) { $(this).attr('target', '_blank'); } }); });
//// External Links // Open external links in a new tab. $(function () { $('a').each(function () { if ( $(this).href.indexOf(window.location.host) === -1 ) { $(this).attr('target', '_blank'); } }); });
Fix "Expected '===' and instead saw '=='."
Fix "Expected '===' and instead saw '=='."
JavaScript
mit
eustasy/puff-core,eustasy/puff-core,eustasy/puff-core
5b7eda2be2c50e4aab45b862c2f9cde0d31c2dfe
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var clean = require('gulp-clean'); var zip = require('gulp-zip'); var bases = { root: 'dist/' }; var paths = [ 'core/actions/*', 'core/common/**', 'admin/**', '!admin/config/*', 'boxoffice/**', '!boxoffice/config/*', 'customer/**', '!customer/config/*', 'scanner/**', '!scanner/config/*', 'printer/**', '!printer/config/*', 'core/model/*', 'core/services/*', 'vendor/**', 'composer.lock', 'core/dependencies.php' ]; gulp.task('clean', function() { return gulp.src(bases.root) .pipe(clean({})); }); gulp.task('collect', function() { return gulp.src(paths, { base: './', dot: true }) .pipe(gulp.dest(bases.root)); }); gulp.task('zip', function() { return gulp.src(bases.root + '**') .pipe(zip('ticketbox-server-php.zip')) .pipe(gulp.dest(bases.root)); }); gulp.task('default', gulp.series('clean', 'collect', 'zip'));
var gulp = require('gulp'); var clean = require('gulp-clean'); var zip = require('gulp-zip'); var bases = { root: 'dist/' }; var paths = [ 'core/actions/*', 'core/common/**', 'admin/**', '!admin/config/*', 'boxoffice/**', '!boxoffice/config/*', 'customer/**', '!customer/config/*', 'scanner/**', '!scanner/config/*', 'printer/**', '!printer/config/*', 'core/model/*', 'core/services/*', 'vendor/**', 'composer.lock', 'core/dependencies.php', 'core/.htaccess' ]; gulp.task('clean', function() { return gulp.src(bases.root) .pipe(clean({})); }); gulp.task('collect', function() { return gulp.src(paths, { base: './', dot: true }) .pipe(gulp.dest(bases.root)); }); gulp.task('zip', function() { return gulp.src(bases.root + '**') .pipe(zip('ticketbox-server-php.zip')) .pipe(gulp.dest(bases.root)); }); gulp.task('default', gulp.series('clean', 'collect', 'zip'));
Copy core .htaccess file to dist
Copy core .htaccess file to dist
JavaScript
mit
ssigg/ticketbox-server-php,ssigg/ticketbox-server-php,ssigg/ticketbox-server-php
77726d201de27f48485de497ff706ccea11becc2
src/config/config.default.js
src/config/config.default.js
// TODO Just add fallbacks to config.js var path = require('path') module.exports = { port: 8080, address: '127.0.0.1', session_secret: 'asdf', database: { host: 'mongodb://127.0.0.1/', // MongoDB host name: 'vegosvar', // MongoDB database name }, facebook: { app_id: '', app_secret: '', callback: 'http://local.vegosvar.se:8080/auth/facebook/callback' }, root: path.join(__dirname, '..'), uploads: path.join(__dirname, '../uploads') }
// TODO Just add fallbacks to config.js var path = require('path') module.exports = { port: 8080, address: '127.0.0.1', session_secret: 'asdf', database: { host: 'mongodb://127.0.0.1/', // MongoDB host name: 'vegosvar', // MongoDB database name }, facebook: { app_id: '', app_secret: '', callback: 'http://local.vegosvar.se:8080/auth/facebook/callback' }, instagram: { client_id: '', client_secret: '', callback: 'http://local.vegosvar.se/admin/auth/instagram/callback', scope: 'public_content ' }, root: path.join(__dirname, '..'), uploads: path.join(__dirname, '../uploads') }
Add config for instagram authentication
Add config for instagram authentication
JavaScript
unlicense
Vegosvar/Vegosvar,Vegosvar/Vegosvar,Vegosvar/Vegosvar
e4e9561be08162dc7d00ce5cf38f55b52cad5863
src/models/interact.js
src/models/interact.js
var _ = require("lodash"); var Bacon = require("baconjs"); var Interact = module.exports; Interact.ask = function (question) { var readline = require("readline").createInterface({ input: process.stdin, output: process.stdout }); return Bacon.fromCallback(_.partial(readline.question.bind(readline), question)).doAction(readline.close.bind(readline)); }; Interact.confirm = function(question, rejectionMessage) { return Interact.ask(question).flatMapLatest(function(answer) { if(_.includes(["yes", "y"], answer)) { return true; } else { return new Bacon.Error(rejectionMessage); } }); };
var _ = require("lodash"); var Bacon = require("baconjs"); var Interact = module.exports; Interact.ask = function (question) { var readline = require("readline").createInterface({ input: process.stdin, output: process.stdout }); return Bacon.fromCallback(_.partial(readline.question.bind(readline), question)).doAction(readline.close.bind(readline)); }; Interact.confirm = function(question, rejectionMessage, answers) { var defaultAnswers = ["yes", "y"]; var expectedAnswers = typeof answers === "undefined" ? defaultAnswers : answers; return Interact.ask(question).flatMapLatest(function(answer) { if(_.includes(expectedAnswers, answer)) { return true; } else { return new Bacon.Error(rejectionMessage); } }); };
Make Interact.confirm use configurable acceptance strings
Make Interact.confirm use configurable acceptance strings
JavaScript
apache-2.0
CleverCloud/clever-tools,CleverCloud/clever-tools,CleverCloud/clever-tools
8695e857ae870b1e991cd511ffd70101969876cc
api/feed/pending/matchExec.js
api/feed/pending/matchExec.js
(function () { var cogClass = function () {}; cogClass.prototype.exec = function (params, request, response) { var oops = this.sys.apiError; var sys = this.sys; var userID = params.id; var userKey = params.key; var pages = sys.pages; pages.reset(); var delay = 30; if (sys.output_style === 'demo') { delay = 0; } var sql = 'SELECT eventID FROM events WHERE (strftime("%s","now")-strftime("%s",touchDate,"unixepoch"))/60>? AND NOT published=1 and status=0 ORDER BY pageDate DESC;'; sys.db.all(sql,[delay],function(err,rows){ if (err) {return oops(response,err,'pending(1)')}; sys.runEvents(rows,response,processData); function processData (data) { var page = pages.composeFeed(data,null) page = page.replace(/@@USER_ID@@/g,userID) .replace(/@@USER_KEY@@/g,userKey); response.writeHead(200, {'Content-Type': 'application/atom+xml'}); response.end(page) } }); } exports.cogClass = cogClass; })();
(function () { var cogClass = function () {}; cogClass.prototype.exec = function (params, request, response) { var oops = this.sys.apiError; var sys = this.sys; var userID = params.id; var userKey = params.key; var pages = sys.pages; pages.reset(); var delay = 30; if (sys.output_style === 'demo') { delay = 0; } delay = 3; var sql = 'SELECT eventID FROM events WHERE (strftime("%s","now")-strftime("%s",touchDate,"unixepoch"))/60>? AND NOT published=1 and status=0 ORDER BY pageDate DESC;'; sys.db.all(sql,[delay],function(err,rows){ if (err) {return oops(response,err,'pending(1)')}; sys.runEvents(rows,response,processData); function processData (data) { var page = pages.composeFeed(data,null) page = page.replace(/@@USER_ID@@/g,userID) .replace(/@@USER_KEY@@/g,userKey); response.writeHead(200, {'Content-Type': 'application/atom+xml'}); response.end(page) } }); } exports.cogClass = cogClass; })();
Set short delay for demo
Set short delay for demo
JavaScript
unlicense
fbennett/newswriter
7cf8e87de3aac94d6371799c1bc23c117df06b8d
ti_mocha_tests/modules/commonjs/commonjs.legacy.index_json/1.0.0/commonjs.legacy.index_json.js
ti_mocha_tests/modules/commonjs/commonjs.legacy.index_json/1.0.0/commonjs.legacy.index_json.js
module.exports = { name: 'commonjs.legacy.index_json/commonjs.legacy.index_js.js' };
module.exports = { name: 'commonjs.legacy.index_json/commonjs.legacy.index_json.js' };
Fix test input file with incorrect contets
Fix test input file with incorrect contets
JavaScript
apache-2.0
mano-mykingdom/titanium_mobile,ashcoding/titanium_mobile,cheekiatng/titanium_mobile,mano-mykingdom/titanium_mobile,mano-mykingdom/titanium_mobile,cheekiatng/titanium_mobile,ashcoding/titanium_mobile,cheekiatng/titanium_mobile,cheekiatng/titanium_mobile,ashcoding/titanium_mobile,ashcoding/titanium_mobile,ashcoding/titanium_mobile,cheekiatng/titanium_mobile,ashcoding/titanium_mobile,mano-mykingdom/titanium_mobile,cheekiatng/titanium_mobile,mano-mykingdom/titanium_mobile,ashcoding/titanium_mobile,ashcoding/titanium_mobile,mano-mykingdom/titanium_mobile,mano-mykingdom/titanium_mobile,cheekiatng/titanium_mobile,cheekiatng/titanium_mobile,mano-mykingdom/titanium_mobile
dda231347aeba1e692ddbf31d10897d6499cd44b
src/fn/fn-buckets-quantiles.js
src/fn/fn-buckets-quantiles.js
'use strict'; require('es6-promise').polyfill(); var debug = require('../helper/debug')('fn-quantiles'); var LazyFiltersResult = require('../model/lazy-filters-result'); var fnBuckets = require('./fn-buckets'); module.exports = function (datasource) { return function fn$quantiles (numBuckets) { debug('fn$quantiles(%j)', arguments); debug('Using "%s" datasource to calculate quantiles', datasource.getName()); return new Promise(function (resolve) { return resolve(new LazyFiltersResult(function (column, strategy) { return fnBuckets(datasource)(column, 'quantiles', numBuckets).then(function (filters) { filters.strategy = strategy || '>'; return new Promise(function (resolve) { return resolve(filters); }); }); })); }); }; }; module.exports.fnName = 'quantiles';
'use strict'; var createBucketsFn = require('./fn-buckets').createBucketsFn; var FN_NAME = 'quantiles'; module.exports = function (datasource) { return createBucketsFn(datasource, FN_NAME, '>'); }; module.exports.fnName = FN_NAME;
Migrate quantiles to buckets creation
Migrate quantiles to buckets creation
JavaScript
bsd-3-clause
CartoDB/turbo-cartocss
2fa1bad5ac36807f47c184c31c36f0ecc050cea9
draft-js-inline-toolbar-plugin/src/components/Toolbar/__test__/Toolbar.js
draft-js-inline-toolbar-plugin/src/components/Toolbar/__test__/Toolbar.js
import React, { Component } from 'react'; import { expect } from 'chai'; import { mount } from 'enzyme'; import Toolbar from '../index'; describe('Toolbar', () => { it('allows children to override the content', (done) => { const structure = [class Child extends Component { componentDidMount() { setTimeout(() => { this.props.onOverrideContent(() => { setTimeout(() => { this.props.onOverrideContent(undefined); }); return <span className="overridden" />; }); }); } render() { return <span className="initial" />; } }]; const theme = { toolbarStyles: {} }; const store = { subscribeToItem() {}, unsubscribeFromItem() {}, getItem: (name) => ({ getEditorState: () => ({ getSelection: () => ({ isCollapsed: () => true }) }) }[name]) }; const wrapper = mount( <Toolbar store={store} theme={theme} structure={structure} /> ); expect(wrapper.find('.initial').length).to.equal(1); setTimeout(() => { expect(wrapper.find('.initial').length).to.equal(0); expect(wrapper.find('.overridden').length).to.equal(1); setTimeout(() => { expect(wrapper.find('.initial').length).to.equal(1); expect(wrapper.find('.overridden').length).to.equal(0); done(); }); }); }); });
import React, { Component } from 'react'; import { expect } from 'chai'; import { mount } from 'enzyme'; import Toolbar from '../index'; describe('Toolbar', () => { it('allows children to override the content', (done) => { const structure = [class Child extends Component { componentDidMount() { setTimeout(() => { this.props.onOverrideContent(() => { setTimeout(() => { this.props.onOverrideContent(undefined); }); return <span className="overridden" />; }); }); } render() { return <span className="initial" />; } }]; const theme = { toolbarStyles: {} }; const store = { subscribeToItem() {}, unsubscribeFromItem() {}, getItem: (name) => ({ getEditorState: () => ({ getSelection: () => ({ isCollapsed: () => true, getHasFocus: () => true }) }) }[name]) }; const wrapper = mount( <Toolbar store={store} theme={theme} structure={structure} /> ); expect(wrapper.find('.initial').length).to.equal(1); setTimeout(() => { expect(wrapper.find('.initial').length).to.equal(0); expect(wrapper.find('.overridden').length).to.equal(1); setTimeout(() => { expect(wrapper.find('.initial').length).to.equal(1); expect(wrapper.find('.overridden').length).to.equal(0); done(); }); }); }); });
Fix test for inline toolbar
Fix test for inline toolbar
JavaScript
mit
draft-js-plugins/draft-js-plugins,dagopert/draft-js-plugins,nikgraf/draft-js-plugin-editor,nikgraf/draft-js-plugin-editor,draft-js-plugins/draft-js-plugins,dagopert/draft-js-plugins,nikgraf/draft-js-plugin-editor,draft-js-plugins/draft-js-plugins,dagopert/draft-js-plugins,draft-js-plugins/draft-js-plugins
9034a21f2762b6b01d6dc45a9f049e60cf3d7439
addon/components/course-publicationcheck.js
addon/components/course-publicationcheck.js
/* eslint-disable ember/no-computed-properties-in-native-classes */ import Component from '@glimmer/component'; import { inject as service } from '@ember/service'; export default class CoursePublicationCheckComponent extends Component { @service router; get showUnlinkIcon() { if (!this.args.course.courseObjectives) { return false; } const objectivesWithoutParents = this.args.course.courseObjectives.filter((objective) => { const parentIds = objective.hasMany('programYearObjectives').ids(); return parentIds.length === 0; }); return objectivesWithoutParents.length > 0; } }
/* eslint-disable ember/no-computed-properties-in-native-classes */ import Component from '@glimmer/component'; import { inject as service } from '@ember/service'; import { use } from 'ember-could-get-used-to-this'; import ResolveAsyncValue from 'ilios-common/classes/resolve-async-value'; export default class CoursePublicationCheckComponent extends Component { @service router; @use courseObjectives = new ResolveAsyncValue(() => [this.args.course.courseObjectives, []]); get showUnlinkIcon() { const objectivesWithoutParents = this.courseObjectives.filter((objective) => { return objective.programYearObjectives.length === 0; }); return objectivesWithoutParents.length > 0; } }
Resolve objectives in course publication check
Resolve objectives in course publication check We can also use the length value of the relationship to check if there are parents which engages auto tracking.
JavaScript
mit
ilios/common,ilios/common
5d9f0dbd9e287ad320f020238ab6d3e66ffb2f49
addon/components/floating-mobile-buttons.js
addon/components/floating-mobile-buttons.js
import Ember from 'ember'; import layout from '../templates/components/floating-mobile-buttons'; export default Ember.Component.extend({ layout, tagName: 'ul', classNames: ['floating-buttons'], classNameBindings: ['active:active', 'bottom:bottom', 'top:top', 'left:left', 'right:right'], active: false, childrenActive: false, hasChildren: false, position: 'bottom right', didReceiveAttrs(){ this._super(...arguments); let classes = this.get('position').trim().split(" "); let vClasses = classes.filter( c => { if(c.match(/(bottom|top)/i)){ return c; } }); let hClasses = classes.filter( c => { if(c.match(/(right|left)/i)){ return c; } }); if(vClasses.length === 0 || vClasses.length > 1 || hClasses.length === 0 || hClasses.length > 1){ Ember.assert('The position property must be a string with the values top|bottom and left|right.'); } classes.forEach( c => { this.set(c, true); }); }, didInsertElement(){ this._super(...arguments); this.set('active', true); if(Ember.$(`#${this.get('elementId')} .floating-child-button`).length > 1){ this.set('hasChildren', true); } }, actions: { toggleChildren(){ this.toggleProperty('childrenActive'); } } });
import Ember from 'ember'; import layout from '../templates/components/floating-mobile-buttons'; export default Ember.Component.extend({ layout, tagName: 'ul', classNames: ['floating-buttons'], classNameBindings: ['active:active', 'bottom:bottom', 'top:top', 'left:left', 'right:right'], active: false, childrenActive: false, hasChildren: false, position: 'bottom right', didReceiveAttrs(){ this._super(...arguments); this.set('active', true); let classes = this.get('position').trim().split(" "); let vClasses = classes.filter( c => { if(c.match(/(bottom|top)/i)){ return c; } }); let hClasses = classes.filter( c => { if(c.match(/(right|left)/i)){ return c; } }); if(vClasses.length === 0 || vClasses.length > 1 || hClasses.length === 0 || hClasses.length > 1){ Ember.assert('The position property must be a string with the values top|bottom and left|right.'); } classes.forEach( c => { this.set(c, true); }); Ember.run.schedule('afterRender', () => { if(Ember.$(`#${this.get('elementId')} .floating-child-button`).length > 1){ this.set('hasChildren', true); } }); }, actions: { toggleChildren(){ this.toggleProperty('childrenActive'); } } });
Use the afterRender run loop to check if has children
Use the afterRender run loop to check if has children
JavaScript
mit
yontxu/ember-floating-mobile-buttons,yontxu/ember-floating-mobile-buttons
bf5b8c20974dfe7d16dde885aa02ec39471e652a
great/static/js/models/artist.js
great/static/js/models/artist.js
"use strict"; great.Artist = Backbone.Model.extend({ }); great.ArtistsCollection = Backbone.PageableCollection.extend({ model: great.Artist, comparator: "name", url: "/great/music/artists/", mode: "client", });
"use strict"; great.Artist = Backbone.Model.extend({ urlRoot: "/great/music/artists/", }); great.ArtistsCollection = Backbone.PageableCollection.extend({ model: great.Artist, comparator: "name", url: "/great/music/artists/", mode: "client", });
Add a urlRoot to allow use outside of a collection.
Add a urlRoot to allow use outside of a collection.
JavaScript
mit
Julian/Great,Julian/Great,Julian/Great
8f0b0267da395ce2824122496408b4c3ac014a3d
src/camel-case.js
src/camel-case.js
import R from 'ramda'; import uncapitalize from './uncapitalize.js'; import pascalCase from './pascal-case.js'; // a -> a const camelCase = R.compose(uncapitalize, pascalCase); export default camelCase;
import R from 'ramda'; import compose from './util/compose.js'; import uncapitalize from './uncapitalize.js'; import pascalCase from './pascal-case.js'; // a -> a const camelCase = compose(uncapitalize, pascalCase); export default camelCase;
Refactor camelCase function to use custom compose function
Refactor camelCase function to use custom compose function
JavaScript
mit
restrung/restrung-js
6a5598ed7f1cf85502d58e7a9b774d31419ff79c
js/kamfu.js
js/kamfu.js
$(document).ready(function() { console.log( "ready!" ); var gameForeground = $('#gameForeground')[0]; var gameFront = $('#gameFront')[0]; var gameBack = $('#gameBack')[0]; var gameText = $('#gameText')[0]; gameCommon.setup(gameForeground, gameFront, gameBack, gameText); var video = document.querySelector('video'); camera.setup(video, gameCommon.onSnapshot, gameCommon.initCallback); window.setTimeout(gameCommon.mainLoop, 100); $( "body" ).click(function() { if (gameCommon.currentGame == gameMenu) { var r = confirm("Reset camera?"); if (r == true) { gameCommon.clearup(); camera.initialized = false; camera.startupTime = 0; } } }); });
$(document).ready(function() { console.log( "ready!" ); var gameForeground = $('#gameForeground')[0]; var gameFront = $('#gameFront')[0]; var gameBack = $('#gameBack')[0]; var gameText = $('#gameText')[0]; gameCommon.setup(gameForeground, gameFront, gameBack, gameText); var video = document.querySelector('video'); camera.setup(video, gameCommon.onSnapshot, gameCommon.initCallback); window.setTimeout(gameCommon.mainLoop, 100); });
Remove reset camera click event
Remove reset camera click event
JavaScript
apache-2.0
pabloalba/kam-fu,pabloalba/kam-fu
0ca2b8e525a81eedb21af53b1ac2213b8efa4dd8
web/src/store.js
web/src/store.js
import { compose, createStore, applyMiddleware } from 'redux' import persistState from 'redux-localstorage' import thunk from 'redux-thunk' import RootReducer from 'reducers/RootReducer' export default createStore( RootReducer, compose( applyMiddleware(thunk), persistState(['user']), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), ), )
import { compose, createStore, applyMiddleware } from 'redux' import persistState from 'redux-localstorage' import thunk from 'redux-thunk' import RootReducer from 'reducers/RootReducer' const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose export default createStore( RootReducer, composeEnhancers( persistState(['user']), applyMiddleware(thunk), ), )
Fix Redux DevTools for mobile
Fix Redux DevTools for mobile
JavaScript
mit
RailsRoading/wissle,RailsRoading/wissle,RailsRoading/wissle
dc5f805dcea6d0c1dd27a98cadbf2290a323ea87
javascript/staticsearch.js
javascript/staticsearch.js
jQuery(function($) { $('#tipue_search_input').tipuesearch({ 'mode': 'static', 'contentLocation': '/search_index' }); $("form.no-pageload input").keypress(function(e){ var k = e.keyCode || e.which; if(k == 13){ e.preventDefault(); } }); $("form.button-submit input.submit-button").click(function(e){ this.form.submit(); }); });
jQuery(function($) { //prevent undeclared variable var tipuesearch = {"pages": [ {"title": "", "text":"", "tags":"", "loc":""} ]}; $('#tipue_search_input').tipuesearch({ 'mode': 'static', 'contentLocation': '/search_index' }); $("form.no-pageload input").keypress(function(e){ var k = e.keyCode || e.which; if(k == 13){ e.preventDefault(); } }); $("form.button-submit input.submit-button").click(function(e){ this.form.submit(); }); });
Fix undefined error when no search file found
BUG: Fix undefined error when no search file found
JavaScript
bsd-3-clause
adrexia/silverstripe-staticsearch,adrexia/silverstripe-staticsearch
5c2e5defbe12f099b627ac83302e1caa818d0093
lib/Post.js
lib/Post.js
var config = require('../config.json'); var modIDs = config.modIDs; /** * A single Facebook post or comment. * @class */ var Post = module.exports = function (id) { /** @member {string} */ this.id = id; /** @member {string} */ this.from = ''; /** @member {string} */ this.message = ''; }; /** * Converts a raw JSON-formatted post from a response body into an object. * @param {Object} raw * @return {Post} */ Post.fromRaw = function (raw) { var post = new Post(raw.id); post.from = raw.from ? raw.from.id : '0'; post.message = raw.message; return post; }; /** * Determines if the poster was a group moderator. * @returns {boolean} */ Post.prototype.isMod = function () { return modIDs.indexOf(this.from) !== -1; }; /** * Determines if the post contains a moderative command. Commands begin with a * forward slash, followed by any number of alphanumeric characters. * @param {string} cmd * @returns {boolean} */ Post.prototype.hasCommand = function (cmd) { return this.message.match('^/' + cmd + '(?: |$)'); };
var config = require('../config.json'); var modIDs = config.modIDs; /** * A single Facebook post or comment. * @class */ var Post = module.exports = function (id) { /** @member {string} */ this.id = id; /** @member {string} */ this.from = ''; /** @member {string} */ this.message = ''; }; /** * Converts a raw JSON-formatted post from a response body into an object. * @param {Object} raw * @return {Post} */ Post.fromRaw = function (raw) { var post = new Post(raw.id); post.from = raw.from ? raw.from.id : '0'; post.message = raw.message || ''; return post; }; /** * Determines if the poster was a group moderator. * @returns {boolean} */ Post.prototype.isMod = function () { return modIDs.indexOf(this.from) !== -1; }; /** * Determines if the post contains a moderative command. Commands begin with a * forward slash, followed by any number of alphanumeric characters. * @param {string} cmd * @returns {boolean} */ Post.prototype.hasCommand = function (cmd) { return this.message.match('^/' + cmd + '(?: |$)'); };
Fix message processing for sticker comments.
Fix message processing for sticker comments.
JavaScript
bsd-3-clause
HHDesign/hackbot,rhallie15/hackbot,kern/hackbot,kern/hackbot,samuelcouch/hackbot,rubinovitz/hackbot
48b850d5ba1cdda06a55b8ae5d2727c5c8b4bde4
lib/deck.js
lib/deck.js
var _ = require("lodash"); var EventEmitter = require("events").EventEmitter; var util = require("util"); var ItemCollection = require("./itemcollection"); function Deck(options) { if (!(this instanceof Deck)) { return new Deck(options); } EventEmitter.call(this); this.itemCollection = options.itemCollection || new ItemCollection(options.items || []); this.itemRenderer = options.itemRenderer; this.setViewport(options.viewport); // use default this.setLayout(options.layout); // use standard grid layout } util.inherits(Deck, EventEmitter); _.extend(Deck.prototype, { addItem: function(item) { this.itemCollection.addItem(item); }, addItems: function(items) { this.itemCollection.addItems(items); }, removeItem: function(item) { this.itemCollection.removeItem(item); }, clear: function() { this.itemCollection.clear(); }, setViewport: function(viewport) { if (this.viewport) { // TODO: unbind viewport events? } this.viewport = viewport; this.viewport.setItemRenderer(this.itemRenderer); // TODO: set viewport on current layout }, setLayout: function(layout) { if (this.layout) { this.layout.unbindCollectionEvents(); this.layout.unbindViewportEvents(); } this.layout = layout; this.layout.setItemCollection(this.itemCollection); this.layout.setViewport(this.viewport); } }); module.exports = Deck;
var _ = require("lodash"); var EventEmitter = require("events").EventEmitter; var util = require("util"); var ItemCollection = require("./itemcollection"); var ItemRenderer = require("./itemrenderer"); function Deck(options) { if (!(this instanceof Deck)) { return new Deck(options); } EventEmitter.call(this); this.itemCollection = options.itemCollection || new ItemCollection(options.items || []); this.itemRenderer = new ItemRenderer(options.itemRenderer); this.setViewport(options.viewport); // use default this.setLayout(options.layout); // use standard grid layout } util.inherits(Deck, EventEmitter); _.extend(Deck.prototype, { addItem: function(item) { this.itemCollection.addItem(item); }, addItems: function(items) { this.itemCollection.addItems(items); }, removeItem: function(item) { this.itemCollection.removeItem(item); }, clear: function() { this.itemCollection.clear(); }, setViewport: function(viewport) { if (this.viewport) { // TODO: unbind viewport events? } this.viewport = viewport; this.viewport.setItemRenderer(this.itemRenderer); // TODO: set viewport on current layout }, setLayout: function(layout) { if (this.layout) { this.layout.unbindCollectionEvents(); this.layout.unbindViewportEvents(); } this.layout = layout; this.layout.setItemCollection(this.itemCollection); this.layout.setViewport(this.viewport); } }); module.exports = Deck;
Create ItemRenderer from options passed to Deck
Create ItemRenderer from options passed to Deck
JavaScript
mit
pellucidanalytics/decks,pellucidanalytics/decks
0ffa589122d21ab32099ec377ddbab6be15a593a
lib/exec.js
lib/exec.js
'use strict'; var shell = require('shelljs'); var cmd = require('./cmd'); // Execute msbuild.exe with passed arguments module.exports = function exec(args) { process.exit(shell.exec(cmd(args)).code); }
'use strict'; var shell = require('shelljs'); var cmd = require('./cmd'); // Execute nuget.exe with passed arguments module.exports = function exec(args) { const result = shell.exec(cmd(args)).code; if (result !== 0) { console.log(); console.log(`NuGet failed. ERRORLEVEL '${result}'.'`) process.exit(result); } console.log('NuGet completed successfully.'); }
Fix handling of NuGet errors
Fix handling of NuGet errors
JavaScript
mit
TimMurphy/npm-nuget
bc80e82a05c0a7b19e538ff3773f8966e1bf28f8
lib/main.js
lib/main.js
'use babel' const FS = require('fs') const Path = require('path') const {View} = require('./view') const callsite = require('callsite') import {guessName, installPackages, packagesToInstall} from './helpers' // Renamed for backward compatibility if (typeof window.__steelbrain_package_deps === 'undefined') { window.__steelbrain_package_deps = new Set() } export function install(name = null, enablePackages = false) { if (!name) { name = guessName(require('callsite')()[1].getFileName()) } const {toInstall, toEnable} = packagesToInstall(name) let promise = Promise.resolve() if (enablePackages && toEnable.length) { promise = toEnable.reduce(function(promise, name) { atom.packages.enablePackage(name) return atom.packages.activatePackage(name) }, promise) } if (toInstall.length) { const view = new View(name, toInstall) promise = Promise.all([view.show(), promise]).then(function() { return installPackages(toInstall, function(name, status) { if (status) { view.advance() } else { atom.notifications.addError(`Error Installing ${name}`, {detail: 'Something went wrong. Try installing this package manually.'}) } }) }) } return promise }
'use babel' const FS = require('fs') const Path = require('path') const {View} = require('./view') const callsite = require('callsite') import {guessName, installPackages, packagesToInstall} from './helpers' // Renamed for backward compatibility if (typeof window.__steelbrain_package_deps === 'undefined') { window.__steelbrain_package_deps = new Set() } export function install(name = null, enablePackages = false) { if (!name) { const filePath = require('callsite')()[1].getFileName() name = guessName(filePath) if (!name) { console.log(`Unable to get package name for file: ${filePath}`) return Promise.resolve() } } const {toInstall, toEnable} = packagesToInstall(name) let promise = Promise.resolve() if (enablePackages && toEnable.length) { promise = toEnable.reduce(function(promise, name) { atom.packages.enablePackage(name) return atom.packages.activatePackage(name) }, promise) } if (toInstall.length) { const view = new View(name, toInstall) promise = Promise.all([view.show(), promise]).then(function() { return installPackages(toInstall, function(name, status) { if (status) { view.advance() } else { atom.notifications.addError(`Error Installing ${name}`, {detail: 'Something went wrong. Try installing this package manually.'}) } }) }) } return promise }
Handle failure in name guessing
:art: Handle failure in name guessing
JavaScript
mit
steelbrain/package-deps,openlawlibrary/package-deps,steelbrain/package-deps
763e147ba669365e5f38f5b27c0dc1367087c031
lib/util.js
lib/util.js
"use strict"; var Class = require("./Class"); var CompileError = exports.CompileError = Class.extend({ initialize: function () { switch (arguments.length) { case 2: // token, text this._filename = arguments[0].filename; this._pos = arguments[0].pos; this._message = arguments[1]; break; case 3: // filename, pos, text this._filename = arguments[0]; this._pos = arguments[1]; this._message = arguments[2]; default: throw new Error(); } }, getFilename: function () { return this._filename; }, getPosition: function () { return this._pos; }, toString: function () { return this._filename + "(" + this._pos + "):" + this._message; } }); var Util = exports.Util = Class.extend({ $serializeArray: function (a) { if (a == null) return null; var ret = []; for (var i = 0; i < a.length; ++i) ret[i] = a[i].serialize(); return ret; }, $serializeNullable: function (v) { if (v == null) return null; return v.serialize(); } });
"use strict"; var Class = require("./Class"); var CompileError = exports.CompileError = Class.extend({ initialize: function () { switch (arguments.length) { case 2: // token, text this._filename = arguments[0].filename; this._pos = arguments[0].pos; this._message = arguments[1]; break; case 3: // filename, pos, text this._filename = arguments[0]; this._pos = arguments[1]; this._message = arguments[2]; break; default: throw new Error("Unrecognized arguments for CompileError: " + JSON.stringify( Array.prototype.slice.call(arguments) )); } }, getFilename: function () { return this._filename; }, getPosition: function () { return this._pos; }, toString: function () { return this._filename + "(" + this._pos + "):" + this._message; } }); var Util = exports.Util = Class.extend({ $serializeArray: function (a) { if (a == null) return null; var ret = []; for (var i = 0; i < a.length; ++i) ret[i] = a[i].serialize(); return ret; }, $serializeNullable: function (v) { if (v == null) return null; return v.serialize(); } }); // vim: set noexpandtab:
Fix error handling in lexer
Fix error handling in lexer
JavaScript
mit
mattn/JSX,jsx/JSX,jsx/JSX,dj31416/JSX,dj31416/JSX,mattn/JSX,jsx/JSX,jsx/JSX,dj31416/JSX,dj31416/JSX,jsx/JSX,dj31416/JSX
581b1239c070873fbede643c04b654067d5468a5
src/redux/__tests__/random.test.js
src/redux/__tests__/random.test.js
import { expect } from 'chai'; import Immutable from 'immutable'; import { createReducer } from 'rook/lib/redux/createStore'; import reducers from '../modules'; const reducer = createReducer(reducers.random); describe('redux', () => { describe('reducers', () => { describe('random', () => { const initialState = Immutable.fromJS({}); it('handles loadOk', () => { const curDate = new Date().toString(); const newState = reducer(initialState, { type: 'random/loadOk', result: { number: 0.5, time: curDate } }); expect(newState.toJS()).to.deep.equal({ number: 0.5, time: curDate }); }); }); }); });
import { expect } from 'chai'; import Immutable from 'immutable'; import createReducer from 'rook/lib/redux/createReducer'; import reducers from '../modules'; const reducer = createReducer(reducers.random); describe('redux', () => { describe('reducers', () => { describe('random', () => { const initialState = Immutable.fromJS({}); it('handles loadOk', () => { const curDate = new Date().toString(); const newState = reducer(initialState, { type: 'random/loadOk', result: { number: 0.5, time: curDate } }); expect(newState.toJS()).to.deep.equal({ number: 0.5, time: curDate }); }); }); }); });
Update path to createReducer function
Update path to createReducer function
JavaScript
mit
apazzolini/rook-starter
a92dcb2c0c3b6fb4f79de28c18b3b0dd357d139d
app/components/text-search.js
app/components/text-search.js
export default Ember.TextField.extend(Ember.TargetActionSupport, { change: function() { this.triggerAction({ action: 'search' }); }, insertNewline: function() { this.triggerAction({ action: 'search' }); } });
export default Ember.TextField.extend(Ember.TargetActionSupport, { change: function() { this.triggerAction({ action: 'search' }); } });
Fix for search not working when pressing the enter key.
Fix for search not working when pressing the enter key.
JavaScript
mit
HospitalRun/hospitalrun-frontend,HospitalRun/hospitalrun-frontend,HospitalRun/hospitalrun-frontend,HospitalRun/hospitalrun-frontend
35a6c36ed93b5e45026707925851c1792099aff6
test/commands/domains/index.js
test/commands/domains/index.js
'use strict'; let nock = require('nock'); let cmd = require('../../../commands/domains'); let expect = require('chai').expect; describe('domains', function() { beforeEach(() => cli.mockConsole()); it('shows the domains', function() { let api = nock('https://api.heroku.com:443') .get('/apps/myapp/domains') .reply(200, [ {"cname": "myapp.com", "hostname": "myapp.com", "kind": "custom"}, {"cname": null, "hostname": "myapp.herokuapp.com", "kind": "heroku"}, ]); return cmd.run({app: 'myapp', flags: {}}) .then(() => expect(cli.stdout).to.equal(`=== myapp Heroku Domain myapp.herokuapp.com === myapp Custom Domains Domain Name DNS Target ─────────── ────────── myapp.com myapp.com `)) .then(() => api.done()); }); });
'use strict'; let nock = require('nock'); let cmd = require('../../../commands/domains'); let expect = require('chai').expect; describe('domains', function() { beforeEach(() => cli.mockConsole()); it('shows the domains', function() { let api = nock('https://api.heroku.com:443') .get('/apps/myapp/domains') .reply(200, [ {"cname": "myapp.com", "hostname": "myapp.com", "kind": "custom"}, {"cname": null, "hostname": "myapp.herokuapp.com", "kind": "heroku"}, ]); return cmd.run({app: 'myapp', flags: {}}) .then(() => expect(cli.stdout).to.equal(`=== myapp Heroku Domain myapp.herokuapp.com === myapp Custom Domains Domain Name DNS Target ─────────── ────────── myapp.com myapp.com `)) .then(() => api.done()); }); });
Fix domains test after pull & npm install
Fix domains test after pull & npm install
JavaScript
isc
heroku/heroku-apps,heroku/heroku-apps
6772db0ad6d5b4733a9101537795f5fb9dfe3fe1
src/common/core.js
src/common/core.js
var d3 = window.d3; var previousD3ma = window.d3.ma; var d3ma = d3.ma = {}; d3ma.noConflict = function() { window.d3ma= previousD3ma; return d3ma; }; d3ma.assert = function(test, message) { if(test) { return; } throw new Error('[d3.ma] ' + message); }; d3ma.assert(d3, 'd3.js is required'); d3ma.assert( typeof d3.version === 'string' && d3.version.match(/^3/), 'd3.js version 3 is required' ); d3.ma.version = '0.1.0';
var d3 = window.d3; var previousD3ma = window.d3.ma; var d3ma = d3.ma = {}; d3ma.noConflict = function() { window.d3ma= previousD3ma; return d3ma; }; d3ma.assert = function(test, message) { if(test) { return; } throw new Error('[d3.ma] ' + message); }; d3ma.assert(d3, 'd3.js is required'); d3ma.assert( typeof d3.version === 'string' && d3.version.match(/^3/), 'd3.js version 3 is required' ); d3ma.version = '0.1.0';
Update the d3ma var, make it more global like d3.ma
Update the d3ma var, make it more global like d3.ma
JavaScript
mit
mattma/d3.ma.js
0483e4269e66992329f0c451d2188a2230f7b81c
static/js/components/CourseList.js
static/js/components/CourseList.js
import React from 'react'; import { makeCourseStatusDisplay } from '../util/util'; class CourseList extends React.Component { render() { const { dashboard, courseList } = this.props; let dashboardLookup = {}; for (let course of dashboard.courses) { dashboardLookup[course.id] = course; } let tables = courseList.programList.map(program => { let courses = courseList.courseList. filter(course => course.program === program.id). map(course => dashboardLookup[course.id]). filter(course => course); return <div key={program.id}> <ul className="course-list-header"> <li>{program.title}</li> <li /> </ul> { courses.map(course => <ul key={course.id} className={"course-list-status-" + course.status}> <li> {course.title} </li> <li> {makeCourseStatusDisplay(course)} </li> </ul> ) } </div>; }); return <div className="course-list"> {tables} </div>; } } CourseList.propTypes = { courseList: React.PropTypes.object.isRequired, dashboard: React.PropTypes.object.isRequired, }; export default CourseList;
import React from 'react'; import _ from 'lodash'; import { makeCourseStatusDisplay } from '../util/util'; class CourseList extends React.Component { render() { const { dashboard } = this.props; let sortedCourses = _.sortBy(dashboard.courses, 'position_in_program'); let table = sortedCourses.map(course => { // id number is not guaranteed to exist here so we need to use the whole // object to test uniqueness // TODO: fix this when we refactor return <ul key={JSON.stringify(course)} className={"course-list-status-" + course.status} > <li> {course.title} </li> <li> {makeCourseStatusDisplay(course)} </li> </ul>; }); return <div className="course-list"> <ul className="course-list-header"> <li /> <li /> </ul> {table} </div>; } } CourseList.propTypes = { courseList: React.PropTypes.object.isRequired, dashboard: React.PropTypes.object.isRequired, }; export default CourseList;
Use only information from dashboard API for dashboard display.
Use only information from dashboard API for dashboard display. This fixes a problem with course run ids which may not exist
JavaScript
bsd-3-clause
mitodl/micromasters,mitodl/micromasters,mitodl/micromasters,mitodl/micromasters
1505e4cae9730677d513c81d4cd66df1017e09e5
src/elementType.js
src/elementType.js
import React from 'react'; import createChainableTypeChecker from './utils/createChainableTypeChecker'; function elementType(props, propName, componentName, location, propFullName) { const propValue = props[propName]; const propType = typeof propValue; if (React.isValidElement(propValue)) { return new Error( `Invalid ${location} \`${propFullName}\` of type ReactElement ` + `supplied to \`${componentName}\`, expected an element type (a string ` + 'or a ReactClass).' ); } if (propType !== 'function' && propType !== 'string') { return new Error( `Invalid ${location} \`${propFullName}\` of value \`${propValue}\` ` + `supplied to \`${componentName}\`, expected an element type (a string ` + 'or a ReactClass).' ); } return null; } export default createChainableTypeChecker(elementType);
import React from 'react'; import createChainableTypeChecker from './utils/createChainableTypeChecker'; function elementType(props, propName, componentName, location, propFullName) { const propValue = props[propName]; const propType = typeof propValue; if (React.isValidElement(propValue)) { return new Error( `Invalid ${location} \`${propFullName}\` of type ReactElement ` + `supplied to \`${componentName}\`, expected an element type (a string ` + 'or a ReactClass).' ); } const isSpecial = propValue && propValue.$$typeof; if (propType !== 'function' && propType !== 'string' && !isSpecial) { return new Error( `Invalid ${location} \`${propFullName}\` of value \`${propValue}\` ` + `supplied to \`${componentName}\`, expected an element type (a string ` + ', component class, or function component).' ); } return null; } export default createChainableTypeChecker(elementType);
Update for new React types, context, forwardRef, etc
Update for new React types, context, forwardRef, etc
JavaScript
mit
react-bootstrap/prop-types-extra
bf6234ad7030b45fe2ae70c67d720b6fd1898fe9
src/lib/Twilio.js
src/lib/Twilio.js
require('dotenv').config(); export const sendSMS = (message) => { const formData = new FormData() formData.append('body', encodeURIComponent(message)) formData.append('to', encodeURIComponent(process.env.TO_PHONE)) formData.append('from', encodeURIComponent(process.env.FROM_PHONE)) const options = { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ' + encodeURIComponent(process.env.SID + ':' + process.env.TOKEN) }, body: formData } fetch( 'https://api.twilio.com/2010-04-01/Accounts/' + process.env.SID + '/Messages.json', options ).then((response) => { //Parse JSON response console.log(response.json()) }) }
require('dotenv').config() const twilio = require('twilio') const client = new twilio(process.env.SID, process.env.TOKEN) const sendSMS = (message) => { client.api.messages.create({ body: message, to: process.env.TO_PHONE, from: process.env.FROM_PHONE }) .then((mes) => { console.log(mes.sid) }) .catch((err) => { console.log(err) }) } module.exports = sendSMS
Add sendSMS method and confirm that it works
Add sendSMS method and confirm that it works
JavaScript
mit
severnsc/brewing-app,severnsc/brewing-app
5ca0961dbd3c171a248452726e9f283a955babb8
src/App.js
src/App.js
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } var tw = 1500000; function getTimeRemaining(consumed = 0) { var t = tw - consumed; tw = t; var minute = Math.floor((t/1000/60) % 60); var seconds = Math.floor((t/1000) % 60); return { minute, seconds }; } function initializedClock() { var timeInterval = setInterval(() => { var timex = getTimeRemaining(1000); console.log(timex.minute,' : ',timex.seconds); if (timex.t <= 0) { clearInterval(timeInterval); } }, 1000); } initializedClock(); export default App;
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } var tw = 1500000; function getTimeRemaining(consumed = 0) { var t = tw - consumed; tw = t; var minute = Math.floor((t/1000/60) % 60); var seconds = Math.floor((t/1000) % 60); return { minute, seconds }; } function initializedClock() { var timeInterval = setInterval(() => { var timex = getTimeRemaining(1000); console.log(timex.minute,' : ',('0' + timex.seconds).slice(-2)); if (timex.t <= 0) { clearInterval(timeInterval); } }, 1000); } initializedClock(); export default App;
Add leading to zeros to single digit
Add leading to zeros to single digit
JavaScript
mit
cauldyclark15/pomodoro,cauldyclark15/pomodoro
fb083580920b89bda2cbfc0d3be5ad5c2a0ca074
src/jwt-request.js
src/jwt-request.js
var JWTHelper = require('./jwt-helper'); var JWTConfig = require('./jwt-config'); var JWTRequest = { setAuthorizationHeader(options, token) { if (!options.headers) options.headers = {}; options.headers[JWTConfig.authHeader] = `${JWTConfig.authPrefix} ${token}`; return options; }, handleUnAuthorizedFetch(url, options) { return fetch(url, options).then((response) => response.json()); }, handleAuthorizedFetch(url, options) { return new Promise((resolve, reject) => { JWTHelper.getToken().then((token) => { if (token && !JWTHelper.isTokenExpired(token)) { options = this.setAuthorizationHeader(options, token); fetch(url, options).then((response) => { resolve(response.json()) }); } else { reject('Token is either not valid or has expired.'); } }) }) }, fetch(url, options, skipAuthorization) { options = options || {}; if (skipAuthorization) { return this.handleUnAuthorizedFetch(url, options); } else { return this.handleAuthorizedFetch(url, options); } } }; module.exports = JWTRequest;
var JWTHelper = require('./jwt-helper'); var JWTConfig = require('./jwt-config'); var JWTRequest = { setAuthorizationHeader(options, token) { if (!options.headers) options.headers = {}; options.headers[JWTConfig.authHeader] = `${JWTConfig.authPrefix} ${token}`; return options; }, handleUnAuthorizedFetch(url, options) { return fetch(url, options).then((response) => response.json()); }, handleAuthorizedFetch(url, options) { return new Promise((resolve, reject) => { JWTHelper.getToken().then((token) => { if (token && !JWTHelper.isTokenExpired(token)) { options = this.setAuthorizationHeader(options, token); fetch(url, options).then((response) => { resolve(response.json()) }); } else { reject('Token is either not valid or has expired.'); } }) }) }, fetch(url, options) { options = options || {}; if (options.skipAuthorization) { return this.handleUnAuthorizedFetch(url, options); } else { return this.handleAuthorizedFetch(url, options); } } }; module.exports = JWTRequest;
Add skipAuthorization to options instead of a variable in our method
Add skipAuthorization to options instead of a variable in our method
JavaScript
mit
iDay/react-native-http,iktw/react-native-http
bb89d991e9495f15d6fabed5be9441177003b716
bin/bin-executor.js
bin/bin-executor.js
'use strict'; const yarpm = require('../lib'); const argv = process.argv.slice(2); exports.run = function run(options) { yarpm(argv, Object.assign({stdin: process.stdin, stdout: process.stdout, stderr: process.stderr}, options || {})) // Not sure why, but sometimes the process never exits on Git Bash (MINGW64) .then(({code}) => process.exit(code)) .catch(err => { console.error(err); process.exit(1); }); };
'use strict'; const yarpm = require('../lib'); const argv = process.argv.slice(2); exports.run = function run(options) { yarpm(argv, Object.assign({stdin: process.stdin, stdout: process.stdout, stderr: process.stderr}, options || {})) // Not sure why, but sometimes the process never exits on Git Bash (MINGW64) .then((res) => process.exit(res.code)) .catch(err => { console.error(err); process.exit(1); }); };
Make it work on Node 4
Make it work on Node 4 Node 4 does not support destructuring.
JavaScript
mit
BendingBender/yarpm,BendingBender/yarpm
3f7dba1f6063671e1a0ec6f9b547c7aa05b85260
src/js/directives/textfit.js
src/js/directives/textfit.js
'use strict'; // Directive for using http://www.jacklmoore.com/autosize/ angular.module('Teem') .directive('textfit',[ '$timeout', function($timeout) { return { link: function(scope, element, attrs) { textFit(element); scope.$watch(attrs.ngBind, function() { $timeout(() => { textFit(element); }, 1000); // There should be a better way to do this :-( }); } }; }]);
'use strict'; // Directive for using http://www.jacklmoore.com/autosize/ angular.module('Teem') .directive('textfit',[ '$timeout', function($timeout) { return { link: function(scope, element, attrs) { scope.$watch(attrs.ngBind, function() { $timeout(() => { textFit(element); }, 1000); // There should be a better way to do this :-( }); } }; }]);
Remove first call to textFit
Remove first call to textFit
JavaScript
agpl-3.0
P2Pvalue/teem,P2Pvalue/teem,P2Pvalue/pear2pear,Grasia/teem,P2Pvalue/teem,Grasia/teem,P2Pvalue/pear2pear,Grasia/teem
115a2e1b9c0cad8c5a05c13a73569daff11c76a3
root/test/spec/controllers/action.js
root/test/spec/controllers/action.js
'use strict'; describe('Controller: ActionCtrl', function () { // load the controller's module beforeEach(module('nameApp')); var ActionCtrl, scope; // Initialize the controller and a mock scope beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); ActionCtrl = $controller('ActionCtrl', { $scope: scope }); })); it('should attach a list of awesomeThings to the scope', function () { expect(scope.awesomeThings.length).toBe(3); }); });
'use strict'; describe('Controller: ActionCtrl', function () { // load the controller's module beforeEach(module('geboHai')); var ActionCtrl, scope; // Initialize the controller and a mock scope beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); ActionCtrl = $controller('ActionCtrl', { $scope: scope }); })); it('should attach a list of awesomeThings to the scope', function () { expect(scope.awesomeThings.length).toBe(3); }); });
Correct app name in ActionCtrl tests
Correct app name in ActionCtrl tests
JavaScript
mit
RaphaelDeLaGhetto/grunt-init-gebo-hai
1c0597d51a0ff4646bff7ffe895cd7ac8c1e77c2
client/components/Loading.js
client/components/Loading.js
import React from 'react'; import { CircularProgress } from 'material-ui/Progress'; import Text from './Text'; const Loading = ({ message }) => ( <div className="loading"> <CircularProgress size={300} thickness={7} mode="indeterminate" /> <Text>{message}</Text> <style jsx>{` .loading { width: 100%; text-align: center; } `}</style> </div> ); export default Loading;
import React from 'react'; import { CircularProgress } from 'material-ui/Progress'; import Text from './Text'; const Loading = ({ message }) => ( <div className="loading"> <CircularProgress size={300} mode="indeterminate" /> <Text>{message}</Text> <style jsx>{` .loading { width: 100%; text-align: center; } `}</style> </div> ); export default Loading;
Remove obsolete prop from CircularProgress.
client: Remove obsolete prop from CircularProgress.
JavaScript
mit
u-wave/hub
ae3c0d72e26ec037aac7290fbb248386e35a04c9
scripts/get-latest-platform-tests.js
scripts/get-latest-platform-tests.js
"use strict"; if (process.env.NO_UPDATE) { process.exit(0); } const path = require("path"); const fs = require("fs"); const request = require("request"); // Pin to specific version, reflecting the spec version in the readme. // // To get the latest commit: // 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url // 2. Press "y" on your keyboard to get a permalink // 3. Copy the commit hash const commitHash = "5de931eafc9ca8d6de6a138015311812943755ac"; const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`; const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`; const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests"); request.get(sourceURL) .pipe(fs.createWriteStream(path.resolve(targetDir, "urltestdata.json"))); request.get(setterSourceURL) .pipe(fs.createWriteStream(path.resolve(targetDir, "setters_tests.json")));
"use strict"; if (process.env.NO_UPDATE) { process.exit(0); } const path = require("path"); const fs = require("fs"); const request = require("request"); // Pin to specific version, reflecting the spec version in the readme. // // To get the latest commit: // 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url // 2. Press "y" on your keyboard to get a permalink // 3. Copy the commit hash const commitHash = "634175d64d1f3ec26e2a674b294e71738624c77c"; const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`; const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`; const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests"); request.get(sourceURL) .pipe(fs.createWriteStream(path.resolve(targetDir, "urltestdata.json"))); request.get(setterSourceURL) .pipe(fs.createWriteStream(path.resolve(targetDir, "setters_tests.json")));
Update to include latest web platform tests
Update to include latest web platform tests Includes https://github.com/w3c/web-platform-tests/pull/5146.
JavaScript
mit
jsdom/whatwg-url,jsdom/whatwg-url,jsdom/whatwg-url
a2b90b5f99c4b4bf0b9049001b1288cc57128259
src/routes/index.js
src/routes/index.js
const router = require('express').Router() const nonUser = require('./non-user') const user = require('./user-only') router.use((req, res, next) => { let loggedIn = false if (req.session.user) { loggedIn = true } res.locals = {loggedIn} next() }) router.use('/', nonUser) router.use('/', user) module.exports = router
const router = require('express').Router() const nonUser = require('./non-user') const user = require('./user-only') router.use((req, res, next) => { let loggedIn = false let userId = null if (req.session.user) { loggedIn = true userId = req.session.user.user_id } res.locals = {loggedIn, userId} console.log(res.locals); next() }) router.use('/', nonUser) router.use('/', user) module.exports = router
Add user id of logged in user to res.locals
Add user id of logged in user to res.locals
JavaScript
mit
Maighdlyn/phase-4-challenge,Maighdlyn/phase-4-challenge,Maighdlyn/phase-4-challenge
b23cdded1bd8067bbd6312dc38379bf7f22b5769
src/scripts/main.js
src/scripts/main.js
/*global jQuery:false*/ (function($) { function equalize() { var elements = $('.left, .right'); var max_height = Math.max.apply( null, elements.map(function(index, elt) { return $(elt).height(); }) ); elements.each(function(index, elt) { var last_child = $('section', elt).last()[0]; $(last_child).css({}); $(elt).height(max_height); var parent_bbox = elt.getBoundingClientRect(); var last_child_bbox = last_child.getBoundingClientRect(); var d = parent_bbox.bottom - last_child_bbox.bottom; $(last_child).height(last_child_bbox.height + d); }); } $(window) .load(equalize) .on('resize', equalize); })(jQuery);
/*global jQuery:false*/ (function($) { function equalize() { var elements = $('.left, .right'); var max_height = Math.max.apply( null, elements.map(function(index, elt) { return $(elt).height(); }) ); elements.each(function(index, elt) { var last_child = $('section', elt).last()[0]; $(last_child).css({}); $(elt).height(max_height); var parent_bbox = elt.getBoundingClientRect(); var last_child_bbox = last_child.getBoundingClientRect(); var d = parent_bbox.bottom - last_child_bbox.bottom; $(last_child).height(last_child_bbox.height + d); }); } function before_print() { $('.left, .right').each(function(index, elt) { $(elt).add($('section', elt).last()[0]).removeAttr('style'); }); } $(window) .load(equalize) .on('resize', equalize); if (window.matchMedia) { window.matchMedia('print').addListener(function(mql) { if (mql.matches) { before_print(); } else { equalize(); } }); } })(jQuery);
Disable column equalization before print.
Disable column equalization before print.
JavaScript
mit
NealRame/CV,NealRame/Blog,NealRame/Blog,NealRame/Blog,NealRame/CV
0e00766548766aa280a0a5410c4019745e20c46e
lib/transport/browser/websocket.js
lib/transport/browser/websocket.js
'use strict'; var Driver = global.WebSocket || global.MozWebSocket; if (Driver) { module.exports = function WebSocketBrowserDriver(url) { return new Driver(url); }; }
'use strict'; var Driver = global.WebSocket || global.MozWebSocket; if (Driver) { module.exports = function WebSocketBrowserDriver(url) { return new Driver(url); }; } else { module.exports = undefined; }
FIX error with webpack when WebSocket not exists
FIX error with webpack when WebSocket not exists When building with webpack and you didn't define module.exports it will default to an empty object {} So when transport.enabled test !!WebSocketDriver it returns true instead of false.
JavaScript
mit
sockjs/sockjs-client,sockjs/sockjs-client,sockjs/sockjs-client
8db5f375995f8b9f77679badab0e03beba9062c7
config/webpack/development.js
config/webpack/development.js
// Note: You must restart bin/webpack-watcher for changes to take effect const merge = require('webpack-merge') const common = require('./common.js') const { resolve } = require('path') const { devServer, publicPath, paths } = require('./configuration.js') module.exports = merge(common, { devtool: 'sourcemap', stats: { errorDetails: true }, output: { pathinfo: true }, devServer: { host: devServer.host, port: devServer.port, contentBase: resolve(paths.output, paths.entry), publicPath } })
// Note: You must restart bin/webpack-watcher for changes to take effect const merge = require('webpack-merge') const common = require('./common.js') const { resolve } = require('path') const { devServer, publicPath, paths } = require('./configuration.js') module.exports = merge(common, { devtool: 'sourcemap', stats: { errorDetails: true }, output: { pathinfo: true }, devServer: { host: devServer.host, port: devServer.port, contentBase: resolve(paths.output, paths.entry), proxy: {'/': 'http://localhost:9000'}, publicPath } })
Use webpack dev server as proxy to rails
Use webpack dev server as proxy to rails
JavaScript
agpl-3.0
jgraichen/mnemosyne-server,jgraichen/mnemosyne-server,jgraichen/mnemosyne-server
94f16a05a78b2bf71c01f47e2bb575cc68db709a
config/webpack/loaders/vue.js
config/webpack/loaders/vue.js
const { dev_server: devServer } = require('@rails/webpacker').config; const isProduction = process.env.NODE_ENV === 'production'; const inDevServer = process.argv.find(v => v.includes('webpack-dev-server')); const extractCSS = !(inDevServer && (devServer && devServer.hmr)) || isProduction; module.exports = { test: /\.vue(\.erb)?$/, use: [{ loader: 'vue-loader', options: {extractCSS, // Enabled to prevent annotations from incurring incorrect // offsets due to extra whitespace in templates // TODO - the next Vue release introduces an even more useful // type of whitespace trimming: https://github.com/vuejs/vue/issues/9208#issuecomment-450012518 preserveWhitespace: false} }] };
const { dev_server: devServer } = require('@rails/webpacker').config; const isProduction = process.env.NODE_ENV === 'production'; const inDevServer = process.argv.find(v => v.includes('webpack-dev-server')); const extractCSS = !(inDevServer && (devServer && devServer.hmr)) || isProduction; module.exports = { test: /\.vue(\.erb)?$/, use: [{ loader: 'vue-loader', options: {extractCSS, // Enabled to prevent annotations from incurring incorrect // offsets due to extra whitespace in templates whitespace: 'condense'} }] };
Use new Vue whitespace optimization
Use new Vue whitespace optimization
JavaScript
agpl-3.0
harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o
575d973524bd2d953a9615c66dcf8e409e40bab9
console/server/node-server.js
console/server/node-server.js
const MONGOOSE_CONSOLE_DEFAULT_PORT = 8080; const PROMETHEUS_CONFIGURATION_PATH = '/configuration/prometheus.yml'; var express = require('express'); var bodyParser = require('body-parser'); var fs = require('fs'); var app = express(); var path = __dirname + ''; var port = process.env.CONSOLE_PORT || MONGOOSE_CONSOLE_DEFAULT_PORT; app.use(express.static(path)); app.use(bodyParser.json()); // NOTE: Supporting JSON-encoded bodies app.use(express.multipart()); // NOTE: We're saving Prometheus configuration via the server // NOTE: Configurating server to serve index.html since during the production ... // build Angular converts its html's to only one file. app.get('*', function(req, res) { res.sendFile(path + '/index.html'); }); app.post('/savefile', function (req, res) { var fileName = req.body.fileName; var fileContent = req.body.fileContent; var stream = fs.createWriteStream(fileName); stream.once('open', function () { stream.write(fileContent); stream.end(); }); fs.writeFile(PROMETHEUS_CONFIGURATION_PATH, fileContent, function(err) { if(err) { return console.log(err); } console.log("Prometheus configuration has been updated."); }); }); app.listen(port);
const MONGOOSE_CONSOLE_DEFAULT_PORT = 8080; const PROMETHEUS_CONFIGURATION_PATH = '/configuration/prometheus.yml'; var express = require('express'); var bodyParser = require('body-parser'); var fs = require('fs'); var cors = require('cors') var app = express(); var path = __dirname + ''; var port = process.env.CONSOLE_PORT || MONGOOSE_CONSOLE_DEFAULT_PORT; app.use(express.static(path)); app.use(bodyParser.json()); // NOTE: Supporting JSON-encoded bodies app.use(express.multipart()); // NOTE: We're saving Prometheus configuration via the server // NOTE: CORS configuration app.use(cors()) app.options('*', cors()); // NOTE: Configurating server to serve index.html since during the production ... // build Angular converts its html's to only one file. app.get('*', function(req, res) { res.sendFile(path + '/index.html'); }); app.post('/savefile', function (req, res) { var fileName = req.body.fileName; var fileContent = req.body.fileContent; // var stream = fs.createWriteStream(fileName); // stream.once('open', function () { // stream.write(fileContent); // stream.end(); // }); console.log("File name:", fileName); console.log("File content: ", fileContent); fs.writeFile(PROMETHEUS_CONFIGURATION_PATH, fileContent, function(err) { if(err) { return console.log(err); } console.log("Prometheus configuration has been updated."); }); }); app.listen(port);
Add CORS to node server.
Add CORS to node server.
JavaScript
mit
emc-mongoose/console,emc-mongoose/console,emc-mongoose/console
b30815c324d90e99bb3fca25eb6d00b5cdfef4e8
markup/components/header/header.js
markup/components/header/header.js
/* eslint-disable */ $('.nav-toggle').click(function (e) { $('.nav-menu').slideToggle(500); }); debounce(function(){ $(window).resize(function(){ if($(window).width() > 720){ $('.nav-menu').removeAttr('style'); } }); }, 200); /* eslint-enable */
/* eslint-disable */ $('.nav-toggle').click(function (e) { $('.nav-menu').slideToggle(500); }); $(window).resize(function(){ if($(window).width() > 720){ $('.nav-menu').removeAttr('style'); } }); /* eslint-enable */
FIX - поправлен JS для адаптива меню
FIX - поправлен JS для адаптива меню
JavaScript
mit
agolomazov/bouncy,agolomazov/bouncy
415b7d0250887764ee9836ee823be07d45708173
api/models/Y.js
api/models/Y.js
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Y Model * ========== */ var Y = new keystone.List('Y'); Y.add({ name: { type: Types.Name, required: true, index: true }, email: { type: Types.Email, initial: true, required: true, index: true }, password: { type: Types.Password, initial: true, required: true, hidden: true, }, }, 'Permissions', { isAdmin: { type: Boolean, label: 'Can access Keystone', index: true }, }); // Provide access to Keystone Y.schema.virtual('canAccessKeystone').get(function () { return this.isAdmin; }); /** * Relationships */ Y.relationship({ ref: 'Post', path: 'posts', refPath: 'author' }); /** * Registration */ Y.defaultColumns = 'name, email, isAdmin'; Y.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Y Model * ========== */ var Y = new keystone.List('Y'); Y.add({ name: { type: Types.Name, required: true, index: true }, email: { type: Types.Email, initial: true, required: true, index: true }, password: { type: Types.Password, initial: true, required: true, }, }, 'Permissions', { isAdmin: { type: Boolean, label: 'Can access Keystone', index: true }, }); // Provide access to Keystone Y.schema.virtual('canAccessKeystone').get(function () { return this.isAdmin; }); /** * Relationships */ Y.relationship({ ref: 'Post', path: 'posts', refPath: 'author' }); /** * Registration */ Y.defaultColumns = 'name, email, isAdmin'; Y.register();
Remove password as hidden field
Remove password as hidden field
JavaScript
mit
chrisslater/snapperfish
941c1565dbc89005b99b9302370028cbd5c820c1
components/LandingPageHero.js
components/LandingPageHero.js
import React from 'react'; import Helmet from 'react-helmet'; import Hero from './Hero'; const LandingPageHero = ({ title, headline }, { modals }) => { return ( <div> <Helmet title={title} /> <Hero headline={headline} textline={`Increase your productivity, focus on new features, and scale beyond millions of users without managing servers.`} image={ <img src={require('../pages/home/build-powerful-apps-in-half-the-time.svg')} alt="serverless app platform" /> } > <div className="hero__text__button-container"> <span className="button button--large button--featured" onClick={modals.signUp.open} > Get Started for Free </span> <p className="hero__text__button-description"> 6 months free &bull; No credit card required </p> </div> </Hero> </div> ); }; LandingPageHero.defaultProps = { title: 'Build powerful apps in half the time | Syncano', headline: <span>Build powerfulapps<br />in half the time</span> }; LandingPageHero.contextTypes = { modals: React.PropTypes.object }; export default LandingPageHero;
import React from 'react'; import Helmet from 'react-helmet'; import Hero from './Hero'; const LandingPageHero = ({ title, headline }, { modals }) => { return ( <div> <Helmet title={title} /> <Hero headline={headline} textline={`Increase your productivity, focus on new features, and scale beyond millions of users without managing servers.`} image={ <img src={require('../pages/home/build-powerful-apps-in-half-the-time.svg')} alt="serverless app platform" /> } > <div className="hero__text__button-container"> <span className="button button--large button--featured" onClick={modals.signUp.open} > Get Started for Free </span> <p className="hero__text__button-description"> 6 months free &bull; No credit card required </p> </div> </Hero> </div> ); }; LandingPageHero.defaultProps = { title: 'Build powerful apps in half the time | Syncano', headline: <span>Build powerful apps<br />in half the time</span> }; LandingPageHero.contextTypes = { modals: React.PropTypes.object }; export default LandingPageHero;
Fix typo in "powerful apps"
[WEB-465] Fix typo in "powerful apps"
JavaScript
mit
Syncano/syncano.com,Syncano/syncano.com
3fe151d044e6a6f4ea957e3a75105a45a2865314
build/karma.base.js
build/karma.base.js
const buble = require('rollup-plugin-buble'); const nodeResolve = require('rollup-plugin-node-resolve'); const commonJS = require('rollup-plugin-commonjs'); module.exports = { frameworks: ['jasmine', 'sinon'], files: [ { pattern: '../src/**/*.js', watched: process.env.CI === 'true', included: false, }, { pattern: '../spec/**/*.spec.js', watched: process.env.CI === 'true', }, ], preprocessors: { '../spec/**/*.spec.js': ['rollup'], }, rollupPreprocessor: { format: 'iife', sourceMap: 'inline', plugins: [commonJS(), nodeResolve(), buble()], }, plugins: [ 'karma-jasmine', 'karma-sinon', 'karma-rollup-plugin', 'karma-spec-reporter', ], reporters: ['spec'], };
const buble = require('rollup-plugin-buble'); const nodeResolve = require('rollup-plugin-node-resolve'); const commonJS = require('rollup-plugin-commonjs'); module.exports = { frameworks: ['jasmine', 'sinon'], files: [ { pattern: '../src/**/*.js', watched: process.env.CI !== 'true', included: false, }, { pattern: '../spec/**/*.spec.js', watched: process.env.CI !== 'true', }, ], preprocessors: { '../spec/**/*.spec.js': ['rollup'], }, rollupPreprocessor: { format: 'iife', sourceMap: 'inline', plugins: [commonJS(), nodeResolve(), buble()], }, plugins: [ 'karma-jasmine', 'karma-sinon', 'karma-rollup-plugin', 'karma-spec-reporter', ], reporters: ['spec'], };
Fix karma config. Watch files when not CI environment.
Fix karma config. Watch files when not CI environment.
JavaScript
mit
demiazz/lighty
7652f2b6ac6e0602d5d3746e9c42173cf3730622
templates/add-service/web-express-es6/app/index.js
templates/add-service/web-express-es6/app/index.js
// This is the main server file. // // It parses the command line and instantiates the two servers for this app: const async = require('async') const {cyan, dim, green, red} = require('chalk') const ExoRelay = require('exorelay'); const N = require('nitroglycerin'); const {name, version} = require('../package.json') const WebServer = require('./web-server'); function startExorelay (done) { global.exorelay = new ExoRelay({serviceName: process.env.SERVICE_NAME, exocomPort: process.env.EXOCOM_PORT}) global.exorelay.on('error', (err) => { console.log(red(err)) }) global.exorelay.on('online', (port) => { console.log(`${green('ExoRelay')} online at port ${cyan(port)}`) done() }) global.exorelay.listen(process.env.EXORELAY_PORT) } function startWebServer (done) { const webServer = new WebServer; webServer.on('error', (err) => { console.log(red(err)) }) webServer.on('listening', () => { console.log(`${green('HTML server')} online at port ${cyan(webServer.port())}`) done() }) webServer.listen(3000) } startExorelay( N( () => { startWebServer( N( () => { console.log(green('all systems go')) })) }))
// This is the main server file. // // It parses the command line and instantiates the two servers for this app: const async = require('async') const {cyan, dim, green, red} = require('chalk') const ExoRelay = require('exorelay'); const N = require('nitroglycerin'); const {name, version} = require('../package.json') const WebServer = require('./web-server') const port = process.env.PORT || 3000 function startExorelay (done) { global.exorelay = new ExoRelay({serviceName: process.env.SERVICE_NAME, exocomPort: process.env.EXOCOM_PORT}) global.exorelay.on('error', (err) => { console.log(red(err)) }) global.exorelay.on('online', (port) => { console.log(`${green('ExoRelay')} online at port ${cyan(port)}`) done() }) global.exorelay.listen(process.env.EXORELAY_PORT) } function startWebServer (done) { const webServer = new WebServer; webServer.on('error', (err) => { console.log(red(err)) }) webServer.on('listening', () => { console.log(`${green('HTML server')} online at port ${cyan(webServer.port())}`) done() }) webServer.listen(port) } startExorelay( N( () => { startWebServer( N( () => { console.log(green('all systems go')) })) }))
Make the web port configurable
Make the web port configurable
JavaScript
mit
Originate/exosphere,Originate/exosphere,Originate/exosphere,Originate/exosphere
476b864d53a63fd211b2faa6c40f9be4b1454526
ui/src/shared/middleware/errors.js
ui/src/shared/middleware/errors.js
// import {replace} from 'react-router-redux' import {authReceived, meReceived} from 'shared/actions/auth' import {publishNotification as notify} from 'shared/actions/notifications' import {HTTP_FORBIDDEN} from 'shared/constants' const errorsMiddleware = store => next => action => { if (action.type === 'ERROR_THROWN') { const {error, error: {status, auth}} = action console.error(error) if (status === HTTP_FORBIDDEN) { const {auth: {me}} = store.getState() const wasSessionTimeout = me === null store.dispatch(authReceived(auth)) store.dispatch(meReceived(null)) if (wasSessionTimeout) { store.dispatch(notify('error', 'Please login to use Chronograf.')) } else { store.dispatch(notify('error', 'Session timed out. Please login again.')) } } else { store.dispatch(notify('error', 'Cannot communicate with server.')) } } next(action) } export default errorsMiddleware
// import {replace} from 'react-router-redux' import {authExpired} from 'shared/actions/auth' import {publishNotification as notify} from 'shared/actions/notifications' import {HTTP_FORBIDDEN} from 'shared/constants' const errorsMiddleware = store => next => action => { if (action.type === 'ERROR_THROWN') { const {error, error: {status, auth}} = action console.error(error) if (status === HTTP_FORBIDDEN) { const {auth: {me}} = store.getState() const wasSessionTimeout = me !== null next(authExpired(auth)) if (wasSessionTimeout) { store.dispatch(notify('error', 'Session timed out. Please login again.')) } else { store.dispatch(notify('error', 'Please login to use Chronograf.')) } } else { store.dispatch(notify('error', 'Cannot communicate with server.')) } } next(action) } export default errorsMiddleware
Use authExpired action; fix session timeout notification logic
Use authExpired action; fix session timeout notification logic
JavaScript
agpl-3.0
brianbaker/chronograf,brianbaker/chronograf,brianbaker/chronograf,brianbaker/chronograf,brianbaker/chronograf
b5b6d9b04bec0c9e937441a60dcac34f30e0a041
dataprep-webapp/src/app/components/preparation/creator/datasets-filters/datasets-filters-controller.js
dataprep-webapp/src/app/components/preparation/creator/datasets-filters/datasets-filters-controller.js
/* ============================================================================ Copyright (C) 2006-2016 Talend Inc. - www.talend.com This source code is available under agreement available at https://github.com/Talend/data-prep/blob/master/LICENSE You should have received a copy of the agreement along with this program; if not, write to Talend SA 9 rue Pages 92150 Suresnes, France ============================================================================*/ class DatasetsFiltersCtrl { constructor() { 'ngInject'; // The order is important this.datasetsFilters = [ { value: 'RECENT_DATASETS', imageUrl: '/assets/images/inventory/recent-datasets.png', description: 'RECENT_DATASETS_DESCRIPTION', isSelected: true }, { value: 'FAVORITE_DATASETS', icon: 'f', description: 'FAVORITE_DATASETS_DESCRIPTION' }, { value: 'CERTIFIED_DATASETS', imageUrl: '/assets/images/inventory/certified_no_shadow.png', description: 'CERTIFIED_DATASETS_DESCRIPTION' }, { value: 'ALL_DATASETS', imageUrl: '/assets/images/inventory/all-datasets.png', description: 'ALL_DATASETS_DESCRIPTION' } ]; this.selectedFilter = this.datasetsFilters[0]; } selectFilter(filter) { if (this.importing) { return; } this.selectedFilter.isSelected = false; this.selectedFilter = filter; this.selectedFilter.isSelected = true; this.onFilterSelect({ filter: filter.value }); } } export default DatasetsFiltersCtrl;
/* ============================================================================ Copyright (C) 2006-2016 Talend Inc. - www.talend.com This source code is available under agreement available at https://github.com/Talend/data-prep/blob/master/LICENSE You should have received a copy of the agreement along with this program; if not, write to Talend SA 9 rue Pages 92150 Suresnes, France ============================================================================*/ class DatasetsFiltersCtrl { constructor() { 'ngInject'; // The order is important this.datasetsFilters = [ { value: 'RECENT_DATASETS', imageUrl: '/assets/images/inventory/recent-datasets.png', description: 'RECENT_DATASETS_DESCRIPTION', isSelected: true }, { value: 'FAVORITE_DATASETS', icon: 'f', description: 'FAVORITE_DATASETS_DESCRIPTION' }, { value: 'ALL_DATASETS', imageUrl: '/assets/images/inventory/all-datasets.png', description: 'ALL_DATASETS_DESCRIPTION' } ]; this.selectedFilter = this.datasetsFilters[0]; } selectFilter(filter) { if (this.importing) { return; } this.selectedFilter.isSelected = false; this.selectedFilter = filter; this.selectedFilter.isSelected = true; this.onFilterSelect({ filter: filter.value }); } } export default DatasetsFiltersCtrl;
Fix unit test following merge of maintenance/1.2.0 changes.
[Test] Fix unit test following merge of maintenance/1.2.0 changes.
JavaScript
apache-2.0
Talend/data-prep,Talend/data-prep,Talend/data-prep
0b5f74f9d0a3ab08b742a537e1e900765f8f52d8
packages/resourceful-redux/src/utils/get-resources.js
packages/resourceful-redux/src/utils/get-resources.js
// Returns a list of resources by IDs or label export default function(state, resourceName, idsOrLabel) { const resourceSlice = state[resourceName]; if (!resourceSlice) { return []; } const resources = resourceSlice.resources; let idsList; // This conditional handles the situation where `idsOrLabel` is an ID if (typeof idsOrLabel === 'string') { const label = resourceSlice.labels[idsOrLabel]; if (!label) { return []; } const labelIds = label.ids; if (!labelIds) { return []; } idsList = labelIds; } else { idsList = idsOrLabel; } if (!(idsList && idsList.length)) { return []; } return idsList.map(id => resources[id]).filter(Boolean); }
// Returns a list of resources by IDs or list name export default function(state, resourceName, idsOrList) { const resourceSlice = state[resourceName]; if (!resourceSlice) { return []; } const resources = resourceSlice.resources; let idsList; // This conditional handles the situation where `idsOrList` is an list name if (typeof idsOrList === 'string') { const list = resourceSlice.lists[idsOrList]; if (!list) { return []; } idsList = list.ids; } else { idsList = idsOrList; } if (!(idsList && idsList.length)) { return []; } return idsList.map(id => resources[id]).filter(Boolean); }
Update getResources to support lists, not labels
Update getResources to support lists, not labels
JavaScript
mit
jmeas/resourceful-redux,jmeas/resourceful-redux
77749a3cc52eb8ebabbdb0f13a58338fd543b6bd
src/environment-settings-template.js
src/environment-settings-template.js
// Here you can add settings which change per environment. This file will be also used by the buildserver to inject environment specific values. // Settings are made available through the configService. var environmentSettings = { host: 'localhost', port: 8001 } // Leave line below untouched. This how gulp file is also able to use this settings file. ('require' needs a module) module.exports = environmentSettings;
// Here you can add settings which change per environment. This file will be also used by the buildserver to inject environment specific values. // Settings are made available through the configService. var environmentSettings = { host: 'localhost', port: 8001 } // Leave lines below untouched. This how gulp file is also able to use this settings file. ('require' needs a module) if(typeof module !== 'undefined'){ module.exports = environmentSettings; };
Fix for module error in console.
Fix for module error in console.
JavaScript
mit
robinvanderknaap/SkaeleFrontend,robinvanderknaap/SkaeleFrontend
a5bc2b05f6a2d948d596cb562796be98cfbd1d49
packages/ember-model/lib/adapter.js
packages/ember-model/lib/adapter.js
Ember.Adapter = Ember.Object.extend({ find: function(record, id) { throw new Error('Ember.Adapter subclasses must implement find'); }, findQuery: function(record, id) { throw new Error('Ember.Adapter subclasses must implement findQuery'); }, findMany: function(record, id) { throw new Error('Ember.Adapter subclasses must implement findMany'); }, findAll: function(klass, records) { throw new Error('Ember.Adapter subclasses must implement findAll'); }, load: function(record, id, data) { record.load(id, data); }, createRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement createRecord'); }, saveRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement saveRecord'); }, deleteRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement deleteRecord'); } });
Ember.Adapter = Ember.Object.extend({ find: function(record, id) { throw new Error('Ember.Adapter subclasses must implement find'); }, findQuery: function(klass, records, params) { throw new Error('Ember.Adapter subclasses must implement findQuery'); }, findMany: function(klass, records, ids) { throw new Error('Ember.Adapter subclasses must implement findMany'); }, findAll: function(klass, records) { throw new Error('Ember.Adapter subclasses must implement findAll'); }, load: function(record, id, data) { record.load(id, data); }, createRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement createRecord'); }, saveRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement saveRecord'); }, deleteRecord: function(record) { throw new Error('Ember.Adapter subclasses must implement deleteRecord'); } });
Update Adapter to match API
Update Adapter to match API
JavaScript
mit
greyhwndz/ember-model,juggy/ember-model,gmedina/ember-model,sohara/ember-model,ipavelpetrov/ember-model,asquet/ember-model,ebryn/ember-model,GavinJoyce/ember-model,zenefits/ember-model,c0achmcguirk/ember-model,asquet/ember-model,ipavelpetrov/ember-model,CondeNast/ember-model,Swrve/ember-model,ckung/ember-model,julkiewicz/ember-model,intercom/ember-model,igorgoroshit/ember-model
0ede5818a3dd1d087ef4a01511d83a76390a35e3
app/scripts/directives/help-icon.js
app/scripts/directives/help-icon.js
'use strict'; (function() { angular.module('ncsaas') .directive('helpicon', ['$document', helpicon]); function helpicon($document) { return { restrict: 'E', templateUrl: "views/directives/help-icon.html", replace: true, scope: { helpText: '@' }, link: function ($scope, element) { var trigger = element; var text = trigger.find('span'); trigger.css('position', 'relative'); trigger.bind('click', function(){ if (!text.hasClass('active')) { text.addClass('active'); text.css({ 'position': 'absolute', 'top': -(text[0].offsetHeight + 4) + 'px', 'left': '50%', 'margin-left': -text[0].offsetWidth/2 + 'px' }) } else { text.removeClass('active'); } }); } }; } })();
'use strict'; (function() { angular.module('ncsaas') .directive('helpicon', ['$document', helpicon]); function helpicon($document) { return { restrict: 'E', templateUrl: "views/directives/help-icon.html", replace: true, scope: { helpText: '@' }, link: function (scope, element) { var trigger = element; var text = trigger.find('span'); trigger.css('position', 'relative'); trigger.bind('click', function(event){ if (!text.hasClass('active')) { text.addClass('active'); text.css({ 'position': 'absolute', 'top': -(text[0].offsetHeight + 4) + 'px', 'left': '50%', 'margin-left': -text[0].offsetWidth/2 + 'px' }) } else { text.removeClass('active'); } event.stopPropagation(); }); $document.bind('click', function() { text.removeClass('active'); }) } }; } })();
Hide help text if click outside element.
Hide help text if click outside element. – SAAS-457
JavaScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
266e31e911e1337589aa5134efd194de6b124551
src/scripts/content/toggl.js
src/scripts/content/toggl.js
'use strict'; var userData, offlineUser; offlineUser = localStorage.getItem('offline_users'); if (offlineUser) { userData = JSON.parse(localStorage.getItem('offline_users-' + offlineUser)); if (userData && userData.offlineData) { chrome.extension.sendMessage({ type: 'userToken', apiToken: userData.offlineData.api_token }); } } (function() { var version, source, s; source = `window.TogglButton = { version: "${process.env.VERSION}" }`; s = document.createElement('script'); s.textContent = source; document.body.appendChild(s); })(); document.addEventListener('webkitvisibilitychange', function() { if (!document.webkitHidden) { chrome.extension.sendMessage({ type: 'sync' }, function() { return; }); } }); chrome.extension.sendMessage({ type: 'sync' }, function() { return; });
'use strict'; var userData, offlineUser; offlineUser = localStorage.getItem('offline_users'); if (offlineUser) { userData = JSON.parse(localStorage.getItem('offline_users-' + offlineUser)); if (userData && userData.offlineData) { chrome.extension.sendMessage({ type: 'userToken', apiToken: userData.offlineData.api_token }); } } (function() { var source, s; const version = chrome.runtime.getManifest().version; source = `window.TogglButton = { version: "${version}" }`; s = document.createElement('script'); s.textContent = source; document.body.appendChild(s); })(); document.addEventListener('webkitvisibilitychange', function() { if (!document.webkitHidden) { chrome.extension.sendMessage({ type: 'sync' }, function() { return; }); } }); chrome.extension.sendMessage({ type: 'sync' }, function() { return; });
Fix process undefined in content script
Fix process undefined in content script Fixes #1113.
JavaScript
bsd-3-clause
glensc/toggl-button,glensc/toggl-button,glensc/toggl-button
94a9e274fa01e834bd88e9b03dcba8a1c643120d
build/tasks/durandal.js
build/tasks/durandal.js
var gulp = require('gulp'); //var gutil = require('gulp-util'); var fs = require('fs'); var durandal = require('gulp-durandal'); var header = require('gulp-header'); var paths = require('../paths'); gulp.task('durandal', function() { var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); var banner = ['/**', ' * Copyright (c) <%= new Date().getFullYear() %> - <%= author %>', ' * <%= name %> - <%= description %>', ' * @built <%= new Date().toISOString() %>', ' * @version v<%= version %>', ' * @link <%= homepage %>', ' * @license <%= license %>', ' */', ''].join('\n'); return durandal({ baseDir: paths.root, main: 'main.js', output: 'main.js', almond: true, minify: true, rjsConfigAdapter: function(cfg) { cfg.preserveLicenseComments = true; cfg.generateSourceMaps = false; cfg.uglify2 = { output: { beautify: false }, compress: { sequences: false, global_defs: { DEBUG: false }, drop_console: true }, warnings: true, mangle: false }; return cfg; } }) .pipe(header(banner, pkg)) .pipe(gulp.dest(paths.output + paths.root)); });
var gulp = require('gulp'); var fs = require('fs'); var durandal = require('gulp-durandal'); var header = require('gulp-header'); var paths = require('../paths'); gulp.task('durandal', function() { var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); var banner = ['/**', ' * Copyright (c) <%= new Date().getFullYear() %> - <%= author %>', ' * <%= name %> - <%= description %>', ' * @built <%= new Date().toISOString() %>', ' * @version v<%= version %>', ' * @link <%= homepage %>', ' * @license <%= license %>', ' */', ''].join('\n'); return durandal({ baseDir: paths.root, main: 'main.js', output: 'main.js', almond: true, minify: true, rjsConfigAdapter: function(cfg) { cfg.preserveLicenseComments = true; cfg.generateSourceMaps = false; cfg.uglify2 = { output: { beautify: false }, compress: { sequences: false, global_defs: { DEBUG: false }, drop_console: true }, warnings: true, mangle: false }; return cfg; } }) .pipe(header(banner, pkg)) .pipe(gulp.dest(paths.output + paths.root)); });
Add banner to built version
Add banner to built version
JavaScript
mit
mryellow/durandal-gulp-boilerplate,mryellow/durandal-gulp-boilerplate
ebd672e35424298de480a1e19c7ac57bd0b78e67
app/utils/socketIO.js
app/utils/socketIO.js
'use strict'; /* * Socket.io related things go ! */ import { log, LOG_TYPES } from './log'; import { decodeJWT } from './JWT'; const EVENT_TYPES = { DISCONNECT : 'disconnect', CONNECTION : 'connection', TOKEN_VALID : 'token_valid', TOKEN_INVALID : 'token_invalid', CONTACT_ONLINE : 'contact:online', CONTACT_OFFLINE : 'contact:offline' }; let io; let connections = []; function createSocketIO(server, app) { io = require('socket.io')(server); io.on(EVENT_TYPES.CONNECTION, (socket) => { socket.on(EVENT_TYPES.DISCONNECT, () => { log(`Socket disconnected with id ${socket.id}`, LOG_TYPES.WARN); let i = connections.indexOf(socket); connections.splice(i, 1); }); decodeJWT(socket.handshake.query.token) .then( results => { log(`Socket connected with id ${socket.id}`); socket.emit('token_valid', {}); socket.user = results; connections.push(socket); }) .catch(error => { log(`Token from ${socket.id} is invalid`, LOG_TYPES.ALERT) socket.emit('token_invalid', {}); socket.disconnect(true); }) }); } export { io, connections, createSocketIO, EVENT_TYPES }
'use strict'; /* * Socket.io related things go ! */ import { log, LOG_TYPES } from './log'; import { decodeJWT } from './JWT'; import models from '../models'; const User = models.User; const EVENT_TYPES = { DISCONNECT : 'disconnect', CONNECTION : 'connection', TOKEN_VALID : 'token_valid', TOKEN_INVALID : 'token_invalid', CONTACT_ONLINE : 'contact:online', CONTACT_OFFLINE : 'contact:offline' }; let io; let connections = []; function createSocketIO(server, app) { io = require('socket.io')(server); io.on(EVENT_TYPES.CONNECTION, (socket) => { socket.on(EVENT_TYPES.DISCONNECT, () => { log(`Socket disconnected with id ${socket.id}`, LOG_TYPES.WARN); let i = connections.indexOf(socket); connections.splice(i, 1); }); decodeJWT(socket.handshake.query.token) .then( results => { log(`Socket connected with id ${socket.id}`); socket.emit('token_valid', {}); let lastSeen = Date.now(); results.lastSeen = lastSeen; socket.user = results; User.update({ lastSeen: lastSeen }, { where: { id: results.id } }); connections.push(socket); }) .catch(error => { log(`Token from ${socket.id} is invalid`, LOG_TYPES.ALERT) socket.emit('token_invalid', {}); socket.disconnect(true); }) }); } export { io, connections, createSocketIO, EVENT_TYPES }
Update last seen date when connecting through socket.io
Update last seen date when connecting through socket.io
JavaScript
mit
learning-layers/sardroid-server,learning-layers/sardroid-server
f34ad58342958656ec4b15a828349af931ea2dc3
firefox/lib/main.js
firefox/lib/main.js
var self = require("sdk/self"); var panel = require("sdk/panel"); var initToolbar = function(freedom) { // create toolbarbutton var tbb = require("pathfinder/ui/toolbarbutton").ToolbarButton({ id: "UProxyItem", label: "UProxy", image: self.data.url("common/ui/icons/uproxy-19.png"), panel: initPanel(freedom.communicator) }); tbb.moveTo({ toolbarID: "nav-bar", forceMove: false // only move from palette }); }; var initPanel = function(freedomCommunicator) { var l10n = JSON.parse(self.data.load("l10n/en/messages.json")); var uproxyPanel = panel.Panel({ contentURL: self.data.url("common/ui/popup.html"), width: 450, height: 300 }); freedomCommunicator.addContentContext(uproxyPanel); uproxyPanel.port.on("show", function() { uproxyPanel.port.emit("l10n", l10n); }); return uproxyPanel; }; var freedomEnvironment = require('./init_freedom').InitFreedom(); // TODO: Remove when uproxy.js no longer uses setTimeout // and replace with the line: // initToolbar(freedomEnvironment); require('sdk/timers').setTimeout(initToolbar, 20, freedomEnvironment);
var self = require("sdk/self"); var panel = require("sdk/panel"); var initToolbar = function(freedom) { // create toolbarbutton var tbb = require("pathfinder/ui/toolbarbutton").ToolbarButton({ id: "UProxyItem", label: "UProxy", image: self.data.url("common/ui/icons/uproxy-19.png"), panel: initPanel(freedom.communicator) }); tbb.moveTo({ toolbarID: "nav-bar", forceMove: false // only move from palette }); }; var initPanel = function(freedomCommunicator) { var l10n = JSON.parse(self.data.load("l10n/en/messages.json")); var uproxyPanel = panel.Panel({ contentURL: self.data.url("common/ui/popup.html"), width: 450, height: 300 }); freedomCommunicator.addContentContext(uproxyPanel); uproxyPanel.port.on("show", function() { uproxyPanel.port.emit("l10n", l10n); }); return uproxyPanel; }; var freedomEnvironment = require('./init_freedom').InitFreedom(); // TODO: Remove when uproxy.js no longer uses setTimeout // and replace with the line: // initToolbar(freedomEnvironment); require('sdk/timers').setTimeout(initToolbar, 500, freedomEnvironment);
Increase delay for loading toolbarbutton so that other components have a chance to load.
Increase delay for loading toolbarbutton so that other components have a chance to load.
JavaScript
apache-2.0
chinarustin/uproxy,jpevarnek/uproxy,jpevarnek/uproxy,uProxy/uproxy,itplanes/uproxy,dhkong88/uproxy,qida/uproxy,jpevarnek/uproxy,itplanes/uproxy,dhkong88/uproxy,chinarustin/uproxy,MinFu/uproxy,chinarustin/uproxy,chinarustin/uproxy,qida/uproxy,jpevarnek/uproxy,jpevarnek/uproxy,roceys/uproxy,IveWong/uproxy,itplanes/uproxy,roceys/uproxy,MinFu/uproxy,roceys/uproxy,roceys/uproxy,uProxy/uproxy,qida/uproxy,uProxy/uproxy,uProxy/uproxy,MinFu/uproxy,qida/uproxy,MinFu/uproxy,IveWong/uproxy,dhkong88/uproxy,uProxy/uproxy,dhkong88/uproxy,itplanes/uproxy,MinFu/uproxy,qida/uproxy,chinarustin/uproxy,itplanes/uproxy,IveWong/uproxy,roceys/uproxy,IveWong/uproxy,dhkong88/uproxy
0717d0940e525eb17831cac42093c6a67fc658f0
src/space-case.js
src/space-case.js
import R from 'ramda'; // a -> a const spaceCase = R.compose( R.trim, R.replace(/([a-z])([A-Z])/g, '$1 $2'), R.replace(/(\.|-|_)/g, ' ') ); export default spaceCase;
import R from 'ramda'; import compose from './util/compose.js'; // a -> a const spaceCase = compose( R.trim, R.replace(/([a-z])([A-Z])/g, '$1 $2'), R.replace(/(\.|-|_)/g, ' ') ); export default spaceCase;
Refactor spaceCase function to use custom compose function
Refactor spaceCase function to use custom compose function
JavaScript
mit
restrung/restrung-js
ddd5cae6fb518d8ea6c073ecbf90a20fc4bec8dd
src/components/box/boxProps.js
src/components/box/boxProps.js
import omit from 'lodash.omit'; import pick from 'lodash.pick'; const boxProps = [ 'alignContent', 'alignItems', 'alignSelf', 'borderWidth', 'borderBottomWidth', 'borderColor', 'borderLeftWidth', 'borderRightWidth', 'borderTint', 'borderTopWidth', 'boxSizing', 'className', 'display', 'element', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent', 'margin', 'marginHorizontal', 'marginVertical', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'order', 'overflow', 'overflowX', 'overflowY', 'padding', 'paddingHorizontal', 'paddingVertical', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', ]; const omitBoxProps = props => omit(props, boxProps); const pickBoxProps = props => pick(props, boxProps); export default boxProps; export { omitBoxProps, pickBoxProps };
import omit from 'lodash.omit'; import pick from 'lodash.pick'; const boxProps = [ 'alignContent', 'alignItems', 'alignSelf', 'borderWidth', 'borderBottomWidth', 'borderColor', 'borderLeftWidth', 'borderRightWidth', 'borderTint', 'borderTopWidth', 'borderRadius', 'boxSizing', 'className', 'display', 'element', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent', 'margin', 'marginHorizontal', 'marginVertical', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'order', 'overflow', 'overflowX', 'overflowY', 'padding', 'paddingHorizontal', 'paddingVertical', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', ]; const omitBoxProps = props => omit(props, boxProps); const pickBoxProps = props => pick(props, boxProps); export default boxProps; export { omitBoxProps, pickBoxProps };
Add borderRadius to the box prop list
Add borderRadius to the box prop list
JavaScript
mit
teamleadercrm/teamleader-ui
35cabf1fcf225e7d7168f12a52baca7c5728aa4a
frontend/app/js/containers/project/index.js
frontend/app/js/containers/project/index.js
import ServerboardView from 'app/components/project' import store from 'app/utils/store' import { projects_update_info } from 'app/actions/project' var Project=store.connect({ state(state){ if (state.project.current != "/" && localStorage.last_project != state.project.current){ localStorage.last_project = state.project.current } return { shortname: state.project.current, project: state.project.project, projects_count: (state.project.projects || []).length } }, handlers: (dispatch, props) => ({ goto(url){ console.log(url) store.goto(url.pathname, url.state) }, onAdd(){ dispatch( store.set_modal("project.add") ) }, onUpdate(){ dispatch( projects_update_info(props.params.project) ) } }), store_enter: (state, props) => [ () => projects_update_info(state.project.current), ], store_exit: (state, props) => [ () => projects_update_info(), ], subscriptions: ["service.updated"], watch: ["shortname"] }, ServerboardView) export default Project
import ServerboardView from 'app/components/project' import store from 'app/utils/store' import { projects_update_info } from 'app/actions/project' var Project=store.connect({ state(state){ if (state.project.current != "/" && localStorage.last_project != state.project.current){ localStorage.last_project = state.project.current } return { shortname: state.project.current, project: state.project.project, projects_count: (state.project.projects || []).length } }, handlers: (dispatch, props) => ({ goto(url){ console.log(url) store.goto(url.pathname || url, url.state) }, onAdd(){ dispatch( store.set_modal("project.add") ) }, onUpdate(){ dispatch( projects_update_info(props.params.project) ) } }), store_enter: (state, props) => [ () => projects_update_info(state.project.current), ], store_exit: (state, props) => [ () => projects_update_info(), ], subscriptions: ["service.updated"], watch: ["shortname"] }, ServerboardView) export default Project
Fix goto simple sections at sidebar
Fix goto simple sections at sidebar
JavaScript
apache-2.0
serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards
1b565f867fc123d54cb54c96fdb2e188ff71227a
renderer.js
renderer.js
// This file is required by the index.html file and will // be executed in the renderer process for that window. // All of the Node.js APIs are available in this process. const {clipboard} = require('electron') alert(clipboard.readText("String")) module.exports = function demoClipboard() { var text = clipboard.readText("String"); alert(text); }
// This file is required by the index.html file and will // be executed in the renderer process for that window. // All of the Node.js APIs are available in this process. const {clipboard} = require('electron') module.exports = function demoClipboard() { var text = clipboard.readText("String"); alert(text); }
Remove alert for testing purpose
Remove alert for testing purpose
JavaScript
cc0-1.0
weitalu/awesome-answering-machine,weitalu/awesome-answering-machine
466017c706bf782d868c621b4d535047b3a05259
app/config-debug.js
app/config-debug.js
var juju_config = { // These are blacklisted config items not passed into subapps mounted into // the main App. serverRouting: false, html5: true, container: '#main', viewContainer: '#main', // FIXME: turn off transitions until they are fixed. transitions: false, // These are the main application config items used and passed down into all // SubApps. consoleEnabled: true, charm_store_url: 'http://jujucharms.com/', charmworldURL: 'http://charmworld.local:2464/', // The config has three socket settings. socket_port and socket_protocol // modify the current application url to determine the websocket url (always // adding "/ws" as the final path). socket_url sets the entire websocket // url. For backwards compatibility in the GUI charm, if you provide the // socket port and/or protocol *and* the socket_url, the socket_url will be // ignored (the port/protocol behavior overrides socket_url). socket_protocol: 'ws', socket_port: 8081, user: 'admin', password: 'admin', apiBackend: 'python', // Value can be 'python' or 'go'. sandbox: false, readOnly: false, login_help: 'For this demonstration, use the password "admin" to connect.' };
var juju_config = { // These are blacklisted config items not passed into subapps mounted into // the main App. serverRouting: false, html5: true, container: '#main', viewContainer: '#main', // FIXME: turn off transitions until they are fixed. transitions: false, // These are the main application config items used and passed down into all // SubApps. consoleEnabled: true, charm_store_url: 'http://jujucharms.com/', charmworldURL: 'http://staging.jujucharms.com/', // The config has three socket settings. socket_port and socket_protocol // modify the current application url to determine the websocket url (always // adding "/ws" as the final path). socket_url sets the entire websocket // url. For backwards compatibility in the GUI charm, if you provide the // socket port and/or protocol *and* the socket_url, the socket_url will be // ignored (the port/protocol behavior overrides socket_url). socket_protocol: 'ws', socket_port: 8081, user: 'admin', password: 'admin', apiBackend: 'python', // Value can be 'python' or 'go'. sandbox: false, readOnly: false, login_help: 'For this demonstration, use the password "admin" to connect.' };
Revert local change to config.
Revert local change to config.
JavaScript
agpl-3.0
jrwren/juju-gui,bac/juju-gui,mitechie/juju-gui,mitechie/juju-gui,jrwren/juju-gui,bac/juju-gui,bac/juju-gui,mitechie/juju-gui,CanonicalJS/juju-gui,mitechie/juju-gui,jrwren/juju-gui,CanonicalJS/juju-gui,bac/juju-gui,jrwren/juju-gui,CanonicalJS/juju-gui
b52cc64da7f2ecf037c5b3226a4c6641fe4c4b73
eloquent_js_exercises/chapter06/chapter06_ex01.js
eloquent_js_exercises/chapter06/chapter06_ex01.js
function Vector(x, y) { this.x = x; this.y = y; } Vector.prototype.plus = function(vec) { return new Vector(this.x + vec.x, this.y + vec.y); } Vector.prototype.minus = function(vec) { return new Vector(this.x - vec.x, this.y - vec.y); } Object.defineProperty(Vector.prototype, "length", { get: function() { return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2)); } });
class Vec { constructor(x, y) { this.x = x; this.y = y; } plus(v) { return new Vec(this.x + v.x, this.y + v.y); } minus(v) { return new Vec(this.x - v.x, this.y - v.y); } get length() { return Math.sqrt(this.x**2 + this.y**2); } toString() { return `Vec{x: ${this.x}, y: ${this.y}}`; } }
Add Chapter 06, exercise 1
Add Chapter 06, exercise 1
JavaScript
mit
bewuethr/ctci
3073499ecb1147986f6164688a5b8e4e1700ef44
eloquent_js_exercises/chapter09/chapter09_ex03.js
eloquent_js_exercises/chapter09/chapter09_ex03.js
var number = /^(\+|-)?(\d+(\.\d*)?|\.\d+)([Ee](\+|-)?\d+)?$/;
let number = /^[+-]?\d*(\d\.|\.\d)?\d*([eE][+-]?\d+)?$/;
Add Chapter 09, exercise 3
Add Chapter 09, exercise 3
JavaScript
mit
bewuethr/ctci
73b4e1dee95f584129f03bad8c5a7448eee31b3a
handlers/awsJobs.js
handlers/awsJobs.js
// dependencies ------------------------------------------------------------ import aws from '../libs/aws'; // handlers ---------------------------------------------------------------- /** * Jobs * * Handlers for job actions. */ let handlers = { /** * Describe Job Definitions */ describeJobDefinitions(req, res, next) { aws.batch.sdk.describeJobDefinitions({}, (err, data) => { if (err) { return next(err); } else { let definitions = {}; for (let definition of data.jobDefinitions) { if (!definitions.hasOwnProperty(definition.jobDefinitionName)) { definitions[definition.jobDefinitionName] = {}; } definitions[definition.jobDefinitionName][definition.revision] = definition; } res.send(definitions); } }); }, /** * Submit Job */ submitJob(req, res) { let job = req.body; const batchJobParams = { jobDefinition: job.jobDefinition, jobName: job.jobName, parameters: job.parameters }; batchJobParams.jobQueue = 'bids-queue'; aws.batch.sdk.submitJob(batchJobParams, (err, data) => { res.send(data); }); } }; export default handlers;
// dependencies ------------------------------------------------------------ import aws from '../libs/aws'; import scitran from '../libs/scitran'; // handlers ---------------------------------------------------------------- /** * Jobs * * Handlers for job actions. */ let handlers = { /** * Create Job Definition */ createJobDefinition(req, res, next) { }, /** * Describe Job Definitions */ describeJobDefinitions(req, res, next) { aws.batch.sdk.describeJobDefinitions({}, (err, data) => { if (err) { return next(err); } else { let definitions = {}; for (let definition of data.jobDefinitions) { if (!definitions.hasOwnProperty(definition.jobDefinitionName)) { definitions[definition.jobDefinitionName] = {}; } definitions[definition.jobDefinitionName][definition.revision] = definition; } res.send(definitions); } }); }, /** * Submit Job */ submitJob(req, res) { let job = req.body; const batchJobParams = { jobDefinition: job.jobDefinition, jobName: job.jobName, parameters: job.parameters }; batchJobParams.jobQueue = 'bids-queue'; scitran.downloadSymlinkDataset(job.snapshotId, (err, hash) => { aws.s3.uploadSnapshot(hash, () => { aws.batch.sdk.submitJob(batchJobParams, (err, data) => { res.send(data); }); }); }); } }; export default handlers;
Add stub for creating job definitions. Add back snapshot uploading prior to job submission
Add stub for creating job definitions. Add back snapshot uploading prior to job submission
JavaScript
mit
poldracklab/crn_server,poldracklab/crn_server
bbb6168aef0478fae75da18410a90dd12a9d3fd5
Gruntfile.js
Gruntfile.js
'use strict'; module.exports = function (grunt) { grunt.initConfig({ mochacli: { options: { ui: 'bdd', reporter: 'spec', require: [ 'espower_loader_helper.js' ] }, all: ['test/*Test.js'] }, jshint: { options: { jshintrc: '.jshintrc' }, gruntfile: { src: 'Gruntfile.js' }, lib: { src: ['lib/**/*.js'] }, test: { src: ['test/**/*.js'] } }, watch: { gruntfile: { files: '<%= jshint.gruntfile.src %>', tasks: ['jshint:gruntfile'] }, lib: { files: '<%= jshint.lib.src %>', tasks: ['jshint:lib'] }, test: { files: '<%= jshint.test.src %>', tasks: ['test'] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-mocha-cli'); grunt.registerTask('test', ['mochacli']); // Default task. grunt.registerTask('default', ['test']); };
'use strict'; module.exports = function (grunt) { grunt.initConfig({ mochacli: { options: { ui: 'bdd', reporter: 'spec', require: [ 'espower_loader_helper.js' ] }, all: ['test/*Test.js'] }, jshint: { options: { jshintrc: '.jshintrc' }, gruntfile: { src: 'Gruntfile.js' }, lib: { src: ['lib/**/*.js'] }, test: { src: ['test/**/*.js'] } }, watch: { gruntfile: { files: '<%= jshint.gruntfile.src %>', tasks: ['jshint:gruntfile'] }, lib: { files: '<%= jshint.lib.src %>', tasks: ['jshint:lib', 'test'] }, test: { files: '<%= jshint.test.src %>', tasks: ['test'] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-mocha-cli'); grunt.registerTask('test', ['mochacli']); // Default task. grunt.registerTask('default', ['test']); };
Watch and run tests on lib change too.
Watch and run tests on lib change too.
JavaScript
mit
takas-ho/tddbc-201411-js,takas-ho/tddbc-201411-js
d62e85df1a66f6cd6a8d7df237147164f5320190
Gruntfile.js
Gruntfile.js
'use strict'; module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } }, uglify: { dist: { files: { 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] } } }, copy: { dist: { src: 'src/**/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' }, example: { expand: true, flatten: true, src: ['dist/*'], dest: 'examples/node_modules/gnap-map/dist/' } }, cssmin: { dist: { src: 'dist/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.min.css' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.registerTask('dist', ['concat', 'uglify', 'copy:dist', 'cssmin', 'copy:example']); };
'use strict'; module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } }, uglify: { dist: { files: { 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] } } }, copy: { dist: { src: 'src/**/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' }, example: { expand: true, flatten: true, src: ['dist/*'], dest: 'example/node_modules/gnap-map/dist/' } }, cssmin: { dist: { src: 'dist/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.min.css' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.registerTask('dist', ['concat', 'uglify', 'copy:dist', 'cssmin', 'copy:example']); };
Fix in publish to example folder
Fix in publish to example folder
JavaScript
bsd-3-clause
infrabel/gnap-map,infrabel/gnap-map
ff0e9e0c7aee05422b63e9cf5516eb9fbcfdd1d1
src/mmw/js/src/core/filters.js
src/mmw/js/src/core/filters.js
"use strict"; var nunjucks = require('nunjucks'); var utils = require('./utils'); var _ = require('lodash'); nunjucks.env = new nunjucks.Environment(); var basicFormatter = new Intl.NumberFormat('en'); var specificFormatter = function(sigFig) { return new Intl.NumberFormat('en',{minimumFractionDigits: sigFig}); }; var cachedFormatters = _.memoize(specificFormatter); nunjucks.env.addFilter('toLocaleString', function(val, n) { if (val===undefined || isNaN(val)) { return val; } if (n) { return cachedFormatters(n).format(val); } else { return basicFormatter.format(val); } }); nunjucks.env.addFilter('filterNoData', utils.filterNoData); nunjucks.env.addFilter('toFriendlyDate', function(date) { return new Date(date).toLocaleString(); });
"use strict"; var nunjucks = require('nunjucks'); var utils = require('./utils'); var _ = require('lodash'); nunjucks.env = new nunjucks.Environment(); if (window.hasOwnProperty('Intl')) { // Intl is available, we should use the faster NumberFormat var basicFormatter = new Intl.NumberFormat('en'), minDigitFormatter = function(n) { return new Intl.NumberFormat('en', { minimumFractionDigits: n }); }, cachedMinDigitFormatter = _.memoize(minDigitFormatter); var toLocaleStringFormatter = function(val, n) { if (val === undefined || isNaN(val)) { return val; } if (n) { return cachedMinDigitFormatter(n).format(val); } else { return basicFormatter.format(val); } }; } else { // Intl is not available, we should use the more compatible toLocaleString var toLocaleStringFormatter = function(val, n) { if (val === undefined || isNaN(val)) { return val; } if (n) { return val.toLocaleString('en', { minimumFractionDigits: n }); } else { return val.toLocaleString('en'); } }; } nunjucks.env.addFilter('toLocaleString', toLocaleStringFormatter); nunjucks.env.addFilter('filterNoData', utils.filterNoData); nunjucks.env.addFilter('toFriendlyDate', function(date) { return new Date(date).toLocaleString(); });
Support older browsers that lack Intl
Support older browsers that lack Intl While Intl.NumberFormat is a much more performant implementation (see #1566), and is supported by all modern browsers, there are still older browsers in the wild that lack support for it. Most notably, Safari 9 and the Android built-in browser do not support it, leaving many users stuck on older iPads and Macs unable to access the site. By checking for Intl support before using it, we ensure backwards compatibility, while also using the more performant modern options wherever available. Refs #1804 :bug: :apple: :globe_with_meridians:
JavaScript
apache-2.0
kdeloach/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed,kdeloach/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed
6f1262a480b7d37093e1367e21a26a41ed95181e
app/assets/javascripts/switch_meter.js
app/assets/javascripts/switch_meter.js
$(document).on("turbolinks:load", function() { $(".first-date-picker").datepicker( { dateFormat: 'DD, d MM yy', altFormat: 'yy-mm-dd', altField: "#first_date", // minDate: -42, maxDate: -1, orientation: 'bottom', changeMonth: true, changeYear: true }); $(".to-date-picker").datepicker( { dateFormat: 'DD, d MM yy', altFormat: 'yy-mm-dd', altField: "#to_date", // minDate: -42, maxDate: -1, orientation: 'bottom', changeMonth: true, changeYear: true }); }); function updateChart(el) { chart_id = el.form.id.replace("-filter", ""); chart = Chartkick.charts[chart_id]; current_source = chart.getDataSource(); new_source = current_source.split("?")[0] + "?" + $(el.form).serialize(); chart.updateData(new_source); chart.getChartObject().showLoading(); } $(document).on('change', '.meter-filter', function() { updateChart(this); }); $(document).on('change', '.first-date-picker', function() { updateChart(this); }); $(document).on('change', '.to-date-picker', function() { updateChart(this); });
$(document).on("turbolinks:load", function() { $(".first-date-picker").datepicker( { dateFormat: 'DD, d MM yy', altFormat: 'yy-mm-dd', altField: $(".first-date-picker").parents("form:first").find("#first_date"), // minDate: -42, maxDate: -1, orientation: 'bottom', changeMonth: true, changeYear: true }); $(".to-date-picker").datepicker( { dateFormat: 'DD, d MM yy', altFormat: 'yy-mm-dd', altField: $(".first-date-picker").parents("form:first").find("#to_date"), // minDate: -42, maxDate: -1, orientation: 'bottom', changeMonth: true, changeYear: true }); }); function updateChart(el) { chart_id = el.form.id.replace("-filter", ""); chart = Chartkick.charts[chart_id]; current_source = chart.getDataSource(); new_source = current_source.split("?")[0] + "?" + $(el.form).serialize(); chart.updateData(new_source); chart.getChartObject().showLoading(); } $(document).on('change', '.meter-filter', function() { updateChart(this); }); $(document).on('change', '.first-date-picker', function() { updateChart(this); }); $(document).on('change', '.to-date-picker', function() { updateChart(this); });
Fix issue with switching when there is dual supply
Fix issue with switching when there is dual supply
JavaScript
mit
BathHacked/energy-sparks,BathHacked/energy-sparks,BathHacked/energy-sparks,BathHacked/energy-sparks
7cc81eb68da50a7b505a8669885af646e4a45241
app/containers/HomePage/Login/index.js
app/containers/HomePage/Login/index.js
import ActionExitToApp from 'material-ui/svg-icons/action/exit-to-app'; import { defaultProps, setDisplayName, setPropTypes } from 'recompose'; import RaisedButton from 'material-ui/RaisedButton'; import React from 'react'; import R from 'ramda'; const Login = () => <RaisedButton label="login with imgur" fullWidth style={{ marginTop: '15%' }} > <ActionExitToApp /> </RaisedButton>; const enhance = R.pipe( defaultProps({ getImgurToken: () => {}, }), setPropTypes({ getImgurToken: React.PropTypes.func, }), setDisplayName('Login'), ); export { Login }; export default enhance(Login);
import ActionExitToApp from 'material-ui/svg-icons/action/exit-to-app'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { defaultProps, setDisplayName, setPropTypes } from 'recompose'; import RaisedButton from 'material-ui/RaisedButton'; import React from 'react'; import R from 'ramda'; import getImgurTokenAction from '../../../interactions/imgur/actions'; const Login = ({ getImgurToken }) => // eslint-disable-line react/prop-types <RaisedButton label="login with imgur" fullWidth style={{ marginTop: '15%' }} onClick={getImgurToken} > <ActionExitToApp /> </RaisedButton>; const mapDispatchToProps = (dispatch) => bindActionCreators({ getImgurToken: getImgurTokenAction, }, dispatch); const enhance = R.pipe( defaultProps({ getImgurToken: () => {}, }), setPropTypes({ getImgurToken: React.PropTypes.func, }), connect(null, mapDispatchToProps), setDisplayName('Login'), ); export { Login }; export default enhance(Login);
Add onClick function to `Login`
Add onClick function to `Login` Use a suffix for `getImgurToken` to solve the no-shadow linting conflict. Although the prop types for `getImgurToken` are defined through a recompose function, the linter indicates a false error.
JavaScript
mit
romy/personal-imgur-gallery,romy/personal-imgur-gallery
94ed33ff52d90b3b153f5fd09069e09b29d530d1
xmlToJson/index.js
xmlToJson/index.js
var fs = rquire('fs'); module.exports = function (context, xmlZipBlob) { context.log('Node.js blob trigger function processed blob:', xmlZipBlob); console.log(`typeof xmlZipBlob:`, typeof xmlZipBlob); fs.writeFile('xmlZip.zip', xmlZipBlob, (err) => { if (err) { throw err; } console.log('saved blob to loal file called xmlZip.zip'); }); context.done(); };
var fs = require('fs'); module.exports = function (context, xmlZipBlob) { context.log('Node.js blob trigger function processed blob:', xmlZipBlob); context.log(`typeof xmlZipBlob:`, typeof xmlZipBlob); fs.writeFile('xmlZip.zip', xmlZipBlob, (err) => { if (err) { throw err; } context.log('saved blob to loal file called xmlZip.zip'); }); context.done(); };
Fix typos and use context instead of console
Fix typos and use context instead of console
JavaScript
mit
mattmazzola/sc2iq-azure-functions
d53860ae453ed40e410af32ac5d1b7baa84f5950
Gruntfile.js
Gruntfile.js
module.exports = function (grunt) { 'use strict'; grunt.initConfig({ jshint: { options: grunt.file.readJSON('.jshintrc'), gruntfile: 'Gruntfile.js', bin: { src: [ 'bin/*.js', 'bin/yo' ] }, test: { options: { globals: { describe: true, it: true, beforeEach: true, afterEach: true, before: true, after: true } }, src: 'test/**/*.js' } }, watch: { files: [ 'Gruntfile.js', '<%= jshint.test.src %>', '<%= jshint.bin.src %>' ], tasks: [ 'jshint', 'mochaTest' ] }, mochaTest: { test: { options: { slow: 1500, timeout: 50000, reporter: 'spec', globals: [ 'events', 'AssertionError', 'TAP_Global_Harness' ] }, src: ['test/**/*.js'] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-mocha-test'); grunt.registerTask('default', ['jshint', 'mochaTest']); };
module.exports = function (grunt) { 'use strict'; grunt.initConfig({ jshint: { options: grunt.file.readJSON('.jshintrc'), gruntfile: 'Gruntfile.js', bin: [ 'cli.js', 'yoyo.js' ], test: { options: { globals: { describe: true, it: true, beforeEach: true, afterEach: true, before: true, after: true } }, src: 'test/**/*.js' } }, watch: { files: [ 'Gruntfile.js', '<%= jshint.test.src %>', '<%= jshint.bin.src %>' ], tasks: [ 'jshint', 'mochaTest' ] }, mochaTest: { test: { options: { slow: 1500, timeout: 50000, reporter: 'spec', globals: [ 'events', 'AssertionError', 'TAP_Global_Harness' ] }, src: ['test/**/*.js'] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-mocha-test'); grunt.registerTask('default', ['jshint', 'mochaTest']); };
Fix linting paths to match previous refactor
Fix linting paths to match previous refactor
JavaScript
bsd-2-clause
yeoman/yo
7efd2e90aa25f7ded66d2c69d78a285825d02f2d
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), run: { app: { options: { wait: false }, cmd: 'node', args: ['app.js'] } }, simplemocha: { control: { src: ['specs/sandbox-control.spec.js'] }, jsonRpc: { src: ['specs/sandbox-json-rpc.spec.js'] } } }); grunt.loadNpmTasks('grunt-run'); grunt.loadNpmTasks('grunt-simple-mocha'); grunt.registerTask('test', [ 'run:app', 'simplemocha', 'stop:app' ]); grunt.registerTask('default', []); };
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), run: { app: { options: { wait: false }, cmd: 'node', args: ['app.js'] } }, simplemocha: { control: { src: ['specs/sandbox-control.spec.js'] }, jsonRpc: { src: ['specs/sandbox-json-rpc.spec.js'] } } }); grunt.loadNpmTasks('grunt-run'); grunt.loadNpmTasks('grunt-simple-mocha'); grunt.registerTask('simplemochaGrep', function() { grunt.config('simplemocha.options.grep', grunt.option('grep')); grunt.task.run('simplemocha'); }); grunt.registerTask('test', [ 'run:app', 'simplemochaGrep', 'stop:app' ]); grunt.registerTask('default', []); };
Add grep argument to run tests with a filter
Add grep argument to run tests with a filter
JavaScript
agpl-3.0
ether-camp/ethereum-sandbox
e7e7da9fac092e06d6a234d2be0fc522da5585a5
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { var attache = { buildDir: 'dist' }; // Project configuration. grunt.initConfig({ appConfig: attache, pkg: grunt.file.readJSON('package.json'), jsdoc : { dist : { src: ['attache.js', 'attache-jquery.js'], options: { destination: 'doc' } } } // copy: { // // NOTE: copy MUST have a target - just using copy: { files: ... } yields an 'missing indexOf' error // build: { // files: [ // {src: ['css/fonts/*'], dest: '<%= appConfig.buildDir %>/', filter: 'isFile'}, // {src: ['videos/*'], dest: '<%= appConfig.buildDir %>/', filter: 'isFile'} // ] // } // }, // uglify: { // options: { // report: 'gzip', // mangle: false // } // } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-jsdoc'); grunt.registerTask('default', [ 'jsdoc' ]); };
module.exports = function(grunt) { var attache = { buildDir: 'dist' }; // Project configuration. grunt.initConfig({ appConfig: attache, pkg: grunt.file.readJSON('package.json'), jsdoc : { dist : { src: ['attache.js', 'attache-jquery.js'], options: { destination: 'doc', private: false } } } // copy: { // // NOTE: copy MUST have a target - just using copy: { files: ... } yields an 'missing indexOf' error // build: { // files: [ // {src: ['css/fonts/*'], dest: '<%= appConfig.buildDir %>/', filter: 'isFile'}, // {src: ['videos/*'], dest: '<%= appConfig.buildDir %>/', filter: 'isFile'} // ] // } // }, // uglify: { // options: { // report: 'gzip', // mangle: false // } // } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-jsdoc'); grunt.registerTask('default', [ 'jsdoc' ]); };
Exclude private functions from documentation
Exclude private functions from documentation
JavaScript
mit
janfoeh/attachejs,janfoeh/attachejs,janfoeh/attachejs