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 |
|---|---|---|---|---|---|---|---|---|---|---|
e3d2f266ed07b9a98f3a076d0684877e1d141970 | config/policies.js | config/policies.js | /**
* Policies are simply Express middleware functions which run before your controllers.
* You can apply one or more policies for a given controller or action.
*
* Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder,
* at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`)
*
* For more information on policies, check out:
* http://sailsjs.org/#documentation
*/
module.exports.policies = {
// Default policy for all controllers and actions
// (`true` allows public access)
'*': true,
GroupController: {
'*': 'authenticated'
},
MainController: {
'dashboard': 'authenticated'
},
RoomController: {
'*': 'authenticated'
},
UserController: {
'*': 'authenticated',
'create': true
}
};
| /**
* Policies are simply Express middleware functions which run before your controllers.
* You can apply one or more policies for a given controller or action.
*
* Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder,
* at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`)
*
* For more information on policies, check out:
* http://sailsjs.org/#documentation
*/
module.exports.policies = {
// Default policy for all controllers and actions
// (`true` allows public access)
'*': true,
GroupController: {
'*': 'authenticated',
'create': ['authenticated', 'admin'],
'manage': ['authenticated', 'admin'],
'user_add': ['authenticated', 'admin'],
'user_delete': ['authenticated', 'admin'],
'destroy': ['authenticated', 'admin']
},
MainController: {
'dashboard': 'authenticated'
},
MessageController: {
'*': 'authenticated'
},
RoomController: {
'*': 'authenticated',
'create': ['authenticated', 'admin'],
'manage': ['authenticated', 'admin'],
'destroy': ['authenticated', 'admin']
},
UserController: {
'*': 'authenticated',
'manage': ['authenticated', 'admin'],
'create': true
}
};
| Attach admin policy to actions which create or destroy groups, rooms, or users. | Attach admin policy to actions which create or destroy groups, rooms, or users.
Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com> | JavaScript | mit | maxfierke/WaterCooler | ---
+++
@@ -17,19 +17,32 @@
'*': true,
GroupController: {
- '*': 'authenticated'
+ '*': 'authenticated',
+ 'create': ['authenticated', 'admin'],
+ 'manage': ['authenticated', 'admin'],
+ 'user_add': ['authenticated', 'admin'],
+ 'user_delete': ['authenticated', 'admin'],
+ 'destroy': ['authenticated', 'admin']
},
MainController: {
'dashboard': 'authenticated'
},
+ MessageController: {
+ '*': 'authenticated'
+ },
+
RoomController: {
- '*': 'authenticated'
+ '*': 'authenticated',
+ 'create': ['authenticated', 'admin'],
+ 'manage': ['authenticated', 'admin'],
+ 'destroy': ['authenticated', 'admin']
},
UserController: {
'*': 'authenticated',
+ 'manage': ['authenticated', 'admin'],
'create': true
}
}; |
0f21e7aed83f547ced598a9d6c869b7814686eb5 | init/rollup.config.js | init/rollup.config.js | const rollupBabel = require('rollup-plugin-babel');
const rollupCommonjs = require('rollup-plugin-commonjs');
const rollupNodeResolve = require('rollup-plugin-node-resolve');
const rollupUglify = require('rollup-plugin-uglify');
const path = require('path');
const pkg = require(path.join(process.cwd(), 'package.json'));
const shouldMinify = process.argv.indexOf('--min') !== -1;
const presetEs2015 = require('babel-preset-es2015-rollup');
const babel = rollupBabel({
presets: presetEs2015,
});
const plugins = [
babel,
rollupCommonjs(),
rollupNodeResolve(),
];
if (shouldMinify) {
plugins.push(rollupUglify());
}
const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js';
const moduleName = pkg['build:global'] || pkg.name;
module.exports = {
dest: `dist/index${shouldMinify ? '.min' : ''}.js`,
entry,
exports: 'named',
format: 'umd',
moduleName,
plugins,
sourceMap: true,
useStrict: false,
};
| const rollupBabel = require('rollup-plugin-babel');
const rollupCommonjs = require('rollup-plugin-commonjs');
const rollupNodeResolve = require('rollup-plugin-node-resolve');
const rollupUglify = require('rollup-plugin-uglify');
const path = require('path');
const pkg = require(path.join(process.cwd(), 'package.json'));
const shouldMinify = process.argv.indexOf('--min') !== -1;
const presetEs2015 = require('babel-preset-es2015-rollup');
const babel = rollupBabel({
presets: presetEs2015,
});
const plugins = [
babel,
rollupCommonjs(),
rollupNodeResolve(),
];
if (shouldMinify) {
plugins.push(rollupUglify());
}
const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js';
const moduleName = pkg['build:global'] || pkg.name;
module.exports = {
dest: 'dist/index' + (shouldMinify ? '.min' : '') + '.js',
entry,
exports: 'named',
format: 'umd',
moduleName,
plugins,
sourceMap: true,
useStrict: false,
};
| Fix template literal issue with underscore templates. | fix(build): Fix template literal issue with underscore templates.
| JavaScript | mit | skatejs/build,skatejs/build | ---
+++
@@ -23,7 +23,7 @@
const moduleName = pkg['build:global'] || pkg.name;
module.exports = {
- dest: `dist/index${shouldMinify ? '.min' : ''}.js`,
+ dest: 'dist/index' + (shouldMinify ? '.min' : '') + '.js',
entry,
exports: 'named',
format: 'umd', |
bee126e3d4db9860e095f35a3c60b7b94f05b024 | blacklisted-sites.js | blacklisted-sites.js | // Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible.
// Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py
var BLACKLIST = [
'github',
'agolo.com',
'youtube',
'youtu.be',
'atlassian.net',
'spotify.com',
'twitter.com',
'mail.google',
'imgur.com',
'bit.ly',
'tinyurl',
'vine',
'dropbox'
];
/** Convert the array to an object and export it **/
var empty = {};
// Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object
var reducer = function(aggregate, element) {
aggregate[element] = 1;
return aggregate;
}
module.exports = BLACKLIST.reduce(reducer, empty);
| // Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible.
// Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py
var BLACKLIST = [
'github',
'agolo.com',
'youtube',
'youtu.be',
'atlassian.net',
'spotify.com',
'twitter.com',
'mail.google',
'imgur.com',
'bit.ly',
'tinyurl',
'vine',
'dropbox',
'zoom.us',
'appear.in'
];
/** Convert the array to an object and export it **/
var empty = {};
// Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object
var reducer = function(aggregate, element) {
aggregate[element] = 1;
return aggregate;
}
module.exports = BLACKLIST.reduce(reducer, empty);
| Add zoom.us and appear.in to blacklist | Add zoom.us and appear.in to blacklist | JavaScript | mit | premgane/agolo-slackbot | ---
+++
@@ -13,7 +13,9 @@
'bit.ly',
'tinyurl',
'vine',
- 'dropbox'
+ 'dropbox',
+ 'zoom.us',
+ 'appear.in'
];
|
884455a7aa3cc8f8a6f1d6f9ca28faa597b4993f | ipwb/serviceWorker.js | ipwb/serviceWorker.js | /* eslint-env serviceworker */
// This makes a module available named "reconstructive"
importScripts('reconstructive.js')
// Customize configs (defaults should work for IPWB out of the box)
// reconstructive.init({
// version: 'reconstructive.js:v1',
// urimPattern: self.location.origin + '/memento/<datetime>/<urir>',
// showBanner: false
// })
// Add any custom exclusions or modify or delete default ones
//> reconstructive.exclusions
//< {
//< notGet: f (event, config),
//< localResource: f (event, config)
//< }
reconstructive.exclusions.selfScript = function (event, config) {
event.request.url.endsWith('reconstructive.js')
}
// Pass a custom function to generate banner markup
// reconstructive.bannerCreator(f (event, rewritten, config))
// Or update the rewriting logic
// reconstructive.updateRewriter(f (event, rewritten, config))
// This is unnecessary, but can be useful for debugging or in future
self.addEventListener('install', function (event) {
console.log('Installing ServiceWorker.')
})
// This is unnecessary, but can be useful for debugging or in future
self.addEventListener('activate', function (event) {
console.log('Activating ServiceWorker.')
})
self.addEventListener("fetch", function(event) {
console.log('A fetch event triggered:', event);
// Add any custom logic here to conditionally call the reroute function
reconstructive.reroute(event);
})
| /* eslint-env serviceworker */
// This makes a module available named "reconstructive"
importScripts('/reconstructive.js')
// Customize configs (defaults should work for IPWB out of the box)
// reconstructive.init({
// version: 'reconstructive.js:v1',
// urimPattern: self.location.origin + '/memento/<datetime>/<urir>',
// showBanner: false
// })
// Add any custom exclusions or modify or delete default ones
//> reconstructive.exclusions
//< {
//< notGet: f (event, config),
//< localResource: f (event, config)
//< }
reconstructive.exclusions.selfScript = function (event, config) {
event.request.url.endsWith('reconstructive.js')
}
// Pass a custom function to generate banner markup
// reconstructive.bannerCreator(f (event, rewritten, config))
// Or update the rewriting logic
// reconstructive.updateRewriter(f (event, rewritten, config))
// This is unnecessary, but can be useful for debugging or in future
self.addEventListener('install', function (event) {
console.log('Installing ServiceWorker.')
})
// This is unnecessary, but can be useful for debugging or in future
self.addEventListener('activate', function (event) {
console.log('Activating ServiceWorker.')
})
self.addEventListener("fetch", function(event) {
console.log('A fetch event triggered:', event);
// Add any custom logic here to conditionally call the reroute function
reconstructive.reroute(event);
})
| Load reconstructive.js using an absolute path | Load reconstructive.js using an absolute path
| JavaScript | mit | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ---
+++
@@ -1,7 +1,7 @@
/* eslint-env serviceworker */
// This makes a module available named "reconstructive"
-importScripts('reconstructive.js')
+importScripts('/reconstructive.js')
// Customize configs (defaults should work for IPWB out of the box)
// reconstructive.init({ |
2b5bd27f0323428e6814b202fefbfb774be97256 | lib/engines/scss.js | lib/engines/scss.js | 'use strict';
var Engine = require('./engine');
var herit = require('herit');
var path = require('path');
module.exports = herit(Engine, {
defaults: function () {
return {
paths: [],
indentedSyntax: false
};
},
run: function (asset, cb) {
try {
var sass = require('node-sass');
sass.render({
data: asset.source,
indentedSyntax: this.options.indentedSyntax,
includePaths: this.options.paths.concat(path.dirname(asset.abs)),
success: function (res) {
asset.source = res.css;
if (!asset.ext()) asset.exts.push('css');
cb();
},
error: function (er) { cb(new Error(er)); }
});
} catch (er) { cb(er); }
}
});
| 'use strict';
var Engine = require('./engine');
var herit = require('herit');
var path = require('path');
module.exports = herit(Engine, {
defaults: function () {
return {
paths: [],
indentedSyntax: false
};
},
run: function (asset, cb) {
try {
var sass = require('node-sass');
sass.render({
data: asset.source,
indentedSyntax: this.options.indentedSyntax,
includePaths: this.options.paths.concat(path.dirname(asset.abs)),
success: function (res) {
asset.source = res.css;
if (!asset.ext()) asset.exts.push('css');
cb();
},
error: function (er) {
cb(new Error('Line ' + er.line + ': ' + er.message));
}
});
} catch (er) { cb(er); }
}
});
| Fix SCSS engine error message | Fix SCSS engine error message
| JavaScript | mit | caseywebdev/cogs,caseywebdev/cogs | ---
+++
@@ -24,7 +24,9 @@
if (!asset.ext()) asset.exts.push('css');
cb();
},
- error: function (er) { cb(new Error(er)); }
+ error: function (er) {
+ cb(new Error('Line ' + er.line + ': ' + er.message));
+ }
});
} catch (er) { cb(er); }
} |
3f55e7c83a838f2658191d475a00a453fe17157e | lib/infinitedivs.js | lib/infinitedivs.js | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var infinitedivs = function infinitedivs() {
_classCallCheck(this, infinitedivs);
};
exports.default = infinitedivs; | /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var infinitedivs = function infinitedivs() {
_classCallCheck(this, infinitedivs);
};
exports.default = infinitedivs;
/***/ }
/******/ ]); | Create infinitediv class and add basic buffer based loading. | Create infinitediv class and add basic buffer based loading.
| JavaScript | mit | supreetpal/infinite-divs,supreetpal/infinite-divs | ---
+++
@@ -1,13 +1,62 @@
-"use strict";
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
-var infinitedivs = function infinitedivs() {
- _classCallCheck(this, infinitedivs);
-};
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
-exports.default = infinitedivs;
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ var infinitedivs = function infinitedivs() {
+ _classCallCheck(this, infinitedivs);
+ };
+
+ exports.default = infinitedivs;
+
+/***/ }
+/******/ ]); |
368aef6a552b9b626b6e8e551f72d39f9a5ba144 | lib/modules/info.js | lib/modules/info.js | const chalk = require('chalk');
const helpers = require('../helpers');
exports.about = function () {
helpers.printMessage(chalk.green('Welcome to Space CLI'), '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches');
};
| const chalk = require('chalk');
const helpers = require('../helpers');
exports.about = function () {
helpers.printMessage(chalk.green('Welcome to Space CLI') + ' ' + '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches');
};
| Fix inconsistent rendering in about command | Fix inconsistent rendering in about command
| JavaScript | mit | Belar/space-cli | ---
+++
@@ -2,5 +2,5 @@
const helpers = require('../helpers');
exports.about = function () {
- helpers.printMessage(chalk.green('Welcome to Space CLI'), '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches');
+ helpers.printMessage(chalk.green('Welcome to Space CLI') + ' ' + '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches');
}; |
2c082c238124844a8bae0c83eb890455452b7067 | lib/services/swf.js | lib/services/swf.js | var AWS = require('../core');
/**
* @constant
* @readonly
* Backwards compatibility for access to the {AWS.SWF} service class.
*/
AWS.SimpleWorkflow = AWS.SWF;
| var AWS = require('../core');
AWS.util.hideProperties(AWS, ['SimpleWorkflow']);
/**
* @constant
* @readonly
* Backwards compatibility for access to the {AWS.SWF} service class.
*/
AWS.SimpleWorkflow = AWS.SWF;
| Hide SimpleWorkflow service class from AWS properties | Hide SimpleWorkflow service class from AWS properties
| JavaScript | apache-2.0 | grimurjonsson/aws-sdk-js,jeskew/aws-sdk-js,mohamed-kamal/aws-sdk-js,mapbox/aws-sdk-js,Blufe/aws-sdk-js,jeskew/aws-sdk-js,chrisradek/aws-sdk-js,chrisradek/aws-sdk-js,beni55/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,chrisradek/aws-sdk-js,guymguym/aws-sdk-js,chrisradek/aws-sdk-js,aws/aws-sdk-js,MitocGroup/aws-sdk-js,MitocGroup/aws-sdk-js,jippeholwerda/aws-sdk-js,odeke-em/aws-sdk-js,j3tm0t0/aws-sdk-js,MitocGroup/aws-sdk-js,Blufe/aws-sdk-js,prembasumatary/aws-sdk-js,jeskew/aws-sdk-js,j3tm0t0/aws-sdk-js,odeke-em/aws-sdk-js,LiuJoyceC/aws-sdk-js,guymguym/aws-sdk-js,dconnolly/aws-sdk-js,michael-donat/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,mohamed-kamal/aws-sdk-js,dconnolly/aws-sdk-js,grimurjonsson/aws-sdk-js,beni55/aws-sdk-js,prembasumatary/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,prembasumatary/aws-sdk-js,LiuJoyceC/aws-sdk-js,mohamed-kamal/aws-sdk-js,Blufe/aws-sdk-js,jippeholwerda/aws-sdk-js,GlideMe/aws-sdk-js,guymguym/aws-sdk-js,mapbox/aws-sdk-js,beni55/aws-sdk-js,AdityaManohar/aws-sdk-js,michael-donat/aws-sdk-js,ugie/aws-sdk-js,grimurjonsson/aws-sdk-js,jmswhll/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,GlideMe/aws-sdk-js,jeskew/aws-sdk-js,guymguym/aws-sdk-js,misfitdavidl/aws-sdk-js,odeke-em/aws-sdk-js,jmswhll/aws-sdk-js,prestomation/aws-sdk-js,jippeholwerda/aws-sdk-js,mapbox/aws-sdk-js,j3tm0t0/aws-sdk-js,LiuJoyceC/aws-sdk-js,michael-donat/aws-sdk-js,dconnolly/aws-sdk-js,aws/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,jmswhll/aws-sdk-js | ---
+++
@@ -1,4 +1,6 @@
var AWS = require('../core');
+
+AWS.util.hideProperties(AWS, ['SimpleWorkflow']);
/**
* @constant |
fb4ae324c3bd986677aa8dfed4b64bf5bae5beb6 | entity.js | entity.js | const createTransform = require('./transform')
let entityId = 0
function Entity (components, parent, tags) {
this.id = entityId++
this.tags = tags || []
this.components = components ? components.slice(0) : []
this.transform = this.getComponent('Transform')
if (!this.transform) {
this.transform = createTransform({
parent: parent ? parent.transform : null
})
this.components.unshift(this.transform)
}
this.transform.set({ parent: parent ? parent.transform : null })
this.components.forEach((component) => component.init(this))
}
Entity.prototype.dispose = function () {
// detach from the hierarchy
this.transform.set({ parent: null })
}
Entity.prototype.getComponent = function (type) {
return this.components.find((component) => component.type === type)
}
module.exports = function createEntity (components, parent, tags) {
return new Entity(components, parent, tags)
}
| const createTransform = require('./transform')
let entityId = 0
function Entity (components, parent, tags) {
this.id = entityId++
this.tags = tags || []
this.components = components ? components.slice(0) : []
this.transform = this.getComponent('Transform')
if (!this.transform) {
this.transform = createTransform({
parent: parent ? parent.transform : null
})
this.components.unshift(this.transform)
}
this.transform.set({ parent: parent ? parent.transform : null })
this.components.forEach((component) => component.init(this))
}
Entity.prototype.dispose = function () {
// detach from the hierarchy
this.transform.set({ parent: null })
}
Entity.prototype.addComponent = function (component) {
this.components.push(component)
component.init(this)
}
Entity.prototype.getComponent = function (type) {
return this.components.find((component) => component.type === type)
}
module.exports = function createEntity (components, parent, tags) {
return new Entity(components, parent, tags)
}
| Add addComponent method to Entity | Add addComponent method to Entity
| JavaScript | mit | pex-gl/pex-renderer,pex-gl/pex-renderer | ---
+++
@@ -26,6 +26,11 @@
this.transform.set({ parent: null })
}
+Entity.prototype.addComponent = function (component) {
+ this.components.push(component)
+ component.init(this)
+}
+
Entity.prototype.getComponent = function (type) {
return this.components.find((component) => component.type === type)
} |
3053a37c25fa000223642db9c0eb0dc8b0c265ae | migrations/20170401114125_initial.js | migrations/20170401114125_initial.js |
exports.up = (knex, Promise) => Promise.all([
knex.schema.createTableIfNotExists('user', (table) => {
table.integer('telegram_id')
.primary();
table.string('piikki_username')
.unique();
table.string('default_group');
table.text('json_state');
}),
]);
exports.down = (knex, Promise) => Promise.all([
knex.schema.dropTable('user'),
]);
|
exports.up = (knex, Promise) => Promise.all([
knex.schema.createTableIfNotExists('user', (table) => {
table.integer('telegram_id')
.primary();
table.string('piikki_username');
table.string('default_group');
table.text('json_state');
}),
]);
exports.down = (knex, Promise) => Promise.all([
knex.schema.dropTable('user'),
]);
| Allow multiple nulls in username | Allow multiple nulls in username
| JavaScript | mit | majori/piikki-client-tg | ---
+++
@@ -3,8 +3,7 @@
knex.schema.createTableIfNotExists('user', (table) => {
table.integer('telegram_id')
.primary();
- table.string('piikki_username')
- .unique();
+ table.string('piikki_username');
table.string('default_group');
table.text('json_state');
}), |
48d6b2ef33a9e8a27180d126db6cf37e6a685841 | src/components/SearchFilterCountries.js | src/components/SearchFilterCountries.js | import React from 'react';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { Button, Popover, Position, Spinner } from '@blueprintjs/core';
const SearchFilterCountries = ({ loaded, countries, currentValue, onOpen, onChange }) => {
function toggleCountryId(countryId) {
const newValue = currentValue.indexOf(countryId) > -1 ?
currentValue.filter(i => i !== countryId) : [...currentValue, countryId];
onChange(newValue);
}
return (
<Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline={true}>
<Button rightIconName="caret-down">
<FormattedMessage id="search.countries" defaultMessage="Countries"/>
{loaded && <span> (<FormattedNumber value={countries.length} />)</span>}
</Button>
<div className="search-filter-countries">
{loaded ?
<ul className="search-filter-countries-list">
{countries.map(country => (
<li onClick={toggleCountryId.bind(null, country.id)} key={country.id}>
<span className="pt-icon-standard pt-icon-tick"
style={{'visibility': currentValue.indexOf(country.id) > -1 ? 'visible': 'hidden'}} />
{country.label}
</li>
))}
</ul> :
<Spinner className="pt-large" />}
</div>
</Popover>
);
};
export default SearchFilterCountries;
| import React from 'react';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { Button, Popover, Position, Spinner } from '@blueprintjs/core';
const SearchFilterCountries = ({ loaded, countries, currentValue, onOpen, onChange }) => {
function toggleCountryId(countryId) {
const newValue = currentValue.indexOf(countryId) > -1 ?
currentValue.filter(i => i !== countryId) : [...currentValue, countryId];
onChange(newValue);
}
return (
<Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline>
<Button rightIconName="caret-down">
<FormattedMessage id="search.countries" defaultMessage="Countries"/>
{loaded && <span> (<FormattedNumber value={countries.length} />)</span>}
</Button>
<div className="search-filter-countries">
{loaded ?
<ul className="search-filter-countries-list">
{countries.map(country => (
<li onClick={toggleCountryId.bind(null, country.id)} key={country.id}>
<span className="pt-icon-standard pt-icon-tick"
style={{'visibility': currentValue.indexOf(country.id) > -1 ? 'visible': 'hidden'}} />
{country.label}
</li>
))}
</ul> :
<Spinner className="pt-large" />}
</div>
</Popover>
);
};
export default SearchFilterCountries;
| Remove unnecessary value on inline prop | Remove unnecessary value on inline prop
| JavaScript | mit | pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph | ---
+++
@@ -12,7 +12,7 @@
}
return (
- <Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline={true}>
+ <Popover position={Position.BOTTOM} popoverWillOpen={onOpen} inline>
<Button rightIconName="caret-down">
<FormattedMessage id="search.countries" defaultMessage="Countries"/>
{loaded && <span> (<FormattedNumber value={countries.length} />)</span>} |
8e75817344c4743a95f93efbb6a7124220183f60 | src/components/MdContent/styles.js | src/components/MdContent/styles.js | import theme from '../../theme'
export default {
mdContent: {},
content: {
position: 'relative',
},
markdown: {
display: 'block',
},
actions: {
float: 'right',
display: 'flex',
alignItems: 'center',
position: 'relative',
zIndex: 5
},
action: {
display: 'flex',
height: 30,
borderRight: [1, 'solid', theme.borderColor],
paddingRight: 20,
marginLeft: 20,
'&:last-child': {
isolate: false,
borderRight: 0,
paddingRight: 0
},
'&:first-child': {
marginLeft: 0
}
},
// Removes inlining with title.
[theme.media.md]: {
actions: {
float: 'none',
justifyContent: 'flex-end',
marginBottom: 20,
}
},
[theme.media.sm]: {
actions: {
justifyContent: 'center'
}
}
}
| import theme from '../../theme'
export default {
mdContent: {},
content: {
position: 'relative',
},
markdown: {
display: 'block',
},
actions: {
float: 'right',
display: 'flex',
alignItems: 'center',
position: 'relative',
zIndex: 5,
marginLeft: 20
},
action: {
display: 'flex',
height: 30,
borderRight: [1, 'solid', theme.borderColor],
paddingRight: 20,
marginLeft: 20,
'&:last-child': {
isolate: false,
borderRight: 0,
paddingRight: 0
},
'&:first-child': {
marginLeft: 0
}
},
// Removes inlining with title.
[theme.media.md]: {
actions: {
float: 'none',
justifyContent: 'flex-end',
marginBottom: 20,
}
},
[theme.media.sm]: {
actions: {
justifyContent: 'center'
}
}
}
| Fix space between title and version select | Fix space between title and version select
| JavaScript | mit | cssinjs/cssinjs | ---
+++
@@ -13,7 +13,8 @@
display: 'flex',
alignItems: 'center',
position: 'relative',
- zIndex: 5
+ zIndex: 5,
+ marginLeft: 20
},
action: {
display: 'flex', |
c08fa30117cf593cd91a1325b86a4199b0fd08f6 | config/webpack/webpack.config.test.js | config/webpack/webpack.config.test.js | "use strict";
/**
* Webpack frontend test configuration.
*/
var path = require("path");
var prodCfg = require("./webpack.config");
// Replace with `__dirname` if using in project root.
var ROOT = process.cwd();
var _ = require("lodash"); // devDependency
module.exports = {
cache: true,
context: path.join(ROOT, "test/client"),
entry: "./main",
output: {
filename: "main.js",
publicPath: "/assets/"
},
resolve: _.merge({}, prodCfg.resolve, {
alias: {
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
sinon: "node_modules/sinon/pkg/sinon.js",
// Allow root import of `src/FOO` from ROOT/src.
src: path.join(ROOT, "src")
}
}),
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
externals: {
"cheerio": "window",
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true
},
module: _.assign({}, prodCfg.module, {
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
noParse: [
/\/sinon\.js/
]
}),
devtool: "source-map"
};
| "use strict";
/**
* Webpack frontend test configuration.
*/
var path = require("path");
var prodCfg = require("./webpack.config");
// Replace with `__dirname` if using in project root.
var ROOT = process.cwd();
var _ = require("lodash"); // devDependency
module.exports = {
cache: true,
context: path.join(ROOT, "test/client"),
entry: "./main",
output: {
filename: "main.js",
publicPath: "/assets/"
},
resolve: _.merge({}, prodCfg.resolve, {
alias: {
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
sinon: "node_modules/sinon/pkg/sinon.js",
// Allow root import of `src/FOO` from ROOT/src.
src: path.join(ROOT, "src")
}
}),
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
externals: {
"cheerio": "window",
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true,
"react/addons": true
},
module: _.assign({}, prodCfg.module, {
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47
noParse: [
/\/sinon\.js/
]
}),
devtool: "source-map"
};
| Fix for enzyme and react 15 | Fix for enzyme and react 15
| JavaScript | mit | FormidableLabs/builder-radium-component,FormidableLabs/builder-radium-component | ---
+++
@@ -29,7 +29,8 @@
externals: {
"cheerio": "window",
"react/lib/ExecutionEnvironment": true,
- "react/lib/ReactContext": true
+ "react/lib/ReactContext": true,
+ "react/addons": true
},
module: _.assign({}, prodCfg.module, {
// enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 |
59fd6e6d26ddb98957dcdcdb415efddad1080be3 | content/bootloader.js | content/bootloader.js |
// Render the environment & partner menus
renderEnvironmentMenuItems();
renderPartnerMenuItems();
renderGaugeRowItems();
// Events binding
window.onhashchange = _handlerRefreshMenuAndPage;
// Update the menu and render the content
_handlerRefreshMenuAndPage();
|
// Render the environment & partner menus
renderEnvironmentMenuItems();
renderPartnerMenuItems();
renderGaugeRowItems();
// Events binding
window.onhashchange = _handlerRefreshMenuAndPage;
// Update the menu and render the content
_handlerRefreshMenuAndPage();
(function myLoop (i) {
setTimeout(function () {
renderGaugeRowItems();
if (--i) {
myLoop(i);
}
}, 3000)
})(1000);
| Add simple code for time triggering of gauge | Add simple code for time triggering of gauge
| JavaScript | mit | vejuhust/yet-another-monitoring-dashboard,vejuhust/yet-another-monitoring-dashboard | ---
+++
@@ -9,3 +9,12 @@
// Update the menu and render the content
_handlerRefreshMenuAndPage();
+
+(function myLoop (i) {
+ setTimeout(function () {
+ renderGaugeRowItems();
+ if (--i) {
+ myLoop(i);
+ }
+ }, 3000)
+})(1000); |
8ccc4d34fe92889c75a06d01bcdbd9df226aa965 | inject.js | inject.js | function receiveMessage(event) {
var commentPath,
frameURL;
// get url of comment
commentPath = event.data.commentURL;
frameURL = "https://news.ycombinator.com/" + commentPath;
showComments( frameURL )
}
var showComments = function( URL ) {
var commentFrame;
}
var drawIframe = function() {
var frameset,
pageURL,
pageFrame,
commentFrame,
html,
body;
html = document.querySelector( "html" );
body = document.querySelector( "body" );
frameset = document.createElement( "frameset" );
pageFrame = document.createElement( "frame" );
commentFrame = document.createElement( "frame" );
pageFrame.setAttribute( "id", "page-frame" );
commentFrame.setAttribute( "id", "comment-frame" );
pageURL = document.URL;
if ( body )
body.parentNode.removeChild( body );
frameset.appendChild( pageFrame );
frameset.appendChild( commentFrame );
html.appendChild( frameset );
pageFrame.setAttribute( "src", pageURL );
}
drawIframe();
window.addEventListener("message", receiveMessage, false); | function receiveMessage(event) {
var commentPath,
frameURL;
// get url of comment
commentPath = event.data.commentURL;
frameURL = "https://news.ycombinator.com/" + commentPath;
showComments( frameURL )
}
var showComments = function( URL ) {
var commentFrame;
commentFrame = document.querySelector( "#frameID" );
commentFrame.setAttribute( "src", URL );
}
var drawIframe = function() {
var frameset,
pageURL,
pageFrame,
commentFrame,
html,
body;
html = document.querySelector( "html" );
body = document.querySelector( "body" );
frameset = document.createElement( "frameset" );
pageFrame = document.createElement( "frame" );
commentFrame = document.createElement( "frame" );
pageFrame.setAttribute( "id", "page-frame" );
commentFrame.setAttribute( "id", "comment-frame" );
pageURL = document.URL;
if ( body )
body.parentNode.removeChild( body );
frameset.appendChild( pageFrame );
frameset.appendChild( commentFrame );
html.appendChild( frameset );
pageFrame.setAttribute( "src", pageURL );
}
drawIframe();
window.addEventListener("message", receiveMessage, false); | Set attribute of comment frame. | Set attribute of comment frame.
| JavaScript | mit | tonyonodi/reddit-comments,tonyonodi/reddit-comments,tonyonodi/back-to-the-comments,tonyonodi/back-to-the-comments | ---
+++
@@ -11,7 +11,10 @@
var showComments = function( URL ) {
var commentFrame;
-
+
+ commentFrame = document.querySelector( "#frameID" );
+ commentFrame.setAttribute( "src", URL );
+
}
var drawIframe = function() { |
62dee18342aa659ad1f124be9de70b11d3a0c0d1 | src/jar/lang/Object/Object-info.js | src/jar/lang/Object/Object-info.js | JAR.register({
MID: 'jar.lang.Object.Object-info',
deps: ['..', '.!reduce|derive', '..Array!reduce']
}, function(lang, Obj, Arr) {
'use strict';
var reduce = Obj.reduce;
lang.extendNativeType('Object', {
keys: function() {
return reduce(this, pushKey, []);
},
pairs: function() {
return reduce(this, pushKeyValue, []);
},
prop: function(key) {
var propList = key.split('.');
return Arr.reduce(propList, extractProperty, this);
},
size: function() {
return reduce(this, countProperties, 0);
},
values: function() {
return reduce(this, pushValue, []);
}
});
function extractProperty(obj, key) {
return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined;
}
function countProperties(size) {
return ++size;
}
function pushKey(array, value, key) {
array[array.length] = key;
return array;
}
function pushValue(array, value) {
array[array.length] = value;
return array;
}
function pushKeyValue(array, value, key) {
array[array.length] = [key, value];
return array;
}
return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']);
}); | JAR.register({
MID: 'jar.lang.Object.Object-info',
deps: ['..', '.!reduce|derive', '..Array!reduce']
}, function(lang, Obj, Arr) {
'use strict';
var reduce = Obj.reduce;
lang.extendNativeType('Object', {
keys: function() {
return reduce(this, pushKey, Arr());
},
pairs: function() {
return reduce(this, pushKeyValue, Arr());
},
prop: function(key) {
var propList = key.split('.');
return Arr.reduce(propList, extractProperty, this);
},
size: function() {
return reduce(this, countProperties, 0);
},
values: function() {
return reduce(this, pushValue, Arr());
}
});
function extractProperty(obj, key) {
return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined;
}
function countProperties(size) {
return ++size;
}
function pushKey(array, value, key) {
array[array.length] = key;
return array;
}
function pushValue(array, value) {
array[array.length] = value;
return array;
}
function pushKeyValue(array, value, key) {
array[array.length] = Arr(key, value);
return array;
}
return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']);
}); | Use jar.lang.Array instead of native as returnvalue | Use jar.lang.Array instead of native as returnvalue
| JavaScript | mit | HROH/JAR | ---
+++
@@ -8,11 +8,11 @@
lang.extendNativeType('Object', {
keys: function() {
- return reduce(this, pushKey, []);
+ return reduce(this, pushKey, Arr());
},
pairs: function() {
- return reduce(this, pushKeyValue, []);
+ return reduce(this, pushKeyValue, Arr());
},
prop: function(key) {
@@ -26,7 +26,7 @@
},
values: function() {
- return reduce(this, pushValue, []);
+ return reduce(this, pushValue, Arr());
}
});
@@ -51,7 +51,7 @@
}
function pushKeyValue(array, value, key) {
- array[array.length] = [key, value];
+ array[array.length] = Arr(key, value);
return array;
} |
9cd54ca34eee54d3cbe357147f2f81c6021bc606 | controllers/widget.js | controllers/widget.js | var args = _.extend({
duration: 2000,
animationDuration: 250,
message: '',
title: Ti.App.name,
elasticity: 0.5,
pushForce: 30,
usePhysicsEngine: true
}, arguments[0] || {});
var That = null;
exports.show = function(opt) {
if (_.isObject(opt)) _.extend(args, opt);
if (_.isString(opt)) _.extend(args, { message: opt });
if (OS_ANDROID && args.view == null) {
Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification.");
That = Ti.UI.createNotification({
message: args.message,
duration: args.duration
});
That.show();
} else {
That = Widget.createController('window', args);
}
};
exports.hide = function() {
if (That != null) {
That.hide();
}
}; | var args = _.extend({
duration: 2000,
animationDuration: 250,
message: '',
title: Ti.App.name,
elasticity: 0.5,
pushForce: 30,
usePhysicsEngine: true
}, arguments[0] || {});
var That = null;
exports.show = function(opt) {
if (_.isObject(opt)) _.extend(args, opt);
if (_.isString(opt)) _.extend(args, { message: opt });
if (OS_ANDROID && args.view == null) {
Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification.");
That = Ti.UI.createNotification({
message: args.message,
duration: args.duration
});
That.show();
} else {
That = Widget.createController('window', args);
}
};
exports.update = function(message)
{
That.update(message);
};
exports.hide = function() {
if (That != null) {
That.hide();
}
};
| Allow update of notification text. | Allow update of notification text.
Allows you to update the message in the notification.
I wanted this feature to allow me to show loading percentage in the notification when downloading or uploading data. | JavaScript | mit | titanium-forks/CaffeinaLab.com.caffeinalab.titanium.notifications,CaffeinaLab/Ti.Notifications,DouglasHennrich/Ti.Notifications | ---
+++
@@ -31,6 +31,11 @@
}
};
+exports.update = function(message)
+{
+ That.update(message);
+};
+
exports.hide = function() {
if (That != null) {
That.hide(); |
2e048f088512f37e0fcc6feec79930b64a615c1d | number_insight/ni-advanced.js | number_insight/ni-advanced.js | require('dotenv').config({path: __dirname + '/../.env'})
const NEXMO_API_KEY = process.env.NEXMO_API_KEY
const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET
// By default use the command line argument. Otherwise use the environment variable.
const INSIGHT_NUMBER = process.argv[2] || process.env.INSIGHT_NUMBER;
const Nexmo = require('nexmo');
const nexmo = new Nexmo({
apiKey: NEXMO_API_KEY,
apiSecret: NEXMO_API_SECRET
});
nexmo.numberInsight.get({level: 'advanced', number: INSIGHT_NUMBER}, (error, result) => {
if(error) {
console.error(error);
}
else {
console.log(result);
}
});
| require('dotenv').config({path: __dirname + '/../.env'})
const NEXMO_API_KEY = process.env.NEXMO_API_KEY
const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET
// By default use the command line argument. Otherwise use the environment variable.
const INSIGHT_NUMBER = process.argv[2] || process.env.INSIGHT_NUMBER;
const Nexmo = require('nexmo');
const nexmo = new Nexmo({
apiKey: NEXMO_API_KEY,
apiSecret: NEXMO_API_SECRET
});
nexmo.numberInsight.get({level: 'advancedSync', number: INSIGHT_NUMBER}, (error, result) => {
if(error) {
console.error(error);
}
else {
console.log(result);
}
});
| Change level from `advanced` to `advancedSync` | Change level from `advanced` to `advancedSync`
As per: https://github.com/Nexmo/nexmo-node/pull/232 | JavaScript | mit | nexmo-community/nexmo-node-quickstart,nexmo-community/nexmo-node-quickstart | ---
+++
@@ -13,7 +13,7 @@
apiSecret: NEXMO_API_SECRET
});
-nexmo.numberInsight.get({level: 'advanced', number: INSIGHT_NUMBER}, (error, result) => {
+nexmo.numberInsight.get({level: 'advancedSync', number: INSIGHT_NUMBER}, (error, result) => {
if(error) {
console.error(error);
} |
460569d2ccd067dea0fcebca62a266e4f43c4ac8 | src/express/middleware/createContext.js | src/express/middleware/createContext.js | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
var data = require('../../data'),
notifications = require('../../notifications'),
attachOperators = require('../../query/attachOperators'),
logger = require('../../logger');
module.exports = function (configuration) {
var dataProvider = data(configuration),
notificationsClient = notifications(configuration.notifications).getClient();
return function (req, res, next) {
req.azureMobile = {
req: req,
res: res,
data: dataProvider,
push: notificationsClient,
configuration: configuration,
logger: logger,
tables: function (name) {
return attachOperators(name, dataProvider(configuration.tables[name]));
}
};
next();
};
};
| // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
var data = require('../../data'),
notifications = require('../../notifications'),
attachOperators = require('../../query/attachOperators'),
logger = require('../../logger');
module.exports = function (configuration) {
var dataProvider = data(configuration),
notificationsClient = notifications(configuration.notifications).getClient();
return function (req, res, next) {
req.azureMobile = {
req: req,
res: res,
data: dataProvider,
push: notificationsClient,
configuration: configuration,
logger: logger,
tables: function (name) {
if(!configuration.tables[name])
throw new Error("The table '" + name + "' does not exist.")
return attachOperators(name, dataProvider(configuration.tables[name]));
}
};
next();
};
};
| Throw meaningful exception if table does not exist | Throw meaningful exception if table does not exist
| JavaScript | mit | mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node | ---
+++
@@ -19,6 +19,8 @@
configuration: configuration,
logger: logger,
tables: function (name) {
+ if(!configuration.tables[name])
+ throw new Error("The table '" + name + "' does not exist.")
return attachOperators(name, dataProvider(configuration.tables[name]));
}
}; |
7512a4e4e4588c16883ebc5499804a05286d1b64 | web/src/js/views/location-chooser.js | web/src/js/views/location-chooser.js | import locations from '../core/locations';
import View from '../base/view';
import {trigger} from '../utils/browser';
import template from '../../templates/location-chooser.ejs';
export default class LocationChooser extends View {
constructor({app, location, route}) {
super({app});
this.location = location;
this.route = route;
}
getHTML() {
const currentLocation = this.location;
const targetRoute = this.getTargetRoute();
return this.app.renderTemplate(template, {
locations, targetRoute, currentLocation});
}
mount() {
this.events.bind('change', 'onChange');
}
getTargetRoute() {
if (this.route.name == 'place-list') {
return {name: 'place-list', args: this.route.args};
} else if (this.route.name == 'event-list') {
return {name: 'event-list', args: this.route.args};
} else {
return {name: 'event-list', args: {}};
}
}
onChange(event) {
trigger(window, 'navigate', this.element.value);
}
}
| import locations from '../core/locations';
import View from '../base/view';
import {trigger} from '../utils/browser';
import template from '../../templates/location-chooser.ejs';
export default class LocationChooser extends View {
constructor({app, location, route}) {
super({app});
this.location = location;
this.route = route;
}
getHTML() {
const currentLocation = this.location;
const targetRoute = this.getTargetRoute();
return this.app.renderTemplate(template, {
locations, targetRoute, currentLocation});
}
mount() {
this.events.bind('change', 'onChange');
}
getTargetRoute() {
if (['place-list', 'event-list'].includes(this.route.name)) {
return this.route;
} else {
return {name: 'event-list', args: {}};
}
}
onChange(event) {
trigger(window, 'navigate', this.element.value);
}
}
| Simplify location chooser target route logic | Simplify location chooser target route logic
| JavaScript | mit | despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics | ---
+++
@@ -27,10 +27,8 @@
}
getTargetRoute() {
- if (this.route.name == 'place-list') {
- return {name: 'place-list', args: this.route.args};
- } else if (this.route.name == 'event-list') {
- return {name: 'event-list', args: this.route.args};
+ if (['place-list', 'event-list'].includes(this.route.name)) {
+ return this.route;
} else {
return {name: 'event-list', args: {}};
} |
c69e67b560fd1fa97674f254e88e5637d177d1d9 | js/app.js | js/app.js | "use strict";
(function() {
var filters = {
age: function() {
this
.saturation(20)
.gamma(1.4)
.vintage()
.contrast(5)
.exposure(15)
.vignette(300, 60)
.render()
},
lomo: function() {
this
.brightness(15)
.exposure(15)
.curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255])
.saturation(-20)
.gamma(1.8)
.vignette("50%", 60)
.brightness(5)
.render()
},
oldtv: function() {
this
.saturation(-60)
.contrast(30)
.noise(20)
.vignette("50%", 70)
.render()
}
};
$('#filters button').click(function(e) {
e.preventDefault();
Caman("#canvas").revert();
Caman("#canvas", filters[$(this).data('filter')]);
$('#filters button').removeClass('active');
$(this).addClass('active');
});
})()
| "use strict";
(function() {
var filters = {
age: function() {
this
.saturation(20)
.gamma(1.4)
.vintage()
.contrast(5)
.exposure(15)
.vignette(300, 60)
.render()
},
blackAndWhite: function() {
this
.gamma(100)
.contrast(30)
.saturation(-100)
.render()
},
lomo: function() {
this
.brightness(15)
.exposure(15)
.curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255])
.saturation(-20)
.gamma(1.8)
.vignette("50%", 60)
.brightness(5)
.render()
},
oldtv: function() {
this
.saturation(-60)
.contrast(30)
.noise(20)
.vignette("50%", 70)
.render()
}
};
$('#filters button').click(function(e) {
e.preventDefault();
Caman("#canvas").revert();
Caman("#canvas", filters[$(this).data('filter')]);
$('#filters button').removeClass('active');
$(this).addClass('active');
});
})()
| Add black and white filter | Add black and white filter
| JavaScript | bsd-2-clause | fwenzel/hipstergram | ---
+++
@@ -10,6 +10,14 @@
.contrast(5)
.exposure(15)
.vignette(300, 60)
+ .render()
+ },
+
+ blackAndWhite: function() {
+ this
+ .gamma(100)
+ .contrast(30)
+ .saturation(-100)
.render()
},
|
b304daf4802a5fa1a870ac65ab9f3674eb83b4c1 | app/js/store.js | app/js/store.js | 'use strict';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducer from './reducers';
const createStoreWithMiddleware = compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore);
export default createStoreWithMiddleware(reducer);
| 'use strict';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducer from './reducers';
const createStoreWithMiddleware = applyMiddleware(
thunk
)(createStore);
export default createStoreWithMiddleware(reducer);
| Revert "Add dev tools stuff" | Revert "Add dev tools stuff"
This reverts commit 46ebaea0030bdb0b81aa5b6ac343f70a968910b9.
| JavaScript | mit | rit-sse/officers,rit-sse/officers | ---
+++
@@ -1,12 +1,11 @@
'use strict';
-import { createStore, applyMiddleware, compose } from 'redux';
+import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducer from './reducers';
-const createStoreWithMiddleware = compose(
- applyMiddleware(thunk),
- window.devToolsExtension ? window.devToolsExtension() : f => f
+const createStoreWithMiddleware = applyMiddleware(
+ thunk
)(createStore);
export default createStoreWithMiddleware(reducer); |
ed2d17a60d5d560f3c22722221603d846457ae9c | lib/router.js | lib/router.js | var subscriptions = new SubsManager();
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound'
});
Router.route('/', {
name: 'home',
waitOn: function() {
return subscriptions.subscribe('allOwnedMangas', Meteor.userId());
},
fastRender: true
});
| var subscriptions = new SubsManager();
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound'
});
Router.route('/', {
name: 'home',
waitOn: function() {
return subscriptions.subscribe('allOwnedMangas', Meteor.userId());
},
fastRender: true
});
Router.route('/missingMangas', {
name: 'missingMangas',
waitOn: function() {
return subscriptions.subscribe('allMissingMangas', Meteor.userId());
},
fastRender: true
});
| Add route for missing mangas | Add route for missing mangas
| JavaScript | mit | dexterneo/mangas,dexterneo/mangas,dexterneo/mangatek,dexterneo/mangatek | ---
+++
@@ -13,3 +13,11 @@
},
fastRender: true
});
+
+Router.route('/missingMangas', {
+ name: 'missingMangas',
+ waitOn: function() {
+ return subscriptions.subscribe('allMissingMangas', Meteor.userId());
+ },
+ fastRender: true
+}); |
3eba8d104dea9a21650e0dcb52ec8d00d42fe4b0 | plugin.js | plugin.js | 'use strict';
// Make our own plugin main interface an event emitter.
// This can be used to communicate and subscribe to others plugins events.
import { EventEmitter } from 'events';
/**
* Plugin Interface
* @class Plugin
*/
export default class extends EventEmitter {
/**
* Construct the plugin.
*/
constructor() {
super();
// Will be injected by core
this.app = null;
this.plugins = null;
this.server = null;
this.players = null;
this.maps = null;
/**
* Will hold the defined models for this plugin!
*
* @type {{}}
*/
this.models = {};
}
/**
* Inject Core App interface into the plugin.
*
* @param {App} app
*/
inject(app) {
this.app = app;
this.server = app.server;
// Expand app into separate parts.
// TODO: Fill in plugins, server, players, maps.
}
}
| 'use strict';
// Make our own plugin main interface an event emitter.
// This can be used to communicate and subscribe to others plugins events.
import { EventEmitter } from 'events';
/**
* Plugin Interface
* @class Plugin
*/
export default class extends EventEmitter {
/**
* Construct the plugin.
*/
constructor() {
super();
// Will be injected by core
this.app = null;
this.plugins = null;
this.server = null;
this.players = null;
this.maps = null;
/**
* Will hold the defined models for this plugin!
*
* @type {{}}
*/
this.models = {};
}
/**
* Inject Core App interface into the plugin.
*
* @param {App} app
*/
inject(app) {
this.app = app;
this.server = app.server;
// Expand app into separate parts.
this.players = app.players;
this.maps = app.maps;
}
}
| Prepare for players and maps update of core. | Prepare for players and maps update of core.
| JavaScript | isc | ManiaJS/plugins,ManiaJS/plugins,ManiaJS/plugins | ---
+++
@@ -44,6 +44,7 @@
this.server = app.server;
// Expand app into separate parts.
- // TODO: Fill in plugins, server, players, maps.
+ this.players = app.players;
+ this.maps = app.maps;
}
} |
00efb338ffc61def70a3deb5aebc47d1f76203de | jsrts/Runtime-node.js | jsrts/Runtime-node.js | $JSRTS.os = require('os');
$JSRTS.fs = require('fs');
$JSRTS.prim_systemInfo = function (index) {
switch (index) {
case 0:
return "node";
case 1:
return $JSRTS.os.platform();
}
return "";
};
$JSRTS.prim_writeStr = function (x) { return process.stdout.write(x) }
$JSRTS.prim_readStr = function () {
var ret = '';
var b = new Buffer(1024);
var i = 0;
while (true) {
$JSRTS.fs.readSync(0, b, i, 1)
if (b[i] == 10) {
ret = b.toString('utf8', 0, i);
break;
}
i++;
if (i == b.length) {
nb = new Buffer(b.length * 2);
b.copy(nb)
b = nb;
}
}
return ret;
}; | $JSRTS.os = require('os');
$JSRTS.fs = require('fs');
$JSRTS.prim_systemInfo = function (index) {
switch (index) {
case 0:
return "node";
case 1:
return $JSRTS.os.platform();
}
return "";
};
$JSRTS.prim_writeStr = function (x) { return process.stdout.write(x) }
$JSRTS.prim_readStr = function () {
var ret = '';
var b = new Buffer(1024);
var i = 0;
while (true) {
$JSRTS.fs.readSync(0, b, i, 1)
if (b[i] == 10) {
ret = b.toString('utf8', 0, i);
break;
}
i++;
if (i == b.length) {
var nb = new Buffer(b.length * 2);
b.copy(nb)
b = nb;
}
}
return ret;
}; | Fix undeclared variable in node runtime | Fix undeclared variable in node runtime
| JavaScript | bsd-3-clause | uuhan/Idris-dev,uuhan/Idris-dev,uuhan/Idris-dev,kojiromike/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,uuhan/Idris-dev,markuspf/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,markuspf/Idris-dev,kojiromike/Idris-dev,kojiromike/Idris-dev,kojiromike/Idris-dev | ---
+++
@@ -22,7 +22,7 @@
}
i++;
if (i == b.length) {
- nb = new Buffer(b.length * 2);
+ var nb = new Buffer(b.length * 2);
b.copy(nb)
b = nb;
} |
3692239249bb4d9efd4e84a2c1ea81d31b28f736 | spec/global-spec.js | spec/global-spec.js | var proxyquire = require("proxyquire");
// Returns an ajax instance that has the underlying XMLHttpRequest stubbed.
function getStubbedAjax(stub) {
proxyquire("../index.js", {
xmlhttprequest: {
"XMLHttpRequest": function () {
this.open = function () {};
this.send = function () {};
this.setRequestHeader = function () {
this.readyState = 4;
this.status = 200;
this.onreadystatechange();
};
if (stub != null) {
for (var method in stub) {
this[method] = stub[method];
}
}
}
}
});
return require("../index.js");
}
describe("The get method", function () {
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.get("http://www.example.com")
.then(function () {
done();
}, function () {
fail();
})
});
}); | var proxyquire = require("proxyquire");
// Returns an ajax instance that has the underlying XMLHttpRequest stubbed.
function getStubbedAjax(stub) {
proxyquire("../index.js", {
xmlhttprequest: {
"XMLHttpRequest": function () {
this.open = function () {};
this.send = function () {};
this.setRequestHeader = function () {
this.readyState = 4;
this.status = 200;
this.onreadystatechange();
};
if (stub != null) {
for (var method in stub) {
this[method] = stub[method];
}
}
}
}
});
return require("../index.js");
}
describe("The get method", function () {
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.get("http://www.example.com")
.then(done, fail);
});
});
describe("The post method", function () {
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.post("http://www.example.com")
.then(done, fail);
});
});
describe("The put method", function () {
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.put("http://www.example.com")
.then(done, fail);
});
});
describe("The del method", function () {
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.del("http://www.example.com")
.then(done, fail);
});
}); | Add basic tests for post/put/del | Add basic tests for post/put/del
| JavaScript | mit | levibotelho/dead-simple-ajax | ---
+++
@@ -27,10 +27,31 @@
it("works", function (done) {
var ajax = getStubbedAjax();
ajax.get("http://www.example.com")
- .then(function () {
- done();
- }, function () {
- fail();
- })
+ .then(done, fail);
});
});
+
+describe("The post method", function () {
+ it("works", function (done) {
+ var ajax = getStubbedAjax();
+ ajax.post("http://www.example.com")
+ .then(done, fail);
+ });
+});
+
+
+describe("The put method", function () {
+ it("works", function (done) {
+ var ajax = getStubbedAjax();
+ ajax.put("http://www.example.com")
+ .then(done, fail);
+ });
+});
+
+describe("The del method", function () {
+ it("works", function (done) {
+ var ajax = getStubbedAjax();
+ ajax.del("http://www.example.com")
+ .then(done, fail);
+ });
+}); |
da1cd5e7b6cfe09fb21599dd590b49aada010e3d | koans/AboutExpects.js | koans/AboutExpects.js | describe("About Expects", function() {
/We shall contemplate truth by testing reality, via spec expectations.
it("should expect true", function() {
expect(true).toBeTruthy(); //This should be true
});
//To understand reality, we must compare our expectations against reality.
it("should expect equality", function () {
var expectedValue = FILL_ME_IN;
var actualValue = 1 + 1;
expect(actualValue === expectedValue).toBeTruthy();
});
//Some ways of asserting equality are better than others.
it("should assert equality a better way", function () {
var expectedValue = FILL_ME_IN;
var actualValue = 1 + 1;
// toEqual() compares using common sense equality.
expect(actualValue).toEqual(expectedValue);
});
//Sometimes you need to be really exact about what you "type".
it("should assert equality with ===", function () {
var expectedValue = FILL_ME_IN;
var actualValue = (1 + 1).toString();
// toBe() will always use === to compare.
expect(actualValue).toBe(expectedValue);
});
//Sometimes we will ask you to fill in the values.
it("should have filled in values", function () {
expect(1 + 1).toEqual(FILL_ME_IN);
});
});
| describe("About Expects", function() {
/We shall contemplate truth by testing reality, via spec expectations.
it("should expect true", function() {
expect(true).toBeTruthy(); //This should be true
});
//To understand reality, we must compare our expectations against reality.
it("should expect equality", function () {
var expectedValue = 2;
var actualValue = 1 + 1;
expect(actualValue === expectedValue).toBeTruthy();
});
//Some ways of asserting equality are better than others.
it("should assert equality a better way", function () {
var expectedValue = 2;
var actualValue = 1 + 1;
// toEqual() compares using common sense equality.
expect(actualValue).toEqual(expectedValue);
});
//Sometimes you need to be really exact about what you "type".
it("should assert equality with ===", function () {
var expectedValue = "2";
var actualValue = (1 + 1).toString();
// toBe() will always use === to compare.
expect(actualValue).toBe(expectedValue);
});
//Sometimes we will ask you to fill in the values.
it("should have filled in values", function () {
expect(1 + 1).toEqual(2);
});
});
| Change FILL_ME_IN to respective types | Change FILL_ME_IN to respective types
| JavaScript | mit | Imti/javascript-koans,Imti/javascript-koans | ---
+++
@@ -7,7 +7,7 @@
//To understand reality, we must compare our expectations against reality.
it("should expect equality", function () {
- var expectedValue = FILL_ME_IN;
+ var expectedValue = 2;
var actualValue = 1 + 1;
expect(actualValue === expectedValue).toBeTruthy();
@@ -15,7 +15,7 @@
//Some ways of asserting equality are better than others.
it("should assert equality a better way", function () {
- var expectedValue = FILL_ME_IN;
+ var expectedValue = 2;
var actualValue = 1 + 1;
// toEqual() compares using common sense equality.
@@ -24,7 +24,7 @@
//Sometimes you need to be really exact about what you "type".
it("should assert equality with ===", function () {
- var expectedValue = FILL_ME_IN;
+ var expectedValue = "2";
var actualValue = (1 + 1).toString();
// toBe() will always use === to compare.
@@ -33,6 +33,6 @@
//Sometimes we will ask you to fill in the values.
it("should have filled in values", function () {
- expect(1 + 1).toEqual(FILL_ME_IN);
+ expect(1 + 1).toEqual(2);
});
}); |
260c02133464f51f80d117fdb67893247f55551a | testem.js | testem.js | var Reporter = require('ember-test-utils/reporter')
module.exports = {
disable_watching: true,
framework: 'mocha',
launch_in_ci: [
'Chrome',
'Firefox'
],
launch_in_dev: [
'Chrome'
],
reporter: new Reporter(),
test_page: 'tests/index.html?hidepassed'
}
| var Reporter = require('ember-test-utils/reporter')
module.exports = {
disable_watching: true,
framework: 'mocha',
launch_in_ci: [
'Firefox',
'Chrome'
],
launch_in_dev: [
'Chrome'
],
reporter: new Reporter(),
test_page: 'tests/index.html?hidepassed'
}
| Test firefox first, so Chrome coverage is used | Test firefox first, so Chrome coverage is used
| JavaScript | mit | dafortin/ember-frost-core,EWhite613/ember-frost-core,helrac/ember-frost-core,rox163/ember-frost-core,EWhite613/ember-frost-core,dafortin/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core,dafortin/ember-frost-core,EWhite613/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core | ---
+++
@@ -4,8 +4,8 @@
disable_watching: true,
framework: 'mocha',
launch_in_ci: [
- 'Chrome',
- 'Firefox'
+ 'Firefox',
+ 'Chrome'
],
launch_in_dev: [
'Chrome' |
6384ec4372c63b3d5dc5bd540a2dca39552c910c | script.js | script.js | function playAudioOnKeyDown(elt) {
let soundToPlay = document.querySelector(`audio[data-key="${elt.keyCode}"]`);
let keyToAnimate = document.querySelector(`div[data-key="${elt.keyCode}"]`);
keyToAnimate.classList.add('playing');
soundToPlay.currentTime = 0;
soundToPlay.play();
keyToAnimate.addEventListener('transitionend', function(element){
if(element.target.classList.contains('playing')) {
element.target.classList.remove('playing');
}
});
}
window.addEventListener('keydown', playAudioOnKeyDown); | Modify JavaScript file, first working version with keyDown | Modify JavaScript file, first working version with keyDown
| JavaScript | mit | shahzaibkhalid/electronic-drum-kit,shahzaibkhalid/electronic-drum-kit | ---
+++
@@ -0,0 +1,14 @@
+function playAudioOnKeyDown(elt) {
+ let soundToPlay = document.querySelector(`audio[data-key="${elt.keyCode}"]`);
+ let keyToAnimate = document.querySelector(`div[data-key="${elt.keyCode}"]`);
+ keyToAnimate.classList.add('playing');
+ soundToPlay.currentTime = 0;
+ soundToPlay.play();
+
+ keyToAnimate.addEventListener('transitionend', function(element){
+ if(element.target.classList.contains('playing')) {
+ element.target.classList.remove('playing');
+ }
+ });
+}
+window.addEventListener('keydown', playAudioOnKeyDown); | |
069aa383a0b5dc3cb3fca05bce98d8f3106ab1ce | server.js | server.js |
var http = require('http');
var mongoClient = require('mongodb').MongoClient;
var mongoUri = process.env.MONGO_URI || '';
var port = process.env.PORT || 80;
mongoClient.connect(mongoUri, function (err, client) {
http.createServer(function (req, res) {
if(err){
res.writeHead(500, { 'Content-Type': 'text/plain' });
res.end(`Failed to connect to the database.\n${err}`)
return;
}
const db = client.db('logs');
const requests = db.collection('requests');
requests.count(function(error, count){
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(`Hello World!\nThere are ${count} request records.`);
})
requests.insertOne({
ip: req.headers['x-forwarded-for'] || req.connection.remoteAddress,
time: Date.now()
});
}).listen(port);
}); |
var http = require('http');
var mongoClient = require('mongodb').MongoClient;
var mongoUri = process.env.MONGO_URI || '';
var port = process.env.PORT || 80;
mongoClient.connect(mongoUri, function (err, client) {
http.createServer(function (req, res) {
if(err){
res.writeHead(500, { 'Content-Type': 'text/plain' });
res.end(`Failed to connect to the database.\n${err}`)
return;
}
const db = client.db('logs');
const requests = db.collection('requests');
requests.count(function(error, count){
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(`Hello World!\nThere are ${count} request records.1222`);
})
requests.insertOne({
ip: req.headers['x-forwarded-for'] || req.connection.remoteAddress,
time: Date.now()
});
}).listen(port);
}); | Update text to test CI/CD | Update text to test CI/CD
| JavaScript | mit | TylerLu/hello-world,TylerLu/hello-world,TylerLu/hello-world | ---
+++
@@ -20,7 +20,7 @@
requests.count(function(error, count){
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end(`Hello World!\nThere are ${count} request records.`);
+ res.end(`Hello World!\nThere are ${count} request records.1222`);
})
requests.insertOne({ |
5c104409305efe16dbffd04c5041c2d88e55846a | lib/daemon.js | lib/daemon.js | import readline from 'readline';
import Importer from './Importer';
const commandsToFunctionNames = {
fix: 'fixImports',
word: 'import',
goto: 'goto',
rewrite: 'rewriteImports',
add: 'addImports',
};
export default function daemon() {
const rlInterface = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
rlInterface.on('line', (jsonPayload: string) => {
const payload = JSON.parse(jsonPayload);
const importer = new Importer(
payload.fileContent.split('\n'), payload.pathToFile);
// TODO: don't automatically invoke function here because of security issues
const functionName = commandsToFunctionNames[payload.command];
importer[functionName](payload.commandArg).then((result) => {
process.stdout.write(`${JSON.stringify(result)}\n`);
}).catch((error) => {
// TODO: print entire stack trace here
process.stderr.write(error.toString());
});
});
}
| import readline from 'readline';
import Importer from './Importer';
const commandsToFunctionNames = {
fix: 'fixImports',
word: 'import',
goto: 'goto',
rewrite: 'rewriteImports',
add: 'addImports',
};
export default function daemon() {
const rlInterface = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
rlInterface.on('line', (jsonPayload: string) => {
const payload = JSON.parse(jsonPayload);
const importer = new Importer(
payload.fileContent.split('\n'), payload.pathToFile);
// TODO: don't automatically invoke function here because of security issues
const functionName = commandsToFunctionNames[payload.command];
importer[functionName](payload.commandArg).then((result) => {
process.stdout.write(`${JSON.stringify(result)}\n`);
}).catch((error) => {
// TODO: print entire stack trace here
process.stdout.write(JSON.stringify({
error: error.toString(),
}));
});
});
}
| Print importjsd errors to stdout | Print importjsd errors to stdout
I'm playing around with using a vim channel to communicate with the
daemon. It's a lot simpler if we can assume all results (even errors)
get printed to stdout.
| JavaScript | mit | trotzig/import-js,trotzig/import-js,trotzig/import-js,Galooshi/import-js | ---
+++
@@ -28,7 +28,9 @@
process.stdout.write(`${JSON.stringify(result)}\n`);
}).catch((error) => {
// TODO: print entire stack trace here
- process.stderr.write(error.toString());
+ process.stdout.write(JSON.stringify({
+ error: error.toString(),
+ }));
});
});
} |
5594dd12afca6f57965eeac6fd1e5609c89d78b9 | lib/linter.js | lib/linter.js | 'use strict';
var gonzales = require('gonzales-pe');
var linters = [
require('./linters/space_before_brace')
];
exports.lint = function (data, path, config) {
var ast = this.parseAST(data);
var errors = [];
ast.map(function (node) {
var i;
for (i = 0; i < linters.length; i++) {
errors.push(linters[i].call(null, {
config: config,
node: node,
path: path
}));
}
});
// Remove empty errors
return errors.filter(function (error) {
return error !== null && error !== true;
});
};
exports.parseAST = function (input) {
return gonzales.parse(input, {
syntax: 'less'
});
};
| 'use strict';
var gonzales = require('gonzales-pe');
var linters = [
require('./linters/space_before_brace')
];
exports.lint = function (input, path, config) {
var ast = this.parseAST(input);
var errors = [];
ast.map(function (node) {
var i;
for (i = 0; i < linters.length; i++) {
errors.push(linters[i].call(null, {
config: config,
node: node,
path: path
}));
}
});
// Remove empty errors
return errors.filter(function (error) {
return error !== null && error !== true;
});
};
exports.parseAST = function (input) {
return gonzales.parse(input, {
syntax: 'less'
});
};
| Use 'input' instead of 'data' | Use 'input' instead of 'data'
| JavaScript | mit | JoshuaKGoldberg/lesshint,lesshint/lesshint,runarberg/lesshint,gilt/lesshint | ---
+++
@@ -5,8 +5,8 @@
require('./linters/space_before_brace')
];
-exports.lint = function (data, path, config) {
- var ast = this.parseAST(data);
+exports.lint = function (input, path, config) {
+ var ast = this.parseAST(input);
var errors = [];
ast.map(function (node) { |
3988262c70babec9b3d877077d1327f995247568 | problems/filtered_ls/setup.js | problems/filtered_ls/setup.js | const fs = require('fs')
, path = require('path')
, os = require('os')
, onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync
, files = [
'learnyounode.dat'
, 'learnyounode.txt'
, 'learnyounode.sql'
, 'api.html'
, 'README.md'
, 'data.json'
, 'data.dat'
, 'words.dat'
, 'w00t.dat'
, 'w00t.txt'
, 'wrrrrongdat'
]
module.exports = function () {
var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid)
, trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json')
fs.mkdirSync(dir)
files.forEach(function (f) {
fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8')
})
return {
args : [ dir, 'dat' ]
, stdin : null
, modUseTrack : {
trackFile : trackFile
, modules : [ 'fs' ]
}
, verify : onlyAsync.bind(null, trackFile)
}
} | const fs = require('fs')
, path = require('path')
, os = require('os')
, onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync
, files = [
'learnyounode.dat'
, 'learnyounode.txt'
, 'learnyounode.sql'
, 'api.html'
, 'README.md'
, 'data.json'
, 'data.dat'
, 'words.dat'
, 'w00t.dat'
, 'w00t.txt'
, 'wrrrrongdat'
, 'dat'
]
module.exports = function () {
var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid)
, trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json')
fs.mkdirSync(dir)
files.forEach(function (f) {
fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8')
})
return {
args : [ dir, 'dat' ]
, stdin : null
, modUseTrack : {
trackFile : trackFile
, modules : [ 'fs' ]
}
, verify : onlyAsync.bind(null, trackFile)
}
}
| Add test case from make_it_modular to filtered_ls | Add test case from make_it_modular to filtered_ls
This test case was present in the next, "same as the previous" challenge, thus preventing some solutions to filtered_ls to work for make_it_modular for an unclear reason. | JavaScript | mit | amandasilveira/learnyounode,soujiro27/learnyounode,sergiorgiraldo/learnyounode,AydinHassan/learnyounode,thenaughtychild/learnyounode,jqk6/learnyounode,Yas3r/learnyounode,kmckee/learnyounode,zpxiaomi/learnyounode,keshwans/learnyounode,jojo1311/learnyounode,5harf/learnyounode,hsidar/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,kmckee/learnyounode,PibeDx/learnyounode,PibeDx/learnyounode,RoseTHERESA/learnyounode-1,Gtskk/learnyoupython,maksimgm/learnyounode,sergiorgiraldo/learnyounode,yous/learnyounode,AydinHassan/learnyounode,hsidar/learnyounode,JonnyCheng/learnyounode,noikiy/learnyounode,chechiachang/learnyounode,amandasilveira/learnyounode,chechiachang/learnyounode,zpxiaomi/learnyounode,walhs/learnyounode,runithome/learnyounode,andrewtdinh/learnyounode,marocchino/learnyounode,pushnoy100500/learnyounode,soujiro27/learnyounode,JonnyCheng/learnyounode,yous/learnyounode,michaelgrilo/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,jqk6/learnyounode,maksimgm/learnyounode,ElTomatos/learnyounode,thenaughtychild/learnyounode,lesterhm/learnyounode,marocchino/learnyounode,Yas3r/learnyounode,ericdouglas/learnyounode,kishorsharma/learnyounode,ralphtheninja/learnyounode,ralphtheninja/learnyounode,ElTomatos/learnyounode,CNBorn/learnyounode,noikiy/learnyounode,esmitley/learnyounode,pushnoy100500/learnyounode,akashnimare/learnyounode,runithome/learnyounode,Gtskk/learnyoupython,andrewtdinh/learnyounode,zhushuanglong/learnyounode,5harf/learnyounode,esmitley/learnyounode,walhs/learnyounode,lesterhm/learnyounode,michaelgrilo/learnyounode,jojo1311/learnyounode,akashnimare/learnyounode,RoseTHERESA/learnyounode-1,keshwans/learnyounode,CNBorn/learnyounode,aijiekj/learnyounode,aijiekj/learnyounode,Gtskk/learnyoupython,metakata/learnyounode,metakata/learnyounode,kishorsharma/learnyounode,zhushuanglong/learnyounode | ---
+++
@@ -15,6 +15,7 @@
, 'w00t.dat'
, 'w00t.txt'
, 'wrrrrongdat'
+ , 'dat'
]
module.exports = function () { |
e62497abb96c1a8753a786e55be75b5e3bb3f90b | src/tasks/check-file-names/__tests__/index-test.js | src/tasks/check-file-names/__tests__/index-test.js | 'use strict';
import { runCommand } from '../../../utils/helper-tests';
import { join } from 'path';
describe('Check file names task', () => {
pit('should pass with valid file & folder names', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'valid-project')
}])
);
pit('should fail if invalid file name found', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'invalid-file-name'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should fail if invalid folder name found', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'invalid-folder-name'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should use global configuration if parameters are not defined', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'global-configuration'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should use default configuration without specific parameters', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'default-configuration'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
});
| 'use strict';
import { extendJasmineTimeout, runCommand } from '../../../utils/helper-tests';
import { join } from 'path';
describe('Check file names task', () => {
extendJasmineTimeout(jasmine, beforeEach, afterEach);
pit('should pass with valid file & folder names', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'valid-project')
}])
);
pit('should fail if invalid file name found', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'invalid-file-name'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should fail if invalid folder name found', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'invalid-folder-name'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should use global configuration if parameters are not defined', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'global-configuration'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
pit('should use default configuration without specific parameters', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'default-configuration'),
expectToFail: true,
expectToContain: 'Invalid file name at'
}])
);
});
| Fix checkFileNames tests (extend timeout) | Fix checkFileNames tests (extend timeout)
| JavaScript | mit | urbanjs/tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/urbanjs-tools | ---
+++
@@ -1,9 +1,11 @@
'use strict';
-import { runCommand } from '../../../utils/helper-tests';
+import { extendJasmineTimeout, runCommand } from '../../../utils/helper-tests';
import { join } from 'path';
describe('Check file names task', () => {
+ extendJasmineTimeout(jasmine, beforeEach, afterEach);
+
pit('should pass with valid file & folder names', () =>
runCommand(['gulp check-file-names', {
cwd: join(__dirname, 'valid-project') |
67336759eedbcbd662d500336364ba5745ca306a | src/Schema/Address.js | src/Schema/Address.js | const mongoose = require("mongoose");
const shortid = require("shortid");
const ProcessorItem = require("./ProcessorItem");
const originals = require("mongoose-originals");
const Address = new mongoose.Schema({
_id: {
type: String,
default: shortid.generate,
},
processor: {
type: ProcessorItem,
default: ProcessorItem,
},
phone: String,
company: String,
name: String,
country: String,
locality: String,
streetAddress: String,
extendedAddress: String,
postalCode: String,
createdAt: Date,
updatedAt: Date,
});
Address.plugin(originals, {
fields: [
"phone",
"company",
"name",
"country",
"locality",
"streetAddress",
"extendedAddress",
"postalCode",
],
});
module.exports = Address;
| const mongoose = require("mongoose");
const shortid = require("shortid");
const ProcessorItem = require("./ProcessorItem");
const originals = require("mongoose-originals");
const Address = new mongoose.Schema({
_id: {
type: String,
default: shortid.generate,
},
processor: {
type: ProcessorItem,
default: ProcessorItem,
},
name: String,
country: String,
postalCode: String,
createdAt: Date,
updatedAt: Date,
});
Address.plugin(originals, {
fields: [
"phone",
"company",
"name",
"country",
"locality",
"streetAddress",
"extendedAddress",
"postalCode",
],
});
module.exports = Address;
| Remove not needed fields from schema | Remove not needed fields from schema | JavaScript | mit | enhancv/mongoose-subscriptions | ---
+++
@@ -12,13 +12,8 @@
type: ProcessorItem,
default: ProcessorItem,
},
- phone: String,
- company: String,
name: String,
country: String,
- locality: String,
- streetAddress: String,
- extendedAddress: String,
postalCode: String,
createdAt: Date,
updatedAt: Date, |
f78e46607cf15a7273ac780086a071f4cea092df | packages/meteor/server_environment.js | packages/meteor/server_environment.js | Meteor = {
isClient: false,
isServer: true
};
try {
if (process.env.METEOR_SETTINGS)
Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS);
} catch (e) {
throw new Error("Settings are not valid JSON");
}
| Meteor = {
isClient: false,
isServer: true
};
try {
Meteor.settings = {};
if (process.env.METEOR_SETTINGS)
Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS);
} catch (e) {
throw new Error("Settings are not valid JSON");
}
| Make the default for Meteor.settings be the empty object | Make the default for Meteor.settings be the empty object
| JavaScript | mit | TribeMedia/meteor,henrypan/meteor,l0rd0fwar/meteor,esteedqueen/meteor,jg3526/meteor,D1no/meteor,colinligertwood/meteor,Profab/meteor,skarekrow/meteor,dfischer/meteor,shadedprofit/meteor,servel333/meteor,shadedprofit/meteor,baiyunping333/meteor,skarekrow/meteor,GrimDerp/meteor,michielvanoeffelen/meteor,jeblister/meteor,bhargav175/meteor,shmiko/meteor,modulexcite/meteor,yinhe007/meteor,luohuazju/meteor,yiliaofan/meteor,yyx990803/meteor,eluck/meteor,benjamn/meteor,mirstan/meteor,Urigo/meteor,jeblister/meteor,steedos/meteor,ljack/meteor,yyx990803/meteor,paul-barry-kenzan/meteor,sdeveloper/meteor,joannekoong/meteor,pjump/meteor,codedogfish/meteor,meonkeys/meteor,IveWong/meteor,GrimDerp/meteor,somallg/meteor,DCKT/meteor,michielvanoeffelen/meteor,dandv/meteor,jagi/meteor,Jonekee/meteor,LWHTarena/meteor,jrudio/meteor,shmiko/meteor,wmkcc/meteor,jeblister/meteor,cherbst/meteor,daslicht/meteor,joannekoong/meteor,cherbst/meteor,chinasb/meteor,somallg/meteor,sunny-g/meteor,baiyunping333/meteor,elkingtonmcb/meteor,saisai/meteor,yonas/meteor-freebsd,karlito40/meteor,yanisIk/meteor,PatrickMcGuinness/meteor,Quicksteve/meteor,rabbyalone/meteor,AnjirHossain/meteor,joannekoong/meteor,cog-64/meteor,meteor-velocity/meteor,jirengu/meteor,alexbeletsky/meteor,brettle/meteor,bhargav175/meteor,lawrenceAIO/meteor,eluck/meteor,dandv/meteor,daslicht/meteor,mirstan/meteor,ashwathgovind/meteor,4commerce-technologies-AG/meteor,servel333/meteor,ericterpstra/meteor,benjamn/meteor,benstoltz/meteor,williambr/meteor,udhayam/meteor,shmiko/meteor,oceanzou123/meteor,brettle/meteor,calvintychan/meteor,AnthonyAstige/meteor,yinhe007/meteor,sclausen/meteor,luohuazju/meteor,whip112/meteor,Puena/meteor,jdivy/meteor,codingang/meteor,chiefninew/meteor,ashwathgovind/meteor,Hansoft/meteor,modulexcite/meteor,benstoltz/meteor,DAB0mB/meteor,wmkcc/meteor,luohuazju/meteor,Prithvi-A/meteor,evilemon/meteor,baysao/meteor,ndarilek/meteor,jrudio/meteor,jrudio/meteor,neotim/meteor,kengchau/meteor,lieuwex/meteor,qscripter/meteor,wmkcc/meteor,nuvipannu/meteor,ashwathgovind/meteor,TribeMedia/meteor,rozzzly/meteor,arunoda/meteor,vacjaliu/meteor,nuvipannu/meteor,shmiko/meteor,vjau/meteor,katopz/meteor,youprofit/meteor,Prithvi-A/meteor,chmac/meteor,skarekrow/meteor,Ken-Liu/meteor,Puena/meteor,stevenliuit/meteor,lieuwex/meteor,tdamsma/meteor,lieuwex/meteor,chasertech/meteor,daltonrenaldo/meteor,Hansoft/meteor,h200863057/meteor,ndarilek/meteor,DCKT/meteor,AnthonyAstige/meteor,namho102/meteor,baiyunping333/meteor,mubassirhayat/meteor,mjmasn/meteor,evilemon/meteor,l0rd0fwar/meteor,sunny-g/meteor,allanalexandre/meteor,papimomi/meteor,l0rd0fwar/meteor,guazipi/meteor,zdd910/meteor,PatrickMcGuinness/meteor,TechplexEngineer/meteor,mauricionr/meteor,qscripter/meteor,Quicksteve/meteor,qscripter/meteor,DAB0mB/meteor,ashwathgovind/meteor,baysao/meteor,EduShareOntario/meteor,wmkcc/meteor,fashionsun/meteor,lpinto93/meteor,Theviajerock/meteor,yalexx/meteor,jenalgit/meteor,shadedprofit/meteor,michielvanoeffelen/meteor,lieuwex/meteor,pjump/meteor,AlexR1712/meteor,Hansoft/meteor,HugoRLopes/meteor,mauricionr/meteor,PatrickMcGuinness/meteor,AlexR1712/meteor,guazipi/meteor,oceanzou123/meteor,tdamsma/meteor,evilemon/meteor,namho102/meteor,arunoda/meteor,evilemon/meteor,youprofit/meteor,akintoey/meteor,benstoltz/meteor,alexbeletsky/meteor,jg3526/meteor,yiliaofan/meteor,nuvipannu/meteor,chmac/meteor,jagi/meteor,tdamsma/meteor,vacjaliu/meteor,rozzzly/meteor,newswim/meteor,michielvanoeffelen/meteor,IveWong/meteor,chasertech/meteor,rozzzly/meteor,codingang/meteor,servel333/meteor,bhargav175/meteor,judsonbsilva/meteor,EduShareOntario/meteor,lpinto93/meteor,colinligertwood/meteor,cherbst/meteor,Hansoft/meteor,mirstan/meteor,dboyliao/meteor,jg3526/meteor,chiefninew/meteor,katopz/meteor,ashwathgovind/meteor,Eynaliyev/meteor,fashionsun/meteor,sitexa/meteor,yanisIk/meteor,DAB0mB/meteor,mirstan/meteor,l0rd0fwar/meteor,paul-barry-kenzan/meteor,kencheung/meteor,baiyunping333/meteor,steedos/meteor,GrimDerp/meteor,karlito40/meteor,LWHTarena/meteor,AnthonyAstige/meteor,modulexcite/meteor,Profab/meteor,devgrok/meteor,dfischer/meteor,ericterpstra/meteor,dandv/meteor,justintung/meteor,Ken-Liu/meteor,ndarilek/meteor,arunoda/meteor,jg3526/meteor,fashionsun/meteor,Ken-Liu/meteor,Prithvi-A/meteor,chinasb/meteor,justintung/meteor,jg3526/meteor,AnjirHossain/meteor,rozzzly/meteor,brdtrpp/meteor,HugoRLopes/meteor,chiefninew/meteor,yyx990803/meteor,zdd910/meteor,sdeveloper/meteor,planet-training/meteor,TechplexEngineer/meteor,alphanso/meteor,neotim/meteor,vjau/meteor,cog-64/meteor,Urigo/meteor,ndarilek/meteor,justintung/meteor,lorensr/meteor,cbonami/meteor,tdamsma/meteor,johnthepink/meteor,vjau/meteor,bhargav175/meteor,deanius/meteor,elkingtonmcb/meteor,codedogfish/meteor,meteor-velocity/meteor,dfischer/meteor,bhargav175/meteor,shrop/meteor,DAB0mB/meteor,Puena/meteor,yalexx/meteor,judsonbsilva/meteor,elkingtonmcb/meteor,lorensr/meteor,benstoltz/meteor,SeanOceanHu/meteor,williambr/meteor,arunoda/meteor,daltonrenaldo/meteor,cherbst/meteor,meonkeys/meteor,ndarilek/meteor,katopz/meteor,alphanso/meteor,cog-64/meteor,modulexcite/meteor,udhayam/meteor,yyx990803/meteor,SeanOceanHu/meteor,saisai/meteor,allanalexandre/meteor,somallg/meteor,elkingtonmcb/meteor,yalexx/meteor,codingang/meteor,namho102/meteor,hristaki/meteor,h200863057/meteor,cbonami/meteor,yanisIk/meteor,sitexa/meteor,sclausen/meteor,Profab/meteor,jg3526/meteor,Hansoft/meteor,brdtrpp/meteor,vjau/meteor,alphanso/meteor,Hansoft/meteor,ericterpstra/meteor,rabbyalone/meteor,whip112/meteor,servel333/meteor,nuvipannu/meteor,mjmasn/meteor,fashionsun/meteor,LWHTarena/meteor,Jonekee/meteor,Hansoft/meteor,lieuwex/meteor,dfischer/meteor,yinhe007/meteor,vacjaliu/meteor,TribeMedia/meteor,SeanOceanHu/meteor,codedogfish/meteor,pandeysoni/meteor,williambr/meteor,evilemon/meteor,skarekrow/meteor,somallg/meteor,D1no/meteor,katopz/meteor,benjamn/meteor,h200863057/meteor,chmac/meteor,h200863057/meteor,youprofit/meteor,yalexx/meteor,dfischer/meteor,modulexcite/meteor,hristaki/meteor,yalexx/meteor,brdtrpp/meteor,henrypan/meteor,judsonbsilva/meteor,planet-training/meteor,wmkcc/meteor,planet-training/meteor,Puena/meteor,jagi/meteor,imanmafi/meteor,steedos/meteor,lassombra/meteor,rabbyalone/meteor,lassombra/meteor,meteor-velocity/meteor,sdeveloper/meteor,daslicht/meteor,stevenliuit/meteor,Jonekee/meteor,lawrenceAIO/meteor,Eynaliyev/meteor,chiefninew/meteor,servel333/meteor,Ken-Liu/meteor,aramk/meteor,arunoda/meteor,chasertech/meteor,yiliaofan/meteor,dboyliao/meteor,lpinto93/meteor,alexbeletsky/meteor,GrimDerp/meteor,devgrok/meteor,ljack/meteor,henrypan/meteor,chmac/meteor,paul-barry-kenzan/meteor,aleclarson/meteor,aldeed/meteor,iman-mafi/meteor,youprofit/meteor,sdeveloper/meteor,codedogfish/meteor,kidaa/meteor,somallg/meteor,meteor-velocity/meteor,Paulyoufu/meteor-1,esteedqueen/meteor,pandeysoni/meteor,IveWong/meteor,devgrok/meteor,jrudio/meteor,JesseQin/meteor,papimomi/meteor,aramk/meteor,pandeysoni/meteor,brdtrpp/meteor,oceanzou123/meteor,chinasb/meteor,cog-64/meteor,newswim/meteor,Urigo/meteor,brettle/meteor,HugoRLopes/meteor,tdamsma/meteor,chinasb/meteor,DAB0mB/meteor,newswim/meteor,imanmafi/meteor,codedogfish/meteor,whip112/meteor,vacjaliu/meteor,Eynaliyev/meteor,GrimDerp/meteor,jenalgit/meteor,dboyliao/meteor,deanius/meteor,msavin/meteor,jirengu/meteor,emmerge/meteor,luohuazju/meteor,Eynaliyev/meteor,framewr/meteor,emmerge/meteor,neotim/meteor,hristaki/meteor,codingang/meteor,yyx990803/meteor,elkingtonmcb/meteor,johnthepink/meteor,jirengu/meteor,sunny-g/meteor,HugoRLopes/meteor,papimomi/meteor,Jeremy017/meteor,JesseQin/meteor,D1no/meteor,yonas/meteor-freebsd,sitexa/meteor,deanius/meteor,yinhe007/meteor,oceanzou123/meteor,yiliaofan/meteor,servel333/meteor,benjamn/meteor,katopz/meteor,zdd910/meteor,h200863057/meteor,JesseQin/meteor,TechplexEngineer/meteor,daltonrenaldo/meteor,shadedprofit/meteor,shadedprofit/meteor,jeblister/meteor,johnthepink/meteor,calvintychan/meteor,Jeremy017/meteor,stevenliuit/meteor,baysao/meteor,AnjirHossain/meteor,ericterpstra/meteor,msavin/meteor,nuvipannu/meteor,neotim/meteor,TechplexEngineer/meteor,ericterpstra/meteor,GrimDerp/meteor,imanmafi/meteor,juansgaitan/meteor,planet-training/meteor,tdamsma/meteor,meteor-velocity/meteor,dboyliao/meteor,pjump/meteor,daltonrenaldo/meteor,yiliaofan/meteor,steedos/meteor,justintung/meteor,benstoltz/meteor,AnthonyAstige/meteor,kencheung/meteor,elkingtonmcb/meteor,aramk/meteor,williambr/meteor,meonkeys/meteor,brettle/meteor,yonas/meteor-freebsd,ljack/meteor,Quicksteve/meteor,guazipi/meteor,evilemon/meteor,justintung/meteor,TechplexEngineer/meteor,kengchau/meteor,kidaa/meteor,joannekoong/meteor,daltonrenaldo/meteor,ljack/meteor,mirstan/meteor,calvintychan/meteor,judsonbsilva/meteor,deanius/meteor,Theviajerock/meteor,servel333/meteor,johnthepink/meteor,lawrenceAIO/meteor,karlito40/meteor,pandeysoni/meteor,TechplexEngineer/meteor,alphanso/meteor,iman-mafi/meteor,aramk/meteor,queso/meteor,newswim/meteor,tdamsma/meteor,juansgaitan/meteor,esteedqueen/meteor,johnthepink/meteor,papimomi/meteor,benjamn/meteor,deanius/meteor,eluck/meteor,udhayam/meteor,framewr/meteor,baiyunping333/meteor,sclausen/meteor,lassombra/meteor,juansgaitan/meteor,JesseQin/meteor,alexbeletsky/meteor,yonas/meteor-freebsd,katopz/meteor,luohuazju/meteor,daltonrenaldo/meteor,sitexa/meteor,AnjirHossain/meteor,brdtrpp/meteor,SeanOceanHu/meteor,Jonekee/meteor,TribeMedia/meteor,jdivy/meteor,namho102/meteor,baiyunping333/meteor,daltonrenaldo/meteor,yonglehou/meteor,mubassirhayat/meteor,dev-bobsong/meteor,udhayam/meteor,jirengu/meteor,queso/meteor,dev-bobsong/meteor,mubassirhayat/meteor,pandeysoni/meteor,shmiko/meteor,kengchau/meteor,jg3526/meteor,ndarilek/meteor,planet-training/meteor,devgrok/meteor,lorensr/meteor,TribeMedia/meteor,SeanOceanHu/meteor,judsonbsilva/meteor,mirstan/meteor,yanisIk/meteor,AlexR1712/meteor,katopz/meteor,cbonami/meteor,zdd910/meteor,alphanso/meteor,aramk/meteor,h200863057/meteor,paul-barry-kenzan/meteor,yiliaofan/meteor,JesseQin/meteor,chiefninew/meteor,sitexa/meteor,HugoRLopes/meteor,papimomi/meteor,udhayam/meteor,meteor-velocity/meteor,ljack/meteor,jenalgit/meteor,DCKT/meteor,lpinto93/meteor,queso/meteor,yonglehou/meteor,kidaa/meteor,newswim/meteor,emmerge/meteor,Jeremy017/meteor,hristaki/meteor,AnthonyAstige/meteor,PatrickMcGuinness/meteor,sclausen/meteor,jdivy/meteor,hristaki/meteor,williambr/meteor,henrypan/meteor,Profab/meteor,Theviajerock/meteor,Theviajerock/meteor,Quicksteve/meteor,yonglehou/meteor,karlito40/meteor,sunny-g/meteor,esteedqueen/meteor,codedogfish/meteor,joannekoong/meteor,sunny-g/meteor,newswim/meteor,ljack/meteor,yanisIk/meteor,ashwathgovind/meteor,guazipi/meteor,chmac/meteor,fashionsun/meteor,yonglehou/meteor,vjau/meteor,IveWong/meteor,EduShareOntario/meteor,henrypan/meteor,sclausen/meteor,shadedprofit/meteor,meonkeys/meteor,juansgaitan/meteor,DCKT/meteor,lpinto93/meteor,sdeveloper/meteor,karlito40/meteor,sunny-g/meteor,AnthonyAstige/meteor,aldeed/meteor,judsonbsilva/meteor,alphanso/meteor,cog-64/meteor,lassombra/meteor,shadedprofit/meteor,rabbyalone/meteor,jeblister/meteor,cbonami/meteor,Ken-Liu/meteor,l0rd0fwar/meteor,yonas/meteor-freebsd,4commerce-technologies-AG/meteor,lpinto93/meteor,whip112/meteor,JesseQin/meteor,rozzzly/meteor,AlexR1712/meteor,allanalexandre/meteor,allanalexandre/meteor,papimomi/meteor,oceanzou123/meteor,lieuwex/meteor,alexbeletsky/meteor,allanalexandre/meteor,HugoRLopes/meteor,jeblister/meteor,baysao/meteor,saisai/meteor,evilemon/meteor,brettle/meteor,dandv/meteor,baysao/meteor,bhargav175/meteor,Jeremy017/meteor,youprofit/meteor,steedos/meteor,guazipi/meteor,vjau/meteor,kengchau/meteor,Prithvi-A/meteor,fashionsun/meteor,4commerce-technologies-AG/meteor,chinasb/meteor,udhayam/meteor,msavin/meteor,bhargav175/meteor,Eynaliyev/meteor,qscripter/meteor,tdamsma/meteor,shmiko/meteor,jdivy/meteor,colinligertwood/meteor,daslicht/meteor,AnthonyAstige/meteor,yinhe007/meteor,4commerce-technologies-AG/meteor,sdeveloper/meteor,mubassirhayat/meteor,colinligertwood/meteor,SeanOceanHu/meteor,LWHTarena/meteor,whip112/meteor,DCKT/meteor,sdeveloper/meteor,saisai/meteor,dandv/meteor,akintoey/meteor,cbonami/meteor,arunoda/meteor,vacjaliu/meteor,benjamn/meteor,sunny-g/meteor,paul-barry-kenzan/meteor,rozzzly/meteor,calvintychan/meteor,newswim/meteor,planet-training/meteor,brettle/meteor,elkingtonmcb/meteor,planet-training/meteor,chasertech/meteor,Quicksteve/meteor,kencheung/meteor,henrypan/meteor,ljack/meteor,TechplexEngineer/meteor,eluck/meteor,wmkcc/meteor,GrimDerp/meteor,daslicht/meteor,chengxiaole/meteor,shrop/meteor,Jonekee/meteor,chengxiaole/meteor,TribeMedia/meteor,chengxiaole/meteor,vacjaliu/meteor,benjamn/meteor,whip112/meteor,aldeed/meteor,chasertech/meteor,ashwathgovind/meteor,JesseQin/meteor,D1no/meteor,namho102/meteor,msavin/meteor,Theviajerock/meteor,youprofit/meteor,queso/meteor,yyx990803/meteor,dandv/meteor,jagi/meteor,jagi/meteor,DCKT/meteor,nuvipannu/meteor,shrop/meteor,DAB0mB/meteor,karlito40/meteor,pjump/meteor,jagi/meteor,PatrickMcGuinness/meteor,chasertech/meteor,devgrok/meteor,iman-mafi/meteor,sitexa/meteor,chiefninew/meteor,arunoda/meteor,aleclarson/meteor,rabbyalone/meteor,mubassirhayat/meteor,Jeremy017/meteor,chiefninew/meteor,sclausen/meteor,l0rd0fwar/meteor,4commerce-technologies-AG/meteor,yyx990803/meteor,esteedqueen/meteor,AlexR1712/meteor,justintung/meteor,neotim/meteor,cbonami/meteor,Eynaliyev/meteor,modulexcite/meteor,namho102/meteor,alexbeletsky/meteor,whip112/meteor,brdtrpp/meteor,yonas/meteor-freebsd,vjau/meteor,jirengu/meteor,judsonbsilva/meteor,saisai/meteor,eluck/meteor,stevenliuit/meteor,ndarilek/meteor,eluck/meteor,queso/meteor,skarekrow/meteor,HugoRLopes/meteor,EduShareOntario/meteor,emmerge/meteor,yinhe007/meteor,dev-bobsong/meteor,dandv/meteor,papimomi/meteor,skarekrow/meteor,imanmafi/meteor,dfischer/meteor,rozzzly/meteor,lawrenceAIO/meteor,kengchau/meteor,allanalexandre/meteor,yanisIk/meteor,sitexa/meteor,SeanOceanHu/meteor,Quicksteve/meteor,rabbyalone/meteor,Eynaliyev/meteor,michielvanoeffelen/meteor,D1no/meteor,zdd910/meteor,codingang/meteor,yalexx/meteor,lieuwex/meteor,chengxiaole/meteor,mauricionr/meteor,youprofit/meteor,Urigo/meteor,luohuazju/meteor,lorensr/meteor,saisai/meteor,devgrok/meteor,servel333/meteor,jenalgit/meteor,yiliaofan/meteor,mjmasn/meteor,msavin/meteor,chmac/meteor,jdivy/meteor,PatrickMcGuinness/meteor,alexbeletsky/meteor,ndarilek/meteor,yonglehou/meteor,DCKT/meteor,h200863057/meteor,Paulyoufu/meteor-1,chengxiaole/meteor,codingang/meteor,AnthonyAstige/meteor,Urigo/meteor,colinligertwood/meteor,lorensr/meteor,meteor-velocity/meteor,dboyliao/meteor,kidaa/meteor,4commerce-technologies-AG/meteor,Prithvi-A/meteor,cog-64/meteor,brdtrpp/meteor,yinhe007/meteor,akintoey/meteor,LWHTarena/meteor,calvintychan/meteor,framewr/meteor,imanmafi/meteor,yalexx/meteor,Puena/meteor,aramk/meteor,shrop/meteor,kencheung/meteor,jeblister/meteor,lassombra/meteor,daslicht/meteor,Jeremy017/meteor,mauricionr/meteor,Theviajerock/meteor,kidaa/meteor,cherbst/meteor,stevenliuit/meteor,yanisIk/meteor,somallg/meteor,mauricionr/meteor,meonkeys/meteor,colinligertwood/meteor,esteedqueen/meteor,qscripter/meteor,qscripter/meteor,SeanOceanHu/meteor,eluck/meteor,iman-mafi/meteor,Prithvi-A/meteor,Paulyoufu/meteor-1,msavin/meteor,IveWong/meteor,shrop/meteor,qscripter/meteor,emmerge/meteor,chasertech/meteor,LWHTarena/meteor,kencheung/meteor,emmerge/meteor,queso/meteor,Paulyoufu/meteor-1,akintoey/meteor,calvintychan/meteor,guazipi/meteor,ljack/meteor,framewr/meteor,Puena/meteor,justintung/meteor,deanius/meteor,jirengu/meteor,Jonekee/meteor,udhayam/meteor,benstoltz/meteor,pjump/meteor,Ken-Liu/meteor,AnjirHossain/meteor,dev-bobsong/meteor,jenalgit/meteor,dboyliao/meteor,framewr/meteor,somallg/meteor,yanisIk/meteor,williambr/meteor,calvintychan/meteor,mubassirhayat/meteor,Paulyoufu/meteor-1,dev-bobsong/meteor,IveWong/meteor,neotim/meteor,EduShareOntario/meteor,chengxiaole/meteor,luohuazju/meteor,jenalgit/meteor,dboyliao/meteor,allanalexandre/meteor,mjmasn/meteor,Profab/meteor,Theviajerock/meteor,meonkeys/meteor,jirengu/meteor,chmac/meteor,henrypan/meteor,dfischer/meteor,johnthepink/meteor,Ken-Liu/meteor,Jeremy017/meteor,dboyliao/meteor,Eynaliyev/meteor,fashionsun/meteor,shmiko/meteor,aleclarson/meteor,cbonami/meteor,cherbst/meteor,jdivy/meteor,jenalgit/meteor,hristaki/meteor,Paulyoufu/meteor-1,Quicksteve/meteor,framewr/meteor,rabbyalone/meteor,mirstan/meteor,lawrenceAIO/meteor,joannekoong/meteor,mjmasn/meteor,akintoey/meteor,shrop/meteor,meonkeys/meteor,aldeed/meteor,nuvipannu/meteor,codingang/meteor,chinasb/meteor,mauricionr/meteor,karlito40/meteor,aldeed/meteor,colinligertwood/meteor,michielvanoeffelen/meteor,kencheung/meteor,namho102/meteor,joannekoong/meteor,mauricionr/meteor,DAB0mB/meteor,chengxiaole/meteor,mubassirhayat/meteor,pandeysoni/meteor,iman-mafi/meteor,jagi/meteor,imanmafi/meteor,zdd910/meteor,Urigo/meteor,planet-training/meteor,paul-barry-kenzan/meteor,sclausen/meteor,D1no/meteor,4commerce-technologies-AG/meteor,dev-bobsong/meteor,Paulyoufu/meteor-1,neotim/meteor,modulexcite/meteor,johnthepink/meteor,msavin/meteor,devgrok/meteor,kengchau/meteor,iman-mafi/meteor,aldeed/meteor,D1no/meteor,D1no/meteor,vacjaliu/meteor,yonglehou/meteor,esteedqueen/meteor,oceanzou123/meteor,TribeMedia/meteor,kencheung/meteor,lorensr/meteor,sunny-g/meteor,yonglehou/meteor,steedos/meteor,alexbeletsky/meteor,baysao/meteor,paul-barry-kenzan/meteor,aldeed/meteor,aramk/meteor,codedogfish/meteor,hristaki/meteor,lorensr/meteor,stevenliuit/meteor,pandeysoni/meteor,skarekrow/meteor,Prithvi-A/meteor,Profab/meteor,stevenliuit/meteor,AlexR1712/meteor,akintoey/meteor,benstoltz/meteor,iman-mafi/meteor,daslicht/meteor,Jonekee/meteor,imanmafi/meteor,chiefninew/meteor,HugoRLopes/meteor,AnjirHossain/meteor,PatrickMcGuinness/meteor,steedos/meteor,lassombra/meteor,kengchau/meteor,Puena/meteor,emmerge/meteor,baiyunping333/meteor,framewr/meteor,mubassirhayat/meteor,ericterpstra/meteor,lawrenceAIO/meteor,EduShareOntario/meteor,juansgaitan/meteor,jdivy/meteor,oceanzou123/meteor,zdd910/meteor,Profab/meteor,Urigo/meteor,queso/meteor,alphanso/meteor,akintoey/meteor,AnjirHossain/meteor,guazipi/meteor,EduShareOntario/meteor,AlexR1712/meteor,baysao/meteor,pjump/meteor,brdtrpp/meteor,brettle/meteor,dev-bobsong/meteor,wmkcc/meteor,juansgaitan/meteor,l0rd0fwar/meteor,juansgaitan/meteor,daltonrenaldo/meteor,allanalexandre/meteor,mjmasn/meteor,somallg/meteor,kidaa/meteor,jrudio/meteor,mjmasn/meteor,lawrenceAIO/meteor,cog-64/meteor,lpinto93/meteor,yonas/meteor-freebsd,shrop/meteor,jrudio/meteor,deanius/meteor,chinasb/meteor,lassombra/meteor,karlito40/meteor,eluck/meteor,IveWong/meteor,cherbst/meteor,williambr/meteor,saisai/meteor,kidaa/meteor,ericterpstra/meteor,michielvanoeffelen/meteor,LWHTarena/meteor,pjump/meteor | ---
+++
@@ -4,6 +4,7 @@
};
try {
+ Meteor.settings = {};
if (process.env.METEOR_SETTINGS)
Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS);
} catch (e) { |
876bd105dc905630f9d01d787c1d60f70113a72a | pages/authPassword/authPassword.js | pages/authPassword/authPassword.js | //var ERR = require('async-stacktrace');
var express = require('express');
var router = express.Router();
var csrf = require('../../lib/csrf');
var config = require('../../lib/config');
router.get('/', function(req, res) {
res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies;
res.render(__filename.replace(/\.js$/, '.ejs'), res.locals);
});
router.post('/', function(req, res) {
if (req.body.__action == 'assessmentPassword') {
var pl_pw_origUrl = req.cookies.pl_pw_origUrl;
var pwCookie = csrf.generateToken({password: req.body.password}, config.secretKey);
res.cookie('pl_assessmentpw', pwCookie);
res.clearCookie('pl_pw_origUrl');
return res.redirect(pl_pw_origUrl);
}
});
module.exports = router;
| //var ERR = require('async-stacktrace');
var express = require('express');
var router = express.Router();
var csrf = require('../../lib/csrf');
var config = require('../../lib/config');
router.get('/', function(req, res) {
res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies;
res.render(__filename.replace(/\.js$/, '.ejs'), res.locals);
});
router.post('/', function(req, res) {
if (req.body.__action == 'assessmentPassword') {
var pl_pw_origUrl = req.cookies.pl_pw_origUrl;
var maxAge = 1000 * 60 * 60 * 12; // 12 hours
var pwCookie = csrf.generateToken({password: req.body.password, maxAge: maxAge}, config.secretKey);
res.cookie('pl_assessmentpw', pwCookie, {maxAge: maxAge});
res.clearCookie('pl_pw_origUrl');
return res.redirect(pl_pw_origUrl);
}
});
module.exports = router;
| Add timeouts to CSRF and cookie | Add timeouts to CSRF and cookie
| JavaScript | agpl-3.0 | parasgithub/PrairieLearn,parasgithub/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,parasgithub/PrairieLearn,rbessick5/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn | ---
+++
@@ -16,9 +16,10 @@
if (req.body.__action == 'assessmentPassword') {
var pl_pw_origUrl = req.cookies.pl_pw_origUrl;
+ var maxAge = 1000 * 60 * 60 * 12; // 12 hours
- var pwCookie = csrf.generateToken({password: req.body.password}, config.secretKey);
- res.cookie('pl_assessmentpw', pwCookie);
+ var pwCookie = csrf.generateToken({password: req.body.password, maxAge: maxAge}, config.secretKey);
+ res.cookie('pl_assessmentpw', pwCookie, {maxAge: maxAge});
res.clearCookie('pl_pw_origUrl');
return res.redirect(pl_pw_origUrl);
} |
c0f10b0f04d691ad7ad2e2bcc5a28effc0f20414 | src/index.js | src/index.js | import React from 'react';
import Logo from './components/logo'
import SocialButtons from './components/social-buttons'
import Navigation from './components/navigation'
import Home from './components/home'
import Footer from './components/footer'
class Page {
render() {
return (
<div id="wrapper" className="pure-g">
<header className="pure-u-2-3">
<Logo/>
<SocialButtons/>
<Navigation />
</header>
<Home/>
<Footer />
</div>
)
}
}
React.render(<Page/>, document.getElementById('app'));
| import React from 'react';
import Logo from './components/logo'
import SocialButtons from './components/social-buttons'
import Navigation from './components/navigation'
import Home from './components/home';
import Footer from './components/footer';
import AppUrl from './appurl'
class Page {
render() {
let appUrl = new AppUrl();
const siteComponent = this.props.siteComponent;
return (
<div id="wrapper" className="pure-g">
<header className="pure-u-2-3">
<Logo/>
<SocialButtons/>
<Navigation appUrl={appUrl} />
</header>
{siteComponent}
<Footer />
</div>
)
}
}
const rerender = (siteComponent = <Home />) => {
React.render(<Page siteComponent={siteComponent} />, document.getElementById('app'));
};
import {parse as parseUrl} from 'url';
import Chronicle from './lexicon/chronicle'
window.addEventListener('hashchange', ({newURL: newUrl}) => {
const parsedUrl = parseUrl(newUrl);
processUrl(parsedUrl);
});
function processUrl(parsedUrl) {
if (parsedUrl && parsedUrl.hash && parsedUrl.hash.startsWith('#/')) {
if (parsedUrl.hash.match(/^#\/chronicle/)) {
Chronicle.componentWithData((chronicleComponent) => {
rerender(chronicleComponent);
});
}
} else {
rerender(<Home />);
}
}
processUrl();
| Load the page according to the current url, using hashes. | Load the page according to the current url, using hashes. | JavaScript | mit | cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki | ---
+++
@@ -3,23 +3,53 @@
import Logo from './components/logo'
import SocialButtons from './components/social-buttons'
import Navigation from './components/navigation'
-import Home from './components/home'
-import Footer from './components/footer'
+import Home from './components/home';
+import Footer from './components/footer';
+
+import AppUrl from './appurl'
class Page {
render() {
+
+ let appUrl = new AppUrl();
+ const siteComponent = this.props.siteComponent;
+
return (
<div id="wrapper" className="pure-g">
<header className="pure-u-2-3">
<Logo/>
<SocialButtons/>
- <Navigation />
+ <Navigation appUrl={appUrl} />
</header>
- <Home/>
+ {siteComponent}
<Footer />
</div>
)
}
}
-React.render(<Page/>, document.getElementById('app'));
+const rerender = (siteComponent = <Home />) => {
+ React.render(<Page siteComponent={siteComponent} />, document.getElementById('app'));
+};
+
+import {parse as parseUrl} from 'url';
+import Chronicle from './lexicon/chronicle'
+
+window.addEventListener('hashchange', ({newURL: newUrl}) => {
+ const parsedUrl = parseUrl(newUrl);
+ processUrl(parsedUrl);
+});
+
+function processUrl(parsedUrl) {
+ if (parsedUrl && parsedUrl.hash && parsedUrl.hash.startsWith('#/')) {
+ if (parsedUrl.hash.match(/^#\/chronicle/)) {
+ Chronicle.componentWithData((chronicleComponent) => {
+ rerender(chronicleComponent);
+ });
+ }
+ } else {
+ rerender(<Home />);
+ }
+}
+
+processUrl(); |
969aa542268675b9edfeae9a8139d229712f1000 | server.js | server.js | var util = require('util'),
connect = require('connect'),
serveStatic = require('serve-static'),
port = 80,
app = connect();
app.use(serveStatic(__dirname)).listen(port);
util.puts('Listening on ' + port + '...');
util.puts('Press Ctrl + C to stop.'); | var util = require('util'),
connect = require('connect'),
serveStatic = require('serve-static'),
port = process.env.PORT || 3000,
app = connect();
app.use(serveStatic(__dirname)).listen(port);
util.puts('Listening on ' + port + '...');
util.puts('Press Ctrl + C to stop.'); | Update so PORT environment variable is used | Update so PORT environment variable is used
| JavaScript | mit | maael/design-patterns-presentation | ---
+++
@@ -1,7 +1,7 @@
var util = require('util'),
connect = require('connect'),
serveStatic = require('serve-static'),
- port = 80,
+ port = process.env.PORT || 3000,
app = connect();
app.use(serveStatic(__dirname)).listen(port); |
a6bb5eedb0f26bcdb5b837a5cffd86122db42cf8 | src/index.js | src/index.js | // @flow
import { elementNames } from './config'
import create from './helper'
export { apply } from './helper'
export function tag(head: string, ...tail: any[]): Function {
return create(head)(...tail)
}
export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } {
const helpers = {}
names.forEach(name => {
helpers[name] = create(name)
})
return helpers
}
export default createHelpers(elementNames)
| // @flow
import { elementNames } from './config'
import create from './helper'
export { apply } from './helper'
function tag(head: string, ...tail: any[]): Function {
return create(head)(...tail)
}
export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } {
const helpers = {}
names.forEach(name => {
helpers[name] = create(name)
})
helpers.tag = tag
return helpers
}
export default createHelpers(elementNames)
| Move `tag` helper in default export | Move `tag` helper in default export
| JavaScript | mit | ktsn/vue-vnode-helper,ktsn/vue-vnode-helper | ---
+++
@@ -5,7 +5,7 @@
export { apply } from './helper'
-export function tag(head: string, ...tail: any[]): Function {
+function tag(head: string, ...tail: any[]): Function {
return create(head)(...tail)
}
@@ -14,6 +14,7 @@
names.forEach(name => {
helpers[name] = create(name)
})
+ helpers.tag = tag
return helpers
}
|
bc30514628a5bf9ccd4f92999115ee75c499e2ad | server.js | server.js | var restify = require('restify');
var mainController = require('./controllers/mainController');
var server = restify.createServer({
name: 'self-signed'
});
server.use(restify.bodyParser());
server.put('/:client/key', mainController.key);
server.get('/:client/key', mainController.publicKey);
server.get('/:client/sign', mainController.sign);
server.listen(3000, function(){
console.log('Server started at port: 3000');
});
| var restify = require('restify');
var mainController = require('./controllers/mainController');
var server = restify.createServer({
name: 'self-signed'
});
server.use(restify.bodyParser());
server.put('/:client/key', mainController.key);
server.get('/:client/key', mainController.publicKey);
server.post('/:client/sign', mainController.sign);
server.listen(3000, function(){
console.log('Server started at port: 3000');
});
| Move signing method to post verb | Move signing method to post verb
| JavaScript | mit | shtpavel/node-signing-server | ---
+++
@@ -10,7 +10,7 @@
server.put('/:client/key', mainController.key);
server.get('/:client/key', mainController.publicKey);
-server.get('/:client/sign', mainController.sign);
+server.post('/:client/sign', mainController.sign);
server.listen(3000, function(){
console.log('Server started at port: 3000'); |
373fdd2d21739f38464fb502a75c063f07c8d1cf | src/index.js | src/index.js | var Alexa = require('alexa-sdk');
var APP_ID = 'amzn1.ask.skill.933585d3-ba4a-49f9-baed-86e109c589ed';
var SKILL_NAME = 'Snack Overflow';
var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ];
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(getRecipieHandlers);
alexa.execute();
};
var getRecipieHandlers = {
'whatShouldIMakeIntent': function() {
var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length);
this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]);
}
};
| var Alexa = require('alexa-sdk');
var APP_ID = 'amzn1.ask.skill.85ae7ea2-b727-4d2a-9765-5c563a5ec379';
var SKILL_NAME = 'Snack Overflow';
var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ];
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(getRecipieHandlers);
alexa.execute();
};
var getRecipieHandlers = {
'whatShouldIMakeIntent': function() {
var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length);
this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]);
}
};
| Update APP_ID to correct app id | Update APP_ID to correct app id
| JavaScript | mit | cwboden/amazon-hackathon-alexa | ---
+++
@@ -1,6 +1,6 @@
var Alexa = require('alexa-sdk');
-var APP_ID = 'amzn1.ask.skill.933585d3-ba4a-49f9-baed-86e109c589ed';
+var APP_ID = 'amzn1.ask.skill.85ae7ea2-b727-4d2a-9765-5c563a5ec379';
var SKILL_NAME = 'Snack Overflow';
var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ]; |
0825b7031e33edfd6d684118046bced28b0a2fd2 | src/index.js | src/index.js | import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import assign from 'lodash/assign';
import pick from 'lodash/pick';
import flatten from 'lodash/flatten';
import pickBy from 'lodash/pickBy';
import assignWith from 'lodash/assignWith';
import compose from './compose';
export const isDescriptor = isObject;
export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose);
export const isComposable = obj => isDescriptor(obj) || isStamp(obj);
export const init = (...functions) => compose({ initializers: flatten(functions) });
export const overrides = (...keys) => {
const flattenKeys = flatten(keys);
return compose({
initializers: [function (opt) {
assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys));
}]
});
};
export const namespaced = (keyStampMap) => {
const keyStampMapClone = pickBy(keyStampMap, isStamp);
return compose({
initializers: [function (opt) {
const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]);
assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt));
assign(this, optClone);
}]
});
};
| import {
isFunction, isObject,
assign, assignWith,
pick, pickBy,
flatten
} from 'lodash';
import compose from './compose';
export const isDescriptor = isObject;
export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose);
export const isComposable = obj => isDescriptor(obj) || isStamp(obj);
export const init = (...functions) => compose({ initializers: flatten(functions) });
export const overrides = (...keys) => {
const flattenKeys = flatten(keys);
return compose({
initializers: [function (opt) {
assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys));
}]
});
};
export const namespaced = (keyStampMap) => {
const keyStampMapClone = pickBy(keyStampMap, isStamp);
return compose({
initializers: [function (opt) {
const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]);
assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt));
assign(this, optClone);
}]
});
};
| Use single import of lodash | Use single import of lodash | JavaScript | mit | stampit-org/stamp-utils | ---
+++
@@ -1,10 +1,9 @@
-import isFunction from 'lodash/isFunction';
-import isObject from 'lodash/isObject';
-import assign from 'lodash/assign';
-import pick from 'lodash/pick';
-import flatten from 'lodash/flatten';
-import pickBy from 'lodash/pickBy';
-import assignWith from 'lodash/assignWith';
+import {
+ isFunction, isObject,
+ assign, assignWith,
+ pick, pickBy,
+ flatten
+} from 'lodash';
import compose from './compose';
|
a8c322a16c2a81f72b1632279604db757bd9cd2a | 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: 'secretClementine',
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: 'secretClementine',
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-votingapp,jcsgithub/jcsgithub-votingapp | ---
+++
@@ -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); |
d715a4bbc039e4959caabcb3e92ccc8a7626d555 | public/javascripts/application.js | public/javascripts/application.js | $(document).ready(function() {
var divs = "#flash_success, #flash_notice, #flash_error";
$(divs).each(function() {
humanMsg.displayMsg($(this).text());
return false;
});
if (window.location.href.search(/query=/) == -1) {
$('#query').one('click', function() {
$(this).val('');
});
}
$(document).bind('keyup', function(event) {
if ($(event.target).is(':input')) {
return;
}
if (event.which == 83) {
$('#query').focus();
}
});
if ($('.count').length > 0) {
setInterval(function() {
$.getJSON("/api/v1/downloads.json", function(data) {
$(".count strong").text(number_with_delimiter(data['total']) + " downloads");
});
}, 5000);
}
});
// http://kevinvaldek.com/number-with-delimiter-in-javascript
function number_with_delimiter(number, delimiter) {
number = number + '', delimiter = delimiter || ',';
var split = number.split('.');
split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter);
return split.join('.');
};
| $(document).ready(function() {
$('#flash_success, #flash_notice, #flash_error').each(function() {
humanMsg.displayMsg($(this).text());
});
if (window.location.href.search(/query=/) == -1) {
$('#query').one('click, focus', function() {
$(this).val('');
});
}
$(document).bind('keyup', function(event) {
if ($(event.target).is(':input')) {
return;
}
if (event.which == 83) {
$('#query').focus();
}
});
if ($('.count').length > 0) {
setInterval(function() {
$.getJSON('/api/v1/downloads.json', function(data) {
$('.count strong')
.text(number_with_delimiter(data['total']) + ' downloads');
});
}, 5000);
}
});
// http://kevinvaldek.com/number-with-delimiter-in-javascript
function number_with_delimiter(number, delimiter) {
number = number + '', delimiter = delimiter || ',';
var split = number.split('.');
split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter);
return split.join('.');
};
| Clear the search query on focus as well and some minor JS clean up. | Clear the search query on focus as well and some minor JS clean up. | JavaScript | mit | bpm/getbpm.org,bpm/getbpm.org,alloy/gemcutter,dstrctrng/private_event,square/rubygems.org,alloy/gemcutter,dstrctrng/private_event,rubygems/rubygems.org-backup,rubygems/rubygems.org-backup,square/rubygems.org,1337807/rubygems.org,1337807/rubygems.org,square/rubygems.org,1337807/rubygems.org,rubygems/rubygems.org-backup | ---
+++
@@ -1,12 +1,10 @@
$(document).ready(function() {
- var divs = "#flash_success, #flash_notice, #flash_error";
- $(divs).each(function() {
+ $('#flash_success, #flash_notice, #flash_error').each(function() {
humanMsg.displayMsg($(this).text());
- return false;
});
if (window.location.href.search(/query=/) == -1) {
- $('#query').one('click', function() {
+ $('#query').one('click, focus', function() {
$(this).val('');
});
}
@@ -23,8 +21,9 @@
if ($('.count').length > 0) {
setInterval(function() {
- $.getJSON("/api/v1/downloads.json", function(data) {
- $(".count strong").text(number_with_delimiter(data['total']) + " downloads");
+ $.getJSON('/api/v1/downloads.json', function(data) {
+ $('.count strong')
+ .text(number_with_delimiter(data['total']) + ' downloads');
});
}, 5000);
} |
56a95bd9065a4299a0195b6408ade51b47640ee2 | services/bovada.js | services/bovada.js | const axios = require('axios');
const BovadaParser = require('../services/BovadaParser');
axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football';
axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36';
module.exports.getLines = async () => {
const [regSeasonResp, playoffResp] = await Promise.all([
axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'),
axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'),
]);
return BovadaParser.call(regSeasonResp.data)
.concat(BovadaParser.call(playoffResp.data));
};
| const axios = require('axios');
const BovadaParser = require('../services/BovadaParser');
axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football';
axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36';
module.exports.getLines = async () => {
const [regSeasonResp, playoffResp, superBowlResp] = await Promise.all([
axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'),
axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'),
axios.get('/super-bowl?marketFilterId=def&preMatchOnly=true&lang=en'),
]);
return BovadaParser.call(regSeasonResp.data)
.concat(BovadaParser.call(playoffResp.data))
.concat(BovadaParser.call(superBowlResp.data));
};
| Add Bovada endpoint for super bowl lines | Add Bovada endpoint for super bowl lines
| JavaScript | mit | lentz/buddyduel,lentz/buddyduel,lentz/buddyduel | ---
+++
@@ -5,11 +5,13 @@
axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36';
module.exports.getLines = async () => {
- const [regSeasonResp, playoffResp] = await Promise.all([
+ const [regSeasonResp, playoffResp, superBowlResp] = await Promise.all([
axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'),
axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'),
+ axios.get('/super-bowl?marketFilterId=def&preMatchOnly=true&lang=en'),
]);
return BovadaParser.call(regSeasonResp.data)
- .concat(BovadaParser.call(playoffResp.data));
+ .concat(BovadaParser.call(playoffResp.data))
+ .concat(BovadaParser.call(superBowlResp.data));
}; |
eeee14f6c0d0ae83cce051024739940960474147 | plugin.js | plugin.js | /**
* @file insert Non-Breaking SPace for CKEditor
* Copyright (C) 2014 Alfonso Martnez de Lizarrondo
* Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor
*
*/
CKEDITOR.plugins.add( 'nbsp',
{
init : function( editor )
{
// Insert if Ctrl+Space is pressed:
editor.addCommand( 'insertNbsp', {
exec: function( editor ) {
editor.insertHtml( ' ' );
}
});
editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' );
}
} );
| /**
* @file insert Non-Breaking Space for CKEditor
* Copyright (C) 2014 Alfonso Martínez de Lizarrondo
* Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor
*
*/
CKEDITOR.plugins.add( 'nbsp',
{
init : function( editor )
{
// Insert if Ctrl+Space is pressed:
editor.addCommand( 'insertNbsp', {
exec: function( editor ) {
editor.insertHtml( ' ', 'text' );
}
});
editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' );
}
} );
| Fix inline tag splitting and comment formatting | Fix inline tag splitting and comment formatting
| JavaScript | mpl-2.0 | AlfonsoML/nbsp | ---
+++
@@ -1,6 +1,6 @@
/**
- * @file insert Non-Breaking SPace for CKEditor
- * Copyright (C) 2014 Alfonso Martnez de Lizarrondo
+ * @file insert Non-Breaking Space for CKEditor
+ * Copyright (C) 2014 Alfonso Martínez de Lizarrondo
* Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor
*
*/
@@ -12,7 +12,7 @@
// Insert if Ctrl+Space is pressed:
editor.addCommand( 'insertNbsp', {
exec: function( editor ) {
- editor.insertHtml( ' ' );
+ editor.insertHtml( ' ', 'text' );
}
});
editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' ); |
0e3042f89fb16fe3c130d1044b8e9c7f599f8e72 | server.js | server.js | var app = require('express')();
var parser = require('./src/scrip').parse;
app.get('/', function (req, res) {
var scrip = req.query.scrip;
var result = parser(scrip);
res.send(result);
});
app.listen('8000');
| var app = require('express')();
var parser = require('./src/scrip').parse;
app.get('/', function (req, res) {
var scrip = req.query.scrip;
if (scrip) {
var result = parser(scrip);
res.status(200).json(result);
} else {
res.status(422).json({'error': 'Invalid data'});
}
});
app.listen('8000');
module.exports = app;
| Return 422 for invalid parameters | Return 422 for invalid parameters
| JavaScript | mit | pranavrc/scrip | ---
+++
@@ -3,10 +3,14 @@
app.get('/', function (req, res) {
var scrip = req.query.scrip;
- var result = parser(scrip);
-
- res.send(result);
+ if (scrip) {
+ var result = parser(scrip);
+ res.status(200).json(result);
+ } else {
+ res.status(422).json({'error': 'Invalid data'});
+ }
});
app.listen('8000');
+module.exports = app; |
64de8750546e31361e85a1ebe2917afe2c7c30df | mspace.js | mspace.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*jslint browser: true*/
"use strict";
(function () {
window.addEventListener("load", function () {
// Insert mathml.css if the <mspace> element is not supported.
var box, div, link;
div = document.createElement("div");
div.innerHTML = "<math><mspace height='23px' width='77px'/></math>";
document.body.appendChild(div);
box = div.firstChild.firstChild.getBoundingClientRect();
document.body.removeChild(div);
if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) {
link = document.createElement("link");
link.href = "http://fred-wang.github.io/mathml.css/mathml.css";
link.rel = "stylesheet";
document.head.appendChild(link);
}
});
}());
| /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*jslint browser: true*/
"use strict";
(function () {
window.addEventListener("load", function () {
// Insert mathml.css if the <mspace> element is not supported.
var box, div, link;
div = document.createElement("div");
div.innerHTML = "<math xmlns='http://www.w3.org/1998/Math/MathML'><mspace height='23px' width='77px'/></math>";
document.body.appendChild(div);
box = div.firstChild.firstChild.getBoundingClientRect();
document.body.removeChild(div);
if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) {
link = document.createElement("link");
link.href = "http://fred-wang.github.io/mathml.css/mathml.css";
link.rel = "stylesheet";
document.head.appendChild(link);
}
});
}());
| Add a MathML namespace so that the detection works in XML too. | Add a MathML namespace so that the detection works in XML too.
| JavaScript | mpl-2.0 | fred-wang/mathml.css,josephlewis42/mathml.css,fred-wang/mathml.css,josephlewis42/mathml.css | ---
+++
@@ -10,7 +10,7 @@
// Insert mathml.css if the <mspace> element is not supported.
var box, div, link;
div = document.createElement("div");
- div.innerHTML = "<math><mspace height='23px' width='77px'/></math>";
+ div.innerHTML = "<math xmlns='http://www.w3.org/1998/Math/MathML'><mspace height='23px' width='77px'/></math>";
document.body.appendChild(div);
box = div.firstChild.firstChild.getBoundingClientRect();
document.body.removeChild(div); |
47b5d6c7a2e90dec04f1b7e751abed54347488a2 | public/js/views/DashboardMainGraph.js | public/js/views/DashboardMainGraph.js | define([], function() {
'use strict';
return Backbone.View.extend({
jqplotId: null,
initialize: function(options) {
this.render();
var view = this;
diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) {
view.options.dashArgs.interval = interval;
view.render();
});
},
render: function() {
// Use convention-based IDs so markup can just hold positional containers.
this.jqplotId = this.el.id + '-canvas';
var url = this.buildUrl('/job/count_all_graph?', {
interval: this.options.dashArgs.interval
}, false);
var view = this;
$.ajax(
url, {
success: function(data) {
view.$el.empty();
view.$el.append($('<div>').attr('id', view.jqplotId));
var graphData = [];
_.each(data, function(result, time) {
graphData.push([time, result.count]);
});
var defaults = {
xaxis: {
renderer: $.jqplot.DateAxisRenderer
}
};
var axes = diana.helpers.Graph.adjustAxes(graphData, defaults);
try {
$.jqplot(
view.jqplotId,
[graphData],
{
title: 'Events',
axes: axes,
series:[{lineWidth:2}]
}
);
} catch (e) {
if (e.message != 'No data to plot.') {
console.log(e);
}
}
}
});
}
});
});
| define([], function() {
'use strict';
return Backbone.View.extend({
jqplotId: null,
initialize: function(options) {
this.render();
var view = this;
diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) {
view.options.dashArgs.interval = interval;
view.navigate('dashboard', view.options.dashArgs, {trigger: false});
view.render();
});
},
render: function() {
// Use convention-based IDs so markup can just hold positional containers.
this.jqplotId = this.el.id + '-canvas';
var url = this.buildUrl('/job/count_all_graph?', {
interval: this.options.dashArgs.interval
}, false);
var view = this;
$.ajax(
url, {
success: function(data) {
view.$el.empty();
view.$el.append($('<div>').attr('id', view.jqplotId));
var graphData = [];
_.each(data, function(result, time) {
graphData.push([time, result.count]);
});
var defaults = {
xaxis: {
renderer: $.jqplot.DateAxisRenderer
}
};
var axes = diana.helpers.Graph.adjustAxes(graphData, defaults);
try {
$.jqplot(
view.jqplotId,
[graphData],
{
title: 'Events',
axes: axes,
series:[{lineWidth:2}]
}
);
} catch (e) {
if (e.message != 'No data to plot.') {
console.log(e);
}
}
}
});
}
});
});
| Update route on interval drop-down changes. | Update route on interval drop-down changes.
| JavaScript | mit | codeactual/mainevent | ---
+++
@@ -11,6 +11,9 @@
var view = this;
diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) {
view.options.dashArgs.interval = interval;
+
+ view.navigate('dashboard', view.options.dashArgs, {trigger: false});
+
view.render();
});
}, |
9b5395ab11d8b28bc996f42e266a11a591057551 | online.js | online.js | #!/usr/bin/env node
'use strict';
let [,, onLineSrc, onCloseSrc ] = process.argv;
let onLine = eval(onLineSrc) || (line => line);
let onClose = eval(onCloseSrc) || (() => undefined);
let env = new Set();
require('readline')
.createInterface({
input: process.stdin
})
.on('line', line => {
let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || [];
let value = onLine(line, columns, env);
if (value != null) {
console.log(value);
}
})
.on('close', () => {
onClose(env);
});
| #!/usr/bin/env node
'use strict';
let [,, onLineSrc, onCloseSrc ] = process.argv;
let onLine = eval(onLineSrc) || (line => line);
let onClose = eval(onCloseSrc) || (() => undefined);
let env = new Set();
require('readline')
.createInterface({
input: process.stdin
})
.on('line', line => {
let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || [];
let value = onLine(line, columns, env);
if (value != null) {
console.log(value);
}
})
.on('close', () => {
let value = onClose(env);
if (value != null) {
console.log(value);
}
});
| Print the return value of onClose if it's not null | Print the return value of onClose if it's not null
| JavaScript | mit | bsdelf/scripts | ---
+++
@@ -18,5 +18,8 @@
}
})
.on('close', () => {
- onClose(env);
+ let value = onClose(env);
+ if (value != null) {
+ console.log(value);
+ }
}); |
0b942a6b920c3562468b21ff865c729eda5fe453 | public/js/login.js | public/js/login.js | /* eslint-env jquery */
start();
function start () {
'use strict';
$(document).ready(() => {
$('form').submit(event => {
event.preventDefault();
const username = $('#username').val();
const password = $('#password').val();
const loginObj = {
username,
password
};
$.post({
url: '/login',
data: JSON.stringify(loginObj),
dataType: 'JSON',
contentType: "application/json; charset=utf-8",
success: (result) => console.log(result)
});
});
});
}
| /* eslint-env jquery */
start();
function start () {
'use strict';
$(document).ready(() => {
$('form').submit(event => {
event.preventDefault();
const username = $('#username').val();
const password = $('#password').val();
const loginObj = {
username,
password
};
$.post({
url: '/login',
data: JSON.stringify(loginObj),
dataType: 'JSON',
contentType: 'application/json; charset=utf-8',
success: (result) => console.log(result)
});
});
});
}
| Change double quotes to single quotes | Change double quotes to single quotes
| JavaScript | apache-2.0 | ailijic/era-floor-time,ailijic/era-floor-time | ---
+++
@@ -17,7 +17,7 @@
url: '/login',
data: JSON.stringify(loginObj),
dataType: 'JSON',
- contentType: "application/json; charset=utf-8",
+ contentType: 'application/json; charset=utf-8',
success: (result) => console.log(result)
});
}); |
e558d635be3c497a4766900400ad8b2acb26282f | gulpfile.js | gulpfile.js | var gulp = require('gulp')
var connect = require('gulp-connect')
var inlinesource = require('gulp-inline-source')
gulp.task('connect', () => {
connect.server({
root: 'dist',
livereload: true
})
})
gulp.task('html', () => {
gulp.src('./src/index.html')
.pipe(inlinesource())
.pipe(gulp.dest('./dist/'))
.pipe(connect.reload())
})
gulp.task('watch', () => {
gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html'])
})
gulp.task('default', ['connect', 'watch', 'html'])
| var gulp = require('gulp');
var connect = require('gulp-connect');
var inlinesource = require('gulp-inline-source');
gulp.task('connect', () => {
connect.server({
root: 'dist',
livereload: true
})
})
gulp.task('html', () => {
gulp.src('./src/index.html')
.pipe(inlinesource())
.pipe(gulp.dest('./dist/'))
.pipe(connect.reload());
})
gulp.task('watch', () => {
gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']);
})
gulp.task('default', ['connect', 'watch', 'html']);
gulp.task('test', ['html']);
| Add test task for Gulp | Add test task for Gulp
| JavaScript | mit | jeerbl/beat.pm,jeerbl/beat.pm | ---
+++
@@ -1,6 +1,6 @@
-var gulp = require('gulp')
-var connect = require('gulp-connect')
-var inlinesource = require('gulp-inline-source')
+var gulp = require('gulp');
+var connect = require('gulp-connect');
+var inlinesource = require('gulp-inline-source');
gulp.task('connect', () => {
connect.server({
@@ -13,11 +13,12 @@
gulp.src('./src/index.html')
.pipe(inlinesource())
.pipe(gulp.dest('./dist/'))
- .pipe(connect.reload())
+ .pipe(connect.reload());
})
gulp.task('watch', () => {
- gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html'])
+ gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']);
})
-gulp.task('default', ['connect', 'watch', 'html'])
+gulp.task('default', ['connect', 'watch', 'html']);
+gulp.task('test', ['html']); |
ead960958b97975c73851633e4c530ada3f374b8 | gulpfile.js | gulpfile.js | 'use strict';
const gulp = require('gulp'),
fs = require('fs'),
plumber = require('gulp-plumber');
const options = {
source: 'templates',
dist: 'dist',
workingDir: 'tmp',
src: function plumbedSrc() {
return gulp.src.apply(gulp, arguments).pipe(plumber());
}
};
/**
* Load tasks from the '/tasks' directory.
*/
const build = require('./tasks/build')(options);
const checkDeps = require('./tasks/check-deps')(options);
const dupe = require('./tasks/dupe')(options);
const less = require('./tasks/less')(options);
const lint = require('./tasks/lint')(options);
const postcss = require('./tasks/postcss')(options);
const sass = require('./tasks/sass')(options);
/* By default templates will be built into '/dist' */
gulp.task(
'default',
gulp.series(
('dupe', 'less', 'sass', 'postcss', 'lint', 'build'),
() => {
/* gulp will watch for changes in '/templates'. */
gulp.watch(
[
options.source + '/**/*.html',
options.source + '/**/*.css',
options.source + '/**/*.scss',
options.source + '/**/*.less',
options.source + '/**/conf.json'
],
{ delay: 500 },
gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build')
)
}
)
);
| 'use strict';
const gulp = require('gulp'),
fs = require('fs'),
plumber = require('gulp-plumber');
const options = {
source: 'templates',
dist: 'dist',
workingDir: 'tmp',
src: function plumbedSrc() {
return gulp.src.apply(gulp, arguments).pipe(plumber());
}
};
/**
* Load tasks from the '/tasks' directory.
*/
const build = require('./tasks/build')(options);
const checkDeps = require('./tasks/check-deps')(options);
const dupe = require('./tasks/dupe')(options);
const less = require('./tasks/less')(options);
const lint = require('./tasks/lint')(options);
const postcss = require('./tasks/postcss')(options);
const sass = require('./tasks/sass')(options);
/* Runs the entire pipeline once. */
gulp.task('run-pipeline', gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build'));
/* By default templates will be built into '/dist'. */
gulp.task(
'default',
gulp.series(
'run-pipeline',
() => {
/* gulp will watch for changes in '/templates'. */
gulp.watch(
[
options.source + '/**/*.html',
options.source + '/**/*.css',
options.source + '/**/*.scss',
options.source + '/**/*.less',
options.source + '/**/conf.json'
],
{ delay: 500 },
gulp.series('run-pipeline')
)
}
)
);
| Create a gulp task to run pipeline once | Create a gulp task to run pipeline once
| JavaScript | mit | fadeit/responsive-html-email-signature,fadeit/responsive-html-email-signature | ---
+++
@@ -24,11 +24,14 @@
const postcss = require('./tasks/postcss')(options);
const sass = require('./tasks/sass')(options);
-/* By default templates will be built into '/dist' */
+/* Runs the entire pipeline once. */
+gulp.task('run-pipeline', gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build'));
+
+/* By default templates will be built into '/dist'. */
gulp.task(
'default',
gulp.series(
- ('dupe', 'less', 'sass', 'postcss', 'lint', 'build'),
+ 'run-pipeline',
() => {
/* gulp will watch for changes in '/templates'. */
gulp.watch(
@@ -40,7 +43,7 @@
options.source + '/**/conf.json'
],
{ delay: 500 },
- gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build')
+ gulp.series('run-pipeline')
)
}
) |
44d6583901f0eaabfb12594110397cdbfb8f21ad | gulpfile.js | gulpfile.js | var gulp = require("gulp");
var typescript = require("gulp-typescript");
const tsconfig = typescript.createProject("tsconfig.json");
gulp.task("compile", () => {
return gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"])
.pipe(tsconfig())
.pipe(gulp.dest("./build"));
});
| const argv = require("argv");
const gulp = require("gulp");
const path = require("path");
const sourcemaps = require("gulp-sourcemaps");
const typescript = require("gulp-typescript");
const args = argv.option({name: "env", short: "e", type: "string"}).run();
const isDebug = args.options["env"] === "debug";
const destDirname = isDebug ? "debug" : "build"
const dest = `./${destDirname}`;
const tsconfig = typescript.createProject("tsconfig.json");
gulp.task("compile", () => {
const src = gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"], { base: "./src" });
if (isDebug) {
return src.pipe(sourcemaps.init())
.pipe(tsconfig())
.pipe(sourcemaps.mapSources((sourcePath, file) => {
const from = path.resolve(path.join(__dirname, destDirname));
const to = path.dirname(file.path);
return path.join(path.relative(from, to), sourcePath);
}))
.pipe(sourcemaps.write(""))
.pipe(gulp.dest(dest));
} else {
return src.pipe(tsconfig())
.pipe(gulp.dest(dest));
}
});
gulp.task("build", ["compile"]);
| Fix project setup to support production and debug | Fix project setup to support production and debug
| JavaScript | mit | nickp10/shuffler,nickp10/shuffler | ---
+++
@@ -1,10 +1,31 @@
-var gulp = require("gulp");
-var typescript = require("gulp-typescript");
+const argv = require("argv");
+const gulp = require("gulp");
+const path = require("path");
+const sourcemaps = require("gulp-sourcemaps");
+const typescript = require("gulp-typescript");
+const args = argv.option({name: "env", short: "e", type: "string"}).run();
+const isDebug = args.options["env"] === "debug";
+const destDirname = isDebug ? "debug" : "build"
+const dest = `./${destDirname}`;
const tsconfig = typescript.createProject("tsconfig.json");
gulp.task("compile", () => {
- return gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"])
- .pipe(tsconfig())
- .pipe(gulp.dest("./build"));
+ const src = gulp.src(["./src/**/*.ts", "!./src/**/*.d.ts"], { base: "./src" });
+ if (isDebug) {
+ return src.pipe(sourcemaps.init())
+ .pipe(tsconfig())
+ .pipe(sourcemaps.mapSources((sourcePath, file) => {
+ const from = path.resolve(path.join(__dirname, destDirname));
+ const to = path.dirname(file.path);
+ return path.join(path.relative(from, to), sourcePath);
+ }))
+ .pipe(sourcemaps.write(""))
+ .pipe(gulp.dest(dest));
+ } else {
+ return src.pipe(tsconfig())
+ .pipe(gulp.dest(dest));
+ }
});
+
+gulp.task("build", ["compile"]); |
d5d5e4f18a4a3fb467bac398a0a28d5c9a1701f4 | server/routes/dashboard/dashboard.route.js | server/routes/dashboard/dashboard.route.js | const express = require('express')
const router = express.Router()
module.exports = router
| const express = require('express')
const queryHelper = require('../../utilities/query')
const router = express.Router()
router.get('/number-of-student', (req, res) => {
queryHelper.queryAndResponse({
sql: `select substr(student_id, 1, 2) as academic_year,
count(*) as student_count from students
group by substr(student_id, 1, 2)`,
req: req,
res: res
})
})
router.get('/average-gpax', (req, res) => {
queryHelper.queryAndResponse({
sql: `SELECT SUBSTRING(student_id, 1, 2) as academic_year,
count(*) as student_count FROM students
group by SUBSTRING(student_id, 1, 2)`,
req: req,
res: res
})
})
module.exports = router
| Add some service to dashboard | Add some service to dashboard
| JavaScript | mit | JThanat/student-management-system,JThanat/student-management-system | ---
+++
@@ -1,6 +1,26 @@
const express = require('express')
+const queryHelper = require('../../utilities/query')
+const router = express.Router()
-const router = express.Router()
+router.get('/number-of-student', (req, res) => {
+ queryHelper.queryAndResponse({
+ sql: `select substr(student_id, 1, 2) as academic_year,
+ count(*) as student_count from students
+ group by substr(student_id, 1, 2)`,
+ req: req,
+ res: res
+ })
+})
+
+router.get('/average-gpax', (req, res) => {
+ queryHelper.queryAndResponse({
+ sql: `SELECT SUBSTRING(student_id, 1, 2) as academic_year,
+ count(*) as student_count FROM students
+ group by SUBSTRING(student_id, 1, 2)`,
+ req: req,
+ res: res
+ })
+})
module.exports = router |
2ce08f2ca4392a0a5753106e2f582a3310914596 | gulpfile.js | gulpfile.js | var gulp = require('gulp'),
// this is an arbitrary object that loads all gulp plugins in package.json.
coffee = require('coffee-script/register'),
$ = require("gulp-load-plugins")(),
express = require('express'),
path = require('path'),
tinylr = require('tiny-lr'),
assets = require('connect-assets'),
app = express(),
server = tinylr();
gulp.task('express', function() {
// app.use(express.static(path.resolve('./dist')));
app.set('views', 'src/views');
app.set('view engine', 'jade');
require('./routes')(app);
app.use(assets({
paths: ['src/scripts', 'src/images', 'src/stylesheets', 'src/views']
}));
app.listen(1337);
$.util.log('Listening on port: 1337');
});
// Default Task
gulp.task('default', ['express']);
| var gulp = require('gulp'),
// this is an arbitrary object that loads all gulp plugins in package.json.
coffee = require('coffee-script/register'),
$ = require("gulp-load-plugins")(),
express = require('express'),
path = require('path'),
tinylr = require('tiny-lr'),
assets = require('connect-assets'),
app = express(),
server = tinylr();
gulp.task('express', function() {
// app.use(express.static(path.resolve('./dist')));
app.set('views', 'src/views');
app.set('view engine', 'jade');
require('./routes')(app);
app.use(assets({
paths: [
'src/scripts',
'src/images',
'src/stylesheets',
'src/views',
'bower_components'
]
}));
app.listen(1337);
$.util.log('Listening on port: 1337');
});
// Default Task
gulp.task('default', ['express']);
| Include bower components as assets | Include bower components as assets
| JavaScript | mit | GeoSensorWebLab/Arctic-Scholar-Portal,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/Arctic-Scholar-Portal | ---
+++
@@ -15,7 +15,13 @@
app.set('view engine', 'jade');
require('./routes')(app);
app.use(assets({
- paths: ['src/scripts', 'src/images', 'src/stylesheets', 'src/views']
+ paths: [
+ 'src/scripts',
+ 'src/images',
+ 'src/stylesheets',
+ 'src/views',
+ 'bower_components'
+ ]
}));
app.listen(1337); |
4ab099864a19bc91b50122853b6dc1808466d443 | gulpfile.js | gulpfile.js | var bower = require('bower'),
eventStream = require('event-stream'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip');
// Installs bower dependencies
gulp.task('bower', function(callback) {
bower.commands.install([], {}, {})
.on('error', function(error) {
callback(error);
})
.on('end', function() {
callback();
});
});
// Builds and packs plugins sources
gulp.task('default', ['bower'], function() {
var version = require('./package.json').version;
return eventStream.merge(
getSources()
.pipe(zip('emoji-plugin-' + version + '.zip')),
getSources()
.pipe(tar('emoji-plugin-' + version + '.tar'))
.pipe(gzip())
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
});
/**
* Returns files stream with the plugin sources.
*
* @returns {Object} Stream with VinylFS files.
*/
var getSources = function() {
return gulp.src([
'Plugin.php',
'README.md',
'LICENSE',
'js/*',
'css/*',
'components/emoji-images/emoji-images.js',
'components/emoji-images/readme.md',
'components/emoji-images/pngs/*'
],
{base: './'}
);
}
| var bower = require('bower'),
eventStream = require('event-stream'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip');
// Installs bower dependencies
gulp.task('bower', function(callback) {
bower.commands.install([], {}, {})
.on('error', function(error) {
callback(error);
})
.on('end', function() {
callback();
});
});
gulp.task('prepare-release', ['bower'], function() {
var version = require('./package.json').version;
return eventStream.merge(
getSources()
.pipe(zip('emoji-plugin-' + version + '.zip')),
getSources()
.pipe(tar('emoji-plugin-' + version + '.tar'))
.pipe(gzip())
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
});
// Builds and packs plugins sources
gulp.task('default', ['prepare-release'], function() {
// The "default" task is just an alias for "prepare-release" task.
});
/**
* Returns files stream with the plugin sources.
*
* @returns {Object} Stream with VinylFS files.
*/
var getSources = function() {
return gulp.src([
'Plugin.php',
'README.md',
'LICENSE',
'js/*',
'css/*',
'components/emoji-images/emoji-images.js',
'components/emoji-images/readme.md',
'components/emoji-images/pngs/*'
],
{base: './'}
);
}
| Add prepare-release task for consistency | Add prepare-release task for consistency
| JavaScript | apache-2.0 | Mibew/emoji-plugin,Mibew/emoji-plugin | ---
+++
@@ -17,8 +17,7 @@
});
});
-// Builds and packs plugins sources
-gulp.task('default', ['bower'], function() {
+gulp.task('prepare-release', ['bower'], function() {
var version = require('./package.json').version;
return eventStream.merge(
@@ -30,6 +29,11 @@
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
+});
+
+// Builds and packs plugins sources
+gulp.task('default', ['prepare-release'], function() {
+ // The "default" task is just an alias for "prepare-release" task.
});
/** |
a91c6b4ca951b8cf5d1076d4f7b35746ddbf034f | shared/chat/conversation/messages/retry.js | shared/chat/conversation/messages/retry.js | // @flow
import React from 'react'
import {globalColors} from '../../../styles'
import {Box, Text} from '../../../common-adapters'
const Retry = ({onRetry}: {onRetry: () => void}) => (
<Box>
<Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text>
<Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text>
<Text type='BodySmall' style={{color: globalColors.red, textDecoration: 'underline'}} onClick={onRetry}>Retry</Text>
</Box>
)
export default Retry
| // @flow
import React from 'react'
import {globalColors, globalStyles} from '../../../styles'
import {Text} from '../../../common-adapters'
const Retry = ({onRetry}: {onRetry: () => void}) => (
<Text type='BodySmall'>
<Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text>
<Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text>
<Text type='BodySmall' style={{color: globalColors.red, ...globalStyles.textDecoration('underline')}} onClick={onRetry}>Retry</Text>
</Text>
)
export default Retry
| Fix styling of Retry component on mobile | Fix styling of Retry component on mobile
| JavaScript | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client | ---
+++
@@ -1,14 +1,14 @@
// @flow
import React from 'react'
-import {globalColors} from '../../../styles'
-import {Box, Text} from '../../../common-adapters'
+import {globalColors, globalStyles} from '../../../styles'
+import {Text} from '../../../common-adapters'
const Retry = ({onRetry}: {onRetry: () => void}) => (
- <Box>
+ <Text type='BodySmall'>
<Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text>
<Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text>
- <Text type='BodySmall' style={{color: globalColors.red, textDecoration: 'underline'}} onClick={onRetry}>Retry</Text>
- </Box>
+ <Text type='BodySmall' style={{color: globalColors.red, ...globalStyles.textDecoration('underline')}} onClick={onRetry}>Retry</Text>
+ </Text>
)
export default Retry |
c1fce5f22ff9d83c06981be01a63b5b2da739f6d | website/app/application/core/projects/project/home/home.js | website/app/application/core/projects/project/home/home.js | (function (module) {
module.controller('projectHome', projectHome);
projectHome.$inject = ["project"];
function projectHome(project, ui) {
var ctrl = this;
ctrl.project = project;
}
}(angular.module('materialscommons')));
| (function (module) {
module.controller('projectHome', projectHome);
projectHome.$inject = ["project"];
function projectHome(project) {
var ctrl = this;
ctrl.project = project;
}
}(angular.module('materialscommons')));
| Remove reference to unused ui service. | Remove reference to unused ui service.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -2,7 +2,7 @@
module.controller('projectHome', projectHome);
projectHome.$inject = ["project"];
- function projectHome(project, ui) {
+ function projectHome(project) {
var ctrl = this;
ctrl.project = project;
} |
7b3bdf9c919d38bf18b8825d75deb0f6018c0e37 | httpmock.js | httpmock.js | var argv = require('optimist')
.usage("Usage: $0 --config [config] --port [port]")
.demand(['config'])
.default('port', 5000)
.argv;
var mock = require('./src/mock.js').mock;
mock(argv.port, process.cwd + "/" + argv.config);
| var argv = require('optimist')
.usage("Usage: $0 --config [config] --port [port]")
.demand(['config'])
.default('port', 5000)
.argv;
var mock = require('./src/mock.js').mock;
mock(argv.port, argv.config);
| Revert "Look for mock.js in the current directory" | Revert "Look for mock.js in the current directory"
This reverts commit c7f1aa03479a7fd2dedc5d172fbdc0dc692bcf85.
Conflicts:
httpmock.js
| JavaScript | mit | tildedave/httpmock.js | ---
+++
@@ -6,4 +6,5 @@
var mock = require('./src/mock.js').mock;
-mock(argv.port, process.cwd + "/" + argv.config);
+mock(argv.port, argv.config);
+ |
389851c4db207fbd92b424fe1bbccf773745f99b | config.js | config.js | /**
* React Static Boilerplate
* https://github.com/koistya/react-static-boilerplate
* Copyright (c) Konstantin Tarkus (@koistya) | MIT license
*/
export default {
title: 'Flashcards',
description: 'For studying stuff. Indeed, for learning stuff.',
googleAnalyticsId: 'UA-XXXXX-X',
};
| /**
* React Static Boilerplate
* https://github.com/koistya/react-static-boilerplate
* Copyright (c) Konstantin Tarkus (@koistya) | MIT license
*/
export default {
title: 'Super Flash Cards',
description: 'For studying stuff. Indeed, for learning stuff.',
googleAnalyticsId: 'UA-XXXXX-X',
};
| Change default <title> to "Super Flash Cards" | Change default <title> to "Super Flash Cards"
| JavaScript | mit | ahw/flash-cards-static-app,ahw/superflash.cards | ---
+++
@@ -5,7 +5,7 @@
*/
export default {
- title: 'Flashcards',
+ title: 'Super Flash Cards',
description: 'For studying stuff. Indeed, for learning stuff.',
googleAnalyticsId: 'UA-XXXXX-X',
}; |
91942007195c4eaa1f800be8854e6223b402a0ce | testem.js | testem.js | /* eslint-env node */
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'PhantomJS',
'Chrome'
],
launch_in_dev: [
'PhantomJS',
'Chrome'
],
browser_args: {
Chrome: [
'--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: [
// --no-sandbox is needed when running Chrome inside a container
process.env.TRAVIS ? '--no-sandbox' : null,
'--disable-gpu',
'--headless',
'--remote-debugging-port=0',
'--window-size=1440,900'
]
},
}
};
| Use `--no-sandbox` on TravisCI 🔨 | Use `--no-sandbox` on TravisCI 🔨
Related to use of Headless Chrome, see https://github.com/ember-cli/ember-cli/pull/7566.
| JavaScript | mit | dunnkers/ember-polymer-paper,dunnkers/ember-polymer-paper | ---
+++
@@ -3,19 +3,23 @@
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
- 'PhantomJS',
'Chrome'
],
launch_in_dev: [
- 'PhantomJS',
'Chrome'
],
browser_args: {
- Chrome: [
- '--disable-gpu',
- '--headless',
- '--remote-debugging-port=9222',
- '--window-size=1440,900'
- ]
+ Chrome: {
+ mode: 'ci',
+ args: [
+ // --no-sandbox is needed when running Chrome inside a container
+ process.env.TRAVIS ? '--no-sandbox' : null,
+
+ '--disable-gpu',
+ '--headless',
+ '--remote-debugging-port=0',
+ '--window-size=1440,900'
+ ]
+ },
}
}; |
415719a72236bb4609d8112037ed2e49a9cc2d9a | 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: [
'--disable-gpu',
'--headless',
'--no-sandbox',
'--remote-debugging-port=9222',
'--window-size=1440,900'
]
},
}
};
| Add --no-sandbox chrome argument to fix Travis CI build | Add --no-sandbox chrome argument to fix Travis CI build
| JavaScript | mit | LucasHill/ember-print-this,LucasHill/ember-print-this,LucasHill/ember-print-this | ---
+++
@@ -14,6 +14,7 @@
args: [
'--disable-gpu',
'--headless',
+ '--no-sandbox',
'--remote-debugging-port=9222',
'--window-size=1440,900'
] |
13ce5d9b14847599a894e2098ba10a2382a78bf8 | config.js | config.js | module.exports = {
refreshMin: 10,
github: {
per_page: 100,
timeout: 5000,
version: '3.0.0'
},
local: {
save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS
location: undefined
}
}
| module.exports = {
refreshMin: 10,
github: {
per_page: 100,
timeout: 5000,
version: '3.0.0'
},
local: {
save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS
location: null
}
}
| Use null instead of undefined and remove whitespace | Use null instead of undefined and remove whitespace
| JavaScript | mit | mcwhittemore/gist-db,pinn3/gist-db | ---
+++
@@ -6,7 +6,7 @@
version: '3.0.0'
},
local: {
- save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS
- location: undefined
+ save: 'NEVER', // NEVER, ON_REFRESH, ALWAYS
+ location: null
}
} |
3c4b2a07c509c7031e7e914729982fc3431872d9 | server.js | server.js | 'use strict';
const express = require('express');
const app = express();
const path = require('path');
const twilio = require('twilio');
const bodyparser = require('body-parser');
const onConnect = require('./lib/socket').onConnect;
const twilioRoute = require('./lib/twilio');
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyparser.json());
app.post('/twilio/response', twilio.webhook({ validate: false }), twilioRoute.response);
const server = require('http').createServer(app);
const io = require('socket.io')(server);
server.listen(process.env.port || 3000);
io.on('connection', onConnect);
| 'use strict';
const express = require('express');
const app = express();
const path = require('path');
const twilio = require('twilio');
const bodyparser = require('body-parser');
const onConnect = require('./lib/socket').onConnect;
const twilioRoute = require('./lib/twilio');
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyparser.urlencoded({ extended: false }));
app.post('/twilio/response', twilio.webhook({ validate: false }), twilioRoute.response);
const server = require('http').createServer(app);
const io = require('socket.io')(server);
server.listen(process.env.port || 3000);
io.on('connection', onConnect);
| Switch json for url parser | Switch json for url parser
| JavaScript | apache-2.0 | peterjuras/askeighty,peterjuras/askeighty | ---
+++
@@ -10,7 +10,7 @@
const twilioRoute = require('./lib/twilio');
app.use(express.static(path.join(__dirname, 'public')));
-app.use(bodyparser.json());
+app.use(bodyparser.urlencoded({ extended: false }));
app.post('/twilio/response', twilio.webhook({ validate: false }), twilioRoute.response);
const server = require('http').createServer(app); |
ecd6064267b8bbdd126dbda09e74f85cdabc729f | src/reducers/visibilityFilter.js | src/reducers/visibilityFilter.js | const visibilityFilter = (state = 'SHOW_ALL', action) => {
switch(action.type) {
case 'SET_VISIBILITY_FILTER':
return action.filter;
default:
return state;
}
};
export default visibilityFilter;
| const visibilityFilter = (state = 'SHOW_ALL', action) => {
switch(action.type) {
case 'ADD_ITEM':
return 'SHOW_ALL';
case 'SET_VISIBILITY_FILTER':
return action.filter;
default:
return state;
}
};
export default visibilityFilter;
| Set viz-filter to SHOW_ALL when adding a new item | Set viz-filter to SHOW_ALL when adding a new item
| JavaScript | mit | blaqbern/lists,blaqbern/lists | ---
+++
@@ -1,7 +1,11 @@
const visibilityFilter = (state = 'SHOW_ALL', action) => {
switch(action.type) {
+ case 'ADD_ITEM':
+ return 'SHOW_ALL';
+
case 'SET_VISIBILITY_FILTER':
return action.filter;
+
default:
return state;
} |
286aaa28ea38b4b3022b35fac03b8948d8ff2807 | src/cli/Host.js | src/cli/Host.js | 'use strict';
const program = require('commander');
const path = require('path');
const FlaCompiler = require('./FlaCompiler');
program
.version(require('../../package.json').version)
.option('--interactive-compiler <path>', 'full path to Flash.exe')
.option('--input-directory <path>', 'full path to input directory that contains FLA files')
.option('--output-directory <path>', 'full path to input directory to put build artifacts into')
.option('--include-pattern [pattern]', 'list of files to include in a build, default is *.fla', '*.fla')
.option('--debug [value]', 'activate session 0 debugging mode', (value) => Boolean(parseInt(value)), false)
.parse(process.argv);
const compilerConfig = {
interactiveCompiler: program.interactiveCompiler,
inputDirectory: path.resolve(program.inputDirectory),
outputDirectory: path.resolve(program.outputDirectory),
includePattern: program.includePattern,
debug: program.debug
};
const compiler = new FlaCompiler(compilerConfig);
compiler.compile(); | 'use strict';
const program = require('commander');
const path = require('path');
const FlaCompiler = require('./FlaCompiler');
program
.version(require('../../package.json').version)
.option('--interactive-compiler <path>', 'absolute or relative path to Flash.exe')
.option('--input-directory <path>', 'absolute or relative path to input directory that contains FLA files')
.option('--output-directory <path>', 'absolute or relative path to input directory to put build artifacts into')
.option('--include-pattern [pattern]', 'list of files to include in a build, default is *.fla', '*.fla')
.option('--debug [value]', 'activate session 0 debugging mode', (value) => Boolean(parseInt(value)), false)
.parse(process.argv);
const compilerConfig = {
interactiveCompiler: path.resolve(program.interactiveCompiler),
inputDirectory: path.resolve(program.inputDirectory),
outputDirectory: path.resolve(program.outputDirectory),
includePattern: program.includePattern,
debug: program.debug
};
const compiler = new FlaCompiler(compilerConfig);
compiler.compile(); | Allow relative path for interactive compiler parameter. Update help | Allow relative path for interactive compiler parameter. Update help
| JavaScript | mit | alexeiskachykhin/flc | ---
+++
@@ -7,16 +7,16 @@
program
.version(require('../../package.json').version)
- .option('--interactive-compiler <path>', 'full path to Flash.exe')
- .option('--input-directory <path>', 'full path to input directory that contains FLA files')
- .option('--output-directory <path>', 'full path to input directory to put build artifacts into')
+ .option('--interactive-compiler <path>', 'absolute or relative path to Flash.exe')
+ .option('--input-directory <path>', 'absolute or relative path to input directory that contains FLA files')
+ .option('--output-directory <path>', 'absolute or relative path to input directory to put build artifacts into')
.option('--include-pattern [pattern]', 'list of files to include in a build, default is *.fla', '*.fla')
.option('--debug [value]', 'activate session 0 debugging mode', (value) => Boolean(parseInt(value)), false)
.parse(process.argv);
const compilerConfig = {
- interactiveCompiler: program.interactiveCompiler,
+ interactiveCompiler: path.resolve(program.interactiveCompiler),
inputDirectory: path.resolve(program.inputDirectory),
outputDirectory: path.resolve(program.outputDirectory),
includePattern: program.includePattern, |
b2f2591150c2bcc640fd706eef8cd2ae1cc740ad | src/actions/headerNav.js | src/actions/headerNav.js | import {
HEADER_NAV_MOUSE_ENTER,
HEADER_NAV_MOUSE_LEAVE,
SET_HEADER_NAV
} from '../constants/headerNav';
import { setCurrentAsset } from '../actions/assets';
import keyBy from 'lodash/keyBy';
export const setCurrentHeaderNav = headerNavID => dispatch => {
dispatch({
type: SET_HEADER_NAV,
payload: headerNavID
});
};
export const headevNavMouseEnter = headerNavID => dispatch => {
dispatch({
type: HEADER_NAV_MOUSE_ENTER,
payload: headerNavID
});
};
export const headevNavMouseLeave = () => dispatch => {
dispatch({
type: HEADER_NAV_MOUSE_LEAVE
});
};
export const headerNavClick = headerNavID => (dispatch, getState) => {
const mapping = keyBy(getState().assetsToHeaderNavMapping, 'headerNavID')[headerNavID];
mapping && dispatch(setCurrentAsset(mapping.assetID));
dispatch(setCurrentHeaderNav(headerNavID));
};
| import {
HEADER_NAV_MOUSE_ENTER,
HEADER_NAV_MOUSE_LEAVE,
SET_HEADER_NAV
} from '../constants/headerNav';
import { setCurrentAsset } from '../actions/assets';
import keyBy from 'lodash/keyBy';
export const setCurrentHeaderNav = headerNavID => dispatch => {
dispatch({
type: SET_HEADER_NAV,
payload: headerNavID
});
};
export const headevNavMouseEnter = headerNavID => dispatch => {
dispatch({
type: HEADER_NAV_MOUSE_ENTER,
payload: headerNavID
});
};
export const headevNavMouseLeave = () => dispatch => {
dispatch({
type: HEADER_NAV_MOUSE_LEAVE
});
};
export const headerNavClick = headerNavID => (dispatch, getState) => {
const mapping = keyBy(getState().assetsToHeaderNavMapping, 'headerNavID')[headerNavID];
mapping && dispatch(setCurrentAsset(mapping.assetID));
dispatch(setCurrentHeaderNav(headerNavID));
dispatch(headevNavMouseLeave());
};
| Hide submenu on click sub menu item | Hide submenu on click sub menu item
| JavaScript | mit | g8extended/Character-Generator,g8extended/Character-Generator | ---
+++
@@ -30,4 +30,5 @@
const mapping = keyBy(getState().assetsToHeaderNavMapping, 'headerNavID')[headerNavID];
mapping && dispatch(setCurrentAsset(mapping.assetID));
dispatch(setCurrentHeaderNav(headerNavID));
+ dispatch(headevNavMouseLeave());
}; |
b487ddf16e2a8c396b927fb580919716a951f0a3 | bin/imp.js | bin/imp.js | #! /usr/bin/env node
var program = require("commander");
program
.version("0.0.1")
.command("devices [options]", "Lists devices, or adds/removes devices from project")
.command("deploy [options]", "Deploys the project")
.command("init", "Creates a new imp project")
.command("log [options]", "Logs messages from specified device")
.command("login [options]", "Sets your global API-Key")
.command("models [options]", "Lists models, or sets the project's model")
.command("pull [options]", "Fetches the most recent code from the imp server")
.command("migrate [options]", "Migrates model from development imp server to production imp server")
program.parse(process.argv);
| #! /usr/bin/env node
var program = require("commander");
program
.version("0.0.1")
.command("devices [options]", "Lists devices, or adds/removes devices from project")
.command("deploy [options]", "Deploys the project")
.command("init", "Creates a new imp project")
.command("log [options]", "Logs messages from specified device")
.command("login [options]", "Sets your global API-Key")
.command("models [options]", "Lists models, or sets the project's model")
.command("pull [options]", "Fetches the most recent code from the imp server")
.command("migrate [options]", "Migrates model from one imp account to another (useful for commercial customers with dev accounts and limited access production accounts)")
program.parse(process.argv);
| Update migrate help text so that its purpose was more clear | Update migrate help text so that its purpose was more clear
| JavaScript | mit | deldrid1/imp-cli,matt-haines/imp-cli,cat-haines/imp-cli | ---
+++
@@ -12,6 +12,6 @@
.command("login [options]", "Sets your global API-Key")
.command("models [options]", "Lists models, or sets the project's model")
.command("pull [options]", "Fetches the most recent code from the imp server")
- .command("migrate [options]", "Migrates model from development imp server to production imp server")
+ .command("migrate [options]", "Migrates model from one imp account to another (useful for commercial customers with dev accounts and limited access production accounts)")
program.parse(process.argv); |
9e1f44dd5609ae683e9bb147f7c84955b3b7bdaa | bleep.com-dance-all-night.user.js | bleep.com-dance-all-night.user.js | // ==UserScript==
// @name bleep.com dance all night
// @namespace rob@middlerob.com
// @include https://bleep.com/*
// @version 1
// @description Disable the 60 second pause on bleep.com
// @license MIT
// @oujs:author middlerob
// @grant none
// ==/UserScript==
eval(durationChanged.toString().replace('durationChanged', 'fixedDurationChanged').replace(60, 1000000))
$('#jplayer')
.unbind($.jPlayer.event.timeupdate)
.bind($.jPlayer.event.timeupdate, fixedDurationChanged)
| // ==UserScript==
// @name bleep.com dance all night
// @namespace rob@middlerob.com
// @include https://bleep.com/*
// @version 2
// @description Disable the 60 second pause on bleep.com
// @license MIT
// @oujs:author middlerob
// @grant none
// ==/UserScript==
setInterval(function() {
window.playableTime = 1000000
}, 2000)
| Fix script to work with latest website updates | Fix script to work with latest website updates | JavaScript | mit | Rob-ot/bleep.com-dance-all-night | ---
+++
@@ -2,15 +2,13 @@
// @name bleep.com dance all night
// @namespace rob@middlerob.com
// @include https://bleep.com/*
-// @version 1
+// @version 2
// @description Disable the 60 second pause on bleep.com
// @license MIT
// @oujs:author middlerob
// @grant none
// ==/UserScript==
-eval(durationChanged.toString().replace('durationChanged', 'fixedDurationChanged').replace(60, 1000000))
-
-$('#jplayer')
- .unbind($.jPlayer.event.timeupdate)
- .bind($.jPlayer.event.timeupdate, fixedDurationChanged)
+setInterval(function() {
+ window.playableTime = 1000000
+}, 2000) |
8f05bb23c68bf3ded65cbf9b145f1f299b44205c | src/defaults.js | src/defaults.js | const defaults = {
/**
* Label
*/
label: 'Dialog',
/**
* Description - ID of HTMLElement to use as aria-describedby
*/
description: '',
/**
* Focus - HTMLElement to focus on open
*/
focus: '',
/**
* Alert - Is the dialog an alert?
*/
alert: false,
openClass: 'is-open',
/**
* Auto initiate on instantiation
*/
autoInit: true,
};
export default defaults;
| /**
* Default configuration.
*
* @property {string} label - ID of HTMLElement to use as label or a string.
* @property {string} description - ID of HTMLElement to use as aria-describedby.
* @property {boolean} alert - Set dialog role to alertdialog.
* @property {string} openClass - The class applied to elements.dialog when open.
*/
const defaults = {
label: 'Dialog',
description: '',
alert: false,
openClass: 'is-open',
};
export default defaults;
| Add docblock to default configuration object | Add docblock to default configuration object
| JavaScript | mit | rynpsc/dialog,rynpsc/dialog | ---
+++
@@ -1,30 +1,16 @@
+/**
+ * Default configuration.
+ *
+ * @property {string} label - ID of HTMLElement to use as label or a string.
+ * @property {string} description - ID of HTMLElement to use as aria-describedby.
+ * @property {boolean} alert - Set dialog role to alertdialog.
+ * @property {string} openClass - The class applied to elements.dialog when open.
+ */
const defaults = {
- /**
- * Label
- */
label: 'Dialog',
-
- /**
- * Description - ID of HTMLElement to use as aria-describedby
- */
description: '',
-
- /**
- * Focus - HTMLElement to focus on open
- */
- focus: '',
-
- /**
- * Alert - Is the dialog an alert?
- */
alert: false,
-
openClass: 'is-open',
-
- /**
- * Auto initiate on instantiation
- */
- autoInit: true,
};
export default defaults; |
3561e1abd475ac6b1d3a48076b9f5d8a5ebaf3f1 | src/components/Facets/FacetsGroup.js | src/components/Facets/FacetsGroup.js | import React, { Component } from 'react'
import Facet from './Facet'
import { isActive } from '../../helpers/manageFilters'
const styles = {
type: {
textTransform: 'capitalize',
fontSize: '1em',
fontWeight: 400,
marginBottom: '1em',
},
group: {
marginBottom: '1em',
}
}
class FacetsGroup extends Component {
render() {
const { type, facets, filters, addFilter } = this.props
return (
<div style={styles.group}>
<h4 style={styles.type}>{type}</h4>
{facets.map((facet, idx) => <Facet
key={idx}
name={type}
value={facet.value}
count={facet.count}
isActive={isActive(filters, {name: type, value: facet.value})}
addFilter={addFilter} />)}
</div>
)
}
}
export default FacetsGroup
| import React, { Component } from 'react'
import Facet from './Facet'
import { isActive } from '../../helpers/manageFilters'
const styles = {
type: {
textTransform: 'capitalize',
fontSize: '1em',
fontWeight: 400,
marginBottom: '1em',
},
group: {
marginBottom: '1em',
}
}
class FacetsGroup extends Component {
render() {
const { type, facets, filters, addFilter } = this.props
const activeMap = facets.map(facet => isActive(filters, {name: type, value: facet.value}))
if (activeMap.indexOf(false) === -1) {
return null;
}
return (
<div style={styles.group}>
<h4 style={styles.type}>{type}</h4>
{facets.map((facet, idx) => <Facet
key={idx}
name={type}
value={facet.value}
count={facet.count}
isActive={activeMap[idx]}
addFilter={addFilter} />)}
</div>
)
}
}
export default FacetsGroup
| Hide facet if no filters are still inactive inside | Hide facet if no filters are still inactive inside
| JavaScript | mit | sgmap/inspire,sgmap/inspire | ---
+++
@@ -18,6 +18,12 @@
render() {
const { type, facets, filters, addFilter } = this.props
+ const activeMap = facets.map(facet => isActive(filters, {name: type, value: facet.value}))
+
+ if (activeMap.indexOf(false) === -1) {
+ return null;
+ }
+
return (
<div style={styles.group}>
<h4 style={styles.type}>{type}</h4>
@@ -26,7 +32,7 @@
name={type}
value={facet.value}
count={facet.count}
- isActive={isActive(filters, {name: type, value: facet.value})}
+ isActive={activeMap[idx]}
addFilter={addFilter} />)}
</div>
) |
7ebb7b380645c5dc496d2b4376979bd7a9bbaa87 | src/converter/r2t/ConvertCodeCell.js | src/converter/r2t/ConvertCodeCell.js | import convertSourceCode from './convertSourceCode'
export default class ConvertCodeCell {
/*
Collect <code specific-use="cell"> and turn it into cell elements in
TextureJATS
TODO:
- Properly handle CDATA content
- Implement export method
*/
import(dom, converter) {
let cells = dom.findAll('code[specific-use=cell]')
cells.forEach((oldCell) => {
let cell = dom.createElement('cell')
cell.append(
convertSourceCode(oldCell, converter)
)
oldCell.getParent().replaceChild(oldCell, cell)
})
}
export(/*dom*/) {
console.error('TODO: implement ConvertCodeCell.export')
}
}
| import convertSourceCode from './convertSourceCode'
export default class ConvertCodeCell {
/*
Collect <code specific-use="cell"> and turn it into cell elements in
TextureJATS
TODO:
- Properly handle CDATA content
- Implement export method
*/
import(dom, converter) {
let cells = dom.findAll('code[specific-use=cell]')
cells.forEach((oldCell) => {
let cell = dom.createElement('cell').attr('id', oldCell.id)
cell.append(
convertSourceCode(oldCell, converter)
)
oldCell.getParent().replaceChild(oldCell, cell)
})
}
export(/*dom*/) {
console.error('TODO: implement ConvertCodeCell.export')
}
}
| Save cell id during conversion. | Save cell id during conversion.
| JavaScript | mit | substance/texture,substance/texture | ---
+++
@@ -14,7 +14,7 @@
let cells = dom.findAll('code[specific-use=cell]')
cells.forEach((oldCell) => {
- let cell = dom.createElement('cell')
+ let cell = dom.createElement('cell').attr('id', oldCell.id)
cell.append(
convertSourceCode(oldCell, converter) |
bf33de8661a8d2ff1dfa415929c86679eb7c8cc0 | src/css-clean-src/sortCss/sortCss.js | src/css-clean-src/sortCss/sortCss.js | function sortCss(settings, cssObject) {
function sortDeep(array) {
sortCss.scope(settings, array, {
displace : [
'sass function',
'sass import',
'sass include',
'sass include arguments',
'sass mixin',
'sass include block',
'sass extend',
'property group',
]
});
for (var i = 0, n = array.length; i < n; i++) {
if (Array.isArray(array[i].content) && array[i].content.length) {
sortDeep(array[i].content);
}
}
}
sortCss.scope(settings, cssObject, {
displace : [
'sass import',
'sass include',
'sass variable assignment',
'font face',
'sass function',
'sass mixin',
'sass include block',
'sass placeholder',
]
});
if (settings.sortBlockScope) {
for (var i = 0, n = cssObject.length; i < n; i++) {
if (Array.isArray(cssObject[i].content) && cssObject[i].content.length) {
sortDeep(cssObject[i].content);
}
}
}
}
sortCss.list = {};
sortCss.each = {};
| function sortCss(settings, cssObject) {
var displaceDeep = [
'sass function',
'sass import',
'sass include',
'sass include arguments',
'sass mixin',
'sass include block',
'sass extend',
'property group',
];
var displaceZeroDepth = [
'sass import',
'sass include',
'sass variable assignment',
'font face',
'sass function',
'sass mixin',
'sass include block',
'sass placeholder',
];
function sortDeep(array) {
sortCss.scope(settings, array, {
displace : displaceDeep
});
for (var i = 0, n = array.length; i < n; i++) {
if (Array.isArray(array[i].content) && array[i].content.length) {
sortDeep(array[i].content);
}
}
}
sortCss.scope(settings, cssObject, {
displace : displaceZeroDepth
});
if (settings.sortBlockScope) {
for (var i = 0, n = cssObject.length; i < n; i++) {
if (Array.isArray(cssObject[i].content) && cssObject[i].content.length) {
sortDeep(cssObject[i].content);
}
}
}
}
sortCss.list = {};
sortCss.each = {};
| Declare 'displace' arrays at the top of the function | Declare 'displace' arrays at the top of the function
| JavaScript | mit | SeanJM/atom-css-clean | ---
+++
@@ -1,35 +1,42 @@
function sortCss(settings, cssObject) {
+ var displaceDeep = [
+ 'sass function',
+ 'sass import',
+ 'sass include',
+ 'sass include arguments',
+ 'sass mixin',
+ 'sass include block',
+ 'sass extend',
+ 'property group',
+ ];
+
+ var displaceZeroDepth = [
+ 'sass import',
+ 'sass include',
+ 'sass variable assignment',
+ 'font face',
+ 'sass function',
+ 'sass mixin',
+ 'sass include block',
+ 'sass placeholder',
+ ];
+
function sortDeep(array) {
sortCss.scope(settings, array, {
- displace : [
- 'sass function',
- 'sass import',
- 'sass include',
- 'sass include arguments',
- 'sass mixin',
- 'sass include block',
- 'sass extend',
- 'property group',
- ]
+ displace : displaceDeep
});
+
for (var i = 0, n = array.length; i < n; i++) {
if (Array.isArray(array[i].content) && array[i].content.length) {
sortDeep(array[i].content);
}
}
}
+
sortCss.scope(settings, cssObject, {
- displace : [
- 'sass import',
- 'sass include',
- 'sass variable assignment',
- 'font face',
- 'sass function',
- 'sass mixin',
- 'sass include block',
- 'sass placeholder',
- ]
+ displace : displaceZeroDepth
});
+
if (settings.sortBlockScope) {
for (var i = 0, n = cssObject.length; i < n; i++) {
if (Array.isArray(cssObject[i].content) && cssObject[i].content.length) { |
3eb178c27d595833fe1ea7ebeb846c37ffd094e4 | js/board.js | js/board.js | import settings from 'settings';
import { bind } from 'util/dom';
var worker;
var messageCount;
var callbacks;
function post (command, data, callback) {
callbacks[messageCount] = callback;
worker.postMessage({
id: messageCount,
command: command,
data: JSON.parse(JSON.stringify(data)),
});
messageCount++;
}
function messageHandler (event) {
var message = event.data;
if (callbacks[message.id]) {
callbacks[message.id](message.data);
delete callbacks[message.id];
}
}
export function getJewel (x, y, callback) {
post('getJewel', {
x: x,
y: y,
}, callback);
}
export function getBoard (callback) {
post('getBoard', null, callback);
}
export function print () {
post('print', null, function (jewels) {
console.log(jewels);
});
}
export function swap (x1, y1, x2, y2, callback) {
post('swap', {
x1: x1,
y1: y1,
x2: x2,
y2: y2
}, callback);
}
export function initialize (callback) {
messageCount = 0;
callbacks = [];
worker = new Worker('/scripts/workers/board.js');
bind(worker, 'message', messageHandler);
post('initialize', settings, callback);
}
| import settings from 'settings';
import { bind } from 'util/dom';
var worker;
var messageCount;
var callbacks;
function post (command, data, callback) {
callbacks[messageCount] = callback;
worker.postMessage({
id: messageCount,
command: command,
data: JSON.parse(JSON.stringify(data)),
});
messageCount++;
}
function messageHandler (event) {
var message = event.data;
if (callbacks[message.id]) {
callbacks[message.id](message.data);
delete callbacks[message.id];
}
}
export function getJewel (x, y, callback) {
post('getJewel', {
x: x,
y: y,
}, callback);
}
export function getBoard (callback) {
post('getBoard', null, callback);
}
export function print () {
post('print', null, function (jewels) {
console.log(jewels);
});
}
export function swap (x1, y1, x2, y2, callback) {
post('swap', {
x1: x1,
y1: y1,
x2: x2,
y2: y2
}, callback);
}
export function initialize (callback) {
messageCount = 0;
callbacks = [];
worker = new Worker('/scripts/workers/board.js');
bind(worker, 'message', messageHandler);
bind(worker, 'error', function (err) {
console.log('worker error:', err);
});
post('initialize', settings, callback);
}
| Add error handler to Web Worker | Add error handler to Web Worker
| JavaScript | mit | darvelo/match-three | ---
+++
@@ -57,6 +57,9 @@
callbacks = [];
worker = new Worker('/scripts/workers/board.js');
bind(worker, 'message', messageHandler);
+ bind(worker, 'error', function (err) {
+ console.log('worker error:', err);
+ });
post('initialize', settings, callback);
}
|
4d84f4549135fce864890b00deedfb81eed3ad23 | js/count.js | js/count.js | document.addEventListener("DOMContentLoaded", function (event) {
// redirect to 7777 port
// ping golang counter
httpGetAsync("http://www.aracki.me:7777/count", function (res) {
alert(res);
})
});
function httpGetAsync(theUrl, callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState === 4 && xmlHttp.status === 200)
callback(xmlHttp.responseText);
};
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.setRequestHeader("Access-Control-Allow-Origin", '*');
xmlHttp.setRequestHeader("Access-Control-Allow-Methods", 'GET, POST, PATCH, PUT, DELETE, OPTIONS');
xmlHttp.setRequestHeader("Access-Control-Allow-Headers", 'Origin, Content-Type, X-Auth-Token');
xmlHttp.send("ivan");
} | document.addEventListener("DOMContentLoaded", function (event) {
// redirect to 7777 port
// ping golang counter
getRequest("localhost:7777/count", function (request) {
var response = request.currentTarget.response || request.target.responseText;
console.log(response);
})
});
function getRequest(url, success) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = success;
xhr.send();
return xhr;
} | Add getRequest() to golang app | Add getRequest() to golang app
| JavaScript | mit | Aracki/aracki.me,Aracki/aracki.me | ---
+++
@@ -1,20 +1,16 @@
document.addEventListener("DOMContentLoaded", function (event) {
// redirect to 7777 port
// ping golang counter
- httpGetAsync("http://www.aracki.me:7777/count", function (res) {
- alert(res);
+ getRequest("localhost:7777/count", function (request) {
+ var response = request.currentTarget.response || request.target.responseText;
+ console.log(response);
})
});
-function httpGetAsync(theUrl, callback) {
- var xmlHttp = new XMLHttpRequest();
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState === 4 && xmlHttp.status === 200)
- callback(xmlHttp.responseText);
- };
- xmlHttp.open("GET", theUrl, true); // true for asynchronous
- xmlHttp.setRequestHeader("Access-Control-Allow-Origin", '*');
- xmlHttp.setRequestHeader("Access-Control-Allow-Methods", 'GET, POST, PATCH, PUT, DELETE, OPTIONS');
- xmlHttp.setRequestHeader("Access-Control-Allow-Headers", 'Origin, Content-Type, X-Auth-Token');
- xmlHttp.send("ivan");
+function getRequest(url, success) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url);
+ xhr.onload = success;
+ xhr.send();
+ return xhr;
} |
f4035de99216e3c4d587a53e5f728316acab1f22 | server.js | server.js | const express = require('express')
const path = require('path')
const fs = require('fs')
const formidable = require('formidable')
const app = express()
const PORT = process.env.PORT || 9000
const UPLOAD_DIR = path.join(__dirname, 'uploads/')
if (!fs.existsSync(UPLOAD_DIR)) {
console.warn('Creating uploads folder...')
fs.mkdirSync(UPLOAD_DIR)
}
console.info(`Uploads will be saved in ${UPLOAD_DIR}`)
app.use(express.static(path.join(__dirname, 'build')))
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})
app.post('/uploads', function (req, res) {
var form = new formidable.IncomingForm()
form.parse(req)
form.on('fileBegin', function (name, file) {
file.path = `${UPLOAD_DIR}${file.name}`
})
form.on('file', function (name, file) {
console.log('Uploaded ' + file.name)
})
res.header('Access-Control-Allow-Origin', '*')
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
)
res.status(200).json({ success: true, status: 'Form successfully submitted' })
})
app.listen(PORT, _ => console.info(`Server listening on PORT ${PORT}...`))
| const express = require('express')
const path = require('path')
const fs = require('fs')
const formidable = require('formidable')
const app = express()
const PORT = process.env.PORT || 9000
const UPLOAD_DIR = path.join(__dirname, 'uploads/')
const CORS = process.env.NODE_ENV === 'production' ? process.env.HOST : '*'
if (!fs.existsSync(UPLOAD_DIR)) {
console.warn('Creating uploads folder...')
fs.mkdirSync(UPLOAD_DIR)
}
console.info(`Uploads will be saved in ${UPLOAD_DIR}`)
app.use(express.static(path.join(__dirname, 'build')))
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})
app.post('/uploads', function (req, res) {
var form = new formidable.IncomingForm()
form.parse(req)
form.on('fileBegin', function (name, file) {
file.path = `${UPLOAD_DIR}${file.name}`
})
form.on('file', function (name, file) {
console.log('Uploaded ' + file.name)
})
res.header('Access-Control-Allow-Origin', CORS)
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
)
res.status(200).json({ success: true, status: 'Form successfully submitted' })
})
app.listen(PORT, _ => console.info(`Server listening on PORT ${PORT}...`))
| Change CORS to be set by environment | Change CORS to be set by environment
| JavaScript | mit | planigan/resource-center,planigan/resource-center,fus-marcom/resource-center,fus-marcom/resource-center | ---
+++
@@ -5,6 +5,7 @@
const app = express()
const PORT = process.env.PORT || 9000
const UPLOAD_DIR = path.join(__dirname, 'uploads/')
+const CORS = process.env.NODE_ENV === 'production' ? process.env.HOST : '*'
if (!fs.existsSync(UPLOAD_DIR)) {
console.warn('Creating uploads folder...')
@@ -31,7 +32,7 @@
console.log('Uploaded ' + file.name)
})
- res.header('Access-Control-Allow-Origin', '*')
+ res.header('Access-Control-Allow-Origin', CORS)
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept' |
647e62ffa45e6cd91bf2232c7dfbe78055705599 | knexfile.js | knexfile.js | /**
* This file is automatically loaded when knex runs migrations
*/
require('babel-register')();
const config = require('./server/config').default;
module.exports = {
client: 'mssql',
connection: {
server: config.db.server,
user: config.db.user,
password: config.db.password,
database: config.db.name,
options: {
encrypt: true,
},
},
};
| /**
* This file is automatically loaded when knex runs migrations
*/
require('babel-register')();
const config = require('./server/config').default;
module.exports = {
client: 'mssql',
connection: {
server: config.db.server,
user: config.db.user,
password: config.db.password,
database: config.db.name,
options: {
encrypt: true,
},
},
acquireConnectionTimeout: 5000,
};
| Use a more sensible connection timeout for knex | Use a more sensible connection timeout for knex
| JavaScript | mit | noms-digital-studio/csra-app,noms-digital-studio/csra-app,noms-digital-studio/csra-app | ---
+++
@@ -17,4 +17,5 @@
encrypt: true,
},
},
+ acquireConnectionTimeout: 5000,
}; |
5df0f46b25b9d97e5a20a9488de3ee01fc9baa71 | app/assets/javascripts/deck.js | app/assets/javascripts/deck.js | var Deck = function(cards = []) {
this.cards = cards;
};
Deck.prototype.addCard = function(card) {
this.cards.push(card);
};
Deck.prototype.nextCard = function(card) {
return this.cards.pop();
};
Deck.prototype.fetchCards = function() {
var request = $.ajax({
method: 'POST',
url: '/decks/new',
data: $("input").serialize()
})
.done(function(resp) {
deckCallBack(resp);
})
};
Deck.prototype.updateHistory = function(card, state) {
// Send back the result of the card
json_card = {
card_id: card["id"],
card_name: card["name"],
card_state: state }
$.ajax({
method: 'PUT',
url: '/decks/' + card["id"] + '/update',
data: json_card
})
};
| var Deck = function() {
this.cards = [];
};
Deck.prototype.addCard = function(card) {
this.cards.push(card);
};
Deck.prototype.nextCard = function(card) {
return this.cards.pop();
};
Deck.prototype.fetchCards = function() {
var request = $.ajax({
method: 'POST',
url: '/decks/new',
data: $("input").serialize()
})
.done(function(resp) {
deckCallBack(resp);
})
};
Deck.prototype.updateHistory = function(card, state) {
// Send back the result of the card
json_card = {
card_id: card["id"],
card_name: card["name"],
card_state: state }
$.ajax({
method: 'PUT',
url: '/decks/' + card["id"] + '/update',
data: json_card
})
};
| Remove cards == [] from Deck() | Remove cards == [] from Deck()
| JavaScript | mit | zjuanz/tendr,zjuanz/tendr,zjuanz/tendr | ---
+++
@@ -1,5 +1,5 @@
-var Deck = function(cards = []) {
- this.cards = cards;
+var Deck = function() {
+ this.cards = [];
};
Deck.prototype.addCard = function(card) { |
b2416e04739afc0ee2c52ed64dabdd069c2ccaa2 | app/controllers/application.js | app/controllers/application.js | import Ember from 'ember';
export default Ember.Controller.extend({
flashError: null,
nextFlashError: null,
showUserOptions: false,
stepFlash: function() {
this.set('flashError', this.get('nextFlashError'));
this.set('nextFlashError', null);
},
resetDropdownOption: function(controller, option) {
controller.set(option, !controller.get(option));
if (controller.get(option)) {
Ember.$(document).on('mousedown.useroptions', function() {
Ember.run.later(function() {
controller.set(option, false);
}, 100);
Ember.$(document).off('mousedown.useroptions');
});
}
},
actions: {
search: function(query) {
this.transitionToRoute('search', {queryParams: {q: query}});
},
toggleUserOptions: function() {
this.resetDropdownOption(this, 'showUserOptions');
},
},
});
| import Ember from 'ember';
export default Ember.Controller.extend({
flashError: null,
nextFlashError: null,
showUserOptions: false,
stepFlash: function() {
this.set('flashError', this.get('nextFlashError'));
this.set('nextFlashError', null);
},
resetDropdownOption: function(controller, option) {
controller.set(option, !controller.get(option));
if (controller.get(option)) {
Ember.$(document).on('mousedown.useroptions', function() {
Ember.run.later(function() {
controller.set(option, false);
}, 150);
Ember.$(document).off('mousedown.useroptions');
});
}
},
actions: {
search: function(query) {
this.transitionToRoute('search', {queryParams: {q: query}});
},
toggleUserOptions: function() {
this.resetDropdownOption(this, 'showUserOptions');
},
},
});
| Extend the visible time after-click for a dropdown | Extend the visible time after-click for a dropdown
| JavaScript | apache-2.0 | chenxizhang/crates.io,withoutboats/crates.io,sfackler/crates.io,mbrubeck/crates.io,chenxizhang/crates.io,chenxizhang/crates.io,sfackler/crates.io,BlakeWilliams/crates.io,sfackler/crates.io,withoutboats/crates.io,Susurrus/crates.io,mbrubeck/crates.io,steveklabnik/crates.io,Gankro/crates.io,BlakeWilliams/crates.io,achanda/crates.io,rust-lang/crates.io,mbrubeck/crates.io,achanda/crates.io,steveklabnik/crates.io,BlakeWilliams/crates.io,achanda/crates.io,mbrubeck/crates.io,withoutboats/crates.io,Gankro/crates.io,steveklabnik/crates.io,BlakeWilliams/crates.io,Gankro/crates.io,chenxizhang/crates.io,Susurrus/crates.io,Susurrus/crates.io,rust-lang/crates.io,achanda/crates.io,Gankro/crates.io,rust-lang/crates.io,withoutboats/crates.io,Susurrus/crates.io,steveklabnik/crates.io,rust-lang/crates.io | ---
+++
@@ -16,7 +16,7 @@
Ember.$(document).on('mousedown.useroptions', function() {
Ember.run.later(function() {
controller.set(option, false);
- }, 100);
+ }, 150);
Ember.$(document).off('mousedown.useroptions');
});
} |
f04da7379d9c870cc065460d5a20fd90d21dbf78 | app/libs/utils/color-string.js | app/libs/utils/color-string.js | 'use strict';
// Load requirements
const clk = require('chalk'),
chalk = new clk.constructor({level: 1, enabled: true});
// Formats a string with ANSI styling
module.exports = function(str) {
// Variables
const regex = /\{([a-z,]+)\:(.+?)\}/gi;
let m;
// Check for a non-string
if ( typeof str !== 'string' ) {
return '';
}
// Loop through matches
while ( ( m = regex.exec(str) ) !== null ) {
// Allow for multiple formatting options
let split = m[1].split(','),
partial = m[2];
// Wrap the replacement area
for ( let i in split ) {
if ( chalk[split[i]] !== undefined ) {
partial = chalk[split[i]](partial);
}
}
// Make the replacement in the original string
str = str.replace(m[0], partial);
}
// Still matches to be made
return ( str.match(regex) !== null ? this.colorString(str) : str.replace(/\{([a-z,]+)\:/gi, '') );
};
| 'use strict';
// Load requirements
const clk = require('chalk'),
chalk = new clk.constructor({level: 1, enabled: true});
// Formats a string with ANSI styling
module.exports = function(str) {
// Variables
const regex = /\{([a-z,]+)\:([\s\S]*?)\}/gmi;
let m;
// Check for a non-string
if ( typeof str !== 'string' ) {
return '';
}
// Loop through matches
while ( ( m = regex.exec(str) ) !== null ) {
// Allow for multiple formatting options
let split = m[1].split(','),
partial = m[2];
// Wrap the replacement area
for ( let i in split ) {
if ( chalk[split[i]] !== undefined ) {
partial = chalk[split[i]](partial);
}
}
// Make the replacement in the original string
str = str.replace(m[0], partial);
}
// Still matches to be made
return ( str.match(regex) !== null ? this.colorString(str) : str.replace(/\{([a-z,]+)\:/gi, '') );
};
| Improve color string regex pattern for multiline matches | Improve color string regex pattern for multiline matches
| JavaScript | apache-2.0 | transmutejs/core | ---
+++
@@ -8,7 +8,7 @@
module.exports = function(str) {
// Variables
- const regex = /\{([a-z,]+)\:(.+?)\}/gi;
+ const regex = /\{([a-z,]+)\:([\s\S]*?)\}/gmi;
let m;
// Check for a non-string |
0ee588e3e67535829d31b06b5da91ffb3d1910a8 | src/apis/GifAPI.js | src/apis/GifAPI.js | import * as _ from 'lodash'
import UUID from 'node-uuid';
const KEY = 'GIFS';
export const loadData = () => {
let data = JSON.parse(localStorage.getItem(KEY));
if (_.isEmpty(data)) {
return {};
} else {
return data;
}
};
export const update = (update) => {
localStorage.setItem(KEY, JSON.stringify(update));
};
export const mock = (max = 10) => {
localStorage.clear();
let data = [];
for(let i = 0; i < max; i++) {
data.push({
id: UUID.v4(),
name: 'Test ' + i,
url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif'
});
}
localStorage.setItem(KEY, JSON.stringify(data))
}; | import * as _ from 'lodash'
import UUID from 'node-uuid';
const KEY = 'GIFS';
export const loadData = () => {
let data = JSON.parse(localStorage.getItem(KEY));
if (_.isEmpty(data)) {
return {};
} else {
return data;
}
};
export const update = (update) => {
localStorage.setItem(KEY, JSON.stringify(update));
};
export const mock = (max = 10) => {
localStorage.clear();
let data = [];
for(let i = 0; i < max; i++) {
data.push({
id: UUID.v4(),
name: 'Test ' + i,
url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif',
still_url: 'https://media2.giphy.com/media/geozuBY5Y6cXm/giphy_s.gif'
});
}
localStorage.setItem(KEY, JSON.stringify(data))
}; | Add stil url in mock | Add stil url in mock
| JavaScript | mit | macpie/Gif-Chrome-Extension,macpie/Gif-Chrome-Extension | ---
+++
@@ -26,7 +26,8 @@
data.push({
id: UUID.v4(),
name: 'Test ' + i,
- url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif'
+ url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif',
+ still_url: 'https://media2.giphy.com/media/geozuBY5Y6cXm/giphy_s.gif'
});
}
|
f60385580b7db9ef8a0a8a137d95e08abccb854e | lib/util.js | lib/util.js | /**
* Download tool for Unicode CLDR JSON data
*
* Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license
* https://github.com/rxaviers/cldr-data-downloader/blob/master/LICENSE-MIT
*/
"use strict";
var assert = require("assert");
var fs = require("fs");
var url = require("url");
module.exports = {
deepEqual: function(a, b) {
try {
assert.deepEqual(a, b);
} catch (error) {
if (error.name === "AssertionError") {
return false;
}
throw error;
}
return true;
},
isUrl: function(urlOrPath) {
urlOrPath = url.parse(urlOrPath);
return urlOrPath.hostname ? true : false;
},
readJSON: function(filepath) {
return JSON.parse(fs.readFileSync(filepath));
}
};
| /**
* Download tool for Unicode CLDR JSON data
*
* Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license
* https://github.com/rxaviers/cldr-data-downloader/blob/master/LICENSE-MIT
*/
"use strict";
var assert = require("assert");
var fs = require("fs");
var url = require("url");
module.exports = {
deepEqual: function(a, b) {
try {
assert.deepEqual(a, b);
} catch (error) {
if (error instanceof assert.AssertionError) {
return false;
}
throw error;
}
return true;
},
isUrl: function(urlOrPath) {
urlOrPath = url.parse(urlOrPath);
return urlOrPath.hostname ? true : false;
},
readJSON: function(filepath) {
return JSON.parse(fs.readFileSync(filepath));
}
};
| Check error with instance of | Check error with instance of
Closes #22
Signed-off-by: Dominic Bartl <a9662aa7a7b7ac6326ee7732d0f7f2070642dd85@gmail.com>
| JavaScript | mit | rxaviers/cldr-data-downloader | ---
+++
@@ -17,7 +17,7 @@
try {
assert.deepEqual(a, b);
} catch (error) {
- if (error.name === "AssertionError") {
+ if (error instanceof assert.AssertionError) {
return false;
}
throw error; |
9163379bf273fde65b13d8a6b989c9c3b09a079e | app/webpacker/packs/vue_app.js | app/webpacker/packs/vue_app.js | import Vue from 'vue/dist/vue.esm';
import store from '../store/index.js.erb';
import '../config/axios';
import '../directives/selectionchange';
import TheAnnotator from '../components/TheAnnotator.vue.erb';
import AnnotationHandle from "../components/AnnotationHandle";
document.addEventListener('DOMContentLoaded', () => {
const app = new Vue({
el: '#app',
store,
components: {
TheAnnotator,
AnnotationHandle
}
});
window.app = app;
});
| import 'polyfills';
import Vue from 'vue/dist/vue.esm';
import store from '../store/index.js.erb';
import '../config/axios';
import '../directives/selectionchange';
import TheAnnotator from '../components/TheAnnotator.vue.erb';
import AnnotationHandle from "../components/AnnotationHandle";
document.addEventListener('DOMContentLoaded', () => {
const app = new Vue({
el: '#app',
store,
components: {
TheAnnotator,
AnnotationHandle
}
});
window.app = app;
});
| Include polyfills for vue app js | Include polyfills for vue app js
| JavaScript | agpl-3.0 | harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o | ---
+++
@@ -1,3 +1,4 @@
+import 'polyfills';
import Vue from 'vue/dist/vue.esm';
import store from '../store/index.js.erb'; |
666bc930fece85dc2b45221bd7ffcecb73a057a3 | config/bootstrap.js | config/bootstrap.js | /**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your Sails app gets lifted.
* This gives you an opportunity to set up your data model, run jobs, or perform some special logic.
*
* For more information on bootstrapping your app, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.bootstrap.html
*/
module.exports.bootstrap = function(cb) {
Video.findOne({
playing: true
}).exec(function(err, current) {
if (current) {
SyncService.startVideo(current);
}
cb();
});
};
| /**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your Sails app gets lifted.
* This gives you an opportunity to set up your data model, run jobs, or perform some special logic.
*
* For more information on bootstrapping your app, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.bootstrap.html
*/
module.exports.bootstrap = function(cb) {
Video.findOne({
playing: true
}).then(function(err, current) {
if (current) {
SyncService.startVideo(current);
}
cb();
});
};
| Change Bootstrap .exec to .then for consistency | Change Bootstrap .exec to .then for consistency
| JavaScript | mit | TheConnMan/jukebot,TheConnMan/jukebot,TheConnMan/jukebot | ---
+++
@@ -13,7 +13,7 @@
Video.findOne({
playing: true
- }).exec(function(err, current) {
+ }).then(function(err, current) {
if (current) {
SyncService.startVideo(current);
} |
5712884c7ddbe7edafdf2c3e03f456d031d96e84 | app/js/controllers/main_controller.js | app/js/controllers/main_controller.js | annotationApp.controller('MainController', function($scope) {
$scope.tokens = [
{ 'string' : 'Marcus', 'id' : '1' },
{ 'string' : 'rosam', 'id' : '2' },
{ 'string' : 'videt', 'id' : '3' },
{ 'string' : '.', 'id' : '4' }
];
$scope.selectedToken = { id: '1' };
$scope.currentToken = function() {
return $scope.tokens[$scope.selectedToken.id - 1]
};
});
| annotationApp.controller('MainController', function($scope) {
$scope.tokens = [
{ 'string' : 'Marcus', 'id' : '1' },
{ 'string' : 'rosam', 'id' : '2' },
{ 'string' : 'videt', 'id' : '3' },
{ 'string' : '.', 'id' : '4' }
];
$scope.selectedToken = { id: '1' };
$scope.currentToken = function() {
return $scope.tokens[$scope.selectedToken.id - 1]
};
$scope.selectToken = function(id) {
$scope.selectedToken.id = id
}
});
| Add function to select a token | Add function to select a token
| JavaScript | mit | fbaumgardt/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa,latin-language-toolkit/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa,PonteIneptique/arethusa,PonteIneptique/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,Masoumeh/arethusa | ---
+++
@@ -11,4 +11,8 @@
$scope.currentToken = function() {
return $scope.tokens[$scope.selectedToken.id - 1]
};
+
+ $scope.selectToken = function(id) {
+ $scope.selectedToken.id = id
+ }
}); |
4c36269339935f0ccb44dc600d4c1dcd5d2725ec | config/webpack.dev.js | config/webpack.dev.js | const path = require("path");
const merge = require("webpack-merge");
const webpack = require("webpack");
const common = require("./webpack.common.js");
const postCSSPlugins = [
require("postcss-easy-import")({ prefix: "_" }),
require("postcss-mixins"),
require("postcss-simple-vars"),
require("postcss-nested"),
require("postcss-color-function"),
require("postcss-hexrgba"),
require("autoprefixer")
];
module.exports = merge(common, {
entry: [
"webpack-dev-server/client?http://localhost:3000/",
"webpack/hot/only-dev-server"
],
mode: "development",
devtool: "eval-cheap-module-source-map",
watch: true,
devServer: {
headers: {
"Access-Control-Allow-Origin": "*"
},
hot: true,
port: 3000,
disableHostCheck: true,
overlay: true,
contentBase: path.join(__dirname, "../src")
},
plugins: [new webpack.HotModuleReplacementPlugin()],
module: {
rules: [
{
test: /\.css$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
url: false
}
},
{
loader: "postcss-loader",
options: {
plugins: postCSSPlugins
}
}
]
}
]
}
});
| const path = require("path");
const merge = require("webpack-merge");
const webpack = require("webpack");
const common = require("./webpack.common.js");
const postCSSPlugins = [
require("postcss-easy-import")({ prefix: "_" }),
require("postcss-mixins"),
require("postcss-simple-vars"),
require("postcss-nested"),
require("postcss-color-function"),
require("postcss-hexrgba"),
require("autoprefixer")
];
module.exports = merge(common, {
entry: [
"webpack-dev-server/client?http://localhost:3000/",
"webpack/hot/only-dev-server"
],
mode: "development",
devtool: "eval-source-map",
watch: true,
devServer: {
headers: {
"Access-Control-Allow-Origin": "*"
},
hot: true,
port: 3000,
disableHostCheck: true,
overlay: true,
contentBase: path.join(__dirname, "../src")
},
plugins: [new webpack.HotModuleReplacementPlugin()],
module: {
rules: [
{
test: /\.css$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
url: false
}
},
{
loader: "postcss-loader",
options: {
plugins: postCSSPlugins
}
}
]
}
]
}
});
| Use more reliable JS source mapping technique | Use more reliable JS source mapping technique
| JavaScript | mit | trendyminds/pura,trendyminds/pura | ---
+++
@@ -19,7 +19,7 @@
"webpack/hot/only-dev-server"
],
mode: "development",
- devtool: "eval-cheap-module-source-map",
+ devtool: "eval-source-map",
watch: true,
devServer: {
headers: { |
091842d279f0456ca9f8f2f062a7d207c4e1466e | spec/client.spec.js | spec/client.spec.js | const Client = require('../lib/client');
const options = {
baseUrl: 'some value',
username: 'some value',
password: 'some value'
};
describe('Client', () => {
it('should be constructor and factory function', () => {
expect(Client).toBeFunction();
expect(new Client(options)).toBeObject();
expect(Client(options)).toBeObject();
});
it('should have properties with api', () => {
const client = new Client(options);
const apiKeys = Object.keys(client);
expect(apiKeys.length).toEqual(1);
expect(client['branchPermissions']).toBeObject();
});
it('should have validation for options', () => {
expect(() => new Client()).toThrow();
expect(() => new Client(123)).toThrow();
expect(() => new Client({})).toThrow();
expect(() => new Client({ baseUrl: null, username: null, password: null })).toThrow();
expect(() => new Client({ baseUrl: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123', baseUrl: '123' })).not.toThrow();
});
});
| const Client = require('../lib/client');
const options = {
baseUrl: 'some value',
username: 'some value',
password: 'some value'
};
describe('Client', () => {
it('should be constructor and factory function', () => {
expect(Client).toBeFunction();
expect(new Client(options)).toBeObject();
expect(Client(options)).toBeObject();
});
it('should have properties with api', () => {
const client = new Client(options);
const apiKeys = Object.keys(client);
expect(apiKeys.length).toEqual(1);
expect(client['branchPermissions']).toBeObject();
});
it('should have validation for options', () => {
expect(() => new Client()).toThrow();
expect(() => new Client(123)).toThrow();
expect(() => new Client({})).toThrow();
expect(() => new Client({ baseUrl: null, username: null, password: null })).toThrow();
expect(() => new Client({ baseUrl: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123' })).toThrow();
expect(() => new Client({ username: '123', baseUrl: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123', baseUrl: '123' })).not.toThrow();
});
});
| Cover one more branch in unit tests | tests: Cover one more branch in unit tests
| JavaScript | mit | bponomarenko/stash-web-api | ---
+++
@@ -28,6 +28,7 @@
expect(() => new Client({ baseUrl: null, username: null, password: null })).toThrow();
expect(() => new Client({ baseUrl: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123' })).toThrow();
+ expect(() => new Client({ username: '123', baseUrl: '123' })).toThrow();
expect(() => new Client({ username: '123', password: '123', baseUrl: '123' })).not.toThrow();
});
}); |
188f10af537bfdfb3e0c24c676b129efca9117f5 | server.js | server.js | var http = require('http');
var fs = require('fs');
var path = require('path');
var mime = require('mime');
var cache = {};
function send404(response) {
response.writeHead(404, {'Content-Type': 'text/plain'});
response.write('Error 404: resource not found.');
response.end();
}
function sendFile(response, filePath, fileContents) {
response.writeHead(
200,
{'Content-Type': mime.lookup(path.basename(filePath))}
);
response.end(fileContents);
} | var http = require('http');
var fs = require('fs');
var path = require('path');
var mime = require('mime');
var cache = {};
function send404(response) {
response.writeHead(404, {'Content-Type': 'text/plain'});
response.write('Error 404: resource not found.');
response.end();
}
function sendFile(response, filePath, fileContents) {
response.writeHead(
200,
{'Content-Type': mime.lookup(path.basename(filePath))}
);
response.end(fileContents);
}
function serveStatic(response, cache, absPath) {
if (cache[absPath]) {
sendFile(response, absPath, cache[absPath]);
} else {
fs.exists(absPath, function(exists) {
if (exists) {
fs.readFile(absPath, function(err, data) {
if (err) {
send404(response);
} else {
cache[absPath] = data;
sendFile(response, absPath, data);
}
});
} else {
send404(response);
}
});
}
} | Add helper function for serving static files | Add helper function for serving static files
| JavaScript | mit | sebsonic2o/chatrooms,sebsonic2o/chatrooms | ---
+++
@@ -17,3 +17,24 @@
);
response.end(fileContents);
}
+
+function serveStatic(response, cache, absPath) {
+ if (cache[absPath]) {
+ sendFile(response, absPath, cache[absPath]);
+ } else {
+ fs.exists(absPath, function(exists) {
+ if (exists) {
+ fs.readFile(absPath, function(err, data) {
+ if (err) {
+ send404(response);
+ } else {
+ cache[absPath] = data;
+ sendFile(response, absPath, data);
+ }
+ });
+ } else {
+ send404(response);
+ }
+ });
+ }
+} |
4b14769af554c0a28817f049e75b783dc2c18f36 | server.js | server.js | var koa = require('koa');
var http = require('http');
var route = require('koa-route');
var serve = require('koa-static');
var bodyParser = require('koa-bodyparser');
// Koa middleware
var error = require('./api/lib/middleware/error');
// Create koa app
var app = koa();
// Koa middleware
app.use(error());
app.use(bodyParser());
app.use(serve('./frontend/dist'));
// API routes
app.use(route.post('/generate', require('./api/routes/generate')));
// Define configurable port
var port = process.env.PORT || 4000;
// Listen for connections
app.listen(port);
// Log port
console.log('Server listening on http://localhost:' + port);
| var koa = require('koa');
var http = require('http');
var route = require('koa-route');
var serve = require('koa-static');
var bodyParser = require('koa-bodyparser');
// Koa middleware
var error = require('./api/lib/middleware/error');
// Create koa app
var app = koa();
// Koa middleware
app.use(error());
app.use(bodyParser());
app.use(serve('./frontend/dist'));
// API routes
app.use(route.post('/generate', require('./api/routes/generate')));
// Define configurable port
var port = process.env.PORT || 4000;
// Listen for connections
app.listen(port);
// Log port
console.log('Server listening on port ' + port);
| Improve port log message syntax | Improve port log message syntax
| JavaScript | apache-2.0 | eladnava/applicationize,eladnava/applicationize | ---
+++
@@ -25,4 +25,4 @@
app.listen(port);
// Log port
-console.log('Server listening on http://localhost:' + port);
+console.log('Server listening on port ' + port); |
0736453287987b2221129475d5c2fedfb160d8a2 | gulp-tasks/link-js.js | gulp-tasks/link-js.js | 'use strict';
(() => {
module.exports = (gulp, plugins, config) => {
return () => {
return plugins.vinylFs.src([config.patternsPath + '/**/*.js',
config.patternsPath + '/**/*.json',
'!' + config.patternsPath + '/**/rocketbelt.slipsum-cache.json'])
.pipe(plugins.plumber({ errorHandler: plugins.notify.onError('Error: <%= error.message %>') }))
.pipe(plugins.vinylFs.symlink(config.templatesPath, { relative: true }));
};
};
})();
| 'use strict';
(() => {
module.exports = (gulp, plugins, config) => {
return () => {
return plugins.vinylFs.src([`${config.patternsPath}/**/*.js`,
`${config.patternsPath}/**/*.json`,
`!${config.patternsPath}/**/rocketbelt.slipsum-cache.json`,
`!${config.patternsPath}/tools/**/*`])
.pipe(plugins.plumber({
errorHandler: plugins.notify.onError('Error: <%= error.message %>')
}))
.pipe(plugins.vinylFs.symlink(config.templatesPath, { relative: true }));
};
};
})();
| Exclude JS files in tools directory from symlinking. | fix(Build): Exclude JS files in tools directory from symlinking.
| JavaScript | mit | Pier1/rocketbelt,Pier1/rocketbelt | ---
+++
@@ -2,10 +2,13 @@
(() => {
module.exports = (gulp, plugins, config) => {
return () => {
- return plugins.vinylFs.src([config.patternsPath + '/**/*.js',
- config.patternsPath + '/**/*.json',
- '!' + config.patternsPath + '/**/rocketbelt.slipsum-cache.json'])
- .pipe(plugins.plumber({ errorHandler: plugins.notify.onError('Error: <%= error.message %>') }))
+ return plugins.vinylFs.src([`${config.patternsPath}/**/*.js`,
+ `${config.patternsPath}/**/*.json`,
+ `!${config.patternsPath}/**/rocketbelt.slipsum-cache.json`,
+ `!${config.patternsPath}/tools/**/*`])
+ .pipe(plugins.plumber({
+ errorHandler: plugins.notify.onError('Error: <%= error.message %>')
+ }))
.pipe(plugins.vinylFs.symlink(config.templatesPath, { relative: true }));
};
}; |
8de650bcecb75087610aed4352e0a426290f690c | src/modules/common/components/App.js | src/modules/common/components/App.js | import React from 'react';
import {Provider} from 'react-redux';
import {Router, Route, IndexRoute} from 'react-router';
import HomeContainer from '../../home/components/HomeContainer';
import TranslationProvider from './translation/TranslationProvider';
import {routerPaths} from '../constants';
const routes = (
<Route path="/">
<IndexRoute component={HomeContainer}/>
<Route path={routerPaths.singleUnit} component={HomeContainer}/>
</Route>
);
const App = ({store, history}) => (
<TranslationProvider>
<Provider store={store}>
<Router history={history} routes={routes} key={Math.random()}/>
</Provider>
</TranslationProvider>
);
export default App; | import React from 'react';
import {Provider} from 'react-redux';
import {Router, Route, IndexRoute} from 'react-router';
import HomeContainer from '../../home/components/HomeContainer';
import TranslationProvider from './translation/TranslationProvider';
import {routerPaths} from '../constants';
const routes = (
<Route path="/">
<IndexRoute component={HomeContainer}/>
<Route path={routerPaths.singleUnit} component={HomeContainer}/>
</Route>
);
const App = ({store, history}) => (
<Provider store={store}>
<TranslationProvider>
<Router history={history} routes={routes} key={Math.random()}/>
</TranslationProvider>
</Provider>
);
export default App; | Change order of translation provider and store provider to allow translation provider access the storage | Change order of translation provider and store provider to allow translation provider access the storage
| JavaScript | mit | nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map | ---
+++
@@ -13,11 +13,11 @@
);
const App = ({store, history}) => (
- <TranslationProvider>
<Provider store={store}>
+ <TranslationProvider>
<Router history={history} routes={routes} key={Math.random()}/>
- </Provider>
- </TranslationProvider>
+ </TranslationProvider>
+ </Provider>
);
export default App; |
826d3b49a409fc658991a25f2226f67a0a00722e | src/gates/Joke_NeGate.js | src/gates/Joke_NeGate.js | import {GateBuilder} from "src/circuit/Gate.js"
import {Matrix} from "src/math/Matrix.js"
import {GatePainting} from "src/draw/GatePainting.js"
const NeGate = new GateBuilder().
setSerializedId("NeGate").
setSymbol("-I").
setTitle("Ne-Gate").
setBlurb("Negates all amplitudes.").
setDrawer(args => {
GatePainting.paintLocationIndependentFrame(args);
let {x, y} = args.rect.center();
args.painter.print(
"-I",
x,
y,
'center',
'middle',
'black',
'16px monospace',
args.rect.w,
args.rect.h);
}).
setKnownEffectToMatrix(Matrix.square(-1, 0, 0, -1)).
gate;
export {NeGate}
| import {GateBuilder} from "src/circuit/Gate.js"
import {Matrix} from "src/math/Matrix.js"
import {Point} from "src/math/Point.js"
import {GatePainting} from "src/draw/GatePainting.js"
const NeGate = new GateBuilder().
setSerializedId("NeGate").
setTitle("Ne-Gate").
setBlurb("Negates all amplitudes.").
setDrawer(args => {
GatePainting.paintLocationIndependentFrame(args);
let {x, y} = args.rect.center();
args.painter.strokeLine(new Point(x - 6, y), new Point(x + 6, y), 'black', 2);
}).
setKnownEffectToMatrix(Matrix.square(-1, 0, 0, -1)).
gate;
export {NeGate}
| Update negate gate symbol to be a single thick line | Update negate gate symbol to be a single thick line
| JavaScript | apache-2.0 | Strilanc/Quantum-Circuit-Inspector,Strilanc/Quirk,Strilanc/Quirk,Strilanc/Quantum-Circuit-Inspector | ---
+++
@@ -1,25 +1,16 @@
import {GateBuilder} from "src/circuit/Gate.js"
import {Matrix} from "src/math/Matrix.js"
+import {Point} from "src/math/Point.js"
import {GatePainting} from "src/draw/GatePainting.js"
const NeGate = new GateBuilder().
setSerializedId("NeGate").
- setSymbol("-I").
setTitle("Ne-Gate").
setBlurb("Negates all amplitudes.").
setDrawer(args => {
GatePainting.paintLocationIndependentFrame(args);
let {x, y} = args.rect.center();
- args.painter.print(
- "-I",
- x,
- y,
- 'center',
- 'middle',
- 'black',
- '16px monospace',
- args.rect.w,
- args.rect.h);
+ args.painter.strokeLine(new Point(x - 6, y), new Point(x + 6, y), 'black', 2);
}).
setKnownEffectToMatrix(Matrix.square(-1, 0, 0, -1)).
gate; |
4d49374a63ede67e58ead2fd34dc484c67efa606 | assignments/javascript/anagram/anagram_test.spec.js | assignments/javascript/anagram/anagram_test.spec.js | var Anagram = require('./anagram');
describe('Anagram', function() {
it("no matches",function() {
var detector = new Anagram("diaper");
var matches = detector.match([ "hello", "world", "zombies", "pants"]);
expect(matches).toEqual([]);
});
xit("detects simple anagram",function() {
var detector = new Anagram("ba");
var matches = detector.match(['ab', 'abc', 'bac']);
expect(matches).toEqual(['ab']);
});
xit("detects multiple anagrams",function() {
var detector = new Anagram("abc");
var matches = detector.match(['ab', 'abc', 'bac']);
expect(matches).toEqual(['abc', 'bac']);
});
xit("detects anagram",function() {
var detector = new Anagram("listen");
var matches = detector.match(['enlists', 'google', 'inlets', 'banana']);
expect(matches).toEqual(['inlets']);
});
xit("detects multiple anagrams",function() {
var detector = new Anagram("allergy");
var matches = detector.match(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']);
expect(matches).toEqual(['gallery', 'regally', 'largely']);
});
}); | var Anagram = require('./anagram');
describe('Anagram', function() {
it("no matches",function() {
var detector = new Anagram("diaper");
var matches = detector.match([ "hello", "world", "zombies", "pants"]);
expect(matches).toEqual([]);
});
xit("detects simple anagram",function() {
var detector = new Anagram("ba");
var matches = detector.match(['ab', 'abc', 'bac']);
expect(matches).toEqual(['ab']);
});
xit("does not detect false positives",function() {
var detector = new Anagram("bba");
var matches = detector.match(["aab"]);
expect(matches).toEqual([]);
});
xit("detects multiple anagrams",function() {
var detector = new Anagram("abc");
var matches = detector.match(['ab', 'abc', 'bac']);
expect(matches).toEqual(['abc', 'bac']);
});
xit("detects anagram",function() {
var detector = new Anagram("listen");
var matches = detector.match(['enlists', 'google', 'inlets', 'banana']);
expect(matches).toEqual(['inlets']);
});
xit("detects multiple anagrams",function() {
var detector = new Anagram("allergy");
var matches = detector.match(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']);
expect(matches).toEqual(['gallery', 'regally', 'largely']);
});
});
| Add test for same length, same letters, different letter instance counts | Add test for same length, same letters, different letter instance counts
One possible solution to detecting an anagram might be to check to see if the words are the same length and that each letter from the first word is contained in the second word. This additional test would guard against that solution appearing to work.
I wasn't sure in what position in the test sequence it ought to go, or what the exact test description should be. Feel free to suggest changes.
| JavaScript | mit | wobh/xjavascript,marcCanipel/xjavascript,marcCanipel/xjavascript,nicgallardo/xjavascript,a25patel/xjavascript,cloudleo/xjavascript,schorsch3000/xjavascript,wobh/xjavascript,JenanMannette/xjavascript,Vontei/Xjavascript-Solutions,eloquence/xjavascript,exercism/xjavascript,nicgallardo/xjavascript,exercism/xjavascript,a25patel/excercismExcercises,cloudleo/xjavascript,Vontei/xjavascript,eloquence/xjavascript,schorsch3000/xjavascript,Vontei/xjavascript,a25patel/excercismExcercises,Vontei/Xjavascript-Solutions,ZacharyRSmith/xjavascript,JenanMannette/xjavascript,a25patel/xjavascript,ZacharyRSmith/xjavascript | ---
+++
@@ -12,6 +12,12 @@
var detector = new Anagram("ba");
var matches = detector.match(['ab', 'abc', 'bac']);
expect(matches).toEqual(['ab']);
+ });
+
+ xit("does not detect false positives",function() {
+ var detector = new Anagram("bba");
+ var matches = detector.match(["aab"]);
+ expect(matches).toEqual([]);
});
xit("detects multiple anagrams",function() { |
214861a2176e4beb47802ef192927a286301fefe | packages/core/lib/commands/console.js | packages/core/lib/commands/console.js | const command = {
command: "console",
description:
"Run a console with contract abstractions and commands available",
builder: {},
help: {
usage: "truffle console [--network <name>] [--verbose-rpc]",
options: [
{
option: "--network <name>",
description:
"Specify the network to use. Network name must exist in the configuration."
},
{
option: "--verbose-rpc",
description:
"Log communication between Truffle and the Ethereum client."
}
]
},
run: async function (options) {
const { promisify } = require("util");
const Config = require("@truffle/config");
const Console = require("../console");
const { Environment } = require("@truffle/environment");
const config = Config.detect(options);
// This require a smell?
const commands = require("./index");
const excluded = new Set(["console", "init", "watch", "develop"]);
const consoleCommands = Object.keys(commands).reduce((acc, name) => {
return !excluded.has(name)
? Object.assign(acc, {[name]: commands[name]})
: acc;
}, {});
await Environment.detect(config);
const c = new Console(consoleCommands, config.with({noAliases: true}));
return await promisify(c.start)();
}
};
module.exports = command;
| const { promisify } = require("util");
const command = {
command: "console",
description:
"Run a console with contract abstractions and commands available",
builder: {},
help: {
usage: "truffle console [--network <name>] [--verbose-rpc]",
options: [
{
option: "--network <name>",
description:
"Specify the network to use. Network name must exist in the configuration."
},
{
option: "--verbose-rpc",
description:
"Log communication between Truffle and the Ethereum client."
}
]
},
run: async function (options) {
const Config = require("@truffle/config");
const Console = require("../console");
const { Environment } = require("@truffle/environment");
const config = Config.detect(options);
// This require a smell?
const commands = require("./index");
const excluded = new Set(["console", "init", "watch", "develop"]);
const consoleCommands = Object.keys(commands).reduce((acc, name) => {
return !excluded.has(name)
? Object.assign(acc, {[name]: commands[name]})
: acc;
}, {});
await Environment.detect(config);
const c = new Console(consoleCommands, config.with({noAliases: true}));
return await promisify(c.start)();
}
};
module.exports = command;
| Move promisify require to top of file | Move promisify require to top of file
| JavaScript | mit | ConsenSys/truffle | ---
+++
@@ -1,3 +1,5 @@
+const { promisify } = require("util");
+
const command = {
command: "console",
description:
@@ -19,7 +21,6 @@
]
},
run: async function (options) {
- const { promisify } = require("util");
const Config = require("@truffle/config");
const Console = require("../console");
const { Environment } = require("@truffle/environment"); |
f2ed67e33ec475506a9d5c5dfcfbd985a274b5f7 | Presentation.Web/protractor.conf.js | Presentation.Web/protractor.conf.js | var paths = require('../paths.config.js');
exports.config = {
// Path to the selenium server jar. Update version number accordingly!
seleniumServerJar: paths.seleniumServerJar,
// select all end to end tests
specs: paths.e2eFiles,
resultJsonOutputFile: paths.e2eReport
};
| var paths = require('../paths.config.js');
exports.config = {
// Path to the selenium server jar. Update version number accordingly!
seleniumServerJar: paths.seleniumServerJar,
// select all end to end tests
specs: paths.e2eFiles,
resultJsonOutputFile: paths.e2eReport,
// Increase timeout to allow AppVeyor to rebuild database on first instantiation.
allScriptsTimeout: 30000
};
| Increase protractor timeout limit to enable AppVeyor to build database on first instantiation. | Increase protractor timeout limit to enable AppVeyor to build database on first instantiation.
| JavaScript | mpl-2.0 | os2kitos/kitos,os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,miracle-as/kitos,miracle-as/kitos,miracle-as/kitos,os2kitos/kitos | ---
+++
@@ -7,5 +7,8 @@
// select all end to end tests
specs: paths.e2eFiles,
- resultJsonOutputFile: paths.e2eReport
+ resultJsonOutputFile: paths.e2eReport,
+
+ // Increase timeout to allow AppVeyor to rebuild database on first instantiation.
+ allScriptsTimeout: 30000
}; |
159689207deab42fbc4626d8f8b38d3e94c880ea | src/angular-ladda-lw.js | src/angular-ladda-lw.js | angular.module('ladda-lw', ['ngAnimate']).directive('ladda', function laddaDirective() {
return {
restrict: 'A',
scope: {
ladda: '=',
},
compile: (element, attrs) => {
const lLoading = attrs.ladda;
element.addClass('ladda-lw');
const textWrap = angular.element(`
<div class="ladda-lw__text"
ng-class="{\'ladda-lw__text--up\': ' + lLoading + '}">
</div>
`);
textWrap.append(element.contents());
element.append(textWrap);
const loadingWrap = angular.element('<div class="ladda-lw__loading-wrap"></div>');
const loading = angular.element('<div class="ladda-lw__loading" ng-class="{\'ladda-lw__loading--up\': ' + lLoading + '}"></div>');
loadingWrap.append(loading);
element.append(loadingWrap);
return function link(scope, iElement) {
scope.$watch('ladda', function laddaWatch(l) {
iElement.attr('disabled', l ? 'disabled' : false);
});
};
},
};
});
| angular.module('ladda-lw', ['ngAnimate']).directive('ladda', function laddaDirective() {
return {
restrict: 'A',
scope: {
ladda: '=',
},
compile: (element, attrs) => {
const lLoading = attrs.ladda;
element.addClass('ladda-lw');
const textWrap = angular.element(`
<div class="ladda-lw__text"
ng-class="{'ladda-lw__text--up': ${lLoading}}">
</div>
`);
textWrap.append(element.contents());
element.append(textWrap);
const loadingWrap = angular.element(`<div class="ladda-lw__loading-wrap"></div>`);
const loading = angular.element(`
<div class="ladda-lw__loading"
ng-class="{'ladda-lw__loading--up': ${lLoading}}">
</div>
`);
loadingWrap.append(loading);
element.append(loadingWrap);
return function link(scope, iElement) {
scope.$watch('ladda', function laddaWatch(l) {
iElement.attr('disabled', l ? 'disabled' : false);
});
};
},
};
});
| Fix for templates in es6 | Fix for templates in es6
| JavaScript | mit | aeharding/angular-ladda-lw,aeharding/angular-ladda-lw | ---
+++
@@ -11,15 +11,19 @@
const textWrap = angular.element(`
<div class="ladda-lw__text"
- ng-class="{\'ladda-lw__text--up\': ' + lLoading + '}">
+ ng-class="{'ladda-lw__text--up': ${lLoading}}">
</div>
`);
textWrap.append(element.contents());
element.append(textWrap);
- const loadingWrap = angular.element('<div class="ladda-lw__loading-wrap"></div>');
- const loading = angular.element('<div class="ladda-lw__loading" ng-class="{\'ladda-lw__loading--up\': ' + lLoading + '}"></div>');
+ const loadingWrap = angular.element(`<div class="ladda-lw__loading-wrap"></div>`);
+ const loading = angular.element(`
+ <div class="ladda-lw__loading"
+ ng-class="{'ladda-lw__loading--up': ${lLoading}}">
+ </div>
+ `);
loadingWrap.append(loading);
element.append(loadingWrap); |
1600a066ccdb6cbb1b55ecfc0eb526f1854350e0 | Public/Resources/Javascript/global-config.js | Public/Resources/Javascript/global-config.js | /* We have to setup the global variables which will be used for web application.
As now everything comes from webframework globally so I put it here temprarily.
When we completely moved back ferite webframework then we setup it to main.js file
*/
var scriptSrcPath = "/Cention.app/Resources/ReactSrc/";
var imageSrcPath = "/Cention.app/Resources/Images/";
var webRoot = "/web/";
var controllerPath = "/Cention/";
| /* We have to setup the global variables which will be used for web application.
As now everything comes from webframework globally so I put it here temprarily.
When we completely moved back ferite webframework then we setup it to main.js file
*/
var scriptSrcPath = "/Cention.app/Resources/ReactSrc/";
var imageSrcPath = "/Cention.app/Resources/Images/";
var webRoot = "/Cention/web/";
var controllerPath = "/";
| Change controllerPath and webRoot for customer server installation | Change controllerPath and webRoot for customer server installation
| JavaScript | bsd-3-clause | cention/ferite-module-webframework,cention/ferite-module-webframework,cention/ferite-module-webframework | ---
+++
@@ -4,5 +4,5 @@
*/
var scriptSrcPath = "/Cention.app/Resources/ReactSrc/";
var imageSrcPath = "/Cention.app/Resources/Images/";
-var webRoot = "/web/";
-var controllerPath = "/Cention/";
+var webRoot = "/Cention/web/";
+var controllerPath = "/"; |
2ce7a8500f9b3ed7765a4befc070faecb87c7d4c | src/client/js/models/chatlog/index.js | src/client/js/models/chatlog/index.js | /* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80; */
"use strict";
require("sockjs");
let Sock = window.SockJS,
{addMethod} = require("genfun"),
{clone, init} = require("../../lib/proto"),
_ = require("lodash"),
can = require("../../shims/can");
/**
* Chatlog Model
*/
let Chatlog = clone();
/*
* Init
*/
addMethod(init, [Chatlog], function(log, url) {
initSocket(log, url);
initModelList(log);
});
function initSocket(log) {
log.socket = new Sock("http://localhost:8080/ws");
log.socket.onmessage = _.partial(onMessage, log);
}
function initModelList(log) {
log.lines = new LogLine.List([]);
}
function onMessage(log, message) {
log.lines.push(new LogLine({text: message.data}));
}
function addLine(log, line) {
log.socket.send(line);
}
/*
* Canjs Model
*/
var LogLine = can.Model.extend({},{});
module.exports.Chatlog = Chatlog;
module.exports.addLine = addLine;
| /* -*- js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80; */
"use strict";
require("sockjs");
let Sock = window.SockJS,
{addMethod} = require("genfun"),
{clone, init} = require("../../lib/proto"),
_ = require("lodash"),
can = require("../../shims/can");
/**
* Chatlog Model
*/
let Chatlog = clone();
/*
* Init
*/
addMethod(init, [Chatlog], function(log, url) {
initSocket(log, url);
initModelList(log);
});
function initSocket(log) {
log.socket = new Sock("http://localhost:8080/ws");
log.socket.onmessage = _.partial(onMessage, log);
// TODO - this is probably a pretty naive way to go about reconnecting...
log.socket.onclose = _.partial(initSocket, log);
}
function initModelList(log) {
log.lines = new LogLine.List([]);
}
function onMessage(log, message) {
log.lines.push(new LogLine({text: message.data}));
}
function addLine(log, line) {
log.socket.send(line);
}
/*
* Canjs Model
*/
var LogLine = can.Model.extend({},{});
module.exports.Chatlog = Chatlog;
module.exports.addLine = addLine;
| Reconnect if connection is lost | Reconnect if connection is lost
| JavaScript | agpl-3.0 | zkat/storychat | ---
+++
@@ -25,6 +25,8 @@
function initSocket(log) {
log.socket = new Sock("http://localhost:8080/ws");
log.socket.onmessage = _.partial(onMessage, log);
+ // TODO - this is probably a pretty naive way to go about reconnecting...
+ log.socket.onclose = _.partial(initSocket, log);
}
function initModelList(log) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.