commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
470d60cecd661784183cc9633790262e16a9d494
firefox/bl.ocks.firefox/content/bl.ocks.js
firefox/bl.ocks.firefox/content/bl.ocks.js
window.addEventListener("load", function(e) { var run = function() { var document = content.document; var reGist = /^https?\:\/\/gist\.github\.com\/(\d*)/i, reRel = /^\/?(\d+)$/, gist = reGist.test(document.location.href), anchors = document.querySelectorAll("a[href]"), anchor, image, imageURL = "chrome://bl.ocks.org/content/bl.ocks.png", i = -1, n = anchors.length, href, match; while (++i < n) { match = (href = (anchor = anchors[i]).getAttribute("href")).match(reGist); if (gist && !(match && match[1])) match = href.match(reRel); if (match && match[1]) { anchor = anchor.parentNode.insertBefore(document.createElement("a"), anchor.nextSibling); anchor.setAttribute("href", "http://bl.ocks.org/" + match[1]); anchor.setAttribute("title", "View bl.ock #" + match[1] + "."); anchor.style.marginLeft = "2px"; image = anchor.appendChild(document.createElement("img")); image.setAttribute("src", imageURL); image.style.width = "16px"; } } }; var appcontent = document.getElementById("appcontent"); if (appcontent) { appcontent.addEventListener("DOMContentLoaded", run, true); } }, false);
window.addEventListener("load", function load() { window.removeEventListener("load", load, false); gBrowser.addEventListener("DOMContentLoaded", function(e) { var document = e.originalTarget, reGist = /^https?\:\/\/gist\.github\.com\/(\d*)/i, reRel = /^\/?(\d+)$/, gist = reGist.test(document.location.href), anchors = document.querySelectorAll("a[href]"), anchor, image, imageURL = "chrome://bl.ocks.org/content/bl.ocks.png", i = -1, n = anchors.length, href, match; while (++i < n) { match = (href = (anchor = anchors[i]).getAttribute("href")).match(reGist); if (gist && !(match && match[1])) match = href.match(reRel); if (match && match[1] && !anchor.matched) { anchor.matched = true; // avoid duplicate linking on iframes anchor = anchor.parentNode.insertBefore(document.createElement("a"), anchor.nextSibling); anchor.setAttribute("href", "http://bl.ocks.org/" + match[1]); anchor.setAttribute("title", "View bl.ock #" + match[1] + "."); anchor.style.marginLeft = "2px"; image = anchor.appendChild(document.createElement("img")); image.setAttribute("src", imageURL); image.style.width = "16px"; } } }, false); }, false);
Fix duplicate linking with iframes.
Fix duplicate linking with iframes.
JavaScript
bsd-3-clause
techtonik/bl.ocks.org,dubu/bl.ocks.org,dubu/bl.ocks.org,bclinkinbeard/bl.ocks.org,cool-Blue/bl.ocks.org,techtonik/bl.ocks.org,cool-Blue/bl.ocks.org,bclinkinbeard/bl.ocks.org
--- +++ @@ -1,7 +1,8 @@ -window.addEventListener("load", function(e) { - var run = function() { - var document = content.document; - var reGist = /^https?\:\/\/gist\.github\.com\/(\d*)/i, +window.addEventListener("load", function load() { + window.removeEventListener("load", load, false); + gBrowser.addEventListener("DOMContentLoaded", function(e) { + var document = e.originalTarget, + reGist = /^https?\:\/\/gist\.github\.com\/(\d*)/i, reRel = /^\/?(\d+)$/, gist = reGist.test(document.location.href), anchors = document.querySelectorAll("a[href]"), @@ -15,7 +16,8 @@ while (++i < n) { match = (href = (anchor = anchors[i]).getAttribute("href")).match(reGist); if (gist && !(match && match[1])) match = href.match(reRel); - if (match && match[1]) { + if (match && match[1] && !anchor.matched) { + anchor.matched = true; // avoid duplicate linking on iframes anchor = anchor.parentNode.insertBefore(document.createElement("a"), anchor.nextSibling); anchor.setAttribute("href", "http://bl.ocks.org/" + match[1]); anchor.setAttribute("title", "View bl.ock #" + match[1] + "."); @@ -25,9 +27,5 @@ image.style.width = "16px"; } } - }; - var appcontent = document.getElementById("appcontent"); - if (appcontent) { - appcontent.addEventListener("DOMContentLoaded", run, true); - } -}, false); + }, false); +}, false);
32c6c1747b798b03a8d200dbf5dc3b84fd7fa487
index.js
index.js
/* eslint-disable */ 'use strict'; module.exports = { name: 'ember-flatpickr', included: function(app) { let cssPath = 'themes/'; if(app.options && app.options.flatpickr && app.options.flatpickr.theme) { cssPath += app.options.flatpickr.theme; } else { cssPath += 'dark'; } cssPath += '.css'; this.theme = cssPath; this._super.included.apply(this, arguments); }, options: { nodeAssets: { flatpickr: function() { if (!process.env.EMBER_CLI_FASTBOOT) { return { srcDir: 'dist', import: [ 'flatpickr.js', this.theme ] }; } } } } };
/* eslint-disable */ 'use strict'; module.exports = { name: 'ember-flatpickr', included: function(app) { let cssPath = 'themes/'; if (app.options && app.options.flatpickr && app.options.flatpickr.theme) { cssPath += app.options.flatpickr.theme; } else { cssPath += 'dark'; } cssPath += '.css'; this.theme = cssPath; this._super.included.apply(this, arguments); }, options: { nodeAssets: { flatpickr: function() { return { enabled: !process.env.EMBER_CLI_FASTBOOT, srcDir: 'dist', import: [ 'flatpickr.js', this.theme ] }; } } } };
Fix node assets with fastboot
Fix node assets with fastboot
JavaScript
mit
shipshapecode/ember-flatpickr,shipshapecode/ember-flatpickr,shipshapecode/ember-flatpickr
--- +++ @@ -5,9 +5,9 @@ name: 'ember-flatpickr', included: function(app) { let cssPath = 'themes/'; - if(app.options && app.options.flatpickr && app.options.flatpickr.theme) { + if (app.options && app.options.flatpickr && app.options.flatpickr.theme) { cssPath += app.options.flatpickr.theme; - } + } else { cssPath += 'dark'; } @@ -19,15 +19,14 @@ options: { nodeAssets: { flatpickr: function() { - if (!process.env.EMBER_CLI_FASTBOOT) { - return { - srcDir: 'dist', - import: [ - 'flatpickr.js', - this.theme - ] - }; - } + return { + enabled: !process.env.EMBER_CLI_FASTBOOT, + srcDir: 'dist', + import: [ + 'flatpickr.js', + this.theme + ] + }; } } }
2536e5d46101068a045c8a7c05c8b02d99bb1e65
index.js
index.js
var debug = require( 'debug' )( 'wpcom-vip' ); var request = require( './lib/util/request' ); // Modules function WPCOM_VIP( token ) { this.req = new Request( this ); } WPCOM_VIP.prototype.API_VERSION = '1'; WPCOM_VIP.prototype.API_TIMEOUT = 10000; WPCOM_VIP.prototype.req = new Request(); WPCOM_VIP.prototype.get = function() { return this.req.get.apply( arguments ); }; WPCOM_VIP.prototype.post = function() { return this.req.post.apply( arguments ); }; WPCOM_VIP.prototype.put = function() { return this.req.get.apply( arguments ); }; WPCOM_VIP.prototype.delete = function() { return this.req.delete.apply( arguments ); }; module.exports = WPCOM_VIP;
var debug = require( 'debug' )( 'wpcom-vip' ); var request = require( './lib/util/request' ); // Modules function WPCOM_VIP( token ) { this.req = new Request( this ); this.auth = {}; } WPCOM_VIP.prototype.API_VERSION = '1'; WPCOM_VIP.prototype.API_TIMEOUT = 10000; WPCOM_VIP.prototype.req = new Request(); WPCOM_VIP.prototype.get = function() { return this.req.get.apply( arguments ); }; WPCOM_VIP.prototype.post = function() { return this.req.post.apply( arguments ); }; WPCOM_VIP.prototype.put = function() { return this.req.get.apply( arguments ); }; WPCOM_VIP.prototype.delete = function() { return this.req.delete.apply( arguments ); }; module.exports = WPCOM_VIP;
Add placeholder 'auth' property to the main object
Add placeholder 'auth' property to the main object
JavaScript
mit
Automattic/vip-js-sdk
--- +++ @@ -6,6 +6,8 @@ function WPCOM_VIP( token ) { this.req = new Request( this ); + + this.auth = {}; } WPCOM_VIP.prototype.API_VERSION = '1';
22cd0157d81831d765ae328e4cba253f314761a3
index.js
index.js
module.exports = function cu(fn) { 'use strict'; var args = [].slice.call(arguments); if ('function' !== typeof fn) throw new Error('auto-curry: Invalid parameter. First parameter should be a function.'); if ('function' === typeof fn && !fn.length) return fn; if (args.length - 1 >= fn.length) return fn.apply(this, args.slice(1)); return function() { var tempArgs = args.concat([].slice.call(arguments)); return cu.apply(this, tempArgs); }; };
module.exports = function cu(fn) { 'use strict' var args = [].slice.call(arguments) var typeOfFn = typeof fn if ('function' !== typeOfFn) throw new Error('auto-curry: Invalid parameter. Expected function, received ' + typeOfFn) if (fn.length <= 1) return fn if (args.length - 1 >= fn.length) return fn.apply(this, args.slice(1)) return function() { return cu.apply(this, args.concat([].slice.call(arguments))) }; };
Return unary fn as is and remove redundant checks
Return unary fn as is and remove redundant checks
JavaScript
mit
zeusdeux/auto-curry
--- +++ @@ -1,12 +1,14 @@ module.exports = function cu(fn) { - 'use strict'; - var args = [].slice.call(arguments); + 'use strict' - if ('function' !== typeof fn) throw new Error('auto-curry: Invalid parameter. First parameter should be a function.'); - if ('function' === typeof fn && !fn.length) return fn; - if (args.length - 1 >= fn.length) return fn.apply(this, args.slice(1)); + var args = [].slice.call(arguments) + var typeOfFn = typeof fn + + if ('function' !== typeOfFn) throw new Error('auto-curry: Invalid parameter. Expected function, received ' + typeOfFn) + if (fn.length <= 1) return fn + if (args.length - 1 >= fn.length) return fn.apply(this, args.slice(1)) + return function() { - var tempArgs = args.concat([].slice.call(arguments)); - return cu.apply(this, tempArgs); + return cu.apply(this, args.concat([].slice.call(arguments))) }; };
61e507ef3bbf11ee4f59ea3d9f470091d9229040
server.js
server.js
const Hapi = require('@hapi/hapi'); const routes = require('./routes'); const auth = require('./auth'); module.exports = async (elastic, config, cb) => { const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: "ignore" }, log: { collect: true } } }); server.route(routes(elastic, config)); if (config.auth) { server.route(auth()); await server.register(require('hapi-auth-jwt2')); await server.register(require('./auth/authentication')); } try { await server.register([ { plugin: require('good'), options: { reporters: { console: [{ module: 'good-console' }, 'stdout'] } } }, require('inert'), require('vision'), require('h2o2'), { plugin: require('./routes/plugins/error'), options: { config: config } } ]); } catch (err) { return cb(err); } server.views({ engines: { html: { module: require('handlebars'), compileMode: 'sync' } }, relativeTo: __dirname, path: './templates/pages', layout: 'default', layoutPath: './templates/layouts', partialsPath: './templates/partials', helpersPath: './templates/helpers' }); cb(null, { server, elastic }); };
const Hapi = require('@hapi/hapi'); const routes = require('./routes'); const auth = require('./auth'); module.exports = async (elastic, config, cb) => { const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: 'ignore' }, log: { collect: true } } }); server.route(routes(elastic, config)); if (config.auth) { server.route(auth()); await server.register(require('hapi-auth-jwt2')); await server.register(require('./auth/authentication')); } try { await server.register([ { plugin: require('good'), options: { reporters: { console: [{ module: 'good-console' }, 'stdout'] } } }, require('inert'), require('vision'), require('h2o2'), { plugin: require('./routes/plugins/error'), options: { config: config } } ]); } catch (err) { return cb(err); } server.views({ engines: { html: { module: require('handlebars'), compileMode: 'sync' } }, relativeTo: __dirname, path: './templates/pages', layout: 'default', layoutPath: './templates/layouts', partialsPath: './templates/partials', helpersPath: './templates/helpers' }); cb(null, { server, elastic }); };
Enable CORS ignore orgin header
Enable CORS ignore orgin header
JavaScript
mit
TheScienceMuseum/collectionsonline,TheScienceMuseum/collectionsonline
--- +++ @@ -3,7 +3,7 @@ const auth = require('./auth'); module.exports = async (elastic, config, cb) => { - const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: "ignore" }, log: { collect: true } } }); + const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: 'ignore' }, log: { collect: true } } }); server.route(routes(elastic, config));
017042607ba141f7d7a51731f5466fb7a9b6d517
index.js
index.js
import { readdirSync, lstatSync } from 'fs'; import { resolve } from 'path'; import { init } from './server/init'; import { replaceInjectedVars } from './server/lib/replace_injected_vars'; export default function (kibana) { return new kibana.Plugin({ id: 'notification_center', configPrefix: 'notification_center', require: ['elasticsearch'], name: 'notification_center', uiExports: { chromeNavControls: [ 'plugins/notification_center/nav_control' ], injectDefaultVars(server) { return { notificationCenter: { supportDarkTheme: server.config().get('notification_center.supportDarkTheme') } }; }, replaceInjectedVars }, config(Joi) { return Joi.object({ enabled: Joi.boolean().default(true), index: Joi.string().default('notification-%{+YYYY.MM.DD}'), template: Joi.object({ name: Joi.string().default('notification_center_template'), overwrite: Joi.boolean().default(false) }).default(), api: Joi.object({ enabled: Joi.boolean().default(true), pull: Joi.object({ maxSize: Joi.number().default(100) }).default() }).default(), supportDarkTheme: Joi.boolean().default(true) }).default(); }, init }); };
import { resolve } from 'path'; import { init } from './server/init'; import { replaceInjectedVars } from './server/lib/replace_injected_vars'; export default function (kibana) { return new kibana.Plugin({ id: 'notification_center', configPrefix: 'notification_center', require: ['elasticsearch'], name: 'notification_center', publicDir: resolve(__dirname, 'public'), uiExports: { chromeNavControls: [ 'plugins/notification_center/nav_control' ], injectDefaultVars(server) { return { notificationCenter: { supportDarkTheme: server.config().get('notification_center.supportDarkTheme') } }; }, replaceInjectedVars }, config(Joi) { return Joi.object({ enabled: Joi.boolean().default(true), index: Joi.string().default('notification-%{+YYYY.MM.DD}'), template: Joi.object({ name: Joi.string().default('notification_center_template'), overwrite: Joi.boolean().default(false) }).default(), api: Joi.object({ enabled: Joi.boolean().default(true), pull: Joi.object({ maxSize: Joi.number().default(100) }).default() }).default(), supportDarkTheme: Joi.boolean().default(true) }).default(); }, init }); };
Add `publicDir` option to plugin options
Add `publicDir` option to plugin options
JavaScript
mit
sw-jung/kibana_notification_center,sw-jung/kibana_notification_center
--- +++ @@ -1,4 +1,3 @@ -import { readdirSync, lstatSync } from 'fs'; import { resolve } from 'path'; import { init } from './server/init'; import { replaceInjectedVars } from './server/lib/replace_injected_vars'; @@ -9,6 +8,7 @@ configPrefix: 'notification_center', require: ['elasticsearch'], name: 'notification_center', + publicDir: resolve(__dirname, 'public'), uiExports: { chromeNavControls: [
36612c54e1ff3e27928aa523818a82e321a8e42b
server.js
server.js
'use strict'; var express = require('express'); var routes = require('./app/routes/index.js'); var mongoose = require('mongoose'); var passport = require('passport'); var session = require('express-session'); var bodyParser = require('body-parser') var app = express(); require('dotenv').load(); require('./app/config/passport')(passport); mongoose.connect(process.env.MONGO_URI); mongoose.Promise = global.Promise; // Configure server to parse JSON for us app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use('/controllers', express.static(process.cwd() + '/app/controllers')); app.use('/public', express.static(process.cwd() + '/public')); app.use(session({ secret: 'secretJcsgithubNightlifeapp', resave: false, saveUninitialized: true })); app.use(passport.initialize()); app.use(passport.session()); routes(app, passport); var port = process.env.PORT || 8080; app.listen(port, function () { console.log('Node.js listening on port ' + port + '...'); });
'use strict'; var express = require('express'); var routes = require('./app/routes/index.js'); var mongoose = require('mongoose'); var passport = require('passport'); var session = require('express-session'); var bodyParser = require('body-parser') var app = express(); // require('dotenv').load(); require('./app/config/passport')(passport); mongoose.connect(process.env.MONGO_URI); mongoose.Promise = global.Promise; // Configure server to parse JSON for us app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use('/controllers', express.static(process.cwd() + '/app/controllers')); app.use('/public', express.static(process.cwd() + '/public')); app.use(session({ secret: 'secretJcsgithubNightlifeapp', resave: false, saveUninitialized: true })); app.use(passport.initialize()); app.use(passport.session()); routes(app, passport); var port = process.env.PORT || 8080; app.listen(port, function () { console.log('Node.js listening on port ' + port + '...'); });
Comment out dotenv for heroku deployment
Comment out dotenv for heroku deployment
JavaScript
mit
jcsgithub/jcsgithub-mangatradingapp,jcsgithub/jcsgithub-mangatradingapp
--- +++ @@ -8,7 +8,7 @@ var bodyParser = require('body-parser') var app = express(); -require('dotenv').load(); +// require('dotenv').load(); require('./app/config/passport')(passport); mongoose.connect(process.env.MONGO_URI);
ab73dbf435953e1b0b1b49501cd46e4a60caf0a1
index.js
index.js
#!/usr/bin/env node const yargs = require('yargs'); yargs .usage('$0 command') .command('all', 'run all bundled commands', yargs => { const operations = require('./src'); console.log("yargs" yargs) for (const key of Object.keys(operations)) { operations[key](); } }) .command('fix-libraries', 'add any missing build configurations to all xcode projects in node_modules', yargs => { require('./src/fix-libraries')(); }) .command('fix-script', 'replace the react native ios bundler with our scheme aware one', yargs => { require('./src/fix-script')(); }) .command('hide-library-schemes', `hide any schemes that come from your node modules directory so they don't clutter up the menu.`, yargs => { require('./src/hide-library-schemes')(); }) .command('verify-config', `check the configuration and ensure we have both a postinstall script and xcodeSchemes configurations.`, yargs => { require('./src/verify-config')(); }) .demand(1, 'must provide a valid command') .help('h') .alias('h', 'help') .argv;
#!/usr/bin/env node const yargs = require('yargs'); yargs .usage('$0 command') .command('all', 'run all bundled commands', yargs => { const operations = require('./src'); console.log("yargs", yargs) for (const key of Object.keys(operations)) { operations[key](); } }) .command('fix-libraries', 'add any missing build configurations to all xcode projects in node_modules', yargs => { require('./src/fix-libraries')(); }) .command('fix-script', 'replace the react native ios bundler with our scheme aware one', yargs => { require('./src/fix-script')(); }) .command('hide-library-schemes', `hide any schemes that come from your node modules directory so they don't clutter up the menu.`, yargs => { require('./src/hide-library-schemes')(); }) .command('verify-config', `check the configuration and ensure we have both a postinstall script and xcodeSchemes configurations.`, yargs => { require('./src/verify-config')(); }) .demand(1, 'must provide a valid command') .help('h') .alias('h', 'help') .argv;
Revert "Revert "debugging the ios directory issue""
Revert "Revert "debugging the ios directory issue"" This reverts commit 7842f28f4f2209b9a9ccaf8be1b00170109a2fec.
JavaScript
mit
Thinkmill/react-native-schemes-manager,Thinkmill/react-native-schemes-manager
--- +++ @@ -5,7 +5,7 @@ .usage('$0 command') .command('all', 'run all bundled commands', yargs => { const operations = require('./src'); - console.log("yargs" yargs) + console.log("yargs", yargs) for (const key of Object.keys(operations)) { operations[key]();
a68c652fd9b1d3f287f2885a6826751bbb02a4f4
server.js
server.js
var express = require('express'), app = express(); app.use( express.static( __dirname + '/public' ) ); var server = app.listen(3000, function() { console.log('Listening on port %d', server.address().port); });
var express = require('express'), app = express(); app.use( express.static( __dirname + '/public' ) ); var server = app.listen(3000, function() { console.log('Listening on port %d', server.address().port); require('opn')('http://localhost:3000'); });
Use opn to open demo site in a browser on start.
Use opn to open demo site in a browser on start.
JavaScript
mit
jonkemp/wizard-mvc
--- +++ @@ -5,4 +5,6 @@ var server = app.listen(3000, function() { console.log('Listening on port %d', server.address().port); + + require('opn')('http://localhost:3000'); });
d1ec63c6fb8258bc218ecebdc4e4159ed630663b
server.js
server.js
/* eslint-disable no-console */ /** * Setup and run the development server for Hot-Module-Replacement * https://webpack.github.io/docs/hot-module-replacement-with-webpack.html * @flow */ import express from 'express'; import webpack from 'webpack'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; import { spawn } from 'child_process'; import config from './webpack.config.development'; const app = express(); const compiler = webpack(config); const PORT = process.env.PORT || 3000; const wdm = webpackDevMiddleware(compiler, { publicPath: config.output.publicPath, stats: { colors: true } }); app.use(wdm); app.use(webpackHotMiddleware(compiler)); const server = app.listen(PORT, 'localhost', serverError => { if (serverError) { return console.error(serverError); } spawn('npm', ['run', 'start-hot'], { stdio: 'inherit' }) .on('close', code => process.exit(code)) .on('error', spawnError => console.error(spawnError)); console.log(`Listening at http://localhost:${PORT}`); }); process.on('SIGTERM', () => { console.log('Stopping dev server'); wdm.close(); server.close(() => { process.exit(0); }); });
/* eslint-disable no-console */ /** * Setup and run the development server for Hot-Module-Replacement * https://webpack.github.io/docs/hot-module-replacement-with-webpack.html * @flow */ import express from 'express'; import webpack from 'webpack'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; import { spawn } from 'child_process'; import config from './webpack.config.development'; const argv = require('minimist')(process.argv.slice(2)); const app = express(); const compiler = webpack(config); const PORT = process.env.PORT || 3000; const wdm = webpackDevMiddleware(compiler, { publicPath: config.output.publicPath, stats: { colors: true } }); app.use(wdm); app.use(webpackHotMiddleware(compiler)); const server = app.listen(PORT, 'localhost', serverError => { if (serverError) { return console.error(serverError); } if (argv['start-hot']) { spawn('npm', ['run', 'start-hot'], { env: process.env, stdio: 'inherit' }) .on('close', code => process.exit(code)) .on('error', spawnError => console.error(spawnError)); } console.log(`Listening at http://localhost:${PORT}`); }); process.on('SIGTERM', () => { console.log('Stopping dev server'); wdm.close(); server.close(() => { process.exit(0); }); });
Add flag option `start-hot` and apply env
Add flag option `start-hot` and apply env * Add flag option `start-hot` to server.js * Apply env to `start-hot` mode of server.js
JavaScript
mit
ThomasBaldry/mould-maker-desktop,irwinb/table-viewer,stefanKuijers/aw-fullstack-app,TheCbac/MICA-Desktop,nantaphop/redd,Andrew-Hird/bFM-desktop,Byte-Code/lm-digitalstore,ivtpz/brancher,runandrew/memoriae,carly-lee/electron-sleep-timer,kivo360/ECC-GUI,kaunio/gloso,kme211/srt-maker,chentsulin/electron-react-boilerplate,bird-system/bs-label-convertor,baublet/lagniappe,barbalex/kapla3,anthonyraymond/joal-desktop,thirdicrypto/darkwallet-electron-ui,JoaoCnh/picto-pc,ACalix/sprinthub,kme211/srt-maker,cosio55/app-informacion-bitso,ycai2/visual-git-stats,zackhall/ack-chat,lhache/katalogz,espenbjorkeng/Rabagast,waha3/Electron-NeteaseCloudMusic,ACalix/sprinthub,waha3/Electron-NeteaseCloudMusic,sdlfj/eq-roll-tracker,anthonyraymond/joal-desktop,baublet/lagniappe,anthonyraymond/joal-desktop,foysalit/wallly-electron,alecholmez/crew-electron,jaytrepka/kryci-jmena,kimurakenshi/caravanas,zackhall/ack-chat,espenbjorkeng/Rabagast,riccardopiola/LeagueFlash,kivo360/ECC-GUI,carly-lee/electron-sleep-timer,tw00089923/kcr_bom,kaunio/gloso,foysalit/wallly-electron,Byte-Code/lm-digital-store-private-test,Byte-Code/lm-digital-store-private-test,Byte-Code/lm-digitalstore,Sebkasanzew/Electroweb,riccardopiola/LeagueFlash,barbalex/kapla3,tw00089923/kcr_bom,surrealroad/electron-react-boilerplate,bird-system/bs-label-convertor,jhen0409/electron-react-boilerplate,joshuef/peruse,alecholmez/crew-electron,sdlfj/eq-roll-tracker,Andrew-Hird/bFM-desktop,Sebkasanzew/Electroweb,nantaphop/redd,ivtpz/brancher,jaytrepka/kryci-jmena,lhache/katalogz,kimurakenshi/caravanas,joshuef/peruse,JoaoCnh/picto-pc,ycai2/visual-git-stats,TheCbac/MICA-Desktop,stefanKuijers/aw-fullstack-app,chentsulin/electron-react-boilerplate,surrealroad/electron-react-boilerplate,ThomasBaldry/mould-maker-desktop,irwinb/table-viewer,runandrew/memoriae,cosio55/app-informacion-bitso,jhen0409/electron-react-boilerplate,surrealroad/electron-react-boilerplate,thirdicrypto/darkwallet-electron-ui
--- +++ @@ -12,6 +12,8 @@ import { spawn } from 'child_process'; import config from './webpack.config.development'; + +const argv = require('minimist')(process.argv.slice(2)); const app = express(); const compiler = webpack(config); @@ -33,9 +35,11 @@ return console.error(serverError); } - spawn('npm', ['run', 'start-hot'], { stdio: 'inherit' }) - .on('close', code => process.exit(code)) - .on('error', spawnError => console.error(spawnError)); + if (argv['start-hot']) { + spawn('npm', ['run', 'start-hot'], { env: process.env, stdio: 'inherit' }) + .on('close', code => process.exit(code)) + .on('error', spawnError => console.error(spawnError)); + } console.log(`Listening at http://localhost:${PORT}`); });
3abbaf59ea7786d4b9df82dcb08b20df35952cbe
index.js
index.js
const path = require('path'); const express = require('express'); const logger = require('winston'); const passport = require('passport'); const bodyParser = require('body-parser'); const bearerAuth = require('./auth/bearer'); const httpHelper = require('sharemyscreen-http-helper'); const user = require('./route/user'); const organization = require('./route/organization/index'); var apiApp = null; var apiRouter = null; function getApp () { logger.info('Initializing api app ...'); apiApp = express(); apiApp.use(bodyParser.json()); apiApp.use(passport.initialize()); apiRouter = express.Router(); bearerAuth.init(); apiRouter.use(passport.authenticate('bearer', { session: false })); // Register all routes user.registerRoute(apiRouter); organization.registerRoute(apiRouter); apiApp.use('/v1', apiRouter); apiApp.use('/doc', express.static(path.join(__dirname, '/doc'), {dotfiles: 'allow'})); // Error handler apiApp.use(function (err, req, res, next) { logger.error(err); httpHelper.sendReply(res, httpHelper.error.internalServerError(err)); }); logger.info('Api app initialized'); return apiApp; } module.exports.getApp = getApp;
const path = require('path'); const express = require('express'); const logger = require('winston'); const passport = require('passport'); const bodyParser = require('body-parser'); const bearerAuth = require('./auth/bearer'); const httpHelper = require('sharemyscreen-http-helper'); const user = require('./route/user'); const organization = require('./route/organization/index'); var apiApp = null; var apiRouter = null; function getApp () { logger.info('Initializing api app ...'); apiApp = express(); apiApp.use(bodyParser.json()); apiApp.use(passport.initialize()); apiRouter = express.Router(); bearerAuth.init(); apiRouter.use(passport.authenticate('bearer', { session: false })); apiApp.use(function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Headers', 'X-Requested-With,Content-Type'); next(); }); // Register all routes user.registerRoute(apiRouter); organization.registerRoute(apiRouter); apiApp.use('/v1', apiRouter); apiApp.use('/doc', express.static(path.join(__dirname, '/doc'), {dotfiles: 'allow'})); // Error handler apiApp.use(function (err, req, res, next) { logger.error(err); httpHelper.sendReply(res, httpHelper.error.internalServerError(err)); }); logger.info('Api app initialized'); return apiApp; } module.exports.getApp = getApp;
Allow CROS (via adding headers)
Allow CROS (via adding headers)
JavaScript
mit
sharemyscreen/api-service
--- +++ @@ -23,6 +23,12 @@ bearerAuth.init(); apiRouter.use(passport.authenticate('bearer', { session: false })); + apiApp.use(function (req, res, next) { + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Headers', 'X-Requested-With,Content-Type'); + next(); + }); + // Register all routes user.registerRoute(apiRouter); organization.registerRoute(apiRouter);
e8ca8f23f9b3d907e73be4f0ca67a80c833947f8
index.js
index.js
var fields = ['skin', 'location', 'ink', 'layering', 'scarring', 'colors']; var form; $(function() { form = document.forms[0]; $('input').change(onChange); }); function onChange(e) { var scale = {}; var field_count = 0; for (var i = 0; i < fields.length; ++i) { var field = fields[i]; if (form[field].value) { scale[field] = form[field].value; ++field_count; } } var total_points = 0; for (var field in scale) { $('.' + field + '-points').text(scale[field]); total_points += parseInt(scale[field]); } if (field_count == fields.length) { $('.total-points').text(total_points); } }
var fields = ['skin', 'location', 'ink', 'layering', 'scarring', 'colors']; var form; $(function() { form = document.forms[0]; $('input').change(onChange); onChange(); }); function onChange() { var scale = {}; var field_count = 0; for (var i = 0; i < fields.length; ++i) { var field = fields[i]; if (form[field].value) { scale[field] = form[field].value; ++field_count; } } var total_points = 0; for (var field in scale) { $('.' + field + '-points').text(scale[field]); total_points += parseInt(scale[field]); } if (field_count == fields.length) { $('.total-points').text(total_points); } }
Fix an issue where the scores would not show if a user left the page, then returned using the browser's back/forward buttons (since the form values would be saved, but the DOM not updated by our logic).
Fix an issue where the scores would not show if a user left the page, then returned using the browser's back/forward buttons (since the form values would be saved, but the DOM not updated by our logic).
JavaScript
mit
0x24a537r9/kirbydesai,0x24a537r9/kirbydesai
--- +++ @@ -5,10 +5,11 @@ form = document.forms[0]; $('input').change(onChange); + onChange(); }); -function onChange(e) { +function onChange() { var scale = {}; var field_count = 0; for (var i = 0; i < fields.length; ++i) {
7c51d2fd014fc8fcc6f1a36859d9f43b8cb7238b
index.js
index.js
/* jshint node: true */ 'use strict'; module.exports = { name: 'ember-plupload', included: function (app) { this._super.included(app); if (process.env.EMBER_ENV === 'development') { app.import('bower_components/plupload/js/moxie.js'); app.import('bower_components/plupload/js/plupload.dev.js'); } else { app.import('bower_components/plupload/js/plupload.full.min.js'); } app.import('bower_components/plupload/js/Moxie.swf', { destDir: 'assets' }); app.import('bower_components/plupload/js/Moxie.xap', { destDir: 'assets' }); app.import('bower_components/dinosheets/dist/dinosheets.amd.js', { exports: { 'dinosheets': ['default'] } }); app.import('vendor/styles/ember-plupload.css'); } };
/* jshint node: true */ 'use strict'; module.exports = { name: 'ember-plupload', included: function (app) { this._super.included(app); if (process.env.EMBER_ENV === 'development') { app.import('bower_components/plupload/js/moxie.js'); app.import('bower_components/plupload/js/plupload.dev.js'); } else { app.import('bower_components/plupload/js/plupload.dev.js'); } app.import('bower_components/plupload/js/Moxie.swf', { destDir: 'assets' }); app.import('bower_components/plupload/js/Moxie.xap', { destDir: 'assets' }); app.import('bower_components/dinosheets/dist/dinosheets.amd.js', { exports: { 'dinosheets': ['default'] } }); app.import('vendor/styles/ember-plupload.css'); } };
Use plupload.dev.js instead of full, as it contains fixes for PUT option.
Use plupload.dev.js instead of full, as it contains fixes for PUT option.
JavaScript
mit
musicdealers/ember-plupload,musicdealers/ember-plupload
--- +++ @@ -10,7 +10,7 @@ app.import('bower_components/plupload/js/moxie.js'); app.import('bower_components/plupload/js/plupload.dev.js'); } else { - app.import('bower_components/plupload/js/plupload.full.min.js'); + app.import('bower_components/plupload/js/plupload.dev.js'); } app.import('bower_components/plupload/js/Moxie.swf', { destDir: 'assets'
dbb5f2329fb98e62ce5adf992585e04a39e47f2a
packages/shared/lib/user/helpers.js
packages/shared/lib/user/helpers.js
import { USER_ROLES } from '../constants'; const { ADMIN_ROLE, MEMBER_ROLE } = USER_ROLES; export const hasPaidMail = ({ Subscribed }) => Subscribed & 1; export const hasPaidVpn = ({ Subscribed }) => Subscribed & 4; export const isPaid = ({ Subscribed }) => Subscribed; export const isFree = (user) => !isPaid(user); export const isAdmin = ({ Role }) => Role === ADMIN_ROLE; export const isMember = ({ Role }) => Role === MEMBER_ROLE; export const isSubUser = ({ OrganizationPrivateKey }) => typeof OrganizationPrivateKey !== 'undefined'; export const isDelinquent = ({ Delinquent }) => Delinquent; export const getInfo = (User) => { return { isAdmin: isAdmin(User), isMember: isMember(User), isFree: isFree(User), isPaid: isPaid(User), isSubUser: isSubUser(User), isDelinquent: isDelinquent(User), hasPaidMail: hasPaidMail(User), hasPaidVpn: hasPaidVpn(User) }; };
import { USER_ROLES } from '../constants'; const { ADMIN_ROLE, MEMBER_ROLE } = USER_ROLES; export const hasPaidMail = ({ Subscribed }) => Subscribed & 1; export const hasPaidVpn = ({ Subscribed }) => Subscribed & 4; export const isPaid = ({ Subscribed }) => Subscribed; export const isPrivate = ({ Private }) => Private === 1; export const isFree = (user) => !isPaid(user); export const isAdmin = ({ Role }) => Role === ADMIN_ROLE; export const isMember = ({ Role }) => Role === MEMBER_ROLE; export const isSubUser = ({ OrganizationPrivateKey }) => typeof OrganizationPrivateKey !== 'undefined'; export const isDelinquent = ({ Delinquent }) => Delinquent; export const getInfo = (User) => { return { isAdmin: isAdmin(User), isMember: isMember(User), isFree: isFree(User), isPaid: isPaid(User), isPrivate: isPrivate(User), isSubUser: isSubUser(User), isDelinquent: isDelinquent(User), hasPaidMail: hasPaidMail(User), hasPaidVpn: hasPaidVpn(User) }; };
Add isPrivate flag to user
Add isPrivate flag to user
JavaScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -5,6 +5,7 @@ export const hasPaidMail = ({ Subscribed }) => Subscribed & 1; export const hasPaidVpn = ({ Subscribed }) => Subscribed & 4; export const isPaid = ({ Subscribed }) => Subscribed; +export const isPrivate = ({ Private }) => Private === 1; export const isFree = (user) => !isPaid(user); export const isAdmin = ({ Role }) => Role === ADMIN_ROLE; export const isMember = ({ Role }) => Role === MEMBER_ROLE; @@ -17,6 +18,7 @@ isMember: isMember(User), isFree: isFree(User), isPaid: isPaid(User), + isPrivate: isPrivate(User), isSubUser: isSubUser(User), isDelinquent: isDelinquent(User), hasPaidMail: hasPaidMail(User),
aef6e84abcfb237cedb9d92b05b0b8e28d316462
bin/collider.js
bin/collider.js
#!/usr/bin/env node 'use strict'; var pkg = require('../package.json') var cli = require('yargs'); var updateNotifier = require('update-notifier'); updateNotifier({ pkg }).notify(); cli .strict() .version() .usage('collider [--version] [--help] <command> [<args>]') .command('run', 'Run an existing project in the current directory', require('../lib/commands/run')) .command('new <name>', 'Create a new project in the current directory', require('../lib/commands/new')) .help() .argv; var commands = cli.argv._; // If no commands are given, then show help. if(commands.length === 0) { cli.showHelp(); }
#!/usr/bin/env node 'use strict'; var pkg = require('../package.json') var yargs = require('yargs'); var updateNotifier = require('update-notifier'); updateNotifier({ pkg }).notify(); yargs .strict() .version() .usage('collider [--version] [--help] <command> [<args>]') .command('run', 'Run an existing project in the current directory', require('../lib/commands/run')) .command('new <name>', 'Create a new project in the current directory', require('../lib/commands/new')) .help() .argv; var commands = cli.argv._; // If no commands are given, then show help. if(commands.length === 0) { cli.showHelp(); }
Rename cli var to yargs
Rename cli var to yargs
JavaScript
mit
simonsinclair/collider-cli
--- +++ @@ -3,12 +3,12 @@ 'use strict'; var pkg = require('../package.json') -var cli = require('yargs'); +var yargs = require('yargs'); var updateNotifier = require('update-notifier'); updateNotifier({ pkg }).notify(); -cli +yargs .strict() .version() .usage('collider [--version] [--help] <command> [<args>]')
5f1c78aef2eae992e614584f6ca955f22b39e3b4
copyVersionToIndex.js
copyVersionToIndex.js
"use strict"; exports.__esModule = true; var fs = require("fs"); // read in the /index.ts // use regex to find a console log for printing the version and update it for the new version // update /index.ts with the new content console.log("update src/index.ts with version:", process.env.npm_package_version); fs.readFile("./index.ts", 'utf8', function(err, data) { if (err) throw err; var re = /(.*[a-zA-Z]\s\-\s)(.*)(\"\)\;.*)/; //console.log("before", data) data = data.replace(re, "$1"+process.env.npm_package_version+"$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version); //console.log("after", data) fs.writeFile("./index.ts", data, function(err) { if (err) throw err; console.log("Updated ./index.ts with inserted version ", process.env.npm_package_version); }); });
'use strict'; exports.__esModule = true; const fs = require('fs'); // read in the /index.ts // use regex to find a console log for printing the version and update it for the new version // update /index.ts with the new content console.log('update src/index.ts with version:', process.env.npm_package_version); fs.readFile('./index.ts', 'utf8', function(err, data) { if (err) throw err; const re = /(.*[a-zA-Z]\s-\s)(.*)(["|']\);.*)/; //console.log("before", data) //#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version); data = data.replace(re, '$1' + process.env.npm_package_version + '$3'); //console.log("after", data) fs.writeFile('./index.ts', data, function(err) { if (err) throw err; console.log('Updated ./index.ts with inserted version ', process.env.npm_package_version); }); });
Copy version after lint, support `'`
fix: Copy version after lint, support `'`
JavaScript
apache-2.0
awayjs/core,awayjs/core,awayjs/core,awayjs/core,awayjs/core
--- +++ @@ -1,7 +1,6 @@ -"use strict"; +'use strict'; exports.__esModule = true; -var fs = require("fs"); - +const fs = require('fs'); // read in the /index.ts @@ -9,16 +8,17 @@ // update /index.ts with the new content -console.log("update src/index.ts with version:", process.env.npm_package_version); +console.log('update src/index.ts with version:', process.env.npm_package_version); -fs.readFile("./index.ts", 'utf8', function(err, data) { - if (err) throw err; - var re = /(.*[a-zA-Z]\s\-\s)(.*)(\"\)\;.*)/; - //console.log("before", data) - data = data.replace(re, "$1"+process.env.npm_package_version+"$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version); - //console.log("after", data) - fs.writeFile("./index.ts", data, function(err) { - if (err) throw err; - console.log("Updated ./index.ts with inserted version ", process.env.npm_package_version); - }); -}); +fs.readFile('./index.ts', 'utf8', function(err, data) { + if (err) throw err; + const re = /(.*[a-zA-Z]\s-\s)(.*)(["|']\);.*)/; + //console.log("before", data) + //#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version); + data = data.replace(re, '$1' + process.env.npm_package_version + '$3'); + //console.log("after", data) + fs.writeFile('./index.ts', data, function(err) { + if (err) throw err; + console.log('Updated ./index.ts with inserted version ', process.env.npm_package_version); + }); +});
cca3e5f727b8f5beb25d6c54e1787be9efe60fae
test/specs/linter.js
test/specs/linter.js
var assert = require('assert'); describe('linter', function () { var linter = require('../../lib/linter'); describe('lint', function () { it('should return array of errors', function () { var source = '.foo{ color:red; }'; var path = 'test.less'; var actual; var config = { spaceAfterPropertyColon: { enabled: true, style: 'one_space' }, spaceBeforeBrace: { enabled: true, style: 'one_space' } }; actual = linter.lint(source, path, config); assert.equal(2, actual.length); }); }); describe('parseAST', function () { it('should return an AST', function () { var source = '.foo { color: red; }'; var ast = linter.parseAST(source); assert.ok(ast.toCSS); // If the returned object has the 'toCSS' method, we'll consider it a success }); }); });
var assert = require('assert'); describe('linter', function () { var linter = require('../../lib/linter'); describe('lint', function () { it('should return array of errors', function () { var source = '.foo{ color:red; }'; var path = 'test.less'; var actual; var config = { spaceAfterPropertyColon: { enabled: true, style: 'one_space' }, spaceBeforeBrace: { enabled: true, style: 'one_space' } }; actual = linter.lint(source, path, config); assert.ok(actual.length === 2); }); }); describe('parseAST', function () { it('should return an AST', function () { var source = '.foo { color: red; }'; var ast = linter.parseAST(source); assert.ok(ast.toCSS); // If the returned object has the 'toCSS' method, we'll consider it a success }); }); });
Use assert.ok() instead of assert.equals()
Use assert.ok() instead of assert.equals()
JavaScript
mit
JoshuaKGoldberg/lesshint,gilt/lesshint,runarberg/lesshint,lesshint/lesshint
--- +++ @@ -22,7 +22,7 @@ actual = linter.lint(source, path, config); - assert.equal(2, actual.length); + assert.ok(actual.length === 2); }); });
429c823a60cbcf5c60f980922e253364ceaeb3a2
src/pages/qr.js
src/pages/qr.js
import React from 'react' import PropTypes from 'prop-types' import { compose, withProps } from 'recompose' import QRCode from 'qrcode.react' import { withRouter } from 'next/router' import { StaticLayout } from '../components/layouts' import { withLogging } from '../lib' const propTypes = { shortname: PropTypes.string.isRequired, } const QR = ({ shortname }) => { const joinLink = process.env.APP_JOIN_URL ? `${process.env.APP_JOIN_URL}/${shortname}` : `${process.env.APP_BASE_URL}/join/${shortname}` return ( <StaticLayout pageTitle="QR"> <div className="link">{joinLink.replace(/^https?:\/\//, '')}</div> <div className="qr"> <QRCode size={700} value={joinLink} /> </div> <style jsx>{` @import 'src/theme'; .link { line-height: 4rem; font-size: ${process.env.APP_JOIN_URL ? '5rem' : '4rem'}; font-weight: bold; margin-bottom: 2rem; } .qr { display: flex; align-items: center; justify-content: center; } `}</style> </StaticLayout> ) } QR.propTypes = propTypes export default compose( withRouter, withLogging(), withProps(({ router }) => ({ shortname: router.query.shortname, })) )(QR)
import React from 'react' import PropTypes from 'prop-types' import { compose, withProps } from 'recompose' import QRCode from 'qrcode.react' import { withRouter } from 'next/router' import { StaticLayout } from '../components/layouts' import { withLogging } from '../lib' const propTypes = { shortname: PropTypes.string.isRequired, } const QR = ({ shortname }) => { const joinLink = process.env.APP_JOIN_URL ? `${process.env.APP_JOIN_URL}/${shortname}` : `${process.env.APP_BASE_URL}/join/${shortname}` return ( <StaticLayout pageTitle="QR"> <div className="link">{joinLink.replace(/^https?:\/\//, '')}</div> <div className="qr"> <QRCode size={700} value={`${process.env.APP_BASE_URL}/join/${shortname}`} /> </div> <style jsx>{` @import 'src/theme'; .link { line-height: 4rem; font-size: ${process.env.APP_JOIN_URL ? '5rem' : '4rem'}; font-weight: bold; margin-bottom: 2rem; } .qr { display: flex; align-items: center; justify-content: center; } `}</style> </StaticLayout> ) } QR.propTypes = propTypes export default compose( withRouter, withLogging(), withProps(({ router }) => ({ shortname: router.query.shortname, })) )(QR)
Change embedded join link to direct klicker.uzh.ch domain
Change embedded join link to direct klicker.uzh.ch domain
JavaScript
agpl-3.0
uzh-bf/klicker-react,uzh-bf/klicker-react
--- +++ @@ -20,7 +20,7 @@ <StaticLayout pageTitle="QR"> <div className="link">{joinLink.replace(/^https?:\/\//, '')}</div> <div className="qr"> - <QRCode size={700} value={joinLink} /> + <QRCode size={700} value={`${process.env.APP_BASE_URL}/join/${shortname}`} /> </div> <style jsx>{`
d6095c1e7ee53f957652fea0cdf680f5a13f7880
testem.js
testem.js
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], browser_args: { Chrome: { mode: 'ci', args: [ '--disable-gpu', '--headless', '--remote-debugging-port=9222', '--window-size=1440,900' ] }, } };
/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], browser_args: { Chrome: { mode: 'ci', args: [ process.env.TRAVIS ? '--no-sandbox' : null, '--disable-gpu', '--headless', '--remote-debugging-port=9222', '--window-size=1440,900' ].filter(Boolean) }, } };
Disable chrome sandboxing on travis
Disable chrome sandboxing on travis
JavaScript
mit
topaxi/ember-bootstrap-datepicker,topaxi/ember-bootstrap-datepicker
--- +++ @@ -12,11 +12,13 @@ Chrome: { mode: 'ci', args: [ + process.env.TRAVIS ? '--no-sandbox' : null, + '--disable-gpu', '--headless', '--remote-debugging-port=9222', '--window-size=1440,900' - ] + ].filter(Boolean) }, } };
08876f416ca45d2bb08db91068b6a2fde3d1c198
testem.js
testem.js
module.exports = { framework: 'mocha', 'test_page': 'tests/index.html?hidepassed&coverage', 'disable_watching': true, 'launch_in_ci': [ 'Chrome' ], 'launch_in_dev': [ 'Chrome' ] }
var Reporter = require('ember-test-utils/reporter') module.exports = { disable_watching: true, framework: 'mocha', launch_in_ci: [ 'Chrome' ], launch_in_dev: [ 'Chrome' ], reporter: new Reporter(), test_page: 'tests/index.html?hidepassed' }
Remove Firefox from CI as it is problematic
Remove Firefox from CI as it is problematic
JavaScript
mit
rox163/ember-frost-core,dafortin/ember-frost-core,dafortin/ember-frost-core,helrac/ember-frost-core,EWhite613/ember-frost-core,helrac/ember-frost-core,ciena-frost/ember-frost-core,dafortin/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core,rox163/ember-frost-core,EWhite613/ember-frost-core,ciena-frost/ember-frost-core,EWhite613/ember-frost-core
--- +++ @@ -1,11 +1,14 @@ +var Reporter = require('ember-test-utils/reporter') + module.exports = { + disable_watching: true, framework: 'mocha', - 'test_page': 'tests/index.html?hidepassed&coverage', - 'disable_watching': true, - 'launch_in_ci': [ + launch_in_ci: [ 'Chrome' ], - 'launch_in_dev': [ + launch_in_dev: [ 'Chrome' - ] + ], + reporter: new Reporter(), + test_page: 'tests/index.html?hidepassed' }
dc939b494bb414c9d63b20b9388fd614b47bc102
app/assets/javascripts/users.js
app/assets/javascripts/users.js
$( document ).ready(function(){ $('#add_to_calendar').click(function(e){ e.preventDefault(); var $form = $(this).closest('form'); $.ajax({ url: '/emails', type: 'POST', data: $form.serialize(), dataType: 'script', success: function(){console.log('Email sent!');}, failure: function(){alert('Email could not be sent!');} }); }); });
$( document ).ready(function(){ $('#add_to_calendar').click(function(e){ e.preventDefault(); var $form = $(this).closest('form'); $.ajax({ url: '/emails', type: 'POST', data: $form.serialize(), dataType: 'script', success: function(){ $form.find('input[id="email_email_address"]').val(""); console.log('Email sent!'); }, failure: function(){alert('Email could not be sent!');} }); }); });
Clear email address field after email is sent
Clear email address field after email is sent
JavaScript
mit
ruby005-reed-sufrin-tang/concertify-me,ruby005-reed-sufrin-tang/concertify-me
--- +++ @@ -7,7 +7,10 @@ type: 'POST', data: $form.serialize(), dataType: 'script', - success: function(){console.log('Email sent!');}, + success: function(){ + $form.find('input[id="email_email_address"]').val(""); + console.log('Email sent!'); + }, failure: function(){alert('Email could not be sent!');} }); });
ead2ddad26b912f4f011922b392b359a8d0cadda
src/plugins/local/components/TableBodyContainer.js
src/plugins/local/components/TableBodyContainer.js
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { getContext, mapProps, compose } from 'recompose'; import { visibleRowIdsSelector, classNamesForComponentSelector, stylesForComponentSelector } from '../selectors/localSelectors'; const ComposedTableBodyContainer = OriginalComponent => compose( getContext({ components: PropTypes.object, selectors: PropTypes.object, }), connect(state => ({ visibleRowIds: visibleRowIdsSelector(state), className: classNamesForComponentSelector(state, 'TableBody'), style: stylesForComponentSelector(state, 'TableBody'), })), mapProps(props => ({ Row: props.components.Row, ...props })), // withHandlers({ // Row: props => props.components.Row // }) )(({ Row, visibleRowIds, style, className }) => ( <OriginalComponent rowIds={visibleRowIds} Row={Row} style={style} className={className} /> )); export default ComposedTableBodyContainer;
import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { getContext, mapProps, compose } from 'recompose'; import { visibleRowIdsSelector, classNamesForComponentSelector, stylesForComponentSelector } from '../selectors/localSelectors'; const ComposedTableBodyContainer = OriginalComponent => compose( getContext({ components: PropTypes.object, selectors: PropTypes.object, }), mapProps(props => ({ Row: props.components.Row, visibleRowIdsSelector: props.selectors.visibleRowIdsSelector, ...props })), connect((state, props) => ({ visibleRowIds: props.visibleRowIdsSelector(state), className: classNamesForComponentSelector(state, 'TableBody'), style: stylesForComponentSelector(state, 'TableBody'), })), // withHandlers({ // Row: props => props.components.Row // }) )(({ Row, visibleRowIds, style, className }) => ( <OriginalComponent rowIds={visibleRowIds} Row={Row} style={style} className={className} /> )); export default ComposedTableBodyContainer;
Fix virtual scrolling for table with local data.
Fix virtual scrolling for table with local data.
JavaScript
mit
ttrentham/Griddle,GriddleGriddle/Griddle,joellanciaux/Griddle,GriddleGriddle/Griddle,joellanciaux/Griddle
--- +++ @@ -9,14 +9,15 @@ components: PropTypes.object, selectors: PropTypes.object, }), - connect(state => ({ - visibleRowIds: visibleRowIdsSelector(state), + mapProps(props => ({ + Row: props.components.Row, + visibleRowIdsSelector: props.selectors.visibleRowIdsSelector, + ...props + })), + connect((state, props) => ({ + visibleRowIds: props.visibleRowIdsSelector(state), className: classNamesForComponentSelector(state, 'TableBody'), style: stylesForComponentSelector(state, 'TableBody'), - })), - mapProps(props => ({ - Row: props.components.Row, - ...props })), // withHandlers({ // Row: props => props.components.Row
64c0803d06ba64dc822ab06f3da88fa9413a5384
lib/plugins/front-matter.js
lib/plugins/front-matter.js
'use strict'; const through = require('through2'); const gutil = require('gulp-util'); const fm = require('front-matter') const PluginError = gutil.PluginError; const PLUGIN_NAME = 'front-matter'; module.exports = () => { return through.obj(function(file, encoding, cb) { ///////////////////////////// // Errors if (file.isNull()) { return cb(); } if (file.isStream()) { this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!')); return cb(); } ///////////////////////////// // Manipulate let content = fm(file.contents.toString()); if (!file.meta) { file.meta = content.attributes; } else { file.meta = {}; } file.meta.today = Date.now(); file.contents = new Buffer(content.body); this.push(file); cb(); }); }
'use strict'; const through = require('through2'); const gutil = require('gulp-util'); const fm = require('front-matter') const PluginError = gutil.PluginError; const PLUGIN_NAME = 'front-matter'; module.exports = () => { return through.obj(function(file, encoding, cb) { ///////////////////////////// // Errors if (file.isNull()) { return cb(); } if (file.isStream()) { this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!')); return cb(); } ///////////////////////////// // Manipulate let content = fm(file.contents.toString()); file.meta = content.attributes; file.meta.today = Date.now(); file.contents = new Buffer(content.body); this.push(file); cb(); }); }
Clean up front matter plugin logic
:art: Clean up front matter plugin logic
JavaScript
mit
kellychurchill/gulp-armadillo,Snugug/gulp-armadillo
--- +++ @@ -23,13 +23,7 @@ // Manipulate let content = fm(file.contents.toString()); - if (!file.meta) { - file.meta = content.attributes; - } - else { - file.meta = {}; - } - + file.meta = content.attributes; file.meta.today = Date.now(); file.contents = new Buffer(content.body);
0687ad2cd63250e2077940a3c7499d62f78fea58
lib/iruby/static/custom/custom.js
lib/iruby/static/custom/custom.js
$([IPython.events]).on('notebook_loaded.Notebook', function(){ // add here logic that should be run once per **notebook load** IPython.notebook.metadata.language = 'ruby' ; }); $([IPython.events]).on('app_initialized.NotebookApp', function(){ // add here logic that shoudl be run once per **page load** $.getScript('/static/components/codemirror/mode/ruby/ruby.js'); IPython.CodeCell.options_default['cm_config']['mode'] = 'ruby'; IPython.CodeCell.options_default['cm_config']['indentUnit'] = 2; });
$([IPython.events]).on('notebook_loaded.Notebook', function(){ // add here logic that should be run once per **notebook load** IPython.notebook.metadata.language = 'ruby' ; }); $([IPython.events]).on('app_initialized.NotebookApp', function(){ // add here logic that shoudl be run once per **page load** CodeMirror.requireMode('ruby', function(){ console.log('Ruby mode should now be availlable in codemirror.'); }) IPython.CodeCell.options_default['cm_config']['mode'] = 'ruby'; IPython.CodeCell.options_default['cm_config']['indentUnit'] = 2; });
Use CodeMirror RequireMode instead of getScript.
Use CodeMirror RequireMode instead of getScript. 1) this will not get the mode if already on the page 2) this will work when IPython is run with a prefix.
JavaScript
mit
domitry/iruby,SciRuby/iruby,domitry/iruby,SciRuby/iruby,SciRuby/iruby,zalt50/iruby,mijoharas/iruby,zalt50/iruby,Rambatino/pi-ruby,mijoharas/iruby,Rambatino/pi-ruby,jjn2009/iruby,zalt50/iruby,hainesr/iruby,zalt50/iruby,SciRuby/iruby,astroboxio/iruby,astroboxio/iruby,hainesr/iruby,jjn2009/iruby
--- +++ @@ -5,7 +5,9 @@ $([IPython.events]).on('app_initialized.NotebookApp', function(){ // add here logic that shoudl be run once per **page load** - $.getScript('/static/components/codemirror/mode/ruby/ruby.js'); + CodeMirror.requireMode('ruby', function(){ + console.log('Ruby mode should now be availlable in codemirror.'); + }) IPython.CodeCell.options_default['cm_config']['mode'] = 'ruby'; IPython.CodeCell.options_default['cm_config']['indentUnit'] = 2; });
3104476b61b126b4203f9cf7e68c61caefa95052
test/controllers/menuCtrlTest.js
test/controllers/menuCtrlTest.js
describe('menuCtrl tests', function() { describe('instantiation and scope tests', function() { var $httpBackend, $rootScope, createController; beforeEach(function() { module('starter'); module('starter.controllers'); module('starter.services'); }); beforeEach(inject(function($injector) { var $controller = $injector.get('$controller'); $rootScope = $injector.get('$rootScope'); createController = function() { return $controller('menuCtrl', {'$scope': $rootScope}); }; })); it('should be defined and initialized', (function() { var controller = createController(); expect(controller).toBeDefined(); expect($rootScope).toBeDefined(); })); it('should know if has been canceled Redirect',(function() { var controller = createController(); expect(controller).toBeDefined(); expect($rootScope).toBeDefined(); expect($rootScope.cancelRedirect).toBeDefined(); spyOn($rootScope,'cancelRedirect'); $rootScope.cancelRedirect(); expect($rootScope.cancelRedirect).toHaveBeenCalled(); })); it('should close app',(function() { var controller = createController(); expect(controller).toBeDefined(); expect($rootScope).toBeDefined(); expect($rootScope.closeApp).toBeDefined(); spyOn($rootScope,'closeApp'); $rootScope.closeApp(); expect($rootScope.closeApp).toHaveBeenCalled( ); expect($rootScope.closeApp).toHaveBeenCalledWith( ); spyOn(ionic.Platform,'exitApp'); ionic.Platform.exitApp(); expect(ionic.Platform.exitApp).toHaveBeenCalled(); expect(ionic.Platform.exitApp).toHaveBeenCalledWith(); })); }); });
describe('menuCtrl tests', function() { describe('instantiation and scope tests', function() { var $httpBackend, $rootScope, createController; beforeEach(function() { module('starter'); module('starter.controllers'); module('starter.services'); }); beforeEach(inject(function($injector) { var $controller = $injector.get('$controller'); $rootScope = $injector.get('$rootScope'); createController = function() { return $controller('menuCtrl', {'$scope': $rootScope}); }; })); it('should be defined and initialized', (function() { var controller = createController(); expect(controller).toBeDefined(); expect($rootScope).toBeDefined(); })); it('should know if has been canceled Redirect', inject(function($state) { spyOn($state, 'go'); var controller = createController(); $rootScope.cancelRedirect(); expect($state.go).toHaveBeenCalledWith('menu.home'); })); it('should close app', inject(function($state) { spyOn($state, 'go'); var controller = createController(); $rootScope.closeApp(); expect($state.go).not.toHaveBeenCalledWith('menu.home'); })); }); });
Fix test for cancel redirect and close app
Fix test for cancel redirect and close app
JavaScript
mit
mdsgpp2016/frontend,mdsgpp2016/frontend,mdsgpp2016/frontend,mdsgpp2016/frontend,mdsgpp2016/frontend,mdsgpp2016/frontend,mdsgpp2016/frontend
--- +++ @@ -25,39 +25,19 @@ - it('should know if has been canceled Redirect',(function() { + it('should know if has been canceled Redirect', inject(function($state) { + spyOn($state, 'go'); var controller = createController(); - - expect(controller).toBeDefined(); - expect($rootScope).toBeDefined(); - expect($rootScope.cancelRedirect).toBeDefined(); - - spyOn($rootScope,'cancelRedirect'); $rootScope.cancelRedirect(); - - expect($rootScope.cancelRedirect).toHaveBeenCalled(); - - + expect($state.go).toHaveBeenCalledWith('menu.home'); })); - it('should close app',(function() { + it('should close app', inject(function($state) { + spyOn($state, 'go'); var controller = createController(); - - expect(controller).toBeDefined(); - expect($rootScope).toBeDefined(); - expect($rootScope.closeApp).toBeDefined(); - - spyOn($rootScope,'closeApp'); $rootScope.closeApp(); - expect($rootScope.closeApp).toHaveBeenCalled( ); - expect($rootScope.closeApp).toHaveBeenCalledWith( ); - - spyOn(ionic.Platform,'exitApp'); - ionic.Platform.exitApp(); - expect(ionic.Platform.exitApp).toHaveBeenCalled(); - expect(ionic.Platform.exitApp).toHaveBeenCalledWith(); - + expect($state.go).not.toHaveBeenCalledWith('menu.home'); }));
6e1d449579254cff7d2e316bedfddf59bda00935
gs-timer.js
gs-timer.js
function onOpen() { var spreadsheet = SpreadsheetApp.getActive(); spreadsheet.addMenu('Time Tracking', [{ "name": 'Lauch Timer', "functionName": 'launchTimer_'}]); } function launchTimer_() { var ui = SpreadsheetApp.getUi(); ui.showSidebar(HtmlService.createHtmlOutputFromFile('timer.html')); }
function onOpen() { var spreadsheet = SpreadsheetApp.getActive(); spreadsheet.addMenu('Time Tracking', [{ "name": 'Lauch Timer', "functionName": 'launchTimer_'}]); } function launchTimer_() { var ui = SpreadsheetApp.getUi(); ui.showSidebar(HtmlService.createHtmlOutputFromFile('timer.html')); } function beginTimeSheetEntry() { var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); cell.setValue(new Date()); return [cell.getRow(), cell.getColumn()]; }
Add function to write when timer begins to the active cell.
Add function to write when timer begins to the active cell.
JavaScript
mit
igrep/gs-timer
--- +++ @@ -7,3 +7,9 @@ var ui = SpreadsheetApp.getUi(); ui.showSidebar(HtmlService.createHtmlOutputFromFile('timer.html')); } + +function beginTimeSheetEntry() { + var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); + cell.setValue(new Date()); + return [cell.getRow(), cell.getColumn()]; +}
8e171c389e3d2e984383c3b02734259660629ebd
test/factories/config_versions.js
test/factories/config_versions.js
'use strict'; require('../test_helper'); var Factory = require('factory-lady'), mongoose = require('mongoose'); mongoose.model('ConfigVersion', new mongoose.Schema({ version: { type: Date, unique: true, }, config: mongoose.Schema.Types.Mixed, }, { collection: 'config_versions' })); Factory.define('config_version', mongoose.testConnection.model('ConfigVersion'), { version: function(callback) { callback(new Date()); }, });
'use strict'; require('../test_helper'); var Factory = require('factory-lady'), mongoose = require('mongoose'); mongoose.model('RouterConfigVersion', new mongoose.Schema({ version: { type: Date, unique: true, }, config: mongoose.Schema.Types.Mixed, }, { collection: 'config_versions' })); Factory.define('config_version', mongoose.testConnection.model('RouterConfigVersion'), { version: function(callback) { callback(new Date()); }, });
Fix conflicting model in tests with the api-umbrella-config module.
Fix conflicting model in tests with the api-umbrella-config module. I'm not sure why this didn't happen before, but I think it might be related to getting the api-umbrella-config module bumped and on the same version of mongoose as the router and gatekeeper. This could be handled better, but in the meantime, we'll just call the router one something different.
JavaScript
mit
NREL/api-umbrella-router,NREL/api-umbrella,OdiloOrg/api-umbrella-router,NREL/api-umbrella,OdiloOrg/api-umbrella-router,NREL/api-umbrella-router,OdiloOrg/api-umbrella-router,apinf/api-umbrella,apinf/api-umbrella,NREL/api-umbrella,NREL/api-umbrella-router,apinf/api-umbrella,NREL/api-umbrella,apinf/api-umbrella,apinf/api-umbrella
--- +++ @@ -5,7 +5,7 @@ var Factory = require('factory-lady'), mongoose = require('mongoose'); -mongoose.model('ConfigVersion', new mongoose.Schema({ +mongoose.model('RouterConfigVersion', new mongoose.Schema({ version: { type: Date, unique: true, @@ -13,7 +13,7 @@ config: mongoose.Schema.Types.Mixed, }, { collection: 'config_versions' })); -Factory.define('config_version', mongoose.testConnection.model('ConfigVersion'), { +Factory.define('config_version', mongoose.testConnection.model('RouterConfigVersion'), { version: function(callback) { callback(new Date()); },
6da357b5684ce799cce14f9397288fed9db64735
gulpfile.js
gulpfile.js
var exec = require('child_process').exec; var gulp = require('gulp'); gulp.task('test', function() { var path = './node_modules/mocha-phantomjs/bin/mocha-phantomjs'; var command = '/test/index.html'; exec(path + ' ' + command, function (error, stdout, stderr) { if (stdout) { console.log(stdout); } else if (stderr) { console.log(stderr); } else if (error) { console.log(error); } }); });
var exec = require('child_process').exec; var gulp = require('gulp'); gulp.task('test', function() { var path = './node_modules/mocha-phantomjs/bin/mocha-phantomjs'; var command = '/test/index.html'; exec(path + ' ' + command, function (error, stdout, stderr) { if (stdout) { console.log(stdout); } else if (stderr) { console.error(stderr); } else if (error) { console.error(error); } }); });
Use console.error in gulp test task
Use console.error in gulp test task
JavaScript
agpl-3.0
jessamynsmith/boards-web,GetBlimp/boards-web,jessamynsmith/boards-web
--- +++ @@ -9,9 +9,9 @@ if (stdout) { console.log(stdout); } else if (stderr) { - console.log(stderr); + console.error(stderr); } else if (error) { - console.log(error); + console.error(error); } }); });
2c97ef51e9916af7c5fa11ef70c5b6c131d0f0d4
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var stylus = require('gulp-stylus'); var stylint = require('gulp-stylint'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var stylFiles = './assets/styl/*.styl'; function bsjs(file) { return './assets/bootstrap-stylus-5.0.2/js/' + file + '.js' }; var bootstrapJsFiles = [bsjs('collapse'), bsjs('button'), bsjs('dropdown')]; gulp.task('stylus-lint', function() { return gulp.src(stylFiles) .pipe(stylint({ config: './assets/styl/.stylintrc' })) .pipe(stylint.reporter()) .pipe(stylint.reporter('fail')); }); gulp.task('stylus-compile', function() { return gulp.src(stylFiles) .pipe(stylus({ compress: true })) .pipe(gulp.dest('./assets/css')) }); gulp.task('stylus', ['stylus-lint', 'stylus-compile']); gulp.task('bootstrap-js', function() { return gulp.src(bootstrapJsFiles) .pipe(concat('bootstrap.min.js')) .pipe(uglify()) .pipe(gulp.dest('./assets/js')) }); gulp.task('watch', function() { gulp.watch([stylFiles, './assets/bootstrap-stylus-5.0.2/bootstrap/*.styl'], ['stylus']); }); gulp.task('default', ['stylus', 'bootstrap-js']);
var gulp = require('gulp'); var stylus = require('gulp-stylus'); var stylint = require('gulp-stylint'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var stylFiles = './assets/styl/*.styl'; function bsjs(file) { return './assets/bootstrap-stylus-5.0.2/js/' + file + '.js' }; var bootstrapJsFiles = [bsjs('collapse'), bsjs('button'), bsjs('dropdown')]; gulp.task('stylus-lint', function() { return gulp.src(stylFiles) .pipe(stylint({ config: './assets/styl/.stylintrc' })) .pipe(stylint.reporter()) .pipe(stylint.reporter('fail')); }); gulp.task('stylus-compile', function() { return gulp.src(stylFiles) .pipe(stylus({ compress: true })) .pipe(gulp.dest('./assets/css')) }); gulp.task('stylus', ['stylus-lint', 'stylus-compile']); gulp.task('bootstrap-js', function() { return gulp.src(bootstrapJsFiles) .pipe(concat('bootstrap.min.js')) .pipe(uglify()) .pipe(gulp.dest('./assets/js')) }); gulp.task('watch', function() { gulp.watch([stylFiles, './assets/bootstrap-stylus-5.0.2/bootstrap/*.styl'], ['stylus-compile']); }); gulp.task('default', ['stylus', 'bootstrap-js']);
Remove stylint from gulp watch
Remove stylint from gulp watch
JavaScript
mit
arthurrump/gct,arthurrump/gct
--- +++ @@ -38,7 +38,7 @@ }); gulp.task('watch', function() { - gulp.watch([stylFiles, './assets/bootstrap-stylus-5.0.2/bootstrap/*.styl'], ['stylus']); + gulp.watch([stylFiles, './assets/bootstrap-stylus-5.0.2/bootstrap/*.styl'], ['stylus-compile']); }); gulp.task('default', ['stylus', 'bootstrap-js']);
9bc6661eb135751f800a70b4ea0cf16875e450ac
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var jshint = require('gulp-jshint'); var stylish = require('jshint-stylish'); gulp.task('jshint', function() { return gulp.src(['*.js', 'lib/*.js', 'spec/*.js']). pipe(jshint()). pipe(jshint.reporter(stylish)); }); var jasmine = require('gulp-jasmine'); gulp.task('test', function() { return gulp.src('spec/*.js'). pipe(jasmine()); }); gulp.task('default', [ 'jshint', 'test' ]);
'use strict'; var gulp = require('gulp'); var jshint = require('gulp-jshint'); var stylish = require('jshint-stylish'); gulp.task('jshint', function() { return gulp.src(['*.js', 'lib/*.js', 'spec/*.js']). pipe(jshint()). pipe(jshint.reporter(stylish)). pipe(jshint.reporter('fail')); }); var jasmine = require('gulp-jasmine'); gulp.task('test', [ 'jshint' ], function() { return gulp.src('spec/*.js'). pipe(jasmine()); }) gulp.task('default', [ 'jshint', 'test' ]);
Make 'gulp test' depends on 'gulp jshint'.
[NF] Make 'gulp test' depends on 'gulp jshint'.
JavaScript
mit
chaoran/blackjack
--- +++ @@ -7,15 +7,16 @@ gulp.task('jshint', function() { return gulp.src(['*.js', 'lib/*.js', 'spec/*.js']). pipe(jshint()). - pipe(jshint.reporter(stylish)); + pipe(jshint.reporter(stylish)). + pipe(jshint.reporter('fail')); }); var jasmine = require('gulp-jasmine'); -gulp.task('test', function() { +gulp.task('test', [ 'jshint' ], function() { return gulp.src('spec/*.js'). pipe(jasmine()); -}); +}) gulp.task('default', [ 'jshint', 'test' ]);
18a518ed6f18487693755f614fbc943adc3a2bc4
gulpfile.js
gulpfile.js
var browserify = require('browserify'); var gulp = require('gulp'); var glob = require('glob'); var reactify = require('reactify'); var source = require('vinyl-source-stream'); var shell = require('gulp-shell'); /* gulp browserify: Bundles all .js files in the /js/ directory into one file in /build/bundle.js that will be imported onto all pages */ gulp.task('browserify', function() { var files = glob.sync('./js/**/*.js'); var b = browserify(); for (var i = 0; i < files.length; i++) { var matches = /(\w+)\.js$/.exec(files[i]); b.require(files[i], {expose: matches[1]}); } b.require('xhpjs'); return b .bundle() .pipe(source('bundle.js')) .pipe(gulp.dest('./build/')); }); gulp.task('install-php', shell.task([ 'hhvm composer.phar install' ])); gulp.task('autoload', shell.task([ 'hhvm composer.phar dump-autoload' ])); gulp.task('default', ['install-php','browserify']);
var browserify = require('browserify'); var gulp = require('gulp'); var glob = require('glob'); var reactify = require('reactify'); var source = require('vinyl-source-stream'); var shell = require('gulp-shell'); /* gulp browserify: Bundles all .js files in the /js/ directory into one file in /build/bundle.js that will be imported onto all pages */ gulp.task('browserify', function() { var files = glob.sync('./js/**/*.js'); var b = browserify(); for (var i = 0; i < files.length; i++) { var matches = /(\w+)\.js$/.exec(files[i]); b.require(files[i], {expose: matches[1]}); } b.require('xhpjs'); return b .bundle() .pipe(source('bundle.js')) .pipe(gulp.dest('./build/')); }); gulp.task('install-php', shell.task([ 'hhvm composer.phar install' ])); gulp.task('autoload', shell.task([ 'hhvm composer.phar dump-autoload' ])); gulp.task('serve', shell.task([ 'hhvm -m server -p 8080' ])); gulp.task('default', ['install-php','browserify','serve']);
Add gulp command for running server
Add gulp command for running server
JavaScript
mit
BinghamtonCoRE/core-site
--- +++ @@ -34,4 +34,8 @@ 'hhvm composer.phar dump-autoload' ])); -gulp.task('default', ['install-php','browserify']); +gulp.task('serve', shell.task([ + 'hhvm -m server -p 8080' +])); + +gulp.task('default', ['install-php','browserify','serve']);
87f621008c55215bf157606c4c2bf60cd7039b65
gulpfile.js
gulpfile.js
var gulp = require('gulp'), jshint = require('gulp-jshint'), mocha = require('gulp-mocha'); gulp.task('default', function () { // place code for your default task here }); gulp.task('lint', function () { return gulp.src(['./lib/*.js', './bin/*.js']) .pipe(jshint()) .pipe(jshint.reporter('default', {verbose: true})); }); gulp.task('test', function () { return gulp.src('./test/telldus.js', {read: false}) .pipe(mocha({reporter: 'nyan'})); });
var gulp = require('gulp'), jshint = require('gulp-jshint'), mocha = require('gulp-mocha'); gulp.task('default', ['lint', 'test'], function () { // place code for your default task here }); gulp.task('lint', function () { return gulp.src(['./lib/*.js', './bin/*.js','./test/*.js']) .pipe(jshint()) .pipe(jshint.reporter('default', {verbose: true})); }); gulp.task('test', function () { return gulp.src('./test/telldus.js', {read: false}) .pipe(mocha({reporter: 'nyan'})); });
Add lint and test to default gulp task
Add lint and test to default gulp task
JavaScript
mit
ashpool/telldus2graphite,ashpool/telldus2graphite
--- +++ @@ -2,12 +2,12 @@ jshint = require('gulp-jshint'), mocha = require('gulp-mocha'); -gulp.task('default', function () { +gulp.task('default', ['lint', 'test'], function () { // place code for your default task here }); gulp.task('lint', function () { - return gulp.src(['./lib/*.js', './bin/*.js']) + return gulp.src(['./lib/*.js', './bin/*.js','./test/*.js']) .pipe(jshint()) .pipe(jshint.reporter('default', {verbose: true})); });
d0ed663ef1374776e25216b01450f0529bd9e5c2
gulpfile.js
gulpfile.js
var gulp = require('gulp'), concat = require('gulp-concat'), rename = require('gulp-rename'), uglify = require('gulp-uglify'), gulpif = require('gulp-if'), react = require('gulp-react'); var paths = [ 'wrapper-header.js', 'cosmos.js', 'lib/**/*.js', 'mixins/**/*.js', 'components/**/*.jsx', 'wrapper-footer.js' ]; gulp.task('build', function() { gulp.src(paths) .pipe(gulpif(/\.jsx$/, react())) .pipe(concat('cosmos.js')) .pipe(gulp.dest('build')) .pipe(uglify()) .pipe(rename('cosmos.min.js')) .pipe(gulp.dest('build')); }); // Rerun the task when a file changes gulp.task('watch', function () { gulp.watch(paths.core, ['build']); }); gulp.task('default', ['build', 'watch']);
var gulp = require('gulp'), concat = require('gulp-concat'), rename = require('gulp-rename'), uglify = require('gulp-uglify'), gulpif = require('gulp-if'), react = require('gulp-react'); var paths = [ 'wrapper-header.js', 'cosmos.js', 'lib/**/*.js', 'mixins/**/*.js', 'components/**/*.jsx', 'wrapper-footer.js' ]; gulp.task('build', function() { gulp.src(paths) .pipe(gulpif(/\.jsx$/, react())) .pipe(concat('cosmos.js')) .pipe(gulp.dest('build')) .pipe(uglify()) .pipe(rename('cosmos.min.js')) .pipe(gulp.dest('build')); }); // Rerun the task when a file changes gulp.task('watch', function () { gulp.watch(paths, ['build']); }); gulp.task('default', ['build', 'watch']);
Fix paths in watch gulp task
Fix paths in watch gulp task
JavaScript
mit
gdi2290/cosmos,skidding/cosmos,kwangkim/cosmos,pekala/cosmos,react-cosmos/react-cosmos,react-cosmos/react-cosmos,kwangkim/cosmos,Patreon/cosmos,pekala/cosmos,rrarunan/cosmos,kidaa/cosmos,skidding/cosmos,Patreon/cosmos,teosz/cosmos,skidding/react-cosmos,skidding/react-cosmos,react-cosmos/react-cosmos,teosz/cosmos,rrarunan/cosmos,gdi2290/cosmos,bbirand/cosmos,kidaa/cosmos,cef62/cosmos,bbirand/cosmos,cef62/cosmos
--- +++ @@ -26,7 +26,7 @@ // Rerun the task when a file changes gulp.task('watch', function () { - gulp.watch(paths.core, ['build']); + gulp.watch(paths, ['build']); }); gulp.task('default', ['build', 'watch']);
11901cd8635578f1eaf1c057c0c72f3de591b215
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'), browserify = require('browserify'), transform = require('vinyl-transform'), uglify = require('gulp-uglify'), sourcemaps = require('gulp-sourcemaps'), jasmine = require('gulp-jasmine'), sass = require('gulp-sass'); gulp.task('default', ['build', 'watch']); gulp.task('watch', function () { gulp.watch('./src/js/**/*.js', ['test']); gulp.watch('./spec/**/*.js', ['test']); gulp.watch('./src/scss/**/*.scss', ['css']); }); gulp.task('build', ['javascript', 'css']); gulp.task('css', function () { gulp.src('./src/css/bowler.scss') .pipe(sourcemaps.init()) .pipe(sass()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css')); }); gulp.task('javascript', function () { var browserified = transform(function (filename) { var b = browserify({ entries: filename, debug: true }); return b.bundle(); }); return gulp.src('./src/js/bowler.js') .pipe(browserified) .pipe(sourcemaps.init({ loadMaps: true })) .pipe(uglify()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/js')); }); gulp.task('test', ['javascript'], function () { return gulp.src('./spec/**/*.js') .pipe(jasmine()); });
'use strict'; var gulp = require('gulp'), browserify = require('browserify'), transform = require('vinyl-transform'), uglify = require('gulp-uglify'), sourcemaps = require('gulp-sourcemaps'), jasmine = require('gulp-jasmine'), sass = require('gulp-sass'); gulp.task('default', ['build', 'watch']); gulp.task('watch', function () { gulp.watch('./src/js/**/*.js', ['test']); gulp.watch('./spec/**/*.js', ['test']); gulp.watch('./src/scss/**/*.scss', ['css']); }); gulp.task('build', ['javascript', 'css']); gulp.task('css', function () { gulp.src('./src/scss/bowler.scss') .pipe(sourcemaps.init()) .pipe(sass({ outputStyle: 'compressed' })) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css')); }); gulp.task('javascript', function () { var browserified = transform(function (filename) { var b = browserify({ entries: filename, debug: true }); return b.bundle(); }); return gulp.src('./src/js/bowler.js') .pipe(browserified) .pipe(sourcemaps.init({ loadMaps: true })) .pipe(uglify()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/js')); }); gulp.task('test', ['javascript'], function () { return gulp.src('./spec/**/*.js') .pipe(jasmine()); });
Set sass output style to compressed
Set sass output style to compressed
JavaScript
mit
rowanoulton/bowler,rowanoulton/bowler
--- +++ @@ -19,9 +19,9 @@ gulp.task('build', ['javascript', 'css']); gulp.task('css', function () { - gulp.src('./src/css/bowler.scss') + gulp.src('./src/scss/bowler.scss') .pipe(sourcemaps.init()) - .pipe(sass()) + .pipe(sass({ outputStyle: 'compressed' })) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css')); });
47c8340f0a3f14e6a5d93817945a7191b194f64b
server/models/todo.js
server/models/todo.js
import mongoose from 'mongoose'; const Schema = mongoose.Schema; const todoSchema = new Schema({ text: { type: 'String', required: true }, completed: { type: 'Boolean', required: true }, cuid: { type: 'String', required: true } }); export default mongoose.model('Todo', todoSchema);
import mongoose from 'mongoose'; const Schema = mongoose.Schema; const todoSchema = new Schema({ text: { type: 'String', required: true }, completed: { type: 'Boolean', required: true }, cuid: { type: 'String', required: true }, }); export default mongoose.model('Todo', todoSchema);
Add dangling comma to fix linting
Add dangling comma to fix linting
JavaScript
mit
saltykovdg/mern-react-redux-nodejs-express-todo-list,saltykovdg/mern-react-redux-nodejs-express-todo-list
--- +++ @@ -4,7 +4,7 @@ const todoSchema = new Schema({ text: { type: 'String', required: true }, completed: { type: 'Boolean', required: true }, - cuid: { type: 'String', required: true } + cuid: { type: 'String', required: true }, }); export default mongoose.model('Todo', todoSchema);
a8750422bca3faba4a3993cacb77fcd898b6ddee
server/simulatency.js
server/simulatency.js
global.simulatency = {} global.simulatency.timeout = 100 inject(Meteor.server.stream_server.server._events, 'connection', function (args, done) { inject(args[0], 'write', function (args, done) { setTimeout(done, global.simulatency.timeout) }) done() }) function httpDelay (args, done) { global.simulatency.timeout = getCookie(args[0].headers.cookie, 'lag')[1] || global.simulatency.timeout setTimeout(done, global.simulatency.timeout) } inject(WebApp.httpServer._events, 'upgrade', httpDelay) inject(WebApp.httpServer._events, 'request', httpDelay)
global.simulatency = {} global.simulatency.timeout = 0 inject(Meteor.server.stream_server.server._events, 'connection', function (args, done) { inject(args[0], 'write', function (args, done) { setTimeout(done, global.simulatency.timeout) }) done() }) function httpDelay (args, done) { global.simulatency.timeout = getCookie(args[0].headers.cookie, 'lag')[1] || global.simulatency.timeout setTimeout(done, global.simulatency.timeout) } inject(WebApp.httpServer._events, 'upgrade', httpDelay) inject(WebApp.httpServer._events, 'request', httpDelay)
Set a more sensible default
Set a more sensible default
JavaScript
mit
Kriegslustig/meteor-simulatency
--- +++ @@ -1,6 +1,6 @@ global.simulatency = {} -global.simulatency.timeout = 100 +global.simulatency.timeout = 0 inject(Meteor.server.stream_server.server._events, 'connection', function (args, done) { inject(args[0], 'write', function (args, done) {
632f88c0b097d18be7d5bf76e0817a8ad836c39b
data/checkContrast.js
data/checkContrast.js
var darkColor; var lightColor; self.port.on("colors", function(colors) { darkColor = colors[0]; lightColor = colors[1]; checkElementContrast(document.all[0]); }); function checkElementContrast(element) { var isFgUndefined = (getComputedStyle(element).color == getDefaultComputedStyle(element).color); var isBgUndefined = (getComputedStyle(element).backgroundColor == getDefaultComputedStyle(element).backgroundColor) && (getComputedStyle(element).backgroundImage == 'none'); //Background image is not set if (isFgUndefined && isBgUndefined) { // Both undefined, continue with children var children = element.children for (var i=0; i < children.length; i++) { // Don't look at non-renderable elements switch (element.children[i].nodeName) { case "HEAD": case "TITLE": case "META": case "SCRIPT": case "IMG": case "STYLE": break; default: checkElementContrast(element.children[i]); } } } else if (isFgUndefined) { element.style.color = darkColor; } else if (isBgUndefined) { element.style.backgroundColor = lightColor; } return; }
var darkColor; var lightColor; self.port.on("colors", function(colors) { darkColor = colors[0]; lightColor = colors[1]; // Now replace document colors checkElementContrast(document.all[0]); // Seperately check input and textarea nodes var inputs = document.getElementsByTagName("input"); for (var i=0; i < inputs.length; i++) { checkElementContrast(inputs[i]); } var texts = document.getElementsByTagName("textarea"); for (var i=0; i < texts.length; i++) { checkElementContrast(texts[i]); } }); function checkElementContrast(element) { var isFgUndefined = (getComputedStyle(element).color == getDefaultComputedStyle(element).color); var isBgUndefined = (getComputedStyle(element).backgroundColor == getDefaultComputedStyle(element).backgroundColor) && (getComputedStyle(element).backgroundImage == 'none'); //Background image is not set if (isFgUndefined && isBgUndefined) { // Both undefined, continue with children var children = element.children for (var i=0; i < children.length; i++) { // Don't look at non-renderable elements switch (element.children[i].nodeName) { case "HEAD": case "TITLE": case "META": case "SCRIPT": case "IMG": case "STYLE": break; default: checkElementContrast(element.children[i]); } } } else if (isFgUndefined) { element.style.color = darkColor; } else if (isBgUndefined) { element.style.backgroundColor = lightColor; } return; }
Add checks for input and textarea elements, as they do not inherit styles.
Add checks for input and textarea elements, as they do not inherit styles.
JavaScript
mit
DmitriK/darkContrast,DmitriK/darkContrast,DmitriK/darkContrast
--- +++ @@ -4,7 +4,19 @@ self.port.on("colors", function(colors) { darkColor = colors[0]; lightColor = colors[1]; + // Now replace document colors checkElementContrast(document.all[0]); + + // Seperately check input and textarea nodes + var inputs = document.getElementsByTagName("input"); + for (var i=0; i < inputs.length; i++) { + checkElementContrast(inputs[i]); + } + + var texts = document.getElementsByTagName("textarea"); + for (var i=0; i < texts.length; i++) { + checkElementContrast(texts[i]); + } }); function checkElementContrast(element)
58fdb956b582d0d6d28dc20d0c43b96b0e4bae27
test/Ownable.js
test/Ownable.js
'use strict'; const assertJump = require('./helpers/assertJump'); var Ownable = artifacts.require('../contracts/ownership/Ownable.sol'); contract('Ownable', function(accounts) { let ownable; beforeEach(async function() { ownable = await Ownable.new(); }); it('should have an owner', async function() { let owner = await ownable.owner(); assert.isTrue(owner !== 0); }); it('changes owner after transfer', async function() { let other = accounts[1]; await ownable.transferOwnership(other); let owner = await ownable.owner(); assert.isTrue(owner === other); }); it('should prevent non-owners from transfering', async function() { const other = accounts[2]; const owner = await ownable.owner.call(); assert.isTrue(owner !== other); try { await ownable.transferOwnership(other, {from: other}); } catch(error) { assertJump(error); } }); it('should guard ownership against stuck state', async function() { let originalOwner = await ownable.owner(); try { await ownable.transferOwnership(null, {from: originalOwner}); } catch(error) { assertJump(error); } }); });
'use strict'; const assertJump = require('./helpers/assertJump'); var Ownable = artifacts.require('../contracts/ownership/Ownable.sol'); contract('Ownable', function(accounts) { let ownable; beforeEach(async function() { ownable = await Ownable.new(); }); it('should have an owner', async function() { let owner = await ownable.owner(); assert.isTrue(owner !== 0); }); it('changes owner after transfer', async function() { let other = accounts[1]; await ownable.transferOwnership(other); let owner = await ownable.owner(); assert.isTrue(owner === other); }); it('should prevent non-owners from transfering', async function() { const other = accounts[2]; const owner = await ownable.owner.call(); assert.isTrue(owner !== other); try { await ownable.transferOwnership(other, {from: other}); } catch(error) { assertJump(error); } }); it('should guard ownership against stuck state', async function() { let originalOwner = await ownable.owner(); try { await ownable.transferOwnership(null, {from: originalOwner}); assert.fail() } catch(error) { assertJump(error); } }); });
Add assert to prevent regression
Add assert to prevent regression
JavaScript
mit
OpenZeppelin/zep-solidity,pash7ka/zeppelin-solidity,OpenZeppelin/zeppelin-solidity,dmx374/zeppelin-solidity,pash7ka/zeppelin-solidity,OpenZeppelin/zeppelin-solidity,OpenZeppelin/openzeppelin-contracts,OpenZeppelin/zep-solidity,dmx374/zeppelin-solidity,OpenZeppelin/openzeppelin-contracts,OpenZeppelin/openzeppelin-contracts
--- +++ @@ -38,6 +38,7 @@ let originalOwner = await ownable.owner(); try { await ownable.transferOwnership(null, {from: originalOwner}); + assert.fail() } catch(error) { assertJump(error); }
9d27cecdd7a4a8c5f2094c3f02dcba2a1a301e0b
watson-connector/static/js/app.js
watson-connector/static/js/app.js
$(document).foundation(); $('#all_username').keydown(function(event) { if (event.keyCode == 13) { var reportAPI = "http://localhost:5000/v1/api/watson/data/"+$("#all_username").val()+"/reports"; $('#all_entries tbody').empty(); $.getJSON(reportAPI, function(data) { $.each(data, function(n, i) { console.log(i); $('#all_entries tbody').append('<tr class="child"><td>'+i.user+'</td><td>'+i.date+'</td><td>'+i.payload+'</td></tr>'); }); }); }; }); $("#new_button").click(function() { var reportAPI = "http://localhost:5000/v1/api/watson/data/"+$("#new_username").val()+"/reports/"+$("#new_date").val(); $.ajax({ type: 'PUT', dataType: 'json', url: reportAPI, headers: {"X-HTTP-Method-Override": "PUT"} }); });
$(document).foundation(); $('#all_username').keydown(function(event) { if (event.keyCode == 13) { var reportAPI = "http://localhost:5000/v1/api/watson/data/"+$("#all_username").val()+"/reports"; $('#all_entries tbody').empty(); $.getJSON(reportAPI, function(data) { $.each(data, function(n, i) { console.log(i); var payload = JSON.stringify(i.payload); $('#all_entries tbody').append('<tr class="child"><td>'+i.user+'</td><td>'+i.date+'</td><td>'+ payload +'</td></tr>'); }); }); }; }); $("#new_button").click(function() { var reportAPI = "http://localhost:5000/v1/api/watson/data/"+$("#new_username").val()+"/reports/"+$("#new_date").val(); $.ajax({ type: 'PUT', dataType: 'json', url: reportAPI, headers: {"X-HTTP-Method-Override": "PUT"} }); });
Add better object output on dashboard
Add better object output on dashboard
JavaScript
mit
martialblog/watson-diary,martialblog/watson-diary,martialblog/watson-diary
--- +++ @@ -8,7 +8,8 @@ $.getJSON(reportAPI, function(data) { $.each(data, function(n, i) { console.log(i); - $('#all_entries tbody').append('<tr class="child"><td>'+i.user+'</td><td>'+i.date+'</td><td>'+i.payload+'</td></tr>'); + var payload = JSON.stringify(i.payload); + $('#all_entries tbody').append('<tr class="child"><td>'+i.user+'</td><td>'+i.date+'</td><td>'+ payload +'</td></tr>'); }); });
1fdcb28a71e383e42d64abac2ffb508fe3bd97c7
models/producttype_model.js
models/producttype_model.js
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var Objectid = mongoose.Schema.Types.ObjectId; var ProductTypeSchema = new Schema({ name: { type: String, required: true, index: true }, fire_action: String, price_recommendation_formula: String, bookable: { type: Boolean, default: false }, bookable_noun: String, bookable_time_units: Number, _owner_id: Objectid, _deleted: { type: Boolean, default: false, index: true }, }, { timestamps: true }); ProductTypeSchema.set("_perms", { setup: "crud", admin: "r", all: "r" }); module.exports = mongoose.model('ProductType', ProductTypeSchema);
const mongoose = require('mongoose'); const Schema = mongoose.Schema; const Objectid = mongoose.Schema.Types.ObjectId; const friendly = require("mongoose-friendly"); const ProductTypeSchema = new Schema({ name: { type: String, required: true, index: true }, urlid: { type: String, unique: true, index: true }, fire_action: String, price_recommendation_formula: String, bookable: { type: Boolean, default: false }, bookable_noun: String, bookable_time_units: String, img: String, _owner_id: Objectid, _deleted: { type: Boolean, default: false, index: true }, }, { timestamps: true }); ProductTypeSchema.plugin(friendly, { source: 'name', friendly: 'urlid' }); ProductTypeSchema.set("_perms", { setup: "crud", admin: "r", all: "r" }); module.exports = mongoose.model('ProductType', ProductTypeSchema);
Enhance product type for bookable items
Enhance product type for bookable items
JavaScript
mit
10layer/jexpress,10layer/jexpress
--- +++ @@ -1,19 +1,26 @@ -var mongoose = require('mongoose'); -var Schema = mongoose.Schema; +const mongoose = require('mongoose'); +const Schema = mongoose.Schema; +const Objectid = mongoose.Schema.Types.ObjectId; +const friendly = require("mongoose-friendly"); -var Objectid = mongoose.Schema.Types.ObjectId; - -var ProductTypeSchema = new Schema({ +const ProductTypeSchema = new Schema({ name: { type: String, required: true, index: true }, + urlid: { type: String, unique: true, index: true }, fire_action: String, price_recommendation_formula: String, bookable: { type: Boolean, default: false }, bookable_noun: String, - bookable_time_units: Number, + bookable_time_units: String, + img: String, _owner_id: Objectid, _deleted: { type: Boolean, default: false, index: true }, }, { timestamps: true +}); + +ProductTypeSchema.plugin(friendly, { + source: 'name', + friendly: 'urlid' }); ProductTypeSchema.set("_perms", {
3d11a025d0f20a214f9165da40c954c3be937288
test/context.js
test/context.js
/*jslint*/ (function(){ var testElement = '<div id="testElement">'+ '<a class="link"><a class="sub-link"></a></a>'+ '</div>'; function teardown() { $('#testElement').remove(); } function setup() { $('body').append(testElement); } module("Context binding", {teardown: teardown, setup: setup }); test("Context inside viewController init", function() { var viewController = { init : function init() { equal(init, this.init, 'context of this, is this view controller'); this.test(); }, test : function() { ok(true, 'test function can be accessed from init function, using this'); this.test2(); }, test2 : function() { ok(true, 'test2 function can be accessed from test function, using this'); } }; $('#testElement').capture(viewController); expect(3); }); test("Context inside viewController events", function() { var viewController = { onclick : { '.link': function(e) { equal(e.target, $('#testElement .link')[0], 'e target is element clicked on'); equal(this.element[0], $('#testElement')[0], 'this.element is the viewController bound unto'); } } }; $('#testElement').capture(viewController); $('#testElement .link').click(); }); }());
/*jslint*/ (function(){ var testElement = '<div id="testElement">'+ '<a class="link"><a class="sub-link"></a></a>'+ '</div>'; function teardown() { $('#testElement').remove(); } function setup() { $('body').append(testElement); } module("Context binding", {teardown: teardown, setup: setup }); test("Context inside viewController init", function() { var viewController = { init : function init() { // IE doesn't recognise named functions reference and contexual function ref as the same in // in this instance. We must convert toString() to test equality equal(init.toString(), this.init.toString(), 'context of this, is this view controller'); this.test(); }, test : function() { ok(true, 'test function can be accessed from init function, using this'); this.test2(); }, test2 : function() { ok(true, 'test2 function can be accessed from test function, using this'); } }; $('#testElement').capture(viewController); expect(3); }); test("Context inside viewController events", function() { var viewController = { onclick : { '.link': function(e) { equal(e.target, $('#testElement .link')[0], 'e target is element clicked on'); equal(this.element[0], $('#testElement')[0], 'this.element is the viewController bound unto'); } } }; $('#testElement').capture(viewController); $('#testElement .link').click(); }); }());
Fix for test in IE. Conditions were passing, but due to IE's JS implementation of named functions, it didn't recognise the equality test as equal. Further info in test.
Fix for test in IE. Conditions were passing, but due to IE's JS implementation of named functions, it didn't recognise the equality test as equal. Further info in test.
JavaScript
mit
AdamCraven/Capture,AdamCraven/Capture
--- +++ @@ -20,7 +20,9 @@ var viewController = { init : function init() { - equal(init, this.init, 'context of this, is this view controller'); + // IE doesn't recognise named functions reference and contexual function ref as the same in + // in this instance. We must convert toString() to test equality + equal(init.toString(), this.init.toString(), 'context of this, is this view controller'); this.test(); }, test : function() {
dd39ef99be18aab0e3a1f8bd3f8d7f32c049719a
src/backend/content_node_types.js
src/backend/content_node_types.js
// Register ContentNode types (including meta information). ContentNode.types = { "document": { name: "Document", allowedChildren: ["section"], properties: [ { "key": "title", "name": "Title", "defaultValue": "A document title" } ] }, "section": { name: "Section", allowedChildren: ["text", "image"], properties: [ { "key": "name", "name": "Section name", "defaultValue": "Hi, I'm a new section " } ] }, "text": { name: "Text", allowedChildren: [], properties: [ { "key": "content", "name": "Content", "defaultValue": "Hi, I'm a another text node." } ] }, "image": { name: "Image", allowedChildren: [], properties: [ { "key": "url", "name": "Image URL", "defaultValue": null } ] } };
// Register ContentNode types (including meta information). ContentNode.types = { "/type/document": { name: "Document", allowedChildren: ["section"], properties: [ { "key": "title", "name": "Title", "defaultValue": "A document title" } ] }, "/type/section": { name: "Section", allowedChildren: ["text", "image"], properties: [ { "key": "name", "name": "Section name", "defaultValue": "Hi, I'm a new section " } ] }, "/type/text": { name: "Text", allowedChildren: [], properties: [ { "key": "content", "name": "Content", "defaultValue": "Hi, I'm a another text node." } ] }, "/type/image": { name: "Image", allowedChildren: [], properties: [ { "key": "url", "name": "Image URL", "defaultValue": null } ] } };
Move over to Data.Graph compliant types.
Move over to Data.Graph compliant types.
JavaScript
bsd-2-clause
substance/legacy-composer,substance/legacy-composer
--- +++ @@ -1,7 +1,7 @@ // Register ContentNode types (including meta information). ContentNode.types = { - "document": { + "/type/document": { name: "Document", allowedChildren: ["section"], properties: [ @@ -12,7 +12,7 @@ } ] }, - "section": { + "/type/section": { name: "Section", allowedChildren: ["text", "image"], properties: [ @@ -23,7 +23,7 @@ } ] }, - "text": { + "/type/text": { name: "Text", allowedChildren: [], properties: [ @@ -34,7 +34,7 @@ } ] }, - "image": { + "/type/image": { name: "Image", allowedChildren: [], properties: [
bfbb23d250df64f6864568a585cec6f39c70d790
resources/assets/js/method-link.js
resources/assets/js/method-link.js
var $ = require('jquery'); $(document).ready(function() { var $body = $('body'); // Allow links to specify a HTTP method using `data-method` $('[data-method]').on('click', function(event) { event.preventDefault(); var url = $(this).attr('href'); var method = $(this).data('method'); var csrfToken = $('meta[name=csrf-token]').attr('content'); var $form = $('<form method="post" action="' + url + '"></form>'); var metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; if (csrfToken !== undefined) { metadataInput += '<input name="_token" value="' + csrfToken + '" type="hidden" />'; } $form.hide().append(metadataInput); $body.append($form); $form.submit(); }); });
var $ = require('jquery'); $(document).ready(function() { var $body = $('body'); // Allow links to specify a HTTP method using `data-method` $('[data-method]').on('click', function(event) { event.preventDefault(); var url = $(this).attr('href'); var method = $(this).data('method'); var formItem = $(this).data('form-item'); var formValue = $(this).data('form-value'); var csrfToken = $('meta[name=csrf-token]').attr('content'); var $form = $('<form method="post" action="' + url + '"></form>'); var metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; if (csrfToken !== undefined) { metadataInput += '<input name="_token" value="' + csrfToken + '" type="hidden" />'; } if (formItem !== undefined && formValue !== undefined) { metadataInput += '<input name="' + formItem + '" value="' + formValue + '" type="hidden" />'; } $form.hide().append(metadataInput); $body.append($form); $form.submit(); }); });
Allow one field payload on method links.
Allow one field payload on method links.
JavaScript
mit
axton21/voting-app,DoSomething/voting-app,DoSomething/voting-app,axton21/voting-app,axton21/voting-app,DoSomething/voting-app,DoSomething/voting-app
--- +++ @@ -10,6 +10,9 @@ var url = $(this).attr('href'); var method = $(this).data('method'); + var formItem = $(this).data('form-item'); + var formValue = $(this).data('form-value'); + var csrfToken = $('meta[name=csrf-token]').attr('content'); var $form = $('<form method="post" action="' + url + '"></form>'); @@ -19,6 +22,10 @@ metadataInput += '<input name="_token" value="' + csrfToken + '" type="hidden" />'; } + if (formItem !== undefined && formValue !== undefined) { + metadataInput += '<input name="' + formItem + '" value="' + formValue + '" type="hidden" />'; + } + $form.hide().append(metadataInput); $body.append($form);
fa4884c62778cd5631b84e0efbd32361b927fd79
test/wayback.js
test/wayback.js
/*global describe, it */ 'use strict'; var assert = require('assert'), fs = require('fs'), wayback = require('../lib/wayback'); describe('wayback', function() { it('should throw an error on timeout', function(done) { // Force a timeout this.timeout(10000); var url = 'http://automata.cc/thumb-chuck-wiimote.png', options = {'timeout': 100}; wayback.getClosest(url, options, function(err, resp) { assert.ok(err != null); assert.ok(err instanceof Error); assert.ok(resp === null); done(); }); }); });
/*global describe, it */ 'use strict'; var assert = require('assert'), fs = require('fs'), wayback = require('../lib/wayback'); var url = 'http://automata.cc/thumb-chuck-wiimote.png'; describe('wayback', function() { describe('getClosest', function() { it('should get the closest url on archive', function(done) { wayback.getClosest(url, function(err, resp) { assert.ok(err === null); assert.ok(resp instanceof Object); assert.equal(resp.available, true); done(); }); }); it('should get the closest url while using options', function(done) { this.timeout(6000); var options = {'timeout': 5000}; wayback.getClosest(url, options, function(err, resp) { assert.ok(err === null); assert.ok(resp instanceof Object); assert.equal(resp.available, true); done(); }); }); it('should throw an error on timeout', function(done) { // Force a timeout this.timeout(10000); var options = {'timeout': 100}; wayback.getClosest(url, options, function(err, resp) { assert.ok(err != null); assert.ok(err instanceof Error); assert.ok(resp === null); done(); }); }); }); });
Add more tests to getClosest
Add more tests to getClosest - add a regression test to check if old interface is kept (no options) - add a positive test to timeout option
JavaScript
mit
macbre/wayback-machine
--- +++ @@ -5,17 +5,38 @@ fs = require('fs'), wayback = require('../lib/wayback'); +var url = 'http://automata.cc/thumb-chuck-wiimote.png'; + describe('wayback', function() { - it('should throw an error on timeout', function(done) { - // Force a timeout - this.timeout(10000); - var url = 'http://automata.cc/thumb-chuck-wiimote.png', - options = {'timeout': 100}; - wayback.getClosest(url, options, function(err, resp) { - assert.ok(err != null); - assert.ok(err instanceof Error); - assert.ok(resp === null); - done(); + describe('getClosest', function() { + it('should get the closest url on archive', function(done) { + wayback.getClosest(url, function(err, resp) { + assert.ok(err === null); + assert.ok(resp instanceof Object); + assert.equal(resp.available, true); + done(); + }); + }); + it('should get the closest url while using options', function(done) { + this.timeout(6000); + var options = {'timeout': 5000}; + wayback.getClosest(url, options, function(err, resp) { + assert.ok(err === null); + assert.ok(resp instanceof Object); + assert.equal(resp.available, true); + done(); + }); + }); + it('should throw an error on timeout', function(done) { + // Force a timeout + this.timeout(10000); + var options = {'timeout': 100}; + wayback.getClosest(url, options, function(err, resp) { + assert.ok(err != null); + assert.ok(err instanceof Error); + assert.ok(resp === null); + done(); + }); }); }); });
2de34048abb2ba42d2716909bc3f57ba72bf21e6
client/scripts/app.js
client/scripts/app.js
/*jslint browser: true*/ /*global require, define */ /** * @module app */ define('app', ['yaga'], function (Yaga) { 'use strict'; window.Yaga = Yaga; }); require(['app']);
/*jslint browser: true*/ /*global require, define */ /** * @module app */ define('app', ['yaga', 'jquery', 'yaga-map', 'yaga-map-popup', 'yaga-ui-page', 'yaga-storage', 'yaga-storage-local', 'yaga-geo-json', 'yaga-layer-tile', 'yaga-ui-panel', 'yaga-map-marker', 'yaga-ui-splash-screen', 'yaga-map-icon'], function (Yaga, $, Map, Popup, Page, storage, ls, gj, tile, Panel, Marker, sc, Icon) { 'use strict'; window.Yaga = Yaga; window.Map = Map; window.Popup = Popup; window.Page = Page; window.Store = storage; window.ls = ls; window.gj = gj; window.tile = tile; window.Panel = Panel; window.Marker = Marker; window.Icon = Icon; window.sc = sc; sc.create(); var map, page, osm, state; map = Map.create(); map.activate(); osm = tile.create(); osm.show(); state = gj.create({ "type": "Feature", "properties": {"party": "Republican"}, "geometry": { "type": "Polygon", "coordinates": [[ [-104.05, 48.99], [-97.22, 48.98], [-96.58, 45.94], [-104.03, 45.94], [-104.05, 48.99] ]] } }); state.show(); page = Page.create({content: {content: map.domRoot}, title: 'YAGA - Yet another geo application'}); window.document.body.appendChild(page.domRoot); $(window.document).ready(function () { page.open(); }); }); require(['app']);
Add some hooks to get access in development mode
Add some hooks to get access in development mode
JavaScript
isc
atd-schubert/yaga,atd-schubert/yaga
--- +++ @@ -4,9 +4,54 @@ /** * @module app */ -define('app', ['yaga'], function (Yaga) { +define('app', ['yaga', 'jquery', 'yaga-map', 'yaga-map-popup', 'yaga-ui-page', 'yaga-storage', 'yaga-storage-local', 'yaga-geo-json', 'yaga-layer-tile', 'yaga-ui-panel', 'yaga-map-marker', 'yaga-ui-splash-screen', 'yaga-map-icon'], function (Yaga, $, Map, Popup, Page, storage, ls, gj, tile, Panel, Marker, sc, Icon) { 'use strict'; window.Yaga = Yaga; + window.Map = Map; + window.Popup = Popup; + window.Page = Page; + window.Store = storage; + window.ls = ls; + window.gj = gj; + window.tile = tile; + window.Panel = Panel; + window.Marker = Marker; + window.Icon = Icon; + window.sc = sc; + sc.create(); + + + + var map, page, osm, state; + map = Map.create(); + map.activate(); + + osm = tile.create(); + osm.show(); + + state = gj.create({ + "type": "Feature", + "properties": {"party": "Republican"}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-104.05, 48.99], + [-97.22, 48.98], + [-96.58, 45.94], + [-104.03, 45.94], + [-104.05, 48.99] + ]] + } + }); + + state.show(); + + page = Page.create({content: {content: map.domRoot}, title: 'YAGA - Yet another geo application'}); + + window.document.body.appendChild(page.domRoot); + $(window.document).ready(function () { + page.open(); + }); }); require(['app']);
a3be5ad5ea112422ed00da632530b93bcf54727c
oauth.js
oauth.js
var crypto = require('crypto') , qs = require('querystring') ; function sha1 (key, body) { return crypto.createHmac('sha1', key).update(body).digest('base64') } function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { // adapted from https://dev.twitter.com/docs/auth/oauth var base = httpMethod + "&" + encodeURIComponent( base_uri ) + "&" + Object.keys(params).sort().map(function (i) { // big WTF here with the escape + encoding but it's what twitter wants return encodeURIComponent(qs.escape(i)) + "%3D" + encodeURIComponent(qs.escape(params[i])) }).join("%26") var key = consumer_secret + '&' if (token_secret) key += token_secret return sha1(key, base) } exports.hmacsign = hmacsign
var crypto = require('crypto') , qs = require('querystring') ; function sha1 (key, body) { return crypto.createHmac('sha1', key).update(body).digest('base64') } function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { // adapted from https://dev.twitter.com/docs/auth/oauth var base = httpMethod + "&" + encodeURIComponent( base_uri ) + "&" + Object.keys(params).sort().map(function (i) { // big WTF here with the escape + encoding but it's what twitter wants return encodeURIComponent(escape(i)) + "%3D" + encodeURIComponent(escape(params[i])) }).join("%26") var key = consumer_secret + '&' if (token_secret) key += token_secret return sha1(key, base) } exports.hmacsign = hmacsign
Fix encoding of characters like (
Fix encoding of characters like (
JavaScript
apache-2.0
MofeLee/request,lalitkapoor/request,cvibhagool/request,whembed197923/request,h1bomb/request,Codelegant92/request,kevinburke/request,manishnakar/request,rbramwell/request,MofeLee/request,IveWong/request,paulomcnally/request,udp/request,NewGyu/request,blabno/request,robu3/request,lalitkapoor/request,pablobrady/request,linalu1/request,jzaefferer/request,zhouweiming/request,request/request,phillipj/request,ryanwholey/request,HAKASHUN/request,Prasanna-sr/request,watson/request,HAKASHUN/request,Aloomaio/request,simov/request,zodsoft/request,Jonekee/request,lxe/request,pablobrady/request,NewGyu/request,Codelegant92/request,substack/request,seegno-forks/request,watson/request,whembed197923/request,beni55/request,cvibhagool/request,czardoz/request,xiwc/request,Jonekee/request,Prasanna-sr/request,mvnnn/request,jsifuentes/request,kublaj/request,udp/request,rbramwell/request,xiwc/request,wakermahmud/request,lxe/request,nishant8BITS/request,not001praween001/request,faradayio/request,longwenjunjie/request,czardoz/request,manishnakar/request,not001praween001/request,niklabh/request,xtidt/request,neo-z/request,robu3/request,seegno-forks/request,beni55/request,longwenjunjie/request,jsifuentes/request,IbpTeam/node-request,calibr/request,kmulvey/request,IveWong/request,nishant8BITS/request,chaoliu/request,djchie/request,motopia/request,wakermahmud/request,jzaefferer/request,phillipj/request,calibr/request,sean3z/request,LoicMahieu/request,motopia/request,Aloomaio/request,zodsoft/request,LoicMahieu/request,mvnnn/request,pho3nixf1re/request,zhouweiming/request,wangchi/request,ryanwholey/request,simov/request,pho3nixf1re/request,request/request,niklabh/request,neo-z/request,substack/request,djchie/request,sean3z/request,kublaj/request,h1bomb/request,wangchi/request,blabno/request,bigeasy/request,kevinburke/request,kmulvey/request,faradayio/request,linalu1/request,xtidt/request,chaoliu/request,paulomcnally/request,IbpTeam/node-request
--- +++ @@ -13,7 +13,7 @@ encodeURIComponent( base_uri ) + "&" + Object.keys(params).sort().map(function (i) { // big WTF here with the escape + encoding but it's what twitter wants - return encodeURIComponent(qs.escape(i)) + "%3D" + encodeURIComponent(qs.escape(params[i])) + return encodeURIComponent(escape(i)) + "%3D" + encodeURIComponent(escape(params[i])) }).join("%26") var key = consumer_secret + '&' if (token_secret) key += token_secret
d5b63e0b784928696c6bb9e77776e93200272818
protractor.conf.js
protractor.conf.js
// Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/docs/referenceConf.js /*global jasmine */ var SpecReporter = require('jasmine-spec-reporter'); exports.config = { allScriptsTimeout: 11000, specs: [ './e2e/**/*.e2e-spec.ts' ], capabilities: { 'browserName': 'chrome' }, directConnect: true, baseUrl: 'http://localhost:4200/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, useAllAngular2AppRoots: true, beforeLaunch: function() { require('ts-node').register({ project: 'e2e' }); }, onPrepare: function() { jasmine.getEnv().addReporter(new SpecReporter()); } };
// Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/docs/referenceConf.js /*global jasmine */ var SpecReporter = require('jasmine-spec-reporter'); exports.config = { allScriptsTimeout: 11000, getPageTimeout: 60000, specs: [ './e2e/**/*.e2e-spec.ts' ], capabilities: { 'browserName': 'chrome' }, directConnect: true, baseUrl: 'http://localhost:4200/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, useAllAngular2AppRoots: true, beforeLaunch: function() { require('ts-node').register({ project: 'e2e' }); }, onPrepare: function() { jasmine.getEnv().addReporter(new SpecReporter()); } };
Set getPageTimeout to 60 seconds
Set getPageTimeout to 60 seconds
JavaScript
mit
kendaleiv/angular-testing,kendaleiv/angular2-testing,kendaleiv/angular2-testing,kendaleiv/angular-testing,kendaleiv/angular-testing,kendaleiv/angular2-testing
--- +++ @@ -6,6 +6,7 @@ exports.config = { allScriptsTimeout: 11000, + getPageTimeout: 60000, specs: [ './e2e/**/*.e2e-spec.ts' ],
c2344572b1911f89046b5d3c5078984a80382259
audio.js
audio.js
gAudio = (function(context) { AudioChannel = function() { this.gain = context.createGain(); this.gain.gain.value = 0; this.gain.connect(context.destination); return this; } AudioChannel.prototype.start = function() { var now = context.currentTime; this.gain.gain.linearRampToValueAtTime(0, now); this.gain.gain.linearRampToValueAtTime(0.1, now + 0.01); this.osc = context.createOscillator(); this.osc.connect(this.gain); this.osc.start(); } AudioChannel.prototype.stop = function(delay) { this.osc.stop(delay); } return { // context: context, eChan1: new AudioChannel(), startBolt: function() { var now = context.currentTime; this.eChan1.start(); this.eChan1.osc.frequency.linearRampToValueAtTime(1200, now); this.eChan1.osc.frequency.linearRampToValueAtTime(400, now + 0.1); this.eChan1.gain.gain.linearRampToValueAtTime(0.1, now + 0.1); this.eChan1.gain.gain.linearRampToValueAtTime(0, now + 0.11); this.eChan1.stop(now + 0.11); } } })(new AudioContext());
gAudio = (function(context) { AudioChannel = function() { this.gain = context.createGain(); this.gain.gain.value = 0; this.gain.connect(context.destination); return this; } AudioChannel.prototype.start = function(freq, delay) { var start = context.currentTime; if (typeof delay === 'number') start += delay; this.gain.gain.linearRampToValueAtTime(0, start); this.gain.gain.linearRampToValueAtTime(0.1, start + 0.01); this.osc = context.createOscillator(); this.osc.connect(this.gain); if (freq > 0) this.osc.frequency.value = freq; this.osc.start(start); } AudioChannel.prototype.stop = function(delay) { this.osc.stop(delay); } return { eChan1: new AudioChannel(), startBolt: function() { var now = context.currentTime; this.eChan1.start(now); this.eChan1.osc.frequency.linearRampToValueAtTime(1200, now); this.eChan1.osc.frequency.linearRampToValueAtTime(400, now + 0.1); this.eChan1.gain.gain.linearRampToValueAtTime(0.1, now + 0.1); this.eChan1.gain.gain.linearRampToValueAtTime(0, now + 0.11); this.eChan1.stop(now + 0.11); } } })(new AudioContext());
Update AudioChannel start to accept start frequency and delay
Update AudioChannel start to accept start frequency and delay
JavaScript
mit
peternatewood/shmup,peternatewood/shmup,peternatewood/shmup
--- +++ @@ -6,24 +6,25 @@ return this; } - AudioChannel.prototype.start = function() { - var now = context.currentTime; - this.gain.gain.linearRampToValueAtTime(0, now); - this.gain.gain.linearRampToValueAtTime(0.1, now + 0.01); + AudioChannel.prototype.start = function(freq, delay) { + var start = context.currentTime; + if (typeof delay === 'number') start += delay; + this.gain.gain.linearRampToValueAtTime(0, start); + this.gain.gain.linearRampToValueAtTime(0.1, start + 0.01); this.osc = context.createOscillator(); this.osc.connect(this.gain); - this.osc.start(); + if (freq > 0) this.osc.frequency.value = freq; + this.osc.start(start); } AudioChannel.prototype.stop = function(delay) { this.osc.stop(delay); } return { - // context: context, eChan1: new AudioChannel(), startBolt: function() { var now = context.currentTime; - this.eChan1.start(); + this.eChan1.start(now); this.eChan1.osc.frequency.linearRampToValueAtTime(1200, now); this.eChan1.osc.frequency.linearRampToValueAtTime(400, now + 0.1); this.eChan1.gain.gain.linearRampToValueAtTime(0.1, now + 0.1);
32a18697971c96673ff0ba1c331d3ff9e70092ec
app/javascript/app/routes/index.js
app/javascript/app/routes/index.js
import React from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; // =========== Components =========== import App from '../components/app'; import NotFound from '../components/public-pages/not-found'; // Layout import Header from '../components/navigation/header'; import Footer from '../components/navigation/footer'; // authentication import Register from '../components/auth/register'; import SignIn from '../components/auth/sign-in'; import Profile from '../components/auth/profile'; export default ( <Router> <div> <Header /> <Switch> <Route exact path="/" component={App} /> <Route path="/register" component={Register} /> <Route path="/sign_in" component={SignIn} /> <Route path="/profile" component={Profile} /> <Route component={NotFound} /> </Switch> <footer /> </div> </Router> )
import React from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; // =========== Components =========== import App from '../components/app'; import NotFound from '../components/public-pages/not-found'; // Products import Products from '../components/products/'; // Layout import Header from '../components/navigation/header'; import Footer from '../components/navigation/footer'; // authentication import Register from '../components/auth/register'; import SignIn from '../components/auth/sign-in'; import Profile from '../components/auth/profile'; // Hide order component import RequireAuth from '../components/auth/hoc/require-auth'; import HideAuth from '../components/auth/hoc/hide-auth'; export default ( <Router> <div> <Header /> <Switch> <Route exact path="/" component={App} /> <Route path="/register" component={HideAuth(Register)} /> <Route path="/sign_in" component={HideAuth(SignIn)} /> <Route path="/profile" component={RequireAuth(Profile)} /> <Route path="/products" component={HideAuth(Products)} /> <Route component={NotFound} /> </Switch> <footer /> </div> </Router> )
Hide components if user is logged
Hide components if user is logged
JavaScript
mit
GiancarlosIO/ecommerce-book-app,GiancarlosIO/ecommerce-book-app,GiancarlosIO/ecommerce-book-app
--- +++ @@ -4,6 +4,8 @@ // =========== Components =========== import App from '../components/app'; import NotFound from '../components/public-pages/not-found'; +// Products +import Products from '../components/products/'; // Layout import Header from '../components/navigation/header'; import Footer from '../components/navigation/footer'; @@ -11,6 +13,9 @@ import Register from '../components/auth/register'; import SignIn from '../components/auth/sign-in'; import Profile from '../components/auth/profile'; +// Hide order component +import RequireAuth from '../components/auth/hoc/require-auth'; +import HideAuth from '../components/auth/hoc/hide-auth'; export default ( @@ -19,9 +24,10 @@ <Header /> <Switch> <Route exact path="/" component={App} /> - <Route path="/register" component={Register} /> - <Route path="/sign_in" component={SignIn} /> - <Route path="/profile" component={Profile} /> + <Route path="/register" component={HideAuth(Register)} /> + <Route path="/sign_in" component={HideAuth(SignIn)} /> + <Route path="/profile" component={RequireAuth(Profile)} /> + <Route path="/products" component={HideAuth(Products)} /> <Route component={NotFound} /> </Switch> <footer />
44492c18bec0c24457ee174218b15941fae33719
assets/script.js
assets/script.js
/* globals $, symbols */ // Disable form submission (eg. via Enter key) $('form').submit(false) $('textarea, input, select').on('change keyup', function () { updateQrCode() }) const updateQrCode = function () { const size = 350 $('#error-container').hide() $('#qr').empty() $('#qr').qrcode({ render: $('input[name=qr-format]:checked').val(), width: size, height: size, size: size, color: '#3a3', text: $('#qr-data').val(), textOverlay: $('#qr-overlay').val(), textOverlayTransparency: !$('#qr-overlay-transparency').is(':checked'), textOverlayBorder: $('#qr-overlay-border').is(':checked'), ecLevel: 'H', minVersion: 5, symbols: symbols[$('#qr-overlay-font').val()] }) } updateQrCode()
/* globals $, symbols */ // Disable form submission (eg. via Enter key) $('form').submit(false) $('textarea, input, select').on('change keyup', function () { updateQrCode() }) const updateQrCode = function () { const size = 350 $('#error-container').hide() $('#qr').empty() $('#qr').qrcode({ render: $('input[name=qr-format]:checked').val(), width: size, height: size, size: size, color: '#3a3', text: $('#qr-data').val(), textOverlay: $('#qr-overlay').val(), textOverlayTransparency: !$('#qr-overlay-transparency').is(':checked'), textOverlayBorder: $('#qr-overlay-border').is(':checked'), ecLevel: 'H', minVersion: 5, symbols: symbols[$('#qr-overlay-font').val()] }) } // https://stackoverflow.com/a/21903119/1323144 const getUrlParameter = function (sParam) { const sPageURL = window.location.search.substring(1) const sURLVariables = sPageURL.split('&') let sParameterName let i for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('=') if (sParameterName[0] === sParam) { return typeof sParameterName[1] === 'undefined' ? true : decodeURIComponent(sParameterName[1]) } } return false } // On page load, set data+text from url param if present $(function () { const tParam = getUrlParameter('t') const dParam = getUrlParameter('d') if (tParam) { $('#qr-data').val(dParam) $('#qr-overlay').val(tParam) } // Refresh QR code updateQrCode() })
Set initial data/text values from URL param
Set initial data/text values from URL param
JavaScript
mit
olliebennett/qrupted,olliebennett/qrupted
--- +++ @@ -28,4 +28,31 @@ }) } -updateQrCode() +// https://stackoverflow.com/a/21903119/1323144 +const getUrlParameter = function (sParam) { + const sPageURL = window.location.search.substring(1) + const sURLVariables = sPageURL.split('&') + let sParameterName + let i + + for (i = 0; i < sURLVariables.length; i++) { + sParameterName = sURLVariables[i].split('=') + + if (sParameterName[0] === sParam) { + return typeof sParameterName[1] === 'undefined' ? true : decodeURIComponent(sParameterName[1]) + } + } + return false +} + +// On page load, set data+text from url param if present +$(function () { + const tParam = getUrlParameter('t') + const dParam = getUrlParameter('d') + if (tParam) { + $('#qr-data').val(dParam) + $('#qr-overlay').val(tParam) + } + // Refresh QR code + updateQrCode() +})
877843a53ded3e038445dd1c6e20dbeeb49f29ae
routes/contacts.js
routes/contacts.js
var express = require('express'); var router = express.Router(); /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/', function(req,res,next){ res.render('contacts_list') }) /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/{id}', function(req, res, next){ res.render('contact_info', {contact_id: id}) }) /* Note: this is boilerplate and has NOT been implemented yet */ router.post('/', function(req, res, next){ res.render('contacts_create', {data: req.params}) // Is this right? }) /* Note: this is boilerplate and has NOT been implemented yet */ router.put('/{id}', function(req, res, next){ res.render('contacts_update', {group_id: id, data: req.params}) // Is this right? }) /* Note: this is boilerplate and has NOT been implemented yet */ router.delete('/{id}', function(req, res, next){ res.render('contacts_delete', {group_id: id}) }) module.exports = router;
var express = require('express'); var router = express.Router(); var dbClient = require('mariasql'); /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/', function(req,res,next){ //res.render('contacts_list') }) /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/{id}', function(req, res, next){ //res.render('contact_info', {contact_id: id}) }) /* Note: this is boilerplate and has NOT been implemented yet */ router.post('/', function(req, res, next){ //res.render('contacts_create', {data: req.params}) // Is this right? // Add a random contact let client = new dbClient({ host: 'localhost', user: 'root', password: '' }); let prep = client.prepare("INSERT INTO `voluble`.`contacts` (`first_name`, `surname`, `email_address`, `default_servicechain`) VALUES (?, ?, ?, '1')") client.query(prep([req.body.first_name, req.body.surname, req.body.email_address]), function(err, rows){ if (err) throw err; console.dir(rows); }) res.send(`Inserted ${req.body.first_name} ${req.body.surname}!`); }) /* Note: this is boilerplate and has NOT been implemented yet */ router.put('/{id}', function(req, res, next){ res.render('contacts_update', {group_id: id, data: req.params}) // Is this right? }) /* Note: this is boilerplate and has NOT been implemented yet */ router.delete('/{id}', function(req, res, next){ res.render('contacts_delete', {group_id: id}) }) module.exports = router;
Add new contact to DB from POST request
Add new contact to DB from POST request
JavaScript
mit
calmcl1/voluble,calmcl1/voluble
--- +++ @@ -1,19 +1,38 @@ var express = require('express'); var router = express.Router(); +var dbClient = require('mariasql'); /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/', function(req,res,next){ - res.render('contacts_list') + //res.render('contacts_list') }) /* Note: this is boilerplate and has NOT been implemented yet */ router.get('/{id}', function(req, res, next){ - res.render('contact_info', {contact_id: id}) + //res.render('contact_info', {contact_id: id}) }) /* Note: this is boilerplate and has NOT been implemented yet */ router.post('/', function(req, res, next){ - res.render('contacts_create', {data: req.params}) // Is this right? + //res.render('contacts_create', {data: req.params}) // Is this right? + + // Add a random contact + let client = new dbClient({ + host: 'localhost', + user: 'root', + password: '' + }); + + let prep = client.prepare("INSERT INTO `voluble`.`contacts` (`first_name`, `surname`, `email_address`, `default_servicechain`) VALUES (?, ?, ?, '1')") + client.query(prep([req.body.first_name, req.body.surname, req.body.email_address]), function(err, rows){ + if (err) + throw err; + + console.dir(rows); + }) + + res.send(`Inserted ${req.body.first_name} ${req.body.surname}!`); + }) /* Note: this is boilerplate and has NOT been implemented yet */
b379c6259f0acd08011d737f9fbe70d183e74f38
config/environment.js
config/environment.js
/* jshint node: true */ module.exports = function(environment) { var ENV = { i18n: { defaultLocale: 'en', }, emblemOptions: { blueprints: false }, modulePrefix: 'irene', environment: environment, rootURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } }, APP: { // Here you can pass flags/options to your application instance // when it is created }, 'ember-simple-auth': { loginEndPoint: '/login', checkEndPoint: '/check', logoutEndPoint: '/logout' } }; if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { // Testem prefers this... ENV.locationType = 'none'; // keep test console output quieter ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; } if (environment === 'production') { } return ENV; };
/* jshint node: true */ module.exports = function(environment) { var ENV = { i18n: { defaultLocale: 'en', }, emblemOptions: { blueprints: false }, modulePrefix: 'irene', environment: environment, rootURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } }, APP: { // Here you can pass flags/options to your application instance // when it is created }, 'ember-simple-auth': { loginEndPoint: '/login', checkEndPoint: '/check', logoutEndPoint: '/logout' } }; if (environment === 'production') { ENV['ember-cli-mirage'] = { enabled: true }; } if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { // Testem prefers this... ENV.locationType = 'none'; // keep test console output quieter ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; } if (environment === 'production') { } return ENV; };
Enable mirage on production for now
Enable mirage on production for now
JavaScript
agpl-3.0
appknox/irene,appknox/irene,appknox/irene
--- +++ @@ -30,6 +30,12 @@ } }; + if (environment === 'production') { + ENV['ember-cli-mirage'] = { + enabled: true + }; + } + if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; // ENV.APP.LOG_ACTIVE_GENERATION = true;
b6e4688e9888f192920ab910bead380af72f9d1c
backend/index.js
backend/index.js
'use strict' import angular from 'angular' import ngMockE2E from 'angular-mocks/ngMockE2E' let status export default angular.module('payment.backend', [ ngMockE2E ]) .value('backend', { succeeds () { status = 200 } fails () { status = 402 } }) .run(server) .name server.$inject = ['$httpBackend'] function server ($httpBackend) { $httpBackend.whenPOST('/payments').respond(() => { return [status] }) }
'use strict' import angular from 'angular' import ngMockE2E from 'angular-mocks/ngMockE2E' let status export default angular.module('payment.backend', [ ngMockE2E ]) .value('backend', { succeeds: () => { status = 200 }, fails: () => { status = 402 } }) .run(server) .name server.$inject = ['$httpBackend'] function server ($httpBackend) { $httpBackend.whenPOST('/payments').respond(() => { return [status] }) }
Fix syntax error in backend
Fix syntax error in backend
JavaScript
mit
bendrucker/angular-payment,bendrucker/angular-payment
--- +++ @@ -9,10 +9,10 @@ ngMockE2E ]) .value('backend', { - succeeds () { + succeeds: () => { status = 200 - } - fails () { + }, + fails: () => { status = 402 } })
89627b33ec054d1690415904f201775f7551e0b1
lib/hook.js
lib/hook.js
import commands from './commands'; import { client as slackClient } from './slack'; const TEAM_DOMAIN = process.env.SLACK_TEAM_DOMAIN; const TOKEN = process.env.SLACK_COMMAND_TOKEN; const CHANNEL = process.env.SLACK_COMMAND_CHANNEL; function validate(hookData) { if (TEAM_DOMAIN !== hookData.team_domain) { return Promise.reject(new Error('Invalid team domain.')); } if (TOKEN !== hookData.token) { return Promise.reject(new Error('Invalid token.')); } if (CHANNEL !== hookData.channel_id) { return Promise.reject(new Error('Invalid channel')); } return Promise.resolve(true); } function hookRequest(req, res) { const hookData = req.body; const commandFn = commands[hookData.command]; res.set('Content-Type', 'text/plain'); if (!commandFn) { return res.send(400, 'No command given'); } validate(hookData) .then(() => res.send(200, '')) .catch((err) => res.send(500, err.message)) .then(() => commandFn(hookData)) .then((response) => slackClient().send({ channel: hookData.channel_name, text: response }) ) .catch((err) => console.error('Error processing webhook:', err)); } export default hookRequest;
import commands from './commands'; import { client as slackClient } from './slack'; const TEAM_DOMAIN = process.env.SLACK_TEAM_DOMAIN; const TOKEN = process.env.SLACK_COMMAND_TOKEN; const CHANNEL = process.env.SLACK_COMMAND_CHANNEL; function validate(hookData) { if (TEAM_DOMAIN !== hookData.team_domain) { return Promise.reject(new Error('Invalid team domain.')); } if (TOKEN !== hookData.token) { return Promise.reject(new Error('Invalid token.')); } if (CHANNEL !== hookData.channel_id) { return Promise.reject(new Error('Invalid channel')); } return Promise.resolve(true); } function hookRequest(req, res) { const hookData = req.body; const commandFn = commands[hookData.command]; res.set('Content-Type', 'text/plain'); if (!commandFn) { return res.send(400, 'No command given'); } validate(hookData) .then(() => res.send(200, 'Ok, processing.')) .catch((err) => res.send(500, err.message)) .then(() => commandFn(hookData)) .then((response) => slackClient().send({ channel: hookData.channel_name, text: response }) ) .catch((err) => console.error('Error processing webhook:', err)); } export default hookRequest;
Add acknowledgement about command processing
Add acknowledgement about command processing
JavaScript
mit
Mumakil/slack-gh-extras
--- +++ @@ -27,7 +27,7 @@ return res.send(400, 'No command given'); } validate(hookData) - .then(() => res.send(200, '')) + .then(() => res.send(200, 'Ok, processing.')) .catch((err) => res.send(500, err.message)) .then(() => commandFn(hookData)) .then((response) =>
95ac93c4fe043b66f328be1262c3e56977a56053
config/ember.js
config/ember.js
module.exports = { extends: [ 'plugin:ember/recommended', require.resolve('./base.js') ], env: { 'browser': true }, rules: { 'new-cap': [ 'error', { 'capIsNewExceptions': [ 'A' ] } ], // Custom rules 'ember/no-empty-attrs': 'error', // We actually do not want to turn this rule off. However, // the current rule has a bug. This rule does not take into // account the new module import syntax. Until this is fixed, // this rule should be turned off. 'ember/no-global-jquery': 'off' } };
module.exports = { extends: [ 'plugin:ember/recommended', require.resolve('./base.js') ], env: { 'browser': true }, rules: { 'new-cap': [ 'error', { 'capIsNewExceptions': [ 'A' ] } ], 'no-console': [ 'error', { 'allow': [ 'warn', 'error' ] } ], // Custom rules 'ember/no-empty-attrs': 'error', // We actually do not want to turn this rule off. However, // the current rule has a bug. This rule does not take into // account the new module import syntax. Until this is fixed, // this rule should be turned off. 'ember/no-global-jquery': 'off' } };
Update no-console rule for Ember
Update no-console rule for Ember Ember is getting rid of the logger, which really was just a thing wrapper around the console and existed to patch up cross-browser inconsistencies. So, modify the rule so we can use console directly for warnings and errors, but we still assume logs are dev artifacts that should not be checked in.
JavaScript
mit
PatentNavigation/eslint-plugin-turbopatent
--- +++ @@ -8,6 +8,7 @@ }, rules: { 'new-cap': [ 'error', { 'capIsNewExceptions': [ 'A' ] } ], + 'no-console': [ 'error', { 'allow': [ 'warn', 'error' ] } ], // Custom rules 'ember/no-empty-attrs': 'error',
546e077d06a1f2633ee320309ea335ad425ed2e9
sashimi-webapp/src/router/index.js
sashimi-webapp/src/router/index.js
import Vue from 'vue'; import Router from 'vue-router'; import FileManager from 'components/file-manager/FileManager'; import Content from 'components/editor-viewer/Content'; Vue.use(Router); export default new Router({ routes: [ { path: '/', name: 'fileManager', component: FileManager, }, { path: '/content', name: 'Content', component: Content, }, ], });
import Vue from 'vue'; import Router from 'vue-router'; import FileManager from 'components/file-manager/FileManager'; import Content from 'components/editor-viewer/Content'; Vue.use(Router); export default new Router({ mode: 'history', scrollBehavior(to, from, savedPosition) { if (to.hash) { return { selector: to.hash }; } else { return { x: 0, y: 0 }; } }, routes: [ { path: '/', name: 'fileManager', component: FileManager, }, { path: '/content', name: 'Content', component: Content, }, ], });
Change vue router to use history mode
Change vue router to use history mode
JavaScript
mit
nus-mtp/sashimi-note,nus-mtp/sashimi-note,nus-mtp/sashimi-note
--- +++ @@ -6,6 +6,14 @@ Vue.use(Router); export default new Router({ + mode: 'history', + scrollBehavior(to, from, savedPosition) { + if (to.hash) { + return { selector: to.hash }; + } else { + return { x: 0, y: 0 }; + } + }, routes: [ { path: '/',
ab6cf9ec0c75acecd2ced9c1558a6e93536e6957
test/renderer/epics/theming-spec.js
test/renderer/epics/theming-spec.js
import { expect } from 'chai'; import { setTheme, setStoredThemeObservable, } from '../../../src/notebook/epics/theming'; describe('setTheme', () => { it('creates an action of type SET_THEME with a theme', () => { expect(setTheme('disco')).to.deep.equal({type: 'SET_THEME', theme: 'disco'}) }); }); describe('setStoredThemeObservable', () => { it('returns an observable', () => { const setStoredThemeObs = setStoredThemeObservable('disco'); expect(setStoredThemeObs.subscribe).to.not.be.null; }); });
import chai, { expect } from 'chai'; import sinon from 'sinon'; import sinonChai from 'sinon-chai'; chai.use(sinonChai); import { setTheme, setStoredThemeObservable, } from '../../../src/notebook/epics/theming'; import storage from 'electron-json-storage'; describe('setTheme', () => { it('creates an action of type SET_THEME with a theme', () => { expect(setTheme('disco')).to.deep.equal({type: 'SET_THEME', theme: 'disco'}) }); }); describe('setStoredThemeObservable', () => { it('returns an observable', () => { const setStoredThemeObs = setStoredThemeObservable('disco'); expect(setStoredThemeObs.subscribe).to.not.be.null; }); it('should set the value in the store', (done) => { const setStoredThemeObs = setStoredThemeObservable('disco'); const set = sinon.spy(storage, 'set'); setStoredThemeObs.subscribe(() => { expect(set).to.be.called; done(); }); }); it('should return an error if not given a theme', (done) => { const setStoredThemeObs = setStoredThemeObservable(); const set = sinon.spy(storage, 'set'); setStoredThemeObs.subscribe(() => { throw new Error('Observable invalidly set theme.'); }, (error) => { expect(set).to.be.called; expect(error.message).to.equal('Must provide JSON and key'); }); done(); }); });
Add tests for error in setTheme
test(themeSpec): Add tests for error in setTheme
JavaScript
bsd-3-clause
jdetle/nteract,rgbkrk/nteract,jdfreder/nteract,jdetle/nteract,nteract/composition,captainsafia/nteract,0u812/nteract,nteract/nteract,captainsafia/nteract,jdfreder/nteract,rgbkrk/nteract,nteract/nteract,jdetle/nteract,nteract/nteract,rgbkrk/nteract,rgbkrk/nteract,nteract/composition,jdetle/nteract,jdfreder/nteract,captainsafia/nteract,nteract/nteract,temogen/nteract,temogen/nteract,nteract/composition,0u812/nteract,jdfreder/nteract,0u812/nteract,rgbkrk/nteract,temogen/nteract,captainsafia/nteract,0u812/nteract,nteract/nteract
--- +++ @@ -1,9 +1,16 @@ -import { expect } from 'chai'; +import chai, { expect } from 'chai'; + +import sinon from 'sinon'; +import sinonChai from 'sinon-chai'; + +chai.use(sinonChai); import { setTheme, setStoredThemeObservable, } from '../../../src/notebook/epics/theming'; + +import storage from 'electron-json-storage'; describe('setTheme', () => { it('creates an action of type SET_THEME with a theme', () => { @@ -16,4 +23,26 @@ const setStoredThemeObs = setStoredThemeObservable('disco'); expect(setStoredThemeObs.subscribe).to.not.be.null; }); + it('should set the value in the store', (done) => { + const setStoredThemeObs = setStoredThemeObservable('disco'); + const set = sinon.spy(storage, 'set'); + + setStoredThemeObs.subscribe(() => { + expect(set).to.be.called; + done(); + }); + }); + it('should return an error if not given a theme', (done) => { + const setStoredThemeObs = setStoredThemeObservable(); + const set = sinon.spy(storage, 'set'); + + setStoredThemeObs.subscribe(() => { + throw new Error('Observable invalidly set theme.'); + }, (error) => { + expect(set).to.be.called; + expect(error.message).to.equal('Must provide JSON and key'); + }); + + done(); + }); });
9621b269deddef4cb138709b1d7ef8a0e61b73ce
database/models/user.js
database/models/user.js
// models/shift.js start(); function start () { 'use strict'; const mongoose = require('mongoose'); const ItemSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true }, password: { type: String, required: true }, }); const User = mongoose.model('User', ItemSchema); module.exports = User; }
"use strict"; const mongoose = require("mongoose"); const ItemSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true }, password: { type: String, required: true }, email: { type: String, required: false }, firstName: { type: String, required: false }, lastName: { type: String, required: false } }); const User = mongoose.model("User", ItemSchema); module.exports = User;
Add email and name fields to the database User model
Add email and name fields to the database User model
JavaScript
apache-2.0
ailijic/era-floor-time,ailijic/era-floor-time
--- +++ @@ -1,17 +1,15 @@ -// models/shift.js +"use strict"; -start(); -function start () { - 'use strict'; +const mongoose = require("mongoose"); - const mongoose = require('mongoose'); - - const ItemSchema = new mongoose.Schema({ - username: { type: String, required: true, unique: true }, - password: { type: String, required: true }, - }); - - const User = mongoose.model('User', ItemSchema); - - module.exports = User; -} +const ItemSchema = new mongoose.Schema({ + username: { type: String, required: true, unique: true }, + password: { type: String, required: true }, + email: { type: String, required: false }, + firstName: { type: String, required: false }, + lastName: { type: String, required: false } +}); + +const User = mongoose.model("User", ItemSchema); + +module.exports = User;
29384297a1926e4d9335602e6a43cec36de3932c
src/scripts/composition/config.js
src/scripts/composition/config.js
export const CLASSNAME = 'list-graph'; export const SCROLLBAR_WIDTH = 6; export const COLUMNS = 5; export const ROWS = 5; // An empty path is equal to inline SVG. export const ICON_PATH = ''; // -1 = desc, 1 = asc export const DEFAULT_SORT_ORDER = -1; export const DEFAULT_BAR_MODE = 'one'; export const HIGHLIGHT_ACTIVE_LEVEL = true; export const ACTIVE_LEVEL = 0; export const NO_ROOT_ACTIVE_LEVEL_DIFF = 0; export const QUERYING = false; export const HIDE_OUTWARDS_LINKS = false; export const TRANSITION_LIGHTNING_FAST = 150; export const TRANSITION_FAST = 200; export const TRANSITION_SEMI_FAST = 250; export const TRANSITION_NORMAL = 333; export const TRANSITION_SLOW = 666; export const TRANSITION_SLOWEST = 1; // Gradient colors export const COLOR_ORANGE = '#f23e00'; export const COLOR_NEGATIVE_RED = '#e0001c'; export const COLOR_POSITIVE_GREEN = '#60bf00';
export const CLASSNAME = 'list-graph'; export const SCROLLBAR_WIDTH = 6; export const COLUMNS = 5; export const ROWS = 5; // An empty path is equal to inline SVG. export const ICON_PATH = ''; // -1 = desc, 1 = asc export const DEFAULT_SORT_ORDER = -1; export const DEFAULT_BAR_MODE = 'one'; export const HIGHLIGHT_ACTIVE_LEVEL = true; export const ACTIVE_LEVEL = 0; export const NO_ROOT_ACTIVE_LEVEL_DIFF = 0; export const QUERYING = false; export const HIDE_OUTWARDS_LINKS = false; export const SHOW_LINK_LOCATION = false; export const TRANSITION_LIGHTNING_FAST = 150; export const TRANSITION_FAST = 200; export const TRANSITION_SEMI_FAST = 250; export const TRANSITION_NORMAL = 333; export const TRANSITION_SLOW = 666; export const TRANSITION_SLOWEST = 1; // Gradient colors export const COLOR_ORANGE = '#f23e00'; export const COLOR_NEGATIVE_RED = '#e0001c'; export const COLOR_POSITIVE_GREEN = '#60bf00';
Add an option to show the location of where hidden links point to.
Add an option to show the location of where hidden links point to.
JavaScript
mit
flekschas/d3-list-graph,flekschas/d3-list-graph
--- +++ @@ -17,6 +17,7 @@ export const NO_ROOT_ACTIVE_LEVEL_DIFF = 0; export const QUERYING = false; export const HIDE_OUTWARDS_LINKS = false; +export const SHOW_LINK_LOCATION = false; export const TRANSITION_LIGHTNING_FAST = 150; export const TRANSITION_FAST = 200;
db119a7e04a3719c1b0c0ef295de8d011bdffd0f
stats.js
stats.js
/** * @file stat.js * @license MIT * @copyright 2017 Karim Alibhai. */ const fs = require('fs') const chalk = require('chalk') const solver = require('solver') const tools = process.env.TOOLS.split(',') const results = {} const colors = { gulp: 'magenta', grunt: 'yellow', fly: 'blue', brunch: 'green' } let max = [Infinity, [undefined]] function bold(str, should) { if (should) { return chalk.underline(chalk.bold(str)) } return str } tools .map(tool => { results[tool] = solver.data( fs.readFileSync(`${__dirname}/${tool}/bench.log`, 'utf8') .split(/\r?\n/g) .filter(n => !isNaN(+n)) .map(n => +n) ) return tool }) .sort((a, b) => (+results[a].average() > +results[b].average())) .map(tool => { console.log(' ' + chalk[colors[tool]](tool) + ' ' + bold('average: %s ns', max[1].indexOf(tool) !== -1), results[tool].average()) console.log(' ' + chalk[colors[tool]](tool) + ' ' + bold('deviation: %s%', max[1].indexOf(tool) !== -1), results[tool].deviation().relative * 100) console.log('') })
/** * @file stat.js * @license MIT * @copyright 2017 Karim Alibhai. */ 'use strict' const fs = require('fs') const chalk = require('chalk') const solver = require('solver') const tools = process.env.TOOLS.split(',') const results = {} const colors = { gulp: 'magenta', grunt: 'yellow', fly: 'blue', brunch: 'green' } let max = [Infinity, [undefined]] function bold(str, should) { if (should) { return chalk.underline(chalk.bold(str)) } return str } tools .map(tool => { results[tool] = solver.data( fs.readFileSync(`${__dirname}/${tool}/bench.log`, 'utf8') .split(/\r?\n/g) .filter(n => !isNaN(+n)) .map(n => +n) ) return tool }) .sort((a, b) => (+results[a].average() > +results[b].average())) .map(tool => { console.log(' ' + chalk[colors[tool]](tool) + ' ' + bold('average: %s ns', max[1].indexOf(tool) !== -1), results[tool].average()) console.log(' ' + chalk[colors[tool]](tool) + ' ' + bold('deviation: %s%', max[1].indexOf(tool) !== -1), results[tool].deviation().relative * 100) console.log('') })
Add explicit use strict for node v4
Add explicit use strict for node v4
JavaScript
mit
karimsa/buildjs-benchmarks,karimsa/buildjs-benchmarks
--- +++ @@ -3,6 +3,8 @@ * @license MIT * @copyright 2017 Karim Alibhai. */ + +'use strict' const fs = require('fs') const chalk = require('chalk')
08d845f5353f8e6688c97702bc11c756b3719d50
src/database/DataTypes/Sensor.js
src/database/DataTypes/Sensor.js
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2020 */ import Realm from 'realm'; export class Sensor extends Realm.Object {} Sensor.schema = { name: 'Sensor', primaryKey: 'id', properties: { id: 'string', macAddress: { type: 'string', optional: true }, name: { type: 'string', optional: true }, batteryLevel: { type: 'double', default: 0 }, sensorLogs: { type: 'linkingObjects', objectType: 'SensorLog', property: 'sensor' }, }, }; export default Sensor;
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2020 */ import Realm from 'realm'; import { NativeModules } from 'react-native'; const { BleManager } = NativeModules; const BLUE_MAESTRO_ID = 307; export class Sensor extends Realm.Object { static async startScan(macAddress = '') { return BleManager.getDevices(BLUE_MAESTRO_ID, macAddress); } async sendCommand(command) { return BleManager.sendCommand(BLUE_MAESTRO_ID, this.macAddress, command); } async blink() { return this.sendCommand('*blink'); } async resetLogFrequency() { return this.sendCommand('*lint300'); } async resetAdvertisementFrequency() { return this.sendCommand('*sadv1000'); } async downloadLogs() { return this.sendCommand('*logall'); } } Sensor.schema = { name: 'Sensor', primaryKey: 'id', properties: { id: 'string', macAddress: { type: 'string', optional: true }, name: { type: 'string', optional: true }, batteryLevel: { type: 'double', default: 0 }, sensorLogs: { type: 'linkingObjects', objectType: 'SensorLog', property: 'sensor' }, }, }; export default Sensor;
Add sensor native module methods
Add sensor native module methods
JavaScript
mit
sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile
--- +++ @@ -4,8 +4,37 @@ */ import Realm from 'realm'; +import { NativeModules } from 'react-native'; -export class Sensor extends Realm.Object {} +const { BleManager } = NativeModules; + +const BLUE_MAESTRO_ID = 307; + +export class Sensor extends Realm.Object { + static async startScan(macAddress = '') { + return BleManager.getDevices(BLUE_MAESTRO_ID, macAddress); + } + + async sendCommand(command) { + return BleManager.sendCommand(BLUE_MAESTRO_ID, this.macAddress, command); + } + + async blink() { + return this.sendCommand('*blink'); + } + + async resetLogFrequency() { + return this.sendCommand('*lint300'); + } + + async resetAdvertisementFrequency() { + return this.sendCommand('*sadv1000'); + } + + async downloadLogs() { + return this.sendCommand('*logall'); + } +} Sensor.schema = { name: 'Sensor',
a6a76f95e2db94e9644c0eeff44d67c354e79a99
Resources/public/js/views/plugins/dp-dashboardblockrandomgifplugin.js
Resources/public/js/views/plugins/dp-dashboardblockrandomgifplugin.js
YUI.add('dp-dashboardblockrandomgifplugin', function (Y) { Y.namespace('DP'); Y.DP.DashboardBlockRandomGifPlugin = Y.Base.create('dpDashboardBlockRandomGifPlugin', Y.Plugin.Base, [], { initializer: function () { this.get('host').addBlock( new Y.DP.DashboardBlockRandomGifView({ priority: 100 }) ); }, }, { NS: 'dpDashboardBlockRandomGifPlugin', }); Y.eZ.PluginRegistry.registerPlugin( Y.DP.DashboardBlockRandomGifPlugin, ['dashboardBlocksView'] ); });
YUI.add('dp-dashboardblockrandomgifplugin', function (Y) { Y.namespace('DP'); Y.DP.DashboardBlockRandomGifPlugin = Y.Base.create('dpDashboardBlockRandomGifPlugin', Y.Plugin.Base, [], { initializer: function () { this.get('host').addBlock( new Y.DP.DashboardBlockRandomGifView({ priority: 2000 }) ); }, }, { NS: 'dpDashboardBlockRandomGifPlugin', }); Y.eZ.PluginRegistry.registerPlugin( Y.DP.DashboardBlockRandomGifPlugin, ['dashboardBlocksView'] ); });
Make sure the random gif dashboard block is the first one
Make sure the random gif dashboard block is the first one
JavaScript
mit
dpobel/PlatformUIExtensionSkeletonBundle,dpobel/PlatformUIExtensionSkeletonBundle,dpobel/PlatformUIExtensionSkeletonBundle
--- +++ @@ -6,7 +6,7 @@ initializer: function () { this.get('host').addBlock( new Y.DP.DashboardBlockRandomGifView({ - priority: 100 + priority: 2000 }) ); },
58d6666e254c87ace1be21f6b759dd67e17377ae
src/components/VideoPreviewsList.js
src/components/VideoPreviewsList.js
import React, { Component } from 'react'; import VideoPreview from './VideoPreview'; class VideoPreviewsList extends Component { render() { return ( <div></div> ); } } VideoPreviewsList.propTypes = { } export default VideoPreviewsList;
import React, { Component } from 'react'; import VideoPreview from './VideoPreview'; class VideoPreviewsList extends Component { render() { return ( <ul className="VideoPreviewsList"> {this.props.videoPreviews.map((videoPreview, index) => () <li key={index}> <VideoPreview {...videoPreview} /> <li> ))} </ul> ); } } VideoPreviewsList.propTypes = { videosPreviews: React.PropTypes.arrayOf( React.PropTypes.shape({ videoId: React.PropTypes.string.isRequired, videoTitle: React.PropTypes.string.isRequired, videoDescription: React.PropTypes.string.isRequired, }).isRequired ).isRequired } export default VideoPreviewsList;
Add Proptypes and expand previewslist
Add Proptypes and expand previewslist
JavaScript
mit
mg4tv/mg4tv-web,mg4tv/mg4tv-web
--- +++ @@ -6,13 +6,25 @@ class VideoPreviewsList extends Component { render() { return ( - <div></div> + <ul className="VideoPreviewsList"> + {this.props.videoPreviews.map((videoPreview, index) => () + <li key={index}> + <VideoPreview {...videoPreview} /> + <li> + ))} + </ul> ); } } VideoPreviewsList.propTypes = { + videosPreviews: React.PropTypes.arrayOf( + React.PropTypes.shape({ + videoId: React.PropTypes.string.isRequired, + videoTitle: React.PropTypes.string.isRequired, + videoDescription: React.PropTypes.string.isRequired, + }).isRequired + ).isRequired } export default VideoPreviewsList; -
6965b58949355c234af605b6b63fdee531845ebc
src/ContentBlocks/BlockParagraph/sizing.js
src/ContentBlocks/BlockParagraph/sizing.js
export const sizing = (textSize, align) => ({ p: { props: { size: textSize, margin: 'small', align, style: { marginTop: 0, }, }, }, h1: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h2: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h3: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h4: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h5: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, });
export const sizing = (textSize, align) => ({ a: { props: { target: '_blank', }, }, p: { props: { size: textSize, margin: 'small', align, style: { marginTop: 0, }, }, }, h1: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h2: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h3: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h4: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, h5: { props: { margin: 'small', align, style: { marginTop: 0, }, }, }, });
Add target blank for anchors in paragraph block.
Add target blank for anchors in paragraph block.
JavaScript
apache-2.0
grommet/grommet-cms-content-blocks,grommet/grommet-cms-content-blocks
--- +++ @@ -1,4 +1,9 @@ export const sizing = (textSize, align) => ({ + a: { + props: { + target: '_blank', + }, + }, p: { props: { size: textSize,
4378d25b3aa5daa21750ee150213e5118c8f8633
listener.js
listener.js
var Ripple = require('ripple-lib') var request = require('request') var address = process.env.RIPPLE_ADDRESS || 'rwqhRo41zXZKooNbDNUqQ5dTRrQPQ1BDF7' var lastTxId = process.env.LAST_TX_ID || 'E0785E2C6F7A7F84E03B05635A15C4992EA65532D650FF5CB4CE18BA3707DAD8'; function getNextNotification() { base = 'http://simple-ripple-listener.herokuapp.com/api/v1/'; url = base + 'address/' + address + '/next_notification/' + lastTxId; request.get({ url: url, json: true }, function(err, resp, body) { if (body.notification) { lastTxId = body.notification.txHash; console.log('got a new notification!'); console.log(body.notification); handleNewNotification(body.notification); } else { console.log('no payments, sleep 2 sec'); setTimeout(getNextNotification, 2000); } }) } function handleNewNotification(notification) { console.log(notification); getNextNotification(); } getNextNotification();
var Ripple = require('ripple-lib') var request = require('request') var address = process.env.RIPPLE_ADDRESS; var lastTxId = process.env.LAST_TX_ID; function getNextNotification() { base = 'http://simple-ripple-listener.herokuapp.com/api/v1/'; url = base + 'address/' + address + '/next_notification/' + lastTxId; request.get({ url: url, json: true }, function(err, resp, body) { if (body.notification) { lastTxId = body.notification.txHash; handleNewNotification(body.notification); getNextNotification(); } else { setTimeout(getNextNotification, 2000); } }) } function handleNewNotification(notification) { // Inbound // -- Create ripple transaction // Outbound // -- Find and update ripple transaction console.log(notification); } getNextNotification();
Add function to handle new ripple notifications
[FEATURE] Add function to handle new ripple notifications
JavaScript
isc
crazyquark/gatewayd,xdv/gatewayd,xdv/gatewayd,crazyquark/gatewayd,Parkjeahwan/awegeeks,zealord/gatewayd,whotooktwarden/gatewayd,Parkjeahwan/awegeeks,zealord/gatewayd,whotooktwarden/gatewayd
--- +++ @@ -1,8 +1,8 @@ var Ripple = require('ripple-lib') var request = require('request') -var address = process.env.RIPPLE_ADDRESS || 'rwqhRo41zXZKooNbDNUqQ5dTRrQPQ1BDF7' -var lastTxId = process.env.LAST_TX_ID || 'E0785E2C6F7A7F84E03B05635A15C4992EA65532D650FF5CB4CE18BA3707DAD8'; +var address = process.env.RIPPLE_ADDRESS; +var lastTxId = process.env.LAST_TX_ID; function getNextNotification() { base = 'http://simple-ripple-listener.herokuapp.com/api/v1/'; @@ -10,19 +10,22 @@ request.get({ url: url, json: true }, function(err, resp, body) { if (body.notification) { lastTxId = body.notification.txHash; - console.log('got a new notification!'); - console.log(body.notification); handleNewNotification(body.notification); + getNextNotification(); } else { - console.log('no payments, sleep 2 sec'); setTimeout(getNextNotification, 2000); } }) } function handleNewNotification(notification) { + // Inbound + // -- Create ripple transaction + + // Outbound + // -- Find and update ripple transaction + console.log(notification); - getNextNotification(); } getNextNotification();
50199118519cd8efffb3f2d04370d19460e2bac7
lib/smooth-scroller.js
lib/smooth-scroller.js
//smooth-scroller.js (function($) { $.fn.smoothScroller = function(options) { options = $.extend({}, $.fn.smoothScroller.defaults, options); var el = $(this); $(options.scrollEl).animate({ scrollTop: el.offset().top - $(options.scrollEl).offset().top - options.offset }, options.speed, options.ease, function() { var hash = el.attr('id'); if(hash.length) { if(history.pushState) { history.pushState(null, null, '#' + hash); } else { document.location.hash = hash; } } el.trigger('smoothScrollerComplete'); }); return this; }; $.fn.smoothScroller.defaults = { speed: 400, ease: 'swing', scrollEl: 'body', offset: 0 }; $('body').on('click', '[data-smoothscroller]', function(e) { e.preventDefault(); var href = $(this).attr('href'); if(href.indexOf('#') === 0) { $(href).smoothScroller(); } }); }(jQuery));
//smooth-scroller.js (function($) { $.fn.smoothScroller = function(options) { options = $.extend({}, $.fn.smoothScroller.defaults, options); var el = $(this); $(options.scrollEl).animate({ scrollTop: el.offset().top - $(options.scrollEl).offset().top - options.offset }, options.speed, options.ease, function() { var hash = el.attr('id'); if(hash.length) { if(history.pushState) { history.pushState(null, null, '#' + hash); } else { document.location.hash = hash; } } el.trigger('smoothScrollerComplete'); }); return this; }; $.fn.smoothScroller.defaults = { speed: 400, ease: 'swing', scrollEl: 'body,html', offset: 0 }; $('body').on('click', '[data-smoothscroller]', function(e) { e.preventDefault(); var href = $(this).attr('href'); if(href.indexOf('#') === 0) { $(href).smoothScroller(); } }); }(jQuery));
Add html to scrollEl param to fix FF
Add html to scrollEl param to fix FF
JavaScript
mit
firstandthird/smooth-scroller,firstandthird/smooth-scroller
--- +++ @@ -27,7 +27,7 @@ $.fn.smoothScroller.defaults = { speed: 400, ease: 'swing', - scrollEl: 'body', + scrollEl: 'body,html', offset: 0 };
9c549c9d16869c3ed280e7a2f4c57c10f701a1d5
package.js
package.js
Package.describe({ summary: "JavaScript.next-to-JavaScript-of-today compiler", version: "0.0.42" }); Package._transitional_registerBuildPlugin({ name: "harmony-compiler", use: [], sources: [ "plugin/compiler.js" ], npmDependencies: {"traceur": "0.0.42"} }); Package.on_use(function(api, where) { where = where || ['client', 'server']; // The location of this runtime file is not supposed to change: // https://github.com/google/traceur-compiler/commit/49ad82f89c593b12ac0bcdfcfd05028e79676c78 api.add_files(".npm/plugin/harmony-compiler/node_modules/traceur/bin/traceur-runtime.js", where); }); // Package.on_test(function (api) { // api.use(["harmony", "tinytest"]); // api.add_files("tests/test.js", ["client"]); // api.add_files([ // ], ["client", "server"]); // });
Package.describe({ summary: "JavaScript.next-to-JavaScript-of-today compiler", version: "0.0.42" }); Package._transitional_registerBuildPlugin({ name: "harmony-compiler", use: [], sources: [ "plugin/compiler.js" ], npmDependencies: {"traceur": "0.0.42"} }); Package.on_use(function(api, where) { where = where || ['client', 'server']; // The location of this runtime file is not supposed to change: // http://git.io/B2s0Tg api.add_files(".npm/plugin/harmony-compiler/node_modules/traceur/bin/traceur-runtime.js", where); }); // Package.on_test(function (api) { // api.use(["harmony", "tinytest"]); // api.add_files("tests/test.js", ["client"]); // api.add_files([ // ], ["client", "server"]); // });
Use GitHub link shortener for comment link
Use GitHub link shortener for comment link This makes the link a bit easier to copy/paste, but more importantly reduces the line width to a more manageable size.
JavaScript
mit
mquandalle/meteor-harmony
--- +++ @@ -16,7 +16,7 @@ where = where || ['client', 'server']; // The location of this runtime file is not supposed to change: - // https://github.com/google/traceur-compiler/commit/49ad82f89c593b12ac0bcdfcfd05028e79676c78 + // http://git.io/B2s0Tg api.add_files(".npm/plugin/harmony-compiler/node_modules/traceur/bin/traceur-runtime.js", where); });
90004ee5842cbca74fe9fd55b3abc6c6eac8c72c
src/components/u-menu.vue/index.js
src/components/u-menu.vue/index.js
import MSinglex from '../m-singlex.vue'; export const UMenu = { name: 'u-menu', groupName: 'u-menu-group', childName: 'u-menu-item', extends: MSinglex, props: { router: { type: Boolean, default: true }, }, data() { return { parentVM: undefined, }; }, created() { let popperChildVM = this.$parent; while (popperChildVM && popperChildVM.$options.name !== 'm-popper-child') popperChildVM = popperChildVM.$parent; if (popperChildVM && popperChildVM.parentVM) this.parentVM = popperChildVM.parentVM; this.$on('select', ({ itemVM }) => { this.router && itemVM.navigate(); // this.parentVM && this.parentVM.toggle(false); }); }, }; export { UMenuItem } from './item.vue'; export { UMenuGroup } from './group.vue'; export { UMenuDivider } from './divider.vue'; export default UMenu;
import MSinglex from '../m-singlex.vue'; export const UMenu = { name: 'u-menu', groupName: 'u-menu-group', childName: 'u-menu-item', extends: MSinglex, props: { router: { type: Boolean, default: true }, }, data() { return { parentVM: undefined, }; }, created() { this.$on('select', ({ itemVM }) => { this.router && itemVM.navigate(); this.$parent && this.$parent.close && this.$parent.close(); }); }, }; export { UMenuItem } from './item.vue'; export { UMenuGroup } from './group.vue'; export { UMenuDivider } from './divider.vue'; export default UMenu;
Fix popper close after clicking <u-menu>
:bug: Fix popper close after clicking <u-menu>
JavaScript
mit
vusion/proto-ui,vusion/proto-ui
--- +++ @@ -14,15 +14,9 @@ }; }, created() { - let popperChildVM = this.$parent; - while (popperChildVM && popperChildVM.$options.name !== 'm-popper-child') - popperChildVM = popperChildVM.$parent; - if (popperChildVM && popperChildVM.parentVM) - this.parentVM = popperChildVM.parentVM; - this.$on('select', ({ itemVM }) => { this.router && itemVM.navigate(); - // this.parentVM && this.parentVM.toggle(false); + this.$parent && this.$parent.close && this.$parent.close(); }); }, };
18451a5998564b653651700981a6d3d9720cfa9a
src/lib/backpack/jpeg-thumbnail.js
src/lib/backpack/jpeg-thumbnail.js
const jpegThumbnail = dataUrl => new Promise((resolve, reject) => { const image = new Image(); image.onload = () => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const maxDimension = 96; // 3x the maximum displayed size of 32px if (image.height < 1 || image.width < 1) { canvas.width = canvas.height = maxDimension; // drawImage can fail if image height/width is less than 1 // Use blank image; the costume is too small to render anyway ctx.fillStyle = 'white'; // Create white background, since jpeg doesn't have transparency ctx.fillRect(0, 0, maxDimension, maxDimension); } else { if (image.height > image.width) { canvas.height = maxDimension; canvas.width = (maxDimension / image.height) * image.width; } else { canvas.width = maxDimension; canvas.height = (maxDimension / image.width) * image.height; } ctx.fillStyle = 'white'; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.drawImage(image, 0, 0, canvas.width, canvas.height); } resolve(canvas.toDataURL('image/jpeg', 0.92 /* quality */)); // Default quality is 0.92 }; image.onerror = err => { reject(err); }; image.src = dataUrl; }); export default jpegThumbnail;
const jpegThumbnail = dataUrl => new Promise((resolve, reject) => { const image = new Image(); image.onload = () => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const maxDimension = 96; // 3x the maximum displayed size of 32px if (image.height < 1 || image.width < 1) { canvas.width = canvas.height = maxDimension; // drawImage can fail if image height/width is less than 1 // Use blank image; the costume is too small to render anyway ctx.fillStyle = 'white'; // Create white background, since jpeg doesn't have transparency ctx.fillRect(0, 0, canvas.width, canvas.height); } else { if (image.height > image.width) { canvas.height = maxDimension; canvas.width = (maxDimension / image.height) * image.width; } else { canvas.width = maxDimension; canvas.height = (maxDimension / image.width) * image.height; } ctx.fillStyle = 'white'; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.drawImage(image, 0, 0, canvas.width, canvas.height); } resolve(canvas.toDataURL('image/jpeg', 0.92 /* quality */)); // Default quality is 0.92 }; image.onerror = err => { reject(err); }; image.src = dataUrl; }); export default jpegThumbnail;
Use canvas width/height for futureproofing
Use canvas width/height for futureproofing
JavaScript
bsd-3-clause
LLK/scratch-gui,LLK/scratch-gui
--- +++ @@ -11,7 +11,7 @@ // drawImage can fail if image height/width is less than 1 // Use blank image; the costume is too small to render anyway ctx.fillStyle = 'white'; // Create white background, since jpeg doesn't have transparency - ctx.fillRect(0, 0, maxDimension, maxDimension); + ctx.fillRect(0, 0, canvas.width, canvas.height); } else { if (image.height > image.width) { canvas.height = maxDimension;
2a2b71f08c6c0d22847ba90eb0bc597c30cffae9
penrose.js
penrose.js
(function(){ var tilingEl = document.getElementById('penrose-tiling') , outerRadius = 0.9 , innerRadius = outerRadius * Math.sin(18 * Math.PI / 180) , top = innerRadius , bottom = -innerRadius , left = -outerRadius , right = outerRadius ; tilingEl.innerHTML="<path d='M " + left + " 0 L 0 " + top + " L " + right + " 0 L 0 " + bottom + " z' fill='orange' />"; })();
(function(){ var a18 = 18 * Math.PI / 180 , sin18 = Math.sin(a18) , narrowDiamondMarkup = "<path d='M -1 0 L 0 " + sin18 + " L 1 0 L 0 -" + sin18 + " z' fill='orange' vector-effect='non-scaling-stroke' stroke='black' />" , tilingEl = document.getElementById('penrose-tiling') ; tilingEl.innerHTML = narrowDiamondMarkup; })();
Add border stroke to shape
Add border stroke to shape
JavaScript
mit
stevecj/penrose.js,stevecj/penrose.js
--- +++ @@ -1,11 +1,9 @@ (function(){ - var tilingEl = document.getElementById('penrose-tiling') - , outerRadius = 0.9 - , innerRadius = outerRadius * Math.sin(18 * Math.PI / 180) - , top = innerRadius - , bottom = -innerRadius - , left = -outerRadius - , right = outerRadius + var a18 = 18 * Math.PI / 180 + , sin18 = Math.sin(a18) + , narrowDiamondMarkup = + "<path d='M -1 0 L 0 " + sin18 + " L 1 0 L 0 -" + sin18 + " z' fill='orange' vector-effect='non-scaling-stroke' stroke='black' />" + , tilingEl = document.getElementById('penrose-tiling') ; - tilingEl.innerHTML="<path d='M " + left + " 0 L 0 " + top + " L " + right + " 0 L 0 " + bottom + " z' fill='orange' />"; + tilingEl.innerHTML = narrowDiamondMarkup; })();
1d4a92046b471061afe6b8cdef284927ffeab401
tests/dummy/config/environment.js
tests/dummy/config/environment.js
/* jshint node: true */ module.exports = function(environment) { var ENV = { modulePrefix: 'dummy', environment: environment, baseURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } }, APP: { // Here you can pass flags/options to your application instance // when it is created }, 'ember-cli-toggle': { //includedThemes: ['light', 'ios', 'flip'], //excludedThemes: ['flip'], //defaultTheme: 'light', //defaultSize: 'small' } }; if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { // Testem prefers this... ENV.baseURL = '/'; ENV.locationType = 'auto'; // keep test console output quieter ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; } if (environment === 'production') { } return ENV; };
/* jshint node: true */ module.exports = function(environment) { var ENV = { modulePrefix: 'dummy', environment: environment, baseURL: '/ember-cli-toggle', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true } }, APP: { // Here you can pass flags/options to your application instance // when it is created }, 'ember-cli-toggle': { //includedThemes: ['light', 'ios', 'flip'], //excludedThemes: ['flip'], //defaultTheme: 'light', //defaultSize: 'small' } }; if (environment === 'development') { // ENV.APP.LOG_RESOLVER = true; ENV.APP.LOG_ACTIVE_GENERATION = true; // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; ENV.APP.LOG_VIEW_LOOKUPS = true; } if (environment === 'test') { // Testem prefers this... ENV.baseURL = '/'; ENV.locationType = 'auto'; // keep test console output quieter ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; } if (environment === 'production') { } return ENV; };
Change base path for dummy
Change base path for dummy
JavaScript
mit
knownasilya/ember-toggle,paulkogel/ember-cli-toggle,paulkogel/ember-cli-toggle,knownasilya/ember-cli-toggle,lifegadget/ember-cli-toggle,lifegadget/ember-cli-toggle,knownasilya/ember-cli-toggle,knownasilya/ember-toggle
--- +++ @@ -4,7 +4,7 @@ var ENV = { modulePrefix: 'dummy', environment: environment, - baseURL: '/', + baseURL: '/ember-cli-toggle', locationType: 'auto', EmberENV: { FEATURES: {
ed59fe7c1090f6bc489c04d69f13ffb5b2a2bcc2
lucile-marbot/index.js
lucile-marbot/index.js
'use strict' const config = require(__dirname + '/config.js'); const Twit = require('twit'); const HC = require('node-hipchat'); let twitter = new Twit({ consumer_key: config['twitter_consumer_key'], consumer_secret: config['twitter_consumer_secret'], access_token: config['twitter_access_token'], access_token_secret: config['twitter_access_token_secret'], timeout_ms: 60*1000 // optional HTTP request timeout to apply to all requests. }); let hipchat = new HC(config['hipchat_key']); const params = { 'room': config['hipchat_room'], 'from': config['hipchat_bot'], 'color': 'gray', 'notify': 0 }; // Listen to TEA twitter accounts let stream = twitter.stream('statuses/filter', { track: config['twitter_keywords'] }); console.log('Listening to Twitter, tracking ' + config['twitter_keywords'].join(', ') + '.'); stream.on('tweet', function (tweet) { // posting to HipChat let content = params; content.message = tweet.text; hipchat.postMessage(params, null); });
'use strict' const config = require(__dirname + '/config.js'); const Twit = require('twit'); const HC = require('node-hipchat'); let twitter = new Twit({ consumer_key: config['twitter_consumer_key'], consumer_secret: config['twitter_consumer_secret'], access_token: config['twitter_access_token'], access_token_secret: config['twitter_access_token_secret'], timeout_ms: 60*1000 // optional HTTP request timeout to apply to all requests. }); let hipchat = new HC(config['hipchat_key']); const params = { 'room': config['hipchat_room'], 'from': config['hipchat_bot'], 'color': 'gray', 'notify': 0 }; // Listen to TEA twitter accounts let stream = twitter.stream('statuses/filter', { track: config['twitter_keywords'] }); console.log('Listening to Twitter, tracking ' + config['twitter_keywords'].join(', ') + '.'); stream.on('tweet', function (tweet) { // posting to HipChat let content = params; const url = `http://twitter.com/${tweet.user.screen_name}/status/${tweet.id_str}`; content.message = `<a href="${url}">${url}</a>`; hipchat.postMessage(params, null); });
Change tweet post message: post url instead
Change tweet post message: post url instead
JavaScript
mit
johanpoirier/teabots,johanpoirier/teabots,johanpoirier/teabots,johanpoirier/teabots
--- +++ @@ -26,6 +26,7 @@ stream.on('tweet', function (tweet) { // posting to HipChat let content = params; - content.message = tweet.text; + const url = `http://twitter.com/${tweet.user.screen_name}/status/${tweet.id_str}`; + content.message = `<a href="${url}">${url}</a>`; hipchat.postMessage(params, null); });
741eb308d2013293418fdfd42fc0c6a001b40bb1
src/plugins/deviceOrientation.js
src/plugins/deviceOrientation.js
angular.module('ngCordova.plugins.deviceOrientation', []) .factory('$cordovaDeviceOrientation', ['$q', function($q) { return { watchHeading: function(options) { var q = $q.defer(); navigator.compass.watchHeading(function(result) { q.notify(result); }, function(err) { q.reject(err); }, options); return q.promise; } } }]);
angular.module('ngCordova.plugins.deviceOrientation', []) .factory('$cordovaDeviceOrientation', ['$q', function($q) { return { getCurrentHeading: function() { var q = $q.defer(); navigator.compass.getCurrentHeading(function(heading) { q.resolve(heading); }, function(err) { q.reject(err); }); return q.promise; }, watchHeading: function(options) { var q = $q.defer(); var watchID = navigator.compass.watchHeading(function(result) { q.resolve(watchID); q.notify(result); }, function(err) { q.reject(err); }, options); return q.promise; } clearWatch: function(watchID) { navigator.compass.clearWatch(); } } }]);
Complete the compass methods and handle watchID
Complete the compass methods and handle watchID Add clearWatch() wrapper; Add getCurrent() wrapper; Pass watchID throw resolve() in watchHeading() wrapper;
JavaScript
mit
CodingSans/ng-cordova,justinwp/ng-cordova,andreground/ng-cordova,calendee/ng-cordova,Freundschaft/ng-cordova,andreground/ng-cordova,dangerfarms/ng-cordova,lulee007/ng-cordova,inovia-team/ng-cordova,omefire/ng-cordova,saimon24/ng-cordova,brunogonncalves/ng-cordova,sanoop-hashedin/ng-cordova,Dharmoslap/ng-cordova,edewit/ng-cordova,lukemartin/ng-cordova,Dharmoslap/ng-cordova,saimon24/ng-cordova,documment/ng-cordova,jamalx31/ng-cordova,documment/ng-cordova,saschalink/ng-cordova,saimon24/ng-cordova,driftyco/ng-cordova,b-cuts/ng-cordova,buunguyen/ng-cordova,Dharmoslap/ng-cordova,Dharmoslap/ng-cordova,saschalink/ng-cordova,candril/ng-cordova,fxckdead/ng-cordova,matheusrocha89/ng-cordova,Sharinglabs/ng-cordova,nraboy/ng-cordova,edewit/ng-cordova,athiradandira/ng-cordova,toddhalfpenny/ng-cordova,guaerguagua/ng-cordova,kublaj/ng-cordova,florianeckerstorfer/ng-cordova,Dharmoslap/ng-cordova,dwimberger/ng-cordova,ralic/ng-cordova,saimon24/ng-cordova,matiasurbano/ng-cordova,dlermen12/ng-cordova,listrophy/ng-cordova,florianeckerstorfer/ng-cordova,kidush/ng-cordova,ghsyeung/ng-cordova,thomasbabuj/ng-cordova,dwimberger/ng-cordova,boboldehampsink/ng-cordova,johnli388/ng-cordova,thomasbabuj/ng-cordova,Dharmoslap/ng-cordova,moez-sadok/ng-cordova,documment/ng-cordova,dwimberger/ng-cordova,Sharinglabs/ng-cordova,Freundschaft/ng-cordova,codletech/ng-cordova,Sharinglabs/ng-cordova,documment/ng-cordova,andrew168/ng-cordova,jamalx31/ng-cordova,b-cuts/ng-cordova,jskrzypek/ng-cordova,Dharmoslap/ng-cordova,sesubash/ng-cordova,5amfung/ng-cordova,athiradandira/ng-cordova,GreatAnubis/ng-cordova,documment/ng-cordova,documment/ng-cordova,microlv/ng-cordova,listrophy/ng-cordova,gortok/ng-cordova,codletech/ng-cordova,calendee/ng-cordova,saimon24/ng-cordova,omefire/ng-cordova,jarbitlira/ng-cordova,saimon24/ng-cordova,glustful/ng-cordova,dlermen12/ng-cordova,andrew168/ng-cordova,inovia-team/ng-cordova,saimon24/ng-cordova,glustful/ng-cordova,Dharmoslap/ng-cordova,boboldehampsink/ng-cordova,Jeremy017/ng-cordova,beauby/ng-cordova,documment/ng-cordova,fwitzke/ng-cordova,lulee007/ng-cordova,cihadhoruzoglu/ng-cordova,Galda/ng-cordova,Tobiaswk/ng-cordova,honger05/ng-cordova,jason-engage/ng-cordova,1337/ng-cordova,omefire/ng-cordova,honger05/ng-cordova,Dharmoslap/ng-cordova,buunguyen/ng-cordova,documment/ng-cordova,sesubash/ng-cordova,moez-sadok/ng-cordova,saimon24/ng-cordova,saimon24/ng-cordova,mattlewis92/ng-cordova,DavidePastore/ng-cordova,matheusrocha89/ng-cordova,documment/ng-cordova,sanoop-hashedin/ng-cordova,mattlewis92/ng-cordova,j0k3r/ng-cordova,scripterkaran/ng-cordova,ghsyeung/ng-cordova,andrew168/ng-cordova,Freundschaft/ng-cordova,justinwp/ng-cordova,Dharmoslap/ng-cordova,codletech/ng-cordova,beauby/ng-cordova,SebastianRolf/ng-cordova,alanquigley/ng-cordova,driftyco/ng-cordova,selimg/ng-cordova,HereSinceres/ng-cordova,dangerfarms/ng-cordova,Galda/ng-cordova,brunogonncalves/ng-cordova,j0k3r/ng-cordova,Dharmoslap/ng-cordova,CodingSans/ng-cordova,kidush/ng-cordova,CodingSans/ng-cordova,ghsyeung/ng-cordova,candril/ng-cordova,5amfung/ng-cordova,jason-engage/ng-cordova,fxckdead/ng-cordova,ralic/ng-cordova,honger05/ng-cordova,Tobiaswk/ng-cordova,Jewelbots/ng-cordova,Dharmoslap/ng-cordova,cihadhoruzoglu/ng-cordova,jarbitlira/ng-cordova,saimon24/ng-cordova,HereSinceres/ng-cordova,HereSinceres/ng-cordova,lulee007/ng-cordova,gortok/ng-cordova,lukemartin/ng-cordova,gortok/ng-cordova,andreground/ng-cordova,moez-sadok/ng-cordova,documment/ng-cordova,kidush/ng-cordova,Tobiaswk/ng-cordova,documment/ng-cordova,sesubash/ng-cordova,SidneyS/ng-cordova,fwitzke/ng-cordova,blocktrail/ng-cordova,ralic/ng-cordova,SidneyS/ng-cordova,athiradandira/ng-cordova,candril/ng-cordova,5amfung/ng-cordova,florianeckerstorfer/ng-cordova,guaerguagua/ng-cordova,1337/ng-cordova,jskrzypek/ng-cordova,alanquigley/ng-cordova,brunogonncalves/ng-cordova,documment/ng-cordova,calendee/ng-cordova,Dharmoslap/ng-cordova,glustful/ng-cordova,driftyco/ng-cordova,guaerguagua/ng-cordova,blocktrail/ng-cordova,alanquigley/ng-cordova,promactkaran/ng-cordova,SebastianRolf/ng-cordova,johnli388/ng-cordova,nraboy/ng-cordova,justinwp/ng-cordova,toddhalfpenny/ng-cordova,scripterkaran/ng-cordova,DavidePastore/ng-cordova,Jeremy017/ng-cordova,documment/ng-cordova,beauby/ng-cordova,Dharmoslap/ng-cordova,saimon24/ng-cordova,promactkaran/ng-cordova,j0k3r/ng-cordova,documment/ng-cordova,Dharmoslap/ng-cordova,promactkaran/ng-cordova,jarbitlira/ng-cordova,jskrzypek/ng-cordova,microlv/ng-cordova,selimg/ng-cordova,GreatAnubis/ng-cordova,GreatAnubis/ng-cordova,SebastianRolf/ng-cordova,lukemartin/ng-cordova,kublaj/ng-cordova,matiasurbano/ng-cordova,jamalx31/ng-cordova,jason-engage/ng-cordova,thomasbabuj/ng-cordova,saimon24/ng-cordova,kublaj/ng-cordova,Jewelbots/ng-cordova,documment/ng-cordova,scripterkaran/ng-cordova,Jeremy017/ng-cordova,saimon24/ng-cordova,johnli388/ng-cordova,listrophy/ng-cordova,dangerfarms/ng-cordova,SidneyS/ng-cordova,saschalink/ng-cordova,documment/ng-cordova,fxckdead/ng-cordova,edewit/ng-cordova,sanoop-hashedin/ng-cordova,matiasurbano/ng-cordova,Dharmoslap/ng-cordova,buunguyen/ng-cordova,saimon24/ng-cordova,matheusrocha89/ng-cordova,dlermen12/ng-cordova,fwitzke/ng-cordova,DavidePastore/ng-cordova,saimon24/ng-cordova,toddhalfpenny/ng-cordova,Galda/ng-cordova,1337/ng-cordova,documment/ng-cordova,cihadhoruzoglu/ng-cordova,inovia-team/ng-cordova,Jewelbots/ng-cordova,microlv/ng-cordova,Dharmoslap/ng-cordova,mattlewis92/ng-cordova,blocktrail/ng-cordova,saimon24/ng-cordova,nraboy/ng-cordova,boboldehampsink/ng-cordova,selimg/ng-cordova,saimon24/ng-cordova,b-cuts/ng-cordova
--- +++ @@ -3,10 +3,22 @@ .factory('$cordovaDeviceOrientation', ['$q', function($q) { return { + getCurrentHeading: function() { + var q = $q.defer(); + + navigator.compass.getCurrentHeading(function(heading) { + q.resolve(heading); + }, function(err) { + q.reject(err); + }); + + return q.promise; + }, watchHeading: function(options) { var q = $q.defer(); - navigator.compass.watchHeading(function(result) { + var watchID = navigator.compass.watchHeading(function(result) { + q.resolve(watchID); q.notify(result); }, function(err) { q.reject(err); @@ -14,5 +26,8 @@ return q.promise; } + clearWatch: function(watchID) { + navigator.compass.clearWatch(); + } } }]);
a056d3ef885293a74e1a1ca227af3b5653e31511
src/util/subtitles.js
src/util/subtitles.js
const parseTime = (s) => { const re = /(\d{2}):(\d{2}):(\d{2}),(\d{3})/; const [, hours, mins, seconds, ms] = re.exec(s); return 3600*(+hours) + 60*(+mins) + (+seconds) + 0.001*(+ms); }; export const parseSRT = (text) => { const normText = text.replace(/\r\n/g, '\n'); // normalize newlines const re = /(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})\n((?:.+\n)+)/g; const subs = []; let found; while (true) { found = re.exec(normText); if (!found) { break; } const [full, , beginStr, endStr, lines] = found; const begin = parseTime(beginStr); const end = parseTime(endStr); // TODO: Should verify that end time is >= begin time // NOTE: We could check that indexes and/or time are in order, but don't really care subs.push({ begin, end, lines: lines.trim(), }); re.lastIndex = found.index + full.length; } return subs; };
const parseTime = (s) => { const re = /(\d{2}):(\d{2}):(\d{2}),(\d{3})/; const [, hours, mins, seconds, ms] = re.exec(s); return 3600*(+hours) + 60*(+mins) + (+seconds) + 0.001*(+ms); }; const cleanText = (s) => { const BREAK_RE = /(<br>)/ig; // SRT files shouldn't have these, but some do const TAG_RE = /(<([^>]+)>)/ig; return s.trim().replace(BREAK_RE, '\n').replace(TAG_RE, ''); }; export const parseSRT = (text) => { const normText = text.replace(/\r\n/g, '\n'); // normalize newlines const re = /(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})\n((?:.+\n)+)/g; const subs = []; let found; while (true) { found = re.exec(normText); if (!found) { break; } const [full, , beginStr, endStr, lines] = found; const begin = parseTime(beginStr); const end = parseTime(endStr); // TODO: Should verify that end time is >= begin time // NOTE: We could check that indexes and/or time are in order, but don't really care subs.push({ begin, end, lines: cleanText(lines), }); re.lastIndex = found.index + full.length; } return subs; };
Clean up tags in SRT files on import
Clean up tags in SRT files on import
JavaScript
mit
rsimmons/voracious,rsimmons/immersion-player,rsimmons/voracious,rsimmons/voracious,rsimmons/immersion-player
--- +++ @@ -2,6 +2,12 @@ const re = /(\d{2}):(\d{2}):(\d{2}),(\d{3})/; const [, hours, mins, seconds, ms] = re.exec(s); return 3600*(+hours) + 60*(+mins) + (+seconds) + 0.001*(+ms); +}; + +const cleanText = (s) => { + const BREAK_RE = /(<br>)/ig; // SRT files shouldn't have these, but some do + const TAG_RE = /(<([^>]+)>)/ig; + return s.trim().replace(BREAK_RE, '\n').replace(TAG_RE, ''); }; export const parseSRT = (text) => { @@ -24,7 +30,7 @@ subs.push({ begin, end, - lines: lines.trim(), + lines: cleanText(lines), }); re.lastIndex = found.index + full.length; }
eb36c85f3d5703ad20dc6f4dc523aa324842d416
src/client/utils/ipcAdapter.js
src/client/utils/ipcAdapter.js
import ACTIVITIY_STATUS from './activityStatus' const IPCAdapter = require('electron-ipc-adapter') const ipcRenderer = window.require('electron').ipcRenderer class ClientIPCAdapter extends IPCAdapter { constructor (ipcRenderer) { super(ipcRenderer.send.bind(ipcRenderer), ipcRenderer.on.bind(ipcRenderer)) } getHubs () { return this.ask('getHubs').then((response) => response.hubs) } getActivities (hubUuid) { return Promise.all([ this.ask('getActivities', { hubUuid }), this.ask('getCurrentActivityForHub', { hubUuid }) ]) .then((results) => { const activities = results[0].activities const currentActivityId = results[1].activityId return activities.map((activity) => { if (activity.id === currentActivityId) { activity.activityStatus = ACTIVITIY_STATUS.STARTED } else { activity.activityStatus = ACTIVITIY_STATUS.OFF } return activity }) }) } startActivityForHub (activityId, hubUuid) { return this.tell('startActivityForHub', { hubUuid, activityId }) } } const ipcAdapter = new ClientIPCAdapter(ipcRenderer) export default ipcAdapter
import ACTIVITIY_STATUS from './activityStatus' const IPCAdapter = require('electron-ipc-adapter') const ipcRenderer = window.require('electron').ipcRenderer class ClientIPCAdapter extends IPCAdapter { constructor (ipcRenderer) { super(ipcRenderer.send.bind(ipcRenderer), ipcRenderer.on.bind(ipcRenderer)) } getHubs () { return this.ask('getHubs').then((response) => response.hubs) } getActivities (hubUuid) { return Promise.all([ this.ask('getActivities', { hubUuid }), this.ask('getCurrentActivityForHub', { hubUuid }) ]) .then((results) => { const activities = results[0].activities const currentActivityId = results[1].activityId return activities.map((activity) => { if (activity.id !== '-1' && activity.id === currentActivityId) { activity.activityStatus = ACTIVITIY_STATUS.STARTED } else { activity.activityStatus = ACTIVITIY_STATUS.OFF } return activity }) }) } startActivityForHub (activityId, hubUuid) { return this.tell('startActivityForHub', { hubUuid, activityId }) } } const ipcAdapter = new ClientIPCAdapter(ipcRenderer) export default ipcAdapter
Set default activity state better when load activities
fix(ipc): Set default activity state better when load activities
JavaScript
mit
swissmanu/orchestra-client,swissmanu/orchestra,swissmanu/orchestra-client,swissmanu/orchestra
--- +++ @@ -22,7 +22,7 @@ const currentActivityId = results[1].activityId return activities.map((activity) => { - if (activity.id === currentActivityId) { + if (activity.id !== '-1' && activity.id === currentActivityId) { activity.activityStatus = ACTIVITIY_STATUS.STARTED } else { activity.activityStatus = ACTIVITIY_STATUS.OFF
4f8d1ba721fedc3ea88bf1caa8bd4d26065dde9c
src/components/PostItem/styled.js
src/components/PostItem/styled.js
import styled from 'styled-components' import { Link } from 'gatsby' export const PostItemTitle = styled.h1` ${props => props.theme.Home_PostTitle} margin-bottom: 0.8rem; color: var(--text); transition: color 0.3s; ` export const PostItemLink = styled(Link)` display: block; width: 100%; color: var(--text); text-decoration: none; @media (hover: hover) { &:hover ${PostItemTitle} { color: var(--accent); } } ` export const PostItemWrapper = styled.article` display: flex; flex-direction: column; align-items: flex-start; ` export const PostItemDateAndReadTime = styled.small` ${props => props.theme.Home_PostDateAndReadTime} display: block; margin-bottom: 1.2rem; ` export const PostItemDescription = styled.p` ${props => props.theme.Home_PostDescription} margin-bottom: 0.8rem; ` export const PostItemTags = styled.small` ${props => props.theme.General_Tag} ` export const PostItemTag = styled(Link)` color: var(--text); transition: color 0.3s; text-decoration: underline; @media (hover: hover) { &:hover { color: var(--accent); } } `
import styled from 'styled-components' import { Link } from 'gatsby' export const PostItemTitle = styled.h1` ${props => props.theme.Home_PostTitle} margin-bottom: 0.8rem; color: var(--text); transition: color 0.3s; ` export const PostItemLink = styled(Link)` display: block; width: 100%; color: var(--text); text-decoration: none; transition: color 0.3s; @media (hover: hover) { &:hover ${PostItemTitle} { color: var(--accent); } } ` export const PostItemWrapper = styled.article` display: flex; flex-direction: column; align-items: flex-start; ` export const PostItemDateAndReadTime = styled.small` ${props => props.theme.Home_PostDateAndReadTime} display: block; margin-bottom: 1.2rem; ` export const PostItemDescription = styled.p` ${props => props.theme.Home_PostDescription} margin-bottom: 0.8rem; ` export const PostItemTags = styled.small` ${props => props.theme.General_Tag} ` export const PostItemTag = styled(Link)` color: var(--text); transition: color 0.3s; text-decoration: underline; @media (hover: hover) { &:hover { color: var(--accent); } } `
Add transition on PostItem component
Add transition on PostItem component
JavaScript
mit
evandromacedo/evandromacedo.com
--- +++ @@ -13,6 +13,7 @@ width: 100%; color: var(--text); text-decoration: none; + transition: color 0.3s; @media (hover: hover) { &:hover ${PostItemTitle} {
542414b4cdc4b10b8ae5533bcf0338933938891a
commonjs/replace-image-dpr.js
commonjs/replace-image-dpr.js
var onReady = require('kwf/on-ready'); if (window.devicePixelRatio && window.devicePixelRatio > 1) { onReady.onRender('.kwfReplaceImageDpr2', function(el) { if (el.get(0).tagName.toLowerCase() == 'img') { if (el.get(0).src.indexOf('dpr2') == -1) { el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/'); } } else { var url = el.getStyle('background-image'); if (url.indexOf('dpr2') == -1) { url = url.replace('/images/', '/images/dpr2/'); } el.css('background-image', url); } }); }
var onReady = require('kwf/on-ready'); if (window.devicePixelRatio && window.devicePixelRatio > 1) { onReady.onRender('.kwfReplaceImageDpr2', function(el) { if (el.get(0).tagName.toLowerCase() == 'img') { el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/'); } else { var url = el.getStyle('background-image'); url = url.replace('/images/', '/images/dpr2/'); el.css('background-image', url); } }); }
Revert "Quick fix for wrong image urls in e18 templates"
Revert "Quick fix for wrong image urls in e18 templates" This reverts commit 2d07bb6ede72f5069d8c297586505ada4bc15eef. Will be implemented differently in 4.3 with change in html code (which requires all view cache entries to be deleted)
JavaScript
bsd-2-clause
koala-framework/koala-framework,koala-framework/koala-framework
--- +++ @@ -3,14 +3,10 @@ if (window.devicePixelRatio && window.devicePixelRatio > 1) { onReady.onRender('.kwfReplaceImageDpr2', function(el) { if (el.get(0).tagName.toLowerCase() == 'img') { - if (el.get(0).src.indexOf('dpr2') == -1) { - el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/'); - } + el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/'); } else { var url = el.getStyle('background-image'); - if (url.indexOf('dpr2') == -1) { - url = url.replace('/images/', '/images/dpr2/'); - } + url = url.replace('/images/', '/images/dpr2/'); el.css('background-image', url); } });
7aaddd2dac63e5e141488c9fcb5db44081afd038
test/unit/users.js
test/unit/users.js
describe('Users', function() { describe('Creation', function () { context('When creating a new user', function() { it('Should have an id', function() { some_guy = new mocks.user(); }); }); }); });
describe('Users', function() { describe('Creation', function () { context('When creating a new user', function() { it('Should have an id', function() { var some_guy = jsf(mocks.user); // ADD SHOULD.JS some_guy.should.have.property('id'); some_guy.id.should.be.ok(); some_guy.id.should.be.String(); }); }); }); });
Add first example of shouldJS
Add first example of shouldJS
JavaScript
mit
facundovictor/mocha-testing
--- +++ @@ -4,7 +4,11 @@ context('When creating a new user', function() { it('Should have an id', function() { - some_guy = new mocks.user(); + var some_guy = jsf(mocks.user); + // ADD SHOULD.JS + some_guy.should.have.property('id'); + some_guy.id.should.be.ok(); + some_guy.id.should.be.String(); }); }); });
c562b49e20719c9fbec8dfbdd3c9c1a8a5beb825
src/main/dojoviews/DojoTabView.js
src/main/dojoviews/DojoTabView.js
/** * @class SMITHY/DojoBorderView * View implementation for Dojo Tab Container to support smithy "tabs" * layout mode. */ define([ "../declare", "dijit/layout/TabContainer" ], function ( declare, TabContainer ) { var module = declare(TabContainer, { constructor: function (config) { this.implementsMode = "tabs"; }, addChild: function (view) { this.inherited(arguments); }, removeChild: function (childView) { this.inherited(arguments); }, hasChild: function (childView) { var cidx = this.getIndexOfChild(childView); return (cidx > -1); }, startup: function () { this.inherited(arguments); } }); return module; });
/** * @class SMITHY/DojoBorderView * View implementation for Dojo Tab Container to support smithy "tabs" * layout mode. */ define([ "../declare", "dijit/layout/TabContainer" ], function ( declare, TabContainer ) { var module = declare(TabContainer, { constructor: function (config) { this.implementsMode = "tabs"; }, addChild: function (view) { this.inherited(arguments); this.set("title", view.title); }, removeChild: function (childView) { this.inherited(arguments); }, hasChild: function (childView) { var cidx = this.getIndexOfChild(childView); return (cidx > -1); }, startup: function () { this.inherited(arguments); } }); return module; });
Use view "title" as default tab title.
Use view "title" as default tab title.
JavaScript
apache-2.0
atsid/smithy-js,atsid/smithy-js
--- +++ @@ -17,6 +17,7 @@ addChild: function (view) { this.inherited(arguments); + this.set("title", view.title); }, removeChild: function (childView) {
39b8035987952cb98c1d89eab8b405f7a141ed2b
config/initializers/origin.js
config/initializers/origin.js
import { load as configLoader } from '../config'; const config = configLoader(); export const originMiddleware = async (ctx, next) => { ctx.response.set('Access-Control-Allow-Origin', config.origin); ctx.response.set('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); ctx.response.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, X-Authentication-Token, Access-Control-Request-Method'); ctx.response.set('Access-Control-Expose-Headers', 'Date, X-Freefeed-Server'); await next(); };
import { load as configLoader } from '../config'; const config = configLoader(); export const originMiddleware = async (ctx, next) => { ctx.response.set('Access-Control-Allow-Origin', config.origin); ctx.response.set('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); ctx.response.set('Access-Control-Allow-Headers', [ 'Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'X-Authentication-Token', 'Access-Control-Request-Method', 'Authorization', ].join(', ')); ctx.response.set('Access-Control-Expose-Headers', 'Date, X-Freefeed-Server'); await next(); };
Add Authorization header to Access-Control-Allow-Headers
Add Authorization header to Access-Control-Allow-Headers
JavaScript
mit
FreeFeed/freefeed-server,FreeFeed/freefeed-server
--- +++ @@ -6,7 +6,15 @@ export const originMiddleware = async (ctx, next) => { ctx.response.set('Access-Control-Allow-Origin', config.origin); ctx.response.set('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); - ctx.response.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, X-Authentication-Token, Access-Control-Request-Method'); + ctx.response.set('Access-Control-Allow-Headers', [ + 'Origin', + 'X-Requested-With', + 'Content-Type', + 'Accept', + 'X-Authentication-Token', + 'Access-Control-Request-Method', + 'Authorization', + ].join(', ')); ctx.response.set('Access-Control-Expose-Headers', 'Date, X-Freefeed-Server'); await next();
f5f849f1d8a01b37e0094e84f757de0b26ecb018
src/dom_components/config/config.js
src/dom_components/config/config.js
module.exports = { stylePrefix: 'comp-', wrapperId: 'wrapper', wrapperName: 'Body', // Default wrapper configuration wrapper: { removable: false, copyable: false, draggable: false, components: [], traits: [], stylable: [ 'background', 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', 'background-size' ] }, // Could be used for default components components: [], // Class for new image component imageCompClass: 'fa fa-picture-o', // Open assets manager on create of image component oAssetsOnCreate: true, // Generally, if you don't edit the wrapper in the editor, like // custom attributes, you don't need the wrapper stored in your JSON // structure, but in case you need it you can use this option. // If you have `config.avoidInlineStyle` disabled the wrapper will be stored // as we need to store inlined style. storeWrapper: 1, // List of void elements voidElements: [ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' ] };
module.exports = { stylePrefix: 'comp-', wrapperId: 'wrapper', wrapperName: 'Body', // Default wrapper configuration wrapper: { removable: false, copyable: false, draggable: false, components: [], traits: [], stylable: [ 'background', 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', 'background-size' ] }, // Could be used for default components components: [], // Class for new image component imageCompClass: 'fa fa-picture-o', // Open assets manager on create of image component oAssetsOnCreate: true, // Generally, if you don't edit the wrapper in the editor, like // custom attributes, you don't need the wrapper stored in your JSON // structure, but in case you need it you can use this option. // If you have `config.avoidInlineStyle` disabled the wrapper will be stored // as we need to store inlined style. storeWrapper: 0, // List of void elements voidElements: [ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' ] };
Set storeWrapper false by default
Set storeWrapper false by default
JavaScript
bsd-3-clause
artf/grapesjs,artf/grapesjs,QuorumDMS/grapesjs,artf/grapesjs,QuorumDMS/grapesjs
--- +++ @@ -37,7 +37,7 @@ // structure, but in case you need it you can use this option. // If you have `config.avoidInlineStyle` disabled the wrapper will be stored // as we need to store inlined style. - storeWrapper: 1, + storeWrapper: 0, // List of void elements voidElements: [
b5d25ec7f4b7c45c4905bec87f70d50ee38630cf
src/services/users/users.hooks.js
src/services/users/users.hooks.js
const { authenticate } = require('@feathersjs/authentication').hooks; const { hashPassword, protect } = require('@feathersjs/authentication-local').hooks; const gravatar = require('../../hooks/gravatar'); module.exports = { before: { all: [], find: [ authenticate('jwt') ], get: [], create: [hashPassword(), gravatar()], update: [ hashPassword() ], patch: [ hashPassword() ], remove: [] }, after: { all: [ // Make sure the password field is never sent to the client // Always must be the last hook protect('password') ], find: [], get: [], create: [], update: [], patch: [], remove: [] }, error: { all: [], find: [], get: [], create: [], update: [], patch: [], remove: [] } };
const { authenticate } = require('@feathersjs/authentication').hooks; const { hashPassword, protect } = require('@feathersjs/authentication-local').hooks; const gravatar = require('../../hooks/gravatar'); module.exports = { before: { all: [], find: [ authenticate('jwt') ], get: [ authenticate('jwt') ], create: [hashPassword(), authenticate('jwt'), gravatar()], update: [ hashPassword(), authenticate('jwt') ], patch: [ hashPassword(), authenticate('jwt') ], remove: [ authenticate('jwt') ] }, after: { all: [ // Make sure the password field is never sent to the client // Always must be the last hook protect('password') ], find: [], get: [], create: [], update: [], patch: [], remove: [] }, error: { all: [], find: [], get: [], create: [], update: [], patch: [], remove: [] } };
Add authentication hook to all methods (except create)
Add authentication hook to all methods (except create)
JavaScript
mit
feathersjs/feathers-chat,feathersjs/feathers-chat,feathersjs/feathers-chat
--- +++ @@ -8,11 +8,11 @@ before: { all: [], find: [ authenticate('jwt') ], - get: [], - create: [hashPassword(), gravatar()], - update: [ hashPassword() ], - patch: [ hashPassword() ], - remove: [] + get: [ authenticate('jwt') ], + create: [hashPassword(), authenticate('jwt'), gravatar()], + update: [ hashPassword(), authenticate('jwt') ], + patch: [ hashPassword(), authenticate('jwt') ], + remove: [ authenticate('jwt') ] }, after: {
dc1d10a6769ec851e6c865d131f5050672ad0962
tasks/options/copy.js
tasks/options/copy.js
module.exports = { assets: { files: [{ expand: true, dot: true, dest: '<%= distDir %>', src: [ '<%= appDir %>/images/**/*', '<%= appDir %>/styles/css/*.css', '<%= appDir %>/scripts/**/*.{html,css,jpg,jpeg,png,gif,json}', '<%= appDir %>/template/**/*.html', '<%= appDir %>/scripts/bower_components/requirejs/require.js' ] }] }, js: { files: [{ expand: true, dot: true, cwd: '<%= appDir %>', dest: '<%= distDir %>', src: [ 'scripts/config.js', 'scripts/bower_components/**/*.js' ] }] } };
module.exports = { assets: { files: [{ expand: true, dot: true, cwd: '<%= appDir %>', dest: '<%= distDir %>', src: [ 'images/**/*', 'styles/css/*.css', 'scripts/**/*.{html,css,jpg,jpeg,png,gif,json}', 'template/**/*.html', 'scripts/bower_components/requirejs/require.js' ] }] }, js: { files: [{ expand: true, dot: true, cwd: '<%= appDir %>', dest: '<%= distDir %>', src: [ 'scripts/config.js', 'scripts/bower_components/**/*.js' ] }] } };
Fix build by reverting changes
fix(build): Fix build by reverting changes
JavaScript
agpl-3.0
pavlovicnemanja/superdesk,superdesk/superdesk-ntb,pavlovicnemanja/superdesk,thnkloud9/superdesk,fritzSF/superdesk,amagdas/superdesk,akintolga/superdesk,superdesk/superdesk-aap,ioanpocol/superdesk-ntb,amagdas/superdesk,darconny/superdesk,vied12/superdesk,pavlovicnemanja92/superdesk,superdesk/superdesk-ntb,Aca-jov/superdesk,verifiedpixel/superdesk,marwoodandrew/superdesk,verifiedpixel/superdesk,mdhaman/superdesk,fritzSF/superdesk,superdesk/superdesk-aap,ioanpocol/superdesk-ntb,amagdas/superdesk,petrjasek/superdesk-ntb,sivakuna-aap/superdesk,sjunaid/superdesk,pavlovicnemanja92/superdesk,akintolga/superdesk,hlmnrmr/superdesk,Aca-jov/superdesk,akintolga/superdesk,ancafarcas/superdesk,sjunaid/superdesk,ioanpocol/superdesk-ntb,mugurrus/superdesk,gbbr/superdesk,plamut/superdesk,hlmnrmr/superdesk,plamut/superdesk,superdesk/superdesk-ntb,ioanpocol/superdesk,plamut/superdesk,pavlovicnemanja92/superdesk,petrjasek/superdesk-ntb,superdesk/superdesk,mdhaman/superdesk-aap,vied12/superdesk,petrjasek/superdesk-ntb,akintolga/superdesk-aap,thnkloud9/superdesk,superdesk/superdesk-aap,Aca-jov/superdesk,marwoodandrew/superdesk-aap,vied12/superdesk,ancafarcas/superdesk,sjunaid/superdesk,liveblog/superdesk,marwoodandrew/superdesk,ioanpocol/superdesk,marwoodandrew/superdesk,thnkloud9/superdesk,hlmnrmr/superdesk,akintolga/superdesk-aap,akintolga/superdesk,petrjasek/superdesk,ancafarcas/superdesk,marwoodandrew/superdesk,petrjasek/superdesk,darconny/superdesk,fritzSF/superdesk,vied12/superdesk,amagdas/superdesk,mdhaman/superdesk,verifiedpixel/superdesk,akintolga/superdesk,petrjasek/superdesk-ntb,superdesk/superdesk,amagdas/superdesk,pavlovicnemanja/superdesk,marwoodandrew/superdesk,mugurrus/superdesk,akintolga/superdesk-aap,plamut/superdesk,petrjasek/superdesk,pavlovicnemanja92/superdesk,fritzSF/superdesk,superdesk/superdesk-aap,sivakuna-aap/superdesk,vied12/superdesk,liveblog/superdesk,pavlovicnemanja92/superdesk,sivakuna-aap/superdesk,verifiedpixel/superdesk,superdesk/superdesk,liveblog/superdesk,pavlovicnemanja/superdesk,superdesk/superdesk-ntb,mdhaman/superdesk-aap,fritzSF/superdesk,mugurrus/superdesk,akintolga/superdesk-aap,superdesk/superdesk,verifiedpixel/superdesk,marwoodandrew/superdesk-aap,liveblog/superdesk,gbbr/superdesk,mdhaman/superdesk-aap,sivakuna-aap/superdesk,mdhaman/superdesk,mdhaman/superdesk-aap,liveblog/superdesk,plamut/superdesk,marwoodandrew/superdesk-aap,petrjasek/superdesk,marwoodandrew/superdesk-aap,sivakuna-aap/superdesk,gbbr/superdesk,ioanpocol/superdesk,darconny/superdesk
--- +++ @@ -3,13 +3,14 @@ files: [{ expand: true, dot: true, + cwd: '<%= appDir %>', dest: '<%= distDir %>', src: [ - '<%= appDir %>/images/**/*', - '<%= appDir %>/styles/css/*.css', - '<%= appDir %>/scripts/**/*.{html,css,jpg,jpeg,png,gif,json}', - '<%= appDir %>/template/**/*.html', - '<%= appDir %>/scripts/bower_components/requirejs/require.js' + 'images/**/*', + 'styles/css/*.css', + 'scripts/**/*.{html,css,jpg,jpeg,png,gif,json}', + 'template/**/*.html', + 'scripts/bower_components/requirejs/require.js' ] }] },
7b00d8d0ddf7f2346169880b2e9eb8ed35298767
src/reducers/Entities/index.js
src/reducers/Entities/index.js
import { combineReducers } from 'redux'; import { TemperatureBreachConfigReducer } from './TemperatureBreachConfigReducer'; import { SensorReducer } from './SensorReducer'; export const EntitiesReducer = combineReducers({ temperatureBreachConfiguration: TemperatureBreachConfigReducer, sensor: SensorReducer, });
import { combineReducers } from 'redux'; import { TemperatureBreachConfigReducer } from './TemperatureBreachConfigReducer'; import { SensorReducer } from './SensorReducer'; import { LocationReducer } from './LocationReducer'; export const EntitiesReducer = combineReducers({ temperatureBreachConfiguration: TemperatureBreachConfigReducer, sensor: SensorReducer, location: LocationReducer, });
Add import of location reducer
Add import of location reducer
JavaScript
mit
sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile
--- +++ @@ -2,8 +2,10 @@ import { TemperatureBreachConfigReducer } from './TemperatureBreachConfigReducer'; import { SensorReducer } from './SensorReducer'; +import { LocationReducer } from './LocationReducer'; export const EntitiesReducer = combineReducers({ temperatureBreachConfiguration: TemperatureBreachConfigReducer, sensor: SensorReducer, + location: LocationReducer, });
a586cd584fc255e113fffd29fef4275d0a480ea7
test/client/users/album/create.js
test/client/users/album/create.js
/*global $, assert, trigger*/ 'use strict'; describe('Albums create dialog', function () { this.timeout(20000); it('should create new album', function (done) { var user; TEST.browser // Authorize .auth('users_album_create', function (usr) { user = usr; }) // Navigate to albums page .goto(function () { return 'http://localhost:3000' + TEST.N.router.linkTo('users.albums_root', { user_hid: user.hid }); }) .evaluateAsync(function (done) { TEST.N.wire.once('users.album.create:shown', { priority: 999 }, function () { $('input[name="album_name"]').val('new test album!'); $('.modal-dialog button[type="submit"]').click(); }); trigger('[data-on-click="users.albums_root.create_album"]', function () { assert.equal($('.user-albumlist li:last .thumb-caption__line:first').text(), 'new test album!'); done(); }); }) // Run test .run(done); }); });
/*global $, assert, trigger*/ 'use strict'; describe('Albums create dialog', function () { this.timeout(20000); it('should create new album', function (done) { var user; TEST.browser // Authorize .auth('users_album_create', function (usr) { user = usr; }) // Navigate to albums page .goto(function () { return TEST.N.router.linkTo('users.albums_root', { user_hid: user.hid }); }) .evaluateAsync(function (done) { TEST.N.wire.once('users.album.create:shown', { priority: 999 }, function () { $('input[name="album_name"]').val('new test album!'); $('.modal-dialog button[type="submit"]').click(); }); trigger('[data-on-click="users.albums_root.create_album"]', function () { assert.equal($('.user-albumlist li:last .thumb-caption__line:first').text(), 'new test album!'); done(); }); }) // Run test .run(done); }); });
Fix tests for correct environment config
Fix tests for correct environment config
JavaScript
mit
nodeca/nodeca.users
--- +++ @@ -16,7 +16,7 @@ // Navigate to albums page .goto(function () { - return 'http://localhost:3000' + TEST.N.router.linkTo('users.albums_root', { user_hid: user.hid }); + return TEST.N.router.linkTo('users.albums_root', { user_hid: user.hid }); }) .evaluateAsync(function (done) {
ede7fd0b90e5e6f8d4da802c6b2dcf2a184d3235
packages/strapi-admin/validation/common-validators.js
packages/strapi-admin/validation/common-validators.js
'use strict'; const { yup } = require('strapi-utils'); const strapiID = yup.lazy(value => typeof value === 'number' ? yup.number().integer() : yup.string() ); // https://github.com/jquense/yup/issues/665 const email = yup .string() .email() .min(1); const firstname = yup.string().min(1); const lastname = yup.string().min(1); const username = yup.string().min(1); const password = yup .string() .min(8) .matches(/[a-z]/, '${path} must contain at least one lowercase character') .matches(/[A-Z]/, '${path} must contain at least one uppercase character') .matches(/\d/, '${path} must contain at least one number'); const roles = yup.array(strapiID); module.exports = { email, firstname, lastname, username, password, roles, strapiID, };
'use strict'; const { yup } = require('strapi-utils'); yup['strapiID'] = yup.lazy(value => typeof value === 'number' ? yup.number().integer() : yup.string().matches(/^[a-f\d]{24}$/, '${path} must be a valid ID') ); const email = yup .string() .email() .min(1); const firstname = yup.string().min(1); const lastname = yup.string().min(1); const username = yup.string().min(1); const password = yup .string() .min(8) .matches(/[a-z]/, '${path} must contain at least one lowercase character') .matches(/[A-Z]/, '${path} must contain at least one uppercase character') .matches(/\d/, '${path} must contain at least one number'); const roles = yup.array(yup.strapiID).min(1); module.exports = { email, firstname, lastname, username, password, roles, };
Add custom strapiID type to yup
Add custom strapiID type to yup
JavaScript
mit
wistityhq/strapi,wistityhq/strapi
--- +++ @@ -2,9 +2,11 @@ const { yup } = require('strapi-utils'); -const strapiID = yup.lazy(value => - typeof value === 'number' ? yup.number().integer() : yup.string() -); // https://github.com/jquense/yup/issues/665 +yup['strapiID'] = yup.lazy(value => + typeof value === 'number' + ? yup.number().integer() + : yup.string().matches(/^[a-f\d]{24}$/, '${path} must be a valid ID') +); const email = yup .string() @@ -24,7 +26,7 @@ .matches(/[A-Z]/, '${path} must contain at least one uppercase character') .matches(/\d/, '${path} must contain at least one number'); -const roles = yup.array(strapiID); +const roles = yup.array(yup.strapiID).min(1); module.exports = { email, @@ -33,5 +35,4 @@ username, password, roles, - strapiID, };
c0388ba9b5641dc2a82d97edb5e17211617c1117
test/transaction/actionhandler.js
test/transaction/actionhandler.js
var gRex = require('../../index.js'), Transaction = require("../../src/transaction/transaction"), handlers = require("../../src/transaction/actionhandler"), Element = require("../../src/element"); var vertexHandler, edgeHandler; var edge, vertex, transaction; describe('Element ActionHandlers', function() { before(function(done){ gRex.connect() .then(function(result) { g = result; done(); }) .fail(function(error) { console.error(error); }); }); before(function() { edge = Element.build("edge"); vertex = Element.build("vertex"); transaction = g.begin(); }); describe('Vertex ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return a vertex ActionHandler', function() { vertexHandler = handlers.ActionHandler.build(vertex, transaction, []); vertexHandler.should.be.instanceof(handlers.VertexActionHandler); }); }); }); describe('Edge ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return an edge ActionHandler', function() { edgeHandler = handlers.ActionHandler.build(edge, transaction, []); edgeHandler.should.be.instanceof(handlers.EdgeActionHandler); }); }); }); });
var gRex = require('../../index.js'); var Transaction = require("../../src/transaction/transaction"); var ActionHandlerFactory = require("../../src/transaction/actionhandlers/actionhandlerfactory"); var VertexActionHandler = require("../../src/transaction/actionhandlers/vertexactionhandler"); var EdgeActionHandler = require("../../src/transaction/actionhandlers/edgeactionhandler"); var ElementFactory = require("../../src/elementfactory"); var vertexHandler, edgeHandler; var edge, vertex, transaction; describe('Element ActionHandlers', function() { before(function(done){ gRex.connect() .then(function(result) { g = result; done(); }) .fail(function(error) { console.error(error); }); }); before(function() { edge = ElementFactory.build("edge"); vertex = ElementFactory.build("vertex"); transaction = g.begin(); }); describe('Vertex ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return a vertex ActionHandler', function() { vertexHandler = ActionHandlerFactory.build(vertex, transaction, []); vertexHandler.should.be.instanceof(VertexActionHandler); }); }); }); describe('Edge ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return an edge ActionHandler', function() { edgeHandler = ActionHandlerFactory.build(edge, transaction, []); edgeHandler.should.be.instanceof(EdgeActionHandler); }); }); }); });
Fix ActionHandler tests (support of Factory)
Fix ActionHandler tests (support of Factory)
JavaScript
mit
jbmusso/grex
--- +++ @@ -1,7 +1,11 @@ -var gRex = require('../../index.js'), - Transaction = require("../../src/transaction/transaction"), - handlers = require("../../src/transaction/actionhandler"), - Element = require("../../src/element"); +var gRex = require('../../index.js'); +var Transaction = require("../../src/transaction/transaction"); + +var ActionHandlerFactory = require("../../src/transaction/actionhandlers/actionhandlerfactory"); +var VertexActionHandler = require("../../src/transaction/actionhandlers/vertexactionhandler"); +var EdgeActionHandler = require("../../src/transaction/actionhandlers/edgeactionhandler"); + +var ElementFactory = require("../../src/elementfactory"); var vertexHandler, edgeHandler; var edge, vertex, transaction; @@ -19,16 +23,16 @@ }); before(function() { - edge = Element.build("edge"); - vertex = Element.build("vertex"); + edge = ElementFactory.build("edge"); + vertex = ElementFactory.build("vertex"); transaction = g.begin(); }); describe('Vertex ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return a vertex ActionHandler', function() { - vertexHandler = handlers.ActionHandler.build(vertex, transaction, []); - vertexHandler.should.be.instanceof(handlers.VertexActionHandler); + vertexHandler = ActionHandlerFactory.build(vertex, transaction, []); + vertexHandler.should.be.instanceof(VertexActionHandler); }); }); }); @@ -36,8 +40,8 @@ describe('Edge ActionHandler class', function() { describe('when building a vertex action handler', function() { it('should return an edge ActionHandler', function() { - edgeHandler = handlers.ActionHandler.build(edge, transaction, []); - edgeHandler.should.be.instanceof(handlers.EdgeActionHandler); + edgeHandler = ActionHandlerFactory.build(edge, transaction, []); + edgeHandler.should.be.instanceof(EdgeActionHandler); }); }); });
d9d08ece842966daeea2ee227e240c4fc9264f1b
examples/exception.js
examples/exception.js
'use strict'; const winston = require('../'); // // TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0 // This should output what was previously referred to // as "humanReadableUncaughtExceptions" by default. // const logger = winston.createLogger({ transports: [ new winston.transports.Console({ handleExceptions: true }) ] }); throw new Error('Hello, winston!');
'use strict'; const winston = require('../'); // // TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0 // This should output what was previously referred to // as "humanReadableUncaughtExceptions" by default. // const logger = winston.createLogger({ format: winston.format.simple(), transports: [ new winston.transports.Console({ handleExceptions: true }) ] }); throw new Error('Hello, winston!');
Use simple format to better show that humanReadableUnhandledException is now the default message format.
[dist] Use simple format to better show that humanReadableUnhandledException is now the default message format.
JavaScript
mit
winstonjs/winston,winstonjs/winston
--- +++ @@ -8,6 +8,7 @@ // as "humanReadableUncaughtExceptions" by default. // const logger = winston.createLogger({ + format: winston.format.simple(), transports: [ new winston.transports.Console({ handleExceptions: true }) ]
d6f9d5bdd737c183546ed8aef159db165502c2f6
script.js
script.js
var media = document.querySelectorAll('video, audio'); var rate = prompt('Speed?',''); Array.prototype.forEach.call(media, function(player) { player.playbackRate = rate; });
var media = document.querySelectorAll('video, audio'); var rate = prompt('Speed? Currently playing back at ' + media[0].playbackRate + 'x.',''); Array.prototype.forEach.call(media, function(player) { if (rate != 0) { player.playbackRate = rate; } else { player.playbackRate = 1; } });
Include current playback rate in prompt.
Include current playback rate in prompt. Prevent setting playback rate to 0.
JavaScript
cc0-1.0
jachinn/html5-video-playback-rate
--- +++ @@ -1,5 +1,9 @@ var media = document.querySelectorAll('video, audio'); -var rate = prompt('Speed?',''); +var rate = prompt('Speed? Currently playing back at ' + media[0].playbackRate + 'x.',''); Array.prototype.forEach.call(media, function(player) { - player.playbackRate = rate; + if (rate != 0) { + player.playbackRate = rate; + } else { + player.playbackRate = 1; + } });
bf4b26c1c1ff7e07d394f315545e95b6a550cb58
db/models/comments.js
db/models/comments.js
module.exports = (sequelize, Sequelize) => { const Comment = sequelize.define('comments', { id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true }, body: { type: Sequelize.STRING } }); return Comment; };
module.exports = (sequelize, Sequelize) => { const Comment = sequelize.define('comments', { id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true }, body: { type: Sequelize.STRING }, coordinates: { type: Sequelize.STRING } }); return Comment; };
Add coordinates column to table
Add coordinates column to table
JavaScript
mit
lowtalkers/escape-reality,francoabaroa/escape-reality,lowtalkers/escape-reality,francoabaroa/escape-reality
--- +++ @@ -8,6 +8,9 @@ }, body: { type: Sequelize.STRING + }, + coordinates: { + type: Sequelize.STRING } });
22cc1ec354d2d7776d6e6103aad60bf118abdf14
server.js
server.js
var http = require('http'); http.createServer(function (req, res) { var proxyRequest = http.request({ 'hostname': 'www.google.com' }, function(proxyResponse) { delete proxyResponse.headers['content-length']; res.writeHead(proxyResponse.statusCode, proxyResponse.headers); proxyResponse.setEncoding('utf8'); proxyResponse.on('data', function (chunk) { res.write(chunk); }); proxyResponse.on('end', function(){ res.end(); }); } ); proxyRequest.end(); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
var http = require('http'); var url = require('url'); http.createServer(function (req, res) { var host = req.headers['host']; delete req.headers['host']; var proxyRequest = http.request({ 'method': req.method, 'hostname': host, 'headers': req.headers, 'path': req.url }, function(proxyResponse) { delete proxyResponse.headers['content-length']; res.writeHead(proxyResponse.statusCode, proxyResponse.headers); proxyResponse.setEncoding('utf8'); proxyResponse.on('data', function (chunk) { res.write(chunk); }); proxyResponse.on('end', function(){ res.end(); }); } ); proxyRequest.end(); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
Use host headers to proxy request
Use host headers to proxy request
JavaScript
mit
leibowitz/cacheweb
--- +++ @@ -1,10 +1,17 @@ var http = require('http'); +var url = require('url'); http.createServer(function (req, res) { + + var host = req.headers['host']; + delete req.headers['host']; + var proxyRequest = http.request({ - 'hostname': 'www.google.com' - + 'method': req.method, + 'hostname': host, + 'headers': req.headers, + 'path': req.url }, function(proxyResponse) { delete proxyResponse.headers['content-length'];
2c2c0f8876e7297e2edf3610c9e814f383e72789
app/initializers/authentication.js
app/initializers/authentication.js
import CustomAuthenticator from '../authenticators/custom'; import CustomAuthorizer from '../authorizers/custom'; export default { name: 'authentication', before: 'simple-auth', initialize: function (container) { container.register('authorizer:custom', CustomAuthorizer); container.register('authenticator:custom', CustomAuthenticator); } };
import CustomAuthenticator from '../authenticators/custom'; import CustomAuthorizer from '../authorizers/custom'; export function initialize(container) { container.register('authenticator:custom', CustomAuthenticator); container.register('authorizer:custom', CustomAuthorizer); } export default { name: 'authentication', before: 'simple-auth', initialize: initialize };
Remove back auth initialize function to make test work
Remove back auth initialize function to make test work
JavaScript
mit
Flexberry/ember-flexberry,Flexberry/ember-flexberry,Flexberry/ember-flexberry,Flexberry/ember-flexberry
--- +++ @@ -1,11 +1,13 @@ import CustomAuthenticator from '../authenticators/custom'; import CustomAuthorizer from '../authorizers/custom'; + +export function initialize(container) { + container.register('authenticator:custom', CustomAuthenticator); + container.register('authorizer:custom', CustomAuthorizer); +} export default { name: 'authentication', before: 'simple-auth', - initialize: function (container) { - container.register('authorizer:custom', CustomAuthorizer); - container.register('authenticator:custom', CustomAuthenticator); - } + initialize: initialize };
5a3c89ca2670e6a00e053366bc6d2d4763210471
config/common.js
config/common.js
'use strict'; var fs = require('fs'); var path = require('path'); var merge = require('webpack-merge'); var webpack = require('webpack'); module.exports = function(config) { return new Promise(function(resolve, reject) { var cwd = process.cwd(); var parent = path.join(__dirname, '..'); var siteConfig = config.webpack && config.webpack.common; siteConfig = siteConfig || {}; var corePath = path.join(parent, 'components'); var common = { corePath: corePath, parent: parent, resolve: { root: path.join(parent, 'node_modules'), alias: { 'underscore': 'lodash', 'assets': path.join(cwd, 'assets'), 'config': path.join(cwd, 'antwar.config.js'), 'antwar-core': corePath }, extensions: [ '', '.js', '.jsx', '.json' ], modulesDirectories: [ path.join(cwd, 'node_modules'), 'node_modules' ] }, resolveLoader: { modulesDirectories: [ path.join(parent, 'node_modules'), 'node_modules' ] }, plugins: [ new webpack.DefinePlugin({ __DEV__: JSON.stringify(JSON.parse(config.buildDev)), 'process.env': { 'NODE_ENV': JSON.stringify(config.buildDev ? 'dev' : 'production') } }), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.DedupePlugin() ] }; resolve(merge(common, siteConfig)); }); };
'use strict'; var fs = require('fs'); var path = require('path'); var merge = require('webpack-merge'); var webpack = require('webpack'); module.exports = function(config) { return new Promise(function(resolve, reject) { var cwd = process.cwd(); var parent = path.join(__dirname, '..'); var siteConfig = config.webpack && config.webpack.common; siteConfig = siteConfig || {}; var corePath = path.join(parent, 'components'); var common = { corePath: corePath, parent: parent, resolve: { root: path.join(parent, 'node_modules'), alias: { 'underscore': 'lodash', 'assets': path.join(cwd, 'assets'), 'config': path.join(cwd, 'antwar.config.js'), 'antwar-core': corePath }, extensions: [ '', '.js', '.jsx', '.json' ], modulesDirectories: [ path.join(cwd, 'node_modules'), 'node_modules' ] }, resolveLoader: { modulesDirectories: [ path.join(parent, 'node_modules'), 'node_modules' ] }, plugins: [ new webpack.DefinePlugin({ __DEV__: JSON.stringify(JSON.parse(config.buildDev)), 'process.env': { 'NODE_ENV': 'dev' } }), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.DedupePlugin() ] }; resolve(merge(common, siteConfig)); }); };
Use dev env while building for production
Use dev env while building for production This yields better errors.
JavaScript
mit
antwarjs/antwar
--- +++ @@ -46,7 +46,7 @@ new webpack.DefinePlugin({ __DEV__: JSON.stringify(JSON.parse(config.buildDev)), 'process.env': { - 'NODE_ENV': JSON.stringify(config.buildDev ? 'dev' : 'production') + 'NODE_ENV': 'dev' } }), new webpack.optimize.OccurenceOrderPlugin(),
1beaa461dd647398b3040fc8b06f048882232591
app/js/services/morph_retriever.js
app/js/services/morph_retriever.js
"use strict"; annotationApp.service('morphRetriever', function($http) { this.getData = function(callback) { var result; var request = $.ajax({ url: './static/analyses.json', async: false }); request.done(callback); }; var stubData; this.getStubData(function(res) { stubData = res; }); this.getData = function(string, callback) { var result = stubData[string] || []; callback(result); }; });
"use strict"; annotationApp.service('morphRetriever', function($http) { this.getStubData = function(callback) { var result; var request = $.ajax({ url: './static/analyses.json', async: false }); request.done(callback); }; var stubData; this.getStubData(function(res) { stubData = res; }); this.getData = function(string, callback) { var result = stubData[string] || []; callback(result); }; });
Fix error in recent rebase
Fix error in recent rebase
JavaScript
mit
fbaumgardt/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa,fbaumgardt/arethusa,Masoumeh/arethusa,Masoumeh/arethusa,PonteIneptique/arethusa,alpheios-project/arethusa,PonteIneptique/arethusa,latin-language-toolkit/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa
--- +++ @@ -1,7 +1,7 @@ "use strict"; annotationApp.service('morphRetriever', function($http) { - this.getData = function(callback) { + this.getStubData = function(callback) { var result; var request = $.ajax({ url: './static/analyses.json',
33f5ab12196fd736efcca458f596692fe840882c
weather-app/app.js
weather-app/app.js
const request = require('request'); const yargs = require('yargs'); // 68 Studencheskaya street Engels const argv = yargs .options({ a: { demand: true, alias: 'address', describe: 'Address to fetch weather for.', string: true } }) .help() .alias('help', 'h') .argv; console.log(argv); request({ url: 'https://maps.googleapis.com/maps/api/geocode/json?address=68%20Studencheskaya%20street%20Engels', json: true }, (error, response, body) => { console.log(body.results[0].formatted_address); console.log(`Latitude: ${body.results[0].geometry.location.lat}`); console.log(`Longitude: ${body.results[0].geometry.location.lng}`); });
const request = require('request'); const yargs = require('yargs'); // 68 Studencheskaya street Engels const argv = yargs .options({ a: { demand: true, alias: 'address', describe: 'Address to fetch weather for.', string: true } }) .help() .alias('help', 'h') .argv; var url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(argv.address)}`; request({ url: url, json: true }, (error, response, body) => { console.log(body.results[0].formatted_address); console.log(`Latitude: ${body.results[0].geometry.location.lat}`); console.log(`Longitude: ${body.results[0].geometry.location.lng}`); });
Create url from user input
Create url from user input
JavaScript
mit
cunctat0r/udemy_nodejs_cource,cunctat0r/udemy_nodejs_cource
--- +++ @@ -16,10 +16,10 @@ .alias('help', 'h') .argv; -console.log(argv); +var url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(argv.address)}`; request({ - url: 'https://maps.googleapis.com/maps/api/geocode/json?address=68%20Studencheskaya%20street%20Engels', + url: url, json: true }, (error, response, body) => { console.log(body.results[0].formatted_address);
d0577eb2422723b2b063cc8661cfa56170a99bd3
app/pages/about/about-home.spec.js
app/pages/about/about-home.spec.js
/* eslint prefer-arrow-callback: 0, func-names: 0, 'react/jsx-filename-extension': [1, { "extensions": [".js", ".jsx"] }] */ import React from 'react'; import assert from 'assert'; import { shallow } from 'enzyme'; import AboutHome from './about-home'; describe('AboutHome', function () { let wrapper; before(function () { wrapper = shallow(<AboutHome />); }); it('renders without crashing', function () { assert.equal(wrapper, wrapper); }); it('renders five markdown elements', function () { const markdownElements = wrapper.find('div.on-secondary-page').children(); assert.equal(markdownElements.length, 5); }); });
/* eslint prefer-arrow-callback: 0, func-names: 0, 'react/jsx-filename-extension': [1, { "extensions": [".js", ".jsx"] }] */ import React from 'react'; import assert from 'assert'; import { shallow } from 'enzyme'; import AboutHome from './about-home'; describe('AboutHome', function () { let wrapper; before(function () { wrapper = shallow(<AboutHome />); }); it('renders without crashing', function () { }); it('renders five markdown elements', function () { const markdownElements = wrapper.find('div.on-secondary-page').children(); assert.equal(markdownElements.length, 5); }); });
Test for render without crashing with empty function.
Test for render without crashing with empty function.
JavaScript
apache-2.0
jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,zooniverse/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End
--- +++ @@ -13,7 +13,6 @@ }); it('renders without crashing', function () { - assert.equal(wrapper, wrapper); }); it('renders five markdown elements', function () {
8d84972362aaa3d0fe03ad4831ffbbe6889e4b32
app/src/components/request-pane.js
app/src/components/request-pane.js
const React = require('react') const {Card, CardActions, CardHeader, CardText} = require('material-ui/Card') const FlatButton = require('material-ui/FlatButton').default /* eslint-disable react/jsx-indent */ module.exports = ({ request, response = { headers: [] } }) => { const headerMapper = (header, index) => <li key={`${header.key}-${index}`}>{`${header.key}: ${header.value}`}</li> return <Card> <CardHeader title={request.url} subtitle={request.method} actAsExpander showExpandableButton /> <CardActions> <FlatButton label='Details' /> <FlatButton label='Action2' /> </CardActions> <CardText expandable> <h4>Request</h4> <ul> {request.headers.map(headerMapper)} </ul> <h4>Response</h4> <ul> {response.headers.map(headerMapper)} </ul> </CardText> </Card> } /* eslint-enable react/jsx-indent */
const React = require('react') const {Card, CardHeader, CardText} = require('material-ui/Card') const {Tabs, Tab} = require('material-ui/Tabs') /* eslint-disable react/jsx-indent */ module.exports = ({ request, response = { headers: [] } }) => { const headerMapper = (header, index) => <li key={`${header.key}-${index}`}>{`${header.key}: ${header.value}`}</li> console.log('response', response) return <Card> <CardHeader title={request.url} subtitle={request.method} actAsExpander showExpandableButton /> <CardText expandable> <Tabs> <Tab label='Request'> <ul> {request.headers.map(headerMapper)} </ul> </Tab> <Tab label='Response'> <ul> {response.headers.map(headerMapper)} </ul> {request.url} </Tab> </Tabs> </CardText> </Card> } /* eslint-enable react/jsx-indent */
Use tabs to split request and response.
Use tabs to split request and response.
JavaScript
isc
niklasi/halland-proxy,niklasi/halland-proxy
--- +++ @@ -1,30 +1,32 @@ const React = require('react') -const {Card, CardActions, CardHeader, CardText} = require('material-ui/Card') -const FlatButton = require('material-ui/FlatButton').default +const {Card, CardHeader, CardText} = require('material-ui/Card') +const {Tabs, Tab} = require('material-ui/Tabs') /* eslint-disable react/jsx-indent */ module.exports = ({ request, response = { headers: [] } }) => { const headerMapper = (header, index) => <li key={`${header.key}-${index}`}>{`${header.key}: ${header.value}`}</li> + console.log('response', response) return <Card> <CardHeader title={request.url} subtitle={request.method} actAsExpander showExpandableButton /> - <CardActions> - <FlatButton label='Details' /> - <FlatButton label='Action2' /> - </CardActions> <CardText expandable> - <h4>Request</h4> - <ul> - {request.headers.map(headerMapper)} - </ul> - <h4>Response</h4> - <ul> - {response.headers.map(headerMapper)} - </ul> + <Tabs> + <Tab label='Request'> + <ul> + {request.headers.map(headerMapper)} + </ul> + </Tab> + <Tab label='Response'> + <ul> + {response.headers.map(headerMapper)} + </ul> + {request.url} + </Tab> + </Tabs> </CardText> </Card> }
2868da1d508e358eab101c8220dd439ac060fb89
app/helpers/startNotifications.js
app/helpers/startNotifications.js
import notificationActions from '../flux/notificationActions' window.addEventListener('error', notificationActions.logError) notificationActions.startProgress(1, 'Testing Progress Bars', {max: 4, value: 1}, true) notificationActions.logMessage(0, 'Testing Messages') notificationActions.logError({message: 'Testing Errors'}) import React from 'react' import Notifications from '../elements/notifications' React.render(React.createElement(Notifications), document.querySelector('.notifications'))
import notificationActions from '../flux/notificationActions' window.addEventListener('error', notificationActions.logError) // notificationActions.startProgress(1, 'Testing Progress Bars', {max: 4, value: 1}, true) // notificationActions.logMessage(0, 'Testing Messages') // notificationActions.logError({message: 'Testing Errors'}) import React from 'react' import Notifications from '../elements/notifications' React.render(React.createElement(Notifications), document.querySelector('.notifications'))
Stop loading the notifications every time
Stop loading the notifications every time
JavaScript
agpl-3.0
hawkrives/gobbldygook,hawkrives/gobbldygook,hawkrives/gobbldygook
--- +++ @@ -1,8 +1,8 @@ import notificationActions from '../flux/notificationActions' window.addEventListener('error', notificationActions.logError) -notificationActions.startProgress(1, 'Testing Progress Bars', {max: 4, value: 1}, true) -notificationActions.logMessage(0, 'Testing Messages') -notificationActions.logError({message: 'Testing Errors'}) +// notificationActions.startProgress(1, 'Testing Progress Bars', {max: 4, value: 1}, true) +// notificationActions.logMessage(0, 'Testing Messages') +// notificationActions.logError({message: 'Testing Errors'}) import React from 'react' import Notifications from '../elements/notifications'
47f73cbbdf4c12b7925bc71ffc6de8cb1f424373
config/models.js
config/models.js
/** * Default model configuration * (sails.config.models) * * Unless you override them, the following properties will be included * in each of your models. * * For more info on Sails models, see: * http://sailsjs.org/#!/documentation/concepts/ORM */ module.exports.models = { /*************************************************************************** * * * Your app's default connection. i.e. the name of one of your app's * * connections (see `config/connections.js`) * * * ***************************************************************************/ connection: 'mongodbServer', /*************************************************************************** * * * How and whether Sails will attempt to automatically rebuild the * * tables/collections/etc. in your schema. * * * * See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html * * * ***************************************************************************/ migrate: 'alter' };
/** * Default model configuration * (sails.config.models) * * Unless you override them, the following properties will be included * in each of your models. * * For more info on Sails models, see: * http://sailsjs.org/#!/documentation/concepts/ORM */ module.exports.models = { /*************************************************************************** * * * Your app's default connection. i.e. the name of one of your app's * * connections (see `config/connections.js`) * * * ***************************************************************************/ connection: 'mongodbServer', /*************************************************************************** * * * How and whether Sails will attempt to automatically rebuild the * * tables/collections/etc. in your schema. * * * * See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html * * * ***************************************************************************/ migrate: 'drop' };
Drop data on server relaunch
Drop data on server relaunch
JavaScript
mit
YannBertrand/SimpleSailsChatroom,YannBertrand/SimpleSailsChatroom
--- +++ @@ -27,6 +27,6 @@ * See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html * * * ***************************************************************************/ - migrate: 'alter' + migrate: 'drop' };
ce7f98d32ed99177587848838484e1a76e7fb844
shaq_overflow/app/assets/javascripts/app.js
shaq_overflow/app/assets/javascripts/app.js
$(document).ready(function() { $("a.up-vote-answer").click(function(event) { event.preventDefault(); console.log("we here"); } ); });
$(document).ready(function() { $("a.up-vote-answer").click(function(event) { event.preventDefault(); var $target = $(event.target); console.log($target.data("url")) $.ajax({ type: "post", url: $target.data("url"), data: $target.data(), success: function(response) { $('#' + $target.data('answer-id')).empty(); $('#' + $target.data('answer-id')).append(response) } }); } ); });
Add ajax call for upvotes
Add ajax call for upvotes
JavaScript
mit
lucasrsantos1/lucky-ambassador,lucasrsantos1/lucky-ambassador,lucasrsantos1/lucky-ambassador
--- +++ @@ -2,7 +2,18 @@ $("a.up-vote-answer").click(function(event) { event.preventDefault(); - console.log("we here"); + var $target = $(event.target); + console.log($target.data("url")) + $.ajax({ + type: "post", + url: $target.data("url"), + data: $target.data(), + success: + function(response) { + $('#' + $target.data('answer-id')).empty(); + $('#' + $target.data('answer-id')).append(response) + } + }); } );