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 |
|---|---|---|---|---|---|---|---|---|---|---|
d968fe324bddd13c645d75aa874c811cfcc98056 | server/helpers/encrypt.js | server/helpers/encrypt.js | import bcrypt from 'bcrypt';
module.exports = {
encryptPassword(password) {
const passwordHash = bcrypt.hashSync(password, 10);
return passwordHash;
},
};
| import bcrypt from 'bcrypt';
module.exports = {
encryptPassword(password) {
// const passwordHash = bcrypt.hashSync(password, 10);
// return passwordHash;
const salt = bcrypt.genSaltSync(10);
const hash = bcrypt.hashSync(password, salt);
return {
hash,
salt
};
},
};
| Edit function for password validation | Edit function for password validation
| JavaScript | mit | 3m3kalionel/PostIt,3m3kalionel/PostIt | ---
+++
@@ -2,8 +2,14 @@
module.exports = {
encryptPassword(password) {
- const passwordHash = bcrypt.hashSync(password, 10);
- return passwordHash;
+ // const passwordHash = bcrypt.hashSync(password, 10);
+ // return passwordHash;
+ const salt = bcrypt.genSaltSync(10);
+ const hash = bcrypt.hashSync(password, salt);
+ return {
+ hash,
+ salt
+ };
},
}; |
5993e26d58c3bc099bdc01b71166fe8814289667 | server/migrations/20170625133452-create-message.js | server/migrations/20170625133452-create-message.js | module.exports = {
up: (queryInterface, Sequelize) => queryInterface.createTable('Messages', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
content: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
},
userId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
references: {
model: 'Users',
key: 'id',
as: 'userId',
},
},
groupId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
references: {
model: 'Groups',
key: 'id',
as: 'groupId',
},
},
}),
down(queryInterface /* , Sequelize */) {
queryInterface.dropTable('Messages');
}
};
| module.exports = {
up: (queryInterface, Sequelize) => queryInterface.createTable('Messages', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
content: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
},
userId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE'
},
groupId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE'
},
}),
down(queryInterface /* , Sequelize */) {
queryInterface.dropTable('Messages');
}
};
| Delete references field to fix userId and groupId bugs | Delete references field to fix userId and groupId bugs
| JavaScript | mit | 3m3kalionel/PostIt,3m3kalionel/PostIt | ---
+++
@@ -19,21 +19,11 @@
},
userId: {
type: Sequelize.INTEGER,
- onDelete: 'CASCADE',
- references: {
- model: 'Users',
- key: 'id',
- as: 'userId',
- },
+ onDelete: 'CASCADE'
},
groupId: {
type: Sequelize.INTEGER,
- onDelete: 'CASCADE',
- references: {
- model: 'Groups',
- key: 'id',
- as: 'groupId',
- },
+ onDelete: 'CASCADE'
},
}),
down(queryInterface /* , Sequelize */) { |
23d7bce1eab8f6b770ab2c527c23c3c0908ce907 | function/_define-length.js | function/_define-length.js | 'use strict';
var test = function (a, b) {}, desc, defineProperty
, generate, mixin;
try {
Object.defineProperty(test, 'length', { configurable: true, writable: false,
enumerable: false, value: 1 });
} catch (ignore) {}
if (test.length === 1) {
// ES6
desc = { configurable: true, writable: false, enumerable: false };
defineProperty = Object.defineProperty;
module.exports = function (fn, length) {
desc.value = length;
return defineProperty(fn, 'length', desc);
};
} else {
mixin = require('../object/mixin');
generate = (function () {
var cache = [];
return function (l) {
var args, i = 0;
if (cache[l]) return cache[l];
args = [];
while (l--) args.push('a' + (++i).toString(36));
return new Function('fn', 'return function (' + args.join(', ') +
') { return fn.apply(this, arguments); };');
};
}());
module.exports = function (src, length) {
var target = generate(length)(src);
try { mixin(target, src); } catch (ignore) {}
return target;
};
}
| 'use strict';
var toUint = require('../number/to-uint')
, test = function (a, b) {}, desc, defineProperty
, generate, mixin;
try {
Object.defineProperty(test, 'length', { configurable: true, writable: false,
enumerable: false, value: 1 });
} catch (ignore) {}
if (test.length === 1) {
// ES6
desc = { configurable: true, writable: false, enumerable: false };
defineProperty = Object.defineProperty;
module.exports = function (fn, length) {
length = toUint(length);
if (fn.length === length) return fn;
desc.value = length;
return defineProperty(fn, 'length', desc);
};
} else {
mixin = require('../object/mixin');
generate = (function () {
var cache = [];
return function (l) {
var args, i = 0;
if (cache[l]) return cache[l];
args = [];
while (l--) args.push('a' + (++i).toString(36));
return new Function('fn', 'return function (' + args.join(', ') +
') { return fn.apply(this, arguments); };');
};
}());
module.exports = function (src, length) {
var target;
length = toUint(length);
if (src.length === length) return src;
target = generate(length)(src);
try { mixin(target, src); } catch (ignore) {}
return target;
};
}
| Return same function if length doesn't differ | Return same function if length doesn't differ
| JavaScript | isc | medikoo/es5-ext | ---
+++
@@ -1,6 +1,7 @@
'use strict';
-var test = function (a, b) {}, desc, defineProperty
+var toUint = require('../number/to-uint')
+ , test = function (a, b) {}, desc, defineProperty
, generate, mixin;
try {
@@ -13,6 +14,8 @@
desc = { configurable: true, writable: false, enumerable: false };
defineProperty = Object.defineProperty;
module.exports = function (fn, length) {
+ length = toUint(length);
+ if (fn.length === length) return fn;
desc.value = length;
return defineProperty(fn, 'length', desc);
};
@@ -30,7 +33,10 @@
};
}());
module.exports = function (src, length) {
- var target = generate(length)(src);
+ var target;
+ length = toUint(length);
+ if (src.length === length) return src;
+ target = generate(length)(src);
try { mixin(target, src); } catch (ignore) {}
return target;
}; |
bba2cfe90230b4b4d8120c61b90ede8cc8febb0a | frontend/reducers/index.js | frontend/reducers/index.js | import Shogi from '../src/shogi';
import * as CONST from '../constants/actionTypes';
const InitialState = {
board: Shogi.Board,
isHoldingPiece: undefined
};
const ShogiReducer = (state = InitialState, action) => {
switch (action.type) {
case CONST.HOLD_PIECE:
if (action.piece.type == '*') {
return state;
} else {
let newBoard = state.board.enhanceMovablePoint(action.piece);
return Object.assign({}, { board: newBoard, isHoldingPiece: action.piece });
}
case CONST.MOVE_PIECE:
// if same piece click, release piece.
if (state.isHoldingPiece) {
var newBoard = state.board.movePiece(state.isHoldingPiece, action.piece);
return Object.assign({}, { board: newBoard }, { isHoldingPiece: undefined });
} else {
return Object.assign({}, state, { isHoldingPiece: action.piece });
}
default:
return state;
}
};
export default ShogiReducer;
| import Shogi from '../src/shogi';
import * as CONST from '../constants/actionTypes';
const InitialState = {
board: Shogi.Board,
isHoldingPiece: undefined
};
const ShogiReducer = (state = InitialState, action) => {
switch (action.type) {
case CONST.HOLD_PIECE:
if (action.piece.type == '*') {
return state;
} else {
let newBoard = state.board.enhanceMovablePoint(action.piece);
return Object.assign({}, { board: newBoard, isHoldingPiece: action.piece });
}
case CONST.MOVE_PIECE:
// if same piece click, release piece.
if (state.isHoldingPiece) {
let newBoard = state.board.movePiece(state.isHoldingPiece, action.piece);
return Object.assign({}, { board: newBoard }, { isHoldingPiece: undefined });
} else {
return Object.assign({}, state, { isHoldingPiece: action.piece });
}
default:
return state;
}
};
export default ShogiReducer;
| Use let instead of var | Use let instead of var
| JavaScript | mit | mgi166/usi-front,mgi166/usi-front | ---
+++
@@ -18,7 +18,7 @@
case CONST.MOVE_PIECE:
// if same piece click, release piece.
if (state.isHoldingPiece) {
- var newBoard = state.board.movePiece(state.isHoldingPiece, action.piece);
+ let newBoard = state.board.movePiece(state.isHoldingPiece, action.piece);
return Object.assign({}, { board: newBoard }, { isHoldingPiece: undefined });
} else { |
9efb161d405226438d27a73c628f49b445e01aa6 | gatsby-browser.js | gatsby-browser.js | import React from 'react'
import ComponentRenderer from './src/templates/component-renderer-with-pagination'
exports.replaceComponentRenderer = ({ props, loader }) => {
if (props.layout) {
return null
}
return <ComponentRenderer {...props} loader={loader} />
}
| import React from 'react'
import ComponentRenderer from './src/templates/component-renderer-with-pagination'
export default {
replaceComponentRenderer: ({ props, loader }) => {
if (props.layout) {
return null
}
return <ComponentRenderer {...props} loader={loader} />
}
}
| Convert to either pure CommonJS or pure ES6 (ES6, in this case) | Convert to either pure CommonJS or pure ES6 (ES6, in this case)
| JavaScript | mit | LuisLoureiro/placard-wrapper | ---
+++
@@ -2,10 +2,12 @@
import ComponentRenderer from './src/templates/component-renderer-with-pagination'
-exports.replaceComponentRenderer = ({ props, loader }) => {
- if (props.layout) {
- return null
+export default {
+ replaceComponentRenderer: ({ props, loader }) => {
+ if (props.layout) {
+ return null
+ }
+
+ return <ComponentRenderer {...props} loader={loader} />
}
-
- return <ComponentRenderer {...props} loader={loader} />
} |
15c6f23ff43b1dcc1056c9d63bd7df10b79e65be | Gruntfile.js | Gruntfile.js | module.exports = function (grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
igv: {
src: [
'js/**/*.js',
'vendor/inflate.js',
'vendor/zlib_and_gzip.min.js'
],
dest: 'dist/igv-all.js'
}
},
uglify: {
options: {
mangle: false
},
igv: {
src: 'dist/igv-all.js',
dest: 'dist/igv-all.min.js'
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
//grunt.registerTask('default', ['concat:igvexp', 'uglify:igvexp']);
grunt.registerTask('default', ['concat:igv', 'uglify:igv']);
};
| module.exports = function (grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
igv: {
src: [
'js/**/*.js',
'vendor/inflate.js',
'vendor/zlib_and_gzip.min.js'
],
dest: 'dist/igv-all.js'
}
},
uglify: {
options: {
mangle: false,
sourceMap: true
},
igv: {
src: 'dist/igv-all.js',
dest: 'dist/igv-all.min.js'
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
//grunt.registerTask('default', ['concat:igvexp', 'uglify:igvexp']);
grunt.registerTask('default', ['concat:igv', 'uglify:igv']);
};
| Create sourceMap for minified js | Create sourceMap for minified js
| JavaScript | mit | igvteam/igv.js,NabaviLab/CNV-Visualizer,NabaviLab/CNV-Visualizer,NabaviLab/CNV-Visualizer,NabaviLab/CNV-Visualizer,NabaviLab/CNV-Visualizer,igvteam/igv.js | ---
+++
@@ -18,7 +18,8 @@
uglify: {
options: {
- mangle: false
+ mangle: false,
+ sourceMap: true
},
igv: { |
2a5c56794ba90d34efff284e4771b5922f70c1e4 | app/assets/javascripts/solidus_paypal_braintree/frontend.js | app/assets/javascripts/solidus_paypal_braintree/frontend.js | // This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require solidus_paypal_braintree/constants
//= require solidus_paypal_braintree/promise
//= require solidus_paypal_braintree/client
//= require solidus_paypal_braintree/hosted_form
//= require solidus_paypal_braintree/paypal_button
//= require solidus_paypal_braintree/apple_pay_button
| // This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require solidus_paypal_braintree/braintree_errors
//= require solidus_paypal_braintree/constants
//= require solidus_paypal_braintree/promise
//= require solidus_paypal_braintree/client
//= require solidus_paypal_braintree/hosted_form
//= require solidus_paypal_braintree/paypal_button
//= require solidus_paypal_braintree/apple_pay_button
| Add braintree_error script into manifest | Add braintree_error script into manifest
| JavaScript | bsd-3-clause | solidusio/solidus_paypal_braintree,solidusio/solidus_paypal_braintree,solidusio/solidus_paypal_braintree,solidusio/solidus_paypal_braintree | ---
+++
@@ -4,6 +4,7 @@
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
+//= require solidus_paypal_braintree/braintree_errors
//= require solidus_paypal_braintree/constants
//= require solidus_paypal_braintree/promise
//= require solidus_paypal_braintree/client |
35fdaf00c8e11976b9bcc1dc03b661d4281ff012 | teamcity-reporter.js | teamcity-reporter.js | 'use strict';
var util = require('util');
/**
* @param {Errors[]} errorsCollection
*/
module.exports = function(errorsCollection) {
var errorCount = 0;
/**
* Formatting every error set.
*/
errorsCollection.forEach(function(errors) {
var file = errors.getFilename();
console.log(util.format('##teamcity[testSuiteStarted name="JSCS: %s"]', file));
if (!errors.isEmpty()) {
errors.getErrorList().forEach(function(error) {
errorCount++;
console.log(util.format('##teamcity[testStarted name="%s"]', file));
console.log(util.format('##teamcity[testFailed name="%s" message="line %d, col %d, %s"]',
file, error.line, error.column, error.message));
});
console.log(util.format('##teamcity[testSuiteFinished name="JSCS: %s"]', file));
}
});
if (!errorCount) {
console.log('##teamcity[testStarted name="JSCS"]');
console.log('##teamcity[testFinished name="JSCS"]');
}
};
| "use strict";
var util = require("util");
/**
* @param {Errors[]} errorsCollection
*/
module.exports = function(errorsCollection) {
var errorCount = 0;
console.log(util.format("##teamcity[testSuiteStarted name='JSCS']"));
/**
* Formatting every error set.
*/
errorsCollection.forEach(function(errors) {
var file = errors.getFilename();
if (!errors.isEmpty()) {
errors.getErrorList().forEach(function(error) {
errorCount++;
console.log(util.format("##teamcity[testStarted name='%s']", file));
console.log(util.format("##teamcity[testFailed name='%s' message='line %d, col %d, %s']",
file, error.line, error.column, error.message));
});
}
});
if (errorCount === 0) {
console.log(util.format("##teamcity[testStarted name='JSCS']"));
console.log(util.format("##teamcity[testFinished name='JSCS']"));
}
console.log(util.format("##teamcity[testSuiteFinished name='JSCS']"));
};
| Fix format of messages for teamcity: 1. Replace " by ' - because Teamcity can't process messages with " 2. Change messages structrure | Fix format of messages for teamcity:
1. Replace " by ' - because Teamcity can't process messages with "
2. Change messages structrure
| JavaScript | mit | wurmr/jscs-teamcity-reporter | ---
+++
@@ -1,31 +1,35 @@
-'use strict';
+"use strict";
-var util = require('util');
+var util = require("util");
/**
* @param {Errors[]} errorsCollection
*/
module.exports = function(errorsCollection) {
var errorCount = 0;
+
+ console.log(util.format("##teamcity[testSuiteStarted name='JSCS']"));
+
/**
* Formatting every error set.
*/
errorsCollection.forEach(function(errors) {
var file = errors.getFilename();
- console.log(util.format('##teamcity[testSuiteStarted name="JSCS: %s"]', file));
if (!errors.isEmpty()) {
errors.getErrorList().forEach(function(error) {
errorCount++;
- console.log(util.format('##teamcity[testStarted name="%s"]', file));
- console.log(util.format('##teamcity[testFailed name="%s" message="line %d, col %d, %s"]',
+ console.log(util.format("##teamcity[testStarted name='%s']", file));
+ console.log(util.format("##teamcity[testFailed name='%s' message='line %d, col %d, %s']",
file, error.line, error.column, error.message));
});
- console.log(util.format('##teamcity[testSuiteFinished name="JSCS: %s"]', file));
}
+
});
- if (!errorCount) {
- console.log('##teamcity[testStarted name="JSCS"]');
- console.log('##teamcity[testFinished name="JSCS"]');
+ if (errorCount === 0) {
+ console.log(util.format("##teamcity[testStarted name='JSCS']"));
+ console.log(util.format("##teamcity[testFinished name='JSCS']"));
}
+
+ console.log(util.format("##teamcity[testSuiteFinished name='JSCS']"));
}; |
63d22bfa615b999e0601da71acae794af3ee4865 | component.js | component.js | // This is a function that decorates React's createClass.
// It's used only internally in this library,
// but could be used externally eventually.
// See the mixins for more information on what this does.
var UI = require('reapp-ui');
var Component = require('reapp-component')();
var React = require('react');
var Identified = require('./mixins/Identified');
var Styled = require('./mixins/Styled');
var Classed = require('./mixins/Classed');
var Animated = require('./mixins/Animated');
var ComponentProps = require('./mixins/ComponentProps');
var Tappable = require('./mixins/Tappable');
Component.addDecorator(spec => {
spec.mixins = [].concat(
// unique ids and classes
Identified,
Classed(spec.name),
// constants
{ getConstant: UI.getConstants },
// styles and animations
Styled(spec.name, UI.getStyles),
Animated(UI.getAnimations),
// any component-defined mixins
spec.mixins || [],
Tappable,
// componentProps is the meat of a UI component
// when used, it will handle: id, ref, className, styles, animations
ComponentProps
);
// set UI displayname to help with debugging
spec.displayName = `UI-${spec.name}`;
// allow checking for 'isName' on all components
// spec.statics = spec.statics || {};
// spec[`is${spec.name}`] = true;
return React.createClass(spec);
});
module.exports = Component; | // This is a function that decorates React's createClass.
// It's used only internally in this library,
// but could be used externally eventually.
// See the mixins for more information on what this does.
var UI = require('reapp-ui');
var Component = require('reapp-component')();
var React = require('react');
var Identified = require('./mixins/Identified');
var Styled = require('./mixins/Styled');
var Classed = require('./mixins/Classed');
var Animated = require('./mixins/Animated');
var ComponentProps = require('./mixins/ComponentProps');
Component.addDecorator(spec => {
spec.mixins = [].concat(
// unique ids and classes
Identified,
Classed(spec.name),
// constants
{ getConstant: UI.getConstants },
// styles and animations
Styled(spec.name, UI.getStyles),
Animated(UI.getAnimations),
// any component-defined mixins
spec.mixins || [],
// componentProps is the meat of a UI component
// when used, it will handle: id, ref, className, styles, animations
ComponentProps
);
// set UI displayname to help with debugging
spec.displayName = `UI-${spec.name}`;
// allow checking for 'isName' on all components
// spec.statics = spec.statics || {};
// spec[`is${spec.name}`] = true;
return React.createClass(spec);
});
module.exports = Component; | Remove tappable by default mixin | Remove tappable by default mixin
| JavaScript | mit | Lupino/reapp-ui,oToUC/reapp-ui,jhopper28/reapp-ui,zackp30/reapp-ui,srounce/reapp-ui,zenlambda/reapp-ui,reapp/reapp-ui | ---
+++
@@ -12,7 +12,6 @@
var Classed = require('./mixins/Classed');
var Animated = require('./mixins/Animated');
var ComponentProps = require('./mixins/ComponentProps');
-var Tappable = require('./mixins/Tappable');
Component.addDecorator(spec => {
spec.mixins = [].concat(
@@ -30,8 +29,6 @@
// any component-defined mixins
spec.mixins || [],
- Tappable,
-
// componentProps is the meat of a UI component
// when used, it will handle: id, ref, className, styles, animations
ComponentProps |
0ec851372caa9309df9651126d71361d8163f889 | app/components/crate-toml-copy.js | app/components/crate-toml-copy.js | import { action } from '@ember/object';
import { later } from '@ember/runloop';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
export default class CrateTomlCopy extends Component {
@tracked showSuccess = false;
@tracked showNotification = false;
toggleClipboardProps(isSuccess) {
this.showSuccess = isSuccess;
this.showNotification = true;
later(
this,
() => {
this.showNotification = false;
},
2000,
);
}
@action
copySuccess() {
this.toggleClipboardProps(true);
}
@action
copyError() {
this.toggleClipboardProps(false);
}
}
| import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { rawTimeout, task } from 'ember-concurrency';
export default class CrateTomlCopy extends Component {
@tracked showSuccess = false;
@tracked showNotification = false;
@(task(function* (isSuccess) {
this.showSuccess = isSuccess;
this.showNotification = true;
yield rawTimeout(2000);
this.showNotification = false;
}).restartable())
showNotificationTask;
@action
copySuccess() {
this.showNotificationTask.perform(true);
}
@action
copyError() {
this.showNotificationTask.perform(false);
}
}
| Convert `toggleClipboardProps()` to ember-concurrency task | CrateTomlCopy: Convert `toggleClipboardProps()` to ember-concurrency task
| JavaScript | apache-2.0 | rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io | ---
+++
@@ -1,32 +1,28 @@
import { action } from '@ember/object';
-import { later } from '@ember/runloop';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
+
+import { rawTimeout, task } from 'ember-concurrency';
export default class CrateTomlCopy extends Component {
@tracked showSuccess = false;
@tracked showNotification = false;
- toggleClipboardProps(isSuccess) {
+ @(task(function* (isSuccess) {
this.showSuccess = isSuccess;
this.showNotification = true;
-
- later(
- this,
- () => {
- this.showNotification = false;
- },
- 2000,
- );
- }
+ yield rawTimeout(2000);
+ this.showNotification = false;
+ }).restartable())
+ showNotificationTask;
@action
copySuccess() {
- this.toggleClipboardProps(true);
+ this.showNotificationTask.perform(true);
}
@action
copyError() {
- this.toggleClipboardProps(false);
+ this.showNotificationTask.perform(false);
}
} |
896a87b740c5e228a81f23a11a26845aa849e346 | constants.js | constants.js | // URLs grom telegram
const TELEGRAM_BASE_URL = 'https://api.telegram.org';
const TELEGRAM_MESSAGE_PHOTO_ENDPOINT = '/sendPhoto';
const DEFAULT_PHOTO_URL = 'http://media.salemwebnetwork.com/cms/CROSSCARDS/17343-im-sorry-pug.jpg';
// URLs from giphy
const {GIPHY_PUBLIC_API_KEY} = require('./variables');
const GIPHY_BASE_URL = 'http://api.giphy.com';
const GIPHY_API_KEY_SUFIX = 'api_key=' + GIPHY_PUBLIC_API_KEY;
const GIPHY_SEARCH_ENDPOINT = '/v1/gifs/search';
module.exports = {
// Giphy
GIPHY_BASE_URL, GIPHY_API_KEY_SUFIX, GIPHY_SEARCH_ENDPOINT,
// Telegram
TELEGRAM_BASE_URL, TELEGRAM_MESSAGE_PHOTO_ENDPOINT, DEFAULT_PHOTO_URL
} | // URLs grom telegram
const TELEGRAM_BASE_URL = 'https://api.telegram.org';
const TELEGRAM_MESSAGE_GIF_ENDPOINT = '/sendVideo';
const DEFAULT_GIF_URL = 'http://gph.is/1KuNTVa';
// URLs from giphy
const {GIPHY_PUBLIC_API_KEY} = require('./variables');
const GIPHY_BASE_URL = 'http://api.giphy.com';
const GIPHY_API_KEY_SUFIX = 'api_key=' + GIPHY_PUBLIC_API_KEY;
const GIPHY_SEARCH_ENDPOINT = '/v1/gifs/search';
module.exports = {
// Giphy
GIPHY_BASE_URL, GIPHY_API_KEY_SUFIX, GIPHY_SEARCH_ENDPOINT,
// Telegram
TELEGRAM_BASE_URL, TELEGRAM_MESSAGE_GIF_ENDPOINT, DEFAULT_GIF_URL
} | Rename parameters from photo to gif to get more meaningful names | Rename parameters from photo to gif to get more meaningful names
| JavaScript | apache-2.0 | bserh/giphify_bot | ---
+++
@@ -1,7 +1,7 @@
// URLs grom telegram
const TELEGRAM_BASE_URL = 'https://api.telegram.org';
-const TELEGRAM_MESSAGE_PHOTO_ENDPOINT = '/sendPhoto';
-const DEFAULT_PHOTO_URL = 'http://media.salemwebnetwork.com/cms/CROSSCARDS/17343-im-sorry-pug.jpg';
+const TELEGRAM_MESSAGE_GIF_ENDPOINT = '/sendVideo';
+const DEFAULT_GIF_URL = 'http://gph.is/1KuNTVa';
// URLs from giphy
const {GIPHY_PUBLIC_API_KEY} = require('./variables');
@@ -15,5 +15,5 @@
GIPHY_BASE_URL, GIPHY_API_KEY_SUFIX, GIPHY_SEARCH_ENDPOINT,
// Telegram
- TELEGRAM_BASE_URL, TELEGRAM_MESSAGE_PHOTO_ENDPOINT, DEFAULT_PHOTO_URL
+ TELEGRAM_BASE_URL, TELEGRAM_MESSAGE_GIF_ENDPOINT, DEFAULT_GIF_URL
} |
461281865ccd7521f25b2d4e893eb55c036f56dc | static/js/crowdsource.interceptor.js | static/js/crowdsource.interceptor.js | /**
* Date: 1/9/15
* Author: Shirish Goyal
*/
(function () {
'use strict';
angular
.module('crowdsource.interceptor', [])
.factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);
AuthHttpResponseInterceptor.$inject = ['$location', '$log', '$injector', '$q'];
function AuthHttpResponseInterceptor($location, $log, $injector, $q) {
return {
responseError: function (rejection) {
if (rejection.status === 403) {
if (rejection.hasOwnProperty('data')
&& rejection.data.hasOwnProperty('detail')
&& (rejection.data.detail.indexOf("Authentication credentials were not provided") != -1)
) {
var $http = $injector.get('$http');
var Authentication = $injector.get('Authentication');
if (!Authentication.isAuthenticated()) {
$location.path('/login');
}else{
deferred.resolve(data);
}
}
}
return $q.reject(rejection);
}
}
}
})(); | /**
* Date: 1/9/15
* Author: Shirish Goyal
*/
(function () {
'use strict';
angular
.module('crowdsource.interceptor', [])
.factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);
AuthHttpResponseInterceptor.$inject = ['$location', '$log', '$injector', '$q'];
function AuthHttpResponseInterceptor($location, $log, $injector, $q) {
return {
responseError: function (rejection) {
if (rejection.status === 403) {
if (rejection.hasOwnProperty('data')
&& rejection.data.hasOwnProperty('detail')
&& (rejection.data.detail.indexOf("Authentication credentials were not provided") != -1)
) {
var $http = $injector.get('$http');
var Authentication = $injector.get('Authentication');
if (!Authentication.isAuthenticated()) {
$location.path('/login');
}
}
}
return $q.reject(rejection);
}
}
}
})(); | Remove deferred as not needed | Remove deferred as not needed
| JavaScript | mit | crowdresearch/crowdsource-platform,crowdresearch/crowdsource-platform,crowdresearch/daemo,rakshit-agrawal/crowdsource-platform,Milstein/crowdsource-platform,DESHRAJ/crowdsource-platform,Macbull/crowdsource-platform,crowdresearch/daemo,xasos/crowdsource-platform,crowdresearch/crowdsource-platform,shirishgoyal/crowdsource-platform,xasos/crowdsource-platform,xasos/crowdsource-platform,rakshit-agrawal/crowdsource-platform,aginzberg/crowdsource-platform,DESHRAJ/crowdsource-platform,aginzberg/crowdsource-platform,crowdresearch/daemo,Macbull/crowdsource-platform,shirishgoyal/crowdsource-platform,crowdresearch/crowdsource-platform,aginzberg/crowdsource-platform,Milstein/crowdsource-platform,tanujs22/crowdsource-platform,crowdresearch/daemo,DESHRAJ/crowdsource-platform,aginzberg/crowdsource-platform,shirishgoyal/crowdsource-platform,Macbull/crowdsource-platform,DESHRAJ/crowdsource-platform,rakshit-agrawal/crowdsource-platform,tanujs22/crowdsource-platform,rakshit-agrawal/crowdsource-platform,tanujs22/crowdsource-platform,Milstein/crowdsource-platform,Macbull/crowdsource-platform,xasos/crowdsource-platform,Milstein/crowdsource-platform,shirishgoyal/crowdsource-platform,Milstein/crowdsource-platform,tanujs22/crowdsource-platform | ---
+++
@@ -26,8 +26,6 @@
if (!Authentication.isAuthenticated()) {
$location.path('/login');
- }else{
- deferred.resolve(data);
}
}
} |
d19a0feb10b945a14e5bc0da69d3b47eea6fd47a | packages/mastic-node-server/start.js | packages/mastic-node-server/start.js | const mastic = require('./server.js');
const { promise } = require('mastic-polyfills/bundles');
const server = mastic({
polyfills: [promise]
});
server.listen();
| const mastic = require('./server.js');
const bundles = require('mastic-polyfills/bundles');
const server = mastic({
polyfills: Object.keys(bundles).map(bundleName => bundles[bundleName])
});
server.listen();
| Load all default mastic polyfills in server | Load all default mastic polyfills in server
| JavaScript | mit | thibthib/mastic | ---
+++
@@ -1,8 +1,8 @@
const mastic = require('./server.js');
-const { promise } = require('mastic-polyfills/bundles');
+const bundles = require('mastic-polyfills/bundles');
const server = mastic({
- polyfills: [promise]
+ polyfills: Object.keys(bundles).map(bundleName => bundles[bundleName])
});
server.listen(); |
a441848f22a460a462280c885e4cf53b8eed672b | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
// load all tasks from package.json
require('load-grunt-config')(grunt);
require('time-grunt')(grunt);
/**
* TASKS
*/
// build everything ready for a commit
grunt.registerTask('build', ['img', 'css', 'js']);
// just CSS
grunt.registerTask('css', ['sass', 'cssmin']);
// just images
grunt.registerTask('img', ['responsive_images:retina', 'exec:evenizer', 'responsive_images:regular', 'sprite', 'imagemin']);
// just javascript (babel must go before we add the wrapper, to keep it's generated methods inside, so not globals)
grunt.registerTask('js', ['eslint', 'template:jsAddVersion', 'babel', 'concat', 'uglify', 'replace']);
// build examples
grunt.registerTask('examples', ['template']);
// Travis CI
grunt.registerTask('travis', ['jasmine']);
// bump version number in 3 files, rebuild js to update headers, then commit, tag and push
grunt.registerTask('version', ['bump-only', 'js', 'bump-commit', 'shell:publish']);
};
| module.exports = function(grunt) {
// load all tasks from package.json
require('load-grunt-config')(grunt);
require('time-grunt')(grunt);
/**
* TASKS
*/
// build everything ready for a commit
grunt.registerTask('build', ['css', 'js']);
// just CSS
grunt.registerTask('css', ['sass', 'cssmin']);
// just images
grunt.registerTask('img', ['responsive_images:retina', 'exec:evenizer', 'responsive_images:regular', 'sprite', 'imagemin']);
// just javascript (babel must go before we add the wrapper, to keep it's generated methods inside, so not globals)
grunt.registerTask('js', ['eslint', 'template:jsAddVersion', 'babel', 'concat', 'uglify', 'replace']);
// build examples
grunt.registerTask('examples', ['template']);
// Travis CI
grunt.registerTask('travis', ['jasmine']);
// bump version number in 3 files, rebuild js to update headers, then commit, tag and push
grunt.registerTask('version', ['bump-only', 'js', 'bump-commit', 'shell:publish']);
};
| Remove img task from grunt build | Remove img task from grunt build
As it takes ages, and it always seems to change the images every time someone else runs it. Probably no one else will ever need to update the images, or very rarely, in which case they can manually run the build img task.
| JavaScript | mit | jackocnr/intl-tel-input,jackocnr/intl-tel-input,Bluefieldscom/intl-tel-input,Bluefieldscom/intl-tel-input | ---
+++
@@ -8,7 +8,7 @@
* TASKS
*/
// build everything ready for a commit
- grunt.registerTask('build', ['img', 'css', 'js']);
+ grunt.registerTask('build', ['css', 'js']);
// just CSS
grunt.registerTask('css', ['sass', 'cssmin']);
// just images |
874886cda57b80b5f06a9e3003bd9e20c6601feb | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
"babel": {
options: {
sourceMap: false
},
dist: {
files: [
{
"expand": true,
"cwd": "modules/",
"src": ["**/*.js"],
"dest": "dist",
"ext": ".js"
}]
}
},
eslint: {
target: ["./modules/**/*.js"]
},
watch: {
babel: {
files: ['./modules/*.js'],
tasks: ['babel'],
options: {
spawn: false,
}
}
},
ava: {
target: ['test/*.spec.js']
}
});
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-ava');
grunt.registerTask("default", ["test", "watch"]);
grunt.registerTask("test", ["lint", "babel", "ava"]);
grunt.registerTask("lint", "eslint");
grunt.registerTask("dev", ["babel", "watch"]);
grunt.registerTask("deploy", "babel");
}; | module.exports = function(grunt) {
grunt.initConfig({
"babel": {
options: {
sourceMap: false,
presets: ['es2015']
},
dist: {
files: [
{
"expand": true,
"cwd": "modules/",
"src": ["**/*.js"],
"dest": "dist",
"ext": ".js"
}]
}
},
eslint: {
target: ["./modules/**/*.js"]
},
watch: {
babel: {
files: ['./modules/*.js'],
tasks: ['babel'],
options: {
spawn: false,
}
}
},
ava: {
target: ['test/*.spec.js']
}
});
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-ava');
grunt.registerTask("default", ["test", "watch"]);
grunt.registerTask("test", ["lint", "babel", "ava"]);
grunt.registerTask("lint", "eslint");
grunt.registerTask("dev", ["babel", "watch"]);
grunt.registerTask("deploy", "babel");
}; | Add es2015 preset to babel | Add es2015 preset to babel
| JavaScript | mit | simonlovesyou/file-wipe | ---
+++
@@ -2,7 +2,8 @@
grunt.initConfig({
"babel": {
options: {
- sourceMap: false
+ sourceMap: false,
+ presets: ['es2015']
},
dist: {
files: [ |
fc0bcc9db1e93a520706d21e8766ad38ac1fe00f | public/src/bacon-0.0.1.js | public/src/bacon-0.0.1.js |
(function() {
var metaKeyword = '';
var src = window.location.href;
var metas = document.getElementsByTagName('meta');
for (i in metas) {
console.log(metas[i]);
if (metas[i].name && metas[i].name.indexOf('keyword') > -1) {
metaKeyword += metas[i].content;
}
}
console.log(metaKeyword, src);
})();
|
(function() {
var metaKeyword = '';
var baconServerUrl = "http://127.0.0.1";
var src = window.location.href;
var metas = document.getElementsByTagName('meta');
for (i in metas) {
if (metas[i].name && metas[i].name.indexOf('keyword') > -1) {
metaKeyword += metas[i].content;
}
}
var divs = document.getElementsByClassName('baconLink');
var defaultUrlArgs = "?metaKeyword=" + encodeURIComponent(metaKeyword);
defaultUrlArgs += "&src=" + encodeURIComponent(src);
for (i in divs) {
var div = divs[i];
var args = defaultUrlArgs;
var width = div.getAttribute('width');
if (width) {
args += "&width=" + width;
}
var height = div.getAttribute('width');
if (height) {
args += "&height=" + height;
}
var keywords = div.getAttribute('keywords');
if (keywords) {
args += "&keywords=" + encodeURIComponent(keywords);
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", baconServerUrl + "/getDonationLink" + args, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
div.innerHTML = xmlhttp.responseText;
}
}
}
})();
| Add front end ajax call | Add front end ajax call
| JavaScript | mit | codingtwinky/itchy-octo-fibula | ---
+++
@@ -1,14 +1,42 @@
(function() {
var metaKeyword = '';
+ var baconServerUrl = "http://127.0.0.1";
var src = window.location.href;
var metas = document.getElementsByTagName('meta');
for (i in metas) {
- console.log(metas[i]);
if (metas[i].name && metas[i].name.indexOf('keyword') > -1) {
metaKeyword += metas[i].content;
}
}
- console.log(metaKeyword, src);
+ var divs = document.getElementsByClassName('baconLink');
+
+ var defaultUrlArgs = "?metaKeyword=" + encodeURIComponent(metaKeyword);
+ defaultUrlArgs += "&src=" + encodeURIComponent(src);
+
+ for (i in divs) {
+ var div = divs[i];
+ var args = defaultUrlArgs;
+ var width = div.getAttribute('width');
+ if (width) {
+ args += "&width=" + width;
+ }
+ var height = div.getAttribute('width');
+ if (height) {
+ args += "&height=" + height;
+ }
+ var keywords = div.getAttribute('keywords');
+ if (keywords) {
+ args += "&keywords=" + encodeURIComponent(keywords);
+ }
+
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", baconServerUrl + "/getDonationLink" + args, true);
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ div.innerHTML = xmlhttp.responseText;
+ }
+ }
+ }
})(); |
bd42878d39a42486565548f0c4cc69fcf4e7ce69 | test/web-platform.js | test/web-platform.js | "use strict";
/*global describe */
/*global it */
const assert = require("assert");
const fs = require("fs");
const URL = require("../lib/url").URL;
const uRLTestParser = require("./web-platform-tests/urltestparser");
const testCases = fs.readFileSync(__dirname + "/web-platform-tests/urltestdata.txt", { encoding: "utf-8" });
const urlTests = uRLTestParser(testCases);
describe("Web Platform Tests", function () {
const l = urlTests.length;
for (let i = 0; i < l; i++) {
const expected = urlTests[i];
it("Parsing: <" + expected.input + "> against <" + expected.base + ">", function () {
let url;
try {
url = new URL(expected.input, expected.base);
} catch (e) {
if (e instanceof TypeError && expected.protocol === ":") {
return;
}
throw e;
}
if (expected.protocol === ":" && url.protocol !== ":") {
assert.fail(null, null, "Expected URL to fail parsing");
}
assert.equal(url.href, expected.href, "href");
});
}
});
| "use strict";
/*global describe */
/*global it */
const assert = require("assert");
const fs = require("fs");
const URL = require("../lib/url").URL;
const uRLTestParser = require("./web-platform-tests/urltestparser");
const testCases = fs.readFileSync(__dirname + "/web-platform-tests/urltestdata.txt", { encoding: "utf-8" });
const urlTests = uRLTestParser(testCases);
function testURL(expected) {
return function () {
let url;
try {
url = new URL(expected.input, expected.base);
} catch (e) {
if (e instanceof TypeError && expected.protocol === ":") {
return;
}
throw e;
}
if (expected.protocol === ":" && url.protocol !== ":") {
assert.fail(url.href, "", "Expected URL to fail parsing, got " + url.href);
}
/*assert.equal(url.protocol, expected.protocol, "scheme");
assert.equal(url.hostname, expected.host, "host");
assert.equal(url.port, expected.port, "port");
assert.equal(url.pathname, expected.path, "path");
assert.equal(url.search, expected.search, "search");
assert.equal(url.hash, expected.hash, "hash");*/
assert.equal(url.href, expected.href, "href");
};
}
describe("Web Platform Tests", function () {
const l = urlTests.length;
for (let i = 0; i < l; i++) {
const expected = urlTests[i];
it("Parsing: <" + expected.input + "> against <" + expected.base + ">", testURL(expected));
}
});
| Move function creation out of loop | Move function creation out of loop
Linter complained (it's not actually moved out of it though, function creation still occurs within the loop)
| JavaScript | mit | jsdom/whatwg-url,jsdom/whatwg-url,aaronshaf/whatwg-url,tilgovi/whatwg-url,jsdom/whatwg-url | ---
+++
@@ -10,27 +10,37 @@
const testCases = fs.readFileSync(__dirname + "/web-platform-tests/urltestdata.txt", { encoding: "utf-8" });
const urlTests = uRLTestParser(testCases);
+function testURL(expected) {
+ return function () {
+ let url;
+ try {
+ url = new URL(expected.input, expected.base);
+ } catch (e) {
+ if (e instanceof TypeError && expected.protocol === ":") {
+ return;
+ }
+ throw e;
+ }
+
+ if (expected.protocol === ":" && url.protocol !== ":") {
+ assert.fail(url.href, "", "Expected URL to fail parsing, got " + url.href);
+ }
+
+ /*assert.equal(url.protocol, expected.protocol, "scheme");
+ assert.equal(url.hostname, expected.host, "host");
+ assert.equal(url.port, expected.port, "port");
+ assert.equal(url.pathname, expected.path, "path");
+ assert.equal(url.search, expected.search, "search");
+ assert.equal(url.hash, expected.hash, "hash");*/
+ assert.equal(url.href, expected.href, "href");
+ };
+}
+
describe("Web Platform Tests", function () {
const l = urlTests.length;
for (let i = 0; i < l; i++) {
const expected = urlTests[i];
- it("Parsing: <" + expected.input + "> against <" + expected.base + ">", function () {
- let url;
- try {
- url = new URL(expected.input, expected.base);
- } catch (e) {
- if (e instanceof TypeError && expected.protocol === ":") {
- return;
- }
- throw e;
- }
-
- if (expected.protocol === ":" && url.protocol !== ":") {
- assert.fail(null, null, "Expected URL to fail parsing");
- }
-
- assert.equal(url.href, expected.href, "href");
- });
+ it("Parsing: <" + expected.input + "> against <" + expected.base + ">", testURL(expected));
}
}); |
c606a7d8c4bd008098e6bda631b13cefe96cc82f | lib/collections/notifications.js | lib/collections/notifications.js | Notifications = new Mongo.Collection('notifications');
// TODO add allow/deny rules
// user is owner of project - deny
// user is not logged in - deny
createRequestNotification = function(request) {
check(request, {
user: Object,
project: Object,
createdAt: Date,
status: String
});
Notifications.insert({
userId: request.project.ownerId,
requestingUserId: Meteor.userId(),
text: Meteor.user().username + ' has requested to join ' + request.project.name,
createdAt: new Date(),
read: false,
type: 'interactive',
extraFields: {
projectId: request.project.projectId
}
});
};
| Notifications = new Mongo.Collection('notifications');
// TODO add allow/deny rules
// user is owner of project - deny
// user is not logged in - deny
createRequestNotification = function(request) {
check(request, {
user: Object,
project: Object,
createdAt: Date,
status: String,
_id: String
});
Notifications.insert({
userId: request.project.ownerId,
requestingUserId: Meteor.userId(),
text: Meteor.user().username + ' has requested to join ' + request.project.name,
createdAt: new Date(),
read: false,
type: 'interactive',
extraFields: {
projectId: request.project.projectId,
requestId: request._id
}
});
};
Meteor.methods({
setNotificationAsRead: function(notification) {
check(notification, String);
console.log(notification);
Notifications.update({ _id: notification._id }, {
$set: {
read: true
}
});
}
});
| Add new fields and add method to set notification as read | Add new fields and add method to set notification as read
| JavaScript | mit | PUMATeam/puma,PUMATeam/puma | ---
+++
@@ -9,7 +9,8 @@
user: Object,
project: Object,
createdAt: Date,
- status: String
+ status: String,
+ _id: String
});
Notifications.insert({
@@ -20,7 +21,20 @@
read: false,
type: 'interactive',
extraFields: {
- projectId: request.project.projectId
+ projectId: request.project.projectId,
+ requestId: request._id
}
});
};
+
+Meteor.methods({
+ setNotificationAsRead: function(notification) {
+ check(notification, String);
+ console.log(notification);
+ Notifications.update({ _id: notification._id }, {
+ $set: {
+ read: true
+ }
+ });
+ }
+}); |
d2bfa4fc9abb6b47cd5c2c64652d315e9a0d1699 | app/assets/javascripts/pageflow/slideshow/hidden_text_indicator_widget.js | app/assets/javascripts/pageflow/slideshow/hidden_text_indicator_widget.js | (function($) {
$.widget('pageflow.hiddenTextIndicator', {
_create: function() {
var parent = this.options.parent,
that = this;
parent.on('pageactivate', function(event) {
that.element.toggleClass('invert', $(event.target).hasClass('invert'));
that.element.toggleClass('hidden',
$(event.target).hasClass('hide_content_with_text') ||
$(event.target).hasClass('no_hidden_text_indicator'));
});
parent.on('hidetextactivate', function() {
that.element.addClass('visible');
});
parent.on('hidetextdeactivate', function() {
that.element.removeClass('visible');
});
}
});
}(jQuery));
| (function($) {
$.widget('pageflow.hiddenTextIndicator', {
_create: function() {
var parent = this.options.parent,
that = this;
parent.on('pageactivate', function(event) {
var pageOrPageWrapper = $(event.target).add('.content_and_background', event.target);
that.element.toggleClass('invert', $(event.target).hasClass('invert'));
that.element.toggleClass('hidden',
pageOrPageWrapper.hasClass('hide_content_with_text') ||
pageOrPageWrapper.hasClass('no_hidden_text_indicator'));
});
parent.on('hidetextactivate', function() {
that.element.addClass('visible');
});
parent.on('hidetextdeactivate', function() {
that.element.removeClass('visible');
});
}
});
}(jQuery));
| Allow setting hide text related css classes on wrapper | Allow setting hide text related css classes on wrapper
So far the css classes `hide_content_with_text` and
`no_hidden_text_indicator` had to be present on the page's `section`
element. Allowing them also on the `.content_and_background` wrapper
element makes things much easer to control for page types since that
element is rendered by them.
| JavaScript | mit | tf/pageflow,tf/pageflow-dependabot-test,codevise/pageflow,Modularfield/pageflow,tf/pageflow-dependabot-test,tf/pageflow,Modularfield/pageflow,codevise/pageflow,codevise/pageflow,tf/pageflow,tf/pageflow,Modularfield/pageflow,tf/pageflow-dependabot-test,tf/pageflow-dependabot-test,codevise/pageflow,Modularfield/pageflow,tilsammans/pageflow,tilsammans/pageflow,tilsammans/pageflow,tilsammans/pageflow | ---
+++
@@ -5,10 +5,12 @@
that = this;
parent.on('pageactivate', function(event) {
+ var pageOrPageWrapper = $(event.target).add('.content_and_background', event.target);
+
that.element.toggleClass('invert', $(event.target).hasClass('invert'));
that.element.toggleClass('hidden',
- $(event.target).hasClass('hide_content_with_text') ||
- $(event.target).hasClass('no_hidden_text_indicator'));
+ pageOrPageWrapper.hasClass('hide_content_with_text') ||
+ pageOrPageWrapper.hasClass('no_hidden_text_indicator'));
});
parent.on('hidetextactivate', function() { |
bf2c1b5f09c348f172846087db10344f53bd3c44 | js/MidiInput.js | js/MidiInput.js | var MidiInput = function() {
this.init = function(visualizer) {
this.visualizer = visualizer;
if (navigator.requestMIDIAccess) {
navigator.requestMIDIAccess().then(onMidiSuccess, onMidiReject);
} else {
console.log('No MIDI support: navigator.requestMIDIAccess is not defined');
}
};
function onMidiReject(err) {
console.log('MIDI init error: ' + err);
}
function onMidiSuccess(midi) {
console.log('MIDI init ok!');
}
};
| var MidiInput = function() {
this.init = function(visualizer) {
this.visualizer = visualizer;
if (navigator.requestMIDIAccess) {
navigator.requestMIDIAccess().then(onMidiSuccess.bind(this), onMidiReject);
} else {
console.log('No MIDI support: navigator.requestMIDIAccess is not defined');
}
};
function onMidiReject(err) {
console.log('MIDI init error: ' + err);
}
function onMidiSuccess(midi) {
if (midi.inputs.size > 0) {
// Get first MIDI device
var input = midi.inputs.values().next().value;
console.log('MIDI device found: ' + input.name);
// Set MIDI message handler
input.onmidimessage = messageHandler.bind(this);
} else {
console.log('No MIDI input devices available');
}
}
function messageHandler(event) {
var data = {
status: event.data[0] & 0xf0,
data: [
event.data[1],
event.data[2]
]
};
handleInput(data);
}
function handleInput(data) {
// Note on event
if (data.status === 144) {
var note = data.data[0];
var velocity = data.data[1];
console.log('Note on: ' + note + ', ' + velocity);
// Control change event
} else if (data.status === 176) {
var index = data.data[0];
var value = data.data[1];
console.log('Control change: ' + index + ', ' + value);
}
}
};
| Read note on and control change events from MIDI input | Read note on and control change events from MIDI input
| JavaScript | mit | jakate/AudioViz,jakate/AudioViz,jakate/AudioViz | ---
+++
@@ -3,7 +3,7 @@
this.visualizer = visualizer;
if (navigator.requestMIDIAccess) {
- navigator.requestMIDIAccess().then(onMidiSuccess, onMidiReject);
+ navigator.requestMIDIAccess().then(onMidiSuccess.bind(this), onMidiReject);
} else {
console.log('No MIDI support: navigator.requestMIDIAccess is not defined');
}
@@ -14,6 +14,42 @@
}
function onMidiSuccess(midi) {
- console.log('MIDI init ok!');
+ if (midi.inputs.size > 0) {
+ // Get first MIDI device
+ var input = midi.inputs.values().next().value;
+ console.log('MIDI device found: ' + input.name);
+
+ // Set MIDI message handler
+ input.onmidimessage = messageHandler.bind(this);
+ } else {
+ console.log('No MIDI input devices available');
+ }
+ }
+
+ function messageHandler(event) {
+ var data = {
+ status: event.data[0] & 0xf0,
+ data: [
+ event.data[1],
+ event.data[2]
+ ]
+ };
+
+ handleInput(data);
+ }
+
+ function handleInput(data) {
+ // Note on event
+ if (data.status === 144) {
+ var note = data.data[0];
+ var velocity = data.data[1];
+ console.log('Note on: ' + note + ', ' + velocity);
+
+ // Control change event
+ } else if (data.status === 176) {
+ var index = data.data[0];
+ var value = data.data[1];
+ console.log('Control change: ' + index + ', ' + value);
+ }
}
}; |
102e8120046d6a39aa0db05961288fec320eb3f3 | tests/unit/helpers/upload-validation-active-test.js | tests/unit/helpers/upload-validation-active-test.js |
import { uploadValidationActive } from 'preprint-service/helpers/upload-validation-active';
import { module, test } from 'qunit';
module('Unit | Helper | upload validation active');
// Replace this with your real tests.
test('it works', function(assert) {
var editMode = true;
var nodeLocked = true;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
assert.ok(result);
});
|
import { uploadValidationActive } from 'preprint-service/helpers/upload-validation-active';
import { module, test } from 'qunit';
module('Unit | Helper | upload validation active');
test('edit mode upload validation active', function(assert) {
var editMode = true;
var nodeLocked = true;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
assert.equal(result, true);
});
test('edit mode upload validation not active', function(assert) {
var editMode = true;
var nodeLocked = false;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
assert.equal(result, false);
});
test('add mode upload validation active', function(assert) {
var editMode = false;
var nodeLocked = true;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
assert.equal(result, true);
});
test('add mode upload validation not active', function(assert) {
var editMode = false;
var nodeLocked = false;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
assert.equal(result, false);
});
| Add tests for upload-validation-active helper. | Add tests for upload-validation-active helper.
| JavaScript | apache-2.0 | caneruguz/ember-preprints,caneruguz/ember-preprints,laurenrevere/ember-preprints,CenterForOpenScience/ember-preprints,baylee-d/ember-preprints,laurenrevere/ember-preprints,baylee-d/ember-preprints,CenterForOpenScience/ember-preprints | ---
+++
@@ -4,11 +4,35 @@
module('Unit | Helper | upload validation active');
-// Replace this with your real tests.
-test('it works', function(assert) {
+test('edit mode upload validation active', function(assert) {
var editMode = true;
var nodeLocked = true;
var hasOpened = true;
let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
- assert.ok(result);
+ assert.equal(result, true);
});
+
+test('edit mode upload validation not active', function(assert) {
+ var editMode = true;
+ var nodeLocked = false;
+ var hasOpened = true;
+ let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
+ assert.equal(result, false);
+});
+
+test('add mode upload validation active', function(assert) {
+ var editMode = false;
+ var nodeLocked = true;
+ var hasOpened = true;
+ let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
+ assert.equal(result, true);
+});
+
+
+test('add mode upload validation not active', function(assert) {
+ var editMode = false;
+ var nodeLocked = false;
+ var hasOpened = true;
+ let result = uploadValidationActive([editMode, nodeLocked, hasOpened]);
+ assert.equal(result, false);
+}); |
d8a312185800fd7ee32f7a1bbe590cca63beb32e | lib/modules/apostrophe-search/public/js/always.js | lib/modules/apostrophe-search/public/js/always.js | $(function() {
$('body').on('click', '[data-apos-search-filter]', function() {
$(this).closest('form').submit();
});
$('body').on('keyup', '[data-apos-search-field]').keyup(function (e) {
if (e.keyCode == 13) {
$(this).closest('form').submit();
return false;
}
});
});
| $(function() {
$('body').on('click', '[data-apos-search-filter]', function() {
$(this).closest('form').submit();
});
$('body').on('keyup', '[data-apos-search-field]', function (e) {
if (e.keyCode == 13) {
$(this).closest('form').submit();
return false;
}
});
});
| Fix typo on a keyup handler that was causing chrome to throw errors on every key press | Fix typo on a keyup handler that was causing chrome to throw errors on every key press
| JavaScript | mit | punkave/apostrophe,punkave/apostrophe | ---
+++
@@ -2,7 +2,7 @@
$('body').on('click', '[data-apos-search-filter]', function() {
$(this).closest('form').submit();
});
- $('body').on('keyup', '[data-apos-search-field]').keyup(function (e) {
+ $('body').on('keyup', '[data-apos-search-field]', function (e) {
if (e.keyCode == 13) {
$(this).closest('form').submit();
return false; |
fbf1c83e2fce602a7c7d19ac78372309b6b86be7 | script.js | script.js | /**
* Script for AutoTabber
* Handles Tab Keypress
* @author MarcosBL <soy@marcosbl.com>
*/
/* DOKUWIKI:include taboverride.js */
/* DOKUWIKI:include taboverride.escape.js */
jQuery(window).load(function(){
var textareas = document.getElementsByTagName('textarea');
tabOverride.set(textareas).tabSize(0).autoIndent(true).escape(true);
});
| /**
* Script for AutoTabber
* Handles Tab Keypress
* @author MarcosBL <soy@marcosbl.com>
*/
/* DOKUWIKI:include taboverride.js */
/* DOKUWIKI:include taboverride.escape.js */
jQuery(window).on('load', function(){
var textareas = document.getElementsByTagName('textarea');
tabOverride.set(textareas).tabSize(0).autoIndent(true).escape(true);
});
| Fix exception for 'load' on jQuery 1.8 and above | Fix exception for 'load' on jQuery 1.8 and above
The 'load' event has been deprecated for a couple of years, and thus broke the plugin. | JavaScript | apache-2.0 | MarcosBL/dokuwiki-plugin-autotabber | ---
+++
@@ -7,7 +7,7 @@
/* DOKUWIKI:include taboverride.js */
/* DOKUWIKI:include taboverride.escape.js */
-jQuery(window).load(function(){
+jQuery(window).on('load', function(){
var textareas = document.getElementsByTagName('textarea');
tabOverride.set(textareas).tabSize(0).autoIndent(true).escape(true);
}); |
396a996b4c49e3230fea28590bcebeeb461b4622 | backend/app/assets/javascripts/spree/backend/translation.js | backend/app/assets/javascripts/spree/backend/translation.js | (function() {
// Resolves string keys with dots in a deeply nested object
// http://stackoverflow.com/a/22129960/4405214
var resolveObject = function(path, obj) {
return path
.split('.')
.reduce(function(prev, curr) {
return prev && prev[curr];
}, obj || self);
}
Spree.t = function(key, options) {
options = (options || {});
if(options.scope) {
key = options.scope + "." + key;
}
var translation = resolveObject(key, Spree.translations);
if (translation) {
return translation;
} else {
console.error("No translation found for " + key + ".");
return key;
}
}
Spree.human_attribute_name = function(model, attr) {
return Spree.t("activerecord.attributes." + model + '.' + attr);
}
})();
| (function() {
// Resolves string keys with dots in a deeply nested object
// http://stackoverflow.com/a/22129960/4405214
var resolveObject = function(path, obj) {
return path
.split('.')
.reduce(function(prev, curr) {
return prev && prev[curr];
}, obj || self);
}
Spree.t = function(key, options) {
options = (options || {});
if(options.scope) {
key = options.scope + "." + key;
}
var translation = resolveObject(key, Spree.translations);
if (translation) {
return translation;
} else {
console.warn("No translation found for " + key + ".");
return key;
}
}
Spree.human_attribute_name = function(model, attr) {
return Spree.t("activerecord.attributes." + model + '.' + attr);
}
})();
| Use console.warn instead of console.error | Use console.warn instead of console.error
| JavaScript | bsd-3-clause | pervino/solidus,pervino/solidus,pervino/solidus,pervino/solidus | ---
+++
@@ -18,7 +18,7 @@
if (translation) {
return translation;
} else {
- console.error("No translation found for " + key + ".");
+ console.warn("No translation found for " + key + ".");
return key;
}
} |
6034574f1299343c7df07cfbb65b889fd8b526fd | src/actions/appActions.js | src/actions/appActions.js | export function changeLocation(location) {
return {
type: 'CHANGE_LOCATION',
location
};
}
export function changeUnitType(unitType) {
return {
type: 'CHANGE_UNIT_TYPE',
unitType
};
}
export function setAlert({type, message}) {
return {
type: 'SET_ALERT',
alert: {
type,
message
}
};
}
export function setTooltip({x, y, contentElement, originTarget, title}) {
return {
type: 'SET_TOOLTIP',
tooltip: {
x,
y,
contentElement,
originTarget,
title
}
};
}
export function hideTooltip() {
return {
type: 'SET_TOOLTIP',
tooltip: {}
};
}
| export function changeLocation(location) {
return {
type: 'CHANGE_LOCATION',
location
};
}
export function changeUnitType(unitType) {
return {
type: 'CHANGE_UNIT_TYPE',
unitType
};
}
export function setAlert({type, message}) {
return {
type: 'SET_ALERT',
alert: {
type,
message
}
};
}
export function hideAlert() {
return {
type: 'SET_ALERT',
alert: {}
};
}
export function setTooltip({x, y, contentElement, originTarget, title}) {
return {
type: 'SET_TOOLTIP',
tooltip: {
x,
y,
contentElement,
originTarget,
title
}
};
}
export function hideTooltip() {
return {
type: 'SET_TOOLTIP',
tooltip: {}
};
}
| Add hide alert action creator | Add hide alert action creator
| JavaScript | mit | JavierPDev/Weather-D3,JavierPDev/Weather-D3 | ---
+++
@@ -22,6 +22,13 @@
};
}
+export function hideAlert() {
+ return {
+ type: 'SET_ALERT',
+ alert: {}
+ };
+}
+
export function setTooltip({x, y, contentElement, originTarget, title}) {
return {
type: 'SET_TOOLTIP', |
3ee7ed2698db579ec2d8b4cb6c6c4afc509993c2 | lib/core/abstract-component.js | lib/core/abstract-component.js | /** @babel */
import etch from 'etch'
import {CompositeDisposable} from 'atom'
export default class AbstractComponent {
constructor(properties, children, callback) {
if (properties) this.properties = properties
else this.properties = {}
if (children) this.children = children
else this.children = []
this.disposables = new CompositeDisposable()
if (callback) callback(this.properties, this.children)
etch.initialize(this)
}
update(properties, children, callback) {
if (properties && this.properties !== properties) this.properties = properties
if (children && this.children !== children) this.children = children
if (callback) callback(this.properties, this.children)
return etch.update(this)
}
destroy(callback) {
this.disposables.dispose()
if (callback) callback()
return etch.destroy(this)
}
}
| /** @babel */
import etch from 'etch'
import {Emitter, CompositeDisposable} from 'atom'
export default class AbstractComponent {
constructor(properties, children, callback) {
if (properties) this.properties = properties
else this.properties = {}
if (children) this.children = children
else this.children = []
this.disposables = new CompositeDisposable()
this.emitter = new Emitter()
if (callback) callback(this.properties, this.children)
etch.initialize(this)
}
update(properties, children, callback) {
if (properties && this.properties !== properties) this.properties = properties
if (children && this.children !== children) this.children = children
if (callback) callback(this.properties, this.children)
return etch.update(this)
}
destroy(callback) {
this.disposables.dispose()
this.emitter.dispose()
if (callback) callback()
return etch.destroy(this)
}
}
| Add an emitter to AbstractComponent | Add an emitter to AbstractComponent
| JavaScript | unlicense | berenm/xoreos-editor,berenm/game-data-explorer | ---
+++
@@ -2,7 +2,7 @@
import etch from 'etch'
-import {CompositeDisposable} from 'atom'
+import {Emitter, CompositeDisposable} from 'atom'
export default class AbstractComponent {
constructor(properties, children, callback) {
@@ -12,6 +12,7 @@
else this.children = []
this.disposables = new CompositeDisposable()
+ this.emitter = new Emitter()
if (callback) callback(this.properties, this.children)
etch.initialize(this)
}
@@ -25,6 +26,7 @@
destroy(callback) {
this.disposables.dispose()
+ this.emitter.dispose()
if (callback) callback()
return etch.destroy(this)
} |
12ed1dbfd2cfa2d9c5ef9dd93b1ede0e28c32fdf | bin/ballz-repl.js | bin/ballz-repl.js | #!/usr/bin/env node
/*!
* BALLZ repl module
*
* @author pfleidi
*/
var Readline = require('readline');
var Util = require('util');
var Parser = require('../lib/parser');
var Environment = require('../lib/environment');
var interpreter = require('../lib/interpreter').createInterpreter(
Environment.createEnvironment()
);
var repl = Readline.createInterface(process.stdin, process.stdout);
function exec(cmd) {
var ast = Parser.parse(cmd);
return Util.inspect(interpreter.eval(ast));
}
repl.setPrompt('ballz >');
repl.on('line', function (cmd) {
try {
console.log('==> ' + exec(cmd));
} catch (e) {
console.log(e.message);
console.log(e.stack);
}
repl.prompt();
});
repl.on('SIGINT', function () {
repl.close();
});
repl.on('close', function () {
console.log('goodbye!');
process.exit(0);
});
repl.prompt();
| #!/usr/bin/env node
/*!
* BALLZ repl module
*
* @author pfleidi
*/
var Readline = require('readline');
var Eyes = require('eyes');
var Parser = require('../lib/parser');
var Environment = require('../lib/environment');
var interpreter = require('../lib/interpreter').createInterpreter(
Environment.createEnvironment()
);
var repl = Readline.createInterface(process.stdin, process.stdout);
function exec(cmd) {
var ast = Parser.parse(cmd);
return Eyes.inspect(interpreter.eval(ast));
}
repl.setPrompt('ballz >');
repl.on('line', function (cmd) {
try {
console.log('==> ' + exec(cmd));
} catch (e) {
console.log(e.message);
console.log(e.stack);
}
repl.prompt();
});
repl.on('SIGINT', function () {
repl.close();
});
repl.on('close', function () {
console.log('goodbye!');
process.exit(0);
});
repl.prompt();
| Add colored output to repl | Add colored output to repl
| JavaScript | mit | pfleidi/ballz.js | ---
+++
@@ -7,7 +7,7 @@
*/
var Readline = require('readline');
-var Util = require('util');
+var Eyes = require('eyes');
var Parser = require('../lib/parser');
var Environment = require('../lib/environment');
@@ -19,7 +19,7 @@
function exec(cmd) {
var ast = Parser.parse(cmd);
- return Util.inspect(interpreter.eval(ast));
+ return Eyes.inspect(interpreter.eval(ast));
}
repl.setPrompt('ballz >'); |
d7e2221203de3f69a952ae02562d8e6556ae1087 | test/functional/cucumber/step_definitions/commonSteps.js | test/functional/cucumber/step_definitions/commonSteps.js | var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
disclaimer = element(by.css('div.disclaimer'));
this.Given(/^that I am at the HMDA homepage$/, function(next) {
browser.get('http://dev.hmda-pilot.ec2.devis.com/#/');
//Prevents 'are you sure you want to leave?' window from popping up
browser.executeScript('window.onbeforeunload = function(){};').then(function(){
next();
});
});
this.Then(/^I will see a disclaimer at the top$/, function (next) {
expect(disclaimer.isPresent()).to.eventually.be.true.notify(next);
});
};
| var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
disclaimer = element(by.css('div.disclaimer'));
this.Given(/^that I am at the HMDA homepage$/, function(next) {
passwordBox = element.all(by.id('txt-pwd'));
loginButton = element.all(by.css('.login-button'))
browser.get('http://dev.hmda-pilot.ec2.devis.com/#/');
//Prevents 'are you sure you want to leave?' window from popping up
browser.executeScript('window.onbeforeunload = function(){};').then(function(){
if(passwordBox.count() !== 0){
//Log in if we have not already done so
passwordBox.sendKeys('p1l0t');
loginButton.click();
}
});
next();
});
this.Then(/^I will see a disclaimer at the top$/, function (next) {
expect(disclaimer.isPresent()).to.eventually.be.true.notify(next);
});
};
| Set up tests to log in on first getting to the site | Set up tests to log in on first getting to the site
| JavaScript | cc0-1.0 | LinuxBozo/hmda-pilot,LinuxBozo/hmda-pilot,cfpb/hmda-pilot,cfpb/hmda-pilot,LinuxBozo/hmda-pilot,cfpb/hmda-pilot | ---
+++
@@ -9,11 +9,20 @@
disclaimer = element(by.css('div.disclaimer'));
this.Given(/^that I am at the HMDA homepage$/, function(next) {
+ passwordBox = element.all(by.id('txt-pwd'));
+ loginButton = element.all(by.css('.login-button'))
+
browser.get('http://dev.hmda-pilot.ec2.devis.com/#/');
+
//Prevents 'are you sure you want to leave?' window from popping up
browser.executeScript('window.onbeforeunload = function(){};').then(function(){
+ if(passwordBox.count() !== 0){
+ //Log in if we have not already done so
+ passwordBox.sendKeys('p1l0t');
+ loginButton.click();
+ }
+ });
next();
- });
});
this.Then(/^I will see a disclaimer at the top$/, function (next) { |
c596901ffce073b75635fe86000b5911e2d98cf7 | packages/app/source/client/controllers/layout-controller.js | packages/app/source/client/controllers/layout-controller.js | Space.Object.extend('Todos.LayoutController', {
mixin: [
Space.messaging.EventSubscribing
],
dependencies: {
layout: 'Layout',
_: 'underscore'
},
Constructor() {
this._currentLayout = null;
this._currentSections = {};
},
eventSubscriptions() {
return [{
'Todos.RouteTriggered': function(event) {
switch (event.routeName) {
//case 'routeName': this._routeHanlder(); break;
default: this._renderIndexPage();
}
}
}];
},
_renderIndexPage() {
this._render('index', {
input: 'input',
todo_list: 'todo_list',
footer: 'footer'
});
},
_render(layout, sections) {
this._currentLayout = layout;
this._.extend(this._currentSections, sections);
this.layout.render(this._currentLayout, this._currentSections);
},
_updateSections(sections) {
this._render(this._currentLayout, sections);
}
});
| Space.Object.extend('Todos.LayoutController', {
mixin: [
Space.messaging.EventSubscribing
],
dependencies: {
layout: 'Layout',
_: 'underscore'
},
_currentLayout: null,
_currentSections: {},
eventSubscriptions() {
return [{
'Todos.RouteTriggered': function(event) {
switch (event.routeName) {
//case 'routeName': this._routeHanlder(); break;
default: this._renderIndexPage();
}
}
}];
},
_renderIndexPage() {
this._render('index', {
input: 'input',
todo_list: 'todo_list',
footer: 'footer'
});
},
_render(layout, sections) {
this._currentLayout = layout;
this._.extend(this._currentSections, sections);
this.layout.render(this._currentLayout, this._currentSections);
},
_updateSections(sections) {
this._render(this._currentLayout, sections);
}
});
| Refactor layout controllers layout attributes to static members | Refactor layout controllers layout attributes to static members
| JavaScript | mit | meteor-space/todos,meteor-space/todos,meteor-space/todos | ---
+++
@@ -9,10 +9,9 @@
_: 'underscore'
},
- Constructor() {
- this._currentLayout = null;
- this._currentSections = {};
- },
+ _currentLayout: null,
+
+ _currentSections: {},
eventSubscriptions() {
return [{ |
6b3ad70d9bd6c0559adc067fc432174689e3012b | angular-web-applications/src/scripts/app.js | angular-web-applications/src/scripts/app.js | (function () {
// Set to true to show console.log for debugging
var DEBUG_MODE = true;
'use strict';
var Slide = function (title) {
// Constructor
this.title = title;
this.eleRef = null;
};
Slide.prototype.SetReference = function (dom) {
this.eleRef = dom;
};
Slide.prototype.MoveLeft = function () {};
Slide.prototype.MoveRight = function () {};
Slide.prototype.TransitionLeft = function () {};
Slide.prototype.TransitionRight = function () {};
/////////////////
/// APP START ///
/////////////////
var slides = [];
var currentSlideIdx = 0;
/**
* Initialize App
*/
function Initialize() {
GetSlides();
}
/**
* Get slide DOM reference
*/
function GetSlides() {
var slidesDOM = document.getElementsByClassName('slide');
setTimeout(function () {
for (var i = 0, limit = slidesDOM.length; i < limit; ++i) {
var newSlide = new Slide(slidesDOM[i].dataset.title);
newSlide.SetReference(slidesDOM[i]);
slides.push(newSlide);
}
}, 0);
}
Initialize();
}()); | (function () {
// Set to true to show console.log for debugging
var DEBUG_MODE = true;
'use strict';
var Slide = function (title) {
// Constructor
this.title = title;
this.eleRef = null;
};
Slide.prototype.SetReference = function (dom) {
this.eleRef = dom;
};
Slide.prototype.MoveLeft = function () {};
Slide.prototype.MoveRight = function () {};
Slide.prototype.TransitionLeft = function () {};
Slide.prototype.TransitionRight = function () {};
/////////////////
/// APP START ///
/////////////////
var slides = [];
var currentSlideIdx = 0;
/**
* Initialize App
*/
function Initialize() {
GetSlides();
}
/**
* Get slide DOM reference
*/
function GetSlides() {
var slidesDOM = document.getElementsByClassName('slide');
setTimeout(function () {
for (var i = 0, limit = slidesDOM.length; i < limit; ++i) {
// Set z-index for each slide
slidesDOM[i].style.zIndex = 10 + i;
var newSlide = new Slide(slidesDOM[i].dataset.title);
newSlide.SetReference(slidesDOM[i]);
slides.push(newSlide);
}
}, 0);
}
Initialize();
}()); | Set each slide to have it's own z-index. | Set each slide to have it's own z-index.
| JavaScript | mit | renesansz/presentations,renesansz/presentations | ---
+++
@@ -49,6 +49,9 @@
for (var i = 0, limit = slidesDOM.length; i < limit; ++i) {
+ // Set z-index for each slide
+ slidesDOM[i].style.zIndex = 10 + i;
+
var newSlide = new Slide(slidesDOM[i].dataset.title);
newSlide.SetReference(slidesDOM[i]);
|
8e23e794a17df6638f060284b272d6b99691f269 | src/App/Body/Display/Summary/SummaryBody/summaryFunctions/isEnterprise.js | src/App/Body/Display/Summary/SummaryBody/summaryFunctions/isEnterprise.js | import { withName } from './shared';
import { FEATURES } from 'data/columns';
export default function isEnterprise(modules) {
const serverModule = modules.find(withName('SERVER'));
const hasFeatures = /[CDEFSW]/.test(serverModule[FEATURES]);
const hasModules = ['WSINPUT', 'WSOUTPUT', 'ECOPY'].some(name => (
modules.some(withName(name))
));
return hasFeatures || hasModules;
}
| import { withName } from './shared';
export default function isEnterprise(modules) {
const hasModules = ['WSINPUT', 'WSOUTPUT', 'ECOPY'].some(name => (
modules.some(withName(name))
));
return hasModules;
}
| Stop checking server features to determine enterprise vs. standard | Stop checking server features to determine enterprise vs. standard
| JavaScript | cc0-1.0 | ksmithbaylor/emc-license-summarizer,ksmithbaylor/emc-license-summarizer,ksmithbaylor/emc-license-summarizer | ---
+++
@@ -1,13 +1,9 @@
import { withName } from './shared';
-import { FEATURES } from 'data/columns';
export default function isEnterprise(modules) {
- const serverModule = modules.find(withName('SERVER'));
-
- const hasFeatures = /[CDEFSW]/.test(serverModule[FEATURES]);
const hasModules = ['WSINPUT', 'WSOUTPUT', 'ECOPY'].some(name => (
modules.some(withName(name))
));
- return hasFeatures || hasModules;
+ return hasModules;
} |
5cf04bb912fc64d119a5c0c2693e9e2fa0823e4f | src/geom/Vector2.js | src/geom/Vector2.js | export default class Vector2 {
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
add(vec2) {
this.x = vec2.x;
this.y = vec2.y;
return this;
}
subtract(vec2) {
this.x -= vec2.x;
this.y -= vec2.y;
return this;
}
multiply(vec2) {
this.x *= vec2.x;
this.y *= vec2.y;
return this;
}
divide(vec2) {
this.x /= vec2.x;
this.y /= vec2.y;
return this;
}
angle(vec2) {
return Math.atan2(vec2.y - this.y, vec2.x - this.x);
}
distance(vec2) {
return Math.sqrt(Math.pow(vec2.x - this.x, 2) + Math.pow(vec2.y - this.y, 2));
}
distanceSq(vec2) {
return Math.pow(vec2.x - this.x, 2) + Math.pow(vec2.y - this.y, 2);
}
clone() {
return new Vector2(this.x, this.y);
}
} | export default class Vector2 {
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
add(vec2) {
this.x = vec2.x;
this.y = vec2.y;
return this;
}
subtract(vec2) {
this.x -= vec2.x;
this.y -= vec2.y;
return this;
}
multiplyVector(vec2) {
this.x *= vec2.x;
this.y *= vec2.y;
return this;
}
multiplyScalar(scalar) {
this.x *= scalar;
this.y *= scalar;
return this;
}
divideVector(vec2) {
this.x /= vec2.x;
this.y /= vec2.y;
return this;
}
divideScalar(scalar) {
this.x /= scalar;
this.y /= scalar;
return this;
}
angle(vec2) {
return Math.atan2(vec2.y - this.y, vec2.x - this.x);
}
distance(vec2) {
return Math.sqrt(Math.pow(vec2.x - this.x, 2) + Math.pow(vec2.y - this.y, 2));
}
distanceSq(vec2) {
return Math.pow(vec2.x - this.x, 2) + Math.pow(vec2.y - this.y, 2);
}
clone() {
return new Vector2(this.x, this.y);
}
} | Implement scalar/vector multiply and divide | Implement scalar/vector multiply and divide
| JavaScript | mit | lucidfext/light2d-es6 | ---
+++
@@ -23,15 +23,27 @@
return this;
}
- multiply(vec2) {
+ multiplyVector(vec2) {
this.x *= vec2.x;
this.y *= vec2.y;
return this;
}
- divide(vec2) {
+ multiplyScalar(scalar) {
+ this.x *= scalar;
+ this.y *= scalar;
+ return this;
+ }
+
+ divideVector(vec2) {
this.x /= vec2.x;
this.y /= vec2.y;
+ return this;
+ }
+
+ divideScalar(scalar) {
+ this.x /= scalar;
+ this.y /= scalar;
return this;
}
|
2c067908d8fae5425e2568c43f0501021caf172b | src/components/Nav/Nav.js | src/components/Nav/Nav.js | import React from 'react';
import classnames from 'classnames';
import { GridContainer, GridRow, GridCol } from '../Grid';
const Nav = props => (
<div
className={classnames('ui-nav', {
'ui-nav-fixed': props.fixed,
'ui-nav-inverse': props.inverse,
})}
>
<GridContainer fluid>
<GridRow>
<GridCol>
<div className={classnames('ui-nav-navitems')}>
{props.children}
</div>
</GridCol>
</GridRow>
</GridContainer>
</div>
);
Nav.propTypes = {
fixed: React.PropTypes.bool.isRequired,
inverse: React.PropTypes.bool.isRequired,
children: React.PropTypes.node,
};
Nav.defaultProps = {
fixed: false,
inverse: false,
};
export default Nav;
| import React from 'react';
import classnames from 'classnames';
function Nav({ inverse, children, fixed, prefix }) {
const className = classnames('ui-nav', {
'ui-nav-fixed': fixed,
'ui-nav-inverse': inverse,
});
return (
<div className={className}>
{prefix && <div className="ui-nav-prefix">{prefix}</div>}
<div className={classnames('ui-nav-navitems')}>
{children}
</div>
</div>
);
}
Nav.propTypes = {
fixed: React.PropTypes.bool.isRequired,
inverse: React.PropTypes.bool.isRequired,
children: React.PropTypes.node,
prefix: React.PropTypes.node,
};
Nav.defaultProps = {
fixed: false,
inverse: false,
prefix: null,
children: null,
};
export default Nav;
| Enhance nav component and introduce prefix prop | Enhance nav component and introduce prefix prop
| JavaScript | mit | wundery/wundery-ui-react,wundery/wundery-ui-react | ---
+++
@@ -1,36 +1,35 @@
import React from 'react';
import classnames from 'classnames';
-import { GridContainer, GridRow, GridCol } from '../Grid';
-const Nav = props => (
- <div
- className={classnames('ui-nav', {
- 'ui-nav-fixed': props.fixed,
- 'ui-nav-inverse': props.inverse,
- })}
- >
- <GridContainer fluid>
- <GridRow>
- <GridCol>
- <div className={classnames('ui-nav-navitems')}>
- {props.children}
- </div>
- </GridCol>
- </GridRow>
- </GridContainer>
- </div>
-);
+function Nav({ inverse, children, fixed, prefix }) {
+ const className = classnames('ui-nav', {
+ 'ui-nav-fixed': fixed,
+ 'ui-nav-inverse': inverse,
+ });
+
+ return (
+ <div className={className}>
+ {prefix && <div className="ui-nav-prefix">{prefix}</div>}
+ <div className={classnames('ui-nav-navitems')}>
+ {children}
+ </div>
+ </div>
+ );
+}
Nav.propTypes = {
fixed: React.PropTypes.bool.isRequired,
inverse: React.PropTypes.bool.isRequired,
children: React.PropTypes.node,
+ prefix: React.PropTypes.node,
};
Nav.defaultProps = {
fixed: false,
inverse: false,
+ prefix: null,
+ children: null,
};
export default Nav; |
7d162867c86ae3c2952b167245898d78ee0f1468 | server.js | server.js | var express = require('express');
var app = express();
var config = require('./config');
var bodyParser = require('body-parser');
var morgan = require('morgan')
var mongoose = require('mongoose');
var Recording = require('./models/measurement');
var Station = require('./models/station');
var measurements = require('./routes/measurements');
var stations = require('./routes/stations');
mongoose.connect(config.mongodb.url);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(morgan('combined'))
var router = express.Router();
router.get('/wrm.aspx', measurements.saveMeasurement);
router.get('/measurements', measurements.allMeasurements)
router.get('/stations', stations.findAllStations);
router.get('/stations/:stationId', stations.findOneStation);
router.post('/stations', stations.saveStation);
app.use('', router);
app.listen(3000);
console.log('Listening on port 3000...'); | var express = require('express');
var app = express();
var config = require('./config');
var bodyParser = require('body-parser');
var morgan = require('morgan')
var mongoose = require('mongoose');
var Recording = require('./models/measurement');
var Station = require('./models/station');
var measurements = require('./routes/measurements');
var stations = require('./routes/stations');
mongoose.connect(config.mongodb.url);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(morgan('combined'))
var router = express.Router();
router.get('/wrm.aspx', measurements.saveMeasurement);
router.post('/v2/measurements', measurements.saveMeasurement);
router.get('/v2/measurements', measurements.allMeasurements)
router.get('/v2/stations', stations.findAllStations);
router.get('/v2/stations/:stationId', stations.findOneStation);
router.post('/v2/stations', stations.saveStation);
app.use('', router);
app.listen(8000);
console.log('Listening on port 8000...');
| Change URLs so they can live aside eachother. | Change URLs so they can live aside eachother.
Exception: /wrm.aspx for saving... | JavaScript | apache-2.0 | vindsiden/vindsiden-server | ---
+++
@@ -21,13 +21,14 @@
var router = express.Router();
router.get('/wrm.aspx', measurements.saveMeasurement);
-router.get('/measurements', measurements.allMeasurements)
+router.post('/v2/measurements', measurements.saveMeasurement);
+router.get('/v2/measurements', measurements.allMeasurements)
-router.get('/stations', stations.findAllStations);
-router.get('/stations/:stationId', stations.findOneStation);
-router.post('/stations', stations.saveStation);
+router.get('/v2/stations', stations.findAllStations);
+router.get('/v2/stations/:stationId', stations.findOneStation);
+router.post('/v2/stations', stations.saveStation);
app.use('', router);
-app.listen(3000);
-console.log('Listening on port 3000...');
+app.listen(8000);
+console.log('Listening on port 8000...'); |
0f077bd8eaf30107a691b60c9500fe0c71d0dad0 | src/docs/ComponentPage.js | src/docs/ComponentPage.js | import React from 'react';
import PropTypes from 'prop-types';
import Example from './Example';
import Props from './Props';
const ComponentPage = ({component}) => {
const {name, description, props, examples} = component;
return (
<div className="componentpage">
<h2>{name}</h2>
<p>{description}</p>
<h3>Example{examples.length > 1 && "s"}</h3>
{
examples.length > 0 ?
examples.map( example => <Example key={example.name} example={example} componentName={name} /> ) :
"No examples exist."
}
<h3>Props</h3>
{
props ?
<Props props={props} /> :
"This component accepts no props."
}
</div>
)
};
ComponentPage.propTypes = {
component: PropTypes.object.isRequired
};
export default ComponentPage;
| import React from 'react';
import PropTypes from 'prop-types';
import Example from './Example';
import Props from './Props';
const ComponentPage = ({component}) => {
const {name, description, props, examples} = component;
return (
<div className="componentpage">
<h2>{name}</h2>
<p>{description}</p>
<h3>Example{examples.length > 1 && "s"}</h3>
{
examples.length > 0 ?
examples.map( example => <Example key={example.code} example={example} componentName={name} /> ) :
"No examples exist."
}
<h3>Props</h3>
{
props ?
<Props props={props} /> :
"This component accepts no props."
}
</div>
)
};
ComponentPage.propTypes = {
component: PropTypes.object.isRequired
};
export default ComponentPage;
| Switch to a truly unique key | Switch to a truly unique key
| JavaScript | mit | coryhouse/ps-react,coryhouse/ps-react | ---
+++
@@ -14,7 +14,7 @@
<h3>Example{examples.length > 1 && "s"}</h3>
{
examples.length > 0 ?
- examples.map( example => <Example key={example.name} example={example} componentName={name} /> ) :
+ examples.map( example => <Example key={example.code} example={example} componentName={name} /> ) :
"No examples exist."
}
|
9bc6041852edacb2eb85bf31b5aa5a2e0a67dc28 | server/trello-microservice/src/utils/passportMiddleweare.js | server/trello-microservice/src/utils/passportMiddleweare.js | import fetch from 'node-fetch';
import { userModel } from '../models/index';
export const authenticatedWithToken = (req, res, next) => {
let csrf;
let jwt;
if (req && req.cookies && req.headers){
csrf = req.headers.csrf;
jwt = req.cookies.jwt;
const opts = {
headers: {
csrf,
jwt
}
};
fetch('http://localhost:3002/signcheck', opts)
.then(res => {
if (res.status === 401) {
return null;
}
return res.json();
})
.then(user => {
if (!user) {
return next();
} else {
return userModel.findOne({name: user.name})
.then(user => {
req.user = user;
return next();
});
}
})
}
}; | import fetch from 'node-fetch';
import { userModel } from '../models/index';
export const authenticatedWithToken = async (req, res, next) => {
if (req && req.cookies && req.cookies.jwt && req.headers && req.headers.csrf) {
let csrf = req.headers.csrf;
let jwt = req.cookies.jwt;
const opts = {
headers: {
csrf,
jwt
}
};
let res = await fetch('http://localhost:3002/signcheck', opts);
if (res.status === 401) {
return null;
}
let resJson = await res.json();
if (!resJson) {
next();
} else {
try {
let user = await userModel.findOne({name: resJson.name}).exec();
if (user) {
req.user = user;
next();
}
} catch (error) {
console.log(error)
}
}
} else {
req.err = 'Either the cookie or the token is missing';
next();
}
}; | Replace promise with async await and handle error cases | Replace promise with async await and handle error cases
| JavaScript | mit | Madmous/madClones,Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone,Madmous/Trello-Clone,Madmous/madClones,Madmous/Trello-Clone | ---
+++
@@ -2,13 +2,10 @@
import { userModel } from '../models/index';
-export const authenticatedWithToken = (req, res, next) => {
- let csrf;
- let jwt;
-
- if (req && req.cookies && req.headers){
- csrf = req.headers.csrf;
- jwt = req.cookies.jwt;
+export const authenticatedWithToken = async (req, res, next) => {
+ if (req && req.cookies && req.cookies.jwt && req.headers && req.headers.csrf) {
+ let csrf = req.headers.csrf;
+ let jwt = req.cookies.jwt;
const opts = {
headers: {
@@ -17,25 +14,31 @@
}
};
- fetch('http://localhost:3002/signcheck', opts)
- .then(res => {
- if (res.status === 401) {
- return null;
+ let res = await fetch('http://localhost:3002/signcheck', opts);
+
+ if (res.status === 401) {
+ return null;
+ }
+
+ let resJson = await res.json();
+
+ if (!resJson) {
+ next();
+ } else {
+ try {
+ let user = await userModel.findOne({name: resJson.name}).exec();
+
+ if (user) {
+ req.user = user;
+ next();
}
+ } catch (error) {
+ console.log(error)
+ }
+ }
+ } else {
+ req.err = 'Either the cookie or the token is missing';
- return res.json();
- })
- .then(user => {
- if (!user) {
- return next();
- } else {
- return userModel.findOne({name: user.name})
- .then(user => {
- req.user = user;
-
- return next();
- });
- }
- })
+ next();
}
}; |
46924430441a011b105a6874f72061ddd2c9fe02 | spec/readFile.spec.js | spec/readFile.spec.js | var path = require('path'),
fs = require('fs'),
crypto = require('crypto');
describe("readFile functionality", function() {
var _this = this;
require('./harness.js')(_this);
it("creates a directory", function(done) {
var fname = "testDir";
var resolved = path.resolve(_this.tempdir, fname);
crypto.pseudoRandomBytes(128 * 1024, function(err, data) {
if (err) throw err;
fs.writeFile(resolved, data, function(err) {
if (err) throw err;
_this.wd.readFile(fname, function(err, rdata) {
expect(err).toBe(null);
expect(rdata.toString()).toBe(data.toString());
done();
});
});
});
});
}); | var path = require('path'),
fs = require('fs'),
crypto = require('crypto');
describe("readFile functionality", function() {
var _this = this;
require('./harness.js')(_this);
it("reads a file", function(done) {
var fname = "testDir";
var resolved = path.resolve(_this.tempdir, fname);
crypto.pseudoRandomBytes(128 * 1024, function(err, data) {
if (err) throw err;
fs.writeFile(resolved, data, function(err) {
if (err) throw err;
_this.wd.readFile(fname, function(err, rdata) {
expect(err).toBe(null);
expect(rdata.toString()).toBe(data.toString());
done();
});
});
});
});
}); | Fix name of readFile test | Fix name of readFile test
| JavaScript | bsd-2-clause | terribleplan/WorkingDirectory | ---
+++
@@ -5,7 +5,7 @@
describe("readFile functionality", function() {
var _this = this;
require('./harness.js')(_this);
- it("creates a directory", function(done) {
+ it("reads a file", function(done) {
var fname = "testDir";
var resolved = path.resolve(_this.tempdir, fname);
crypto.pseudoRandomBytes(128 * 1024, function(err, data) { |
d0b0423b2d4ef343d09bb27063d8b8162fb7d466 | day10/10.js | day10/10.js | // look for groups of matching characters
// pass each group to say() and concatenate returns
var look = function(lookString) {
var i = 0;
var j = 1;
var sayString = '';
while (i < lookString.length) {
while (lookString[i] === lookString[j]) {
j++;
}
sayString += say(lookString.slice(i,j));
i += (j - i);
}
return sayString;
}
// convert a group of matching characters to
// the replacement sequence
var say = function(group) {
var output = 0;
return '' + group.length + group[0];
}
// run look-and-say on a given input n times and
// print the result's length to the console.
var lookAndSay = function(input, n) {
var lastString = input;
for (var i = 0; i < n; i++) {
lastString = look(lastString);
}
console.log(lastString.length);
}
lookAndSay('1321131112', 50);
| // Look for groups of matching characters.
// Map the conversion function to each.
// Join & return the new string.
var convert = function(input) {
var groups = input.match(/(\d)\1*/g);
return groups.map(s => s.length + s[0]).join('');
}
// run look-and-say on a given input n times and
// print the result's length to the console.
var lookAndSay = function(input, n) {
var lastString = input;
while (n) {
lastString = convert(lastString);
n--;
}
console.log(lastString.length);
}
lookAndSay('1321131112', 50);
| Refactor solution to use regex and map | Refactor solution to use regex and map
| JavaScript | mit | ptmccarthy/advent-of-code | ---
+++
@@ -1,34 +1,19 @@
-// look for groups of matching characters
-// pass each group to say() and concatenate returns
-var look = function(lookString) {
- var i = 0;
- var j = 1;
- var sayString = '';
-
- while (i < lookString.length) {
- while (lookString[i] === lookString[j]) {
- j++;
- }
- sayString += say(lookString.slice(i,j));
- i += (j - i);
- }
-
- return sayString;
-}
-
-// convert a group of matching characters to
-// the replacement sequence
-var say = function(group) {
- var output = 0;
- return '' + group.length + group[0];
+// Look for groups of matching characters.
+// Map the conversion function to each.
+// Join & return the new string.
+var convert = function(input) {
+ var groups = input.match(/(\d)\1*/g);
+ return groups.map(s => s.length + s[0]).join('');
}
// run look-and-say on a given input n times and
// print the result's length to the console.
var lookAndSay = function(input, n) {
var lastString = input;
- for (var i = 0; i < n; i++) {
- lastString = look(lastString);
+
+ while (n) {
+ lastString = convert(lastString);
+ n--;
}
console.log(lastString.length); |
f1edda2564b4ee70bbd151ed79b26991d575e4e4 | src/ErrorReporting.js | src/ErrorReporting.js | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Snackbar from 'material-ui/Snackbar';
import { red900, grey50 } from 'material-ui/styles/colors';
class ErrorReporting extends Component {
static defaultProps = {
open: false,
action: '',
error: null,
autoHideDuration: 10000,
getMessage: (props) => props.error ? props.action + ': ' + props.error.toString() : '',
style: {
backgroundColor: red900,
color: grey50
}
}
render() {
return (
<Snackbar
open={this.props.open}
message={this.props.getMessage(this.props)}
autoHideDuration={this.props.autoHideDuration}
style={this.props.style}
contentStyle={this.props.style}
bodyStyle={this.props.style}
/>
);
}
}
function mapStoreToProps(state) {
const { action, error } = state.errors;
return {
open: error !== null,
action: action,
error: error
};
}
export default connect(mapStoreToProps)(ErrorReporting);
| import React, { Component } from 'react';
import { connect } from 'react-redux';
import Snackbar from 'material-ui/Snackbar';
import { red900, grey50 } from 'material-ui/styles/colors';
class ErrorReporting extends Component {
static defaultProps = {
open: false,
action: '',
error: null,
autoHideDuration: 10000,
getMessage: (props) => props.error ? props.action + ': ' + props.error.toString() : '',
style: {
backgroundColor: red900,
color: grey50
},
contentStyle: {
display: 'block',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden'
}
}
exclusiveProps = [
'getMessage',
'error',
'action'
]
getSnackbarProps() {
return Object
.keys(this.props)
.filter(
(name) => this.exclusiveProps.indexOf(name) === -1
)
.reduce(
(acc, name) => {
acc[name] = this.props[name];
return acc;
},
{}
);
}
render() {
return (
<Snackbar
open={this.props.open}
message={this.props.getMessage(this.props)}
autoHideDuration={this.props.autoHideDuration}
style={this.props.style}
contentStyle={this.props.style}
bodyStyle={this.props.style}
{...this.getSnackbarProps()}
/>
);
}
}
function mapStoreToProps(state) {
const { action, error } = state.errors;
return {
open: error !== null,
action: action,
error: error
};
}
export default connect(mapStoreToProps)(ErrorReporting);
| Set default contentStyle prop to make message more readable | Set default contentStyle prop to make message more readable
| JavaScript | mit | corpix/material-ui-error-reporting,corpix/material-ui-error-reporting | ---
+++
@@ -15,7 +15,34 @@
style: {
backgroundColor: red900,
color: grey50
+ },
+ contentStyle: {
+ display: 'block',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ overflow: 'hidden'
}
+ }
+
+ exclusiveProps = [
+ 'getMessage',
+ 'error',
+ 'action'
+ ]
+
+ getSnackbarProps() {
+ return Object
+ .keys(this.props)
+ .filter(
+ (name) => this.exclusiveProps.indexOf(name) === -1
+ )
+ .reduce(
+ (acc, name) => {
+ acc[name] = this.props[name];
+ return acc;
+ },
+ {}
+ );
}
render() {
@@ -27,6 +54,7 @@
style={this.props.style}
contentStyle={this.props.style}
bodyStyle={this.props.style}
+ {...this.getSnackbarProps()}
/>
);
} |
22ffe9c0158a27314ae24163592752d392ec3b7c | tests/e2e/utils/setup-site-kit.js | tests/e2e/utils/setup-site-kit.js | /**
* setupSiteKit utility.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* WordPress dependencies
*/
import { activatePlugin } from '@wordpress/e2e-test-utils';
/**
* Internal depedencies
*/
import {
setSiteVerification,
setSearchConsoleProperty,
} from '.';
export const setupSiteKit = async ( { verified, property } = {} ) => {
await activatePlugin( 'e2e-tests-auth-plugin' );
await setSiteVerification( verified );
await setSearchConsoleProperty( property );
};
| /**
* setupSiteKit utility.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* WordPress dependencies
*/
import { activatePlugin } from '@wordpress/e2e-test-utils';
/**
* Internal depedencies
*/
import {
setSiteVerification,
setSearchConsoleProperty,
} from '.';
export const setupSiteKit = async ( { verified, property, auth = 'proxy' } = {} ) => {
if ( auth !== 'proxy' && auth !== 'gcp' ) {
throw new Error( 'Auth type must be either proxy or gcp' );
}
await activatePlugin( `e2e-tests-${ auth }-auth-plugin` );
await setSiteVerification( verified );
await setSearchConsoleProperty( property );
};
| Update helper to set auth type. | Update helper to set auth type.
| JavaScript | apache-2.0 | google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp | ---
+++
@@ -29,8 +29,11 @@
setSearchConsoleProperty,
} from '.';
-export const setupSiteKit = async ( { verified, property } = {} ) => {
- await activatePlugin( 'e2e-tests-auth-plugin' );
+export const setupSiteKit = async ( { verified, property, auth = 'proxy' } = {} ) => {
+ if ( auth !== 'proxy' && auth !== 'gcp' ) {
+ throw new Error( 'Auth type must be either proxy or gcp' );
+ }
+ await activatePlugin( `e2e-tests-${ auth }-auth-plugin` );
await setSiteVerification( verified );
await setSearchConsoleProperty( property );
}; |
cae745eee63931ce361e1f235c6c135ec973f8cb | src/Presenters/Controls/Text/TextBox/TextBoxViewBridge.js | src/Presenters/Controls/Text/TextBox/TextBoxViewBridge.js | var bridge = function (presenterPath) {
window.rhubarb.viewBridgeClasses.HtmlViewBridge.apply(this, arguments);
};
bridge.prototype = new window.rhubarb.viewBridgeClasses.HtmlViewBridge();
bridge.prototype.constructor = bridge;
bridge.spawn = function (spawnData, index, parentPresenterPath) {
var textBox = document.createElement("INPUT");
textBox.setAttribute("type", spawnData.type);
textBox.setAttribute("size", spawnData.size);
if (spawnData.maxLength) {
textBox.setAttribute("maxlength", spawnData.maxLength);
}
window.rhubarb.viewBridgeClasses.HtmlViewBridge.applyStandardAttributesToSpawnedElement(textBox, spawnData, index, parentPresenterPath);
return textBox;
};
bridge.prototype.onKeyPress = function(event){
if (this.onKeyPress){
this.onKeyPress(event);
}
};
bridge.prototype.attachDomChangeEventHandler = function (triggerChangeEvent) {
window.rhubarb.viewBridgeClasses.HtmlViewBridge.prototype.attachDomChangeEventHandler.apply(this,arguments);
var self = this;
if (!this.viewNode.addEventListener) {
this.viewNode.attachEvent("onkeypress", self.onKeyPress.bind(self));
}
else {
// Be interested in a changed event if there is one.
this.viewNode.addEventListener('keypress', self.onKeyPress.bind(self), false);
}
};
window.rhubarb.viewBridgeClasses.TextBoxViewBridge = bridge; | var bridge = function (presenterPath) {
window.rhubarb.viewBridgeClasses.HtmlViewBridge.apply(this, arguments);
};
bridge.prototype = new window.rhubarb.viewBridgeClasses.HtmlViewBridge();
bridge.prototype.constructor = bridge;
bridge.spawn = function (spawnData, index, parentPresenterPath) {
var textBox = document.createElement("INPUT");
textBox.setAttribute("type", spawnData.type);
textBox.setAttribute("size", spawnData.size);
if (spawnData.maxLength) {
textBox.setAttribute("maxlength", spawnData.maxLength);
}
window.rhubarb.viewBridgeClasses.HtmlViewBridge.applyStandardAttributesToSpawnedElement(textBox, spawnData, index, parentPresenterPath);
return textBox;
};
bridge.prototype.keyPressed = function(event){
if (this.onKeyPress){
this.onKeyPress(event);
}
};
bridge.prototype.attachDomChangeEventHandler = function (triggerChangeEvent) {
window.rhubarb.viewBridgeClasses.HtmlViewBridge.prototype.attachDomChangeEventHandler.apply(this,arguments);
var self = this;
if (!this.viewNode.addEventListener) {
this.viewNode.attachEvent("onkeypress", self.keyPressed.bind(self));
}
else {
// Be interested in a changed event if there is one.
this.viewNode.addEventListener('keypress', self.keyPressed.bind(self), false);
}
};
window.rhubarb.viewBridgeClasses.TextBoxViewBridge = bridge; | Fix for textbox view bridge causing recursion | Fix for textbox view bridge causing recursion
| JavaScript | apache-2.0 | RhubarbPHP/Module.Leaf,RhubarbPHP/Module.Leaf | ---
+++
@@ -18,7 +18,7 @@
return textBox;
};
-bridge.prototype.onKeyPress = function(event){
+bridge.prototype.keyPressed = function(event){
if (this.onKeyPress){
this.onKeyPress(event);
}
@@ -30,11 +30,11 @@
var self = this;
if (!this.viewNode.addEventListener) {
- this.viewNode.attachEvent("onkeypress", self.onKeyPress.bind(self));
+ this.viewNode.attachEvent("onkeypress", self.keyPressed.bind(self));
}
else {
// Be interested in a changed event if there is one.
- this.viewNode.addEventListener('keypress', self.onKeyPress.bind(self), false);
+ this.viewNode.addEventListener('keypress', self.keyPressed.bind(self), false);
}
};
|
a74850c23873f3f6ac4033e1632262d43bf56689 | server/configuration/environment_configuration.js | server/configuration/environment_configuration.js | "use strict";
var config = require("12factor-config");
var appConfig = config({
apiUrl: {
env: "AGFAPHD_WEBAPP_API_URL",
type: "string",
default: "http://localhost:8089"
},
emailApiKey: {
env: "AGFAPHD_WEBAPP_EMAIL_API_KEY",
type: "string",
required: true
},
emailApiUrl: {
env: "AGFAPHD_WEBAPP_EMAIL_API_URL",
type: "string",
default: "sandboxa92275a42f30470c860fda4a09140bf6.mailgun.org"
},
emailFrom: {
env: "AGFAPHD_WEBAPP_EMAIL_FROM",
type: "string",
default: "Debt Sentry <sentry@agoodfriendalwayspayshisdebts.com>"
},
revisionMapPath: {
env: "AGFAPHD_WEBAPP_REVISION_MAP_PATH",
type: "string",
default: "../public/default_map.json"
},
serverPort: {
env: "PORT",
type: "integer",
default: 5000
}
});
module.exports = appConfig; | "use strict";
var config = require("12factor-config");
var appConfig = config({
apiUrl: {
env: "AGFAPHD_WEBAPP_API_URL",
type: "string",
default: "http://localhost:8089"
},
emailApiKey: {
env: "AGFAPHD_WEBAPP_EMAIL_API_KEY",
type: "string",
required: true
},
emailApiUrl: {
env: "AGFAPHD_WEBAPP_EMAIL_API_URL",
type: "string",
required: true
},
emailFrom: {
env: "AGFAPHD_WEBAPP_EMAIL_FROM",
type: "string",
default: "Debt Sentry <sentry@agoodfriendalwayspayshisdebts.com>"
},
revisionMapPath: {
env: "AGFAPHD_WEBAPP_REVISION_MAP_PATH",
type: "string",
default: "../public/default_map.json"
},
serverPort: {
env: "PORT",
type: "integer",
default: 5000
}
});
module.exports = appConfig; | Add email api url requirement | Add email api url requirement
| JavaScript | mit | agoodfriendalwayspayshisdebts/agoodfriendalwayspayshisdebts-webapp,Yuyuu/agoodfriendalwayspayshisdebts-webapp,Yuyuu/agoodfriendalwayspayshisdebts-webapp,agoodfriendalwayspayshisdebts/agoodfriendalwayspayshisdebts-webapp,agoodfriendalwayspayshisdebts/agoodfriendalwayspayshisdebts-webapp,Yuyuu/agoodfriendalwayspayshisdebts-webapp | ---
+++
@@ -16,7 +16,7 @@
emailApiUrl: {
env: "AGFAPHD_WEBAPP_EMAIL_API_URL",
type: "string",
- default: "sandboxa92275a42f30470c860fda4a09140bf6.mailgun.org"
+ required: true
},
emailFrom: {
env: "AGFAPHD_WEBAPP_EMAIL_FROM", |
0a6844c2d9ac4c4c67cee668f25db1ce742a8951 | packages/plugin-avatar/test/unit/spec/avatar-url-batcher.js | packages/plugin-avatar/test/unit/spec/avatar-url-batcher.js | /**!
*
* Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
*/
import {assert} from '@ciscospark/test-helper-chai';
import Avatar, {config} from '../../';
// import '@ciscospark/test-helper-sinon';
import {MockSpark} from '@ciscospark/test-helper-mock-spark';
describe(`Services`, () => {
describe(`Avatar`, () => {
describe(`AvatarUrlBatcher`, () => {
let batcher;
let spark;
beforeEach(() => {
spark = new MockSpark({
children: {
avatar: Avatar
}
});
spark.config.avatar = config.avatar;
batcher = spark.avatar.batcher;
console.warn(JSON.stringify(spark, null, `\t`));
});
describe(`#fingerprintRequest(item)`, () => {
it(`returns 'uuid - size'`, () => {
assert.equal(batcher.fingerprintRequest({uuid: `uuid1`, size: 80}), `uuid1 - 80`);
});
});
});
});
});
| /**!
*
* Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
*/
import {assert} from '@ciscospark/test-helper-chai';
import Avatar from '../../';
import MockSpark from '@ciscospark/test-helper-mock-spark';
describe(`Services`, () => {
describe(`Avatar`, () => {
describe(`AvatarUrlBatcher`, () => {
let batcher;
let spark;
beforeEach(() => {
spark = new MockSpark({
children: {
avatar: Avatar
}
});
console.warn('spark: <' + JSON.stringify(spark) + '>');
batcher = spark.avatar.batcher;
});
describe(`#fingerprintRequest(item)`, () => {
it(`returns 'uuid - size'`, () => {
assert.equal(batcher.fingerprintRequest({uuid: `uuid1`, size: 80}), `uuid1 - 80`);
});
});
});
});
});
| Refactor ciscospark Migrate Avatar to packages | Refactor ciscospark Migrate Avatar to packages
use default SparkMock
issue #62 Migrate Avatar
| JavaScript | mit | CiscoHRIT/spark-js-sdk,glhewett/spark-js-sdk,tran2/spark-js-sdk,CiscoHRIT/spark-js-sdk,aimeex3/spark-js-sdk,mwegman/spark-js-sdk,mwegman/spark-js-sdk,adamweeks/spark-js-sdk,ciscospark/spark-js-sdk,tran2/spark-js-sdk,aimeex3/spark-js-sdk,bbender/spark-js-sdk,ianwremmel/spark-js-sdk,mwegman/spark-js-sdk,adamweeks/spark-js-sdk,ciscospark/spark-js-sdk,urbenlegend/spark-js-sdk,nickclar/spark-js-sdk,ianwremmel/spark-js-sdk,glhewett/spark-js-sdk,glhewett/spark-js-sdk,nickclar/spark-js-sdk,urbenlegend/spark-js-sdk,aimeex3/spark-js-sdk,bbender/spark-js-sdk,bbender/spark-js-sdk,adamweeks/spark-js-sdk | ---
+++
@@ -3,9 +3,8 @@
* Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
*/
import {assert} from '@ciscospark/test-helper-chai';
-import Avatar, {config} from '../../';
-// import '@ciscospark/test-helper-sinon';
-import {MockSpark} from '@ciscospark/test-helper-mock-spark';
+import Avatar from '../../';
+import MockSpark from '@ciscospark/test-helper-mock-spark';
describe(`Services`, () => {
describe(`Avatar`, () => {
@@ -19,10 +18,8 @@
avatar: Avatar
}
});
-
- spark.config.avatar = config.avatar;
+ console.warn('spark: <' + JSON.stringify(spark) + '>');
batcher = spark.avatar.batcher;
- console.warn(JSON.stringify(spark, null, `\t`));
});
describe(`#fingerprintRequest(item)`, () => { |
21f294d4aa2364cca03642e71e4872e945e64904 | client/views/hosts/hostCreate/hostCreate.js | client/views/hosts/hostCreate/hostCreate.js | Template.HostCreate.events({
'submit form' : function (event, template) {
event.preventDefault();
// Define form field variables.
var hostname = event.target.hostname.value,
type = event.target.type.value,
version = event.target.version.value;
// Need more validation here.
if (hostname.length) {
// Create sort field sequence value.
var total = Hosts.find().count();
if (total == 0) {
var seq = total;
} else {
var seq = total++;
}
// Insert data into document.
Hosts.insert({
hostname: hostname,
type: type,
version: version,
hostCreated: new Date,
sort: seq
});
// Reset form.
template.find('form').reset();
Router.go('/');
}
}
});
| Template.HostCreate.events({
'submit form' : function (event, template) {
event.preventDefault();
// Define form field variables.
var hostname = event.target.hostname.value,
type = event.target.type.value,
version = event.target.version.value;
// Need more validation here.
if (hostname.length) {
// Create sort field sequence value.
var total = Hosts.find().count();
if (total == 0) {
var seq = total;
} else {
var seq = total++;
}
// Insert data into document.
Hosts.insert({
hostname: hostname,
type: type,
version: version,
hostCreated: new Date,
sort: seq
});
// Reset form.
template.find('form').reset();
Router.go('home');
}
}
});
| Use route names instead of paths. | 54: Use route names instead of paths.
| JavaScript | mit | steyep/syrinx,bfodeke/syrinx,steyep/syrinx,bfodeke/syrinx,shrop/syrinx,shrop/syrinx,hb5co/syrinx,hb5co/syrinx | ---
+++
@@ -28,7 +28,7 @@
});
// Reset form.
template.find('form').reset();
- Router.go('/');
+ Router.go('home');
}
}
}); |
d956307fb81bc0b6561ec13a0cf1655c4d6ffc6c | lib/middleware.js | lib/middleware.js | const assert = require('assert');
'use strict';
/**
* Once middleware will block an event if there is already a scheduled event
* @param {Event} event the event to check
* @param {DBWrkr} wrkr wrkr instance to work with
* @param {function} done callback
*/
function once(event, wrkr, done) {
assert(typeof event.name === 'string', 'event must be a valid event');
const findSpec = {
name: event.name
};
if (event.tid) findSpec.tid = event.tid;
wrkr.find(findSpec, (err, events) => {
if (err) return done(err);
// Mark event as Blocked, DBWrkr.publish will not store it
if (events.length) {
event.__blocked = true;
}
event.when = event.once;
if (typeof event.when === 'number') { // ms
event.when = new Date(Date.now()+event.when);
}
delete event.once;
return done();
});
}
// Exports
module.exports = {
once: once
};
| 'use strict';
/**
* Once middleware will block an event if there is already a scheduled event
* @param {Event} event the event to check
* @param {DBWrkr} wrkr wrkr instance to work with
* @param {function} done callback
*/
function once(event, wrkr, done) {
const findSpec = {
name: event.name
};
if (event.tid) findSpec.tid = event.tid;
wrkr.find(findSpec, (err, events) => {
if (err) return done(err);
// Mark event as Blocked, DBWrkr.publish will not store it
if (events.length) {
event.__blocked = true;
}
event.when = event.once;
if (typeof event.when === 'number') { // ms
event.when = new Date(Date.now()+event.when);
}
delete event.once;
return done();
});
}
// Exports
module.exports = {
once: once
};
| Remove assert on event.name (handled somewhere else) | Once: Remove assert on event.name (handled somewhere else)
| JavaScript | mit | whyhankee/dbwrkr | ---
+++
@@ -1,4 +1,3 @@
-const assert = require('assert');
'use strict';
@@ -9,7 +8,6 @@
* @param {function} done callback
*/
function once(event, wrkr, done) {
- assert(typeof event.name === 'string', 'event must be a valid event');
const findSpec = {
name: event.name |
8e10d4221b8231f4de72130a8014bb79c9b277d0 | src/assets/js/main.js | src/assets/js/main.js | (function () {
function initTwinklingStars() {
particlesJS('stars', {
particles: {
number: {
value: 180,
density: {
enable: true,
value_area: 600
}
},
color: {
value: '#ffffff'
},
shape: {
type: 'circle'
},
opacity: {
value: 1,
random: true,
anim: {
enable: true,
speed: 3,
opacity_min: 0
}
},
size: {
value: 1.5,
random: true,
anim: {
enable: true,
speed: 1,
size_min: 0.5,
sync: false
}
},
line_linked: {
enable: false
},
move: {
enable: true,
speed: 50,
direction: 'none',
random: true,
straight: true,
out_mode: 'bounce'
}
},
retina_detect: true
});
}
window.onload = function () {
document.body.className = '';
initTwinklingStars();
}
window.onresize = function () {
clearTimeout(window.onResizeEnd);
window.onResizeEnd = setTimeout(initTwinklingStars, 250);
}
window.ontouchmove = function () {
return false;
}
window.onorientationchange = function () {
document.body.scrollTop = 0;
}
}());
| (function () {
function initTwinklingStars(devicePixelRatio) {
particlesJS('stars', {
particles: {
number: {
value: 180,
density: {
enable: true,
value_area: 600
}
},
color: {
value: '#ffffff'
},
shape: {
type: 'circle'
},
opacity: {
value: 1,
random: true,
anim: {
enable: true,
speed: 3,
opacity_min: 0
}
},
size: {
value: 1.5 / devicePixelRatio,
random: true,
anim: {
enable: true,
speed: 1,
size_min: 0.5 / devicePixelRatio,
sync: false
}
},
line_linked: {
enable: false
},
move: {
enable: true,
speed: 50,
direction: 'none',
random: true,
straight: true,
out_mode: 'bounce'
}
},
retina_detect: true
});
}
window.onload = function () {
initTwinklingStars(window.devicePixelRatio / 1.5 || 1);
document.body.className = '';
}
window.onresize = function () {
clearTimeout(window.onResizeEnd);
window.onResizeEnd = setTimeout(initTwinklingStars, 250);
}
window.ontouchmove = function () {
return false;
}
window.onorientationchange = function () {
document.body.scrollTop = 0;
}
}());
| Tweak stars size on retina devices | Tweak stars size on retina devices
| JavaScript | mit | rfgamaral/ricardoamaral.net,rfgamaral/ricardoamaral.net | ---
+++
@@ -1,5 +1,6 @@
(function () {
- function initTwinklingStars() {
+ function initTwinklingStars(devicePixelRatio) {
+
particlesJS('stars', {
particles: {
number: {
@@ -25,12 +26,12 @@
}
},
size: {
- value: 1.5,
+ value: 1.5 / devicePixelRatio,
random: true,
anim: {
enable: true,
speed: 1,
- size_min: 0.5,
+ size_min: 0.5 / devicePixelRatio,
sync: false
}
},
@@ -51,8 +52,8 @@
}
window.onload = function () {
+ initTwinklingStars(window.devicePixelRatio / 1.5 || 1);
document.body.className = '';
- initTwinklingStars();
}
window.onresize = function () { |
2e4f0c043868c764fa2719ab11964a929d74bf01 | app/domain/ebmeds/System.js | app/domain/ebmeds/System.js | var moment = require('moment');
var System = {
create: function(activityInstance, user, language, nation) {
var now = moment();
return {
"User": {
"HealthCareRole": user.startsWith("Patient") ? "Citizen" : "Physician",
"HealthCareOrganization": {
"CodeValue": {},
"CodeSystem": {},
"CodeSystemVersion": {}
},
"HealthCareSpecialty": {
"CodeValue": {},
"CodeSystem": {},
"CodeSystemVersion": {}
},
"Language": {
"CodeValue": language,
"CodeSystem": "2.16.840.1.113883.6.99",
"CodeSystemVersion": {}
},
"Nation": {
"CodeValue": nation,
"CodeSystem": "ISO 3166-1",
"CodeSystemVersion": {}
}
},
"Application": {
"QueryID": activityInstance,
"FeedbackType": "S",
"CheckMoment": {
"CheckDate": now.format('YYYY-MM-DD'),
"CheckTime": now.format('HH:mm:ss')
}
}
};
}
};
module.exports = System; | var moment = require('moment');
var System = {
create: function(activityInstance, user, language, nation) {
var now = moment();
return {
"User": {
"HealthCareRole": user.startsWith("Patient") ? "Citizen" : "Physician",
"HealthCareOrganization": {
"CodeValue": "fhirdemo",
"CodeSystem": {},
"CodeSystemVersion": {}
},
"HealthCareSpecialty": {
"CodeValue": {},
"CodeSystem": {},
"CodeSystemVersion": {}
},
"Language": {
"CodeValue": language,
"CodeSystem": "2.16.840.1.113883.6.99",
"CodeSystemVersion": {}
},
"Nation": {
"CodeValue": nation,
"CodeSystem": "ISO 3166-1",
"CodeSystemVersion": {}
}
},
"Application": {
"QueryID": activityInstance,
"FeedbackType": "S",
"CheckMoment": {
"CheckDate": now.format('YYYY-MM-DD'),
"CheckTime": now.format('HH:mm:ss')
}
}
};
}
};
module.exports = System; | Set organization code to fhirdemo | Set organization code to fhirdemo
| JavaScript | mit | ebmeds/ebmeds-fhir,ebmeds/ebmeds-fhir | ---
+++
@@ -10,7 +10,7 @@
"User": {
"HealthCareRole": user.startsWith("Patient") ? "Citizen" : "Physician",
"HealthCareOrganization": {
- "CodeValue": {},
+ "CodeValue": "fhirdemo",
"CodeSystem": {},
"CodeSystemVersion": {}
}, |
e5374eca0b7f8eb61de6fc0ce27085a6be01c519 | assets/buttons.js | assets/buttons.js | require(['gitbook'], function(gitbook) {
gitbook.events.bind('start', function(e, config) {
var opts = config.toolbar;
if (!opts || !opts.buttons) return;
var buttons = opts.buttons.slice(0);
buttons.reverse();
buttons.forEach(function(button) {
gitbook.toolbar.createButton({
icon: button.icon || "fa fa-external-link",
label: button.label || "Link",
position: 'right',
onClick: function(e) {
e.preventDefault();
var mapping = {
"{{title}}": encodeURIComponent(document.title),
"{{url}}": encodeURIComponent(location.href)
};
var re = RegExp(Object.keys(mapping).join("|"), "g");
window.open(button.url.replace(re, function(matched) {
return mapping[matched];
}));
}
});
});
});
});
| require(['gitbook'], function(gitbook) {
gitbook.events.bind('start', function(e, config) {
var opts = config.toolbar;
if (!opts || !opts.buttons) return;
var buttons = opts.buttons.slice(0);
buttons.reverse();
buttons.forEach(function(button) {
gitbook.toolbar.createButton({
icon: button.icon || "fa fa-external-link",
label: button.label || "Link",
position: 'right',
onClick: function(e) {
e.preventDefault();
var mapping = {
"{{title}}": encodeURIComponent(document.title),
"{{url}}": encodeURIComponent(location.href)
};
var re = RegExp(Object.keys(mapping).join("|"), "g");
var url = button.url.replace(re, function(matched) {
return mapping[matched];
});
if (button.target == "_self") {
window.location = url;
} else {
window.open(url, button.target || "_blank");
}
}
});
});
});
});
| Allow to set link target (_self to change current window's location) | Allow to set link target (_self to change current window's location)
| JavaScript | apache-2.0 | Simran-B/gitbook-plugin-toolbar | ---
+++
@@ -20,9 +20,14 @@
"{{url}}": encodeURIComponent(location.href)
};
var re = RegExp(Object.keys(mapping).join("|"), "g");
- window.open(button.url.replace(re, function(matched) {
+ var url = button.url.replace(re, function(matched) {
return mapping[matched];
- }));
+ });
+ if (button.target == "_self") {
+ window.location = url;
+ } else {
+ window.open(url, button.target || "_blank");
+ }
}
});
}); |
f65229875c39b09eab54526b11738c8cc6097247 | src/components/RecipeModal/ReadModeModal/index.js | src/components/RecipeModal/ReadModeModal/index.js | import React, { PropTypes } from 'react';
import { Modal } from 'react-bootstrap';
const ReadModeModal = props => (
<div>
<Modal.Header>
<Modal.Title>{props.recipe.name}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div id='description'>
{props.recipe.description}
</div>
<ul>
{
props.recipe.ingredients.split(',').map((ingredient,index) => (
<li key={index}>{ingredient}</li>)
)
}
</ul>
</Modal.Body>
<Modal.Footer>
<button onClick={() => props.switchModal(props.recipeId,'update')}>
Edit
</button>
<button onClick={() => props.switchModal(props.recipeId,'delete')}>
Delete
</button>
<button onClick={props.onHide}>Close</button>
</Modal.Footer>
</div>
);
ReadModeModal.PropTypes = {
recipeId: PropTypes.number.isRequired,
recipe: PropTypes.object.isRequired,
onHide: PropTypes.func.isRequired,
switchModal: PropTypes.func.isRequired
}
export default ReadModeModal;
| import React, { PropTypes } from 'react';
import { Modal } from 'react-bootstrap';
const ReadModeModal = props => (
<div>
<Modal.Header>
<Modal.Title>{props.recipe.name}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div id='description'>
{props.recipe.description}
</div>
<ul>
{
props.recipe.ingredients.split(',').map((ingredient,index) => (
<li key={index}>{ingredient}</li>)
)
}
</ul>
</Modal.Body>
<Modal.Footer>
<button onClick={() => props.switchModal(props.recipeId,'update')}>
Edit
</button>
<button onClick={() => props.switchModal(props.recipeId,'delete')}>
Delete
</button>
<button onClick={props.onHide}>Close</button>
</Modal.Footer>
</div>
);
ReadModeModal.PropTypes = {
recipeId: PropTypes.number.isRequired,
recipe: PropTypes.shape({
name: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
ingredients: PropTypes.string.isRequired
}),
onHide: PropTypes.func.isRequired,
switchModal: PropTypes.func.isRequired
}
export default ReadModeModal;
| Update PropTypes of ReadModeModal component | Update PropTypes of ReadModeModal component
| JavaScript | mit | ibleedfilm/recipe-box,ibleedfilm/recipe-box | ---
+++
@@ -33,7 +33,11 @@
ReadModeModal.PropTypes = {
recipeId: PropTypes.number.isRequired,
- recipe: PropTypes.object.isRequired,
+ recipe: PropTypes.shape({
+ name: PropTypes.string.isRequired,
+ description: PropTypes.string.isRequired,
+ ingredients: PropTypes.string.isRequired
+ }),
onHide: PropTypes.func.isRequired,
switchModal: PropTypes.func.isRequired
} |
b82800fc66b5744a962217b7a0d529dd1c9b2dee | src/models/Token.js | src/models/Token.js | 'use strict'
const mongoose = require('mongoose')
const uuid = require('uuid').v4
const schema = new mongoose.Schema({
id: {
type: String,
required: true,
unique: true,
default: uuid
},
created: {
type: Date,
required: true,
default: Date.now
},
updated: {
type: Date,
required: true,
default: Date.now
}
})
module.exports = mongoose.model('Token', schema) | 'use strict'
const mongoose = require('mongoose')
const uuid = require('uuid').v4
const schema = new mongoose.Schema({
id: {
type: String,
required: true,
unique: true,
default: uuid
},
title: {
type: String
},
permanent: {
type: Boolean,
default: false
},
created: {
type: Date,
required: true,
default: Date.now
},
updated: {
type: Date,
required: true,
default: Date.now
}
})
module.exports = mongoose.model('Token', schema) | Add title and permanent flag to token model | Add title and permanent flag to token model
| JavaScript | mit | electerious/Ackee | ---
+++
@@ -9,6 +9,13 @@
required: true,
unique: true,
default: uuid
+ },
+ title: {
+ type: String
+ },
+ permanent: {
+ type: Boolean,
+ default: false
},
created: {
type: Date, |
765444e800cd10f7a6347c82f1b272d64875e835 | middleware/ensure-found.js | middleware/ensure-found.js | /*
* Ensures something has been found during the request. Returns 404 if
* res.template is unset, res.locals is empty and statusCode has not been set
* to 204.
*
* Should be placed at the very end of the middleware pipeline,
* after all project specific routes but before the error handler & responder.
*
* @module midwest/middleware/ensure-found
*/
'use strict';
const _ = require('lodash');
module.exports = function ensureFound(req, res, next) {
// it seems most reasonable to check if res.locals is empty before res.statusCode
// because the former is much more common
if (res.template || res.master || !_.isEmpty(res.locals) || res.statusCode === 204) {
next();
} else {
// generates Not Found error if there is no page to render and no truthy
// values in data
const err = new Error(`Not found: ${req.method.toUpperCase()} ${req.path}`);
err.status = 404;
next(err);
}
};
| /*
* Ensures something has been found during the request. Returns 404 if
* res.template is unset, res.locals is empty and statusCode has not been set
* to 204.
*
* Should be placed at the very end of the middleware pipeline,
* after all project specific routes but before the error handler & responder.
*
* @module midwest/middleware/ensure-found
*/
'use strict';
function isEmpty(obj) {
for (const prop in obj) {
if (prop !== 'scripts' && obj.hasOwnProperty(prop)) {
return false;
}
}
return true;
}
module.exports = function ensureFound(req, res, next) {
// it seems most reasonable to check if res.locals is empty before res.statusCode
// because the former is much more common
if (res.template || res.master || !isEmpty(res.locals) || res.statusCode === 204) {
next();
} else {
// generates Not Found error if there is no page to render and no truthy
// values in data
const err = new Error(`Not found: ${req.method.toUpperCase()} ${req.path}`);
err.status = 404;
next(err);
}
};
| Optimize and classify only res.locals.scripts as not found | Optimize and classify only res.locals.scripts as not found
| JavaScript | mit | thebitmill/midwest | ---
+++
@@ -11,12 +11,19 @@
'use strict';
-const _ = require('lodash');
+function isEmpty(obj) {
+ for (const prop in obj) {
+ if (prop !== 'scripts' && obj.hasOwnProperty(prop)) {
+ return false;
+ }
+ }
+ return true;
+}
module.exports = function ensureFound(req, res, next) {
// it seems most reasonable to check if res.locals is empty before res.statusCode
// because the former is much more common
- if (res.template || res.master || !_.isEmpty(res.locals) || res.statusCode === 204) {
+ if (res.template || res.master || !isEmpty(res.locals) || res.statusCode === 204) {
next();
} else {
// generates Not Found error if there is no page to render and no truthy |
3b95b1734cdfa3b7bb5cb38990265dc1db683ab1 | lib/unexpectedMockCouchdb.js | lib/unexpectedMockCouchdb.js | var BufferedStream = require('bufferedstream');
var createMockCouchAdapter = require('./createMockCouchAdapter');
var http = require('http');
var mockCouch = require('mock-couch-alexjeffburke');
var url = require('url');
function generateCouchdbResponse(databases, req, res) {
var responseObject = null;
var couchdbHandler = createMockCouchAdapter();
var couchdb = new mockCouch.MockCouch(couchdbHandler, {});
Object.keys(databases).forEach(function (databaseName) {
couchdb.addDB(databaseName, databases[databaseName].docs || []);
});
// run the handler
couchdbHandler(req, res, function () {});
}
module.exports = {
name: 'unexpected-couchdb',
installInto: function (expect) {
expect.installPlugin(require('unexpected-mitm'));
expect.addAssertion('<any> with couchdb mocked out <object> <assertion>', function (expect, subject, couchdb) {
expect.errorMode = 'nested';
var nextAssertionArgs = this.args.slice(1);
var args = [subject, 'with http mocked out', {
response: generateCouchdbResponse.bind(null, couchdb)
}].concat(nextAssertionArgs);
return expect.apply(expect, args);
});
}
};
| var BufferedStream = require('bufferedstream');
var createMockCouchAdapter = require('./createMockCouchAdapter');
var http = require('http');
var mockCouch = require('mock-couch-alexjeffburke');
var url = require('url');
function generateCouchdbResponse(databases, req, res) {
var responseObject = null;
var couchdbHandler = createMockCouchAdapter();
var couchdb = new mockCouch.MockCouch(couchdbHandler, {});
Object.keys(databases).forEach(function (databaseName) {
couchdb.addDB(databaseName, databases[databaseName].docs || []);
});
// run the handler
couchdbHandler(req, res, function () {});
}
module.exports = {
name: 'unexpected-couchdb',
installInto: function (expect) {
expect.installPlugin(require('unexpected-mitm'));
expect.addAssertion('<any> with couchdb mocked out <object> <assertion>', function (expect, subject, couchdb) {
expect.errorMode = 'nested';
return expect(function () {
return expect.shift();
}, 'with http mocked out', {
response: generateCouchdbResponse.bind(null, couchdb)
}, 'not to error');
});
}
};
| Use expect.shift instead of building an array of arguments for expect when delegating to the next assertion. | Use expect.shift instead of building an array of arguments for expect when delegating to the next assertion.
| JavaScript | bsd-3-clause | alexjeffburke/unexpected-couchdb | ---
+++
@@ -26,13 +26,11 @@
expect.addAssertion('<any> with couchdb mocked out <object> <assertion>', function (expect, subject, couchdb) {
expect.errorMode = 'nested';
- var nextAssertionArgs = this.args.slice(1);
- var args = [subject, 'with http mocked out', {
+ return expect(function () {
+ return expect.shift();
+ }, 'with http mocked out', {
response: generateCouchdbResponse.bind(null, couchdb)
- }].concat(nextAssertionArgs);
-
- return expect.apply(expect, args);
+ }, 'not to error');
});
-
}
}; |
9a4358f6f1726f7834fa009b18ef57c781a5937b | fis-conf.js | fis-conf.js | // default settings. fis3 release
// Global start
fis.match('src/ui-p2p-lending.less', {
parser: fis.plugin('less'),
rExt: '.css'
})
fis.match('src/*.less', {
packTo: 'dist/ui-p2p-lending.css'
})
// Global end
// default media is `dev`
// extends GLOBAL config
| fis.match('src/ui-p2p-lending.less', {
parser: fis.plugin('less'),
rExt: '.css',
release: 'dist/ui-p2p-lending.css'
})
| Modify the configuration of fis to remove the useless configurations | Modify the configuration of fis to remove the useless configurations
| JavaScript | mit | PeachScript/ui-p2p-lending,Hellocyy/ui-p2p-lending,Hellocyy/ui-p2p-lending,PeachScript/ui-p2p-lending | ---
+++
@@ -1,17 +1,5 @@
-// default settings. fis3 release
-
-// Global start
fis.match('src/ui-p2p-lending.less', {
parser: fis.plugin('less'),
- rExt: '.css'
+ rExt: '.css',
+ release: 'dist/ui-p2p-lending.css'
})
-
-fis.match('src/*.less', {
- packTo: 'dist/ui-p2p-lending.css'
-})
-
-// Global end
-
-// default media is `dev`
-
-// extends GLOBAL config |
dcf3b88a466c82c06715badb541e09f3c9d64f1b | src/singlePlayer.js | src/singlePlayer.js | import React, { Component } from 'react'
import { propTypes, defaultProps } from './props'
import Player from './Player'
import { isEqual, getConfig } from './utils'
export default function createSinglePlayer (activePlayer) {
return class SinglePlayer extends Component {
static displayName = `${activePlayer.displayName}Player`
static propTypes = propTypes
static defaultProps = defaultProps
static canPlay = activePlayer.canPlay
shouldComponentUpdate (nextProps) {
return !isEqual(this.props, nextProps)
}
componentWillUpdate (nextProps) {
this.config = getConfig(nextProps, defaultProps)
}
render () {
if (!activePlayer.canPlay(this.props.url)) {
return null
}
return (
<Player
{...this.props}
activePlayer={activePlayer}
config={getConfig(this.props, defaultProps)}
/>
)
}
}
}
| import React, { Component } from 'react'
import { propTypes, defaultProps, DEPRECATED_CONFIG_PROPS } from './props'
import { getConfig, omit, isEqual } from './utils'
import Player from './Player'
const SUPPORTED_PROPS = Object.keys(propTypes)
export default function createSinglePlayer (activePlayer) {
return class SinglePlayer extends Component {
static displayName = `${activePlayer.displayName}Player`
static propTypes = propTypes
static defaultProps = defaultProps
static canPlay = activePlayer.canPlay
shouldComponentUpdate (nextProps) {
return !isEqual(this.props, nextProps)
}
componentWillUpdate (nextProps) {
this.config = getConfig(nextProps, defaultProps)
}
ref = player => {
this.player = player
}
render () {
if (!activePlayer.canPlay(this.props.url)) {
return null
}
const { style, width, height, wrapper: Wrapper } = this.props
const otherProps = omit(this.props, SUPPORTED_PROPS, DEPRECATED_CONFIG_PROPS)
return (
<Wrapper style={{ ...style, width, height }} {...otherProps}>
<Player
{...this.props}
ref={this.ref}
activePlayer={activePlayer}
config={getConfig(this.props, defaultProps)}
/>
</Wrapper>
)
}
}
}
| Add single player wrapper div | Add single player wrapper div
Keeps structure consistent with the full player, and enable props like `className` and `wrapper`
Fixes https://github.com/CookPete/react-player/issues/346
| JavaScript | mit | CookPete/react-player,CookPete/react-player | ---
+++
@@ -1,8 +1,10 @@
import React, { Component } from 'react'
-import { propTypes, defaultProps } from './props'
+import { propTypes, defaultProps, DEPRECATED_CONFIG_PROPS } from './props'
+import { getConfig, omit, isEqual } from './utils'
import Player from './Player'
-import { isEqual, getConfig } from './utils'
+
+const SUPPORTED_PROPS = Object.keys(propTypes)
export default function createSinglePlayer (activePlayer) {
return class SinglePlayer extends Component {
@@ -17,16 +19,24 @@
componentWillUpdate (nextProps) {
this.config = getConfig(nextProps, defaultProps)
}
+ ref = player => {
+ this.player = player
+ }
render () {
if (!activePlayer.canPlay(this.props.url)) {
return null
}
+ const { style, width, height, wrapper: Wrapper } = this.props
+ const otherProps = omit(this.props, SUPPORTED_PROPS, DEPRECATED_CONFIG_PROPS)
return (
- <Player
- {...this.props}
- activePlayer={activePlayer}
- config={getConfig(this.props, defaultProps)}
- />
+ <Wrapper style={{ ...style, width, height }} {...otherProps}>
+ <Player
+ {...this.props}
+ ref={this.ref}
+ activePlayer={activePlayer}
+ config={getConfig(this.props, defaultProps)}
+ />
+ </Wrapper>
)
}
} |
bb03359cfccfa8a1300435339ef91911e4b611af | lib/fs-watch-tree.js | lib/fs-watch-tree.js | module.exports = process.platform === "linux" ?
require("./watch-tree-unix") :
require("./watch-tree-generic");
| module.exports = process.platform === "linux" || process.platform === "darwin" ?
require("./watch-tree-unix") :
require("./watch-tree-generic");
| Use unix fs-watch for OSX because of problems with OSX Lion | Use unix fs-watch for OSX because of problems with OSX Lion
| JavaScript | bsd-3-clause | busterjs/fs-watch-tree | ---
+++
@@ -1,3 +1,3 @@
-module.exports = process.platform === "linux" ?
+module.exports = process.platform === "linux" || process.platform === "darwin" ?
require("./watch-tree-unix") :
require("./watch-tree-generic"); |
01c3baa8c43e976267c47934b99f7f4b210d36b6 | tests/unit/core/randomGeneration.spec.js | tests/unit/core/randomGeneration.spec.js | import { expect } from 'chai';
import jsf from '../../../src';
/* global describe, it */
describe('Random Generation', () => {
it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: true', async () => {
jsf.option({
alwaysFakeOptionals: true,
});
const schema = {
type: 'object',
properties: {
foo: { type: 'string' },
bar: { type: 'string' },
},
required: [],
additionalProperties: true,
};
const resolved = await jsf.resolve(schema);
expect(Object.keys(resolved).length).to.be.at.least(2);
});
it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: false', async () => {
jsf.option({
alwaysFakeOptionals: true,
});
const schema = {
type: 'object',
properties: {
foo: { type: 'string' },
bar: { type: 'string' },
},
required: [],
additionalProperties: false,
};
const resolved = await jsf.resolve(schema);
expect(Object.keys(resolved).length).is.eql(2);
});
});
| import { expect } from 'chai';
import jsf from '../../../src';
/* global describe, it */
describe('Random Generation', () => {
it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: true', () => {
jsf.option({
alwaysFakeOptionals: true,
});
const schema = {
type: 'object',
properties: {
foo: { type: 'string' },
bar: { type: 'string' },
},
required: [],
additionalProperties: true,
};
return jsf.resolve(schema).then(resolved => {
expect(Object.keys(resolved).length).to.be.at.least(2);
});
});
it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: false', () => {
jsf.option({
alwaysFakeOptionals: true,
});
const schema = {
type: 'object',
properties: {
foo: { type: 'string' },
bar: { type: 'string' },
},
required: [],
additionalProperties: false,
};
return jsf.resolve(schema).then(resolved => {
expect(Object.keys(resolved).length).is.eql(2);
});
});
});
| Disable async/await to run on v6 | Disable async/await to run on v6
| JavaScript | mit | json-schema-faker/json-schema-faker,pateketrueke/json-schema-faker,json-schema-faker/json-schema-faker | ---
+++
@@ -4,7 +4,7 @@
/* global describe, it */
describe('Random Generation', () => {
- it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: true', async () => {
+ it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: true', () => {
jsf.option({
alwaysFakeOptionals: true,
});
@@ -19,11 +19,11 @@
additionalProperties: true,
};
- const resolved = await jsf.resolve(schema);
-
- expect(Object.keys(resolved).length).to.be.at.least(2);
+ return jsf.resolve(schema).then(resolved => {
+ expect(Object.keys(resolved).length).to.be.at.least(2);
+ });
});
- it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: false', async () => {
+ it('should generate all the fields with alwaysFakeOptionals option and additionalProperties: false', () => {
jsf.option({
alwaysFakeOptionals: true,
});
@@ -38,8 +38,8 @@
additionalProperties: false,
};
- const resolved = await jsf.resolve(schema);
-
- expect(Object.keys(resolved).length).is.eql(2);
+ return jsf.resolve(schema).then(resolved => {
+ expect(Object.keys(resolved).length).is.eql(2);
+ });
});
}); |
842bfdc503c25008027025fa1ba4f64f11b8300c | src/devtools/model.js | src/devtools/model.js | // @flow
import type {Snapshot, SnapshotItem} from 'redux-ship';
export type State = {
logs: {action: mixed, snapshot: Snapshot<mixed, mixed>}[],
selectedLog: ?number,
selectedSnapshotItem: ?SnapshotItem<mixed, mixed>,
};
export const initialState: State = {
logs: [],
selectedLog: null,
selectedSnapshotItem: null,
};
export type Commit = {
type: 'AddLog',
action: mixed,
snapshot: Snapshot<mixed, mixed>,
} | {
type: 'SelectLog',
logIndex: number,
} | {
type: 'SelectSnapshotItem',
snapshotItem: SnapshotItem<mixed, mixed>,
};
export function reduce(state: State, commit: Commit): State {
switch (commit.type) {
case 'AddLog':
return {
...state,
logs: [
...state.logs,
{
action: commit.action,
snapshot: commit.snapshot,
}
],
};
case 'SelectLog':
return {
...state,
selectedLog: commit.logIndex,
};
case 'SelectSnapshotItem':
return {
...state,
selectedSnapshotItem: commit.snapshotItem,
};
default:
return state;
}
}
| // @flow
import type {Snapshot, SnapshotItem} from 'redux-ship';
export type State = {
logs: {action: mixed, snapshot: Snapshot<mixed, mixed>}[],
selectedLog: ?number,
selectedSnapshotItem: ?SnapshotItem<mixed, mixed>,
};
export const initialState: State = {
logs: [],
selectedLog: null,
selectedSnapshotItem: null,
};
export type Commit = {
type: 'AddLog',
action: mixed,
snapshot: Snapshot<mixed, mixed>,
} | {
type: 'SelectLog',
logIndex: number,
} | {
type: 'SelectSnapshotItem',
snapshotItem: SnapshotItem<mixed, mixed>,
};
export function reduce(state: State, commit: Commit): State {
switch (commit.type) {
case 'AddLog':
return {
...state,
logs: [
...state.logs,
{
action: commit.action,
snapshot: commit.snapshot,
}
],
};
case 'SelectLog':
return commit.logIndex === state.selectedLog ? state : {
...state,
selectedLog: commit.logIndex,
selectedSnapshotItem: null,
};
case 'SelectSnapshotItem':
return {
...state,
selectedSnapshotItem: commit.snapshotItem,
};
default:
return state;
}
}
| Hide the selected state when already on it | Hide the selected state when already on it
| JavaScript | mit | clarus/redux-ship-devtools,clarus/redux-ship-devtools | ---
+++
@@ -39,9 +39,10 @@
],
};
case 'SelectLog':
- return {
+ return commit.logIndex === state.selectedLog ? state : {
...state,
selectedLog: commit.logIndex,
+ selectedSnapshotItem: null,
};
case 'SelectSnapshotItem':
return { |
e1275063a762e4748aae86bfcf9a9e60deb40e70 | app/assets/javascripts/ember-bootstrap-rails/all.js | app/assets/javascripts/ember-bootstrap-rails/all.js | //= require ./core
//= require ./mixins
//= require ./forms
//= require_tree ./forms
//= require_tree ./views | //= require ./core
//= require ./mixins
//= require ./forms
//= require ./forms/field
//= require_tree ./forms
//= require_tree ./views | Fix dependency loading order for checkbox | Fix dependency loading order for checkbox
| JavaScript | mit | kristianmandrup/ember-bootstrap-rails,kristianmandrup/ember-bootstrap-rails | ---
+++
@@ -1,5 +1,6 @@
//= require ./core
//= require ./mixins
//= require ./forms
+//= require ./forms/field
//= require_tree ./forms
//= require_tree ./views |
70459cb61f753ce11bc85a801442de85879f716e | modules/chartDataController.js | modules/chartDataController.js | var express = require('express');
var DataStore = require('./regard-data-store.js');
var Chart = require('../schemas/chart.js');
var router = express.Router();
var dataStore = new DataStore('Adobe', 'Brackets');
router.get('/chartdata', function (req, res, next) {
var id = req.query.ids[0];
dataStore.runQuery(id).then(function (result) {
res.json({
chartdata: [{
_id: id,
values: JSON.parse(result).Results
}]
});
}, next);
});
router.post('/charts', function (req, res, next) {
if (!req.body.chart.queryDefinition) {
res.send(400, 'missing query definition');
}
var queryName = req.body.chart.id;
var queryDefinition = req.body.chart.queryDefinition;
dataStore.registerQuery(queryName, queryDefinition).done(function () {
next();
}, next);
});
module.exports = router; | var express = require('express');
var DataStore = require('./regard-data-store.js');
var Chart = require('../schemas/chart.js');
var router = express.Router();
var dataStore = new DataStore('Adobe', 'Brackets');
router.get('/chartdata', function (req, res, next) {
var id = req.query.ids[0];
dataStore.runQuery(id).then(function (result) {
res.json({
chartdata: [{
_id: id,
values: JSON.parse(result).Results
}]
});
});
});
router.put('/charts/:id', function (req, res, next) {
if (!req.body.chart.queryDefinition) {
res.send(400, 'missing query definition');
}
var queryName = req.params.id;
var queryDefinition = req.body.chart.queryDefinition;
dataStore.registerQuery(queryName, queryDefinition).done(function () {
next();
}, next);
});
module.exports = router; | Revert "Register query on create." | Revert "Register query on create."
This reverts commit 9b1d857a288861a8a93acb242c05d1830e61a7e5.
| JavaScript | apache-2.0 | with-regard/regard-website-api | ---
+++
@@ -9,21 +9,21 @@
var id = req.query.ids[0];
dataStore.runQuery(id).then(function (result) {
- res.json({
+ res.json({
chartdata: [{
_id: id,
values: JSON.parse(result).Results
}]
});
- }, next);
+ });
});
-router.post('/charts', function (req, res, next) {
+router.put('/charts/:id', function (req, res, next) {
if (!req.body.chart.queryDefinition) {
res.send(400, 'missing query definition');
}
- var queryName = req.body.chart.id;
+ var queryName = req.params.id;
var queryDefinition = req.body.chart.queryDefinition;
dataStore.registerQuery(queryName, queryDefinition).done(function () { |
e790505df6398acdcd2dbe81f353cbf7a3cafaf9 | mantis_feeder_contextMenu.js | mantis_feeder_contextMenu.js | function hook_menu(){
$.contextMenu({
selector: '.feeder_entry',
callback: function(key, options) {
if(key == 'gallery'){
var id = $(this).attr('specie_id');
var folder = '';
$.each(collection_data.species,function(){
if(this.id == id){
folder = this.name.replace(/ /g,'_').replace(/\./g,'').toLowerCase();
console.log(this);
window.open("http://soundspawn.com/browser.php?p="+folder);
}
});
console.log(this);
}
},
items: {
"gallery": {name: "Gallery", icon: "quit"},
}
});
}
| function hook_menu(){
$.contextMenu('destroy','.feeder_entry');
$.contextMenu({
selector: '.feeder_entry',
callback: function(key, options) {
if(key == 'gallery'){
var id = $(this).attr('specie_id');
var folder = '';
$.each(collection_data.species,function(){
if(this.id == id){
folder = this.name.replace(/ /g,'_').replace(/\./g,'').toLowerCase();
console.log(this);
window.open("http://soundspawn.com/browser.php?p="+folder);
}
});
console.log(this);
}
},
items: {
"gallery": {name: "Gallery", icon: "quit"},
}
});
}
| Destroy any old bind, makes this function repeat-callable | Destroy any old bind, makes this function repeat-callable
| JavaScript | mit | soundspawn/mantis_feeder,soundspawn/mantis_feeder | ---
+++
@@ -1,4 +1,5 @@
function hook_menu(){
+ $.contextMenu('destroy','.feeder_entry');
$.contextMenu({
selector: '.feeder_entry',
callback: function(key, options) { |
13975ebc0b8253e12b746d88f97d2a2d7f4c91ea | ui/app/controllers/application.js | ui/app/controllers/application.js | import Ember from 'ember';
const { Controller, computed } = Ember;
export default Controller.extend({
error: null,
errorStr: computed('error', function() {
return this.get('error').toString();
}),
errorCodes: computed('error', function() {
const error = this.get('error');
const codes = [error.code];
if (error.errors) {
error.errors.forEach(err => {
codes.push(err.status);
});
}
return codes
.compact()
.uniq()
.map(code => '' + code);
}),
is404: computed('errorCodes.[]', function() {
return this.get('errorCodes').includes('404');
}),
is500: computed('errorCodes.[]', function() {
return this.get('errorCodes').includes('500');
}),
});
| import Ember from 'ember';
const { Controller, computed, inject, run, observer } = Ember;
export default Controller.extend({
config: inject.service(),
error: null,
errorStr: computed('error', function() {
return this.get('error').toString();
}),
errorCodes: computed('error', function() {
const error = this.get('error');
const codes = [error.code];
if (error.errors) {
error.errors.forEach(err => {
codes.push(err.status);
});
}
return codes
.compact()
.uniq()
.map(code => '' + code);
}),
is404: computed('errorCodes.[]', function() {
return this.get('errorCodes').includes('404');
}),
is500: computed('errorCodes.[]', function() {
return this.get('errorCodes').includes('500');
}),
throwError: observer('error', function() {
if (this.get('config.isDev')) {
run.next(() => {
throw this.get('error');
});
}
}),
});
| Throw errors that cause a redirect to make debugging easier | Throw errors that cause a redirect to make debugging easier
| JavaScript | mpl-2.0 | Ashald/nomad,Ashald/nomad,nak3/nomad,dvusboy/nomad,dvusboy/nomad,burdandrei/nomad,nak3/nomad,Ashald/nomad,burdandrei/nomad,Ashald/nomad,dvusboy/nomad,nak3/nomad,dvusboy/nomad,hashicorp/nomad,Ashald/nomad,hashicorp/nomad,nak3/nomad,burdandrei/nomad,burdandrei/nomad,Ashald/nomad,dvusboy/nomad,nak3/nomad,hashicorp/nomad,dvusboy/nomad,hashicorp/nomad,burdandrei/nomad,burdandrei/nomad,nak3/nomad,Ashald/nomad,burdandrei/nomad,hashicorp/nomad,dvusboy/nomad,nak3/nomad,hashicorp/nomad | ---
+++
@@ -1,8 +1,10 @@
import Ember from 'ember';
-const { Controller, computed } = Ember;
+const { Controller, computed, inject, run, observer } = Ember;
export default Controller.extend({
+ config: inject.service(),
+
error: null,
errorStr: computed('error', function() {
@@ -32,4 +34,12 @@
is500: computed('errorCodes.[]', function() {
return this.get('errorCodes').includes('500');
}),
+
+ throwError: observer('error', function() {
+ if (this.get('config.isDev')) {
+ run.next(() => {
+ throw this.get('error');
+ });
+ }
+ }),
}); |
da4c52e2ba3dfc46f6523616df9ecad489266835 | js/background.js | js/background.js | var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=null;do{elem=headers[len];switch(elem.name.toLowerCase()){case'cache-control':if(!f){f=true;elem.value='private, max-age='+txt_cache;}else{headers.splice(len,1);}
break;case'expires':case'last-modified':case'etag':headers.splice(len,1);break;default:break;}}while(len--);if(!f){var obj=null;obj={};obj.name='Cache-Control';obj.value='private, max-age='+txt_cache;headers.push(obj);}
return{responseHeaders:headers};}},{urls:['<all_urls>']},['blocking','responseHeaders']);chrome.runtime.onInstalled.addListener(function(){localStorage.run=true;txt_cache=localStorage.txt_cache='604800';});if(localStorage.run){txt_cache=localStorage.txt_cache;}else{localStorage.run=true;txt_cache=localStorage.txt_cache='604800';} | var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';if(object){var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=null;do{elem=headers[len];switch(elem.name.toLowerCase()){case'cache-control':if(!f){f=true;elem.value='private, max-age='+txt_cache;}else{headers.splice(len,1);}
break;case'expires':case'last-modified':case'etag':headers.splice(len,1);break;default:break;}}while(len--);if(!f){var obj=null;obj={};obj.name='Cache-Control';obj.value='private, max-age='+txt_cache;headers.push(obj);}
return{responseHeaders:headers};}}},{urls:['<all_urls>']},['blocking','responseHeaders']);chrome.runtime.onInstalled.addListener(function(){localStorage.run=true;txt_cache=localStorage.txt_cache='604800';});if(localStorage.run){txt_cache=localStorage.txt_cache;}else{localStorage.run=true;txt_cache=localStorage.txt_cache='604800';}
| Make sure there actually is an object | Make sure there actually is an object | JavaScript | mit | mubaidr/Speed-up-Browsing,mubaidr/Speed-up-Browsing | ---
+++
@@ -1,3 +1,3 @@
-var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=null;do{elem=headers[len];switch(elem.name.toLowerCase()){case'cache-control':if(!f){f=true;elem.value='private, max-age='+txt_cache;}else{headers.splice(len,1);}
+var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';if(object){var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=null;do{elem=headers[len];switch(elem.name.toLowerCase()){case'cache-control':if(!f){f=true;elem.value='private, max-age='+txt_cache;}else{headers.splice(len,1);}
break;case'expires':case'last-modified':case'etag':headers.splice(len,1);break;default:break;}}while(len--);if(!f){var obj=null;obj={};obj.name='Cache-Control';obj.value='private, max-age='+txt_cache;headers.push(obj);}
-return{responseHeaders:headers};}},{urls:['<all_urls>']},['blocking','responseHeaders']);chrome.runtime.onInstalled.addListener(function(){localStorage.run=true;txt_cache=localStorage.txt_cache='604800';});if(localStorage.run){txt_cache=localStorage.txt_cache;}else{localStorage.run=true;txt_cache=localStorage.txt_cache='604800';}
+return{responseHeaders:headers};}}},{urls:['<all_urls>']},['blocking','responseHeaders']);chrome.runtime.onInstalled.addListener(function(){localStorage.run=true;txt_cache=localStorage.txt_cache='604800';});if(localStorage.run){txt_cache=localStorage.txt_cache;}else{localStorage.run=true;txt_cache=localStorage.txt_cache='604800';} |
b2a6fa1a1e6771a662029d3f52b6d57dcabc6ae2 | src/icarus/station.js | src/icarus/station.js | import { EventEmitter } from 'events'
import PouchDB from 'pouchdb'
import Serial from '../serial'
import Classifier from './classifier'
import { parser, dataHandler } from './data-handler'
/**
* Handles everything a Station should.
* Brings Serial, data parsing and database saving together.
*/
export default class Station extends EventEmitter {
/**
* Sets up all relevant class instances (Serial, parsers...) and events listeners.
*/
constructor () {
/**
* Database instance, internal to the station.
*/
this.db = new PouchDB('station-db')
/**
* {@link Serial} instance with the {@link parser} attached
*/
this.serial = new Serial(parser())
/**
* {@link Classifier} instance.
*/
this.classifier = new Classifier()
// Handle incoming packets
this.serial.on('data', this::dataHandler)
}
}
| import { EventEmitter } from 'events'
import PouchDB from 'pouchdb'
import Serial from '../serial'
import Classifier from './classifier'
import { parser, dataHandler } from './data-handler'
/**
* Handles everything a Station should.
* Brings Serial, data parsing and database saving together.
*/
export default class Station extends EventEmitter {
/**
* Sets up all relevant class instances (Serial, parsers...) and events listeners.
*/
constructor () {
super()
/**
* Database instance, internal to the station.
*/
this.db = new PouchDB('station-db')
/**
* {@link Serial} instance with the {@link parser} attached
*/
this.serial = new Serial(parser())
/**
* {@link Classifier} instance.
*/
this.classifier = new Classifier()
// Handle incoming packets
this.serial.on('data', this::dataHandler)
}
}
| Add missing Station super() call | Add missing Station super() call
| JavaScript | mit | cansat-icarus/capture-lib | ---
+++
@@ -13,6 +13,8 @@
* Sets up all relevant class instances (Serial, parsers...) and events listeners.
*/
constructor () {
+ super()
+
/**
* Database instance, internal to the station.
*/ |
5b0f2e638a1ca645f000f0bd23bde42b7a90f334 | js/page/watch.js | js/page/watch.js | var videoStyle = {
width: '100%',
height: '100%',
backgroundColor: '#000'
};
var WatchPage = React.createClass({
propTypes: {
name: React.PropTypes.string,
},
render: function() {
return (
<main>
<video style={videoStyle} src={"/view?name=" + this.props.name} controls />
</main>
);
}
});
| var videoStyle = {
width: '100%',
height: '100%',
backgroundColor: '#000'
};
var WatchPage = React.createClass({
propTypes: {
name: React.PropTypes.string,
},
getInitialState: function() {
return {
readyToPlay: false,
loadStatusMessage: "Requesting stream",
};
},
componentDidMount: function() {
lbry.getStream(this.props.name);
this.updateLoadStatus();
},
updateLoadStatus: function() {
lbry.getFileStatus(this.props.name, (status) => {
if (status.code != 'running') {
this.loadStatusMessage = status.message;
setTimeout(() => { this.updateLoadStatus() }, 250);
} else {
this.setState({
readyToPlay: true
});
}
});
},
render: function() {
if (!this.state.readyToPlay) {
return (
<main>
<h3>Loading lbry://{this.props.name}</h3>
{this.state.loadStatusMessage}
</main>
);
} else {
return (
<main>
<video style={videoStyle} src={"/view?name=" + this.props.name} controls />;
</main>
);
}
}
});
| Hide video until it's playable and show loading message | Hide video until it's playable and show loading message
| JavaScript | mit | lbryio/lbry-electron,jsigwart/lbry-app,jsigwart/lbry-app,akinwale/lbry-app,jsigwart/lbry-app,lbryio/lbry-app,MaxiBoether/lbry-app,akinwale/lbry-app,lbryio/lbry-electron,MaxiBoether/lbry-app,lbryio/lbry-electron,jsigwart/lbry-app,MaxiBoether/lbry-app,akinwale/lbry-app,lbryio/lbry-app,MaxiBoether/lbry-app,akinwale/lbry-app | ---
+++
@@ -8,12 +8,42 @@
propTypes: {
name: React.PropTypes.string,
},
-
+ getInitialState: function() {
+ return {
+ readyToPlay: false,
+ loadStatusMessage: "Requesting stream",
+ };
+ },
+ componentDidMount: function() {
+ lbry.getStream(this.props.name);
+ this.updateLoadStatus();
+ },
+ updateLoadStatus: function() {
+ lbry.getFileStatus(this.props.name, (status) => {
+ if (status.code != 'running') {
+ this.loadStatusMessage = status.message;
+ setTimeout(() => { this.updateLoadStatus() }, 250);
+ } else {
+ this.setState({
+ readyToPlay: true
+ });
+ }
+ });
+ },
render: function() {
- return (
- <main>
- <video style={videoStyle} src={"/view?name=" + this.props.name} controls />
- </main>
- );
+ if (!this.state.readyToPlay) {
+ return (
+ <main>
+ <h3>Loading lbry://{this.props.name}</h3>
+ {this.state.loadStatusMessage}
+ </main>
+ );
+ } else {
+ return (
+ <main>
+ <video style={videoStyle} src={"/view?name=" + this.props.name} controls />;
+ </main>
+ );
+ }
}
}); |
d65379f168c569209d073f3473ffcdb859f430b7 | src/js/clock/clock.js | src/js/clock/clock.js | var Clock = module.exports;
Clock.weekday = function(weekday, hour, minute, seconds) {
return moment({ hour: hour, minute: minute, seconds: seconds }).day(weekday).unix();
};
| var Clock = module.exports;
Clock.weekday = function(weekday, hour, minute, seconds) {
var now = moment();
var target = moment({ hour: hour, minute: minute, seconds: seconds }).day(weekday);
if (moment.max(now, target) === now) {
target.add(1, 'week');
}
return target.unix();
};
| Fix Clock weekday to always return a time in the future | Fix Clock weekday to always return a time in the future
| JavaScript | mit | ishepard/TransmissionTorrent,carlo-colombo/dublin-bus-pebble,pebble/pebblejs,demophoon/Trimet-Tracker,daduke/LMSController,Scoutski/pebblejs,carlo-colombo/dublin-bus-pebble,jiangege/pebblejs-project,frizzr/CatchOneBus,bkbilly/Tvheadend-EPG,Scoutski/pebblejs,stephanpavlovic/pebble-kicker-app,pebble/pebblejs,dhpark/pebblejs,fletchto99/pebblejs,effata/pebblejs,daduke/LMSController,frizzr/CatchOneBus,youtux/PebbleShows,effata/pebblejs,carlo-colombo/dublin-bus-pebble,lavinjj/pebblejs,daduke/LMSController,gwijsman/OpenRemotePebble,Scoutski/pebblejs,youtux/PebbleShows,dhpark/pebblejs,zanesalvatore/transit-watcher,youtux/pebblejs,demophoon/Trimet-Tracker,youtux/pebblejs,carlo-colombo/dublin-bus-pebble,bkbilly/Tvheadend-EPG,fletchto99/pebblejs,arekom/pebble-github,sunshineyyy/CatchOneBus,frizzr/CatchOneBus,jsfi/pebblejs,zanesalvatore/transit-watcher,lavinjj/pebblejs,sunshineyyy/CatchOneBus,jsfi/pebblejs,fletchto99/pebblejs,daduke/LMSController,youtux/pebblejs,effata/pebblejs,dhpark/pebblejs,zanesalvatore/transit-watcher,stephanpavlovic/pebble-kicker-app,lavinjj/pebblejs,gwijsman/OpenRemotePebble,youtux/pebblejs,lavinjj/pebblejs,stephanpavlovic/pebble-kicker-app,effata/pebblejs,ento/pebblejs,arekom/pebble-github,gwijsman/OpenRemotePebble,fletchto99/pebblejs,Scoutski/pebblejs,dhpark/pebblejs,lavinjj/pebblejs,bkbilly/Tvheadend-EPG,zanesalvatore/transit-watcher,arekom/pebble-github,carlo-colombo/dublin-bus-pebble,sunshineyyy/CatchOneBus,youtux/PebbleShows,jiangege/pebblejs-project,dhpark/pebblejs,sunshineyyy/CatchOneBus,ento/pebblejs,pebble/pebblejs,youtux/PebbleShows,ishepard/TransmissionTorrent,Scoutski/pebblejs,stephanpavlovic/pebble-kicker-app,jsfi/pebblejs,gwijsman/OpenRemotePebble,jiangege/pebblejs-project,jsfi/pebblejs,ishepard/TransmissionTorrent,jsfi/pebblejs,ento/pebblejs,daduke/LMSController,pebble/pebblejs,youtux/pebblejs,stephanpavlovic/pebble-kicker-app,zanesalvatore/transit-watcher,demophoon/Trimet-Tracker,arekom/pebble-github,ento/pebblejs,pebble/pebblejs,arekom/pebble-github,frizzr/CatchOneBus,demophoon/Trimet-Tracker,ento/pebblejs,ishepard/TransmissionTorrent,ishepard/TransmissionTorrent,demophoon/Trimet-Tracker,jiangege/pebblejs-project,bkbilly/Tvheadend-EPG,jiangege/pebblejs-project,bkbilly/Tvheadend-EPG,effata/pebblejs,sunshineyyy/CatchOneBus,fletchto99/pebblejs,gwijsman/OpenRemotePebble | ---
+++
@@ -1,5 +1,10 @@
var Clock = module.exports;
Clock.weekday = function(weekday, hour, minute, seconds) {
- return moment({ hour: hour, minute: minute, seconds: seconds }).day(weekday).unix();
+ var now = moment();
+ var target = moment({ hour: hour, minute: minute, seconds: seconds }).day(weekday);
+ if (moment.max(now, target) === now) {
+ target.add(1, 'week');
+ }
+ return target.unix();
}; |
59ad47aa54b15a420efea1b2bbc0f44a2e5e5b3e | gulpfile.js | gulpfile.js | var plugins = require('gulp-load-plugins')({
lazy: true
});
////////// TASKS ////////////
/**
* Prints out the list of available tasks.
*/
gulp.task('default', plugins.taskListing);
/////// ACCESSORY FUNCTIONS ////////
| var plugins = require('gulp-load-plugins')({
lazy: true
});
////////// TASKS ////////////
/**
* Prints out the list of available tasks.
*/
gulp.task('default', plugins.taskListing);
////// igonzalez tasks /////////////
gulp.task('analyze');
////// fjfernandez tasks /////////////
/////// ACCESSORY FUNCTIONS ////////
| Add personal areas to prevent merge conflicts. | Add personal areas to prevent merge conflicts.
| JavaScript | mit | natete/matrix-angular-gulp,natete/matrix-angular-gulp | ---
+++
@@ -11,5 +11,10 @@
gulp.task('default', plugins.taskListing);
+////// igonzalez tasks /////////////
+gulp.task('analyze');
+
+////// fjfernandez tasks /////////////
+
/////// ACCESSORY FUNCTIONS //////// |
dbcb98136ecf6d2f6200d2e5fb29f7d1684c9edf | js/colors.js | js/colors.js | module.exports = {
BLACK: 1,
RED: 1,
GREEN: 2,
BLUE: 3
} | module.exports = {
BLACK: 0,
RED: 1,
GREEN: 2,
BLUE: 3
} | Correct color value for Black | Correct color value for Black
| JavaScript | mit | gbirke/textiles-web,gbirke/textiles-web | ---
+++
@@ -1,5 +1,5 @@
module.exports = {
- BLACK: 1,
+ BLACK: 0,
RED: 1,
GREEN: 2,
BLUE: 3 |
5ca496397a1f948ecd2e1e0cb07fc3ad3e40bc64 | src/main/webapp/public/app-reset.js | src/main/webapp/public/app-reset.js | require.config({
paths: {
"jquery": "js/jquery-2.1.4.min",
"underscore": "js/underscore-min",
"knockout": "js/knockout-min-3.3.0"
}
});
require(['jquery', 'js/modules/dukecondb', 'js/modules/dukeconsettings', 'domReady!'], function($, db, settings) {
console.log("Clearing DB");
db.purge();
console.log("Clearing DB done; resetting localstore");
settings.purge();
console.log("Resetting localstore done; clearing the cache");
window.parent.caches.delete("call");
console.log("Clearing the cache done");
$('#loading').hide();
$('#layout').show();
});
| require.config({
paths: {
"jquery": "js/jquery-2.1.4.min",
"underscore": "js/underscore-min",
"domReady": "js/domReady",
"knockout": "js/knockout-min-3.3.0"
}
});
require(['jquery', 'js/modules/dukecondb', 'js/modules/dukeconsettings', 'domReady!'], function($, db, settings) {
console.log("Clearing DB");
db.purge();
console.log("Clearing DB done; resetting localstore");
settings.purge();
console.log("Resetting localstore done; clearing the cache");
window.parent.caches.delete("call");
console.log("Clearing the cache done");
$('#loading').hide();
$('#layout').show();
});
| Add missing "domReady" module declaration | Add missing "domReady" module declaration
| JavaScript | mit | dukecon/dukecon_html5,dukecon/dukecon_html5 | ---
+++
@@ -2,6 +2,7 @@
paths: {
"jquery": "js/jquery-2.1.4.min",
"underscore": "js/underscore-min",
+ "domReady": "js/domReady",
"knockout": "js/knockout-min-3.3.0"
}
}); |
23b3ba56043fed9a53a3ec6ed6e622063d7ca5e5 | src/nls/zh-tw/urls.js | src/nls/zh-tw/urls.js | /*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
define({
// Relative to the samples folder
"GETTING_STARTED" : "root/Getting Started",
"ADOBE_THIRD_PARTY" : "http://www.adobe.com/go/thirdparty/",
"WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/"
});
| /*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
define({
// Relative to the samples folder
"GETTING_STARTED" : "root/Getting Started",
"ADOBE_THIRD_PARTY" : "http://www.adobe.com/go/thirdparty/",
"WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/deed.zh_TW"
});
| Update CC BY 3.0 link to zh-TW localized version. | Update CC BY 3.0 link to zh-TW localized version.
| JavaScript | mit | zhukaixy/brackets,Live4Code/brackets,2youyouo2/cocoslite,adrianhartanto0/brackets,srinivashappy/brackets,albertinad/brackets,emanziano/brackets,fcjailybo/brackets,MahadevanSrinivasan/brackets,michaeljayt/brackets,tan9/brackets,chrismoulton/brackets,fronzec/brackets,MantisWare/brackets,IAmAnubhavSaini/brackets,malinkie/brackets,CapeSepias/brackets,brianjking/brackets,gideonthomas/brackets,nucliweb/brackets,tan9/brackets,CapeSepias/brackets,fronzec/brackets,quasto/ArduinoStudio,simon66/brackets,brianjking/brackets,brianjking/brackets,NKcentinel/brackets,ralic/brackets,jiimaho/brackets,82488059/brackets,ashleygwilliams/brackets,JordanTheriault/brackets,jmarkina/brackets,marcominetti/brackets,Live4Code/brackets,ropik/brackets,shal1y/brackets,SidBala/brackets,mcanthony/brackets,andrewnc/brackets,kolipka/brackets,amrelnaggar/brackets,andrewnc/brackets,JordanTheriault/brackets,jiawenbo/brackets,Th30/brackets,youprofit/brackets,chambej/brackets,ecwebservices/brackets,jiimaho/brackets,ScalaInc/brackets,humphd/brackets,karevn/brackets,thehogfather/brackets,karevn/brackets,busykai/brackets,zaggino/brackets-electron,keir-rex/brackets,chrismoulton/brackets,GHackAnonymous/brackets,MarcelGerber/brackets,No9/brackets,fabricadeaplicativos/brackets,netlams/brackets,jmarkina/brackets,NGHGithub/brackets,srhbinion/brackets,Andrey-Pavlov/brackets,srinivashappy/brackets,chrisle/brackets,Real-Currents/brackets,dtcom/MyPSDBracket,goldcase/brackets,Lojsan123/brackets,MantisWare/brackets,NKcentinel/brackets,jmarkina/brackets,MarcelGerber/brackets,sprintr/brackets,keir-rex/brackets,abhisekp/brackets,fabricadeaplicativos/brackets,netlams/brackets,zaggino/brackets-electron,albertinad/brackets,chinnyannieb/brackets,ropik/brackets,udhayam/brackets,No9/brackets,simon66/brackets,revi/brackets,StephanieMak/brackets,sgupta7857/brackets,Pomax/brackets,FTG-003/brackets,alexkid64/brackets,flukeout/brackets,No9/brackets,MahadevanSrinivasan/brackets,phillipalexander/brackets,uwsd/brackets,marcominetti/brackets,NickersF/brackets,lunode/brackets,ggusman/present,massimiliano76/brackets,bidle/brackets,sophiacaspar/brackets,dangkhue27/brackets,dangkhue27/brackets,massimiliano76/brackets,jiawenbo/brackets,simon66/brackets,zaggino/brackets-electron,zhukaixy/brackets,mjurczyk/brackets,macdg/brackets,GHackAnonymous/brackets,shal1y/brackets,netlams/brackets,JordanTheriault/brackets,sgupta7857/brackets,gideonthomas/brackets,shiyamkumar/brackets,RamirezWillow/brackets,gupta-tarun/brackets,thehogfather/brackets,goldcase/brackets,adrianhartanto0/brackets,goldcase/brackets,richmondgozarin/brackets,ScalaInc/brackets,Mosoc/brackets,fashionsun/brackets,wangjun/brackets,sedge/nimble,SidBala/brackets,gwynndesign/brackets,thr0w/brackets,ecwebservices/brackets,abhisekp/brackets,Cartman0/brackets,sophiacaspar/brackets,lovewitty/brackets,netlams/brackets,udhayam/brackets,SebastianBoyd/sebastianboyd.github.io-OLD,FTG-003/brackets,eric-stanley/brackets,shiyamkumar/brackets,gcommetti/brackets,CapeSepias/brackets,zaggino/brackets-electron,pkdevbox/brackets,simon66/brackets,rafaelstz/brackets,cdot-brackets-extensions/nimble-htmlLint,Fcmam5/brackets,gupta-tarun/brackets,nucliweb/brackets,NickersF/brackets,sgupta7857/brackets,chinnyannieb/brackets,flukeout/brackets,mozilla/brackets,82488059/brackets,andrewnc/brackets,shiyamkumar/brackets,chrisle/brackets,gwynndesign/brackets,Real-Currents/brackets,iamchathu/brackets,ecwebservices/brackets,treejames/brackets,Mosoc/brackets,srinivashappy/brackets,NKcentinel/brackets,stowball/brackets,gupta-tarun/brackets,lunode/brackets,uwsd/brackets,dangkhue27/brackets,shal1y/brackets,arduino-org/ArduinoStudio,chrisle/brackets,Th30/brackets,zLeonjo/brackets,alicoding/nimble,sprintr/brackets,albertinad/brackets,fabricadeaplicativos/brackets,sedge/nimble,bidle/brackets,fashionsun/brackets,karevn/brackets,falcon1812/brackets,Lojsan123/brackets,revi/brackets,stowball/brackets,busykai/brackets,baig/brackets,thehogfather/brackets,raygervais/brackets,fvntr/brackets,Live4Code/brackets,MahadevanSrinivasan/brackets,phillipalexander/brackets,fcjailybo/brackets,mozilla/brackets,alicoding/nimble,sgupta7857/brackets,michaeljayt/brackets,y12uc231/brackets,srinivashappy/brackets,nucliweb/brackets,kilroy23/brackets,revi/brackets,Rynaro/brackets,y12uc231/brackets,uwsd/brackets,fcjailybo/brackets,wakermahmud/brackets,busykai/brackets,siddharta1337/brackets,pratts/brackets,82488059/brackets,Rajat-dhyani/brackets,pomadgw/brackets,thr0w/brackets,siddharta1337/brackets,humphd/brackets,Andrey-Pavlov/brackets,alexkid64/brackets,mjurczyk/brackets,tan9/brackets,robertkarlsson/brackets,robertkarlsson/brackets,arduino-org/ArduinoStudio,shiyamkumar/brackets,rlugojr/brackets,Jonavin/brackets,keir-rex/brackets,youprofit/brackets,treejames/brackets,MahadevanSrinivasan/brackets,phillipalexander/brackets,MarcelGerber/brackets,Rynaro/brackets,GHackAnonymous/brackets,siddharta1337/brackets,ScalaInc/brackets,Lojsan123/brackets,fastrde/brackets,ForkedRepos/brackets,wesleifreitas/brackets,ralic/brackets,ChaofengZhou/brackets,iamchathu/brackets,gideonthomas/brackets,zaggino/brackets-electron,jiawenbo/brackets,fashionsun/brackets,flukeout/brackets,andrewnc/brackets,ForkedRepos/brackets,thr0w/brackets,phillipalexander/brackets,dtcom/MyPSDBracket,NickersF/brackets,kilroy23/brackets,xantage/brackets,m66n/brackets,riselabs-ufba/RiPLE-HC-ExperimentalData,amrelnaggar/brackets,emanziano/brackets,Th30/brackets,siddharta1337/brackets,RamirezWillow/brackets,pomadgw/brackets,bidle/brackets,thr0w/brackets,mjurczyk/brackets,ricciozhang/brackets,adobe/brackets,kilroy23/brackets,richmondgozarin/brackets,xantage/brackets,quasto/ArduinoStudio,ggusman/present,brianjking/brackets,TylerL-uxai/brackets,No9/brackets,Lojsan123/brackets,adrianhartanto0/brackets,jmarkina/brackets,fcjailybo/brackets,m66n/brackets,weebygames/brackets,lovewitty/brackets,stowball/brackets,show0017/brackets,wakermahmud/brackets,cdot-brackets-extensions/nimble-htmlLint,gupta-tarun/brackets,lovewitty/brackets,treejames/brackets,netlams/brackets,Rajat-dhyani/brackets,alexkid64/brackets,veveykocute/brackets,ralic/brackets,shiyamkumar/brackets,wesleifreitas/brackets,zLeonjo/brackets,jacobnash/brackets,Pomax/brackets,richmondgozarin/brackets,resir014/brackets,flukeout/brackets,rafaelstz/brackets,Mosoc/brackets,Rajat-dhyani/brackets,veveykocute/brackets,brianjking/brackets,michaeljayt/brackets,goldcase/brackets,JordanTheriault/brackets,RobertJGabriel/brackets,sprintr/brackets,fvntr/brackets,jiimaho/brackets,Rajat-dhyani/brackets,Real-Currents/brackets,jiimaho/brackets,Cartman0/brackets,mcanthony/brackets,mozilla/brackets,ChaofengZhou/brackets,weebygames/brackets,IAmAnubhavSaini/brackets,ls2uper/brackets,Free-Technology-Guild/brackets,IAmAnubhavSaini/brackets,pratts/brackets,baig/brackets,eric-stanley/brackets,zLeonjo/brackets,sophiacaspar/brackets,CapeSepias/brackets,ScalaInc/brackets,TylerL-uxai/brackets,ls2uper/brackets,pomadgw/brackets,falcon1812/brackets,wangjun/brackets,macdg/brackets,SebastianBoyd/sebastianboyd.github.io-OLD,chrisle/brackets,thehogfather/brackets,Rynaro/brackets,sprintr/brackets,treejames/brackets,robertkarlsson/brackets,Wikunia/brackets,pratts/brackets,m66n/brackets,weebygames/brackets,m66n/brackets,IAmAnubhavSaini/brackets,Rynaro/brackets,revi/brackets,zLeonjo/brackets,wesleifreitas/brackets,ls2uper/brackets,SebastianBoyd/sebastianboyd.github.io-OLD,busykai/brackets,fastrde/brackets,pkdevbox/brackets,macdg/brackets,weebygames/brackets,wesleifreitas/brackets,amrelnaggar/brackets,macdg/brackets,No9/brackets,StephanieMak/brackets,wakermahmud/brackets,hanmichael/brackets,ScalaInc/brackets,amrelnaggar/brackets,Rajat-dhyani/brackets,hanmichael/brackets,mozilla/brackets,dangkhue27/brackets,SidBala/brackets,resir014/brackets,2youyouo2/cocoslite,gcommetti/brackets,ashleygwilliams/brackets,humphd/brackets,ecwebservices/brackets,Jonavin/brackets,xantage/brackets,eric-stanley/brackets,Cartman0/brackets,CapeSepias/brackets,fvntr/brackets,RobertJGabriel/brackets,mat-mcloughlin/brackets,wangjun/brackets,gcommetti/brackets,82488059/brackets,quasto/ArduinoStudio,zhukaixy/brackets,StephanieMak/brackets,sedge/nimble,ricciozhang/brackets,ficristo/brackets,lunode/brackets,m66n/brackets,fvntr/brackets,rlugojr/brackets,ashleygwilliams/brackets,jacobnash/brackets,Th30/brackets,NGHGithub/brackets,RobertJGabriel/brackets,gideonthomas/brackets,wangjun/brackets,shal1y/brackets,gideonthomas/brackets,shal1y/brackets,sedge/nimble,GHackAnonymous/brackets,y12uc231/brackets,alicoding/nimble,richmondgozarin/brackets,wakermahmud/brackets,resir014/brackets,mcanthony/brackets,2youyouo2/cocoslite,2youyouo2/cocoslite,udhayam/brackets,baig/brackets,mjurczyk/brackets,thehogfather/brackets,Free-Technology-Guild/brackets,mcanthony/brackets,Free-Technology-Guild/brackets,Live4Code/brackets,ashleygwilliams/brackets,alexkid64/brackets,mat-mcloughlin/brackets,rlugojr/brackets,ropik/brackets,keir-rex/brackets,lovewitty/brackets,michaeljayt/brackets,zhukaixy/brackets,NickersF/brackets,simon66/brackets,albertinad/brackets,petetnt/brackets,kilroy23/brackets,adobe/brackets,abhisekp/brackets,gwynndesign/brackets,michaeljayt/brackets,tan9/brackets,abhisekp/brackets,fronzec/brackets,raygervais/brackets,ficristo/brackets,chrismoulton/brackets,82488059/brackets,Fcmam5/brackets,show0017/brackets,ralic/brackets,kolipka/brackets,mat-mcloughlin/brackets,Pomax/brackets,y12uc231/brackets,RamirezWillow/brackets,emanziano/brackets,jiawenbo/brackets,iamchathu/brackets,gupta-tarun/brackets,veveykocute/brackets,ecwebservices/brackets,ricciozhang/brackets,Mosoc/brackets,sprintr/brackets,udhayam/brackets,youprofit/brackets,MahadevanSrinivasan/brackets,NKcentinel/brackets,jmarkina/brackets,falcon1812/brackets,cdot-brackets-extensions/nimble-htmlLint,SidBala/brackets,Andrey-Pavlov/brackets,malinkie/brackets,JordanTheriault/brackets,abhisekp/brackets,MarcelGerber/brackets,jacobnash/brackets,udhayam/brackets,jiimaho/brackets,alicoding/nimble,wakermahmud/brackets,srhbinion/brackets,zaggino/brackets-electron,rlugojr/brackets,fronzec/brackets,nucliweb/brackets,jiawenbo/brackets,FTG-003/brackets,malinkie/brackets,uwsd/brackets,ralic/brackets,Fcmam5/brackets,revi/brackets,weebygames/brackets,albertinad/brackets,ChaofengZhou/brackets,NGHGithub/brackets,Jonavin/brackets,riselabs-ufba/RiPLE-HC-ExperimentalData,kilroy23/brackets,Th30/brackets,Wikunia/brackets,thr0w/brackets,emanziano/brackets,IAmAnubhavSaini/brackets,jacobnash/brackets,RobertJGabriel/brackets,Live4Code/brackets,dtcom/MyPSDBracket,sgupta7857/brackets,robertkarlsson/brackets,petetnt/brackets,raygervais/brackets,chambej/brackets,StephanieMak/brackets,ggusman/present,fcjailybo/brackets,riselabs-ufba/RiPLE-HC-ExperimentalData,y12uc231/brackets,jacobnash/brackets,keir-rex/brackets,richmondgozarin/brackets,Wikunia/brackets,2youyouo2/cocoslite,RamirezWillow/brackets,adrianhartanto0/brackets,Pomax/brackets,iamchathu/brackets,falcon1812/brackets,Andrey-Pavlov/brackets,ForkedRepos/brackets,pkdevbox/brackets,GHackAnonymous/brackets,tan9/brackets,ashleygwilliams/brackets,Cartman0/brackets,nucliweb/brackets,phillipalexander/brackets,resir014/brackets,ls2uper/brackets,ForkedRepos/brackets,fashionsun/brackets,Jonavin/brackets,Fcmam5/brackets,fronzec/brackets,hanmichael/brackets,iamchathu/brackets,riselabs-ufba/RiPLE-HC-ExperimentalData,humphd/brackets,FTG-003/brackets,show0017/brackets,karevn/brackets,Mosoc/brackets,pomadgw/brackets,rafaelstz/brackets,Real-Currents/brackets,Lojsan123/brackets,youprofit/brackets,srinivashappy/brackets,busykai/brackets,fabricadeaplicativos/brackets,arduino-org/ArduinoStudio,NKcentinel/brackets,riselabs-ufba/RiPLE-HC-ExperimentalData,Pomax/brackets,RamirezWillow/brackets,sedge/nimble,SebastianBoyd/sebastianboyd.github.io-OLD,TylerL-uxai/brackets,stowball/brackets,macdg/brackets,srhbinion/brackets,bidle/brackets,MantisWare/brackets,pkdevbox/brackets,dtcom/MyPSDBracket,ChaofengZhou/brackets,flukeout/brackets,chrisle/brackets,MantisWare/brackets,Fcmam5/brackets,Free-Technology-Guild/brackets,chambej/brackets,mjurczyk/brackets,fvntr/brackets,ForkedRepos/brackets,wesleifreitas/brackets,fastrde/brackets,malinkie/brackets,ChaofengZhou/brackets,NGHGithub/brackets,goldcase/brackets,mcanthony/brackets,NGHGithub/brackets,Wikunia/brackets,stowball/brackets,robertkarlsson/brackets,emanziano/brackets,lunode/brackets,pomadgw/brackets,fashionsun/brackets,baig/brackets,veveykocute/brackets,wangjun/brackets,lovewitty/brackets,adobe/brackets,chinnyannieb/brackets,karevn/brackets,dangkhue27/brackets,petetnt/brackets,SidBala/brackets,TylerL-uxai/brackets,pkdevbox/brackets,StephanieMak/brackets,ficristo/brackets,siddharta1337/brackets,zLeonjo/brackets,mat-mcloughlin/brackets,petetnt/brackets,rafaelstz/brackets,ls2uper/brackets,rlugojr/brackets,raygervais/brackets,bidle/brackets,ricciozhang/brackets,resir014/brackets,eric-stanley/brackets,chambej/brackets,treejames/brackets,Cartman0/brackets,amrelnaggar/brackets,zhukaixy/brackets,kolipka/brackets,baig/brackets,adobe/brackets,RobertJGabriel/brackets,veveykocute/brackets,adrianhartanto0/brackets,sophiacaspar/brackets,xantage/brackets,hanmichael/brackets,eric-stanley/brackets,fabricadeaplicativos/brackets,Andrey-Pavlov/brackets,gwynndesign/brackets,rafaelstz/brackets,youprofit/brackets,massimiliano76/brackets,chrismoulton/brackets,SebastianBoyd/sebastianboyd.github.io-OLD,chinnyannieb/brackets,falcon1812/brackets,NickersF/brackets,ricciozhang/brackets,chambej/brackets,TylerL-uxai/brackets,Free-Technology-Guild/brackets,sophiacaspar/brackets,gcommetti/brackets,FTG-003/brackets,Jonavin/brackets,lunode/brackets,arduino-org/ArduinoStudio,MantisWare/brackets,quasto/ArduinoStudio,riselabs-ufba/RiPLE-HC-ExperimentalData,cdot-brackets-extensions/nimble-htmlLint,quasto/ArduinoStudio,raygervais/brackets,Wikunia/brackets,srhbinion/brackets,srhbinion/brackets,ficristo/brackets,andrewnc/brackets,Real-Currents/brackets,ficristo/brackets,kolipka/brackets,arduino-org/ArduinoStudio,alexkid64/brackets,massimiliano76/brackets,show0017/brackets,malinkie/brackets,pratts/brackets,adobe/brackets,petetnt/brackets,ggusman/present,fastrde/brackets,pratts/brackets,mozilla/brackets,humphd/brackets,hanmichael/brackets,Real-Currents/brackets,MarcelGerber/brackets,Rynaro/brackets,chinnyannieb/brackets,fastrde/brackets,kolipka/brackets,gcommetti/brackets,massimiliano76/brackets,xantage/brackets,ropik/brackets,chrismoulton/brackets,uwsd/brackets | ---
+++
@@ -28,5 +28,5 @@
// Relative to the samples folder
"GETTING_STARTED" : "root/Getting Started",
"ADOBE_THIRD_PARTY" : "http://www.adobe.com/go/thirdparty/",
- "WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/"
+ "WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/deed.zh_TW"
}); |
8923137c551fd8ab14798e0fe35ff2018f6b966f | app/constants/Images.js | app/constants/Images.js | /*
* Copyright 2017-present, Hippothesis, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';
export const Images = {
logo: null
};
export default Images;
| /*
* Copyright 2017-present, Hippothesis, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';
export const Images = {
icons: {
home: require('../images/home-icon.png'),
search: require('../images/search-icon.png'),
profile: require('../images/profile-icon.png')
}
};
export default Images;
| Add file paths to icons | Add file paths to icons
| JavaScript | bsd-3-clause | hippothesis/Recipezy,hippothesis/Recipezy,hippothesis/Recipezy | ---
+++
@@ -11,7 +11,11 @@
'use strict';
export const Images = {
- logo: null
+ icons: {
+ home: require('../images/home-icon.png'),
+ search: require('../images/search-icon.png'),
+ profile: require('../images/profile-icon.png')
+ }
};
export default Images; |
7c52422a46c92c85d6ddb482cce389d5fa80e5ba | gulpfile.js | gulpfile.js | var gulp = require('gulp');
var tsc = require('gulp-tsc');
var tape = require('gulp-tape');
var tapSpec = require('tap-spec');
var del = require('del');
gulp.task("test:clean", function(done) {
del(['build-test/**']).then(function(paths) {
console.log("=====\nDeleted the following files:\n" + paths.join('\n')+ "\n=====");
done();
});
});
gulp.task("test:build", function (done) {
gulp.src(['test/**/*.ts'])
.pipe(tsc())
.pipe(gulp.dest('build-test/'))
.on('end', done);
});
gulp.task("test:run", function (done) {
gulp.src('build-test/test/**/*.test.js')
.pipe(tape({
reporter: tapSpec()
}));
});
gulp.task("test", ["test:build"], function (done) {
gulp.src('build-test/test/**/*.test.js')
.pipe(tape({
reporter: tapSpec()
}));
});
| var gulp = require('gulp');
var tsc = require('gulp-tsc');
var tape = require('gulp-tape');
var tapSpec = require('tap-spec');
var del = require('del');
gulp.task("test:clean", function(done) {
del(['build-test/**']).then(function(paths) {
console.log("=====\nDeleted the following files:\n" + paths.join('\n')+ "\n=====");
done();
});
});
gulp.task("test:build", function (done) {
gulp.src(['test/**/*.ts'])
.pipe(tsc())
.pipe(gulp.dest('build-test/'))
.on('end', done);
});
gulp.task("test:run", function (done) {
gulp.src('build-test/test/**/*.test.js')
.pipe(tape({
reporter: tapSpec()
}))
.on('end', done);;
});
gulp.task("test", ["test:build"], function (done) {
gulp.src('build-test/test/**/*.test.js')
.pipe(tape({
reporter: tapSpec()
}));
});
| Call completion callback in test:run | Call completion callback in test:run
| JavaScript | mit | Jameskmonger/isaac-crypto | ---
+++
@@ -22,7 +22,8 @@
gulp.src('build-test/test/**/*.test.js')
.pipe(tape({
reporter: tapSpec()
- }));
+ }))
+ .on('end', done);;
});
gulp.task("test", ["test:build"], function (done) { |
4993dac019eb6eb43b74d5999efebeb5e5c99bdb | gulpfile.js | gulpfile.js | 'use strict';
var gulp = require('gulp');
var watch = require('gulp-watch');
var harp = require('harp');
var browserSync = require('browser-sync');
var ghPages = require('gulp-gh-pages');
var harpServerOptions = {
port: 9000
};
var paths = {
projectDir: './',
outputDir: './dist',
outputFiles: './dist/**/*.*',
srcFiles: './public/**/*.*'
};
gulp.task('default', ['watch']);
gulp.task('deploy', ['build'], function () {
return gulp.src(paths.outputFiles)
.pipe(ghPages());
});
gulp.task('build', function (done) {
harp.compile(paths.projectDir, paths.outputDir, done);
});
gulp.task('watch', ['dev-server'], function () {
browserSync({
open: false,
proxy: 'localhost:' + harpServerOptions.port,
notify: false
});
gulp.src(paths.srcFiles)
.pipe(watch(paths.srcFiles, {
verbose: true
}))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('dev-server', function (done) {
harp.server(__dirname, harpServerOptions, done);
});
| 'use strict';
var gulp = require('gulp');
var watch = require('gulp-watch');
var harp = require('harp');
var browserSync = require('browser-sync');
var ghPages = require('gulp-gh-pages');
var harpServerOptions = {
port: 9000
};
var paths = {
projectDir: './',
outputDir: './dist',
outputFiles: './dist/**/*',
srcFiles: './public/**/*'
};
gulp.task('default', ['watch']);
gulp.task('deploy', ['build'], function () {
return gulp.src(paths.outputFiles)
.pipe(ghPages());
});
gulp.task('build', function (done) {
harp.compile(paths.projectDir, paths.outputDir, done);
});
gulp.task('watch', ['dev-server'], function () {
browserSync({
open: false,
proxy: 'localhost:' + harpServerOptions.port,
notify: false
});
gulp.src(paths.srcFiles)
.pipe(watch(paths.srcFiles, {
verbose: true
}))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('dev-server', function (done) {
harp.server(__dirname, harpServerOptions, done);
});
| Modify files globs to include all files | Modify files globs to include all files
The wildcard pattern was not picking up CNAME. Now it does.
| JavaScript | mit | josh-egan/tech.joshegan.com,josh-egan/tech.joshegan.com,josh-egan/tech.joshegan.com | ---
+++
@@ -13,8 +13,8 @@
var paths = {
projectDir: './',
outputDir: './dist',
- outputFiles: './dist/**/*.*',
- srcFiles: './public/**/*.*'
+ outputFiles: './dist/**/*',
+ srcFiles: './public/**/*'
};
gulp.task('default', ['watch']); |
7baa60230492c34ca9b1bb881731e0f6b5827d25 | gulpfile.js | gulpfile.js | const gulp = require('gulp');
const browserify = require('gulp-browserify');
const pkg = require('./package.json')
gulp.task('build', () =>
gulp.src(pkg.main)
.pipe(browserify({
insertGlobals : true,
debug : !gulp.env.production
}))
.pipe(gulp.dest('dist'))
);
gulp.task('default', ['build']);
| const gulp = require('gulp');
const browserify = require('gulp-browserify');
const rename = require("gulp-rename");
const pkg = require('./package.json');
gulp.task('build', () =>
gulp.src(pkg.main)
.pipe(browserify({
insertGlobals: true,
debug: !gulp.env.production
}))
.pipe(rename(function(path) {
path.basename = pkg.name;
}))
.pipe(gulp.dest('dist'))
);
gulp.task('default', ['build']);
| Add renaming of index.js to memefy.js | Add renaming of index.js to memefy.js
| JavaScript | mit | Kaioru/memefy.js | ---
+++
@@ -1,14 +1,18 @@
const gulp = require('gulp');
const browserify = require('gulp-browserify');
-const pkg = require('./package.json')
+const rename = require("gulp-rename");
+const pkg = require('./package.json');
gulp.task('build', () =>
gulp.src(pkg.main)
.pipe(browserify({
- insertGlobals : true,
- debug : !gulp.env.production
- }))
- .pipe(gulp.dest('dist'))
+ insertGlobals: true,
+ debug: !gulp.env.production
+ }))
+ .pipe(rename(function(path) {
+ path.basename = pkg.name;
+ }))
+ .pipe(gulp.dest('dist'))
);
gulp.task('default', ['build']); |
132822c44fc6916a01a547a2cfb70e1305b737ea | gulpfile.js | gulpfile.js | var gulp = require('gulp'),
rimraf = require('rimraf'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
insert = require('gulp-insert'),
p = require('./package.json')
;
//Folders and annotation
var src = 'src/',
dest = 'dist/',
annotation = '/* ' + p.name + ' v' + p.version + ' | Copyright (c) ' + new Date().getFullYear() + ' ' + p.homepage + ' | ' + p.license + ' license */\n';
gulp.task('clean', function(cb) {
rimraf(dest, cb);
});
gulp.task('scripts', ['clean'], function() {
return gulp.src(src + '*.js')
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify())
.pipe(rename('jquery.seslider-' + p.version + '.min.js'))
.pipe(insert.prepend(annotation))
.pipe(gulp.dest(dest));
;
});
gulp.task('default', ['scripts'], function() {
});
| var gulp = require('gulp'),
rimraf = require('rimraf'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
insert = require('gulp-insert'),
p = require('./package.json')
;
//Folders and annotation
var src = 'src/',
dest = 'dist/',
annotation = '/* ' + p.name + ' v' + p.version + ' | Copyright (c) ' + new Date().getFullYear() + ' ' + p.homepage + ' | ' + p.license + ' license */\n';
gulp.task('clean', function(cb) {
rimraf(dest, cb);
});
gulp.task('scripts', ['clean'], function() {
return gulp.src(src + '*.js')
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify())
.pipe(rename('jquery.seslider.min.js'))
.pipe(insert.prepend(annotation))
.pipe(gulp.dest(dest));
;
});
gulp.task('default', ['scripts'], function() {
});
| Update gulp to change name of generated file | Update gulp to change name of generated file
| JavaScript | mit | Sevrahk/seSlider,Sevrahk/seSlider | ---
+++
@@ -21,7 +21,7 @@
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify())
- .pipe(rename('jquery.seslider-' + p.version + '.min.js'))
+ .pipe(rename('jquery.seslider.min.js'))
.pipe(insert.prepend(annotation))
.pipe(gulp.dest(dest));
; |
3ee6f9293edd48a1ca8302f799f8a339549952a1 | gulpfile.js | gulpfile.js | 'use strict';
var gulp = require('gulp');
var del = require('del');
var babel = require('gulp-babel');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var mocha = require('gulp-mocha');
var mochaBabelRegister = require('babel/register');
var buildDestination = 'build'
gulp.task('build', function() {
del([buildDestination], function() {
var bundleStream = browserify({
entries: './index.js',
debug: true,
}).bundle();
return bundleStream
.pipe(source('min-flux.js'))
.pipe(buffer())
.pipe(babel())
.pipe(gulp.dest(buildDestination));
});
});
gulp.task('test', function() {
var MinFlux = require('./index');
var expect = require('chai').expect;
return gulp.src(['test/**/*.js'], { read: false })
.pipe(mocha({
reporter: 'dot',
require: [
'./index',
'chai',
],
}));
});
gulp.task('default', ['test']);
| 'use strict';
var gulp = require('gulp');
var del = require('del');
var babel = require('gulp-babel');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var mocha = require('gulp-mocha');
var mochaBabelRegister = require('babel/register');
var buildDestination = 'build'
gulp.task('build', function() {
del([buildDestination], function() {
var bundleStream = browserify({
entries: './index.js',
debug: true,
}).bundle();
return bundleStream
.pipe(source('min-flux.js'))
.pipe(buffer())
.pipe(babel())
.pipe(gulp.dest(buildDestination));
});
});
gulp.task('test', function() {
return gulp.src(['test/**/*.js'], { read: false })
.pipe(mocha({
reporter: 'dot',
}));
});
gulp.task('live-test', function() {
return gulp.watch(['index.js', 'lib/**/*.js', 'test/**/*.js'], ['test']);
});
gulp.task('default', ['test']);
| Add gulp task to run tests on file change. | Add gulp task to run tests on file change.
| JavaScript | mit | jnhuynh/min-flux | ---
+++
@@ -28,18 +28,14 @@
});
gulp.task('test', function() {
- var MinFlux = require('./index');
- var expect = require('chai').expect;
-
-
return gulp.src(['test/**/*.js'], { read: false })
.pipe(mocha({
reporter: 'dot',
- require: [
- './index',
- 'chai',
- ],
}));
});
+gulp.task('live-test', function() {
+ return gulp.watch(['index.js', 'lib/**/*.js', 'test/**/*.js'], ['test']);
+});
+
gulp.task('default', ['test']); |
59ca17998801770666c812e00942c0887ded1156 | gulpfile.js | gulpfile.js | var gulp = require('gulp');
var iife = require('gulp-iife');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
gulp.task('default', ['scripts']);
gulp.task('scripts', function () {
gulp.src('src/**/*.js')
.pipe(concat('vk-api-angular.js'))
.pipe(iife())
.pipe(gulp.dest('dist/'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
gulp.task('watch', ['default'], function () {
gulp.watch('src/**/*.js', ['scripts']);
});
| var gulp = require('gulp');
var iife = require('gulp-iife');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
gulp.task('default', ['scripts']);
gulp.task('scripts', function () {
return gulp.src('src/**/*.js')
.pipe(concat('vk-api-angular.js'))
.pipe(iife())
.pipe(gulp.dest('dist/'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
gulp.task('watch', ['default'], function () {
gulp.watch('src/**/*.js', ['scripts']);
});
| Add return statement to gulp task | Add return statement to gulp task
| JavaScript | mit | kefir500/vk-api-angular | ---
+++
@@ -7,7 +7,7 @@
gulp.task('default', ['scripts']);
gulp.task('scripts', function () {
- gulp.src('src/**/*.js')
+ return gulp.src('src/**/*.js')
.pipe(concat('vk-api-angular.js'))
.pipe(iife())
.pipe(gulp.dest('dist/')) |
0c5e8cd6c96275a1db428bc572bea0418e7b3c31 | gulpfile.js | gulpfile.js | var del = require('del');
var gulp = require('gulp');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var $ = require('gulp-load-plugins')();
var config = require('./webpack.config.js');
gulp.task('js', function (cb) {
webpack(config, function (err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
$.util.log("[webpack]", stats.toString({
colors: true
}));
cb();
});
});
gulp.task('html', function () {
gulp.src('./src/*.html')
.pipe(gulp.dest('./build'));
});
gulp.task('css', function () {
gulp.src('./src/css/*.css')
.pipe(gulp.dest('./build/css'));
});
gulp.task('clean', function (cb) {
del(['build']).then(cb);
});
gulp.task('build', ['html', 'css', 'js']);
gulp.task('dev', ['html', 'css'], function () {
// Start a webpack-dev-server
var compiler = webpack(config);
new WebpackDevServer(compiler, {
// server and middleware options
}).listen(8080, "localhost", function(err) {
if(err) throw new gutil.PluginError("webpack-dev-server", err);
// Server listening
$.util.log("[webpack-dev-server]", "http://localhost:8080/webpack-dev-server/index.html");
});
});
| var del = require('del');
var gulp = require('gulp');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var $ = require('gulp-load-plugins')();
var config = require('./webpack.config.js');
gulp.task('js', function (cb) {
webpack(config, function (err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
$.util.log("[webpack]", stats.toString({
colors: true
}));
cb();
});
});
gulp.task('html', function () {
gulp.src('./src/*.html')
.pipe(gulp.dest('./build'));
});
gulp.task('css', function () {
gulp.src('./src/css/*.css')
.pipe(gulp.dest('./build/css'));
});
gulp.task('clean', function (cb) {
del(['build']).then(function () {
cb()
});
});
gulp.task('build', ['html', 'css', 'js']);
gulp.task('dev', ['html', 'css'], function () {
// Start a webpack-dev-server
var compiler = webpack(config);
new WebpackDevServer(compiler, {
// server and middleware options
}).listen(8080, "localhost", function(err) {
if(err) throw new gutil.PluginError("webpack-dev-server", err);
// Server listening
$.util.log("[webpack-dev-server]", "http://localhost:8080/webpack-dev-server/index.html");
});
});
| Fix an error in the clean task | Fix an error in the clean task
| JavaScript | mit | darthmall/once-in-a-blue-moon,darthmall/once-in-a-blue-moon,darthmall/once-in-a-blue-moon | ---
+++
@@ -29,7 +29,9 @@
});
gulp.task('clean', function (cb) {
- del(['build']).then(cb);
+ del(['build']).then(function () {
+ cb()
+ });
});
gulp.task('build', ['html', 'css', 'js']); |
5f9884433df23b78ca063001cfb594081ca5bc35 | app/libs/utils/index.js | app/libs/utils/index.js | 'use strict';
module.exports = {
camelCase: require('./camel-case'),
colorString: require('./color-string'),
nestOptions: require('./nest-options'),
uid: require('./uid'),
request: require('./request'),
metadata: require('./metadata'),
framerate: require('./framerate'),
normalizeLanguage: require('./normalize-language'),
pad: require('./pad'),
output: require('./output')
};
| 'use strict';
module.exports = {
camelCase: require('./camel-case'),
colorString: require('./color-string'),
nestOptions: require('./nest-options'),
uid: require('./uid'),
request: require('./request'),
metadata: require('./metadata'),
framerate: require('./framerate'),
normalizeLanguage: require('./normalize-language'),
pad: require('./pad'),
output: require('./output'),
commandExists: require('./command-exists')
};
| Add command exists to utils | Add command exists to utils
| JavaScript | apache-2.0 | transmutejs/core | ---
+++
@@ -10,5 +10,6 @@
framerate: require('./framerate'),
normalizeLanguage: require('./normalize-language'),
pad: require('./pad'),
- output: require('./output')
+ output: require('./output'),
+ commandExists: require('./command-exists')
}; |
1cde6271d8b7a3c38dfb6e75f0229b670921238a | src/targets/native/ios-simulator.js | src/targets/native/ios-simulator.js | const createWebsocketTarget = require('./create-websocket-target');
const osnap = require('osnap/src/ios');
const saveScreenshotToFile = filename => osnap.saveToFile({ filename });
const createIOSSimulatorTarget = socketUri =>
createWebsocketTarget(socketUri, 'ios', saveScreenshotToFile);
module.exports = createIOSSimulatorTarget;
| const fs = require('fs-extra');
const osnap = require('osnap/src/ios');
const { withRetries } = require('../../failure-handling');
const createWebsocketTarget = require('./create-websocket-target');
const saveScreenshotToFile = withRetries(3)(async filename => {
await osnap.saveToFile({ filename });
const { size } = await fs.stat(filename);
if (size === 0) {
throw new Error('Screenshot failed ');
}
});
const createIOSSimulatorTarget = socketUri =>
createWebsocketTarget(socketUri, 'ios', saveScreenshotToFile);
module.exports = createIOSSimulatorTarget;
| Add retry mechanism for iOS screenshots | Add retry mechanism for iOS screenshots
| JavaScript | mit | oblador/loki,oblador/loki,oblador/loki | ---
+++
@@ -1,7 +1,15 @@
+const fs = require('fs-extra');
+const osnap = require('osnap/src/ios');
+const { withRetries } = require('../../failure-handling');
const createWebsocketTarget = require('./create-websocket-target');
-const osnap = require('osnap/src/ios');
-const saveScreenshotToFile = filename => osnap.saveToFile({ filename });
+const saveScreenshotToFile = withRetries(3)(async filename => {
+ await osnap.saveToFile({ filename });
+ const { size } = await fs.stat(filename);
+ if (size === 0) {
+ throw new Error('Screenshot failed ');
+ }
+});
const createIOSSimulatorTarget = socketUri =>
createWebsocketTarget(socketUri, 'ios', saveScreenshotToFile); |
c29eb1e9d74438621585ac56c239a92ba2eb503b | vendor/assets/javascripts/koi/form-for.js | vendor/assets/javascripts/koi/form-for.js | (function($) {
$(function(){
// https://stackoverflow.com/questions/20658402/internet-explorer-issue-with-html5-form-attribute-for-button-element
// detect if browser supports this
var sampleElement = $('[form]').get(0);
var isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window;
if (sampleElement && window.HTMLFormElement && sampleElement.form instanceof HTMLFormElement && !isIE11) {
// browser supports it, no need to fix
return;
}
$("body").on("click", "button[form]", function(e){
var $element = $(this);
var $form = $("#" + $element.attr("form"));
$form.submit();
});
});
})(jQuery); | (function($) {
$(function(){
// https://stackoverflow.com/questions/20658402/internet-explorer-issue-with-html5-form-attribute-for-button-element
// detect if browser supports this
$("body").on("click", "button[form]", function(e){
var $element = $(this);
var sampleElement = this;
if (sampleElement && window.HTMLFormElement && sampleElement.form instanceof HTMLFormElement) {
// browser supports it, no need to fix
return;
}
var $form = $("#" + $element.attr("form"));
$form.submit();
});
});
})(jQuery);
| Fix for Nav items duplicating | Fix for Nav items duplicating
| JavaScript | mit | katalyst/koi,katalyst/koi,katalyst/koi | ---
+++
@@ -1,17 +1,14 @@
(function($) {
$(function(){
-
// https://stackoverflow.com/questions/20658402/internet-explorer-issue-with-html5-form-attribute-for-button-element
// detect if browser supports this
- var sampleElement = $('[form]').get(0);
- var isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window;
- if (sampleElement && window.HTMLFormElement && sampleElement.form instanceof HTMLFormElement && !isIE11) {
- // browser supports it, no need to fix
- return;
- }
-
$("body").on("click", "button[form]", function(e){
var $element = $(this);
+ var sampleElement = this;
+ if (sampleElement && window.HTMLFormElement && sampleElement.form instanceof HTMLFormElement) {
+ // browser supports it, no need to fix
+ return;
+ }
var $form = $("#" + $element.attr("form"));
$form.submit();
}); |
8fa4ec3b7d2ba0145b16e6e2a1c8f9e7366e96de | webapp/client/app/transforms/timestamp.js | webapp/client/app/transforms/timestamp.js | import DS from 'ember-data';
import Firebase from 'firebase';
export default DS.DateTransform.extend({
serialize: function(date) {
if (date === Firebase.ServerValue.TIMESTAMP){
return date;
}
return this._super(date);
}
});
| import DS from 'ember-data';
import Firebase from 'firebase';
export default DS.DateTransform.extend({
serialize: function(date) {
if (date === Firebase.ServerValue.TIMESTAMP){
return date;
}
// to timestamp
return new Date(date).getTime();
}
});
| Fix date issue on edit | Fix date issue on edit
| JavaScript | agpl-3.0 | asm-products/autora,asm-products/autora,MartinMalinda/autora,MartinMalinda/autora,asm-products/autora,MartinMalinda/autora | ---
+++
@@ -7,6 +7,7 @@
return date;
}
- return this._super(date);
+ // to timestamp
+ return new Date(date).getTime();
}
}); |
ad736959264f0cdc2bae5fa0391569f432fb3c65 | 029-distinct-powers/javascript-solution.js | 029-distinct-powers/javascript-solution.js | exponentiateStrings = function(string1, string2) {
// must have a powers function for strings because 100 ** 100 is too high for JS...
}
// var powers = [];
// for (var a = 2; a <= 100; a++) {
// for (var b = 2; b <= 100; b++) {
// powers.push(exponentiateStrings(a.toString(), b.toString()));
// }
// }
// var distinctPowers = [];
// var usedPowers = {};
// powers.forEach(function(power) {
// if (!usedPowers[power]) {
// distinctPowers.push(power);
// }
// usedPowers[power] = true;
// })
// console.log(distinctPowers.length);
| require("../custom-methods")
// exponentiateStrings = function(string1, string2) {
// // must have a powers function for strings because 100 ** 100 is too high for JS...
// }
// var powers = [];
// for (var a = 2; a <= 100; a++) {
// for (var b = 2; b <= 100; b++) {
// powers.push(exponentiateStrings(a.toString(), b.toString()));
// }
// }
// var distinctPowers = [];
// var usedPowers = {};
// powers.forEach(function(power) {
// if (!usedPowers[power]) {
// distinctPowers.push(power);
// }
// usedPowers[power] = true;
// })
// console.log(distinctPowers.length);
| Add and require custom-methods file | Add and require custom-methods file
| JavaScript | mit | JacobCrofts/project-euler,JacobCrofts/project-euler,JacobCrofts/project-euler | ---
+++
@@ -1,6 +1,9 @@
-exponentiateStrings = function(string1, string2) {
- // must have a powers function for strings because 100 ** 100 is too high for JS...
-}
+require("../custom-methods")
+
+
+// exponentiateStrings = function(string1, string2) {
+// // must have a powers function for strings because 100 ** 100 is too high for JS...
+// }
// var powers = [];
|
2f58bac8452ec8981b5e8cc0ed45434768bf63ef | models/campground.js | models/campground.js | var mongoose = require('mongoose');
// SCHEMA SETUP:
var campgroundSchema = new mongoose.Schema({
name: String,
image: String,
description: String,
comments: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Comment'
}
]
});
module.exports = mongoose.model('Campground', campgroundSchema);
| var mongoose = require('mongoose');
// SCHEMA SETUP:
var campgroundSchema = new mongoose.Schema({
name: String,
image: String,
description: String,
author: {
id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
username: String
},
comments: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Comment'
}
]
});
module.exports = mongoose.model('Campground', campgroundSchema);
| Add relations between Campgrounds and User models. | Add relations between Campgrounds and User models.
| JavaScript | mit | JuanHenriquez/yelp-camp,JuanHenriquez/yelp-camp | ---
+++
@@ -5,6 +5,13 @@
name: String,
image: String,
description: String,
+ author: {
+ id: {
+ type: mongoose.Schema.Types.ObjectId,
+ ref: 'User'
+ },
+ username: String
+ },
comments: [
{
type: mongoose.Schema.Types.ObjectId, |
ef675c190419fcb18c426484ba707dfddf9b866c | lib/hooks.js | lib/hooks.js | 'use strict'
var http = require('http')
var shimmer = require('shimmer')
var asyncState = require('./async-state')
module.exports = function (client) {
shimmer({ logger: client.logger.error })
shimmer.massWrap(http.Server.prototype, ['on', 'addListener'], function (fn) {
return function (event, listener) {
if (event === 'request' && typeof listener === 'function') return fn.call(this, event, onRequest)
else return fn.apply(this, arguments)
function onRequest (req, res) {
asyncState.req = req
listener.apply(this, arguments)
}
}
})
}
| 'use strict'
var http = require('http')
var shimmer = require('shimmer')
var asyncState = require('./async-state')
module.exports = function (client) {
// TODO: This will actual just use the logger of the last client parsed in.
// In most use-cases this is a non-issue, but if someone tries to initiate
// multiple clients with different loggers, this will get weird
shimmer({ logger: client.logger.error })
shimmer.massWrap(http.Server.prototype, ['on', 'addListener'], function (fn) {
return function (event, listener) {
if (event === 'request' && typeof listener === 'function') return fn.call(this, event, onRequest)
else return fn.apply(this, arguments)
function onRequest (req, res) {
asyncState.req = req
listener.apply(this, arguments)
}
}
})
}
| Add TODO related to the auto-request hook feature | Add TODO related to the auto-request hook feature
| JavaScript | bsd-2-clause | opbeat/opbeat-node,opbeat/opbeat-node | ---
+++
@@ -5,7 +5,11 @@
var asyncState = require('./async-state')
module.exports = function (client) {
+ // TODO: This will actual just use the logger of the last client parsed in.
+ // In most use-cases this is a non-issue, but if someone tries to initiate
+ // multiple clients with different loggers, this will get weird
shimmer({ logger: client.logger.error })
+
shimmer.massWrap(http.Server.prototype, ['on', 'addListener'], function (fn) {
return function (event, listener) {
if (event === 'request' && typeof listener === 'function') return fn.call(this, event, onRequest) |
739fa1573e59dee5c862ecf1f5e0dd71342ddfcc | lib/index.js | lib/index.js |
var math = require('mathjs');
var ERROR_RESPONSE = 'I can\'t calculate that!';
module.exports = function(argv, response) {
var respBody = ERROR_RESPONSE;
try {
var expression = argv.slice(1).join('');
var result = math.eval(expression);
if (typeof result === 'function') {
console.error('Somehow got a function in a scalk eval');
}
else {
respBody = math.eval(expression).toString();
}
} catch(e) {
console.error(e);
}
response.end(respBody);
}
|
var math = require('mathjs');
var ERROR_RESPONSE = 'I can\'t calculate that!';
module.exports = function(argv, response, logger) {
var respBody = ERROR_RESPONSE;
try {
var expression = argv.slice(1).join('');
var result = math.eval(expression);
if (typeof result === 'function') {
logger.error('Somehow got a function in a scalk eval');
}
else {
respBody = math.eval(expression).toString();
}
} catch(e) {
logger.error(e);
}
response.end(respBody);
}
| Use the botstrap logger instead of console for logging | Use the botstrap logger instead of console for logging
| JavaScript | mit | elvinyung/scalk | ---
+++
@@ -3,7 +3,7 @@
var ERROR_RESPONSE = 'I can\'t calculate that!';
-module.exports = function(argv, response) {
+module.exports = function(argv, response, logger) {
var respBody = ERROR_RESPONSE;
try {
@@ -11,13 +11,13 @@
var result = math.eval(expression);
if (typeof result === 'function') {
- console.error('Somehow got a function in a scalk eval');
+ logger.error('Somehow got a function in a scalk eval');
}
else {
respBody = math.eval(expression).toString();
}
} catch(e) {
- console.error(e);
+ logger.error(e);
}
response.end(respBody); |
c4812b1d7f7164a5c23c1c723d564cfdac584680 | lib/praat.js | lib/praat.js | var info = require('./info');
var path = require('path');
var myPackageJson = require('../package.json');
var version = myPackageJson.praatVersion;
module.exports = [__dirname, '..', 'node_modules', '.bin', info.praatRealExecName(info.getOsInfo(), version)].join(path.sep);
| var info = require('./info');
var path = require('path');
var myPackageJson = require('../package.json');
var version = myPackageJson.praatVersion;
module.exports = path.resolve(__dirname, '..', 'node_modules', '.bin', info.praatRealExecName(info.getOsInfo(), version));
| Use path.resolve instead of string join | Use path.resolve instead of string join
| JavaScript | mit | motiz88/node-praat | ---
+++
@@ -2,4 +2,4 @@
var path = require('path');
var myPackageJson = require('../package.json');
var version = myPackageJson.praatVersion;
-module.exports = [__dirname, '..', 'node_modules', '.bin', info.praatRealExecName(info.getOsInfo(), version)].join(path.sep);
+module.exports = path.resolve(__dirname, '..', 'node_modules', '.bin', info.praatRealExecName(info.getOsInfo(), version)); |
a47d6f43d397f6ac52fabb3881056af9e8c0a86a | lib/utils.js | lib/utils.js | var STATUS_CODES = require('http');
exports.error = function (statusCode, message) {
var err;
if (message instanceof Error) {
err = message;
} else {
err = new Error(message || STATUS_CODES[statusCode]);
}
err.status = statusCode;
return err;
};
exports.extend = function extend(obj) {
Array.prototype.slice.call(arguments, 1).forEach(function (source) {
if (!source) { return; }
for (var key in source) {
obj[key] = source[key];
}
});
return obj;
};
| var STATUS_CODES = require('http').STATUS_CODES;
exports.error = function (statusCode, message) {
var err;
if (message instanceof Error) {
err = message;
} else {
err = new Error(message || STATUS_CODES[statusCode]);
}
err.status = statusCode;
return err;
};
exports.extend = function extend(obj) {
Array.prototype.slice.call(arguments, 1).forEach(function (source) {
if (!source) { return; }
for (var key in source) {
obj[key] = source[key];
}
});
return obj;
};
| Fix HTTP status code error messages | Fix HTTP status code error messages
| JavaScript | mit | ericf/open-marriage,HandyCodeJob/open-marriage,djscholl/open-marriage,djscholl/open-marriage,FerriNRachel/getting-married,FerriNRachel/getting-married | ---
+++
@@ -1,4 +1,4 @@
-var STATUS_CODES = require('http');
+var STATUS_CODES = require('http').STATUS_CODES;
exports.error = function (statusCode, message) {
var err; |
26bc33be05e3c4ec5403f8074bace5aa447dacf4 | demo/js/demo.js | demo/js/demo.js | 'use strict';
var require = typeof require === 'undefined' ? function() {} : require;
var React = window.React || require('react');
var ReactDom = window.ReactDOM || require('react-dom') || React;
var ElementPan = React.createFactory(window.reactElementPan || require('react-element-pan'));
// Simple image demo
ReactDom.render(
new ElementPan({
startX: 771,
startY: 360
}, React.DOM.img({ src: 'img/beer.jpg' })
), document.getElementById('image-demo'));
// Huge SVG demo
ReactDom.render(
new ElementPan({
startX: 1771,
startY: 1360
}, React.DOM.img({ src: 'img/metro.svg' })
), document.getElementById('map-demo'));
// Slightly more complicated DOM-element demo
var i = 20, themDivs = [];
while (--i) {
themDivs.push(React.DOM.div({
key: i,
style: {
width: i * 30,
lineHeight: (i * 10) + 'px'
}
}, 'Smaller...'));
}
ReactDom.render(
new ElementPan(null, themDivs),
document.getElementById('html-demo')
);
| 'use strict';
var require = typeof require === 'undefined' ? function() {} : require;
var React = window.React || require('react');
var ReactDom = window.ReactDOM || require('react-dom') || React;
var ElementPan = React.createFactory(window.reactElementPan || require('react-element-pan'));
if (React.initializeTouchEvents) {
React.initializeTouchEvents(true);
}
// Simple image demo
ReactDom.render(
new ElementPan({
startX: 771,
startY: 360
}, React.DOM.img({ src: 'img/beer.jpg' })
), document.getElementById('image-demo'));
// Huge SVG demo
ReactDom.render(
new ElementPan({
startX: 1771,
startY: 1360
}, React.DOM.img({ src: 'img/metro.svg' })
), document.getElementById('map-demo'));
// Slightly more complicated DOM-element demo
var i = 20, themDivs = [];
while (--i) {
themDivs.push(React.DOM.div({
key: i,
style: {
width: i * 30,
lineHeight: (i * 10) + 'px'
}
}, 'Smaller...'));
}
ReactDom.render(
new ElementPan(null, themDivs),
document.getElementById('html-demo')
);
| Enable touch events on old React versions | Enable touch events on old React versions
| JavaScript | mit | rexxars/react-element-pan | ---
+++
@@ -5,6 +5,10 @@
var React = window.React || require('react');
var ReactDom = window.ReactDOM || require('react-dom') || React;
var ElementPan = React.createFactory(window.reactElementPan || require('react-element-pan'));
+
+if (React.initializeTouchEvents) {
+ React.initializeTouchEvents(true);
+}
// Simple image demo
ReactDom.render( |
7a45d261a7720133c7004487f273915c48cfef7b | app/assets/javascripts/discourse/components/private_message_map_component.js | app/assets/javascripts/discourse/components/private_message_map_component.js | /**
The controls at the top of a private message in the map area.
@class PrivateMessageMapComponent
@extends Ember.Component
@namespace Discourse
@module Discourse
**/
Discourse.PrivateMessageMapComponent = Ember.View.extend({
templateName: 'components/private-message-map',
tagName: 'section',
classNames: ['information'],
details: Em.computed.alias('topic.details'),
init: function() {
this._super();
this.set('context', this);
this.set('controller', this);
},
actions: {
removeAllowedUser: function(user) {
var self = this;
bootbox.dialog(I18n.t("private_message_info.remove_allowed_user", {name: user.get('username')}), [
{label: I18n.t("no_value"),
'class': 'btn-danger rightg'},
{label: I18n.t("yes_value"),
'class': 'btn-primary',
callback: function() {
self.get('topic.details').removeAllowedUser(user);
}
}
]);
},
showPrivateInvite: function() {
this.sendAction('showPrivateInviteAction');
}
}
});
| /**
The controls at the top of a private message in the map area.
@class PrivateMessageMapComponent
@extends Ember.Component
@namespace Discourse
@module Discourse
**/
Discourse.PrivateMessageMapComponent = Ember.View.extend({
templateName: 'components/private-message-map',
tagName: 'section',
classNames: ['information'],
details: Em.computed.alias('topic.details'),
init: function() {
this._super();
this.set('context', this);
},
actions: {
removeAllowedUser: function(user) {
var self = this;
bootbox.dialog(I18n.t("private_message_info.remove_allowed_user", {name: user.get('username')}), [
{label: I18n.t("no_value"),
'class': 'btn-danger rightg'},
{label: I18n.t("yes_value"),
'class': 'btn-primary',
callback: function() {
self.get('topic.details').removeAllowedUser(user);
}
}
]);
},
showPrivateInvite: function() {
this.get('controller').send('showPrivateInviteAction');
}
}
});
| Fix inviting others to private messages. | Fix inviting others to private messages.
| JavaScript | mit | natefinch/discourse,natefinch/discourse | ---
+++
@@ -15,7 +15,6 @@
init: function() {
this._super();
this.set('context', this);
- this.set('controller', this);
},
actions: {
@@ -34,7 +33,7 @@
},
showPrivateInvite: function() {
- this.sendAction('showPrivateInviteAction');
+ this.get('controller').send('showPrivateInviteAction');
}
}
|
2d9feaa714088dafc473434b8a57e559b3416a5d | kolibri/plugins/learn/assets/src/modules/pluginModule.js | kolibri/plugins/learn/assets/src/modules/pluginModule.js | import mutations from './coreLearn/mutations';
import * as getters from './coreLearn/getters';
import * as actions from './coreLearn/actions';
import classAssignments from './classAssignments';
import classes from './classes';
import examReportViewer from './examReportViewer';
import examViewer from './examViewer';
import lessonPlaylist from './lessonPlaylist';
import topicsTree from './topicsTree';
import plugin_data from 'plugin_data';
export default {
state() {
return {
pageName: '',
rootNodes: [],
canAccessUnassignedContentSetting: plugin_data.allowLearnerUnassignedResourceAccess,
allowGuestAccess: plugin_data.allowGuestAccess,
};
},
actions,
getters,
mutations,
modules: {
classAssignments,
classes,
examReportViewer,
examViewer,
lessonPlaylist,
topicsTree,
},
};
| import { PageNames, ClassesPageNames } from './../constants';
import mutations from './coreLearn/mutations';
import * as getters from './coreLearn/getters';
import * as actions from './coreLearn/actions';
import classAssignments from './classAssignments';
import classes from './classes';
import examReportViewer from './examReportViewer';
import examViewer from './examViewer';
import lessonPlaylist from './lessonPlaylist';
import topicsTree from './topicsTree';
import plugin_data from 'plugin_data';
export default {
state() {
return {
pageName: '',
rootNodes: [],
canAccessUnassignedContentSetting: plugin_data.allowLearnerUnassignedResourceAccess,
allowGuestAccess: plugin_data.allowGuestAccess,
};
},
actions,
getters: {
...getters,
learnPageLinks() {
const params = {};
return {
HomePage: {
name: PageNames.HOME,
params,
},
LibraryPage: {
name: PageNames.LIBRARY,
params,
},
TopicsPage: {
name: PageNames.TOPICS_TOPIC,
params,
},
TopicsSearchPage: {
name: PageNames.TOPICS_TOPIC_SEARCH,
params,
},
ContentUnavailablePage: {
name: PageNames.CONTENT_UNAVAILABLE,
params,
},
BookmarksPage: {
name: PageNames.BOOKMARKS,
params,
},
ExamPage: id => {
return {
name: ClassesPageNames.EXAM_VIWER,
params: { params, quizId: id },
};
},
ExamReportViewer: {
name: ClassesPageNames.EXAM_REPORT_VIEWER,
params,
},
AllClassesPage: {
name: ClassesPageNames.ALL_CLASSES,
params,
},
ClassAssignmentsPage: {
name: ClassesPageNames.CLASS_ASSIGNMENTS,
params,
},
LessonPlaylistPage: {
name: ClassesPageNames.LESSON_PLAYLIST,
params,
},
};
},
},
mutations,
modules: {
classAssignments,
classes,
examReportViewer,
examViewer,
lessonPlaylist,
topicsTree,
},
};
| Update learn getters to create page link references | Update learn getters to create page link references
| JavaScript | mit | learningequality/kolibri,learningequality/kolibri,learningequality/kolibri,learningequality/kolibri | ---
+++
@@ -1,3 +1,4 @@
+import { PageNames, ClassesPageNames } from './../constants';
import mutations from './coreLearn/mutations';
import * as getters from './coreLearn/getters';
import * as actions from './coreLearn/actions';
@@ -20,7 +21,60 @@
};
},
actions,
- getters,
+ getters: {
+ ...getters,
+ learnPageLinks() {
+ const params = {};
+ return {
+ HomePage: {
+ name: PageNames.HOME,
+ params,
+ },
+ LibraryPage: {
+ name: PageNames.LIBRARY,
+ params,
+ },
+ TopicsPage: {
+ name: PageNames.TOPICS_TOPIC,
+ params,
+ },
+ TopicsSearchPage: {
+ name: PageNames.TOPICS_TOPIC_SEARCH,
+ params,
+ },
+ ContentUnavailablePage: {
+ name: PageNames.CONTENT_UNAVAILABLE,
+ params,
+ },
+ BookmarksPage: {
+ name: PageNames.BOOKMARKS,
+ params,
+ },
+ ExamPage: id => {
+ return {
+ name: ClassesPageNames.EXAM_VIWER,
+ params: { params, quizId: id },
+ };
+ },
+ ExamReportViewer: {
+ name: ClassesPageNames.EXAM_REPORT_VIEWER,
+ params,
+ },
+ AllClassesPage: {
+ name: ClassesPageNames.ALL_CLASSES,
+ params,
+ },
+ ClassAssignmentsPage: {
+ name: ClassesPageNames.CLASS_ASSIGNMENTS,
+ params,
+ },
+ LessonPlaylistPage: {
+ name: ClassesPageNames.LESSON_PLAYLIST,
+ params,
+ },
+ };
+ },
+ },
mutations,
modules: {
classAssignments, |
b223c3f57215b8e42ee1792d507c146afad1129d | test/subscribers.js | test/subscribers.js | /* global describe, it */
'use strict'
var expect = require('expect.js')
var MailerLite = require('..')
var ML = new MailerLite()
const LIST_NAME = 'Mocha Test'
const TEST_SUBSCRIBERS = [
{
email: 'foo@bar.com',
name: 'Foo Bar'
},
{
email: 'john@doe.net',
name: 'John Doe'
}
]
describe('Subscribers', () => {
it('should add a subscriber to a new list and remove it immediately', (done) => {
let list_id = 0
let user = TEST_SUBSCRIBERS[0]
ML.Lists.addList(LIST_NAME)
.then((data) => {
list_id = data.id
return ML.Subscribers.addSubscriber(list_id, user.email, user.name)
})
.then((data) => {
expect(data.email).to.be.equal(user.email)
return ML.Subscribers.deleteSubscriber(list_id, user.email)
})
.then((data) => {
return ML.Lists.removeList(list_id)
})
.then(() => {
done()
})
})
})
| Test to add a subscriber to new list and remove it. | Test to add a subscriber to new list and remove it.
| JavaScript | mit | fmoliveira/mailerlite-sdk-nodejs,fmoliveira/mailerlite-sdk-nodejs | ---
+++
@@ -0,0 +1,44 @@
+/* global describe, it */
+
+'use strict'
+
+var expect = require('expect.js')
+
+var MailerLite = require('..')
+var ML = new MailerLite()
+
+const LIST_NAME = 'Mocha Test'
+
+const TEST_SUBSCRIBERS = [
+ {
+ email: 'foo@bar.com',
+ name: 'Foo Bar'
+ },
+ {
+ email: 'john@doe.net',
+ name: 'John Doe'
+ }
+]
+
+describe('Subscribers', () => {
+ it('should add a subscriber to a new list and remove it immediately', (done) => {
+ let list_id = 0
+ let user = TEST_SUBSCRIBERS[0]
+
+ ML.Lists.addList(LIST_NAME)
+ .then((data) => {
+ list_id = data.id
+ return ML.Subscribers.addSubscriber(list_id, user.email, user.name)
+ })
+ .then((data) => {
+ expect(data.email).to.be.equal(user.email)
+ return ML.Subscribers.deleteSubscriber(list_id, user.email)
+ })
+ .then((data) => {
+ return ML.Lists.removeList(list_id)
+ })
+ .then(() => {
+ done()
+ })
+ })
+}) | |
8de92e7e3acee87e6bf9b2932a56783d0d3ebacf | test/test-github.js | test/test-github.js | "use strict";
const {expect} = require("chai");
before(() => {
browser.url("/login");
browser.setCookie({
name: "user_session",
value: process.env.USER_SESSION,
});
});
describe("Pull Requests (listings)", () => {
it("should redact the author", () => {
browser.url("/pulls/mentioned");
const prInfo = $(".opened-by").getText();
expect(prInfo).to.match(/^#1 opened \d+ days ago by$/);
});
});
| "use strict";
const {expect} = require("chai");
before(() => {
browser.url("/login");
browser.setCookie({
name: "user_session",
value: process.env.USER_SESSION,
});
});
describe("Pull Requests (listings)", () => {
it("should redact the author", () => {
browser.url("/pulls/mentioned");
const prInfo = $(".opened-by").getText();
expect(prInfo).to.match(/^#1 opened \d+ days ago by$/);
});
});
describe("(single) Pull Request Page", () => {
it("should redact the author", () => {
browser.url("/zombie/testing-reviews/pull/3");
const topFlash = $("div.flash > div").getText();
expect(topFlash).to.equal("requested your review on this pull request.");
const commentInfo = $("h3.timeline-comment-header-text").getText();
expect(commentInfo).to.match(/^commented \d+ days ago$/);
const avatar = $("a.participant-avatar").isVisible();
expect(avatar).to.be.false;
});
});
| Add test for PR page, check if author is redacted | Add test for PR page, check if author is redacted
| JavaScript | mit | zombie/blind-reviews,zombie/blind-reviews | ---
+++
@@ -19,3 +19,18 @@
expect(prInfo).to.match(/^#1 opened \d+ days ago by$/);
});
});
+
+describe("(single) Pull Request Page", () => {
+ it("should redact the author", () => {
+ browser.url("/zombie/testing-reviews/pull/3");
+
+ const topFlash = $("div.flash > div").getText();
+ expect(topFlash).to.equal("requested your review on this pull request.");
+
+ const commentInfo = $("h3.timeline-comment-header-text").getText();
+ expect(commentInfo).to.match(/^commented \d+ days ago$/);
+
+ const avatar = $("a.participant-avatar").isVisible();
+ expect(avatar).to.be.false;
+ });
+}); |
20476caed9ff374a9b201b057d2dcff3522c6ca4 | test/typeOf-test.js | test/typeOf-test.js | "use strict";
var buster = require("buster");
var sinon = require("../lib/sinon");
var assert = buster.assert;
buster.testCase("sinon.typeOf", {
"returns boolean": function () {
assert.equals(sinon.typeOf(false), "boolean");
},
"returns string": function () {
assert.equals(sinon.typeOf("Sinon.JS"), "string");
},
"returns number": function () {
assert.equals(sinon.typeOf(123), "number");
},
"returns object": function () {
assert.equals(sinon.typeOf({}), "object");
},
"returns function": function () {
assert.equals(sinon.typeOf(function () {}), "function");
},
"returns undefined": function () {
assert.equals(sinon.typeOf(undefined), "undefined");
},
"returns null": function () {
assert.equals(sinon.typeOf(null), "null");
},
"returns array": function () {
assert.equals(sinon.typeOf([]), "array");
},
"returns regexp": function () {
assert.equals(sinon.typeOf(/.*/), "regexp");
},
"returns date": function () {
assert.equals(sinon.typeOf(new Date()), "date");
}
});
| /*eslint-env mocha*/
/*eslint max-nested-callbacks: 0*/
"use strict";
var referee = require("referee");
var sinon = require("../lib/sinon");
var assert = referee.assert;
describe("sinon.typeOf", function () {
it("returns boolean", function () {
assert.equals(sinon.typeOf(false), "boolean");
});
it("returns string", function () {
assert.equals(sinon.typeOf("Sinon.JS"), "string");
});
it("returns number", function () {
assert.equals(sinon.typeOf(123), "number");
});
it("returns object", function () {
assert.equals(sinon.typeOf({}), "object");
});
it("returns function", function () {
assert.equals(sinon.typeOf(function () {}), "function");
});
it("returns undefined", function () {
assert.equals(sinon.typeOf(undefined), "undefined");
});
it("returns null", function () {
assert.equals(sinon.typeOf(null), "null");
});
it("returns array", function () {
assert.equals(sinon.typeOf([]), "array");
});
it("returns regexp", function () {
assert.equals(sinon.typeOf(/.*/), "regexp");
});
it("returns date", function () {
assert.equals(sinon.typeOf(new Date()), "date");
});
});
| Convert typeof tests to mocha | Convert typeof tests to mocha
| JavaScript | bsd-3-clause | fatso83/Sinon.JS,Khan/Sinon.JS,Khan/Sinon.JS,fatso83/Sinon.JS,jishi/sinon,mroderick/Sinon.JS,mroderick/Sinon.JS,jishi/sinon,Khan/Sinon.JS,cjohansen/Sinon.JS,fatso83/Sinon.JS,cjohansen/Sinon.JS,jishi/sinon,andpor/sinon,andpor/sinon,mroderick/Sinon.JS,andpor/sinon,cjohansen/Sinon.JS | ---
+++
@@ -1,47 +1,49 @@
+/*eslint-env mocha*/
+/*eslint max-nested-callbacks: 0*/
"use strict";
-var buster = require("buster");
+var referee = require("referee");
var sinon = require("../lib/sinon");
-var assert = buster.assert;
+var assert = referee.assert;
-buster.testCase("sinon.typeOf", {
- "returns boolean": function () {
+describe("sinon.typeOf", function () {
+ it("returns boolean", function () {
assert.equals(sinon.typeOf(false), "boolean");
- },
+ });
- "returns string": function () {
+ it("returns string", function () {
assert.equals(sinon.typeOf("Sinon.JS"), "string");
- },
+ });
- "returns number": function () {
+ it("returns number", function () {
assert.equals(sinon.typeOf(123), "number");
- },
+ });
- "returns object": function () {
+ it("returns object", function () {
assert.equals(sinon.typeOf({}), "object");
- },
+ });
- "returns function": function () {
+ it("returns function", function () {
assert.equals(sinon.typeOf(function () {}), "function");
- },
+ });
- "returns undefined": function () {
+ it("returns undefined", function () {
assert.equals(sinon.typeOf(undefined), "undefined");
- },
+ });
- "returns null": function () {
+ it("returns null", function () {
assert.equals(sinon.typeOf(null), "null");
- },
+ });
- "returns array": function () {
+ it("returns array", function () {
assert.equals(sinon.typeOf([]), "array");
- },
+ });
- "returns regexp": function () {
+ it("returns regexp", function () {
assert.equals(sinon.typeOf(/.*/), "regexp");
- },
+ });
- "returns date": function () {
+ it("returns date", function () {
assert.equals(sinon.typeOf(new Date()), "date");
- }
+ });
}); |
fb6bb2e453ea1b49593df36addb5c7f90f683452 | client/src/actions/index.js | client/src/actions/index.js | import * as types from './ActionTypes'
import axios from 'axios'
export function addPattern(name, pattern) {
return {
type: types.ADD_PATTERN,
name: name,
pattern: pattern
}
}
export function selectPattern(pattern) {
return {
type: types.SELECT_PATTERN,
name: pattern
}
}
export function deselectPattern(pattern) {
return {
type: types.DESELECT_PATTERN,
name: pattern
}
}
export function changeText(text) {
return function(dispatch) {
dispatch(requestData(text))
}
}
export function requestData() {
return {
type: types.REQUEST_DATA
}
}
export function receiveData(json) {
return {
type: types.RECEIVE_DATA,
data: json
}
}
export function receiveError(json) {
return {
type: types.RECEIVE_ERROR,
data: json
}
}
export function evaluateText(pattern, text) {
return function(dispatch) {
dispatch(requestData())
return axios.post('http://api.riveter.site/v1/process/', {
pattern: pattern,
textContent: text
})
.then(function(data) {
dispatch(receiveData(data))
})
.catch(function(err) {
dispatch(receiveError(err))
})
}
}
| import * as types from './ActionTypes'
import axios from 'axios'
export function addPattern(name, pattern) {
return {
type: types.ADD_PATTERN,
name: name,
pattern: pattern
}
}
export function selectPattern(pattern) {
return {
type: types.SELECT_PATTERN,
name: pattern
}
}
export function deselectPattern(pattern) {
return {
type: types.DESELECT_PATTERN,
name: pattern
}
}
export function changeText(text) {
return function(dispatch) {
dispatch(requestData(text))
}
}
export function requestData() {
return {
type: types.REQUEST_DATA
}
}
export function receiveData(json) {
return {
type: types.RECEIVE_DATA,
data: json
}
}
export function receiveError(json) {
return {
type: types.RECEIVE_ERROR,
data: json
}
}
export function evaluateText(pattern, text) {
return function(dispatch) {
dispatch(requestData())
return axios.post('https://api.riveter.site/v1/process/', {
pattern: pattern,
textContent: text
})
.then(function(data) {
dispatch(receiveData(data))
})
.catch(function(err) {
dispatch(receiveError(err))
})
}
}
| Fix URL to use HTTPS. | Fix URL to use HTTPS.
| JavaScript | mit | Subzidion/riveter,Subzidion/riveter,Subzidion/riveter | ---
+++
@@ -52,7 +52,7 @@
export function evaluateText(pattern, text) {
return function(dispatch) {
dispatch(requestData())
- return axios.post('http://api.riveter.site/v1/process/', {
+ return axios.post('https://api.riveter.site/v1/process/', {
pattern: pattern,
textContent: text
}) |
025610aea87b2cec86855b29c7042a6b37c35de5 | lib/initializer.js | lib/initializer.js | "use strict";
var
Promise = require('./promise');
module.exports = function (API) {
var
self = Object.create(null),
promise = Promise.resolve(API);
self.init = function (initializer) {
promise = promise.then(function () {
return initializer(API);
});
return self;
};
return self;
};
| "use strict";
var
Promise = require('./promise');
module.exports = function (API) {
var
self = Object.create(null),
initializers = [],
promise = Promise.resolve(API);
self.init = function (initializer) {
initializers.push(initializer);
promise = promise.then(function () {
initializer(API);
return initializer.stop().then(initializer.start);
});
return self;
};
self.stop = function () {
return Promise.all(initializers.map(function (initializer) {
if (initializer && initializer.stop) {
return initializer.stop();
} else {
return Promise.resolve(true);
}
}));
};
return self;
};
| Add stop() method to Initializer. | Add stop() method to Initializer.
modified: lib/initializer.js
| JavaScript | mit | kixxauth/enginemill | ---
+++
@@ -6,15 +6,28 @@
module.exports = function (API) {
var
- self = Object.create(null),
- promise = Promise.resolve(API);
+ self = Object.create(null),
+ initializers = [],
+ promise = Promise.resolve(API);
self.init = function (initializer) {
+ initializers.push(initializer);
promise = promise.then(function () {
- return initializer(API);
+ initializer(API);
+ return initializer.stop().then(initializer.start);
});
return self;
};
+ self.stop = function () {
+ return Promise.all(initializers.map(function (initializer) {
+ if (initializer && initializer.stop) {
+ return initializer.stop();
+ } else {
+ return Promise.resolve(true);
+ }
+ }));
+ };
+
return self;
}; |
b5a4f896615b9a15f0cb975982447a96e0959368 | migrations/util.js | migrations/util.js | var stream = require('stream')
var mongoose = require('mongoose')
exports.mongoose = mongoose
exports.connectMongoose = function() {
mongoose.connect(process.env.MONGO_URL || 'mongodb://localhost/meku')
return this
}
exports.progressMonitor = function(num) {
var ii = 0
var tick = num || 250
return function(char) {
if (ii++ % tick == 0) process.stdout.write(char || '.')
}
}
exports.consumer = function(onRow, callback) {
var s = new stream.Writable({ objectMode: true })
s._write = function(row, enc, cb) { onRow(row, cb) }
s.on('finish', callback)
return s
}
exports.done = function(err) {
if (err) throw err
mongoose.disconnect(function() {
console.log('DONE.')
})
} | var stream = require('stream')
var mongoose = require('mongoose')
exports.mongoose = mongoose
exports.connectMongoose = function() {
mongoose.connect(process.env.MONGOHQ_URL || 'mongodb://localhost/meku')
return this
}
exports.progressMonitor = function(num) {
var ii = 0
var tick = num || 250
return function(char) {
if (ii++ % tick == 0) process.stdout.write(char || '.')
}
}
exports.consumer = function(onRow, callback) {
var s = new stream.Writable({ objectMode: true })
s._write = function(row, enc, cb) { onRow(row, cb) }
s.on('finish', callback)
return s
}
exports.done = function(err) {
if (err) throw err
mongoose.disconnect(function() {
console.log('DONE.')
})
}
| Fix migrations mongo url variable | Fix migrations mongo url variable
| JavaScript | mit | kavi-fi/meku,kavi-fi/meku,kavi-fi/meku | ---
+++
@@ -4,7 +4,7 @@
exports.mongoose = mongoose
exports.connectMongoose = function() {
- mongoose.connect(process.env.MONGO_URL || 'mongodb://localhost/meku')
+ mongoose.connect(process.env.MONGOHQ_URL || 'mongodb://localhost/meku')
return this
}
|
31fb423a90cdb5445bf1d3fada17195a85773e1e | gruntfile.js | gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkgFile: 'package.json',
clean: ['build'],
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: './lib',
src: 'index.js',
dest: 'build/index.js',
ext: '.js'
}]
}
},
watch: {
dist: {
files: 'index.js',
task: ['babel:dist']
}
},
eslint: {
options: {
parser: 'babel-eslint'
},
target: ['index.js']
},
contributors: {
options: {
commitMessage: 'update contributors'
}
},
bump: {
options: {
commitMessage: 'v%VERSION%',
pushTo: 'upstream'
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['build']);
grunt.registerTask('build', 'Build wdio-sync', function() {
grunt.task.run([
'eslint',
'clean',
'babel'
]);
});
grunt.registerTask('release', 'Bump and tag version', function(type) {
grunt.task.run([
'build',
'contributors',
'bump:' + (type || 'patch')
]);
});
};
| module.exports = function(grunt) {
grunt.initConfig({
pkgFile: 'package.json',
clean: ['build'],
babel: {
options: {
sourceMap: false
},
dist: {
src: 'index.js',
dest: 'build/index.js'
}
},
watch: {
dist: {
files: 'index.js',
task: ['babel:dist']
}
},
eslint: {
options: {
parser: 'babel-eslint'
},
target: ['index.js']
},
contributors: {
options: {
commitMessage: 'update contributors'
}
},
bump: {
options: {
commitMessage: 'v%VERSION%',
pushTo: 'upstream'
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['build']);
grunt.registerTask('build', 'Build wdio-sync', function() {
grunt.task.run([
'eslint',
'clean',
'babel'
]);
});
grunt.registerTask('release', 'Bump and tag version', function(type) {
grunt.task.run([
'build',
'contributors',
'bump:' + (type || 'patch')
]);
});
};
| Revert "Add a babel task to watch which works" | Revert "Add a babel task to watch which works"
This reverts commit 9b22494b461448d9e75e153610c1629d8e455074.
| JavaScript | mit | webdriverio/wdio-sync | ---
+++
@@ -7,13 +7,8 @@
sourceMap: false
},
dist: {
- files: [{
- expand: true,
- cwd: './lib',
- src: 'index.js',
- dest: 'build/index.js',
- ext: '.js'
- }]
+ src: 'index.js',
+ dest: 'build/index.js'
}
},
watch: { |
5503337e5452e62eb7bb8b77b4cf4dccb6703015 | components/icon/Icon.js | components/icon/Icon.js | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Box from '../box';
import cx from 'classnames';
import theme from './theme.css';
class Icon extends PureComponent {
static propTypes = {
children: PropTypes.any,
className: PropTypes.string,
color: PropTypes.oneOf(['neutral', 'mint', 'violet', 'ruby', 'gold', 'aqua', 'teal']),
opacity: PropTypes.number,
tint: PropTypes.oneOf(['lightest', 'light', 'normal', 'dark', 'darkest']),
};
static defaultProps = {
color: 'teal',
tint: 'normal',
opacity: 0.84,
};
render() {
const { children, className, color, tint, opacity, ...others } = this.props;
const classNames = cx(theme[color], theme[tint], className);
return (
<Box className={classNames} data-teamleader-ui="icon" element="span" {...others}>
{React.Children.map(children, child => {
return React.cloneElement(child, {
opacity,
});
})}
</Box>
);
}
}
export default Icon;
| import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Box from '../box';
import cx from 'classnames';
import theme from './theme.css';
class Icon extends PureComponent {
static propTypes = {
children: PropTypes.any,
className: PropTypes.string,
color: PropTypes.oneOf(['neutral', 'mint', 'violet', 'ruby', 'gold', 'aqua', 'teal']),
opacity: PropTypes.number,
tint: PropTypes.oneOf(['lightest', 'light', 'normal', 'dark', 'darkest']),
};
static defaultProps = {
color: 'teal',
tint: 'normal',
opacity: 0.84,
};
render() {
const { children, className, color, tint, opacity, ...others } = this.props;
const classNames = cx(theme[color], theme[tint], className);
return (
<Box className={classNames} data-teamleader-ui="icon" element="span" {...others}>
{React.Children.map(children, child => {
// Check if child is an actual React component
// if so, pass the needed props. If not, just render it.
if (!child.type) {
return child;
}
return React.cloneElement(child, {
opacity,
});
})}
</Box>
);
}
}
export default Icon;
| Add extra check to ensure child is an actual React component | Add extra check to ensure child is an actual React component
| JavaScript | mit | teamleadercrm/teamleader-ui | ---
+++
@@ -27,6 +27,12 @@
return (
<Box className={classNames} data-teamleader-ui="icon" element="span" {...others}>
{React.Children.map(children, child => {
+ // Check if child is an actual React component
+ // if so, pass the needed props. If not, just render it.
+ if (!child.type) {
+ return child;
+ }
+
return React.cloneElement(child, {
opacity,
}); |
af8887e9c755638f306cc17617c62e0032d31912 | Apps/CesiumViewer/CesiumViewer.profile.js | Apps/CesiumViewer/CesiumViewer.profile.js | var profile = {
basePath : '../..',
baseUrl : '.',
releaseDir : './Build/Apps/CesiumViewer',
action : 'release',
cssOptimize : 'comments',
mini : true,
optimize : 'closure',
layerOptimize : 'closure',
stripConsole : 'all',
selectorEngine : 'acme',
layers : {
'dojo/dojo' : {
include : ['dojo/dojo', 'CesiumViewer/CesiumViewer', 'CesiumViewer/boot'],
boot : true,
customBase : true
}
},
packages : [{
name : 'CesiumViewer',
destLocation : '.'
}],
staticHasFeatures : {
'dojo-trace-api' : 0,
'dojo-log-api' : 0,
'dojo-publish-privates' : 0,
'dojo-sync-loader' : 0,
'dojo-xhr-factory' : 0,
'dojo-test-sniff' : 0
},
resourceTags : {
miniExclude : function(filename, mid) {
"use strict";
return mid in {
'CesiumViewer/CesiumViewer.profile' : 1
};
},
amd : function(filename, mid) {
"use strict";
return (/\.js$/).test(filename);
}
}
}; | var profile = {
basePath : '../..',
baseUrl : '.',
releaseDir : './Build/Apps/CesiumViewer',
action : 'release',
cssOptimize : 'comments',
mini : true,
optimize : 'closure',
layerOptimize : 'closure',
stripConsole : 'all',
selectorEngine : 'acme',
layers : {
'dojo/dojo' : {
include : ['dojo/dojo', 'CesiumViewer/CesiumViewer', 'CesiumViewer/boot'],
boot : true,
customBase : true
}
},
packages : [{
name : 'CesiumViewer',
destLocation : '.'
}],
staticHasFeatures : {
'dojo-trace-api' : 0,
'dojo-log-api' : 0,
'dojo-publish-privates' : 0,
'dojo-sync-loader' : 0,
'dojo-xhr-factory' : 0,
'dojo-test-sniff' : 0,
'dom-addeventlistener' : 1,
'dojo-firebug' : 0
},
resourceTags : {
miniExclude : function(filename, mid) {
"use strict";
return mid in {
'CesiumViewer/CesiumViewer.profile' : 1
};
},
amd : function(filename, mid) {
"use strict";
return (/\.js$/).test(filename);
}
}
}; | Tweak CesiumViewer build to avoid some warnings. | Tweak CesiumViewer build to avoid some warnings.
| JavaScript | apache-2.0 | progsung/cesium,aelatgt/cesium,CesiumGS/cesium,NaderCHASER/cesium,esraerik/cesium,ggetz/cesium,jason-crow/cesium,CesiumGS/cesium,kiselev-dv/cesium,wallw-bits/cesium,soceur/cesium,oterral/cesium,kiselev-dv/cesium,kaktus40/cesium,omh1280/cesium,CesiumGS/cesium,denverpierce/cesium,geoscan/cesium,YonatanKra/cesium,emackey/cesium,kiselev-dv/cesium,ggetz/cesium,AnimatedRNG/cesium,likangning93/cesium,aelatgt/cesium,NaderCHASER/cesium,jasonbeverage/cesium,oterral/cesium,likangning93/cesium,emackey/cesium,denverpierce/cesium,wallw-bits/cesium,aelatgt/cesium,esraerik/cesium,oterral/cesium,likangning93/cesium,likangning93/cesium,jason-crow/cesium,CesiumGS/cesium,wallw-bits/cesium,kaktus40/cesium,hodbauer/cesium,CesiumGS/cesium,emackey/cesium,ggetz/cesium,soceur/cesium,jason-crow/cesium,esraerik/cesium,kiselev-dv/cesium,ggetz/cesium,AnalyticalGraphicsInc/cesium,omh1280/cesium,YonatanKra/cesium,jasonbeverage/cesium,AnimatedRNG/cesium,YonatanKra/cesium,esraerik/cesium,AnimatedRNG/cesium,denverpierce/cesium,YonatanKra/cesium,AnalyticalGraphicsInc/cesium,AnimatedRNG/cesium,soceur/cesium,progsung/cesium,omh1280/cesium,hodbauer/cesium,geoscan/cesium,omh1280/cesium,likangning93/cesium,NaderCHASER/cesium,wallw-bits/cesium,denverpierce/cesium,hodbauer/cesium,josh-bernstein/cesium,aelatgt/cesium,josh-bernstein/cesium,jason-crow/cesium,emackey/cesium | ---
+++
@@ -28,7 +28,9 @@
'dojo-publish-privates' : 0,
'dojo-sync-loader' : 0,
'dojo-xhr-factory' : 0,
- 'dojo-test-sniff' : 0
+ 'dojo-test-sniff' : 0,
+ 'dom-addeventlistener' : 1,
+ 'dojo-firebug' : 0
},
resourceTags : { |
fd4522d63e7d9dc18abc03f16fc5cf00a59409d9 | lib/generators/half_pipe/templates/tasks/options/watch.js | lib/generators/half_pipe/templates/tasks/options/watch.js | module.exports = {
debug: {
files: ['app/scripts/**/*', 'app/styles/**/*'],
tasks: ['build:debug']
},
rails: {
files: ['config/**/*.rb', 'lib/**/*.rb', 'Gemfile.lock'],
tasks: ['rails:server:restart'],
options: {
interrupt: true
}
}
};
| module.exports = {
debug: {
files: ['app/scripts/**/*', 'app/styles/**/*', 'config/build.js'],
tasks: ['build:debug']
},
rails: {
files: ['config/**/*.rb', 'lib/**/*.rb', 'Gemfile.lock'],
tasks: ['rails:server:restart'],
options: {
interrupt: true
}
}
};
| Watch for build configuration changes | Watch for build configuration changes
| JavaScript | mit | half-pipe/half-pipe,half-pipe/half-pipe | ---
+++
@@ -1,6 +1,6 @@
module.exports = {
debug: {
- files: ['app/scripts/**/*', 'app/styles/**/*'],
+ files: ['app/scripts/**/*', 'app/styles/**/*', 'config/build.js'],
tasks: ['build:debug']
},
rails: { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.