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
5a66d394be7c4ac22693fa4fce38da2c40c64d53
index.js
index.js
/* ================================== Express server - main server side file ===================================== */ var path = require('path'); var fs = require('fs'); var http = require('http'); var express = require('express'); var app = express(); // block access to src folder app.get('/js/src/*', function(req, res) { res.status(404); res.end(); }); // Serve the ./static/ folder to the public app.use(express.static('static')); app.use('/stream', express.static('stream')); // need to optimize this // Route all requests to static/index.html app.get('*', function(req, res) { res.sendFile(path.join(__dirname, 'static/index.html')); }); // Start the server var server = http.createServer(app); server.listen(8080); // Socekt io var io = require('socket.io')(server); io.on('connection', function(socket) { socket.on('control-start', function(data) { io.emit('start', data); }); socket.on('control-pause', function(data) { io.emit('pause'); }); socket.on('report', function(data) { io.emit('report', data); }); });
/* ================================== Express server - main server side file ===================================== */ var path = require('path'); var fs = require('fs'); var http = require('http'); var express = require('express'); var app = express(); // block access to src folder app.get('/js/src/*', function(req, res) { res.status(404); res.end(); }); // Serve the ./static/ folder to the public app.use(express.static('static')); app.use('/stream', express.static('stream')); // need to optimize this // Route all requests to static/index.html app.get('*', function(req, res) { res.sendFile(path.join(__dirname, 'static/index.html')); }); // Start the server var server = http.createServer(app); server.listen(process.env.PORT || 8080); // Socekt io var io = require('socket.io')(server); io.on('connection', function(socket) { socket.on('control-start', function(data) { io.emit('start', data); }); socket.on('control-pause', function(data) { io.emit('pause'); }); socket.on('report', function(data) { io.emit('report', data); }); });
Allow port to be defined by env
Allow port to be defined by env
JavaScript
apache-2.0
arthuralee/nito,arthuralee/nito
a096b4d565db8d713c1bdb78ad3bc881f5817b10
gulp/tasks/webpack.js
gulp/tasks/webpack.js
import gulp from 'gulp'; import gulpWebpack from 'webpack-stream'; import webpack from 'webpack'; import config from '../config'; let app = './src/main.js'; gulp.task('webpack', () => { return gulp.src(app) .pipe(gulpWebpack({ output: { filename: config.mainFile + '.js' }, devtool: 'inline-source-map', plugins: [ new webpack.optimize.AggressiveMergingPlugin(), new webpack.optimize.DedupePlugin() ], module: { loaders: [ { loaders: ['ng-annotate', 'babel-loader'] } ] } }, webpack, () => 'done')) .pipe(gulp.dest(config.destFolder)); }); gulp.task('webpack-build', () => { return gulp.src(app) .pipe(gulpWebpack({ output: { filename: config.mainFile + '.js' }, plugins: [ new webpack.optimize.AggressiveMergingPlugin(), new webpack.optimize.DedupePlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: { except: ['goog', 'gapi', 'angular'] } }) ], module: { loaders: [ { loaders: ['ng-annotate', 'babel-loader'] } ] } }, webpack, () => 'done')) .pipe(gulp.dest(config.destFolder)); });
import gulp from 'gulp'; import gulpWebpack from 'webpack-stream'; import webpack from 'webpack'; import config from '../config'; let app = './src/main.js'; gulp.task('webpack', () => { return gulp.src(app) .pipe(gulpWebpack({ output: { filename: config.mainFile + '.js' }, devtool: 'inline-source-map', plugins: [ new webpack.optimize.AggressiveMergingPlugin(), new webpack.optimize.DedupePlugin() ], module: { loaders: [ { loaders: ['babel-loader'] } ] } }, webpack, () => 'done')) .pipe(gulp.dest(config.destFolder)); }); gulp.task('webpack-build', () => { return gulp.src(app) .pipe(gulpWebpack({ output: { filename: config.mainFile + '.js' }, plugins: [ new webpack.optimize.AggressiveMergingPlugin(), new webpack.optimize.DedupePlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: { except: ['goog', 'gapi', 'angular'] } }) ], module: { loaders: [ { loaders: ['ng-annotate', 'babel-loader'] } ] } }, webpack, () => 'done')) .pipe(gulp.dest(config.destFolder)); });
Remove annotate from default task
Remove annotate from default task
JavaScript
mit
marcosmoura/angular-material-steppers,marcosmoura/angular-material-steppers
88ad1c1a133236e609d6fad45c80d637a2ad9a55
test/harvest-client-tests.js
test/harvest-client-tests.js
var assert = require('assert'), config = require('config'), Harvest = require('../index'); describe('The Harvest API Client', function() { describe('Instantiating a Harvest instance', function() { it('should be able to work with HTTP basic authentication', function() { // TODO }); it('should be able to work with OAuth 2.0', function() { // TODO }); }); });
var assert = require('assert'), config = require('config'), Harvest = require('../index'); describe('The Harvest API Client', function() { describe('Instantiating a Harvest instance', function() { it('should be able to work with HTTP basic authentication', function() { var harvest = new Harvest({ subdomain: config.harvest.subdomain, email: config.harvest.email, password: config.harvest.password }); assert(typeof harvest === "object"); }); it('should be able to work with OAuth 2.0', function() { var harvest = new Harvest({ subdomain: config.harvest.subdomain, identifier: config.harvest.identifier, secret: config.harvest.secret }); assert(typeof harvest === "object"); }); }); });
Test for instantiation of harvest client with login or api credentials
Test for instantiation of harvest client with login or api credentials
JavaScript
mit
peterbraden/node-harvest,log0ymxm/node-harvest,Pezmc/node-harvest-2,clearhead/node-harvest
03f6c68e7e66fe8bdba9164702e5102c0793e186
index.js
index.js
"use strict" var http = require('http') var shoe = require('shoe'); var app = http.createServer() module.exports = function(options, cb) { if (typeof options === 'function') cb = options, options = undefined options = options || {} if (!options.file || typeof options.file !== 'string') return cb(new Error('file path required')) var sf = require('slice-file'); var words = sf(options.file); var sock = shoe(function(stream) { words.follow(0).pipe(stream) }) sock.install(app, '/logs'); return app }
"use strict" var http = require('http') var shoe = require('shoe'); var app = http.createServer() module.exports = function(options, cb) { if (typeof options === 'function') cb = options, options = undefined if(typeof cb !== 'function') { cb = function(err) { if(err) { throw err; }}} options = options || {} if (!options.file || typeof options.file !== 'string') return cb(new Error('file path required')) var sf = require('slice-file'); var words = sf(options.file); var sock = shoe(function(stream) { words.follow(0).pipe(stream) }) sock.install(app, '/logs'); return app }
Make default callback throw error
Make default callback throw error
JavaScript
mit
ninjablocks/ninja-tail-stream
0ae4e58f86bad13975fd816b9260e78c187aea05
index.js
index.js
#!/usr/bin/env node const fs = require('fs'); const components = process.argv.slice(2); const componentDefaultContent = componentName => ` import React, { Component, PropTypes, } from 'react'; class ${componentName} extends Component { render() { return ( <div></div> ); } } export default ${componentName}; `; const indexDefaultContent = componentName => ` import ${componentName} from './${componentName}'; export default ${componentName}; `; const createFile = (fileName, contents) => fs.writeFile(fileName, contents, err => { if (err) { return console.log(err); } }); components.forEach(component => { const componentName = component.charAt(0).toUpperCase() + component.slice(1); const folderPrefix = `${component}/`; fs.existsSync(componentName) || fs.mkdirSync(componentName); createFile(`${folderPrefix + componentName}.js`, componentDefaultContent(componentName)); createFile(`${folderPrefix + componentName}.scss`, ''); createFile(`${folderPrefix}index.js`, indexDefaultContent(componentName)); console.log('Successfully created '+componentName+' component!'); });
const fs = require('fs'); const components = process.argv.slice(2); const componentDefaultContent = componentName => `import React, { Component, PropTypes, } from 'react'; class ${componentName} extends Component { render() { return ( <div></div> ); } } export default ${componentName}; `; const indexDefaultContent = componentName => `import ${componentName} from './${componentName}'; export default ${componentName}; `; const createFile = (fileName, contents) => fs.writeFile(fileName, contents, err => { if (err) { return console.log(err); } }); components.forEach(component => { const componentName = component.charAt(0).toUpperCase() + component.slice(1); const folderPrefix = `${component}/`; fs.existsSync(componentName) || fs.mkdirSync(componentName); createFile(`${folderPrefix + componentName}.js`, componentDefaultContent(componentName)); createFile(`${folderPrefix + componentName}.scss`, ''); createFile(`${folderPrefix}index.js`, indexDefaultContent(componentName)); console.log('Successfully created '+componentName+' component!'); });
Update script to remove empty line
Update script to remove empty line
JavaScript
mit
Lukavyi/generate-reactjs-component-folder-css-modules
d97b5e5392e118bca6a30d1eaa3601af5fa9ec32
index.js
index.js
'use strict'; var parse = require('coffee-script').compile; exports.extension = 'coffee'; exports.compile = function (src, options) { var opts = { bare: true }, code, data, map; if (!options.sourceMap) return { code: parse(src, opts) }; opts.sourceMap = true; data = parse(src, opts); // Include original coffee file in the map. map = JSON.parse(data.v3SourceMap); map.sourcesContent = [src]; map = JSON.stringify(map); code = data.js; if (code[code.length - 1] !== '\n') code += '\n'; code += '//@ sourceMappingURL=data:application/json;base64,' + new Buffer(map).toString('base64') + '\n'; return { code: code }; };
'use strict'; var parse = require('coffee-script').compile; exports.extension = 'coffee'; exports.compile = function (src, options) { var opts = { bare: true }, code, data, map; if (!options.sourceMap) return { code: parse(src, opts) }; opts.sourceMap = true; data = parse(src, opts); // Include original coffee file in the map. map = JSON.parse(data.v3SourceMap); map.sourcesContent = [src]; map = JSON.stringify(map); code = data.js; if (code[code.length - 1] !== '\n') code += '\n'; code += '//# sourceMappingURL=data:application/json;base64,' + new Buffer(map).toString('base64') + '\n'; return { code: code }; };
Update sourceMappingURL syntax to latest change
Update sourceMappingURL syntax to latest change
JavaScript
mit
medikoo/webmake-coffee
e6f9b7b2eb9e7e651aa0a7ea37b4543d64d3d3bc
app/scripts/main.js
app/scripts/main.js
$(function () { $('#sidebar').affix({ offset: { //top: $('.navbar-fixed-top').height() //top: $('.navbar-fixed-top').offset().top top: $('main').offset().top + 10 } }); });
$(function () { $('#sidebar').affix({ offset: { top: $('main').offset().top + 10 } }); });
Fix ESLint Errors and Warnings
Fix ESLint Errors and Warnings
JavaScript
mit
Ecotrust/Measuring-Our-Impact-Wireframes,Ecotrust/Measuring-Our-Impact-Wireframes
0c665c9998bf7d7619184d073cdf832b30a1d8af
test/special/subLanguages.js
test/special/subLanguages.js
'use strict'; var fs = require('fs'); var utility = require('../utility'); describe('sub-languages', function() { before(function() { this.block = document.querySelector('#sublanguages'); }); it('should highlight XML with PHP and JavaScript', function() { var filename = utility.buildPath('expect', 'sublanguages.txt'), expected = fs.readFileSync(filename, 'utf-8'), actual = this.block.innerHTML; actual.should.equal(expected); }); });
'use strict'; var fs = require('fs'); var utility = require('../utility'); describe('sub-languages', function() { before(function() { this.block = document.querySelector('#sublanguages'); }); it('should highlight XML with PHP and JavaScript', function(done) { var filename = utility.buildPath('expect', 'sublanguages.txt'), actual = this.block.innerHTML; fs.readFile(filename, 'utf-8', utility.handleExpectedFile(actual, done)); }); });
Change sub languages to asynchronous testing
Change sub languages to asynchronous testing
JavaScript
bsd-3-clause
SibuStephen/highlight.js,isagalaev/highlight.js,0x7fffffff/highlight.js,yxxme/highlight.js,tenbits/highlight.js,aurusov/highlight.js,tenbits/highlight.js,jean/highlight.js,STRML/highlight.js,snegovick/highlight.js,snegovick/highlight.js,MakeNowJust/highlight.js,tenbits/highlight.js,weiyibin/highlight.js,martijnrusschen/highlight.js,Sannis/highlight.js,SibuStephen/highlight.js,krig/highlight.js,alex-zhang/highlight.js,isagalaev/highlight.js,devmario/highlight.js,Ankirama/highlight.js,alex-zhang/highlight.js,ysbaddaden/highlight.js,brennced/highlight.js,christoffer/highlight.js,teambition/highlight.js,robconery/highlight.js,christoffer/highlight.js,ysbaddaden/highlight.js,zachaysan/highlight.js,SibuStephen/highlight.js,sourrust/highlight.js,aristidesstaffieri/highlight.js,dublebuble/highlight.js,abhishekgahlot/highlight.js,CausalityLtd/highlight.js,1st1/highlight.js,palmin/highlight.js,daimor/highlight.js,kba/highlight.js,bluepichu/highlight.js,Delermando/highlight.js,VoldemarLeGrand/highlight.js,robconery/highlight.js,palmin/highlight.js,yxxme/highlight.js,liang42hao/highlight.js,Amrit01/highlight.js,kevinrodbe/highlight.js,ehornbostel/highlight.js,zachaysan/highlight.js,ponylang/highlight.js,Amrit01/highlight.js,CausalityLtd/highlight.js,Ajunboys/highlight.js,liang42hao/highlight.js,highlightjs/highlight.js,Ajunboys/highlight.js,jean/highlight.js,0x7fffffff/highlight.js,kba/highlight.js,teambition/highlight.js,Sannis/highlight.js,aurusov/highlight.js,ilovezy/highlight.js,lizhil/highlight.js,dublebuble/highlight.js,axter/highlight.js,J2TeaM/highlight.js,VoldemarLeGrand/highlight.js,martijnrusschen/highlight.js,alex-zhang/highlight.js,lizhil/highlight.js,delebash/highlight.js,taoger/highlight.js,kevinrodbe/highlight.js,adam-lynch/highlight.js,kayyyy/highlight.js,xing-zhi/highlight.js,carlokok/highlight.js,VoldemarLeGrand/highlight.js,ehornbostel/highlight.js,ilovezy/highlight.js,adjohnson916/highlight.js,dYale/highlight.js,dx285/highlight.js,lizhil/highlight.js,sourrust/highlight.js,brennced/highlight.js,adjohnson916/highlight.js,bluepichu/highlight.js,abhishekgahlot/highlight.js,dx285/highlight.js,StanislawSwierc/highlight.js,aurusov/highlight.js,0x7fffffff/highlight.js,delebash/highlight.js,highlightjs/highlight.js,adam-lynch/highlight.js,axter/highlight.js,kayyyy/highlight.js,J2TeaM/highlight.js,Ankirama/highlight.js,delebash/highlight.js,MakeNowJust/highlight.js,brennced/highlight.js,devmario/highlight.js,taoger/highlight.js,liang42hao/highlight.js,ysbaddaden/highlight.js,ponylang/highlight.js,adjohnson916/highlight.js,Sannis/highlight.js,kayyyy/highlight.js,snegovick/highlight.js,aristidesstaffieri/highlight.js,lead-auth/highlight.js,christoffer/highlight.js,highlightjs/highlight.js,bluepichu/highlight.js,cicorias/highlight.js,dx285/highlight.js,xing-zhi/highlight.js,robconery/highlight.js,xing-zhi/highlight.js,axter/highlight.js,dbkaplun/highlight.js,palmin/highlight.js,Delermando/highlight.js,carlokok/highlight.js,ponylang/highlight.js,yxxme/highlight.js,aristidesstaffieri/highlight.js,devmario/highlight.js,jean/highlight.js,abhishekgahlot/highlight.js,adam-lynch/highlight.js,cicorias/highlight.js,weiyibin/highlight.js,dbkaplun/highlight.js,Ajunboys/highlight.js,sourrust/highlight.js,weiyibin/highlight.js,daimor/highlight.js,teambition/highlight.js,CausalityLtd/highlight.js,dbkaplun/highlight.js,Delermando/highlight.js,kba/highlight.js,Amrit01/highlight.js,carlokok/highlight.js,MakeNowJust/highlight.js,taoger/highlight.js,1st1/highlight.js,dYale/highlight.js,kevinrodbe/highlight.js,carlokok/highlight.js,daimor/highlight.js,cicorias/highlight.js,krig/highlight.js,J2TeaM/highlight.js,StanislawSwierc/highlight.js,dYale/highlight.js,Ankirama/highlight.js,1st1/highlight.js,ilovezy/highlight.js,krig/highlight.js,martijnrusschen/highlight.js,ehornbostel/highlight.js,dublebuble/highlight.js,highlightjs/highlight.js,zachaysan/highlight.js,STRML/highlight.js,STRML/highlight.js
cceb968c9c98e961938595b68602466bcb75e350
src/c/filter-dropdown.js
src/c/filter-dropdown.js
import m from 'mithril'; import dropdown from './dropdown'; const filterDropdown = { view(ctrl, args) { const wrapper_c = args.wrapper_class || '.w-col.w-col-3.w-col-small-6'; return m(wrapper_c, [ m(`label.fontsize-smaller[for="${args.index}"]`, (args.custom_label ? m.component(args.custom_label[0], args.custom_label[1]) : args.label)), m.component(dropdown, { id: args.index, onchange: args.onchange, classes: '.w-select.text-field.positive', valueProp: args.vm, options: args.options }) ]); } }; export default filterDropdown;
import m from 'mithril'; import dropdown from './dropdown'; const filterDropdown = { view(ctrl, args) { const wrapper_c = args.wrapper_class || '.w-col.w-col-3.w-col-small-6'; return m(wrapper_c, [ m(`label.fontsize-smaller[for="${args.index}"]`, (args.custom_label ? m.component(args.custom_label[0], args.custom_label[1]) : args.label)), m.component(dropdown, { id: args.index, onchange: _.isFunction(args.onchange) ? args.onchange : () => {}, classes: '.w-select.text-field.positive', valueProp: args.vm, options: args.options }) ]); } }; export default filterDropdown;
Check for onchange before try executing to avoid errors
Check for onchange before try executing to avoid errors
JavaScript
mit
sushant12/catarse.js,catarse/catarse.js,catarse/catarse_admin
03d408714f001c291ea9ce97c4077ffceb0a94b7
gulp/tasks/mochify.js
gulp/tasks/mochify.js
'use strict'; var gulp = require('gulp'); var mochify = require('mochify'); var config = require('../config').js; gulp.task('mochify', ['jshint'], function () { mochify( config.test, { reporter : 'spec' //debug: true, //cover : true, //consolify : 'build/runner.html' //TODO require : 'chai' and expose expect https://github.com/gulpjs/gulp/blob/master/docs/recipes/mocha-test-runner-with-gulp.md }).bundle(); });
'use strict'; var gulp = require('gulp'); var mochify = require('mochify'); var config = require('../config').js; gulp.task('mochify', ['jshint'], function () { mochify( config.test, { reporter : 'spec' //debug: true, //cover : true, //consolify : 'test/runner.html' //TODO require : 'chai' and expose expect https://github.com/gulpjs/gulp/blob/master/docs/recipes/mocha-test-runner-with-gulp.md }).bundle(); });
Put runner.html in test directory
Put runner.html in test directory
JavaScript
mit
aboutlo/gulp-starter-kit,aboutlo/gulp-starter-kit
5d302a96832bae71bf110479683659ace7e6377f
index.js
index.js
var express = require('express'); var app = express(); var url = require('url'); var request = require('request'); var bodyParser = require('body-parser'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.set('port', (process.env.PORT || 9001)); app.get('/', function(req, res) { res.send('It works!'); }); app.post('/post', function(req, res) { var body = { response_type: "in_channel", text: req.body.text + " http://vignette4.wikia.nocookie.net/imperial-assault/images/d/d7/Imperial_Assault_Die_Face.png/revision/latest?cb=20150825022932 http://epilepsyu.com/epilepsyassociation/files/2016/01/FUN.gif" }; res.send(body); }); app.listen(app.get('port'), function() { console.log('Node app is running on port', app.get('port')); });
var express = require('express'); var app = express(); var url = require('url'); var request = require('request'); var bodyParser = require('body-parser'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.set('port', (process.env.PORT || 9001)); app.get('/', function(req, res) { res.send('It works!'); }); app.post('/post', function(req, res) { var body = { response_type: "in_channel", text: req.body.text + "https://dicemaster.herokuapp.com/resources/ia/blue3.png" }; res.send(body); }); app.listen(app.get('port'), function() { console.log('Node app is running on port', app.get('port')); });
Load ia dice image and see what it looks like
Load ia dice image and see what it looks like
JavaScript
mit
WilliamBZA/DiceMaster
55c823e3fd29a9ed4eee7bac24fec69f518c5edf
index.js
index.js
'use strict'; var events = require('events'); var configs = require('./configs'); var rump = module.exports = new events.EventEmitter(); rump.addGulpTasks = function() { require('./gulp'); }; rump.reconfigure = function(options) { configs.rebuild(options); rump.emit('update:main'); }; rump.configs = { get main() { return configs.main; }, get watch() { return configs.watch; } };
'use strict'; var events = require('events'); var path = require('path'); var configs = require('./configs'); var rump = module.exports = new events.EventEmitter(); rump.autoload = function() { var pkg = require(path.resolve('package.json')); var modules = [].concat(Object.keys(pkg.dependencies || {}), Object.keys(pkg.devDependencies || {}), Object.keys(pkg.peerDependencies || {})); modules.forEach(function(mod) { try { require(mod); } catch(e) {} }); }; rump.addGulpTasks = function() { require('./gulp'); }; rump.reconfigure = function(options) { configs.rebuild(options); rump.emit('update:main'); }; rump.configs = { get main() { return configs.main; }, get watch() { return configs.watch; } };
Add ability to automatically load available modules defined
Add ability to automatically load available modules defined
JavaScript
mit
rumps/core,rumps/rump
eb11d289fd6924ea178c2200b6e96c3763c2ca16
index.js
index.js
// Copyright 2014 Andrei Karpushonak "use strict"; var _ = require('lodash'); var ECMA_SIZES = require('./byte_size'); /** * Main module's entry point * Calculates Bytes for the provided parameter * @param object - handles object/string/boolean/buffer * @returns {*} */ function sizeof(object) { if (_.isObject(object)) { if (Buffer.isBuffer(object)) { return object.length; } else { var bytes = 0; _.forOwn(object, function (value, key) { bytes += sizeof(key); try { bytes += sizeof(value); } catch (ex) { if(ex instanceof RangeError) { console.error('Circular dependency detected, result might be incorrect: ', object) } } }); return bytes; } } else if (_.isString(object)) { return object.length * ECMA_SIZES.STRING; } else if (_.isBoolean(object)) { return ECMA_SIZES.BOOLEAN; } else if (_.isNumber(object)) { return ECMA_SIZES.NUMBER; } else { return 0; } } module.exports = sizeof;
// Copyright 2014 Andrei Karpushonak "use strict"; var _ = require('lodash'); var ECMA_SIZES = require('./byte_size'); /** * Main module's entry point * Calculates Bytes for the provided parameter * @param object - handles object/string/boolean/buffer * @returns {*} */ function sizeof(object) { if (_.isObject(object)) { if (Buffer.isBuffer(object)) { return object.length; } else { var bytes = 0; _.forOwn(object, function (value, key) { bytes += sizeof(key); try { bytes += sizeof(value); } catch (ex) { if(ex instanceof RangeError) { console.log('Circular dependency detected, result might be incorrect: ', object) } } }); return bytes; } } else if (_.isString(object)) { return object.length * ECMA_SIZES.STRING; } else if (_.isBoolean(object)) { return ECMA_SIZES.BOOLEAN; } else if (_.isNumber(object)) { return ECMA_SIZES.NUMBER; } else { return 0; } } module.exports = sizeof;
Use console.log instead of console.warn
Use console.log instead of console.warn
JavaScript
mit
miktam/sizeof,avrora/sizeof
b658af5d5c150f1597fba03063821aafa801f601
src/components/Navbar.js
src/components/Navbar.js
/* * @flow */ import * as React from 'react'; export default function Navbar() { return ( <nav className="navbar navbar-default navbar-fixed-top navbar-inverse"> <div className="container-fluid"> <div className="navbar-header"> <a className="navbar-brand" href="/" onClick={(e: SyntheticEvent<>) => { e.preventDefault(); window.location.hash = ''; window.location.reload(); }}> Bonsai </a> <p className="navbar-text"> Trim your dependency trees </p> </div> <ul className="nav navbar-nav navbar-right"> <li> <a className="navbar-link" href="https://pinterest.github.io/bonsai/"> Docs </a> </li> <li> <a className="navbar-link" href="https://github.com/pinterest/bonsai"> Github </a> </li> </ul> </div> </nav> ); }
/* * @flow */ import * as React from 'react'; import {getClassName} from './Bootstrap/GlyphiconNames'; export default function Navbar() { return ( <nav className="navbar navbar-default navbar-fixed-top navbar-inverse"> <div className="container-fluid"> <div className="navbar-header"> <a className="navbar-brand" href="/" onClick={(e: SyntheticEvent<>) => { e.preventDefault(); window.location.hash = ''; window.location.reload(); }}> Bonsai </a> <p className="navbar-text"> <span className={getClassName('tree-conifer')} aria-hidden="true"></span> Trim your dependency trees </p> </div> <ul className="nav navbar-nav navbar-right"> <li> <a className="navbar-link" href="https://pinterest.github.io/bonsai/"> <span className={getClassName('book')} aria-hidden="true"></span>&nbsp; Docs </a> </li> <li> <a className="navbar-link" href="https://github.com/pinterest/bonsai"> Github </a> </li> </ul> </div> </nav> ); }
Use glyphicons in the header so they download earlier.
Use glyphicons in the header so they download earlier.
JavaScript
apache-2.0
pinterest/bonsai,pinterest/bonsai,pinterest/bonsai
53c7d27f9097c6c80b080f2708f34cbfa296db5e
index.js
index.js
'use strict'; const path = require('path'); const pkg = require(path.resolve('./package.json')); const semver = require('semver'); const versions = require('./versions.json'); const presetEnv = require.resolve('babel-preset-env'); const presetStage3 = require.resolve('babel-preset-stage-3'); module.exports = function() { const targets = {}; if (typeof pkg.browserslist === 'object' && pkg.browserslist.length) { targets.browsers = pkg.browserslist; } if (typeof pkg.engines === 'object' && pkg.engines.node) { const version = pkg.engines.node; if (semver.valid(version)) { targets.node = version; } else if (semver.validRange(version)) { targets.node = semver.minSatisfying(versions.node, version); } } return { presets: [ [presetEnv, {targets}], presetStage3, ], }; };
'use strict'; const path = require('path'); const pkg = require(path.resolve('./package.json')); const semver = require('semver'); const versions = require('./versions.json'); const presetEnv = require.resolve('babel-preset-env'); const presetStage3 = require.resolve('babel-preset-stage-3'); module.exports = function() { const targets = {}; if (pkg.browserslist) { targets.browsers = pkg.browserslist; } if (pkg.engines && pkg.engines.node) { const version = pkg.engines.node; if (semver.valid(version)) { targets.node = version; } else if (semver.validRange(version)) { targets.node = semver.minSatisfying(versions.node, version); } } return { presets: [ [presetEnv, {targets}], presetStage3, ], }; };
Simplify the checks for package.json objects
:hammer: Simplify the checks for package.json objects
JavaScript
mit
jamieconnolly/babel-preset
f997f034b1a028448b266b617f6cb4c3b0269d0b
index.js
index.js
'use strict'; var userHome = require('user-home'); module.exports = function (str) { return userHome ? str.replace(/^~\//, userHome + '/') : str; };
'use strict'; var userHome = require('user-home'); module.exports = function (str) { if (typeof str !== 'string') { throw new TypeError('Expected a string'); } return userHome ? str.replace(/^~\//, userHome + '/') : str; };
Throw if input is not a string
Throw if input is not a string
JavaScript
mit
sindresorhus/untildify,sindresorhus/untildify
a2c4f70e192793f2f241a3acba5878c79090d0d8
client/app/dashboard/students/new/route.js
client/app/dashboard/students/new/route.js
import Ember from 'ember'; export default Ember.Route.extend({ titleToken: 'Add a student', model() { return this.store.createRecord('student'); } });
import Ember from 'ember'; export default Ember.Route.extend({ titleToken: 'Add a student', model() { return this.store.createRecord('student'); }, resetController(controller, isExiting) { if (isExiting) { controller.set('didValidate', false); controller.set('errorMessage', false); } } });
Clean up repeat visits to add student view.
Clean up repeat visits to add student view.
JavaScript
bsd-2-clause
mblayman/lcp,mblayman/lcp,mblayman/lcp
5f032a0fe59a2bbea943bf79fcb40e0382872310
public/js/csv-generator.js
public/js/csv-generator.js
const csvGenerator = { init() { const downloadCsvBtnEl = document.querySelector(".js-download-csv-btn"); if (downloadCsvBtnEl) { downloadCsvBtnEl.addEventListener("click", e => { window.open(window.location.href, '_blank'); }); } } } export default csvGenerator;
const csvGenerator = { init() { const downloadCsvBtnEl = document.querySelector(".js-download-csv-btn"); if (downloadCsvBtnEl) { downloadCsvBtnEl.addEventListener("click", e => { let url = `${window.location.href}&returns=csv`; window.open(url, '_blank'); }); } } } export default csvGenerator;
Refactor CSV generator button script
Refactor CSV generator button script
JavaScript
mit
participedia/api,participedia/api,participedia/api,participedia/api
697b1268296a2aa9b753f0306166f18ca6598884
js/db.js
js/db.js
var app = app || {}; (function() { app.db = { id: "todoDB", description: "Database of the todo list", migrations : [ { version: "1.0", migrate: function(transaction, next) { transaction.db.createObjectStore("todos"); next(); } } ] } })();
var app = app || {}; (function() { app.db = { id: "todoDB", description: "Database of the todo list", nolog: true, migrations : [ { version: "1.0", migrate: function(transaction, next) { transaction.db.createObjectStore("todos"); next(); } } ] } })();
Disable verbose output of the indexedDB
Disable verbose output of the indexedDB
JavaScript
mit
Vicos/viTodo
0ceee8a2ad1e72ad628fe31974670b1fc11220d8
src/web/js/collections/localStorage.js
src/web/js/collections/localStorage.js
/** * Collection for interfacing with localStorage. */ 'use strict'; var Backbone = require('backbone'); var _ = require('lodash'); module.exports = Backbone.Collection.extend({ model: Backbone.Model, initialize: function() { this.localStorage = window.localStorage; }, fetch: function() { var history = []; var session = {}; var keys = Object.keys(this.localStorage); for (var i = 0; i < keys.length; i++) { session = {}; session.id = keys[i]; session.tree = JSON.parse(this.localStorage.getItem(this.localStorage.key(i))); history.push(session); } this.parse(history); this.trigger('sync'); }, parse: function(history) { _.each(history, _.bind(function(session) { session.checked = false; this.add(session); }, this)); }, getLatest: function() { this.fetch(); var len = this.models.length; return this.models[len-1]; } });
/** * Collection for interfacing with localStorage. */ 'use strict'; var Backbone = require('backbone'); var _ = require('lodash'); module.exports = Backbone.Collection.extend({ model: Backbone.Model, initialize: function() { this.localStorage = window.localStorage; }, fetch: function() { var history = []; var session = {}; var keys = Object.keys(this.localStorage); for (var i = 0; i < keys.length; i++) { session = {}; session.id = keys[i]; session.tree = JSON.parse(this.localStorage.getItem(this.localStorage.key(i))); history.push(session); } this.parse(history); this.trigger('sync'); }, parse: function(history) { _.each(history, _.bind(function(session) { session.checked = false; this.add(session); }, this)); }, getLatest: function() { this.fetch(); var len = this.models.length; return this.models[len-1]; }, deleteChecked: function() { var self = this; this.each(function(session) { var sessionId = session.get('id'); if (session.get('checked')) { console.log('Deleting session ' + sessionId); self.remove(sessionId); self.localStorage.removeItem(sessionId); } }); this.trigger('sync'); } });
Implement delete in history collection
Implement delete in history collection
JavaScript
mit
ptmccarthy/wikimapper,ptmccarthy/wikimapper
445c6fcf835af3c7af438864765a6a1ded2edecd
javascript/multivaluefield.js
javascript/multivaluefield.js
jQuery(function($) { function addNewField() { var self = $(this); var val = self.val(); // check to see if the one after us is there already - if so, we don't need a new one var li = $(this).closest('li').next('li'); if (!val) { // lets also clean up if needbe var nextText = li.find('input.mventryfield'); var detach = true; nextText.each (function () { if ($(this) && $(this).val() && $(this).val().length > 0) { detach = false; } }); if (detach) { li.detach(); } } else { if (li.length) { return; } self.closest("li").clone() .find("input").val("").end() .find("select").val("").end() .appendTo(self.parents("ul.multivaluefieldlist")); } $(this).trigger('multiValueFieldAdded'); } $(document).on("keyup", ".mventryfield", addNewField); $(document).on("change", ".mventryfield:not(input)", addNewField); });
jQuery(function($) { function addNewField() { var self = $(this); var val = self.val(); // check to see if the one after us is there already - if so, we don't need a new one var li = $(this).closest('li').next('li'); if (!val) { // lets also clean up if needbe var nextText = li.find('input.mventryfield'); var detach = true; nextText.each (function () { if ($(this) && $(this).val() && $(this).val().length > 0) { detach = false; } }); if (detach) { li.detach(); } } else { if (li.length) { return; } var append = self.closest("li").clone() .find(".has-chzn").show().removeClass("").data("chosen", null).end() .find(".chzn-container").remove().end(); // Assign the new inputs a unique ID, so that chosen picks up // the correct container. append.find("input, select").val("").attr("id", function() { var pos = this.id.lastIndexOf(":"); var num = parseInt(this.id.substr(pos + 1)); return this.id.substr(0, pos + 1) + (num + 1).toString(); }); append.appendTo(self.parents("ul.multivaluefieldlist")); } $(this).trigger('multiValueFieldAdded'); } $(document).on("keyup", ".mventryfield", addNewField); $(document).on("change", ".mventryfield:not(input)", addNewField); });
Allow multi value dropdowns to be used with chosen.
Allow multi value dropdowns to be used with chosen.
JavaScript
bsd-3-clause
souldigital/silverstripe-multivaluefield,souldigital/silverstripe-multivaluefield,designcity/silverstripe-multivaluefield,silverstripe-australia/silverstripe-multivaluefield,silverstripe-australia/silverstripe-multivaluefield,designcity/silverstripe-multivaluefield
18b18dd15046c89d4e81ab0d17f87a1733159cf7
app/assets/javascripts/directives/validation/validation_status.js
app/assets/javascripts/directives/validation/validation_status.js
ManageIQ.angular.app.directive('validationStatus', function() { return { require: 'ngModel', link: function (scope, elem, attrs, ctrl) { ctrl.$validators.validationRequired = function (modelValue, viewValue) { if (angular.isDefined(viewValue) && viewValue === true) { scope.postValidationModelRegistry(attrs.prefix); return true; } return false; }; } } });
ManageIQ.angular.app.directive('validationStatus', ['$rootScope', function($rootScope) { return { require: 'ngModel', link: function (scope, elem, attrs, ctrl) { ctrl.$validators.validationRequired = function (modelValue, viewValue) { if (angular.isDefined(viewValue) && viewValue === true) { scope.postValidationModelRegistry(attrs.prefix); return true; } else { $rootScope.$broadcast('setErrorOnTab', {tab: attrs.prefix}); return false; } }; } } }]);
Mark the tab with the error indicator the moment error is detected
Mark the tab with the error indicator the moment error is detected
JavaScript
apache-2.0
djberg96/manageiq,KevinLoiseau/manageiq,yaacov/manageiq,gmcculloug/manageiq,israel-hdez/manageiq,lpichler/manageiq,ailisp/manageiq,jvlcek/manageiq,gmcculloug/manageiq,tzumainn/manageiq,chessbyte/manageiq,jameswnl/manageiq,borod108/manageiq,kbrock/manageiq,romaintb/manageiq,jvlcek/manageiq,chessbyte/manageiq,mfeifer/manageiq,d-m-u/manageiq,gmcculloug/manageiq,gmcculloug/manageiq,aufi/manageiq,ailisp/manageiq,tinaafitz/manageiq,durandom/manageiq,josejulio/manageiq,agrare/manageiq,NickLaMuro/manageiq,josejulio/manageiq,mzazrivec/manageiq,agrare/manageiq,maas-ufcg/manageiq,romaintb/manageiq,mresti/manageiq,andyvesel/manageiq,jntullo/manageiq,branic/manageiq,romaintb/manageiq,skateman/manageiq,mkanoor/manageiq,juliancheal/manageiq,mresti/manageiq,tinaafitz/manageiq,tzumainn/manageiq,hstastna/manageiq,chessbyte/manageiq,mzazrivec/manageiq,skateman/manageiq,branic/manageiq,ManageIQ/manageiq,ilackarms/manageiq,gerikis/manageiq,mfeifer/manageiq,israel-hdez/manageiq,aufi/manageiq,maas-ufcg/manageiq,lpichler/manageiq,syncrou/manageiq,matobet/manageiq,israel-hdez/manageiq,jrafanie/manageiq,jntullo/manageiq,syncrou/manageiq,NaNi-Z/manageiq,branic/manageiq,maas-ufcg/manageiq,mzazrivec/manageiq,yaacov/manageiq,agrare/manageiq,romanblanco/manageiq,mkanoor/manageiq,djberg96/manageiq,romanblanco/manageiq,matobet/manageiq,tzumainn/manageiq,josejulio/manageiq,juliancheal/manageiq,kbrock/manageiq,mzazrivec/manageiq,pkomanek/manageiq,ManageIQ/manageiq,jameswnl/manageiq,ailisp/manageiq,jvlcek/manageiq,aufi/manageiq,maas-ufcg/manageiq,mresti/manageiq,yaacov/manageiq,d-m-u/manageiq,NickLaMuro/manageiq,josejulio/manageiq,jvlcek/manageiq,mresti/manageiq,aufi/manageiq,NickLaMuro/manageiq,billfitzgerald0120/manageiq,romaintb/manageiq,mfeifer/manageiq,pkomanek/manageiq,tinaafitz/manageiq,durandom/manageiq,mfeifer/manageiq,mkanoor/manageiq,hstastna/manageiq,ManageIQ/manageiq,branic/manageiq,andyvesel/manageiq,d-m-u/manageiq,fbladilo/manageiq,kbrock/manageiq,agrare/manageiq,fbladilo/manageiq,jameswnl/manageiq,romaintb/manageiq,djberg96/manageiq,mkanoor/manageiq,maas-ufcg/manageiq,fbladilo/manageiq,tzumainn/manageiq,jameswnl/manageiq,skateman/manageiq,jrafanie/manageiq,syncrou/manageiq,gerikis/manageiq,NaNi-Z/manageiq,fbladilo/manageiq,skateman/manageiq,ManageIQ/manageiq,durandom/manageiq,ailisp/manageiq,matobet/manageiq,ilackarms/manageiq,jntullo/manageiq,romanblanco/manageiq,borod108/manageiq,gerikis/manageiq,andyvesel/manageiq,NaNi-Z/manageiq,yaacov/manageiq,durandom/manageiq,romaintb/manageiq,KevinLoiseau/manageiq,tinaafitz/manageiq,pkomanek/manageiq,matobet/manageiq,chessbyte/manageiq,jntullo/manageiq,borod108/manageiq,hstastna/manageiq,gerikis/manageiq,juliancheal/manageiq,romanblanco/manageiq,kbrock/manageiq,jrafanie/manageiq,billfitzgerald0120/manageiq,juliancheal/manageiq,d-m-u/manageiq,andyvesel/manageiq,NaNi-Z/manageiq,KevinLoiseau/manageiq,ilackarms/manageiq,ilackarms/manageiq,pkomanek/manageiq,djberg96/manageiq,billfitzgerald0120/manageiq,borod108/manageiq,israel-hdez/manageiq,KevinLoiseau/manageiq,KevinLoiseau/manageiq,KevinLoiseau/manageiq,jrafanie/manageiq,lpichler/manageiq,NickLaMuro/manageiq,hstastna/manageiq,syncrou/manageiq,maas-ufcg/manageiq,billfitzgerald0120/manageiq,lpichler/manageiq
2346a2e653ba30424ac5a5be08a6bd741d7c3814
jest/moveSnapshots.js
jest/moveSnapshots.js
const fs = require('fs') const glob = require('glob') const outputDirectory = [process.argv[2] || 'snapshots'] .filter(x => x) .join('/') const createDir = dir => { const splitPath = dir.split('/') splitPath.reduce((path, subPath) => { if (!fs.existsSync(path)) { console.log(`Create directory at ${path}.`); fs.mkdirSync(path) } return `${path}/${subPath}` }) } glob('src/__snapshots__/*.snap', {}, (er, files) => { console.log({ argv: process.argv }) files.forEach(fileName => { const newName = fileName .replace(/__snapshots__\//g, '') .replace('src/', `${outputDirectory}/`) console.log(`Move file ${fileName} to ${newName}.`); createDir(newName) fs.renameSync(fileName, newName) }) glob('src/__snapshots__', {}, (er, files) => { files.forEach(fileName => { fs.rmdirSync(fileName) }) }) })
const fs = require('fs') const glob = require('glob') const outputDirectory = [process.argv[2] || 'snapshots'] .filter(x => x) .join('/') const createDir = dir => { const splitPath = dir.split('/') splitPath.reduce((path, subPath) => { if (path && !fs.existsSync(path)) { console.log(`Create directory at ${path}.`); fs.mkdirSync(path) } return `${path}/${subPath}` }) } glob('src/__snapshots__/*.snap', {}, (er, files) => { console.log({ argv: process.argv }) files.forEach(fileName => { const newName = fileName .replace(/__snapshots__\//g, '') .replace('src/', `${outputDirectory}/`) console.log(`Move file ${fileName} to ${newName}.`); createDir(newName) fs.renameSync(fileName, newName) }) glob('src/__snapshots__', {}, (er, files) => { files.forEach(fileName => { fs.rmdirSync(fileName) }) }) })
Fix path existence ensuring function
Fix path existence ensuring function
JavaScript
mit
Ciunkos/ciunkos.com
78c19a634a06277e134c3af1024f9648bc3d3b26
kolibri/core/assets/src/api-resources/facilityTask.js
kolibri/core/assets/src/api-resources/facilityTask.js
import { Resource } from 'kolibri.lib.apiResource'; export default new Resource({ name: 'facilitytask', /** * @param {string} facility * @return {Promise} */ dataportalsync(facility) { return this.postListEndpoint('startdataportalsync', { facility }); }, /** * @return {Promise} */ dataportalbulksync() { return this.postListEndpoint('startdataportalbulksync'); }, deleteFinishedTasks() { return this.postListEndpoint('deletefinishedtasks'); }, });
import { Resource } from 'kolibri.lib.apiResource'; export default new Resource({ name: 'facilitytask', /** * @param {string} facility * @return {Promise} */ dataportalsync(facility) { return this.postListEndpoint('startdataportalsync', { facility }); }, /** * @return {Promise} */ dataportalbulksync() { return this.postListEndpoint('startdataportalbulksync'); }, /** * @return {Promise} */ deleteFinishedTasks() { return this.postListEndpoint('deletefinishedtasks'); }, /** * @param {string} facility * @return {Promise} */ deleteFacility(facility) { return this.postListEndpoint('deletefacility', { facility }); }, });
Add JS resource for new endpoint
Add JS resource for new endpoint
JavaScript
mit
mrpau/kolibri,indirectlylit/kolibri,mrpau/kolibri,mrpau/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri
1827499c2e834072c488c5ec7b1e67eccde8e4ea
src/Select/partials/SelectInputFieldSize.js
src/Select/partials/SelectInputFieldSize.js
import styled from 'styled-components' import SelectInputField from './SelectInputField'; export default SelectInputField.withComponent('div').extend` position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; white-space: pre; `;
import styled from 'styled-components' import SelectInputField from './SelectInputField'; export default styled(SelectInputField.withComponent('div'))` position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; white-space: pre; `;
Remove use of extend API
Remove use of extend API To prevent warning `Warning: The "extend" API will be removed in the upcoming v4.0 release. Use styled(StyledComponent) instead. You can find more information here: https://github.com/styled-components/styled-components/issues/1546`
JavaScript
mit
agutoli/react-styled-select
8a175bd8b14dc91719fcd2aa40137fc1e20370b5
src/article/shared/InsertFootnoteCommand.js
src/article/shared/InsertFootnoteCommand.js
import { findParentByType } from './nodeHelpers' // TODO: move AddEntityCommand into shared import AddEntityCommand from '../metadata/AddEntityCommand' export default class InsertFootnoteCommand extends AddEntityCommand { detectScope (params) { const xpath = params.selectionState.xpath return xpath.indexOf('table-figure') > -1 ? 'table-figure' : 'default' } _getCollection (params, context) { const scope = this.detectScope(params) if (scope === 'default') { const collectionName = 'footnotes' return context.api.getModelById(collectionName) } else { const doc = params.editorSession.getDocument() const nodeId = params.selection.getNodeId() const node = doc.get(nodeId) const parentTable = findParentByType(node, 'table-figure') const tableModel = context.api.getModelById(parentTable.id) return tableModel.getFootnotes() } } }
import { findParentByType } from './nodeHelpers' // TODO: move AddEntityCommand into shared import AddEntityCommand from '../metadata/AddEntityCommand' export default class InsertFootnoteCommand extends AddEntityCommand { detectScope (params) { const xpath = params.selectionState.xpath return xpath.indexOf('table-figure') > -1 ? 'table-figure' : 'default' } _getCollection (params, context) { const scope = this.detectScope(params) if (scope === 'default') { const collectionName = 'footnotes' return context.api.getModelById(collectionName) } else { const doc = params.editorSession.getDocument() const nodeId = params.selection.getNodeId() const node = doc.get(nodeId) let tableNodeId = node.id // check if we are already selected table-figure if (node.type !== 'table-figure') { const parentTable = findParentByType(node, 'table-figure') tableNodeId = parentTable.id } const tableModel = context.api.getModelById(tableNodeId) return tableModel.getFootnotes() } } }
Address edge case when table-figure already selected.
Address edge case when table-figure already selected.
JavaScript
mit
substance/texture,substance/texture
79a7e9a58d3d6e724ae1e5b434210084f0e908bf
phantom/graph.js
phantom/graph.js
"use strict"; var page = require('webpage').create(), system = require('system'), address, output; if (system.args.length < 3 || system.args.length > 4) { console.log('Usage: graph.js IP filename'); phantom.exit(); } else { address = system.args[1]; output = system.args[2]; console.log("Fetching", address, "for", output); page.viewportSize = { width: 501, height: 233 }; page.onConsoleMessage = function (msg) { console.log('Page msg:', msg); }; page.customHeaders = { // "Referer": "http://www.pool.ntp.org/?graphs" }; page.settings.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"; page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); } else { window.setTimeout(function () { page.clipRect = { top: 0, left: 20, width: 501, height: 233 }; page.render(output); phantom.exit(); }, 200); } }); }
"use strict"; var page = require('webpage').create(), system = require('system'), address, output; if (system.args.length < 3 || system.args.length > 4) { console.log('Usage: graph.js url filename'); phantom.exit(1); } else { address = system.args[1]; output = system.args[2]; console.log("Fetching", address, "for", output); page.viewportSize = { width: 501, height: 233 }; page.onConsoleMessage = function (msg) { console.log('Page msg:', msg); }; page.customHeaders = { // "Referer": "http://www.pool.ntp.org/?graphs" }; page.settings.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"; page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!', status); phantom.exit(2); } else { window.setTimeout(function () { page.clipRect = { top: 0, left: 20, width: 501, height: 233 }; page.render(output); phantom.exit(); }, 200); } }); }
Make sure the phantomjs script doesn't hang on failures
Make sure the phantomjs script doesn't hang on failures
JavaScript
apache-2.0
punitvara/ntppool,punitvara/ntppool,tklauser/ntppool,tklauser/ntppool,tklauser/ntppool,tklauser/ntppool,punitvara/ntppool
a03061c9710dda8faf1d10eb664206b41835be96
lib/assets/javascripts/dashboard/components/footer/footer-view.js
lib/assets/javascripts/dashboard/components/footer/footer-view.js
const CoreView = require('backbone/core-view'); const template = require('./footer.tpl'); const checkAndBuildOpts = require('builder/helpers/required-opts'); const REQUIRED_OPTS = [ 'configModel' ]; /** * Decide what support block app should show */ module.exports = CoreView.extend({ tagName: 'footer', className: function () { let classes = 'CDB-Text CDB-FontSize-medium Footer Footer--public u-pr'; if (this.options.light) { classes += ' Footer--light'; } return classes; }, initialize: function (options) { checkAndBuildOpts(options, REQUIRED_OPTS, this); }, render: function () { this.$el.html( template({ onpremiseVersion: this._configModel.get('onpremise_version'), isHosted: this._configModel.get('cartodb_com_hosted') }) ); return this; } });
const CoreView = require('backbone/core-view'); const template = require('./footer.tpl'); const checkAndBuildOpts = require('builder/helpers/required-opts'); const REQUIRED_OPTS = [ 'configModel' ]; /** * Decide what support block app should show */ module.exports = CoreView.extend({ tagName: 'footer', className: function () { let classes = 'CDB-Text CDB-FontSize-medium Footer'; if (this.options.light) { classes += ' Footer--light'; } return classes; }, initialize: function (options) { checkAndBuildOpts(options, REQUIRED_OPTS, this); }, render: function () { this.$el.html( template({ onpremiseVersion: this._configModel.get('onpremise_version'), isHosted: this._configModel.get('cartodb_com_hosted') }) ); return this; } });
Fix footer in static pages
Fix footer in static pages
JavaScript
bsd-3-clause
CartoDB/cartodb,CartoDB/cartodb,CartoDB/cartodb,CartoDB/cartodb,CartoDB/cartodb
4122f817b94d9f518c12a01c5d77e719726c2ac6
src/gallery.js
src/gallery.js
import mediumZoom from 'src/config/medium-zoom'; import lqip from 'src/modules/lqip'; import galleryLoader from 'src/modules/gallery-lazy-load'; window.addEventListener('DOMContentLoaded', () => { galleryLoader({ afterInsert(lastPost) { lqip({ selectorRoot: lastPost, afterReplace: (lqipImage, originalImage) => { if (lqipImage) lqipImage.remove(); mediumZoom(originalImage); }, }) }, }); lqip({ afterReplace: (lqipImage, originalImage) => { if (lqipImage) lqipImage.remove(); mediumZoom(originalImage); }, }); });
import mediumZoom from 'src/config/medium-zoom'; import lqip from 'src/modules/lqip'; import galleryLoader from 'src/modules/gallery-lazy-load'; window.addEventListener('DOMContentLoaded', () => { galleryLoader({ afterInsert(lastPost) { lqip({ selectorRoot: lastPost, rootMargin: '0px', afterReplace: (lqipImage, originalImage) => { if (lqipImage) lqipImage.remove(); mediumZoom(originalImage); }, }) }, }); lqip({ afterReplace: (lqipImage, originalImage) => { if (lqipImage) lqipImage.remove(); mediumZoom(originalImage); }, }); });
Use low root margin to prevent premature loading of images
Use low root margin to prevent premature loading of images
JavaScript
mit
tuelsch/bolg,tuelsch/bolg
784c672f4b0c9b42d5b6431a0a155a164493669d
client/src/sagas.js
client/src/sagas.js
export default function* rootSaga() { }
import { createBrowserHistory as createHistory, saga as router } from 'redux-tower'; import routes from './routes' import { fork } from 'redux-saga/effects' const history = createHistory(); export default function* rootSaga() { yield fork(router, {history, routes}); }
Add router saga to rootSaga
Add router saga to rootSaga
JavaScript
mit
ygkn/DJ-YAGICHAN-SYSTEM,ygkn/DJ-YAGICHAN-SYSTEM
73918b480e9f028b7884eec9658376788f07b6fc
src/js/menu.js
src/js/menu.js
(function() { 'use strict'; function Menu() { this.titleTxt = null; this.startTxt = null; } Menu.prototype = { create: function () { this.background = this.add.tileSprite(0, 0, this.world.width, this.world.height, 'background'); var text = 'Dodger\n\nClick to start' , style = { font: '40px Arial', fill: '#ffffff', align: 'center' } , t = this.add.text(this.game.world.centerX, this.game.world.centerY, text, style); t.anchor.set(0.5, 0.5); this.input.onDown.add(this.onDown, this); }, update: function () { this.background.tilePosition.y += 2; }, onDown: function () { this.game.state.start('game'); } }; window['dodger'] = window['dodger'] || {}; window['dodger'].Menu = Menu; }());
(function() { 'use strict'; function Menu() { this.titleTxt = null; this.startTxt = null; } Menu.prototype = { create: function () { this.background = this.add.tileSprite(0, 0, this.world.width, this.world.height, 'background'); var text = 'Dodger' , style = { font: '40px Arial', fill: '#ffffff', align: 'center' } , t = this.add.text(this.game.world.centerX, this.game.world.centerY, text, style); t.anchor.set(0.5, 0.5); text = 'Click to start' style = { font: '30px Arial', fill: '#ffffff', align: 'center' } t = this.add.text(this.game.world.centerX, this.game.world.centerY + 80, text, style); t.anchor.set(0.5, 0.5); this.input.onDown.add(this.onDown, this); }, update: function () { this.background.tilePosition.y += 2; }, onDown: function () { this.game.state.start('game'); } }; window['dodger'] = window['dodger'] || {}; window['dodger'].Menu = Menu; }());
Change text style for instructions
Change text style for instructions
JavaScript
mit
cravesoft/dodger,cravesoft/dodger
69220b4c4c2ec3d4c24db037db0f5a0c7319299c
pairs.js
pairs.js
var People = new Mongo.Collection("people"); if (Meteor.isClient) { Template.body.helpers({ people: function () { return People.find({}); } }); Template.body.events({ "submit .new-person": function (event) { var commaSeparator = /\s*,\s*/; var name = event.target.name.value; var learning = event.target.learning.value.split(commaSeparator); var teaching = event.target.teaching.value.split(commaSeparator); People.insert({ name: name, learning: learning, teaching: teaching }); event.target.name.value = ""; $(event.target.learning).clearOptions(); $(event.target.teaching).clearOptions(); return false; } }); $(document).ready(function () { $('.input-list').selectize({ create: function (input) { return { value: input, text: input }; } }); }); }
var People = new Mongo.Collection("people"); if (Meteor.isClient) { Template.body.helpers({ people: function () { return People.find({}); } }); Template.body.events({ "submit .new-person": function (event) { var commaSeparator = /\s*,\s*/; var name = event.target.name.value; var learning = event.target.learning.value.split(commaSeparator); var teaching = event.target.teaching.value.split(commaSeparator); People.insert({ name: name, learning: learning, teaching: teaching }); event.target.name.value = ""; $(event.target.learning).clearOptions(); $(event.target.teaching).clearOptions(); return false; } }); $(document).ready(function () { $('.input-list').selectize({ create: function (input) { return { value: input, text: input }; }, plugins: [ 'remove_button' ] }); }); }
Add remove buttons to selectize tags
Add remove buttons to selectize tags
JavaScript
mit
paircolumbus/pairs,paircolumbus/pairs
27fbc59c87a41eebd9e6a4ebf0a7d87c0d3ba5f1
lib/app/getBaseurl.js
lib/app/getBaseurl.js
/** * Module dependencies */ var _ = require ('lodash'); /** * Calculate the base URL (useful in emails, etc.) * @return {String} [description] */ module.exports = function getBaseurl() { var sails = this; var usingSSL = sails.config.ssl && sails.config.ssl.key && sails.config.ssl.cert; var host = sails.getHost() || 'localhost'; var port = sails.config.proxyPort || sails.config.port; var probablyUsingSSL = (port === 443); // If host doesn't contain `http*` already, include the protocol string. var protocolString = ''; if (!_.contains(host,'http')) { protocolString = ((usingSSL || probablyUsingSSL) ? 'https' : 'http') + '://'; } var portString = (port === 80 || port === 443 ? '' : ':' + port); var localAppURL = protocolString + host + portString; return localAppURL; };
/** * Module dependencies */ var _ = require ('lodash'); /** * Calculate the base URL (useful in emails, etc.) * @return {String} [description] */ module.exports = function getBaseurl() { var sails = this; var usingSSL = sails.config.ssl === true || (sails.config.ssl && ((sails.config.ssl.key && sails.config.ssl.cert) || sails.config.ssl.pfx)); var host = sails.getHost() || 'localhost'; var port = sails.config.proxyPort || sails.config.port; var probablyUsingSSL = (port === 443); // If host doesn't contain `http*` already, include the protocol string. var protocolString = ''; if (!_.contains(host,'http')) { protocolString = ((usingSSL || probablyUsingSSL) ? 'https' : 'http') + '://'; } var portString = (port === 80 || port === 443 ? '' : ':' + port); var localAppURL = protocolString + host + portString; return localAppURL; };
Update logic in getBaseUrl determining if SSL is being used, to match http hook
Update logic in getBaseUrl determining if SSL is being used, to match http hook
JavaScript
mit
jianpingw/sails,balderdashy/sails,Hanifb/sails,rlugojr/sails,rlugojr/sails,jianpingw/sails
8c499badf087794fc5d9f2109a6a2d64e03cb53d
frontend/app/models/release.js
frontend/app/models/release.js
import Model from 'ember-data/model'; import {belongsTo, hasMany} from 'ember-data/relationships'; import attr from 'ember-data/attr'; export default Model.extend({ artist: attr('string'), title: attr('string'), year: attr('number'), genre: attr('string'), company: attr('string'), cpa: attr('string'), arrivaldate: attr('date'), local: attr('boolean'), demo: attr('boolean'), female: attr('boolean'), compilation: attr('boolean'), owner: attr('string'), timestamp: attr('date'), tracks: hasMany('track', {inverse: 'release'}) });
import Model from 'ember-data/model'; import {belongsTo, hasMany} from 'ember-data/relationships'; import attr from 'ember-data/attr'; export default Model.extend({ artist: attr('string'), title: attr('string'), year: attr('number'), genre: attr('string'), company: attr('string'), cpa: attr('string'), arrivaldate: attr('date'), local: attr('number'), demo: attr('number'), female: attr('number'), compilation: attr('number'), owner: attr('string'), timestamp: attr('date'), tracks: hasMany('track', {inverse: 'release'}), isLocal: Ember.computed('local', function() { if (this.get('local') == 1) { return false; } else if (this.get('local') == 2) { return 'Local'; } else if (this.get('local') == 3) { return 'Some Local'; } }), isFemale: Ember.computed('female', function() { if (this.get('female') == 1) { return false; } else if (this.get('female') == 2) { return 'Female'; } else if (this.get('female') == 3) { return 'Some Female'; } }), isCompilation: Ember.computed('compilation', function() { return this.get('compilation') != 1; }) });
Change some Release attributes to match the json.
Change some Release attributes to match the json.
JavaScript
mit
ThreeDRadio/playlists,ThreeDRadio/playlists,ThreeDRadio/playlists
46f1cd6aed617e033ef0705c1b012a36d521f95c
src/js/Helpers/AccelerationLogic.js
src/js/Helpers/AccelerationLogic.js
import { translate, rand, vLog, objToArr, getR, massToRadius, filterClose, vectorToString } from './VectorHelpers'; import { GRAVITY, PLANET_SPRING } from './Constants'; const getGravityAccel = (vR, mass) => { const rMag2 = vR.lengthSq(); const rNorm = vR.normalize(); const accel = rNorm.multiplyScalar(GRAVITY * mass / rMag2); return accel; }; // const getCollisionAccel = (vR, m1, r1, r2) => { // return vr.normalize().multiplyScalar(PLANET_SPRING / m1 * (vr.length() - (r1 + r2))); // }; const getNetAccel = (originBody, otherBodies) => { let netAccel = new THREE.Vector3(); let vR; for (var i = 0; i < otherBodies.length; i++) { vR = getR(originBody, otherBodies[i]); netAccel.add(getGravityAccel(vR, otherBodies[i].mass)) } return netAccel; }; export { getNetAccel, }
import { translate, rand, vLog, objToArr, getR, massToRadius, filterClose, vectorToString } from './VectorHelpers'; import { GRAVITY, PLANET_SPRING } from './Constants'; const getGravityAccel = (vR, mass) => { const rMag2 = vR.lengthSq(); const rNorm = vR.normalize(); return rNorm.multiplyScalar(GRAVITY * mass / rMag2); }; const getCollisionAccel = (vR, m1, r1, r2) => { return new THREE.Vector3(vR).normalize().multiplyScalar(PLANET_SPRING / m1 * (vR.length() - (r1 + r2))); }; const getNetAccel = (originBody, otherBodies) => { return otherBodies.reduce((netAccel, otherBody) => { const vR = getR(originBody, otherBody); if (vR.length() < originBody.radius + otherBody.radius) { netAccel.add(getCollisionAccel(vR, originBody.mass, originBody.radius, otherBody.radius)); } return netAccel.add(getGravityAccel(vR, otherBody.mass)); }, new THREE.Vector3()); }; export { getNetAccel, }
Add code for collisions (untested)
Add code for collisions (untested)
JavaScript
mit
elliotaplant/celestial-dance,elliotaplant/celestial-dance
26a2a896c5333e286e16619bc8c9d268d30a814f
ruby_event_store-browser/elm/tailwind.config.js
ruby_event_store-browser/elm/tailwind.config.js
module.exports = { theme: { extend: {} }, variants: {}, plugins: [] }
module.exports = { purge: ['./src/style/style.css'], theme: { extend: {} }, variants: {}, plugins: [] }
Purge tailwindcss classes not mentioned in apply
Purge tailwindcss classes not mentioned in apply [#867]
JavaScript
mit
arkency/rails_event_store,arkency/rails_event_store,RailsEventStore/rails_event_store,RailsEventStore/rails_event_store,RailsEventStore/rails_event_store,arkency/rails_event_store,arkency/rails_event_store,RailsEventStore/rails_event_store
b99b971210da9951ff468519bd1066a68d885c78
server/config/middleware.js
server/config/middleware.js
var bodyParser = require('body-parser'); var db = require('../models/index'); module.exports = function (app, express) { //Handle CORS app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', 'http://localhost:3000/'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, X-AUTHENTICATION, X-IP, Content-Type, Accept'); res.header('Access-Control-Allow-Credentials', true); next(); }); //Serve up static files in client folder and other middleware app.use(bodyParser.json()); app.use(express.static(__dirname + '/../../client')); //For debugging. Log every request app.use(function (req, res, next) { console.log('=========================================='); console.log(req.method + ': ' + req.url); next(); }); };
var bodyParser = require('body-parser'); var db = require('../models/index'); module.exports = function (app, express) { //Handle CORS app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', 'http://localhost:3000/'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, X-AUTHENTICATION, X-IP, Content-Type, Accept'); res.header('Access-Control-Allow-Credentials', true); next(); }); //Serve up static files in client folder and other middleware app.use(bodyParser.json()); app.use(express.static(__dirname + '/../../client/public')); //For debugging. Log every request app.use(function (req, res, next) { console.log('=========================================='); console.log(req.method + ': ' + req.url); next(); }); };
Update static file directory to /public subfolder
Update static file directory to /public subfolder
JavaScript
mit
benjaminhoffman/Encompass,benjaminhoffman/Encompass,benjaminhoffman/Encompass
39fb8e8ef10506fb4ae401d2de1c6ef0e27086f0
regulations/static/regulations/js/source/models/preamble-model.js
regulations/static/regulations/js/source/models/preamble-model.js
'use strict'; var URI = require('urijs'); var _ = require('underscore'); var Backbone = require('backbone'); var MetaModel = require('./meta-model'); Backbone.PreambleModel = MetaModel.extend({ getAJAXUrl: function(id) { var path = ['preamble'].concat(id.split('-')); if (window.APP_PREFIX) { path = [window.APP_PREFIX].concat(path); } return URI() .path(path.join('/')) .addQuery({partial: 'true'}) .toString(); } }); module.exports = new Backbone.PreambleModel({});
'use strict'; var URI = require('urijs'); var _ = require('underscore'); var Backbone = require('backbone'); var MetaModel = require('./meta-model'); Backbone.PreambleModel = MetaModel.extend({ getAJAXUrl: function(id) { // window.APP_PREFIX always ends in a slash var path = [window.APP_PREFIX + 'preamble'].concat(id.split('-')); return URI() .path(path.join('/')) .addQuery({partial: 'true'}) .toString(); } }); module.exports = new Backbone.PreambleModel({});
Fix logic around AJAXing in preamble sections
Fix logic around AJAXing in preamble sections
JavaScript
cc0-1.0
eregs/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,18F/regulations-site,18F/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site
beef2838049f4d14fecd18ec19d8bc1ea183a036
lib/validate-admin.js
lib/validate-admin.js
/** * Middleware that only allows users to pass that have their isAdmin flag set. */ function validateToken (req, res, next) { const user = req.decoded if (!user.isAdmin) { res.status(403).json({ success: false, message: `Permission denied: ${JSON.stringify(user.sub)}` }) return } next() } module.exports = validateToken
/** * Middleware that only allows users to pass that have their isAdmin flag set. */ function validateAdmin (req, res, next) { const user = req.decoded if (!user.isAdmin) { res.status(403).json({ success: false, message: `Permission denied: ${JSON.stringify(user.sub)}` }) return } next() } module.exports = validateAdmin
Rename module's function to reflect module name.
Rename module's function to reflect module name.
JavaScript
agpl-3.0
amos-ws16/amos-ws16-arrowjs-server,amos-ws16/amos-ws16-arrowjs-server
1291e59bbf295918de6bcfc430d766717f46f5fa
stories/tab.js
stories/tab.js
import React from 'react' import { storiesOf } from '@storybook/react' import { action } from '@storybook/addon-actions' import Tab from 'components/Tab/Tab' import DraggableTab from 'components/Tab/DraggableTab' import Icon from 'components/Tab/Icon' import store from '../.storybook/mock-store' const { tabs } = store.windowStore const tabProps = () => ({ ...tabs[Math.floor(Math.random() * tabs.length)], dragPreview: action('dragPreview'), getWindowList: action('getWindowList'), faked: true }) storiesOf('Tab', module) .add('DraggableTab', () => ( <DraggableTab {...tabProps()} /> )) .add('Tab', () => ( <Tab {...tabProps()} /> )) .add('Pinned DraggableTab', () => ( <DraggableTab {...tabProps()} pinned /> )) .add('Pinned Tab', () => ( <Tab {...tabProps()} pinned /> )) const iconStory = storiesOf('Icon', module) ;[ 'bookmarks', 'chrome', 'crashes', 'downloads', 'extensions', 'flags', 'history', 'settings' ].map((x) => { iconStory.add(`Chrome Icon ${x}`, () => ( <Icon {...tabProps()} url={`chrome://${x}`} /> )) })
import React from 'react' import { storiesOf } from '@storybook/react' import { action } from '@storybook/addon-actions' import Tab from 'components/Tab/Tab' import DraggableTab from 'components/Tab/DraggableTab' import Icon from 'components/Tab/Icon' import windows from '../.storybook/windows' const tabs = [].concat(...windows.map(x => x.tabs)) const tabProps = () => ({ ...tabs[Math.floor(Math.random() * tabs.length)], dragPreview: action('dragPreview'), getWindowList: action('getWindowList'), faked: true }) storiesOf('Tab', module) .add('DraggableTab', () => ( <DraggableTab {...tabProps()} /> )) .add('Tab', () => ( <Tab {...tabProps()} /> )) .add('Pinned DraggableTab', () => ( <DraggableTab {...tabProps()} pinned /> )) .add('Pinned Tab', () => ( <Tab {...tabProps()} pinned /> )) const iconStory = storiesOf('Icon', module) ;[ 'bookmarks', 'chrome', 'crashes', 'downloads', 'extensions', 'flags', 'history', 'settings' ].map((x) => { iconStory.add(`Chrome Icon ${x}`, () => ( <Icon {...tabProps()} url={`chrome://${x}`} /> )) })
Fix story bug for Tab
Fix story bug for Tab
JavaScript
mit
xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2
05864ed7dd4cf0cf8a0c19ba8c37bc73afb600c3
build/builder-config.js
build/builder-config.js
/** * Copyright (c) Ajay Sreedhar. All rights reserved. * * Licensed under the MIT License. * Please see LICENSE file located in the project root for more information. */ 'use strict'; const releaseConfig = { appId: 'com.kongdash', productName: 'KongDash', copyright: 'Copyright (c) 2022 Ajay Sreedhar', asar: true, compression: 'normal', removePackageScripts: true, nodeGypRebuild: false, buildDependenciesFromSource: false, files: [ { from: 'dist/platform', to: 'platform' }, { from: 'dist/workbench', to: 'workbench' }, 'package.json' ], directories: { output: 'release' }, extraResources: [ { from: 'resources/themes', to: 'themes' } ], extraMetadata: { main: 'platform/main.js' } }; module.exports = {releaseConfig};
/** * Copyright (c) Ajay Sreedhar. All rights reserved. * * Licensed under the MIT License. * Please see LICENSE file located in the project root for more information. */ 'use strict'; const releaseConfig = { appId: 'com.kongdash', productName: 'KongDash', copyright: 'Copyright (c) 2022 Ajay Sreedhar', asar: true, compression: 'normal', removePackageScripts: true, nodeGypRebuild: false, buildDependenciesFromSource: false, files: [ { from: 'out/platform', to: 'platform' }, { from: 'out/workbench', to: 'workbench' }, 'package.json' ], directories: { output: 'dist' }, extraResources: [ { from: 'resources/themes', to: 'themes' } ], extraMetadata: { main: 'platform/main.js' } }; module.exports = {releaseConfig};
Rename release directory name to Out
change: Rename release directory name to Out
JavaScript
mit
ajaysreedhar/kongdash,ajaysreedhar/kongdash,ajaysreedhar/kongdash
a77cae24fb8e0560d2e2bc86f6c08a62b7b36d9d
packages/basic-component-mixins/test/ShadowTemplate.tests.js
packages/basic-component-mixins/test/ShadowTemplate.tests.js
import { assert } from 'chai'; import ShadowTemplate from '../src/ShadowTemplate'; window.MyElement = class MyElement extends HTMLElement { greet() { return `Hello!`; } }; customElements.define('my-element', MyElement); /* Element with a simple template */ class ElementWithStringTemplate extends ShadowTemplate(HTMLElement) { get template() { return "Hello"; } } customElements.define('element-with-string-template', ElementWithStringTemplate); /* Element with a real template */ let template = document.createElement('template'); template.content.textContent = "Hello"; class ElementWithRealTemplate extends ShadowTemplate(HTMLElement) { get template() { return template; } } customElements.define('element-with-real-template', ElementWithRealTemplate); describe("ShadowTemplate mixin", () => { it("stamps string template into root", () => { let element = document.createElement('element-with-string-template'); assert(element.shadowRoot); assert.equal(element.shadowRoot.textContent.trim(), "Hello"); }); it("stamps real template into root", () => { let element = document.createElement('element-with-real-template'); assert(element.shadowRoot); assert.equal(element.shadowRoot.textContent.trim(), "Hello"); }); });
import { assert } from 'chai'; import ShadowTemplate from '../src/ShadowTemplate'; class MyElement extends HTMLElement { greet() { return `Hello!`; } } customElements.define('my-element', MyElement); /* Element with a simple template */ class ElementWithStringTemplate extends ShadowTemplate(HTMLElement) { get template() { return "Hello"; } } customElements.define('element-with-string-template', ElementWithStringTemplate); /* Element with a real template */ let template = document.createElement('template'); template.content.textContent = "Hello"; class ElementWithRealTemplate extends ShadowTemplate(HTMLElement) { get template() { return template; } } customElements.define('element-with-real-template', ElementWithRealTemplate); describe("ShadowTemplate mixin", () => { it("stamps string template into root", () => { let element = document.createElement('element-with-string-template'); assert(element.shadowRoot); assert.equal(element.shadowRoot.textContent.trim(), "Hello"); }); it("stamps real template into root", () => { let element = document.createElement('element-with-real-template'); assert(element.shadowRoot); assert.equal(element.shadowRoot.textContent.trim(), "Hello"); }); });
Remove global reference intended only for debugging.
Remove global reference intended only for debugging.
JavaScript
mit
rlugojr/basic-web-components,basic-web-components/basic-web-components,basic-web-components/basic-web-components,rlugojr/basic-web-components
f9cb778aee192923d927d8f1cd2921e235485128
packages/idyll-components/src/map.js
packages/idyll-components/src/map.js
const React = require('react'); const { mapChildren } = require('idyll-component-children'); import TextContainer from './text-container'; class Map extends React.Component { render() { const { idyll, hasError, updateProps, children, value, currentValue } = this.props; if (children) { return mapChildren(children, child => { return value.map(val => { let newProps = Object.assign({}, child.props); newProps = Object.keys(child.props).reduce((props, elm) => { if (props[elm] === currentValue) { props[elm] = val; return props; } return props; }, newProps); return ( <TextContainer> <div> {React.cloneElement(child, { ...newProps })} </div> </TextContainer> ); }); }); } return null; } } Map._idyll = { name: 'Map', tagType: 'open', children: ['Some text'], props: [ { name: 'value', type: 'array', example: "['one', 'two', 'three']", description: 'Array of values to map.' }, { name: 'currentValue', type: 'string', example: 'iterator', description: 'Value of the current element being processed from the array.' } ] }; module.exports = Map;
const React = require('react'); const { mapChildren } = require('idyll-component-children'); import TextContainer from './text-container'; class Map extends React.Component { render() { const { children, value, currentValue } = this.props; if (children) { return mapChildren(children, child => { return value.map(val => { let newProps = Object.assign({}, child.props); newProps = Object.keys(child.props).reduce((props, elm) => { if (props[elm] === currentValue) { props[elm] = val; return props; } return props; }, newProps); return React.cloneElement(child, { ...newProps }); }); }); } return null; } } Map._idyll = { name: 'Map', tagType: 'open', children: ['Some text'], props: [ { name: 'value', type: 'array', example: "['one', 'two', 'three']", description: 'Array of values to map.' }, { name: 'currentValue', type: 'string', example: 'iterator', description: 'Value of the current element being processed from the array.' } ] }; module.exports = Map;
Update Map Component: remove TextContainer
Update Map Component: remove TextContainer
JavaScript
mit
idyll-lang/idyll,idyll-lang/idyll
f3865e87a30c9c93709a2e558e2e1de3c7712df8
src/app/consumer/phantomrunner.js
src/app/consumer/phantomrunner.js
/** * @fileoverview Run phantom bootstrapper jobs * Spawns a child process to run the phantomjs job, with a callback on * completion */ var childProcess = require('child_process'), phantomjs = require('phantomjs'), binPath = phantomjs.path, config = require('../../config'); // Host mapping of environments to js livefyre.js file hosts var hostMap = { 'prod': 'zor', 'staging': 'zor.t402', 'qa': 'zor.qa-ext' }; /** * @param {string} type * @param {Object} data * @param {function()} callback */ exports.run = function(type, data, callback) { data.host = (hostMap[config.environment.type] || 'zor') + '.livefyre.com'; var childArgs = [ __dirname + '/../../phantom/bootstrapper.js', type, encodeURIComponent(JSON.stringify(data)) ]; console.log('Running phantom child proc to get bs data', data); var phantomInst = childProcess.spawn(binPath, childArgs), html = ''; phantomInst.stdout.on('data', function(data) { html += data.toString(); }); phantomInst.on('error', function(err) { console.error('Something went wrong with phantom child proc'); console.error(err.toString()); }); phantomInst.on('close', function() { callback(html); }); };
/** * @fileoverview Run phantom bootstrapper jobs * Spawns a child process to run the phantomjs job, with a callback on * completion */ var childProcess = require('child_process'), phantomjs = require('phantomjs'), binPath = phantomjs.path, config = require('../../config'); // Host mapping of environments to js livefyre.js file hosts var hostMap = { 'prod': 'zor', 'staging': 'zor.t402', 'qa': 'zor.qa-ext' }; /** * @param {string} type * @param {Object} data * @param {function()} callback */ exports.run = function(type, data, callback) { data.host = (hostMap[config.environment.type] || 'zor') + '.livefyre.com'; var childArgs = [ '--load-images=false', '--disk-cache=true', __dirname + '/../../phantom/bootstrapper.js', type, encodeURIComponent(JSON.stringify(data)) ]; console.log('Running phantom child proc to get bs data', data); var phantomInst = childProcess.spawn(binPath, childArgs), html = ''; phantomInst.stdout.on('data', function(data) { html += data.toString(); }); phantomInst.on('error', function(err) { console.error('Something went wrong with phantom child proc'); console.error(err.toString()); }); phantomInst.on('close', function() { callback(html); }); };
Add optional arguments to improve phantomjs rendering perf.
Add optional arguments to improve phantomjs rendering perf. disk-cache=true will enable disk cache. load-images=false will prevent phantomjs from having to wait for slow image servers / cdns to be ready.
JavaScript
mit
Livefyre/lfbshtml,Livefyre/lfbshtml,Livefyre/lfbshtml
c09f44c763b69b86ec323bc0c7fb7506d47e9e34
lib/io.js
lib/io.js
(function() { 'use strict'; this.IO = { load: function(url, async) { if (async) { return this.loadAsync(url); } return this.loadSync(url); }, loadAsync: function(url) { var deferred = when.defer(); var xhr = new XMLHttpRequest(); xhr.overrideMimeType('text/plain'); xhr.addEventListener('load', function() { if (xhr.status == 200) { deferred.resolve(xhr.responseText); } else { deferred.reject(); } }); xhr.addEventListener('abort', function(e) { return when.reject(e); }); xhr.open('GET', url, true); xhr.send(''); return deferred.promise; }, loadSync: function(url) { var deferred = when.defer(); var xhr = new XMLHttpRequest(); xhr.overrideMimeType('text/plain'); xhr.open('GET', url, false); xhr.send(''); if (xhr.status == 200) { defer.resolve(xhr.responseText); } else { defer.reject(); } return defer.promise; } } }).call(L20n);
(function() { 'use strict'; this.IO = { load: function(url, async) { var deferred = when.defer(); var xhr = new XMLHttpRequest(); xhr.overrideMimeType('text/plain'); xhr.addEventListener('load', function() { if (xhr.status == 200) { deferred.resolve(xhr.responseText); } else { deferred.reject(); } }); xhr.addEventListener('abort', function(e) { return deferred.reject(e); }); xhr.open('GET', url, async); xhr.send(''); return deferred.promise; }, } }).call(L20n);
Simplify IO and fix the s/defer/deferred/ typo
Simplify IO and fix the s/defer/deferred/ typo
JavaScript
apache-2.0
zbraniecki/fluent.js,zbraniecki/fluent.js,projectfluent/fluent.js,mail-apps/l20n.js,projectfluent/fluent.js,Pike/l20n.js,l20n/l20n.js,mail-apps/l20n.js,projectfluent/fluent.js,stasm/l20n.js,Swaven/l20n.js,Pike/l20n.js,zbraniecki/l20n.js
490e5c6f3847ea49163e788bf25a3e808f45199f
src/server/modules/user/index.js
src/server/modules/user/index.js
import jwt from 'jsonwebtoken'; // Components import UserDAO from './sql'; import schema from './schema.graphqls'; import createResolvers from './resolvers'; import { refreshTokens } from './auth'; import tokenMiddleware from './token'; import Feature from '../connector'; const SECRET = 'secret, change for production'; const User = new UserDAO(); export default new Feature({ schema, createResolversFunc: createResolvers, createContextFunc: async (req, connectionParams) => { let tokenUser = null; if ( connectionParams && connectionParams.token && connectionParams.token !== 'null' ) { try { const { user } = jwt.verify(connectionParams.token, SECRET); tokenUser = user; } catch (err) { const newTokens = await refreshTokens( connectionParams.token, connectionParams.refreshToken, User, SECRET ); tokenUser = newTokens.user; } } else if (req) { tokenUser = req.user; } return { User, user: tokenUser, SECRET, req }; }, middleware: tokenMiddleware(SECRET, User) });
import jwt from 'jsonwebtoken'; // Components import UserDAO from './sql'; import schema from './schema.graphqls'; import createResolvers from './resolvers'; import { refreshTokens } from './auth'; import tokenMiddleware from './token'; import Feature from '../connector'; const SECRET = 'secret, change for production'; const User = new UserDAO(); export default new Feature({ schema, createResolversFunc: createResolvers, createContextFunc: async (req, connectionParams) => { let tokenUser = null; if ( connectionParams && connectionParams.token && connectionParams.token !== 'null' && connectionParams.token !== 'undefined' ) { try { const { user } = jwt.verify(connectionParams.token, SECRET); tokenUser = user; } catch (err) { const newTokens = await refreshTokens( connectionParams.token, connectionParams.refreshToken, User, SECRET ); tokenUser = newTokens.user; } } else if (req) { tokenUser = req.user; } return { User, user: tokenUser, SECRET, req }; }, middleware: tokenMiddleware(SECRET, User) });
Handle another corner case where refreshToken is undefined
Handle another corner case where refreshToken is undefined
JavaScript
mit
sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit
5601159d3578b952adeda6c7f87beefc86976724
site/webpack.mix.js
site/webpack.mix.js
let argv = require('yargs').argv; let command = require('node-cmd'); let jigsaw = require('./tasks/bin'); let mix = require('laravel-mix'); let AfterBuild = require('on-build-webpack'); let BrowserSync = require('browser-sync'); let BrowserSyncPlugin = require('browser-sync-webpack-plugin'); let Watch = require('webpack-watch'); const env = argv.e || argv.env || 'local'; const port = argv.p || argv.port || 3000; const buildPath = 'build_' + env + '/'; let browserSyncInstance; let plugins = [ new AfterBuild(() => { command.get(jigsaw.path() + ' build ' + env, (error, stdout, stderr) => { console.log(error ? stderr : stdout); browserSyncInstance.reload(); }); }), new BrowserSyncPlugin({ proxy: null, port: port, server: { baseDir: buildPath }, notify: false, }, { reload: false, callback: function() { browserSyncInstance = BrowserSync.get('bs-webpack-plugin'); }, }), new Watch({ paths: ['source/**/*.md', 'source/**/*.php'], options: { ignoreInitial: true } }), ]; mix.webpackConfig({ plugins }); mix.disableSuccessNotifications(); mix.setPublicPath('source/assets/'); mix.js('source/_assets/js/main.js', 'js/') .sass('source/_assets/sass/main.scss', 'css/') .version();
let argv = require('yargs').argv; let command = require('node-cmd'); let jigsaw = require('./tasks/bin'); let mix = require('laravel-mix'); let AfterBuild = require('on-build-webpack'); let BrowserSync = require('browser-sync'); let BrowserSyncPlugin = require('browser-sync-webpack-plugin'); let Watch = require('webpack-watch'); const env = argv.e || argv.env || 'local'; const port = argv.p || argv.port || 3000; const buildPath = 'build_' + env + '/'; let browserSyncInstance; let plugins = [ new AfterBuild(() => { command.get(jigsaw.path() + ' build ' + env, (error, stdout, stderr) => { console.log(error ? stderr : stdout); if (browserSyncInstance) { browserSyncInstance.reload(); } }); }), new BrowserSyncPlugin({ proxy: null, port: port, server: { baseDir: buildPath }, notify: false, }, { reload: false, callback: function() { browserSyncInstance = BrowserSync.get('bs-webpack-plugin'); }, }), new Watch({ paths: ['source/**/*.md', 'source/**/*.php'], options: { ignoreInitial: true } }), ]; mix.webpackConfig({ plugins }); mix.disableSuccessNotifications(); mix.setPublicPath('source/assets/'); mix.js('source/_assets/js/main.js', 'js/') .sass('source/_assets/sass/main.scss', 'css/') .version();
Allow webpack errors to be displayed (suppress browserSyncInstance.reload)
Allow webpack errors to be displayed (suppress browserSyncInstance.reload)
JavaScript
mit
adamwathan/jigsaw,tightenco/jigsaw,tightenco/jigsaw,adamwathan/jigsaw,tightenco/jigsaw
01955d0e5f99f71043ceb01a43a4888ff53565fe
packages/testing-utils/jest.config.js
packages/testing-utils/jest.config.js
const lernaAliases = require('lerna-alias').jest() module.exports = { testEnvironment: 'node', moduleNameMapper: Object.assign(lernaAliases, { '^redux-saga/effects$': lernaAliases['^redux-saga$'].replace(/index\.js$/, 'effects.js'), }), transform: { '.js$': __dirname + '/babel-transformer.jest.js', }, }
const lernaAliases = require('lerna-alias').jest() module.exports = { testEnvironment: 'node', moduleNameMapper: Object.assign(lernaAliases, { '^redux-saga/effects$': lernaAliases['^redux-saga$'].replace(/index\.js$/, 'effects.js'), '^@redux-saga/core/effects$': lernaAliases['^@redux-saga/core$'].replace(/index\.js$/, 'effects.js'), }), transform: { '.js$': __dirname + '/babel-transformer.jest.js', }, }
Fix lerna alias in testing-utils
Fix lerna alias in testing-utils
JavaScript
mit
yelouafi/redux-saga,yelouafi/redux-saga,redux-saga/redux-saga,redux-saga/redux-saga
036bbbe213ce0a80b56fc6448a86fdb49bf4ed55
src/components/home/Team/index.js
src/components/home/Team/index.js
import React from "react" import { StaticQuery, graphql } from "gatsby" import Member from "./Member" import "./index.module.css" const Team = ({ members }) => ( <ul styleName="root"> {members.map((data, index) => ( <li key={index} styleName="member"> <Member {...data} /> </li> ))} </ul> ) export default () => ( <StaticQuery query={teamQuery} render={({ allTeamYaml: { edges: team } }) => ( <Team members={team.map(m => m.node)} /> )} /> ) const teamQuery = graphql` query TeamQuery { allTeamYaml { edges { node { name role photo { childImageSharp { fluid(maxWidth: 320, quality: 100) { ...GatsbyImageSharpFluid_noBase64 } } } social { twitter github dribbble } } } } } `
import React from "react" import { StaticQuery, graphql } from "gatsby" import Member from "./Member" import "./index.module.css" const Team = ({ members }) => ( <ul styleName="root"> {members.map((data, index) => ( <li key={index}> <Member {...data} /> </li> ))} </ul> ) export default () => ( <StaticQuery query={teamQuery} render={({ allTeamYaml: { edges: team } }) => ( <Team members={team.map(m => m.node)} /> )} /> ) const teamQuery = graphql` query TeamQuery { allTeamYaml { edges { node { name role photo { childImageSharp { fluid(maxWidth: 320, quality: 100) { ...GatsbyImageSharpFluid_noBase64 } } } social { twitter github dribbble } } } } } `
Fix Team component (missing style)
Fix Team component (missing style)
JavaScript
mit
subvisual/subvisual.co,subvisual/subvisual.co
02896d4a839c87d319101023df1862b16e95f3fd
endpoints/hljomaholl/tests/integration_test.js
endpoints/hljomaholl/tests/integration_test.js
var request = require('request'); var assert = require('assert'); var helpers = require('../../../lib/test_helpers.js'); describe('hljomaholl', function() { // The only thing that changes is the form attribute, so why not just re-use the object var fieldsToCheckFor = [ 'date', 'time', 'image', 'title', 'description', 'location', 'buyTicketURL', 'moreInfoURL' ]; it ('should return an array of items with correct fields', function(done) { var params = helpers.testRequestParams('/hljomaholl'); var resultHandler = helpers.testRequestHandlerForFields( done, fieldsToCheckFor, null ); request(params, resultHandler); }); });
var request = require('request'); var assert = require('assert'); var helpers = require('../../../lib/test_helpers.js'); describe('hljomaholl', function() { // The only thing that changes is the form attribute, so why not just re-use the object var fieldsToCheckFor = [ 'date', 'time', 'image', 'title', 'description', 'location', 'buyTicketURL', 'moreInfoURL' ]; it ('should return an array of items with correct fields', function(done) { var params = helpers.testRequestParams('/hljomaholl'); var resultHandler = helpers.testRequestHandlerForFields( done, fieldsToCheckFor, null, true ); request(params, resultHandler); }); });
Allow hljomaholl results to be empty
Allow hljomaholl results to be empty
JavaScript
mit
apis-is/apis
d694448e175c3c92d9f8ace88aa2c369026aa5bb
test/routes.js
test/routes.js
import mockReq from 'mock-require'; import chai from 'chai'; import { shallow } from 'enzyme'; import Match from 'react-router/Match'; chai.should(); global.OKAPI_URL = 'http://localhost:9130'; mockReq('stripes-loader!', { modules: { app: [ { displayName: 'someApp', module: 'some-app', getModule: () => () => 'Close enough to a React component for this purpose.', route: '/someapp' } ] } }); mockReq('some-app', () => <div></div>); const routes = require('../src/moduleRoutes').default; const inst = shallow(routes[0]).instance(); describe('routes', () => { it('should be an array of Match components', () => { routes.should.be.a('array'); inst.should.be.instanceOf(Match); }); });
import mockReq from 'mock-require'; import chai from 'chai'; import { shallow } from 'enzyme'; import Match from 'react-router/Match'; chai.should(); global.OKAPI_URL = 'http://localhost:9130'; mockReq('stripes-loader', { modules: { app: [ { displayName: 'someApp', module: 'some-app', getModule: () => () => 'Close enough to a React component for this purpose.', route: '/someapp' } ] } }); mockReq('some-app', () => <div></div>); const routes = require('../src/moduleRoutes').default; const inst = shallow(routes[0]).instance(); describe('routes', () => { it('should be an array of Match components', () => { routes.should.be.a('array'); inst.should.be.instanceOf(Match); }); });
Update test to mock stripes-loader alias
Update test to mock stripes-loader alias
JavaScript
apache-2.0
folio-org/stripes-core,folio-org/stripes-core,folio-org/stripes-core
b339dc9664ace02351c981e9d05c20851aa165a9
src/Button/index.js
src/Button/index.js
import React, { PropTypes } from 'react'; import styles from './Button.css'; const Button = (props) => { const classNames = [styles.Button]; if (props.state) { classNames.push(styles[`Button--state-${props.state}`]); } if (props.type) { classNames.push(styles[`Button--type-${props.type}`]); } return ( <button className={classNames.join(' ')}> {props.children} </button> ); }; Button.propTypes = { children: PropTypes.node, state: PropTypes.string, type: PropTypes.string, }; export default Button;
import React, { PropTypes } from 'react'; import styles from './Button.css'; const Button = (props) => { const classNames = [styles.Button]; if (props.state) { classNames.push(styles[`Button--state-${props.state}`]); } if (props.type) { classNames.push(styles[`Button--type-${props.type}`]); } return ( <button className={classNames.join(' ')} {...props}> {props.children} </button> ); }; Button.propTypes = { children: PropTypes.node, state: PropTypes.string, type: PropTypes.string, }; export default Button;
Extend props for handlers like onClick
Extend props for handlers like onClick
JavaScript
mit
bufferapp/buffer-components,bufferapp/buffer-components
513024b1add009b895acd5e12f60094f95fb14a7
example/drummer/src/historyComponent/reduce.js
example/drummer/src/historyComponent/reduce.js
const way = require('senseway'); const historyDeleteFrame = (hist, t) => { const newHist = way.clone(hist); newHist.map((ch) => { return ch.splice(t, 1); }); return newHist; }; const historyDuplicateFrame = (hist, t) => { const newHist = way.clone(hist); newHist.map((ch, i) => { const cellValue = ch[t]; return ch.splice(t, 0, cellValue); }); return newHist; }; const historySetValue = (hist, ev) => { const newHist = way.clone(hist); newHist[ev.channel][ev.time] = ev.value; return newHist; }; module.exports = (model, ev) => { switch (ev.type) { case 'DELETE_HISTORY_CHANNEL': { return Object.assign({}, model, { history: model.history.filter((ch, c) => c !== ev.channel) }); } case 'DELETE_HISTORY_FRAME': { return Object.assign({}, model, { history: historyDeleteFrame(model.history, ev.time) }); } case 'DUPLICATE_HISTORY_CHANNEL': { const c = ev.channel; const ch = [model.history[c]]; const pre = model.history.slice(0, c); const post = model.history.slice(c); return Object.assign({}, model, { history: [].concat(pre, ch, post) }); } case 'DUPLICATE_HISTORY_FRAME': { return Object.assign({}, model, { history: historyDuplicateFrame(model.history, ev.time) }); } case 'SET_HISTORY_VALUE': { return Object.assign({}, model, { history: historySetValue(model.history, ev) }); } default: return model; } };
const way = require('senseway'); module.exports = (model, ev) => { switch (ev.type) { case 'DELETE_HISTORY_CHANNEL': { return Object.assign({}, model, { history: way.dropChannel(model.history, ev.channel), }); } case 'DELETE_HISTORY_FRAME': { return Object.assign({}, model, { history: way.dropAt(model.history, ev.time) }); } case 'DUPLICATE_HISTORY_CHANNEL': { return Object.assign({}, model, { history: way.repeatChannel(model.history, ev.channel), }); } case 'DUPLICATE_HISTORY_FRAME': { return Object.assign({}, model, { history: way.repeatAt(model.history, ev.time) }); } case 'SET_HISTORY_VALUE': { return Object.assign({}, model, { history: way.set(model.history, ev.channel, ev.time, ev.value) }); } default: return model; } };
Use way.repeatAt .repeatChannel .dropChannel .dropAt .set
Use way.repeatAt .repeatChannel .dropChannel .dropAt .set
JavaScript
mit
axelpale/lately,axelpale/lately
a9bf8a35794c94c6033f102b500ea10e78755513
client/js/decompress.js
client/js/decompress.js
const continuationBit = 1 << 7; const lowBitsMask = ~continuationBit & 0xff; /** * @template {ArrayBufferView} T * * @param {ReadableStream<Uint8Array>} stream * @param {number} length of the returned ArrayBufferView * @param {new (length: number) => T} Type * * @returns {T} */ export async function decompress(stream, length, Type) { const reader = stream.getReader(); const output = new Type(length); let outIndex = 0; let result = 0; let shift = 0; while (true) { const { done, value } = await reader.read(); if (done) { return output; } for (const byte of value) { result |= (byte & lowBitsMask) << shift; if ((byte & continuationBit) === 0) { output[outIndex++] = result; result = shift = 0; continue; } shift += 7; } } }
const continuationBit = 1 << 7; const lowBitsMask = ~continuationBit & 0xff; /** * Consume a readable stream of unsigned LEB128 encoded bytes, writing the * results into the provided buffer * * @template {ArrayBufferView} T * @param {ReadableStream<Uint8Array>} stream A stream of concatenated unsigned * LEB128 encoded values * @param {T} buffer An ArrayBuffer view to write the decoded values to * @returns {T} the passed in `buffer` */ export async function decompress(stream, buffer) { const reader = stream.getReader(); let index = 0; let result = 0; let shift = 0; while (true) { const { done, value } = await reader.read(); if (done) { return buffer; } for (const byte of value) { result |= (byte & lowBitsMask) << shift; if ((byte & continuationBit) === 0) { buffer[index++] = result; result = shift = 0; continue; } shift += 7; } } }
Bring your own buffer for leb128
Bring your own buffer for leb128
JavaScript
mit
Alexendoo/utf,Alexendoo/utf,Alexendoo/utf,Alexendoo/utf
7b1d235f444dc3edb8ac53bd8de3396e66a9b418
RcmBrightCoveLib/public/keep-aspect-ratio.js
RcmBrightCoveLib/public/keep-aspect-ratio.js
/** * This script keeps the height set on elements with regard to their * width for a given aspect ratio. Great for "display:block" elements * * Example usage: * * <div data-keep-aspect-ratio="16:9"> * * Author: Rod McNew * License: BSD */ new function () { var setHeights = function () { $.each($('[data-keep-aspect-ratio]'), function () { var ele = $(this); var ratioParts = ele.attr('data-keep-aspect-ratio').split(':'); var ratioWidth = ratioParts[0]; var ratioHeight = ratioParts[1]; var width = ele.width(); var newHeight = width * ratioHeight / ratioWidth; ele.css('height', newHeight); }) }; //Run onReady $(setHeights); //Run when window is resized $(window).resize(setHeights); //Run when target elements are resized without a window resize $('body').on('resize', '[data-keep-aspect-ratio]', setHeights); $('body').on('orientationchange', '[data-keep-aspect-ratio]', setHeights); };
/** * This script keeps the height set on elements with regard to their * width for a given aspect ratio. Great for "display:block" elements * * Example usage: * * <div data-keep-aspect-ratio="16:9"> * * Author: Rod McNew * License: BSD */ new function () { var setHeights = function () { $.each($('[data-keep-aspect-ratio]'), function () { var ele = $(this); var ratioParts = ele.attr('data-keep-aspect-ratio').split(':'); var ratioWidth = ratioParts[0]; var ratioHeight = ratioParts[1]; var width = ele.width(); var newHeight = width * ratioHeight / ratioWidth; ele.css('height', newHeight); ele.css('overflow', 'hidden'); ele.find("iframe").height(newHeight).width(width); setTimeout(function() { refreshIframe(ele); }, 500); }) }; var refreshIframe = function(ele) { var iframe = ele.find("iframe"); iframe.attr('src', iframe.attr('src')); }; //Run onReady $(setHeights); //Run when window is resized $(window).resize(setHeights); //Run when target elements are resized without a window resize $('body').on('resize', '[data-keep-aspect-ratio]', setHeights); };
Fix for brightcove player when orintation is changed
Fix for brightcove player when orintation is changed
JavaScript
bsd-3-clause
innaDa/RcmPlugins,jerv13/RcmPlugins,bjanish/RcmPlugins,bjanish/RcmPlugins,innaDa/RcmPlugins,jerv13/RcmPlugins,bjanish/RcmPlugins,jerv13/RcmPlugins,innaDa/RcmPlugins
c75e162718129ce1038442dabd81f4915a238c53
src/is/isArrayLike/isArrayLike.js
src/is/isArrayLike/isArrayLike.js
/** * Checks if value is array-like. * A value is considered array-like if it’s not a function and has a `value.length` that’s an * integer greater than or equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. * @param {*} value The value to check. * @return {Boolean} Returns true if value is array-like, else false. */ function isArrayLike(value) { 'use strict'; var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1, len = value && value.length; return value != null && typeof value !== 'function' && typeof len === 'number' && len > -1 && len % 1 === 0 && len <= MAX_SAFE_INTEGER; }
/** * Checks if value is array-like. * A value is considered array-like if it’s not a function and has a `value.length` that’s an * integer greater than or equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. * @param {*} value The value to check. * @return {Boolean} Returns true if value is array-like, else false. */ function isArrayLike(value) { 'use strict'; var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1, len = !!value && value.length; return value != null && typeof value !== 'function' && typeof len === 'number' && len > -1 && len % 1 === 0 && len <= MAX_SAFE_INTEGER; }
Fix issue that would cause a falsey value like 0 to pass the tests
[ci-skip] Fix issue that would cause a falsey value like 0 to pass the tests
JavaScript
mit
georapbox/smallsJS,georapbox/smallsJS,georapbox/jsEssentials
fd57b24f7d186220436d779200d582856570f966
src/js/lib/monetary/formatting.js
src/js/lib/monetary/formatting.js
define(function () { return { /** * Format monetary to standard format with ISO 4217 code. */ format: function (m) { if (m.isInvalid()) { return "Invalid monetary!"; } return m.currency() + " " + m.amount(); } }; });
define(function () { return { /** * Format monetary to standard format with ISO 4217 code. */ format: function (m) { if (m.isInvalid()) { return "Invalid monetary!"; } return m.currency() + " " + m.amount().toFixed(2); } }; });
Add temporary monetary rounding fix
Add temporary monetary rounding fix
JavaScript
mit
davidknezic/bitcoin-trade-guard
684fe7ced5ac9a43adb7c6f4f1698327c2a3a521
src/common/index.js
src/common/index.js
// We faced a bug in babel so that transform-runtime with export * from 'x' generates import statements in transpiled code // Tracked here : https://github.com/babel/babel/issues/2877 // We tested the workaround given here https://github.com/babel/babel/issues/2877#issuecomment-270700000 with success so far import _ from 'lodash' import * as errors from './errors' import * as permissions from './permissions' export { errors } export { permissions } // Append a parameter value to a given URL export function addQueryParameter(baseUrl, parameter, value) { // Check if this is the first parameter to be added or not const prefix = (baseUrl.includes('?') ? '&' : '?') return `${baseUrl}${prefix}${parameter}=${Array.isArray(value) ? JSON.stringify(value) : value}` } // Build an encoded URL from a given set of parameters export function buildUrl(baseUrl, parameters) { let url = baseUrl _.forOwn(parameters, function(value, key) { url = addQueryParameter(url, key, value) }) return encodeURI(url) }
// We faced a bug in babel so that transform-runtime with export * from 'x' generates import statements in transpiled code // Tracked here : https://github.com/babel/babel/issues/2877 // We tested the workaround given here https://github.com/babel/babel/issues/2877#issuecomment-270700000 with success so far import _ from 'lodash' import * as errors from './errors' import * as permissions from './permissions' export { errors } export { permissions } // Append a parameter value to a given URL export function addQueryParameter(baseUrl, parameter, value) { // Check if this is the first parameter to be added or not const prefix = (baseUrl.includes('?') ? '&' : '?') return `${baseUrl}${prefix}${parameter}=${Array.isArray(value) ? JSON.stringify(value) : value}` } // Build an URL from a given set of parameters export function buildUrl(baseUrl, parameters) { let url = baseUrl _.forOwn(parameters, function(value, key) { url = addQueryParameter(url, key, value) }) return url } // Build an encoded URL from a given set of parameters export function buildEncodedUrl(baseUrl, parameters) { return encodeURI(buildEncodedUrl(baseUrl, parameters)) }
Make buildUrl return a non-encoded url by default
Make buildUrl return a non-encoded url by default
JavaScript
mit
kalisio/kCore
d58636faa24ace56822cda4254a1b765935ac3fe
test/client/ui-saucelabs.conf.js
test/client/ui-saucelabs.conf.js
exports.config = { specs: ['ui/**/*.spec.js'], sauceUser: process.env.SAUCE_USERNAME, sauceKey: process.env.SAUCE_ACCESS_KEY, baseUrl: 'http://localhost:3000', capabilities: { 'browserName': 'chrome', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'AgileJS Training Repo' } };
exports.config = { specs: ['ui/**/*.spec.js'], sauceUser: process.env.SAUCE_USERNAME, sauceKey: process.env.SAUCE_ACCESS_KEY, baseUrl: 'http://localhost:3000', capabilities: { 'browserName': 'firefox', 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, 'build': process.env.TRAVIS_BUILD_NUMBER, 'name': 'AgileJS Training Repo' } };
Correct commands are sent to Saucelabs, but they are misinterpreted. Maybe the Firefox driver works better?
Correct commands are sent to Saucelabs, but they are misinterpreted. Maybe the Firefox driver works better?
JavaScript
mit
agilejs/2015-06-team-3,agilejs/2015-06-team-1,agilejs/2015-04-team-1,agilejs/2015-06-team-4,agilejs/2015-06-team-6,agilejs/2015-06-team-5,agilejs/2015-04-team-1,agilejs/2014-10-Dinatriumdihydrogendiphosphat,agilejs/2015-06-team-3,agilejs/2015-06-team-2,agilejs/2014-10-typesafe,agilejs/2014-10-floppy,agilejs/2015-06-team-5,agilejs/2015-04-team-2,agilejs/2015-04-team-2,agilejs/2015-06-team-2,agilejs/2014-10-localhorsts,agilejs/2014-10-code-red,codecentric/movie-database-node,agilejs/2015-04-team-3,codecentric/coding-serbia-angularjs-workshop,agilejs/2014-10-scrumbags,agilejs/2015-06-team-4,agilejs/2015-04-team-3,codecentric/movie-database-node,agilejs/2015-06-team-1,agilejs/2014-10-code-frantics,agilejs/2015-06-team-6
b51c70f2afce34680298088182bb92c7e26b7420
configs/knexfile.js
configs/knexfile.js
const path = require('path'); module.exports = { development: { client: 'pg', connection: 'postgres://localhost/envelopresent', migrations: { directory: path.join(__dirname, '..', 'datasource', 'migrations'), tableName: 'knex_migrations' } }, production: { client: 'pg', connection: process.env.DATABASE_URL, pool: { min: 2, max: 10 }, migrations: { directory: path.join(__dirname, '..', 'datasource','migrations'), tableName: 'knex_migrations' } } };
const path = require('path'); module.exports = { development: { client: 'pg', connection: 'postgres://localhost/envelopresent', migrations: { directory: path.join(__dirname, '..', 'datasource', 'migrations'), tableName: 'knex_migrations' } }, production: { client: 'ps', connection: process.env.DATABASE_URL, pool: { min: 2, max: 10 }, migrations: { directory: path.join(__dirname, '..', 'datasource','migrations'), tableName: 'knex_migrations' } } };
Revert "Fix DB vendor alias"
Revert "Fix DB vendor alias" This reverts commit 695b5998b3e7aa0d2a6e10737fca263e85bcc304.
JavaScript
mit
chikh/envelopresent
d79f633547008f6add566ea5c39794046dacd90c
examples/face-detection-rectangle.js
examples/face-detection-rectangle.js
var cv = require('../lib/opencv'); var COLOR = [0, 255, 0]; // default red var thickness = 2; // default 1 cv.readImage('./files/mona.png', function(err, im) { if (err) throw err; if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size'); im.detectObject('../data/haarcascade_frontalface_alt2.xml', {}, function(err, faces) { if (err) throw err; for (var i = 0; i < faces.length; i++) { face = faces[i]; im.rectangle([face.x, face.y], [face.x + face.width, face.y + face.height], COLOR, 2); } im.save('./tmp/face-detection-rectangle.png'); console.log('Image saved to ./tmp/face-detection-rectangle.png'); }); });
var cv = require('../lib/opencv'); var COLOR = [0, 255, 0]; // default red var thickness = 2; // default 1 cv.readImage('./files/mona.png', function(err, im) { if (err) throw err; if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size'); im.detectObject('../data/haarcascade_frontalface_alt2.xml', {}, function(err, faces) { if (err) throw err; for (var i = 0; i < faces.length; i++) { face = faces[i]; im.rectangle([face.x, face.y], [face.width, face.height], COLOR, 2); } im.save('./tmp/face-detection-rectangle.png'); console.log('Image saved to ./tmp/face-detection-rectangle.png'); }); });
Fix mistake in face detection example
Fix mistake in face detection example Fixed #274 by changing the x2,y2 second array when drawing the rectangle to width,height (see Matrix.cc)
JavaScript
mit
qgustavor/node-opencv,mvines/node-opencv,piercus/node-opencv,julianduque/node-opencv,keeganbrown/node-opencv,lntitbk/node-opencv,dropfen/node-opencv,webcats/node-opencv,akshonesports/node-opencv,akshonesports/node-opencv,peterbraden/node-opencv,piercus/node-opencv,jainanshul/node-opencv,Queuecumber/node-opencv,cascade256/node-opencv,tualo/node-opencv,jainanshul/node-opencv,lntitbk/node-opencv,borromeotlhs/node-opencv,Queuecumber/node-opencv,cascade256/node-opencv,Eric013/node-opencv,mvines/node-opencv,madshall/node-opencv,peterbraden/node-opencv,akshonesports/node-opencv,qgustavor/node-opencv,madshall/node-opencv,qgustavor/node-opencv,rbtkoz/node-opencv,Queuecumber/node-opencv,jainanshul/node-opencv,piercus/node-opencv,tualo/node-opencv,madshall/node-opencv,cascade256/node-opencv,keeganbrown/node-opencv,Queuecumber/node-opencv,rbtkoz/node-opencv,qgustavor/node-opencv,webcoding/node-opencv,rbtkoz/node-opencv,piercus/node-opencv,bmathews/node-opencv,madshall/node-opencv,tualo/node-opencv,autographer/node-opencv,gregfriedland/node-opencv,webcoding/node-opencv,peterbraden/node-opencv,rbtkoz/node-opencv,keeganbrown/node-opencv,alex1818/node-opencv,autographer/node-opencv,cascade256/node-opencv,mvines/node-opencv,tualo/node-opencv,bmathews/node-opencv,alex1818/node-opencv,mvines/node-opencv,gregfriedland/node-opencv,peterbraden/node-opencv,gregfriedland/node-opencv,keeganbrown/node-opencv,qgustavor/node-opencv,jainanshul/node-opencv,autographer/node-opencv,Eric013/node-opencv,tualo/node-opencv,keeganbrown/node-opencv,dropfen/node-opencv,borromeotlhs/node-opencv,akshonesports/node-opencv,akshonesports/node-opencv,webcats/node-opencv,rbtkoz/node-opencv,bmathews/node-opencv,autographer/node-opencv,mvines/node-opencv,tualo/node-opencv,borromeotlhs/node-opencv,julianduque/node-opencv,piercus/node-opencv,Eric013/node-opencv,keeganbrown/node-opencv,webcoding/node-opencv,lntitbk/node-opencv,cascade256/node-opencv,akshonesports/node-opencv,autographer/node-opencv,Queuecumber/node-opencv,cascade256/node-opencv,webcoding/node-opencv,gregfriedland/node-opencv,mvines/node-opencv,bmathews/node-opencv,webcats/node-opencv,alex1818/node-opencv,julianduque/node-opencv,Eric013/node-opencv,madshall/node-opencv,bmathews/node-opencv,dropfen/node-opencv,autographer/node-opencv,akshonesports/node-opencv,bmathews/node-opencv,Queuecumber/node-opencv,piercus/node-opencv,webcats/node-opencv,julianduque/node-opencv,dropfen/node-opencv,madshall/node-opencv,lntitbk/node-opencv,borromeotlhs/node-opencv,alex1818/node-opencv
66b391ff1a66e9ae160cfadf54fd94e088348a46
angular-typescript-webpack-jasmine/webpack/webpack.build.js
angular-typescript-webpack-jasmine/webpack/webpack.build.js
var loaders = require("./loaders"); var preloaders = require("./preloaders"); var HtmlWebpackPlugin = require('html-webpack-plugin'); var webpack = require('webpack'); module.exports = { entry: ['./src/index.ts'], output: { filename: 'build.js', path: 'dist' }, devtool: '', resolve: { root: __dirname, extensions: ['', '.ts', '.js', '.json'] }, resolveLoader: { modulesDirectories: ["node_modules"] }, plugins: [ new webpack.optimize.UglifyJsPlugin( { warning: false, mangle: true, comments: false } ), new HtmlWebpackPlugin({ template: './src/index.html', inject: 'body', hash: true }), new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', 'window.jquery': 'jquery' }) ], module:{ preLoaders:preloaders, loaders: loaders }, tslint: { emitErrors: true, failOnHint: true } };
const loaders = require("./loaders"); const preloaders = require("./preloaders"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const webpack = require("webpack"); module.exports = { context: path.join(__dirname, ".."), entry: ["./src/index.ts"], output: { filename: "build.js", path: "dist" }, devtool: "", resolve: { root: __dirname, extensions: [".ts", ".js", ".json"] }, resolveLoader: { modulesDirectories: ["node_modules"] }, plugins: [ new webpack.optimize.UglifyJsPlugin( { warning: false, mangle: true, comments: false } ), new HtmlWebpackPlugin({ template: "./src/index.html", inject: "body", hash: true }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery", "window.jquery": "jquery" }) ], module:{ preLoaders:preloaders, loaders: loaders }, tslint: { emitErrors: true, failOnHint: true } };
Replace single quotes -> double quotes, var -> const
Refactoring: Replace single quotes -> double quotes, var -> const
JavaScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
74c5a0a45de24850b7d506c6af17218709e5ecbe
tests/unit/services/user-test.js
tests/unit/services/user-test.js
import Ember from 'ember'; import { moduleFor, test } from 'ember-qunit'; import { Offline } from 'ember-flexberry-data'; import startApp from 'dummy/tests/helpers/start-app'; let App; moduleFor('service:user', 'Unit | Service | user', { needs: [ 'model:i-c-s-soft-s-t-o-r-m-n-e-t-security-agent', ], beforeEach() { App = startApp(); App.unregister('service:store'); App.register('service:store', Offline.Store); App.register('store:local', Offline.LocalStore); }, afterEach() { Ember.run(App, 'destroy'); }, }); test('it works', function(assert) { assert.expect(4); let done = assert.async(); let service = this.subject(App.__container__.ownerInjection()); Ember.run(() => { service.getCurrentUser().then((user) => { assert.equal(user.get('name'), 'user'); assert.ok(user.get('isUser')); assert.notOk(user.get('isGroup')); assert.notOk(user.get('isRole')); done(); }); }); });
import Ember from 'ember'; import { moduleFor, test } from 'ember-qunit'; import { Offline } from 'ember-flexberry-data'; import startApp from 'dummy/tests/helpers/start-app'; let App; moduleFor('service:user', 'Unit | Service | user', { needs: [ 'model:i-c-s-soft-s-t-o-r-m-n-e-t-security-agent', ], beforeEach() { App = startApp(); App.unregister('service:store'); App.register('service:store', Offline.Store); App.register('store:local', Offline.LocalStore); }, afterEach() { Ember.run(App, 'destroy'); }, }); test('it works', function(assert) { // TODO: Replace this with your real tests. let service = this.subject(App.__container__.ownerInjection()); assert.ok(!!service); });
Test user service until better times
Test user service until better times
JavaScript
mit
Flexberry/ember-flexberry-projections,Flexberry/ember-flexberry-data,Flexberry/ember-flexberry-data,Flexberry/ember-flexberry-projections,Flexberry/ember-flexberry-data
511ddc7dcb44c54c24fa09fda91475bd0f5326bc
doubly-linked-list.js
doubly-linked-list.js
"use strict"; // DOUBLY-LINKED LIST // define constructor function Node(val) { this.data = val; this.previous = null; this.next = null; } function DoublyLinkedList() { this._length = 0; this.head = null; this.tail = null; } // add node to doubly linked list DoublyLinkedList.prototype.add = function(val) { var node = new Node(val); // create new instance of node if(this._length) { this.tail.next = node; node.previous = this.tail; // account for bi-directional movement this.tail = node; // new node now tail } else { // if doubly linked list is empty this.head = node; this.tail = node; } this._length++; return node; }
"use strict"; // DOUBLY-LINKED LIST // define constructor function Node(val) { this.data = val; this.previous = null; this.next = null; } function DoublyLinkedList() { this._length = 0; this.head = null; this.tail = null; } // add node to doubly linked list DoublyLinkedList.prototype.add = function(val) { var node = new Node(val); // create new instance of node if(this._length) { this.tail.next = node; node.previous = this.tail; // account for bi-directional movement this.tail = node; // new node now tail } else { // if doubly linked list is empty this.head = node; this.tail = node; } this._length++; return node; } // search nodes at specific positions in doubly linked list DoublyLinkedList.prototype.searchNodeAt = function(position) { var currentNode = this.head, length = this._length, count = 1, message = {failure: 'Failure: non-existent node in this list'}; // first case: invalid position if (length === 0 || position < 1 || position > length) { throw new Error(message.failure); } // second case: valid position while (count < position) { // go through entire doubly linked list until currentNode is equal to position currentNode = currentNode.next; count++; } return currentNode; };
Add search-node method to doubly linked list
Add search-node method to doubly linked list
JavaScript
mit
derekmpham/interview-prep,derekmpham/interview-prep
f8309803daacc51a59daa8fb17096c666a4b615b
ottawa/celebration-park/local.js
ottawa/celebration-park/local.js
var southWest = L.latLng(45.36638, -75.73674), northEast = L.latLng(45.36933, -75.73316), bounds = L.latLngBounds(southWest, northEast); var map = L.map('map', { center: [45.36806, -75.73408], zoom: 18, minZoom: 18, maxZoom: 19, maxBounds: bounds, }); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);
var southWest = L.latLng(45.36638, -75.73674), northEast = L.latLng(45.36933, -75.73316), bounds = L.latLngBounds(southWest, northEast); var map = L.map('map', { center: [45.36806, -75.73408], zoom: 18, minZoom: 18, maxZoom: 19, maxBounds: bounds, }); L.tileLayer('http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);
Use black and white basemap
Use black and white basemap Signed-off-by: Thanh Ha <09ea4d3a79c8bee41a16519f6a431f6bc0fd8d6f@alumni.carleton.ca>
JavaScript
mit
zxiiro/maps,zxiiro/maps
eed9e520f02ca0a9b42a8ace3b3eb2b90ad3f4b1
javascript/word-count/words.js
javascript/word-count/words.js
function Words(sentence){ "use strict"; sentence = sentence.toLowerCase(); var wordMatches = sentence.match(/\w+/g); var result = {}; for(var idx = 0 ; idx < wordMatches.length ; idx++) { result[wordMatches[idx]] = (result[wordMatches[idx]] || 0) + 1; } return { count: result }; }; module.exports = Words;
function Words(sentence){ "use strict"; return { count: countWords(sentence) }; function countWords(sentence){ sentence = sentence.toLowerCase(); var wordMatches = sentence.match(/\w+/g); var result = {}; for(var idx = 0 ; idx < wordMatches.length ; idx++) { result[wordMatches[idx]] = (result[wordMatches[idx]] || 0) + 1; } return result; } }; module.exports = Words;
Use a separate counting function.
Use a separate counting function.
JavaScript
mit
driis/exercism,driis/exercism,driis/exercism
0c374abc35fbefa915834d8bde05d030a9b48e22
js/services/searchService.js
js/services/searchService.js
'use strict'; var SearchService = function($http, $q) { this.search = function(query) { var deferred = $q.defer(); var from = query.from ? '&from=' + query.from : ""; var size = query.size ? '&size=' + query.size : ""; var facetlist = "&facet=resource.provenance&facet=resource.types"; // facet values in der Backend-URI: mit "resource." var fq = query.fq; if (fq == null) { fq = ""; } else if (typeof fq === 'string') { fq = "&fq=resource."+fq; } else { fq = "&fq=resource." + fq.join("&fq=resource."); } var uri = '/data/period/?q=' + query.q + from + size + facetlist + fq; $http.get(uri).then( function success(result) { deferred.resolve(result.data); }, function error(err) { console.warn(err); deferred.reject(); } ); return deferred.promise; } } angular.module('chronontology.services').service('searchService', ["$http", "$q", SearchService]);
'use strict'; var SearchService = function($http, $q) { this.search = function(query) { var deferred = $q.defer(); var from = query.from ? '&from=' + query.from : ""; var size = query.size ? '&size=' + query.size : ""; var facetlist = "&facet=resource.provenance&facet=resource.types"; // facet values in der Backend-URI: mit "resource." var fq = query.fq; if (fq == null) { fq = ""; } else if (typeof fq === 'string') { fq = "&fq=resource."+fq; } else { fq = "&fq=resource." + fq.join("&fq=resource."); } var exists = query.exists; if (exists == null) { exists = ""; } else if (typeof exists === 'string') { exists = "&exists=resource."+exists; } else { exists = "&exists=resource." + exists.join("&exists=resource."); } var uri = '/data/period/?q=' + query.q + from + size + facetlist + fq + exists; $http.get(uri).then( function success(result) { deferred.resolve(result.data); }, function error(err) { console.warn(err); deferred.reject(); } ); return deferred.promise; } } angular.module('chronontology.services').service('searchService', ["$http", "$q", SearchService]);
Make sure exists filter values are sent to backend
Make sure exists filter values are sent to backend
JavaScript
apache-2.0
dainst/chronontology-frontend,dainst/chronontology-frontend
3a8d487334bf1b623d5c93503c33fb0334a11c0d
server.js
server.js
var express = require('express') var vhost = require('vhost') var app2014 = require('./2014/app') var app2015 = require('./2015/app') var app2016 = require('./2016/app') var appSplash = require('./splash/app') //var redirect = express() //redirect.get('/', function (req, res) { // res.redirect(301, 'https://2016.coldfrontconf.com') //}) var server = express() server.set('port', process.env.PORT || 8080) //server.use(vhost('2014.coldfrontconf.com', app2014)) //server.use(vhost('2015.coldfrontconf.com', app2015)) //server.use(vhost('2016.coldfrontconf.com', app2016)) //server.use(vhost('coldfrontconf.com', redirect)) server.use(vhost('localhost', app2016)) server.listen(server.get('port'), function () { console.log('Express server listening on port %d in %s mode', server.get('port'), server.settings.env) })
var express = require('express') var vhost = require('vhost') var app2014 = require('./2014/app') var app2015 = require('./2015/app') var app2016 = require('./2016/app') var appSplash = require('./splash/app') var redirect = express() redirect.get('/', function (req, res) { res.redirect(301, 'https://2016.coldfrontconf.com') }) var server = express() server.set('port', process.env.PORT || 8080) server.use(vhost('2014.coldfrontconf.com', app2014)) server.use(vhost('2015.coldfrontconf.com', app2015)) server.use(vhost('2016.coldfrontconf.com', app2016)) server.use(vhost('coldfrontconf.com', redirect)) server.use(vhost('localhost', app2016)) server.listen(server.get('port'), function () { console.log('Express server listening on port %d in %s mode', server.get('port'), server.settings.env) })
Fix broken redirects and serving of older websites
Fix broken redirects and serving of older websites
JavaScript
mit
auchenberg/coldfront.co,auchenberg/coldfront.co
72b3933fbcc1f0ce1cee85ecf6064a5be6a251ea
server.js
server.js
var hapi = require('hapi'); var moonboots = require('moonboots_hapi'); var config = require('getconfig'); var templatizer = require('templatizer'); var Good = require('good'); var ElectricFence = require('electricfence'); var server = hapi.createServer(8080, 'localhost'); server.pack.register([ { plugin: moonboots, options: { appPath: '/{p*}', moonboots: { main: __dirname + '/client/app.js', developmentMode: config.isDev, stylesheets: [ __dirname + '/public/css/local.css', __dirname + '/public/css/bootstrap.css' ], beforeBuildJS: function () { templatizer(__dirname + '/templates', __dirname + '/client/templates.js'); } } } }, { plugin: Good, options: { reporters: [{ reporter: Good.GoodConsole }] } }, { plugin: ElectricFence, options: config.electricfence } ], function () { server.start(function () { server.log(['info'], 'lift.zone running on the year ' + server.info.port); }); });
var hapi = require('hapi'); var moonboots = require('moonboots_hapi'); var config = require('getconfig'); var templatizer = require('templatizer'); //var Good = require('good'); var ElectricFence = require('electricfence'); var server = hapi.createServer(8080, 'localhost'); server.pack.register([ { plugin: moonboots, options: { appPath: '/{p*}', moonboots: { main: __dirname + '/client/app.js', developmentMode: config.isDev, stylesheets: [ __dirname + '/public/css/local.css', __dirname + '/public/css/bootstrap.css' ], beforeBuildJS: function () { templatizer(__dirname + '/templates', __dirname + '/client/templates.js'); } } } //}, { //plugin: Good, //options: { //reporters: [{ ////reporter: Good.GoodConsole //}] //} }, { plugin: ElectricFence, options: config.electricfence } ], function () { server.start(function () { server.log(['info'], 'lift.zone running on the year ' + server.info.port); }); });
Disable Good cause pm2 pukes
Disable Good cause pm2 pukes
JavaScript
mit
wraithgar/lift.zone,wraithgar/lift.zone,wraithgar/lift.zone
55b92a8ebd70e4c30d50610884a1b890f57ae82b
server.js
server.js
var express = require('express'); var app = express(); var port = process.env.PORT || 3000; // Asset paths first app.get('/js/:file', serveFile.bind(null, 'dist/js')); app.get('/css/:file', serveFile.bind(null, 'dist/css')); app.get('/img/:file', serveFile.bind(null, 'dist/img')); app.get('/templates/:file', serveFile.bind(null, 'dist/templates')); // Anything else is sent to index.html to support SPA routing app.get('/*', function (req, res) { res.sendFile('index.html', { root: 'dist' }); }); // Start the server! var server = app.listen(port, serverStarted); function serverStarted() { console.log("Bloc Base Project is running"); } function serveFile( root, req, res ) { res.sendFile(req.params.file, { root: root }); }
var express = require('express'); var app = express(); var port = process.env.PORT || 3000; // Asset paths first app.get('/js/:file', serveFile.bind(null, 'dist/js')); app.get('/css/:file', serveFile.bind(null, 'dist/css')); app.get('/img/:file', serveFile.bind(null, 'dist/img')); app.get('/templates/:file', serveFile.bind(null, 'dist/templates')); // Anything else is sent to index.html to support SPA routing app.get('/*', function (req, res) { res.sendFile('index.html', { root: 'dist' }); }); // Start the server! var server = app.listen(port, serverStarted); function serverStarted() { console.log("Bloc Base Project is running"); } function serveFile( root, req, res ) { res.sendFile(req.params.file, { root: root }); } // Sets a timer to retrieve data from Heroku so the app doesnt sleep var https = require("https"); setInterval(function(){ https.get("https://pomodoro-app-timer.herokuapp.com/"); console.log("Applicaton is awake"); }, 250000);
Set timer for app so it will retrieve the data from heroku every 4.5 min
Set timer for app so it will retrieve the data from heroku every 4.5 min
JavaScript
apache-2.0
ilitvak/Pomodoro-App,ilitvak/Pomodoro-App
da1bf2e70b7c1dc2005f38d69e186a1043b0cab7
src/configs/webpack/rules/default.js
src/configs/webpack/rules/default.js
// Licensed under the Apache License, Version 2.0 (the “License”); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an “AS IS” BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. import {relative, sep} from 'path' import {getProjectDir} from '../../../paths' const PROJECT_DIR = getProjectDir() function fileName(file) { const RELATIVE = relative(PROJECT_DIR, file) let nodes = RELATIVE.split(sep) if (nodes[0] === 'src') nodes.shift() return `${nodes.join('/')}?[sha512:hash:base64:8]` } export default function () { return { exclude: /\.(css|jsx?|mjs)$/, use: [{ loader: 'url-loader', options: { fallback: 'file-loader', limit: 1024, name: fileName, }, }], } }
// Licensed under the Apache License, Version 2.0 (the “License”); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an “AS IS” BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. import { getProjectDir, TOOLBOX_DIR, } from '../../../paths' import {isPathSubDirOf} from '../../../utils' import {relative, sep} from 'path' const PROJECT_DIR = getProjectDir() /** * Calculate the file path for the loaded asset. */ function fileName(file) { let prefix = null let reference = null if (isPathSubDirOf(file, PROJECT_DIR)) { // Assets from the target project. prefix = [] reference = PROJECT_DIR } else if (isPathSubDirOf(file, TOOLBOX_DIR)) { // Assets from the Toolbox. prefix = ['borela-js-toolbox'] reference = TOOLBOX_DIR } const RELATIVE = relative(reference, file) let nodes = RELATIVE.split(sep) if (nodes[0] === 'src') nodes.shift() if (prefix.length > 0) nodes = [...prefix, ...nodes] return `${nodes.join('/')}?[sha512:hash:base64:8]` } export default function () { return { exclude: /\.(css|jsx?|mjs)$/, use: [{ loader: 'url-loader', options: { fallback: 'file-loader', limit: 1024, name: fileName, }, }], } }
Update asset loader path resolution
Update asset loader path resolution
JavaScript
apache-2.0
ctrine/webpack-settings,ctrine/webpack-settings
8bf302fb83764ce1e8bf9fd39fc4099067aee203
lib/isomorphic/html-styles.js
lib/isomorphic/html-styles.js
import React from 'react' import { prefixLink } from './gatsby-helpers' if (process.env.NODE_ENV === `production`) { let stylesStr try { stylesStr = require(`!raw!public/styles.css`) } catch (e) { // ignore } } const htmlStyles = (args = {}) => { if (process.env.NODE_ENV === `production`) { if (args.link) { // If the user wants to reference the external stylesheet return a link. return <link rel="stylesheet" type="text/css" href={prefixLink(`/styles.css`)} media="screen" /> } else { // Default to returning the styles inlined. return <style id="gatsby-inlined-css" dangerouslySetInnerHTML={{ __html: stylesStr }} /> } } // In dev just return an empty style element. return <style /> } module.exports = htmlStyles
import React from 'react' import { prefixLink } from './gatsby-helpers' let stylesStr if (process.env.NODE_ENV === `production`) { try { stylesStr = require(`!raw!public/styles.css`) } catch (e) { // ignore } } const htmlStyles = (args = {}) => { if (process.env.NODE_ENV === `production`) { if (args.link) { // If the user wants to reference the external stylesheet return a link. return <link rel="stylesheet" type="text/css" href={prefixLink(`/styles.css`)} media="screen" /> } else { // Default to returning the styles inlined. return <style id="gatsby-inlined-css" dangerouslySetInnerHTML={{ __html: stylesStr }} /> } } // In dev just return an empty style element. return <style /> } module.exports = htmlStyles
Move variable declaration up a level to ensure it exists later
Move variable declaration up a level to ensure it exists later
JavaScript
mit
0x80/gatsby,mingaldrichgan/gatsby,fabrictech/gatsby,Khaledgarbaya/gatsby,mingaldrichgan/gatsby,fk/gatsby,fk/gatsby,danielfarrell/gatsby,okcoker/gatsby,fk/gatsby,gatsbyjs/gatsby,mickeyreiss/gatsby,okcoker/gatsby,Khaledgarbaya/gatsby,gatsbyjs/gatsby,mickeyreiss/gatsby,mingaldrichgan/gatsby,chiedo/gatsby,chiedo/gatsby,gatsbyjs/gatsby,ChristopherBiscardi/gatsby,ChristopherBiscardi/gatsby,ChristopherBiscardi/gatsby,ChristopherBiscardi/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,mickeyreiss/gatsby,danielfarrell/gatsby,okcoker/gatsby,0x80/gatsby,chiedo/gatsby,fabrictech/gatsby,fabrictech/gatsby,Khaledgarbaya/gatsby,danielfarrell/gatsby,gatsbyjs/gatsby,0x80/gatsby
532d3eab820b4ffa3eb00c81f650c1c4686c871d
examples/share-window.js
examples/share-window.js
var media = require('rtc-media'); var h = require('hyperscript'); var crel = require('crel'); var screenshare = require('..')({ chromeExtension: 'rtc.io screenshare', version: '^1.0.0' }); var buttons = { install: h('button', 'Install Extension', { onclick: function() { chrome.webstore.install(); }}), capture: h('button', 'Capture Screen', { onclick: shareScreen }) }; function shareScreen() { screenshare.request(function(err, constraints) { if (err) { return console.error('Could not capture window: ', err); } console.log('attempting capture with constraints: ', constraints); media({ constraints: constraints, target: document.getElementById('main') }); }); } // detect whether the screenshare plugin is available and matches // the required version screenshare.available(function(err, version) { var actions = document.getElementById('actions'); if (err) { return actions.appendChild(buttons.install); } actions.appendChild(buttons.capture); }); // on install show the capture button and remove the install button if active screenshare.on('activate', function() { if (buttons.install.parentNode) { buttons.install.parentNode.removeChild(buttons.install); } document.getElementById('actions').appendChild(buttons.capture); });
var media = require('rtc-media'); var h = require('hyperscript'); var crel = require('crel'); var screenshare = require('..')({ chromeExtension: 'rtc.io screenshare', version: '^1.0.0' }); var buttons = { install: h('button', 'Install Extension', { onclick: function() { chrome.webstore.install(); }}), capture: h('button', 'Capture Screen', { onclick: shareScreen }) }; function shareScreen() { screenshare.request(function(err, constraints) { if (err) { return console.error('Could not capture window: ', err); } console.log('attempting capture with constraints: ', constraints); media({ constraints: constraints, target: document.getElementById('main') }); }); // you better select something quick or this will be cancelled!!! setTimeout(screenshare.cancel, 5e3); } // detect whether the screenshare plugin is available and matches // the required version screenshare.available(function(err, version) { var actions = document.getElementById('actions'); if (err) { return actions.appendChild(buttons.install); } actions.appendChild(buttons.capture); }); // on install show the capture button and remove the install button if active screenshare.on('activate', function() { if (buttons.install.parentNode) { buttons.install.parentNode.removeChild(buttons.install); } document.getElementById('actions').appendChild(buttons.capture); });
Include code the cancels the request after 5s
Include code the cancels the request after 5s
JavaScript
apache-2.0
rtc-io/rtc-screenshare
831351123815f125adcdb17efe7c5e467f0ad42d
tests.js
tests.js
Tinytest.add('meteor-assert', function (test) { var isDefined = false; try { assert; isDefined = true; } catch (e) { } test.isTrue(isDefined, "assert is not defined"); test.throws(function () { assert.equal('a', 'b'); }); if (Meteor.isServer) { console.log("Meteor.isServer"); test.equal(1, 2); } else { console.log("Meteor.isClient"); test.equal(1, 3); } });
Tinytest.add('meteor-assert', function (test) { var isDefined = false; try { assert; isDefined = true; } catch (e) { } test.isTrue(isDefined, "assert is not defined"); test.throws(function () { assert.equal('a', 'b'); }); });
Revert "Test for Travis CI."
Revert "Test for Travis CI." This reverts commit 6a840248036cf030994cfb23f1f7d81baba1d600.
JavaScript
bsd-3-clause
peerlibrary/meteor-assert
28600218226a9efc2d8099b16949c8d585e08aa6
frontend/src/page/archive/index.js
frontend/src/page/archive/index.js
import React from 'react'; import Archive from '../../component/archive/archive-list-container'; import PropTypes from 'prop-types'; const render = ({ match }) => <Archive name={match.params.name} />; render.propTypes = { match: PropTypes.object, }; export default render;
import React from 'react'; import Archive from '../../component/archive/archive-list-container'; import PropTypes from 'prop-types'; const render = ({ match: { params }, history }) => <Archive name={params.name} history={history} />; render.propTypes = { match: PropTypes.object, history: PropTypes.object, }; export default render;
Add 'history' prop to the archive-list.
fix(router): Add 'history' prop to the archive-list.
JavaScript
apache-2.0
Unleash/unleash,Unleash/unleash,Unleash/unleash,Unleash/unleash
53eaf9062d4495d5309325c2db3038595e1d4bd8
Libraries/Components/LazyRenderer.js
Libraries/Components/LazyRenderer.js
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LazyRenderer */ 'use strict'; var React = require('React'); var TimerMixin = require('TimerMixin'); var LazyRenderer = React.createClass({ mixin: [TimerMixin], propTypes: { render: React.PropTypes.func.isRequired, }, componentWillMount: function(): void { this.setState({ _lazyRender : true, }); }, componentDidMount: function(): void { requestAnimationFrame(() => { this.setState({ _lazyRender : false, }); }); }, render: function(): ?ReactElement { return this.state._lazyRender ? null : this.props.render(); }, }); module.exports = LazyRenderer;
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule LazyRenderer */ 'use strict'; var React = require('React'); var TimerMixin = require('react-timer-mixin'); var LazyRenderer = React.createClass({ mixin: [TimerMixin], propTypes: { render: React.PropTypes.func.isRequired, }, componentWillMount: function(): void { this.setState({ _lazyRender : true, }); }, componentDidMount: function(): void { requestAnimationFrame(() => { this.setState({ _lazyRender : false, }); }); }, render: function(): ?ReactElement { return this.state._lazyRender ? null : this.props.render(); }, }); module.exports = LazyRenderer;
Replace local copy of TimerMixin with module from npm.
Replace local copy of TimerMixin with module from npm. Reviewed By: spicyj, davidaurelio Differential Revision: D3819543 fbshipit-source-id: 69d68a7653fce05a31cbfd61e48878b7a0a2ab51
JavaScript
bsd-3-clause
farazs/react-native,cosmith/react-native,doochik/react-native,kesha-antonov/react-native,adamjmcgrath/react-native,imjerrybao/react-native,negativetwelve/react-native,kesha-antonov/react-native,Purii/react-native,salanki/react-native,hoastoolshop/react-native,jaggs6/react-native,exponent/react-native,ankitsinghania94/react-native,browniefed/react-native,imjerrybao/react-native,PlexChat/react-native,imjerrybao/react-native,alin23/react-native,Maxwell2022/react-native,shrutic/react-native,facebook/react-native,exponent/react-native,Purii/react-native,happypancake/react-native,tgoldenberg/react-native,DannyvanderJagt/react-native,gitim/react-native,happypancake/react-native,foghina/react-native,salanki/react-native,negativetwelve/react-native,hoastoolshop/react-native,gitim/react-native,makadaw/react-native,hoangpham95/react-native,ptomasroos/react-native,gitim/react-native,christopherdro/react-native,CodeLinkIO/react-native,ptomasroos/react-native,brentvatne/react-native,nickhudkins/react-native,shrutic/react-native,Purii/react-native,facebook/react-native,tszajna0/react-native,Maxwell2022/react-native,ankitsinghania94/react-native,peterp/react-native,farazs/react-native,doochik/react-native,aaron-goshine/react-native,hammerandchisel/react-native,clozr/react-native,foghina/react-native,cosmith/react-native,clozr/react-native,DannyvanderJagt/react-native,javache/react-native,arthuralee/react-native,aljs/react-native,Swaagie/react-native,myntra/react-native,exponent/react-native,shrutic123/react-native,makadaw/react-native,mironiasty/react-native,gilesvangruisen/react-native,PlexChat/react-native,orenklein/react-native,aaron-goshine/react-native,hoangpham95/react-native,orenklein/react-native,PlexChat/react-native,imjerrybao/react-native,hoastoolshop/react-native,tszajna0/react-native,esauter5/react-native,charlesvinette/react-native,tadeuzagallo/react-native,htc2u/react-native,charlesvinette/react-native,Livyli/react-native,hoangpham95/react-native,Livyli/react-native,Guardiannw/react-native,xiayz/react-native,brentvatne/react-native,hammerandchisel/react-native,arthuralee/react-native,esauter5/react-native,browniefed/react-native,formatlos/react-native,skevy/react-native,htc2u/react-native,eduardinni/react-native,Maxwell2022/react-native,facebook/react-native,xiayz/react-native,christopherdro/react-native,Ehesp/react-native,browniefed/react-native,exponentjs/react-native,htc2u/react-native,adamjmcgrath/react-native,salanki/react-native,pandiaraj44/react-native,DanielMSchmidt/react-native,cdlewis/react-native,foghina/react-native,aaron-goshine/react-native,salanki/react-native,orenklein/react-native,frantic/react-native,forcedotcom/react-native,mironiasty/react-native,DanielMSchmidt/react-native,negativetwelve/react-native,jasonnoahchoi/react-native,tsjing/react-native,orenklein/react-native,doochik/react-native,rickbeerendonk/react-native,PlexChat/react-native,myntra/react-native,tadeuzagallo/react-native,xiayz/react-native,brentvatne/react-native,facebook/react-native,charlesvinette/react-native,CodeLinkIO/react-native,frantic/react-native,orenklein/react-native,hoastoolshop/react-native,doochik/react-native,farazs/react-native,htc2u/react-native,xiayz/react-native,browniefed/react-native,eduardinni/react-native,peterp/react-native,hoangpham95/react-native,imjerrybao/react-native,jasonnoahchoi/react-native,jadbox/react-native,cosmith/react-native,mironiasty/react-native,gre/react-native,gre/react-native,DanielMSchmidt/react-native,csatf/react-native,xiayz/react-native,tsjing/react-native,callstack-io/react-native,happypancake/react-native,facebook/react-native,pandiaraj44/react-native,janicduplessis/react-native,javache/react-native,doochik/react-native,Purii/react-native,Andreyco/react-native,facebook/react-native,Ehesp/react-native,cpunion/react-native,cdlewis/react-native,shrutic/react-native,farazs/react-native,lprhodes/react-native,peterp/react-native,tadeuzagallo/react-native,Guardiannw/react-native,ndejesus1227/react-native,hammerandchisel/react-native,shrutic123/react-native,shrutic/react-native,PlexChat/react-native,aaron-goshine/react-native,cdlewis/react-native,Maxwell2022/react-native,cosmith/react-native,Bhullnatik/react-native,makadaw/react-native,Purii/react-native,satya164/react-native,cdlewis/react-native,shrutic/react-native,adamjmcgrath/react-native,kesha-antonov/react-native,jevakallio/react-native,adamjmcgrath/react-native,csatf/react-native,rickbeerendonk/react-native,foghina/react-native,orenklein/react-native,nickhudkins/react-native,formatlos/react-native,tszajna0/react-native,jadbox/react-native,jadbox/react-native,DannyvanderJagt/react-native,adamjmcgrath/react-native,clozr/react-native,exponentjs/react-native,jevakallio/react-native,esauter5/react-native,tgoldenberg/react-native,DanielMSchmidt/react-native,rickbeerendonk/react-native,satya164/react-native,happypancake/react-native,kesha-antonov/react-native,cosmith/react-native,PlexChat/react-native,charlesvinette/react-native,thotegowda/react-native,hoangpham95/react-native,satya164/react-native,alin23/react-native,forcedotcom/react-native,Livyli/react-native,Maxwell2022/react-native,thotegowda/react-native,brentvatne/react-native,jaggs6/react-native,brentvatne/react-native,esauter5/react-native,tszajna0/react-native,shrutic/react-native,cdlewis/react-native,foghina/react-native,Andreyco/react-native,rickbeerendonk/react-native,skevy/react-native,jevakallio/react-native,ptmt/react-native-macos,rickbeerendonk/react-native,lprhodes/react-native,peterp/react-native,dikaiosune/react-native,ankitsinghania94/react-native,csatf/react-native,xiayz/react-native,ndejesus1227/react-native,forcedotcom/react-native,Maxwell2022/react-native,Andreyco/react-native,Swaagie/react-native,satya164/react-native,hoastoolshop/react-native,Bhullnatik/react-native,charlesvinette/react-native,farazs/react-native,Bhullnatik/react-native,alin23/react-native,kesha-antonov/react-native,janicduplessis/react-native,tadeuzagallo/react-native,javache/react-native,cpunion/react-native,gre/react-native,chnfeeeeeef/react-native,javache/react-native,formatlos/react-native,ptmt/react-native-macos,csatf/react-native,negativetwelve/react-native,ptomasroos/react-native,aljs/react-native,jasonnoahchoi/react-native,aaron-goshine/react-native,aljs/react-native,Guardiannw/react-native,Bhullnatik/react-native,shrutic123/react-native,Swaagie/react-native,eduardinni/react-native,cpunion/react-native,aljs/react-native,forcedotcom/react-native,Andreyco/react-native,tsjing/react-native,ankitsinghania94/react-native,farazs/react-native,PlexChat/react-native,lprhodes/react-native,shrutic123/react-native,hammerandchisel/react-native,Maxwell2022/react-native,esauter5/react-native,Bhullnatik/react-native,Maxwell2022/react-native,javache/react-native,cpunion/react-native,gilesvangruisen/react-native,alin23/react-native,Livyli/react-native,esauter5/react-native,brentvatne/react-native,rickbeerendonk/react-native,thotegowda/react-native,brentvatne/react-native,aaron-goshine/react-native,ptmt/react-native-macos,ndejesus1227/react-native,Ehesp/react-native,doochik/react-native,csatf/react-native,foghina/react-native,charlesvinette/react-native,happypancake/react-native,cpunion/react-native,arthuralee/react-native,charlesvinette/react-native,esauter5/react-native,orenklein/react-native,kesha-antonov/react-native,tsjing/react-native,ndejesus1227/react-native,callstack-io/react-native,alin23/react-native,Bhullnatik/react-native,formatlos/react-native,Guardiannw/react-native,exponentjs/react-native,aljs/react-native,facebook/react-native,janicduplessis/react-native,dikaiosune/react-native,janicduplessis/react-native,tszajna0/react-native,ptomasroos/react-native,callstack-io/react-native,satya164/react-native,gre/react-native,skevy/react-native,myntra/react-native,christopherdro/react-native,tsjing/react-native,naoufal/react-native,shrutic/react-native,hoangpham95/react-native,ptomasroos/react-native,myntra/react-native,CodeLinkIO/react-native,callstack-io/react-native,shrutic/react-native,tgoldenberg/react-native,exponentjs/react-native,Ehesp/react-native,gilesvangruisen/react-native,ndejesus1227/react-native,dikaiosune/react-native,christopherdro/react-native,skevy/react-native,jasonnoahchoi/react-native,aljs/react-native,gre/react-native,esauter5/react-native,eduardinni/react-native,jevakallio/react-native,callstack-io/react-native,hoastoolshop/react-native,pandiaraj44/react-native,nickhudkins/react-native,makadaw/react-native,peterp/react-native,doochik/react-native,exponentjs/react-native,myntra/react-native,jevakallio/react-native,CodeLinkIO/react-native,mironiasty/react-native,exponentjs/react-native,DannyvanderJagt/react-native,cdlewis/react-native,formatlos/react-native,cosmith/react-native,frantic/react-native,Livyli/react-native,DannyvanderJagt/react-native,imDangerous/react-native,orenklein/react-native,mironiasty/react-native,chnfeeeeeef/react-native,chnfeeeeeef/react-native,gilesvangruisen/react-native,naoufal/react-native,exponent/react-native,nickhudkins/react-native,gitim/react-native,cpunion/react-native,adamjmcgrath/react-native,jasonnoahchoi/react-native,forcedotcom/react-native,makadaw/react-native,farazs/react-native,exponent/react-native,janicduplessis/react-native,clozr/react-native,cdlewis/react-native,clozr/react-native,tgoldenberg/react-native,cpunion/react-native,tszajna0/react-native,naoufal/react-native,ankitsinghania94/react-native,pandiaraj44/react-native,satya164/react-native,Purii/react-native,imDangerous/react-native,ndejesus1227/react-native,chnfeeeeeef/react-native,dikaiosune/react-native,facebook/react-native,hammerandchisel/react-native,xiayz/react-native,rickbeerendonk/react-native,shrutic123/react-native,rickbeerendonk/react-native,jadbox/react-native,peterp/react-native,jasonnoahchoi/react-native,arthuralee/react-native,gre/react-native,exponent/react-native,CodeLinkIO/react-native,formatlos/react-native,negativetwelve/react-native,tadeuzagallo/react-native,Swaagie/react-native,naoufal/react-native,Ehesp/react-native,htc2u/react-native,ankitsinghania94/react-native,Swaagie/react-native,facebook/react-native,ptmt/react-native-macos,clozr/react-native,Andreyco/react-native,Purii/react-native,shrutic123/react-native,naoufal/react-native,forcedotcom/react-native,arthuralee/react-native,eduardinni/react-native,clozr/react-native,brentvatne/react-native,mironiasty/react-native,thotegowda/react-native,doochik/react-native,adamjmcgrath/react-native,tszajna0/react-native,javache/react-native,cosmith/react-native,cdlewis/react-native,jevakallio/react-native,tadeuzagallo/react-native,Andreyco/react-native,csatf/react-native,callstack-io/react-native,DannyvanderJagt/react-native,forcedotcom/react-native,mironiasty/react-native,myntra/react-native,dikaiosune/react-native,satya164/react-native,Livyli/react-native,jasonnoahchoi/react-native,shrutic123/react-native,christopherdro/react-native,negativetwelve/react-native,makadaw/react-native,imDangerous/react-native,negativetwelve/react-native,jevakallio/react-native,Livyli/react-native,alin23/react-native,gitim/react-native,christopherdro/react-native,christopherdro/react-native,gre/react-native,DanielMSchmidt/react-native,makadaw/react-native,ptmt/react-native-macos,ptomasroos/react-native,farazs/react-native,Guardiannw/react-native,htc2u/react-native,frantic/react-native,dikaiosune/react-native,happypancake/react-native,gitim/react-native,tgoldenberg/react-native,gilesvangruisen/react-native,eduardinni/react-native,ndejesus1227/react-native,browniefed/react-native,myntra/react-native,dikaiosune/react-native,happypancake/react-native,DanielMSchmidt/react-native,gilesvangruisen/react-native,cosmith/react-native,hammerandchisel/react-native,kesha-antonov/react-native,browniefed/react-native,exponent/react-native,Ehesp/react-native,htc2u/react-native,Purii/react-native,peterp/react-native,CodeLinkIO/react-native,exponent/react-native,Guardiannw/react-native,dikaiosune/react-native,Guardiannw/react-native,salanki/react-native,DanielMSchmidt/react-native,tsjing/react-native,alin23/react-native,naoufal/react-native,foghina/react-native,nickhudkins/react-native,skevy/react-native,Ehesp/react-native,thotegowda/react-native,janicduplessis/react-native,CodeLinkIO/react-native,htc2u/react-native,cpunion/react-native,nickhudkins/react-native,ptmt/react-native-macos,formatlos/react-native,makadaw/react-native,chnfeeeeeef/react-native,thotegowda/react-native,ankitsinghania94/react-native,Bhullnatik/react-native,exponentjs/react-native,Andreyco/react-native,imjerrybao/react-native,hammerandchisel/react-native,ptomasroos/react-native,eduardinni/react-native,formatlos/react-native,cdlewis/react-native,jaggs6/react-native,thotegowda/react-native,jaggs6/react-native,hoangpham95/react-native,happypancake/react-native,Guardiannw/react-native,tgoldenberg/react-native,tadeuzagallo/react-native,PlexChat/react-native,hoastoolshop/react-native,alin23/react-native,satya164/react-native,hammerandchisel/react-native,imjerrybao/react-native,imjerrybao/react-native,csatf/react-native,frantic/react-native,imDangerous/react-native,callstack-io/react-native,mironiasty/react-native,DannyvanderJagt/react-native,javache/react-native,csatf/react-native,salanki/react-native,ptmt/react-native-macos,browniefed/react-native,tgoldenberg/react-native,lprhodes/react-native,foghina/react-native,hoangpham95/react-native,Swaagie/react-native,tszajna0/react-native,aljs/react-native,christopherdro/react-native,myntra/react-native,jaggs6/react-native,browniefed/react-native,pandiaraj44/react-native,janicduplessis/react-native,DanielMSchmidt/react-native,jevakallio/react-native,salanki/react-native,adamjmcgrath/react-native,pandiaraj44/react-native,shrutic123/react-native,javache/react-native,makadaw/react-native,jadbox/react-native,exponentjs/react-native,rickbeerendonk/react-native,Ehesp/react-native,imDangerous/react-native,imDangerous/react-native,imDangerous/react-native,skevy/react-native,pandiaraj44/react-native,jaggs6/react-native,gilesvangruisen/react-native,Swaagie/react-native,ankitsinghania94/react-native,gre/react-native,farazs/react-native,gilesvangruisen/react-native,Bhullnatik/react-native,tsjing/react-native,ptomasroos/react-native,jaggs6/react-native,jevakallio/react-native,jadbox/react-native,mironiasty/react-native,lprhodes/react-native,jadbox/react-native,brentvatne/react-native,Andreyco/react-native,aaron-goshine/react-native,lprhodes/react-native,gitim/react-native,xiayz/react-native,formatlos/react-native,Swaagie/react-native,kesha-antonov/react-native,kesha-antonov/react-native,chnfeeeeeef/react-native,lprhodes/react-native,naoufal/react-native,ndejesus1227/react-native,jadbox/react-native,callstack-io/react-native,ptmt/react-native-macos,nickhudkins/react-native,chnfeeeeeef/react-native,aaron-goshine/react-native,chnfeeeeeef/react-native,salanki/react-native,peterp/react-native,myntra/react-native,eduardinni/react-native,clozr/react-native,tadeuzagallo/react-native,CodeLinkIO/react-native,skevy/react-native,javache/react-native,thotegowda/react-native,jasonnoahchoi/react-native,jaggs6/react-native,skevy/react-native,charlesvinette/react-native,Livyli/react-native,hoastoolshop/react-native,negativetwelve/react-native,tgoldenberg/react-native,aljs/react-native,janicduplessis/react-native,DannyvanderJagt/react-native,doochik/react-native,pandiaraj44/react-native,naoufal/react-native,gitim/react-native,nickhudkins/react-native,imDangerous/react-native,tsjing/react-native,lprhodes/react-native,negativetwelve/react-native,forcedotcom/react-native
179d721407ce581079427a07a7e18e7cb5535b2a
lumify-web-war/src/main/webapp/js/util/withFileDrop.js
lumify-web-war/src/main/webapp/js/util/withFileDrop.js
define([], function() { 'use strict'; return withFileDrop; function withFileDrop() { this.after('initialize', function() { var self = this; if (!this.handleFilesDropped) { return console.warn('Implement handleFilesDropped'); } this.node.ondragover = function() { $(this).addClass('file-hover'); return false; }; this.node.ondragenter = function() { $(this).addClass('file-hover'); return false; }; this.node.ondragleave = function() { $(this).removeClass('file-hover'); return false; }; this.node.ondrop = function(e) { e.preventDefault(); e.stopPropagation(); if (self.$node.hasClass('uploading')) return; self.handleFilesDropped(e.dataTransfer.files, event); }; }); } });
define([], function() { 'use strict'; return withFileDrop; function withFileDrop() { this.after('initialize', function() { var self = this; if (!this.handleFilesDropped) { return console.warn('Implement handleFilesDropped'); } this.node.ondragover = function() { $(this).addClass('file-hover'); return false; }; this.node.ondragenter = function() { $(this).addClass('file-hover'); return false; }; this.node.ondragleave = function() { $(this).removeClass('file-hover'); return false; }; this.node.ondrop = function(e) { if (e.dataTransfer && e.dataTransfer.files) { e.preventDefault(); e.stopPropagation(); if (self.$node.hasClass('uploading')) return; self.handleFilesDropped(e.dataTransfer.files, event); } }; }); } });
Fix issue in detail pane where dragging entities to empty space in detail pane would cause it to stay there
Fix issue in detail pane where dragging entities to empty space in detail pane would cause it to stay there
JavaScript
apache-2.0
j-bernardo/lumify,RavenB/lumify,bings/lumify,dvdnglnd/lumify,TeamUDS/lumify,bings/lumify,j-bernardo/lumify,lumifyio/lumify,bings/lumify,Steimel/lumify,TeamUDS/lumify,dvdnglnd/lumify,Steimel/lumify,Steimel/lumify,RavenB/lumify,lumifyio/lumify,j-bernardo/lumify,dvdnglnd/lumify,RavenB/lumify,RavenB/lumify,lumifyio/lumify,Steimel/lumify,TeamUDS/lumify,dvdnglnd/lumify,j-bernardo/lumify,dvdnglnd/lumify,lumifyio/lumify,Steimel/lumify,j-bernardo/lumify,bings/lumify,TeamUDS/lumify,lumifyio/lumify,bings/lumify,RavenB/lumify,TeamUDS/lumify
7c4d61814b2512f977ed13a793479ad801d693d7
lib/orbit/query/context.js
lib/orbit/query/context.js
import { Class } from '../lib/objects'; import { isQueryExpression } from './expression'; export default Class.extend({ evaluator: null, init(evaluator) { this.evaluator = evaluator; }, evaluate(expression) { if (isQueryExpression(expression)) { let operator = this.evaluator.operators[expression.op]; if (!operator) { throw new Error('Unable to find operator: ' + expression.op); } return operator.evaluate(this, expression.args); } else { return expression; } } });
import { isQueryExpression } from './expression'; export default class QueryContext { constructor(evaluator) { this.evaluator = evaluator; } evaluate(expression) { if (isQueryExpression(expression)) { let operator = this.evaluator.operators[expression.op]; if (!operator) { throw new Error('Unable to find operator: ' + expression.op); } return operator.evaluate(this, expression.args); } else { return expression; } } }
Convert QueryContext to ES class.
Convert QueryContext to ES class.
JavaScript
mit
orbitjs/orbit-core,jpvanhal/orbit-core,orbitjs/orbit.js,jpvanhal/orbit.js,orbitjs/orbit.js,jpvanhal/orbit-core,SmuliS/orbit.js,jpvanhal/orbit.js,SmuliS/orbit.js
b4af69796c13cf832d0ff53d5bcc2c9d51d79394
packages/non-core/bundle-visualizer/package.js
packages/non-core/bundle-visualizer/package.js
Package.describe({ version: '1.1.2', summary: 'Meteor bundle analysis and visualization.', documentation: 'README.md', }); Npm.depends({ "d3-selection": "1.0.5", "d3-shape": "1.0.6", "d3-hierarchy": "1.1.4", "d3-transition": "1.0.4", "d3-collection": "1.0.4", "pretty-bytes": "4.0.2", }); Package.onUse(function(api) { api.use('isobuild:dynamic-import@1.5.0'); api.use([ 'ecmascript', 'dynamic-import', 'http', ]); api.mainModule('server.js', 'server'); api.mainModule('client.js', 'client'); });
Package.describe({ version: '1.1.3', summary: 'Meteor bundle analysis and visualization.', documentation: 'README.md', }); Npm.depends({ "d3-selection": "1.0.5", "d3-shape": "1.0.6", "d3-hierarchy": "1.1.4", "d3-transition": "1.0.4", "d3-collection": "1.0.4", "pretty-bytes": "4.0.2", }); Package.onUse(function(api) { api.use('isobuild:dynamic-import@1.5.0'); api.use([ 'ecmascript', 'dynamic-import', 'http', 'webapp', ]); api.mainModule('server.js', 'server'); api.mainModule('client.js', 'client'); });
Make bundle-visualizer depend on webapp, since it imports meteor/webapp.
Make bundle-visualizer depend on webapp, since it imports meteor/webapp.
JavaScript
mit
Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor
775b805e56bbc1aa9962e0c37a82a47b4a23ff9f
src/lib/libraries/decks/translate-image.js
src/lib/libraries/decks/translate-image.js
/** * @fileoverview * Utility functions for handling tutorial images in multiple languages */ import {enImages as defaultImages} from './en-steps.js'; let savedImages = {}; let savedLocale = ''; const loadSpanish = () => import(/* webpackChunkName: "es-steps" */ './es-steps.js') .then(({esImages: imageData}) => imageData); const translations = { es: () => loadSpanish() }; const loadImageData = locale => { if (translations.hasOwnProperty(locale)) { translations[locale]() .then(newImages => { savedImages = newImages; savedLocale = locale; }); } }; /** * Return image data for tutorials based on locale (default: en) * @param {string} imageId key in the images object, or id string. * @param {string} locale requested locale * @return {string} image */ const translateImage = (imageId, locale) => { if (locale !== savedLocale || !savedImages.hasOwnProperty(imageId)) { return defaultImages[imageId]; } return savedImages[imageId]; }; export { loadImageData, translateImage };
/** * @fileoverview * Utility functions for handling tutorial images in multiple languages */ import {enImages as defaultImages} from './en-steps.js'; let savedImages = {}; let savedLocale = ''; const loadSpanish = () => import(/* webpackChunkName: "es-steps" */ './es-steps.js') .then(({esImages: imageData}) => imageData); const translations = { 'es': () => loadSpanish(), 'es-419': () => loadSpanish() }; const loadImageData = locale => { if (translations.hasOwnProperty(locale)) { translations[locale]() .then(newImages => { savedImages = newImages; savedLocale = locale; }); } }; /** * Return image data for tutorials based on locale (default: en) * @param {string} imageId key in the images object, or id string. * @param {string} locale requested locale * @return {string} image */ const translateImage = (imageId, locale) => { if (locale !== savedLocale || !savedImages.hasOwnProperty(imageId)) { return defaultImages[imageId]; } return savedImages[imageId]; }; export { loadImageData, translateImage };
Make Spanish tutorial images also load for Latinamerican Spanish
Make Spanish tutorial images also load for Latinamerican Spanish
JavaScript
bsd-3-clause
LLK/scratch-gui,LLK/scratch-gui
85cb638499d7930ce9c4c119e7ccd15d7adef7f8
dotjs.js
dotjs.js
var hostname = location.hostname.replace(/^www\./, ''); var style = document.createElement('link'); style.rel = 'stylesheet'; style.href = chrome.extension.getURL('styles/' + hostname + '.css'); document.documentElement.appendChild(style); var defaultStyle = document.createElement('link'); defaultStyle.rel = 'stylesheet'; defaultStyle.href = chrome.extension.getURL('styles/default.css'); document.documentElement.appendChild(defaultStyle); var script = document.createElement('script'); script.src = chrome.extension.getURL('scripts/' + hostname + '.js'); document.documentElement.appendChild(script); var defaultScript = document.createElement('script'); defaultScript.src = chrome.extension.getURL('scripts/default.js'); document.documentElement.appendChild(defaultScript);
var hostname = location.hostname.replace(/^www\./, ''); var appendScript = function(path){ var xhr = new XMLHttpRequest(); xhr.onload = function(){ eval(this.responseText); } xhr.open('GET', chrome.extension.getURL(path)); xhr.send(); } var defaultStyle = document.createElement('link'); defaultStyle.rel = 'stylesheet'; defaultStyle.href = chrome.extension.getURL('styles/default.css'); document.head.appendChild(defaultStyle); var style = document.createElement('link'); style.rel = 'stylesheet'; style.href = chrome.extension.getURL('styles/' + hostname + '.css'); document.head.appendChild(style); appendScript('scripts/default.js'); appendScript('scripts/' + hostname + '.js');
Revert back to evaluating scripts
Revert back to evaluating scripts - Rather this than including jQuery manually resulting in potential duplicates
JavaScript
mit
p3lim/dotjs-universal,p3lim/dotjs-universal
21082cb80f8c77c2a90d5f032193a4feda2edcf4
lib/adapter.js
lib/adapter.js
import callbacks from 'ember-encore/mixins/adapter-callbacks'; export default DS.RESTAdapter.extend(callbacks, { defaultSerializer: '-encore', pathForType: function(type) { return Ember.String.pluralize(Ember.String.underscore(type)); }, ajaxError: function(jqXHR) { var error = this._super(jqXHR); var data = JSON.parse(jqXHR.responseText); if (jqXHR && jqXHR.status === 422) { var errors = data.errors.reduce(function(memo, errorGroup) { memo[errorGroup.field] = errorGroup.types[0]; return memo; }, {}); return new DS.InvalidError(errors); } else { return error; } } });
import callbacks from 'ember-encore/mixins/adapter-callbacks'; export default DS.RESTAdapter.extend(callbacks, { defaultSerializer: '-encore', pathForType: function(type) { return Ember.String.pluralize(Ember.String.underscore(type)); }, ajaxError: function(jqXHR) { var error = this._super(jqXHR); var data = JSON.parse(jqXHR.responseText); if (jqXHR && jqXHR.status === 422) { var errors = data.errors.reduce(function(memo, errorGroup) { memo[errorGroup.field] = errorGroup.types; return memo; }, {}); return new DS.InvalidError(errors); } else { return error; } } });
Fix errors format to when creating a DS.InvalidError object
Fix errors format to when creating a DS.InvalidError object
JavaScript
bsd-3-clause
mirego/ember-encore
ec555d651c1748b793dc12ef901af806b6d09dde
server/client/containers/RunAdHocExperiment/DepVars.js
server/client/containers/RunAdHocExperiment/DepVars.js
// import React and Redux dependencies var React = require('react'); var connect = require('react-redux').connect; var $ = require('jquery'); var DepVar = require('./DepVar'); function mapStatetoProps (state, ownProps) { return { depVars: state.Experiments.getIn([ownProps.expId, 'depVars']).toJS() }; } var DepVars = React.createClass({ handleSubmit: function (event) { $.post('/submit', $(event.target).serializeArray()); }, render: function () { var depVars = this.props.depVars.map(function(depVarId) { return <DepVar key={depVarId} depVarId={depVarId} />; }); return ( <div> <form onSubmit={this.handleSubmit}> <input name="optionIndex" type="hidden" value={this.props.optionIndex} /> <input name="expId" type="hidden" value={this.props.expId} /> {depVars} <button type="submit">Submit Sample</button> </form> </div> ); } }); module.exports = connect(mapStatetoProps)(DepVars);
// import React and Redux dependencies var React = require('react'); var connect = require('react-redux').connect; var _ = require('underscore'); var $ = require('jquery'); require('jquery-serializejson'); var DepVar = require('./DepVar'); function mapStatetoProps (state, ownProps) { return { depVars: state.Experiments.getIn([ownProps.params.expid, 'depVars']).toJS(), indVars: state.Samples.getIn([ownProps.params.sampleid, 'indVarStates']).toJS() }; } var DepVars = React.createClass({ handleSubmit: function (event) { event.preventDefault(); var data = $(event.target).serializeJSON(); $.post('/submit', data); }, render: function () { var depVars = this.props.depVars.map(function(depVarId) { return <DepVar key={depVarId} depVarId={depVarId} />; }); var indVars = []; _.each(this.props.indVars, function(indVar){ indVars.push(<input name={'indVars[' + indVar._id + '][value]'} type="hidden" value={indVar.value} />); indVars.push(<input name={'indVars[' + indVar._id + '][name]'} type="hidden" value={indVar.name} />); }); return ( <div> <form onSubmit={this.handleSubmit}> <input name="expId" type="hidden" value={this.props.params.expid} /> {indVars} {depVars} <button type="submit">Submit Sample</button> </form> </div> ); } }); module.exports = connect(mapStatetoProps)(DepVars);
Add support for multiple IndVars
Add support for multiple IndVars
JavaScript
mit
Agnition/agnition,marcusbuffett/agnition,Agnition/agnition,marcusbuffett/agnition
22076933adbf6a17cdd664ac18c612a35a1df234
lib/objects.js
lib/objects.js
'use strict'; let rpc = require('./rpc'); let util = require('./util'); let idKey = util.idKey; let realmKey = util.realmKey; let registeredConstructors = {}; exports.create = create; exports.registerConstructors = registerConstructors; function create(realmId, info) { let schema = info.schema; let constructor = (registeredConstructors[realmId] || {})[schema.name]; let object = constructor ? Object.create(constructor.prototype) : {}; let props = {}; object[realmKey] = realmId; object[idKey] = info.id; for (let prop of schema.properties) { let name = prop.name; props[name] = { get: getterForProperty(name), set: setterForProperty(name), }; } Object.defineProperties(object, props); return object; } function registerletructors(realmId, letructors) { registeredletructors[realmId] = letructors; } function getterForProperty(name) { return function() { return rpc.getObjectProperty(this[realmKey], this[idKey], name); }; } function setterForProperty(name) { return function(value) { rpc.setObjectProperty(this[realmKey], this[idKey], name, value); }; }
'use strict'; let rpc = require('./rpc'); let util = require('./util'); let idKey = util.idKey; let realmKey = util.realmKey; let registeredConstructors = {}; exports.create = create; exports.registerConstructors = registerConstructors; function create(realmId, info) { let schema = info.schema; let constructor = (registeredConstructors[realmId] || {})[schema.name]; let object = constructor ? Object.create(constructor.prototype) : {}; let props = {}; object[realmKey] = realmId; object[idKey] = info.id; for (let prop of schema.properties) { let name = prop.name; props[name] = { get: getterForProperty(name), set: setterForProperty(name), }; } Object.defineProperties(object, props); return object; } function registerConstructors(realmId, constructors) { registeredConstructors[realmId] = constructors; } function getterForProperty(name) { return function() { return rpc.getObjectProperty(this[realmKey], this[idKey], name); }; } function setterForProperty(name) { return function(value) { rpc.setObjectProperty(this[realmKey], this[idKey], name, value); }; }
Fix "const" search and replace
Fix "const" search and replace
JavaScript
apache-2.0
realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js,realm/realm-js
190210feb2f3f134e227055e7e8e631372c4dd7c
app/scripts/reducers/infiniteList.js
app/scripts/reducers/infiniteList.js
import update from 'immutability-helper' import ActionTypes from '../actionTypes' const initialState = { currentPageIndex: 0, isLoading: false, listItems: [], totalPageCount: 0, } export default (state = initialState, action) => { switch (action.type) { case ActionTypes.INFINITE_LIST_INITIALIZE: return update(state, { currentPageIndex: { $set: 0 }, isLoading: { $set: true }, listItems: { $set: [] }, totalPageCount: { $set: 0 }, }) case ActionTypes.INFINITE_LIST_REQUEST: return update(state, { currentPageIndex: { $set: action.meta.page }, isLoading: { $set: true }, }) case ActionTypes.INFINITE_LIST_SUCCESS: return update(state, { isLoading: { $set: false }, listItems: { $push: action.payload.data }, totalPageCount: { $set: Math.floor(action.payload.total / action.payload.limit), }, }) case ActionTypes.INFINITE_LIST_FAILURE: return update(state, { isLoading: { $set: false }, }) default: return state } }
import update from 'immutability-helper' import ActionTypes from '../actionTypes' const initialState = { currentPageIndex: 0, isLoading: false, listItems: [], totalPageCount: 0, } export default (state = initialState, action) => { switch (action.type) { case ActionTypes.INFINITE_LIST_INITIALIZE: return update(state, { currentPageIndex: { $set: 0 }, isLoading: { $set: true }, listItems: { $set: [] }, totalPageCount: { $set: 0 }, }) case ActionTypes.INFINITE_LIST_REQUEST: return update(state, { currentPageIndex: { $set: action.meta.page }, isLoading: { $set: true }, }) case ActionTypes.INFINITE_LIST_SUCCESS: return update(state, { isLoading: { $set: false }, listItems: { $push: action.payload.data }, totalPageCount: { $set: Math.ceil(action.payload.total / action.payload.limit), }, }) case ActionTypes.INFINITE_LIST_FAILURE: return update(state, { isLoading: { $set: false }, }) default: return state } }
Fix wrong counting of total pages for infinite lists
Fix wrong counting of total pages for infinite lists
JavaScript
agpl-3.0
adzialocha/hoffnung3000,adzialocha/hoffnung3000
5a22dbf7d62117b3e9349b41ccc3f5ef2dc9ff71
src/browser/extension/background/contextMenus.js
src/browser/extension/background/contextMenus.js
import openDevToolsWindow from './openWindow'; const menus = [ { id: 'devtools-left', title: 'To left' }, { id: 'devtools-right', title: 'To right' }, { id: 'devtools-bottom', title: 'To bottom' }, { id: 'devtools-panel', title: 'In panel' } ]; let pageUrl; let pageTab; let shortcuts = {}; chrome.commands.getAll(commands => { commands.forEach(({ name, shortcut }) => { shortcuts[name] = shortcut; }); }); export default function createMenu(forUrl, tabId) { if (typeof tabId !== 'number' || tabId === pageTab) return; let url = forUrl; let hash = forUrl.indexOf('#'); if (hash !== -1) url = forUrl.substr(0, hash); if (pageUrl === url) return; pageUrl = url; pageTab = tabId; chrome.contextMenus.removeAll(); menus.forEach(({ id, title }) => { chrome.contextMenus.create({ id: id, title: title + ' (' + shortcuts[id] + ')', contexts: ['all'], documentUrlPatterns: [url], onclick: () => { openDevToolsWindow(id); } }); }); chrome.pageAction.show(tabId); }
import openDevToolsWindow from './openWindow'; const menus = [ { id: 'devtools-left', title: 'To left' }, { id: 'devtools-right', title: 'To right' }, { id: 'devtools-bottom', title: 'To bottom' }, { id: 'devtools-panel', title: 'In panel' } ]; let pageUrl; let pageTab; let shortcuts = {}; chrome.commands.getAll(commands => { commands.forEach(({ name, shortcut }) => { shortcuts[name] = shortcut; }); }); export default function createMenu(forUrl, tabId) { if (typeof tabId !== 'number') return; // It is an extension's background page chrome.pageAction.show(tabId); if (tabId === pageTab) return; let url = forUrl; let hash = forUrl.indexOf('#'); if (hash !== -1) url = forUrl.substr(0, hash); if (pageUrl === url) return; pageUrl = url; pageTab = tabId; chrome.contextMenus.removeAll(); menus.forEach(({ id, title }) => { chrome.contextMenus.create({ id: id, title: title + ' (' + shortcuts[id] + ')', contexts: ['all'], documentUrlPatterns: [url], onclick: () => { openDevToolsWindow(id); } }); }); }
Fix missing page action (popup icon) on page reload
Fix missing page action (popup icon) on page reload Related to #25.
JavaScript
mit
zalmoxisus/redux-devtools-extension,zalmoxisus/redux-devtools-extension
d3924ba8fa88a13044cf9150616c5660847e06d0
src/containers/profile/components/EditProfile.js
src/containers/profile/components/EditProfile.js
import React, { PropTypes } from 'react'; import Immutable from 'immutable'; import { Button } from 'react-bootstrap'; import styles from '../styles.module.css'; const EditProfile = ({onSubmit}) => { return( <div> <div>EditProfileComponent!</div> <Button onClick={onSubmit}>Submit</Button> </div> ); }; EditProfile.propTypes = { onSubmit: PropTypes.func.isRequired }; export default EditProfile;
import React, { PropTypes } from 'react'; import Immutable from 'immutable'; import { Button } from 'react-bootstrap'; import DocumentTitle from 'react-document-title'; import Page from '../../../components/page/Page'; import styles from '../styles.module.css'; const EditProfile = ({ userDetails, onSubmit }) => { return ( <DocumentTitle title="Edit Profile"> <Page> <Page.Header> <Page.Title>Edit Profile</Page.Title> </Page.Header> <div>EditProfileComponent!</div> <Button onClick={onSubmit}>Submit</Button> </Page> </DocumentTitle> ); }; EditProfile.propTypes = { onSubmit: PropTypes.func.isRequired }; export default EditProfile;
Add document title and page header
Add document title and page header
JavaScript
apache-2.0
dataloom/gallery,kryptnostic/gallery,kryptnostic/gallery,dataloom/gallery
5c34ebb081bb40d15daf595e642cfe0dc14f4f55
test/specs/route.js
test/specs/route.js
/*globals PushStateTree, it, expect */ describe('ObjectEvent should', function() { 'use strict'; it('be available on global scope', function() { expect(PushStateTree).toBeDefined(); }); it('throw an error if not using "new" operator', function() { expect(PushStateTree).toThrow(); }); });
/*globals PushStateTree, it, expect */ describe('PushStateTree should', function() { 'use strict'; it('be available on global scope', function() { expect(PushStateTree).toBeDefined(); }); it('throw an error if not using "new" operator', function() { expect(PushStateTree).toThrow(); }); it('construct and became a HTMLElement instance', function(){ expect(new PushStateTree()).toEqual(jasmine.any(HTMLElement)); expect(new PushStateTree({})).toEqual(jasmine.any(HTMLElement)); }); });
Test for element instance creating
Test for element instance creating
JavaScript
mit
gartz/pushStateTree,gartz/pushStateTree
4580c5feca6b28b4afe46f4ad58aa3cb7b6c7b17
website/server/server.js
website/server/server.js
"use strict"; let fs = require("fs"); let path = require("path"); let Q = require("q"); let express = require("express"); let bodyParser = require("body-parser"); let restify = require("restify"); function Server() { Q.longStackSupport = true; this.__setup(); }; Server.prototype.__setup = function () { this.app = restify.createServer({ name: "BeaconSpam" }); this.app.use(bodyParser.json()); this.__setupRouting(); }; Server.prototype.listen = function() { console.log("Server started!"); this.app.listen(8080); }; Server.prototype.__setupRouting = function () { // Static files are added last as they match every request this.app.get(".*", restify.serveStatic({ directory: "client/", default: "index.html" })); }; module.exports = Server;
"use strict"; let fs = require("fs"); let path = require("path"); let Q = require("q"); let express = require("express"); let bodyParser = require("body-parser"); let restify = require("restify"); function Server() { Q.longStackSupport = true; this.__setup(); }; Server.prototype.__setup = function () { this.app = restify.createServer({ name: "BeaconSpam" }); this.app.use(bodyParser.json()); this.__setupRouting(); }; Server.prototype.listen = function() { console.log("Server started!"); this.app.listen(8080); }; let handleBeaconInfo = function (req, res) { /** * { * id: ...., * name: ..., * txPower: ...., * samples: [{rssi: ...., timestamp: .....}] * } */ var beaconData = { id: req.body.id, name: req.body.name, txPower: req.body.txPower, samples: req.body.samples } res.send(); } Server.prototype.__setupRouting = function () { this.app.post("/beacon/data", handleBeaconInfo); // Static files are added last as they match every request this.app.get(".*", restify.serveStatic({ directory: "client/", default: "index.html" })); }; module.exports = Server;
Add rest endpoint for beacon data
Add rest endpoint for beacon data
JavaScript
mit
pankrator/Beacon-Spam,pankrator/Beacon-Spam
2305a450851dbaf03f6f0583b7b12e290ac79f0b
lib/web/angular-base-workaround.js
lib/web/angular-base-workaround.js
if ('angular' in window) { angular.module('ng').run(['$rootScope', '$window', function ($rootScope, window) { $rootScope.$watch(function() { return $window.location.pathname + $window.location.search; }, function (newUrl, oldUrl) { if (newUrl === oldUrl) { return; } var evt = document.createEvent('CustomEvent'); evt.initCustomEvent('spriteLoaderLocationUpdated', false, false, { newUrl: newUrl }); window.dispatchEvent(evt); }); }]); }
if ('angular' in window) { angular.module('ng').run(['$rootScope', '$window', function ($rootScope, $window) { $rootScope.$watch(function() { return $window.location.pathname + $window.location.search; }, function (newUrl, oldUrl) { if (newUrl === oldUrl) { return; } var evt = document.createEvent('CustomEvent'); evt.initCustomEvent('spriteLoaderLocationUpdated', false, false, { newUrl: newUrl }); window.dispatchEvent(evt); }); }]); }
Watch location update instead of listening events since there is no event when $locatoin update is failed: window -> $window typo
Watch location update instead of listening events since there is no event when $locatoin update is failed: window -> $window typo
JavaScript
mit
kisenka/svg-sprite-loader,kisenka/webpack-svg-sprite-loader,princed/webpack-svg-sprite-loader
6113b3bf024e578bb920713470c94d5e9853c684
src/app/utils/notification/NotificationProviderLibNotify.js
src/app/utils/notification/NotificationProviderLibNotify.js
import NotificationProvider from "./NotificationProvider"; import LibNotify from "node-notifier/notifiers/notifysend"; import which from "utils/node/fs/which"; import UTIL from "util"; function NotificationProviderLibNotify() { this.provider = new LibNotify(); } UTIL.inherits( NotificationProviderLibNotify, NotificationProvider ); NotificationProviderLibNotify.platforms = { linux: "growl" }; /** * @returns {Promise} */ NotificationProviderLibNotify.test = function() { return which( "notify-send" ); }; export default NotificationProviderLibNotify;
import NotificationProvider from "./NotificationProvider"; import LibNotify from "node-notifier/notifiers/notifysend"; import which from "utils/node/fs/which"; import UTIL from "util"; function NotificationProviderLibNotify() { this.provider = new LibNotify({ // don't run `which notify-send` twice suppressOsdCheck: true }); } UTIL.inherits( NotificationProviderLibNotify, NotificationProvider ); NotificationProviderLibNotify.platforms = { linux: "growl" }; /** * @returns {Promise} */ NotificationProviderLibNotify.test = function() { return which( "notify-send" ); }; export default NotificationProviderLibNotify;
Disable node-notifier's which call of notify-send
Disable node-notifier's which call of notify-send
JavaScript
mit
chhe/livestreamer-twitch-gui,bastimeyer/livestreamer-twitch-gui,streamlink/streamlink-twitch-gui,streamlink/streamlink-twitch-gui,bastimeyer/livestreamer-twitch-gui,bastimeyer/livestreamer-twitch-gui,chhe/livestreamer-twitch-gui,streamlink/streamlink-twitch-gui,chhe/livestreamer-twitch-gui
4b5965328d8dc4388793fd7dfbbc0df3b5d9ca73
grunt.js
grunt.js
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: '<json:package.json>', test: { files: ['test/**/*.js'] }, lint: { files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js'] }, watch: { files: '<config:lint.files>', tasks: 'default' }, jshint: { options: { curly: true, eqeqeq: true, immed: true, latedef: true, newcap: true, noarg: true, sub: true, undef: true, boss: true, eqnull: true, node: true }, globals: { exports: true } } }); // Default task. grunt.registerTask('default', 'lint test'); };
'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: '<json:package.json>', test: { files: ['test/**/*.js'] }, lint: { files: ['lib/**/*.js', 'test/**/*.coffee'] }, watch: { files: ['<config:coffee.app.src>', 'src/**/*.jade'], tasks: 'coffee cp' }, coffee: { app: { src: ['src/**/*.coffee'], dest: './lib', options: { preserve_dirs: true, base_path: 'src' } } }, coffeelint: { all: { src: ['src/**/*.coffee', 'test/**/*.coffee'], } }, clean:{ folder: 'lib' }, jshint: { options: { curly: true, eqeqeq: true, immed: true, latedef: true, newcap: true, noarg: true, sub: true, undef: true, boss: true, eqnull: true, node: true }, globals: { exports: true } } }); // Default task. grunt.registerTask('default', 'coffeelint coffee'); grunt.loadNpmTasks('grunt-coffee'); grunt.loadNpmTasks('grunt-coffeelint'); grunt.loadNpmTasks('grunt-cp'); grunt.loadNpmTasks('grunt-clean'); };
Set up for compilation from src to lib
Set up for compilation from src to lib
JavaScript
mit
ddubyah/thumblr
605e59e704422fd780fa23a757a17225c8400255
index.js
index.js
connect = require('connect'); serveServer = require('serve-static'); jade = require("./lib/processor/jade.js"); function miniharp(root) { //console.log(root); var app = connect() .use(serveServer(root)) .use(jade(root)); return app; }; module.exports = miniharp;
connect = require('connect'); serveServer = require('serve-static'); jade = require("./lib/processor/jade.js"); less = require("./lib/processor/less.js"); function miniharp(root) { //console.log(root); var app = connect() .use(serveServer(root)) .use(jade(root)) .use(less(root)); return app; }; module.exports = miniharp;
Add less preprocessor to the mini-harp app
Add less preprocessor to the mini-harp app
JavaScript
mit
escray/besike-nodejs-harp,escray/besike-nodejs-harp
75e55d7bd009fcc0bd670c592a34319c8b2655ed
index.js
index.js
'use strict'; var got = require('got'); var cheerio = require('cheerio'); var md = require('html-md'); module.exports = function(id, callback) { var url = 'http://www.stm.dk/_p_' + id + '.html'; got(url, function(err, data){ var $ = cheerio.load(data); var meta = $('meta[name="created"]'); var speech = $('.maininner.maininner-page'); speech.find('h1').remove(); speech.find('.nedtonet').remove(); var data = { source: url, date: meta.attr('content'), html: speech.html(), markdown: md(speech.html(), {inline: true}).replace(/\\/gi, '') }; var linkElement = speech.find('a[onclick]'); if(linkElement.length){ var link = linkElement.attr('onclick').split('\'')[1]; linkElement.attr('href', link); data.video = link; speech.children().last().remove(); speech.children().last().remove(); speech.children().last().remove(); } callback(null, data) }); };
'use strict'; var got = require('got'); var cheerio = require('cheerio'); var md = require('html-md'); module.exports = function(id, callback) { var url = 'http://www.stm.dk/_p_' + id + '.html'; got(url, function(err, data){ var $ = cheerio.load(data); var meta = $('meta[name="created"]'); var speech = $('.maininner.maininner-page'); speech.find('h1').remove(); speech.find('.nedtonet').remove(); var data = { source: url, date: meta.attr('content'), html: speech.html(), markdown: md(speech.html(), {inline: true}).replace(/\\/gi, '') }; var image = speech.find('.a110051').find('img').attr('src'); if(image){ speech.find('.a110051').remove(); image = 'http://www.stm.dk/' + image; } var linkElement = speech.find('a[onclick]'); if(linkElement.length){ var link = linkElement.attr('onclick').split('\'')[1]; linkElement.attr('href', link); data.video = link; speech.children().last().remove(); speech.children().last().remove(); speech.children().last().remove(); } callback(null, data) }); };
Add image property to callback data
Add image property to callback data
JavaScript
mit
matiassingers/statsministeriet-speeches-scraper
3a89935c293c8133ad9dd48c0be01949083a9c4a
client/js/libs/handlebars/colorClass.js
client/js/libs/handlebars/colorClass.js
"use strict"; // Generates a string from "color-1" to "color-32" based on an input string module.exports = function(str) { let hash = 0; for (let i = 0; i < str.length; i++) { hash += str.charCodeAt(i); } return "color-" + (1 + hash % 32); };
"use strict"; // Generates a string from "color-1" to "color-32" based on an input string module.exports = function(str) { let hash = 0; for (let i = 0; i < str.length; i++) { hash += str.charCodeAt(i); } /* Modulo 32 lets us be case insensitive for ascii due to A being ascii 65 (100 0001) while a being ascii 97 (110 0001) */ return "color-" + (1 + hash % 32); };
Add reminder that ascii is awesome.
Add reminder that ascii is awesome.
JavaScript
mit
thelounge/lounge,MaxLeiter/lounge,realies/lounge,realies/lounge,williamboman/lounge,ScoutLink/lounge,williamboman/lounge,thelounge/lounge,FryDay/lounge,MaxLeiter/lounge,realies/lounge,FryDay/lounge,ScoutLink/lounge,ScoutLink/lounge,MaxLeiter/lounge,williamboman/lounge,FryDay/lounge
854e8f71d40d7d2a077a208f3f6f33f9a0dc23f4
index.js
index.js
// http://stackoverflow.com/questions/11935175/sampling-a-random-subset-from-an-array var featureCollection = require('turf-featurecollection'); /** * Takes a {@link FeatureCollection} and returns a FeatureCollection with given number of {@link Feature|features} at random. * * @module turf/sample * @category data * @param {FeatureCollection} features a FeatureCollection of any type * @param {number} n number of features to select * @return {FeatureCollection} a FeatureCollection with `n` features * @example * var points = turf.random('points', 1000); * * //=points * * var sample = turf.sample(points, 10); * * //=sample */ module.exports = function(fc, num){ var outFC = featureCollection(getRandomSubarray(fc.features, num)); return outFC; }; function getRandomSubarray(arr, size) { var shuffled = arr.slice(0), i = arr.length, min = i - size, temp, index; while (i-- > min) { index = Math.floor((i + 1) * Math.random()); temp = shuffled[index]; shuffled[index] = shuffled[i]; shuffled[i] = temp; } return shuffled.slice(min); }
// http://stackoverflow.com/questions/11935175/sampling-a-random-subset-from-an-array var featureCollection = require('turf-featurecollection'); /** * Takes a {@link FeatureCollection} and returns a FeatureCollection with given number of {@link Feature|features} at random. * * @module turf/sample * @category data * @param {FeatureCollection<(Point|LineString|Polygon)>} features a FeatureCollection of any type * @param {Number} n number of features to select * @return {FeatureCollection<(Point|LineString|Polygon)>} a FeatureCollection with `n` features * @example * var points = turf.random('points', 1000); * * //=points * * var sample = turf.sample(points, 10); * * //=sample */ module.exports = function(fc, num){ var outFC = featureCollection(getRandomSubarray(fc.features, num)); return outFC; }; function getRandomSubarray(arr, size) { var shuffled = arr.slice(0), i = arr.length, min = i - size, temp, index; while (i-- > min) { index = Math.floor((i + 1) * Math.random()); temp = shuffled[index]; shuffled[index] = shuffled[i]; shuffled[i] = temp; } return shuffled.slice(min); }
Switch doc to closure compiler templating
Switch doc to closure compiler templating
JavaScript
mit
Turfjs/turf-sample
024de1e7eff4e4f688266d14abfe0dbcaedf407e
index.js
index.js
require('./env'); var http = require('http'); var koa = require('koa'); var app = koa(); app.use(require('koa-bodyparser')()); app.use(function *(next) { if (typeof this.request.body === 'undefined' || this.request.body === null) { this.request.body = {}; } yield next; }); app.use(require('koa-views')('views', { default: 'jade' })); app.use(function *(next) { this.api = API; var token = this.cookies.get('session-token'); if (token) { this.api.$header('x-session-token', token); } yield next; }); app.use(function *(next) { try { yield next; } catch (err) { if (err.body) { if (err.body.status === 401) { this.redirect('/account/signin'); } else { this.body = err.body; } } console.error(err.stack); } }); require('koa-mount-directory')(app, require('path').join(__dirname, 'routes')); app.use(require('koa-mount')('/api', require('./api'))); if (require.main === module) { app.listen($config.port); } else { module.exports = app; }
require('./env'); var mount = require('koa-mount'); var koa = require('koa'); var app = koa(); app.use(require('koa-bodyparser')()); app.use(function *(next) { if (typeof this.request.body === 'undefined' || this.request.body === null) { this.request.body = {}; } yield next; }); app.use(mount('/build', require('koa-static')('build', { defer: true }))); app.use(require('koa-views')('views', { default: 'jade' })); app.use(function *(next) { this.api = API; var token = this.cookies.get('session-token'); if (token) { this.api.$header('x-session-token', token); } yield next; }); app.use(function *(next) { try { yield next; } catch (err) { if (err.body) { if (err.body.status === 401) { this.redirect('/account/signin'); } else { this.body = err.body; } } console.error(err.stack || err); } }); require('koa-mount-directory')(app, require('path').join(__dirname, 'routes')); app.use(require('koa-mount')('/api', require('./api'))); if (require.main === module) { app.listen($config.port); } else { module.exports = app; }
Use koa-static to serve static files
Use koa-static to serve static files
JavaScript
mit
luin/doclab,luin/doclab
3b9847a61da0b294ddfee133cda962fa393f914d
client/components/Reaction.js
client/components/Reaction.js
import React, {Component} from 'react' import './Reaction.sass' class Reaction extends Component { constructor() { super(); this.state = { React: false }; } componentDidMount() { var thiz = this; setTimeout(function () { thiz.setState({ React: true }); }, Math.random()*5000); } render() { let content = <div className="Ready"> 'READY?!' </div>; if (this.state.React) { content = <img className="React-button" src = 'https://s3-us-west-2.amazonaws.com/chicagoview/icons/react-logo.png' />; } return ( <div >{content}</div> ); } }; export default Reaction
import React, {Component} from 'react' import './Reaction.sass' class Reaction extends Component { constructor() { super(); this.state = { React: false }; } componentDidMount() { var thiz = this; setTimeout(function () { thiz.setState({ React: true }); }, Math.random()*5000); } getReactionTime(event) { let reactionTime = Date.now(); console.log(reactionTime); return reactionTime; } getCreate(event) { let create = Date.now(); console.log(create); return create; } reactionTimePlayer() { let timePlayer = getReactionTime() - getCreate(); console.log(timePlayer); return timePlayer; } render() { let content = <div className="Ready"> 'READY?!' </div>; if (this.state.React) { content = <img className="React-button" src = 'https://s3-us-west-2.amazonaws.com/chicagoview/icons/react-logo.png' onClick={this.getReactionTime.bind(this)} onLoad={this.getCreate.bind(this)} />; } return ( <div> <div className="Random"> {content} </div> <div className="time" > Time: {this.reactionTimePlayer.bind(this)} </div> </div> ); } }; export default Reaction
Add OnClick and Onload for reaction and create times
Add OnClick and Onload for reaction and create times
JavaScript
mit
Jeffrey-Meesters/React-Shoot,Jeffrey-Meesters/React-Shoot
59d6f506b93982816e2f98a76b361b2a9ebd57ac
index.js
index.js
'use strict'; require('./patch/functionName'); (function (window, document, undefined) { var oldMappy = window.Mappy var Mappy = require('./lib/main') //Node style module export if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = Mappy; } /** * Resets the window.Mappy variable to its original state and returns * the Mappy object */ Mappy.noConflict = function () { window.Mappy = oldMappy; return this; }; window.Mappy = Mappy; })(window, document)
'use strict'; (function (window, document, undefined) { var oldMappy = window.Mappy var Mappy = require('./lib/main') //Node style module export if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = Mappy; } /** * Resets the window.Mappy variable to its original state and returns * the Mappy object */ Mappy.noConflict = function () { window.Mappy = oldMappy; return this; }; window.Mappy = Mappy; })(window, document)
Remove function constructor name patch
Remove function constructor name patch
JavaScript
mit
mediasuitenz/mappy,mediasuitenz/mappy
65bb0ff4fce04e58febe70936adf503d432f9d41
index.js
index.js
#!/usr/bin/env node var program = require('commander'); var userArgs = process.argv.splice(2); var message = userArgs.join(' '); if (message.length > 140) { console.log('Message was too long. Can only be 140 characters. It was: ', message.length); process.exit(1); } console.log(message);
#!/usr/bin/env node var program = require('commander'); var userArgs = process.argv.splice(2); var message = userArgs.join(' '); var confluenceUrl = process.env.CONFLUENCE_URL if (message.length > 140) { console.log('Message was too long. Can only be 140 characters. It was: ', message.length); process.exit(1); } if (!confluenceUrl) { console.log('Please set the environment variable CONFLUENCE_URL.') process.exit(2); } console.log(message);
Read confluence url from env
Read confluence url from env
JavaScript
mit
tylerpeterson/confluence-user-status