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 |
|---|---|---|---|---|---|---|---|---|---|---|
36da606092c93c31e6c6bc64eeacdfaa4198be44 | .eslintrc.js | .eslintrc.js | // See http://eslint.org/docs/
module.exports = {
env: {es6: true, commonjs: true},
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {jsx: true}
},
extends: ['eslint:recommended', 'google'],
plugins: ['react'],
rules: {
'max-len': ['error', 100],
'require-jsdoc': 'off',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'no-invalid-this': 'off', // It's buggy
'arrow-parens': ['error', 'as-needed']
}
}
| // See http://eslint.org/docs/
module.exports = {
env: {es6: true, commonjs: true},
parserOptions: {
ecmaVersion: 2017,
ecmaFeatures: {jsx: true}
},
extends: ['eslint:recommended', 'google'],
plugins: ['react'],
rules: {
'max-len': ['error', 100],
'require-jsdoc': 'off',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'no-invalid-this': 'off', // It's buggy
'arrow-parens': ['error', 'as-needed']
}
}
| Update the ES version supported by ESLint | Update the ES version supported by ESLint
| JavaScript | mit | frosas/lag,frosas/lag,frosas/lag | ---
+++
@@ -2,7 +2,7 @@
module.exports = {
env: {es6: true, commonjs: true},
parserOptions: {
- ecmaVersion: 6,
+ ecmaVersion: 2017,
ecmaFeatures: {jsx: true}
},
extends: ['eslint:recommended', 'google'], |
57e1963cd12f14ad7ab76792ed280b829fe6e461 | src/convert.js | src/convert.js | 'use strict';
var opts = {
prefix: '',
suffix: '',
suffixLastItem: true,
};
function objToValue(obj, opts) {
var keys = Object.keys(obj);
var fields = keys.map(function(key) {
var value = formatValue(obj[key]);
return opts.prefix + key + ":" + value;
});
var result = fields.join(opts.suffix + "\n");
if (opts.suffixLastItem) {
return result + opts.suffix;
}
return result;
}
function formatValue(value) {
if (value instanceof Array) {
var result = value.map(function(v) {
return formatValue(v);
});
return result.join(', ');
}
if (typeof value === 'object') {
var opts = {
prefix: '',
suffix: ',',
suffixLastItem: false,
};
return '(\n' + objToValue(value, opts) + '\n)';
}
if (typeof value === 'string') {
return value;
}
return JSON.stringify(value);
}
module.exports = objToValue;
| 'use strict';
var opts = {
prefix: '',
suffix: '',
suffixLastItem: true,
};
function objToValue(obj, opts) {
var keys = Object.keys(obj);
var fields = keys.map(function(key) {
var value = formatValue(obj[key]);
return opts.prefix + key + ":" + value;
});
var result = fields.join(opts.suffix + "\n");
if (opts.suffixLastItem) {
return result + opts.suffix;
}
return result;
}
function formatValue(value) {
if (value instanceof Array) {
var result = value.map(function(v) {
return formatValue(v);
});
return '(' + result.join(', ') + ')';
}
if (typeof value === 'object') {
var opts = {
prefix: '',
suffix: ',',
suffixLastItem: false,
};
return '(\n' + objToValue(value, opts) + '\n)';
}
if (typeof value === 'string') {
return value;
}
return JSON.stringify(value);
}
module.exports = objToValue;
| Add parentheses around all lists so that nested lists are supported (without them Sass throws an error). | Add parentheses around all lists so that nested lists are supported (without them Sass throws an error).
| JavaScript | mit | epegzz/sass-vars-loader,epegzz/sass-vars-loader,epegzz/sass-vars-loader | ---
+++
@@ -26,7 +26,7 @@
var result = value.map(function(v) {
return formatValue(v);
});
- return result.join(', ');
+ return '(' + result.join(', ') + ')';
}
if (typeof value === 'object') { |
a8140cbfe42ef3b7952fd4d3a4a22dc77f4ae9a3 | blueprints/ember-leaflet-draw/index.js | blueprints/ember-leaflet-draw/index.js | // /*jshint node:true*/
// module.exports = {
// description: 'add leaflet-draw assets, using bower',
//
// normalizeEntityName: function() {}, // no-op since we're just adding dependencies
//
// afterInstall: function() {
// return this.addBowerPackageToProject('leaflet-draw', '~0.4.9');
// }
// };
| /*jshint node:true*/
module.exports = {
description: 'add leaflet-draw assets, using npm',
normalizeEntityName: function() {}, // no-op since we're just adding dependencies
afterInstall: function() {
return this.addPackageToProject('leaflet-draw', '~0.4.9');
}
};
| Update blueprint to add npm package | Update blueprint to add npm package
| JavaScript | mit | StevenHeinrich/ember-leaflet-draw,StevenHeinrich/ember-leaflet-draw,StevenHeinrich/ember-leaflet-draw | ---
+++
@@ -1,10 +1,10 @@
-// /*jshint node:true*/
-// module.exports = {
-// description: 'add leaflet-draw assets, using bower',
-//
-// normalizeEntityName: function() {}, // no-op since we're just adding dependencies
-//
-// afterInstall: function() {
-// return this.addBowerPackageToProject('leaflet-draw', '~0.4.9');
-// }
-// };
+/*jshint node:true*/
+module.exports = {
+ description: 'add leaflet-draw assets, using npm',
+
+ normalizeEntityName: function() {}, // no-op since we're just adding dependencies
+
+ afterInstall: function() {
+ return this.addPackageToProject('leaflet-draw', '~0.4.9');
+ }
+}; |
bc0211568aa9ce77b4156346cf70dc76348e923e | src/gutiBot.js | src/gutiBot.js | "use strict";
const slack = require('./utils/slackUtils');
const axios = require('axios');
function _ok(response) {
return response.status(200);
}
function respondOk(response) {
return _ok(response).end();
}
function respondWith(response, message) {
const payload = slack.outgoingWebhook.createResponse(message);
return _ok(response).json(payload);
}
function respondViaWebhook(hookUrl, channel, message) {
return axios.post(hookUrl, {
channel,
text: message,
});
}
module.exports = {
respondOk,
respondWith,
respondViaWebhook,
};
| "use strict";
const slack = require('./utils/slackUtils');
const axios = require('axios');
function _ok(response) {
return response.status(200);
}
function _getIncomingWebhookUrl() {
return process.env.SLACK_INCOMING_WEBHOOK_URL;
}
function _getBotUserApiToken() {
return process.env.SLACK_BOT_USER_API_TOKEN;
}
function respondOk(response) {
return _ok(response).end();
}
function respondWith(response, message) {
const payload = slack.outgoingWebhook.createResponse(message);
return _ok(response).json(payload);
}
function respondViaWebhook(hookUrl, channel, message) {
return axios.post(hookUrl, {
channel,
text: message,
});
}
function respondViaDefaultWebhook(channel, message) {
const hookUrl = _getIncomingWebhookUrl();
return respondViaWebhook(hookUrl, channel, message);
}
module.exports = {
respondOk,
respondWith,
respondViaWebhook,
respondViaDefaultWebhook,
};
| Allow Gutibot to supply incoming hook url | Allow Gutibot to supply incoming hook url
| JavaScript | mit | awseward/silly-slacker,awseward/gutibot | ---
+++
@@ -5,6 +5,14 @@
function _ok(response) {
return response.status(200);
+}
+
+function _getIncomingWebhookUrl() {
+ return process.env.SLACK_INCOMING_WEBHOOK_URL;
+}
+
+function _getBotUserApiToken() {
+ return process.env.SLACK_BOT_USER_API_TOKEN;
}
function respondOk(response) {
@@ -24,8 +32,15 @@
});
}
+function respondViaDefaultWebhook(channel, message) {
+ const hookUrl = _getIncomingWebhookUrl();
+
+ return respondViaWebhook(hookUrl, channel, message);
+}
+
module.exports = {
respondOk,
respondWith,
respondViaWebhook,
+ respondViaDefaultWebhook,
}; |
846949d03b2567c591fe284f7ef201de60324578 | src/js/math.js | src/js/math.js | import * as THREE from 'three';
export function randomPointOnSphere( vector = new THREE.Vector3() ) {
const theta = 2 * Math.PI * Math.random();
const u = 2 * Math.random() - 1;
const v = Math.sqrt( 1 - u * u );
return vector.set(
v * Math.cos( theta ),
v * Math.sin( theta ),
u
);
}
export function lerp( a, b, t ) {
return a + t * ( b - a );
}
export function inverseLerp( a, b, x ) {
return ( x - a ) / ( b - a );
}
/*
Returns a function that invokes the callback on a vector, passing in the
position of the vector relative to the geometry bounding box, where
[ 0, 0, 0 ] is the center and extrema are in [ -1, 1 ].
For example, [ -1, 0, 0 ] if the vector is on the left face of the bounding
box, [ 0, 1, 0 ] if on the top face, etc.
The callback is invoked with four arguments: (vector, xt, yt, zt).
*/
export function parametric( geometry, callback ) {
geometry.computeBoundingBox();
const { min, max } = geometry.boundingBox;
return vector => {
callback(
vector,
2 * inverseLerp( min.x, max.x, vector.x ) - 1,
2 * inverseLerp( min.y, max.y, vector.y ) - 1,
2 * inverseLerp( min.z, max.z, vector.z ) - 1
);
};
}
| import * as THREE from 'three';
export function randomPointOnSphere( vector = new THREE.Vector3() ) {
const theta = 2 * Math.PI * Math.random();
const u = 2 * Math.random() - 1;
const v = Math.sqrt( 1 - u * u );
return vector.set(
v * Math.cos( theta ),
v * Math.sin( theta ),
u
);
}
export function inverseLerp( a, b, x ) {
return ( x - a ) / ( b - a );
}
/*
Returns a function that invokes the callback on a vector, passing in the
position of the vector relative to the geometry bounding box, where
[ 0, 0, 0 ] is the center and extrema are in [ -1, 1 ].
For example, [ -1, 0, 0 ] if the vector is on the left face of the bounding
box, [ 0, 1, 0 ] if on the top face, etc.
The callback is invoked with four arguments: (vector, xt, yt, zt).
*/
export function parametric( geometry, callback ) {
geometry.computeBoundingBox();
const { min, max } = geometry.boundingBox;
return vector => {
callback(
vector,
2 * inverseLerp( min.x, max.x, vector.x ) - 1,
2 * inverseLerp( min.y, max.y, vector.y ) - 1,
2 * inverseLerp( min.z, max.z, vector.z ) - 1
);
};
}
| Remove custom 1D lerp() function. | Remove custom 1D lerp() function.
THREE.Math.lerp() was added in three.js r82.
| JavaScript | mit | razh/flying-machines,razh/flying-machines | ---
+++
@@ -10,10 +10,6 @@
v * Math.sin( theta ),
u
);
-}
-
-export function lerp( a, b, t ) {
- return a + t * ( b - a );
}
export function inverseLerp( a, b, x ) { |
415e6315f263345c3f06bcc3d33c6403fd1cfed3 | src/js/main.js | src/js/main.js | let dictionary = new Dictionary();
let httpRequest = new HttpRequest();
httpRequest.get(dictionary.randomUrl, function(o) {
console.log(o)
}); | let dictionary = new Dictionary();
let httpRequest = new HttpRequest();
//(Math.random() * (max - min) + min)
let interval = (Math.random() * (10000 - 5000)) + 5000;
window.setInterval(function() {
let url = dictionary.randomUrl;
httpRequest.get(url);
}, interval); | Set random 5-10 second interval | Set random 5-10 second interval
| JavaScript | mit | brat-corp/applesauce,brat-corp/applesauce | ---
+++
@@ -1,6 +1,10 @@
let dictionary = new Dictionary();
let httpRequest = new HttpRequest();
+//(Math.random() * (max - min) + min)
+let interval = (Math.random() * (10000 - 5000)) + 5000;
-httpRequest.get(dictionary.randomUrl, function(o) {
- console.log(o)
-});
+window.setInterval(function() {
+ let url = dictionary.randomUrl;
+
+ httpRequest.get(url);
+}, interval); |
9ff5270aa8c75a56df883a7b734156d2f8eded99 | client/src/store/rootReducer.js | client/src/store/rootReducer.js | import { reducer as formReducer } from 'redux-form';
import { combineReducers } from 'redux';
import { routerReducer } from 'react-router-redux';
import {
organization,
starredBoard,
notification,
modals,
board,
home
} from '../app/routes/home/modules/index';
import { signUp } from '../app/routes/signUp/modules/index';
import { login } from '../app/routes/login/modules/index';
import {
boardsMenu,
popOver,
app
} from '../app/modules/index';
import {
boardView,
card
} from '../app/routes/home/routes/boardView/modules/index';
const rootReducer = combineReducers({
organization,
starredBoard,
notification,
modals,
board,
home,
signUp,
login,
boardsMenu,
popOver,
app,
boardView,
card,
form: formReducer,
routing: routerReducer
})
export default rootReducer; | import { reducer as formReducer } from 'redux-form';
import { combineReducers } from 'redux';
import { routerReducer } from 'react-router-redux';
import {
organization,
starredBoard,
notification,
modals,
board,
home
} from '../app/routes/home/modules/index';
import { signUp } from '../app/routes/signUp/modules/index';
import { login } from '../app/routes/login/modules/index';
import {
boardsMenu,
popOver,
app
} from '../app/modules/index';
import {
boardView,
card
} from '../app/routes/home/routes/boardView/modules/index';
const appReducer = combineReducers({
organization,
starredBoard,
notification,
modals,
board,
home,
signUp,
login,
boardsMenu,
popOver,
app,
boardView,
card,
form: formReducer,
routing: routerReducer
})
const rootReducer = (state, action) => {
if (action.type === 'UN_AUTHENTICATE_USER') {
state = undefined
}
return appReducer(state, action)
}
export default rootReducer; | Reset state when user logs out | Reset state when user logs out
| JavaScript | mit | Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/Trello-Clone,Madmous/Trello-Clone,Madmous/madClones | ---
+++
@@ -25,7 +25,7 @@
card
} from '../app/routes/home/routes/boardView/modules/index';
-const rootReducer = combineReducers({
+const appReducer = combineReducers({
organization,
starredBoard,
notification,
@@ -47,4 +47,12 @@
routing: routerReducer
})
+const rootReducer = (state, action) => {
+ if (action.type === 'UN_AUTHENTICATE_USER') {
+ state = undefined
+ }
+
+ return appReducer(state, action)
+}
+
export default rootReducer; |
b78fe2c8157e90cea5535189b63120f4608b75b9 | src/js/AppRouter.js | src/js/AppRouter.js | define([
"backbone",
"jquery",
"view/HomeView",
"collection/Presentation",
"view/PresentationView",
"model/Slide",
"view/SlideView"
], function (Backbone, $, HomeView, Presentation, PresentationView, Slide, SlideView) {
return Backbone.Router.extend({
routes: {
"home": "home",
"loadpresentation": "loadPresentation",
"editslide/:id": "editSlide"
},
home: function () {
$("#container").html(new HomeView().render().el);
},
loadPresentation: function () {
var presentation = new Presentation();
var presentationView = new PresentationView({ collection: presentation});
presentation.fetch({
success: function () {
$("#container").html(presentationView.render().el);
}
});
},
editSlide: function (id) {
var slide = new Slide({ id: id});
slide.fetch({
success: function () {
$("#container").html(new SlideView({ model: slide }).render().el);
}
});
}
});
}); | define([
"backbone",
"jquery",
"view/HomeView",
"collection/Presentation",
"view/PresentationView",
"model/Slide",
"view/SlideView"
], function (Backbone, $, HomeView, Presentation, PresentationView, Slide, SlideView) {
var presentation = new Presentation();
return Backbone.Router.extend({
routes: {
"home": "home",
"loadpresentation": "loadPresentation",
"editslide/:id": "editSlide"
},
home: function () {
$("#container").html(new HomeView().render().el);
},
loadPresentation: function () {
var presentationView = new PresentationView({ collection: presentation});
presentation.fetch({
success: function () {
$("#container").html(presentationView.render().el);
}
});
},
editSlide: function (id) {
var slide = presentation.find(function (model) {
return model.get("id") === id;
});
$("#container").html(new SlideView({ model: slide }).render().el);
}
});
}); | Edit slides by finding them from the collection | Edit slides by finding them from the collection
| JavaScript | mit | pads/yap,pads/yap | ---
+++
@@ -7,6 +7,8 @@
"model/Slide",
"view/SlideView"
], function (Backbone, $, HomeView, Presentation, PresentationView, Slide, SlideView) {
+
+ var presentation = new Presentation();
return Backbone.Router.extend({
routes: {
@@ -18,7 +20,6 @@
$("#container").html(new HomeView().render().el);
},
loadPresentation: function () {
- var presentation = new Presentation();
var presentationView = new PresentationView({ collection: presentation});
presentation.fetch({
success: function () {
@@ -27,12 +28,10 @@
});
},
editSlide: function (id) {
- var slide = new Slide({ id: id});
- slide.fetch({
- success: function () {
- $("#container").html(new SlideView({ model: slide }).render().el);
- }
+ var slide = presentation.find(function (model) {
+ return model.get("id") === id;
});
+ $("#container").html(new SlideView({ model: slide }).render().el);
}
});
|
82a6130b3ca36cf474959ea882e3910d4135d283 | src/featureExtractors.js | src/featureExtractors.js | import rms from './extractors/rms';
import energy from './extractors/energy';
import spectralSlope from './extractors/spectralSlope';
import spectralCentroid from './extractors/spectralCentroid';
import spectralRolloff from './extractors/spectralRolloff';
import spectralFlatness from './extractors/spectralFlatness';
import spectralSpread from './extractors/spectralSpread';
import spectralSkewness from './extractors/spectralSkewness';
import spectralKurtosis from './extractors/spectralKurtosis';
import zcr from './extractors/zcr';
import loudness from './extractors/loudness';
import perceptualSpread from './extractors/perceptualSpread';
import perceptualSharpness from './extractors/perceptualSharpness';
import mfcc from './extractors/mfcc';
import powerSpectrum from './extractors/powerSpectrum';
import spectralFlux from './extractors/spectralFlux';
export default {
buffer: function (args) {
return args.signal;
},
rms,
energy,
complexSpectrum: function (args) {
return args.complexSpectrum;
},
spectralSlope,
spectralCentroid,
spectralRolloff,
spectralFlatness,
spectralSpread,
spectralSkewness,
spectralKurtosis,
amplitudeSpectrum: function (args) {
return args.ampSpectrum;
},
zcr,
loudness,
perceptualSpread,
perceptualSharpness,
powerSpectrum,
mfcc,
spectralFlux,
};
| import rms from './extractors/rms';
import energy from './extractors/energy';
import spectralSlope from './extractors/spectralSlope';
import spectralCentroid from './extractors/spectralCentroid';
import spectralRolloff from './extractors/spectralRolloff';
import spectralFlatness from './extractors/spectralFlatness';
import spectralSpread from './extractors/spectralSpread';
import spectralSkewness from './extractors/spectralSkewness';
import spectralKurtosis from './extractors/spectralKurtosis';
import zcr from './extractors/zcr';
import loudness from './extractors/loudness';
import perceptualSpread from './extractors/perceptualSpread';
import perceptualSharpness from './extractors/perceptualSharpness';
import mfcc from './extractors/mfcc';
import powerSpectrum from './extractors/powerSpectrum';
import spectralFlux from './extractors/spectralFlux';
let buffer = function(args) {
return args.signal;
};
let complexSpectrum = function (args) {
return args.complexSpectrum;
};
let amplitudeSpectrum = function (args) {
return args.ampSpectrum;
};
export {
buffer,
rms,
energy,
complexSpectrum,
spectralSlope,
spectralCentroid,
spectralRolloff,
spectralFlatness,
spectralSpread,
spectralSkewness,
spectralKurtosis,
amplitudeSpectrum,
zcr,
loudness,
perceptualSpread,
perceptualSharpness,
powerSpectrum,
mfcc,
spectralFlux
};
| Modify export to allow importing selectively | Modify export to allow importing selectively
| JavaScript | mit | meyda/meyda,hughrawlinson/meyda,meyda/meyda,meyda/meyda | ---
+++
@@ -15,16 +15,23 @@
import powerSpectrum from './extractors/powerSpectrum';
import spectralFlux from './extractors/spectralFlux';
-export default {
- buffer: function (args) {
- return args.signal;
- },
+let buffer = function(args) {
+ return args.signal;
+};
+let complexSpectrum = function (args) {
+ return args.complexSpectrum;
+};
+
+let amplitudeSpectrum = function (args) {
+ return args.ampSpectrum;
+};
+
+export {
+ buffer,
rms,
energy,
- complexSpectrum: function (args) {
- return args.complexSpectrum;
- },
+ complexSpectrum,
spectralSlope,
spectralCentroid,
@@ -33,9 +40,7 @@
spectralSpread,
spectralSkewness,
spectralKurtosis,
- amplitudeSpectrum: function (args) {
- return args.ampSpectrum;
- },
+ amplitudeSpectrum,
zcr,
loudness,
@@ -43,5 +48,5 @@
perceptualSharpness,
powerSpectrum,
mfcc,
- spectralFlux,
+ spectralFlux
}; |
0c5192362e234bb1d024ef9bbbe39ed3c605722a | adventure/res/js/sluggifyUI.js | adventure/res/js/sluggifyUI.js | var updatableSlug = true;
/* jQuery because BS brings it in; trivial to remove */
function sluggify(str) {
if (!str) {
return "";
}
/* we could check for the existence of a slug too */
return str.toLowerCase() /* no uppercase in slug */
.replace(/[^a-z0-9-]/g, "-") /* get rid of non-alphanumerics/hyphen
.replace(/--+/g, "-") /* get rid of doubled up hyphens */
.replace(/-$/g, "") /* get rid of trailing hyphens */
.replace(/^-/g, "") /* and leading ones too */;
}
function updateSlugMaybe(source) {
if (updatableSlug) {
$("#slug").val(sluggify($(source).val()))
}
}
/* if the slug box has its own value entered, don't overwrite */
function slugBlur(source) {
/* is the slug empty, or is the same as a sluggified name? if so, make it changeable */
var val = $(source).val();
updatableSlug = !val || (sluggify($("#name").val()) == val);
} | var updatableSlug = true;
/* jQuery because BS brings it in; trivial to remove */
function sluggify(str) {
if (!str) {
return "";
}
/* we could check for the existence of a slug too */
return str.toLowerCase() /* no uppercase in slug */
.replace(/[^a-z0-9-]/g, "-") /* get rid of non-alphanumerics/hyphen */
.replace(/--+/g, "-") /* get rid of doubled up hyphens */
.replace(/-$/g, "") /* get rid of trailing hyphens */
.replace(/^-/g, "") /* and leading ones too */;
}
function updateSlugMaybe(source) {
if (updatableSlug) {
$("#slug").val(sluggify($(source).val()))
}
}
/* if the slug box has its own value entered, don't overwrite */
function slugBlur(source) {
/* is the slug empty, or is the same as a sluggified name? if so, make it changeable */
var val = $(source).val();
updatableSlug = !val || (sluggify($("#name").val()) == val);
} | Fix broken comment in slug function | Fix broken comment in slug function
| JavaScript | agpl-3.0 | WinWorldPC/adventure,WinWorldPC/adventure | ---
+++
@@ -6,8 +6,8 @@
}
/* we could check for the existence of a slug too */
return str.toLowerCase() /* no uppercase in slug */
- .replace(/[^a-z0-9-]/g, "-") /* get rid of non-alphanumerics/hyphen
- .replace(/--+/g, "-") /* get rid of doubled up hyphens */
+ .replace(/[^a-z0-9-]/g, "-") /* get rid of non-alphanumerics/hyphen */
+ .replace(/--+/g, "-") /* get rid of doubled up hyphens */
.replace(/-$/g, "") /* get rid of trailing hyphens */
.replace(/^-/g, "") /* and leading ones too */;
} |
4dbb60abd9df648f4a963f6584f4090b39b8caa3 | lib/poet.js | lib/poet.js | var
fs = require('fs'),
_ = require('underscore'),
createTemplates = require('./poet/templates'),
createHelpers = require('./poet/helpers'),
routes = require('./poet/routes'),
methods = require('./poet/methods'),
utils = require('./poet/utils'),
method = utils.method;
function Poet (app, options) {
this.app = app;
// Set up a hash of posts and a cache for storing sorted array
// versions of posts, tags, and categories for the helper
this.posts = {};
this.cache = {};
// Merge options with defaults
this.options = utils.createOptions(options);
// Set up default templates (markdown, jade)
this.templates = createTemplates();
// Construct helper methods
this.helpers = createHelpers(this);
// Bind locals for view access
utils.createLocals(this.app, this.helpers);
// Bind routes to express app based off of options
routes.bindRoutes(this);
}
module.exports = function (app, options) {
return new Poet(app, options);
};
Poet.prototype.addTemplate = method(methods.addTemplate);
Poet.prototype.init = method(methods.init);
Poet.prototype.middleware = method(methods.middleware);
Poet.prototype.clearCache = method(methods.clearCache);
Poet.prototype.addRoute = method(routes.addRoute);
Poet.prototype.watch = method(methods.watch);
| var
fs = require('fs'),
_ = require('underscore'),
createTemplates = require('./poet/templates'),
createHelpers = require('./poet/helpers'),
routes = require('./poet/routes'),
methods = require('./poet/methods'),
utils = require('./poet/utils'),
method = utils.method;
function Poet (app, options) {
this.app = app;
// Set up a hash of posts and a cache for storing sorted array
// versions of posts, tags, and categories for the helper
this.posts = {};
this.cache = {};
// Merge options with defaults
this.options = utils.createOptions(options);
// Set up default templates (markdown, jade)
this.templates = createTemplates();
// Construct helper methods
this.helpers = createHelpers(this);
// Bind locals for view access
utils.createLocals(this.app, this.helpers);
// Bind routes to express app based off of options
routes.bindRoutes(this);
}
module.exports = function (app, options) {
return new Poet(app, options);
};
Poet.prototype.addTemplate = method(methods.addTemplate);
Poet.prototype.init = method(methods.init);
Poet.prototype.clearCache = method(methods.clearCache);
Poet.prototype.addRoute = method(routes.addRoute);
Poet.prototype.watch = method(methods.watch);
| Remove method that was vestigial from pre-1.0.0 release | Remove method that was vestigial from pre-1.0.0 release
| JavaScript | mit | Nayar/poet,r14r/fork_nodejs_poet,jhuang314/poet,jhuang314/poet,r14r/fork_nodejs_poet,jsantell/poet,Nayar/poet,jsantell/poet | ---
+++
@@ -38,7 +38,6 @@
Poet.prototype.addTemplate = method(methods.addTemplate);
Poet.prototype.init = method(methods.init);
-Poet.prototype.middleware = method(methods.middleware);
Poet.prototype.clearCache = method(methods.clearCache);
Poet.prototype.addRoute = method(routes.addRoute);
Poet.prototype.watch = method(methods.watch); |
d90307b810d5a6952f969935b0b6275776c1e17a | app/assets/javascripts/ping.js | app/assets/javascripts/ping.js | var Pinger = {
};
// http://stackoverflow.com/a/573784
Pinger.getPing = function(target, callback) {
var start;
var client = Pinger.getClient(); // xmlhttprequest object
client.onreadystatechange = function() {
if (client.readyState >= 2) { // request received
lag_ms = Pinger.pingDone(start); //handle ping
client.onreadystatechange = null; //remove handler
callback(lag_ms);
}
}
start = new Date();
client.open("HEAD", target + "?" + start.valueOf());
client.send();
}
Pinger.pingDone = function(start) {
done = new Date();
return done.valueOf() - start.valueOf();
}
Pinger.getClient = function() {
if (window.XMLHttpRequest)
return new XMLHttpRequest();
if (window.ActiveXObject)
return new ActiveXObject('MSXML2.XMLHTTP.3.0');
throw("No XMLHttpRequest Object Available.");
}
| var Pinger = {
seq: 0
};
// http://stackoverflow.com/a/573784
Pinger.getPing = function(target, callback) {
var start;
var client = Pinger.getClient(); // xmlhttprequest object
client.onreadystatechange = function() {
if (client.readyState >= 2) { // request received
lag_ms = Pinger.pingDone(start); //handle ping
client.onreadystatechange = null; //remove handler
callback(lag_ms);
}
}
Pinger.seq += 1;
start = new Date();
client.open("HEAD", target + "?" + Pinger.seq);
client.send();
}
Pinger.pingDone = function(start) {
done = new Date();
return done.valueOf() - start.valueOf();
}
Pinger.getClient = function() {
if (window.XMLHttpRequest)
return new XMLHttpRequest();
if (window.ActiveXObject)
return new ActiveXObject('MSXML2.XMLHTTP.3.0');
throw("No XMLHttpRequest Object Available.");
}
| Use sequence number instead of timestamp to avoid cache | Use sequence number instead of timestamp to avoid cache
| JavaScript | mit | zunda/ping,zunda/ping,zunda/ping | ---
+++
@@ -1,4 +1,5 @@
var Pinger = {
+ seq: 0
};
// http://stackoverflow.com/a/573784
@@ -13,8 +14,9 @@
}
}
+ Pinger.seq += 1;
start = new Date();
- client.open("HEAD", target + "?" + start.valueOf());
+ client.open("HEAD", target + "?" + Pinger.seq);
client.send();
}
|
2f1f3e808af300a633a1435c425d2f23550e5211 | lib/ember-pusher/bindings.js | lib/ember-pusher/bindings.js | var global = (typeof window !== 'undefined') ? window : {},
Ember = global.Ember;
var Bindings = Ember.Mixin.create({
needs: 'pusher',
init: function() {
var pusherController, target;
this._super();
if(!this.PUSHER_SUBSCRIPTIONS) { return; }
pusherController = this.get('controllers.pusher');
target = this;
Object.keys(target.PUSHER_SUBSCRIPTIONS).forEach(function (channelName) {
var events = target.PUSHER_SUBSCRIPTIONS[channelName];
pusherController.wire(target, channelName, events);
});
},
willDestroy: function() {
var pusherController, target;
if(!this.PUSHER_SUBSCRIPTIONS) { return; }
pusherController = this.controllerFor('pusher');
target = this;
Object.keys(target.PUSHER_SUBSCRIPTIONS).forEach(function (channelName) {
pusherController.unwire(target, channelName);
});
},
_pusherEventsId: function() {
return this.toString();
}
});
export { Bindings };
| var global = (typeof window !== 'undefined') ? window : {},
Ember = global.Ember;
var Bindings = Ember.Mixin.create({
needs: 'pusher',
init: function() {
var pusherController, target;
this._super();
if(!this.PUSHER_SUBSCRIPTIONS) { return; }
pusherController = this.get('controllers.pusher');
target = this;
Object.keys(target.PUSHER_SUBSCRIPTIONS).forEach(function (channelName) {
var events = target.PUSHER_SUBSCRIPTIONS[channelName];
pusherController.wire(target, channelName, events);
});
},
willDestroy: function() {
var pusherController, target;
if(!this.PUSHER_SUBSCRIPTIONS) { return; }
pusherController = this.get('controllers.pusher');
target = this;
Object.keys(target.PUSHER_SUBSCRIPTIONS).forEach(function (channelName) {
pusherController.unwire(target, channelName);
});
this._super();
},
_pusherEventsId: function() {
return this.toString();
}
});
export { Bindings };
| Fix improper grab of the pusher controller in unwire | Fix improper grab of the pusher controller in unwire
| JavaScript | mit | jamiebikies/ember-pusher,mmun/ember-pusher,mmun/ember-pusher,jamiebikies/ember-pusher | ---
+++
@@ -20,11 +20,12 @@
willDestroy: function() {
var pusherController, target;
if(!this.PUSHER_SUBSCRIPTIONS) { return; }
- pusherController = this.controllerFor('pusher');
+ pusherController = this.get('controllers.pusher');
target = this;
Object.keys(target.PUSHER_SUBSCRIPTIONS).forEach(function (channelName) {
pusherController.unwire(target, channelName);
});
+ this._super();
},
_pusherEventsId: function() { |
415d3ab16903f58293aaa09cc1b465686cdd5332 | app/lib/process.js | app/lib/process.js | const Promise = require('bluebird')
const { exec } = require('child_process')
Promise.config({
cancellation: true,
})
class Process {
static execute (script, options = {}) {
return new Promise((resolve, reject, onCancel) => {
const cmd = exec(script, (error, stdout, stderr) => {
if (error) {
reject(stderr)
} else {
resolve(stdout)
}
})
onCancel(() => {
cmd.kill('SIGKILL')
})
})
}
}
module.exports = Process
| const Promise = require('bluebird')
const { exec } = require('child_process')
Promise.config({
cancellation: true,
})
class Process {
static execute (script, userOptions = {}) {
const options = Object.assign({}, {
cwd: process.cwd(),
env: process.env,
}, userOptions)
return new Promise((resolve, reject, onCancel) => {
const cmd = exec(script, options, (error, stdout, stderr) => {
if (error) {
reject(stderr)
} else {
resolve(stdout)
}
})
onCancel(() => {
cmd.kill('SIGKILL')
})
})
}
}
module.exports = Process
| Allow user scripts to execute in their directories. | Allow user scripts to execute in their directories.
| JavaScript | mit | tinytacoteam/zazu,tinytacoteam/zazu | ---
+++
@@ -6,9 +6,13 @@
})
class Process {
- static execute (script, options = {}) {
+ static execute (script, userOptions = {}) {
+ const options = Object.assign({}, {
+ cwd: process.cwd(),
+ env: process.env,
+ }, userOptions)
return new Promise((resolve, reject, onCancel) => {
- const cmd = exec(script, (error, stdout, stderr) => {
+ const cmd = exec(script, options, (error, stdout, stderr) => {
if (error) {
reject(stderr)
} else { |
81cea94ac6192477a0750be60be5d225ab644ff2 | src/tedious.js | src/tedious.js | 'use strict';
module.exports.BulkLoad = require('./bulk-load');
module.exports.Connection = require('./connection');
module.exports.Request = require('./request');
module.exports.library = require('./library');
module.exports.TYPES = require('./data-type').typeByName;
module.exports.ISOLATION_LEVEL = require('./transaction').ISOLATION_LEVEL;
module.exports.TDS_VERSION = require('./tds-versions').versions;
| 'use strict';
module.exports.BulkLoad = require('./bulk-load');
module.exports.Connection = require('./connection');
module.exports.Request = require('./request');
module.exports.library = require('./library');
module.exports.ConnectionError = require('./errors').ConnectionError;
module.exports.RequestError = require('./errors').RequestError;
module.exports.TYPES = require('./data-type').typeByName;
module.exports.ISOLATION_LEVEL = require('./transaction').ISOLATION_LEVEL;
module.exports.TDS_VERSION = require('./tds-versions').versions;
| Add ConnectionError and RequestError to module.exports | Add ConnectionError and RequestError to module.exports
| JavaScript | mit | tediousjs/tedious,tediousjs/tedious,pekim/tedious | ---
+++
@@ -5,6 +5,9 @@
module.exports.Request = require('./request');
module.exports.library = require('./library');
+module.exports.ConnectionError = require('./errors').ConnectionError;
+module.exports.RequestError = require('./errors').RequestError;
+
module.exports.TYPES = require('./data-type').typeByName;
module.exports.ISOLATION_LEVEL = require('./transaction').ISOLATION_LEVEL;
module.exports.TDS_VERSION = require('./tds-versions').versions; |
b2d5054e5810ab94b0f42eb582af05efd366e8cd | app/util/logger.js | app/util/logger.js | import { GOOGLE_ANALYTICS_ID } from '../AppSettings';
import { GoogleAnalyticsTracker } from 'react-native-google-analytics-bridge';
let tracker = new GoogleAnalyticsTracker(GOOGLE_ANALYTICS_ID);
/**
* A module containing logging helper functions
* @module util/logger
*/
module.exports = {
/**
* Send a log message to the console
* @function
* @param {string} msg The message to log
*/
log(msg) {
console.log(msg);
},
/**
* Sends a trackScreenView message to Google Analytics
* @function
* @param {string} msg The message to log
*/
ga(msg) {
tracker.trackScreenView(msg);
},
/**
* Sends a trackException message to Google Analytics
* @function
* @param {string} error The error message
* @param {bool} fatal If the crash was fatal or not
*/
trackException(error, fatal) {
tracker.trackException(error, fatal);
},
};
| import { GOOGLE_ANALYTICS_ID } from '../AppSettings';
import { GoogleAnalyticsTracker } from 'react-native-google-analytics-bridge';
let tracker = new GoogleAnalyticsTracker(GOOGLE_ANALYTICS_ID);
/**
* A module containing logging helper functions
* @module util/logger
*/
module.exports = {
/**
* Send a log message to the console
* @function
* @param {string} msg The message to log
*/
log(msg) {
console.log(msg);
},
/**
* Sends a trackScreenView message to Google Analytics
* @function
* @param {string} msg The message to log
*/
ga(msg) {
tracker.trackScreenView(msg);
},
/**
* Sends a trackEvent message to Google Analytics
* @function
* @param {string} category The category of event
* @param {string} action The name of the action
*/
trackEvent(category, action) {
tracker.trackEvent(category, action);
},
/**
* Sends a trackException message to Google Analytics
* @function
* @param {string} error The error message
* @param {bool} fatal If the crash was fatal or not
*/
trackException(error, fatal) {
tracker.trackException(error, fatal);
},
};
| Add google event tracking capability | Add google event tracking capability
| JavaScript | mit | UCSD/campus-mobile,UCSD/now-mobile,UCSD/campus-mobile,UCSD/now-mobile,UCSD/now-mobile,UCSD/campus-mobile,UCSD/campus-mobile,UCSD/campus-mobile,UCSD/campus-mobile | ---
+++
@@ -27,6 +27,17 @@
tracker.trackScreenView(msg);
},
+
+ /**
+ * Sends a trackEvent message to Google Analytics
+ * @function
+ * @param {string} category The category of event
+ * @param {string} action The name of the action
+ */
+ trackEvent(category, action) {
+ tracker.trackEvent(category, action);
+ },
+
/**
* Sends a trackException message to Google Analytics
* @function |
0c0e961f1d9ff4f44f2c593971a5235418c09390 | index.js | index.js | var gulp = require('gulp');
var elixir = require('laravel-elixir');
var karma = require('karma').server;
var _ = require('underscore');
var gutils = require('gulp-util');
var task = elixir.Task;
function isTddOrWatchTask() {
return gutils.env._.indexOf('watch') > -1 || gutils.env._.indexOf('tdd') > -1;
}
elixir.extend('karma', function(args) {
if (! isTddOrWatchTask()) return;
var defaults = {
configFile: process.cwd()+'/karma.conf.js',
jsDir: ['resources/assets/js/**/*.js', 'resources/assets/coffee/**/*.coffee'],
autoWatch: true,
singleRun: false
};
var options = _.extend(defaults, args);
var isStarted = false;
new task('karma', function() {
if( ! isStarted) {
karma.start(options);
isStarted = true;
}
}).watch(options.jsDir, 'tdd');
});
| var gulp = require('gulp');
var elixir = require('laravel-elixir');
var KarmaServer = require('karma').Server;
var _ = require('underscore');
var gutils = require('gulp-util');
var task = elixir.Task;
function isTddOrWatchTask() {
return gutils.env._.indexOf('watch') > -1 || gutils.env._.indexOf('tdd') > -1;
}
elixir.extend('karma', function(args) {
if (! isTddOrWatchTask()) return;
var defaults = {
configFile: process.cwd() + '/karma.conf.js',
jsDir: ['resources/assets/js/**/*.js', 'resources/assets/coffee/**/*.coffee'],
autoWatch: true,
singleRun: false
};
var options = _.extend(defaults, args);
var server;
var isStarted = false;
new task('karma', function() {
if( ! isStarted) {
server = new KarmaServer(options);
server.start();
isStarted = true;
}
}).watch(options.jsDir, 'tdd');
});
| Use Karma 0.14 style programmatic calling | Use Karma 0.14 style programmatic calling
Fixes https://github.com/olyckne/laravel-elixir-karma/issues/2
| JavaScript | mit | olyckne/laravel-elixir-karma | ---
+++
@@ -1,6 +1,6 @@
var gulp = require('gulp');
var elixir = require('laravel-elixir');
-var karma = require('karma').server;
+var KarmaServer = require('karma').Server;
var _ = require('underscore');
var gutils = require('gulp-util');
@@ -14,7 +14,7 @@
if (! isTddOrWatchTask()) return;
var defaults = {
- configFile: process.cwd()+'/karma.conf.js',
+ configFile: process.cwd() + '/karma.conf.js',
jsDir: ['resources/assets/js/**/*.js', 'resources/assets/coffee/**/*.coffee'],
autoWatch: true,
singleRun: false
@@ -22,11 +22,14 @@
var options = _.extend(defaults, args);
+ var server;
+
var isStarted = false;
new task('karma', function() {
if( ! isStarted) {
- karma.start(options);
+ server = new KarmaServer(options);
+ server.start();
isStarted = true;
}
}).watch(options.jsDir, 'tdd'); |
af3fa380334d52add8e937753ef4d14fab219fb4 | index.js | index.js | /**
* ENVIRONMENT VARIABLES
* TOKEN_LIFE: Number of seconds before a token expires
* APP_TOKEN: Facebook app token
* APP_ID: Facebook app ID
* ADMIN_ID: Client ID for admin program
* ADMIN_SECRET: Client secret for admin program
*/
// Dependencies
var https = require('https')
, fs = require('fs')
, express = require('express')
, app = express()
, bodyParser = require('body-parser')
, mongoose = require('mongoose')
, passport = require('passport')
, nodemailer = require('nodemailer')
, path = require('path')
, api = require('./api/app.js');
var port = process.env.PORT || process.env.SSL ? 443 : 8080;
app.use(bodyParser.urlencoded({
extended: true
}));
// Serve homepage
app.use('/', express.static(path.join(__dirname, 'public')));
// REST API
api.use(express, app, mongoose, passport, nodemailer);
var serverStart = function() {
console.log('Server started on port %d', port);
};
if (process.env.NODE_ENV === 'production' || !process.env.SSL) {
app.listen(port, serverStart);
} else {
// Load SSL Certificate
var options = {
key: fs.readFileSync('./sslcert/key.pem'),
cert: fs.readFileSync('./sslcert/cert.pem')
}
https.createServer(options, app).listen(port, serverStart);
}
| /**
* ENVIRONMENT VARIABLES
* TOKEN_LIFE: Number of seconds before a token expires
* APP_TOKEN: Facebook app token
* APP_ID: Facebook app ID
* ADMIN_ID: Client ID for admin program
* ADMIN_SECRET: Client secret for admin program
*/
// Dependencies
var https = require('https')
, fs = require('fs')
, express = require('express')
, app = express()
, bodyParser = require('body-parser')
, mongoose = require('mongoose')
, passport = require('passport')
, nodemailer = require('nodemailer')
, path = require('path')
, api = require('./api/app.js');
var port = process.env.PORT || (process.env.SSL ? 443 : 8080);
app.use(bodyParser.urlencoded({
extended: true
}));
// Serve homepage
app.use('/', express.static(path.join(__dirname, 'public')));
// REST API
api.use(express, app, mongoose, passport, nodemailer);
var serverStart = function() {
console.log('Server started on port %d', port);
};
if (process.env.NODE_ENV === 'production' || !process.env.SSL) {
app.listen(port, serverStart);
} else {
// Load SSL Certificate
var options = {
key: fs.readFileSync('./sslcert/key.pem'),
cert: fs.readFileSync('./sslcert/cert.pem')
}
https.createServer(options, app).listen(port, serverStart);
}
| Fix heroku using wrong port | Fix heroku using wrong port
| JavaScript | mit | justinsacbibit/omi,justinsacbibit/omi,justinsacbibit/omi | ---
+++
@@ -19,7 +19,7 @@
, path = require('path')
, api = require('./api/app.js');
-var port = process.env.PORT || process.env.SSL ? 443 : 8080;
+var port = process.env.PORT || (process.env.SSL ? 443 : 8080);
app.use(bodyParser.urlencoded({
extended: true |
48011046ae3904c2818b311e8cd0e474505a206c | index.js | index.js | 'use strict';
const express = require('express');
const moment = require('moment');
const app = express();
const port = process.argv[2] || 3000;
app.get('/:timestamp', (request, response) => {
const timestamp = request.params.timestamp;
let result = {};
if (moment.unix(timestamp).isValid()) {
result = {
unix: parseInt(timestamp),
natural: moment.unix(timestamp).format('MMMM D, YYYY')
}
} else if (moment(new Date(timestamp)).isValid()) {
result = {
unix: moment(new Date(timestamp)).format('X'),
natural: moment(new Date(timestamp)).format('MMMM D, YYYY')
}
} else {
result = {
unix: null,
natural: null
}
}
response.end(JSON.stringify(result));
});
app.listen(port, () => {
console.log(`Server listening on port ${port}...`);
})
| 'use strict';
const express = require('express');
const moment = require('moment');
const app = express();
const port = process.argv[2] || 3000;
app.get('/:timestamp', (request, response) => {
const timestamp = request.params.timestamp;
let result = {};
if (moment.unix(timestamp).isValid()) {
result = {
unix: parseInt(timestamp),
natural: moment.unix(timestamp).format('MMMM D, YYYY')
}
} else if (moment(new Date(timestamp)).isValid()) {
result = {
unix: moment(new Date(timestamp)).format('X'),
natural: moment(new Date(timestamp)).format('MMMM D, YYYY')
}
} else {
result = {
unix: null,
natural: null
}
}
response.json(result);
});
app.listen(port, () => {
console.log(`Server listening on port ${port}...`);
})
| Use express' response.json() method because it sets proper header automatically | Use express' response.json() method because it sets proper header automatically
| JavaScript | mit | NicholasAsimov/timestamp-microservice | ---
+++
@@ -28,7 +28,7 @@
}
}
- response.end(JSON.stringify(result));
+ response.json(result);
});
app.listen(port, () => { |
6e7940cee3cfb45526a12b24901bfef982b81eb8 | client/components/Nav.js | client/components/Nav.js | import React, { Component } from 'react'
import { Link, IndexLink } from 'react-router'
export class Nav extends Component {
constructor(props) {
super(props)
}
render() {
return (
<nav className="transparent haze-background wrap navbar navbar-default" role="navigation">
<div className="container-fluid">
<div className="navbar-header">
<button type="button" className="haze-background navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
</div>
<div className="brand-centered">
<IndexLink to="/" className="navbar-brand">Journey</IndexLink>
</div>
<div className="navbar-collapse collapse" id="navigation">
<ul className="nav navbar-nav navbar-left">
<li><Link activeClassName="nav-active" to="/journal">Journal</Link></li>
<li><Link activeClassName="nav-active" to="/dashboard">Dashboard</Link></li>
</ul>
<ul className="nav navbar-nav navbar-right">
<li><Link activeClassName="nav-active" to="/profile">Profile</Link></li>
<li><Link activeClassName="nav-active" to="/signin">Log In</Link></li>
</ul>
</div>
</div>
</nav>
)
}
} | import React, { Component } from 'react'
import { Link, IndexLink } from 'react-router'
export class Nav extends Component {
constructor(props) {
super(props)
}
render() {
return (
<nav className="transparent haze-background wrap navbar navbar-default" role="navigation">
<div className="container-fluid">
<div className="navbar-header">
<button type="button" className="haze-background navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
</div>
<div className="brand-centered">
<IndexLink to="/" className="navbar-brand">Journey</IndexLink>
</div>
<div className="navbar-collapse collapse" id="navigation">
<ul className="nav navbar-nav navbar-left">
<li><Link activeClassName="nav-active" to="/journal">Journal</Link></li>
<li><Link activeClassName="nav-active" to="/dashboard">Dashboard</Link></li>
</ul>
<ul className="nav navbar-nav navbar-right">
<li><Link activeClassName="nav-active" to="/profile">Profile</Link></li>
<li><Link activeClassName="nav-active" to="/login">Log In</Link></li>
</ul>
</div>
</div>
</nav>
)
}
} | Update /signin link to /login | Update /signin link to /login
| JavaScript | mit | scrumptiousAmpersand/journey,scrumptiousAmpersand/journey | ---
+++
@@ -28,7 +28,7 @@
</ul>
<ul className="nav navbar-nav navbar-right">
<li><Link activeClassName="nav-active" to="/profile">Profile</Link></li>
- <li><Link activeClassName="nav-active" to="/signin">Log In</Link></li>
+ <li><Link activeClassName="nav-active" to="/login">Log In</Link></li>
</ul>
</div>
</div> |
16d5a32553342cdff499ca0bb96b767d9bbbcedf | index.js | index.js | 'use strict';
module.exports = function (deck/*, options*/) {
var options = Object(arguments[1]), root = options.root || '/'
, update, activateSlide;
activateSlide = function (index) {
if (index === deck.slide()) return;
deck.slide(index);
};
update = function (e) {
var id = location.pathname.slice(root.length, -1);
if (!id) return;
if (isNaN(id)) {
deck.slides.forEach(function (slide, i) {
if (slide.getAttribute('data-bespoke-id') === id) activateSlide(i);
});
return;
}
activateSlide(Number(id));
};
setTimeout(function () {
update();
var first = deck.slides[0].getAttribute('data-bespoke-id') || '1';
deck.on('activate', function (e) {
var urlSearch = location.search
, slideName = e.slide.getAttribute('data-bespoke-id') ||
String(e.index + 1);
history.pushState({}, '', root +
((slideName === first) ? '' : (slideName + '/')) + urlSearch);
});
window.addEventListener('popstate', update);
}, 0);
};
| 'use strict';
module.exports = function (deck/*, options*/) {
var options = arguments[1], root, update, activateSlide;
if (typeof options === 'string') {
root = options;
} else {
options = Object(options);
root = options.root || '/';
}
activateSlide = function (index) {
if (index === deck.slide()) return;
deck.slide(index);
};
update = function (e) {
var id = location.pathname.slice(root.length, -1);
if (!id) return;
if (isNaN(id)) {
deck.slides.forEach(function (slide, i) {
if (slide.getAttribute('data-bespoke-id') === id) activateSlide(i);
});
return;
}
activateSlide(Number(id));
};
setTimeout(function () {
update();
var first = deck.slides[0].getAttribute('data-bespoke-id') || '1';
deck.on('activate', function (e) {
var urlSearch = location.search
, slideName = e.slide.getAttribute('data-bespoke-id') ||
String(e.index + 1);
history.pushState({}, '', root +
((slideName === first) ? '' : (slideName + '/')) + urlSearch);
});
window.addEventListener('popstate', update);
}, 0);
};
| Support `root` as direct argument | Support `root` as direct argument
| JavaScript | mit | medikoo/bespoke-history | ---
+++
@@ -1,8 +1,14 @@
'use strict';
module.exports = function (deck/*, options*/) {
- var options = Object(arguments[1]), root = options.root || '/'
- , update, activateSlide;
+ var options = arguments[1], root, update, activateSlide;
+
+ if (typeof options === 'string') {
+ root = options;
+ } else {
+ options = Object(options);
+ root = options.root || '/';
+ }
activateSlide = function (index) {
if (index === deck.slide()) return; |
260424ef0d594941d700368ed40a9f749699b7c4 | test/buster.js | test/buster.js | var config = module.exports;
config["Node tests"] = {
environment: "node",
tests: ["test/*.js"]
};
| var config = module.exports;
config["Node tests"] = {
environment: "node",
tests: ["./*-test.js"]
};
| Update configuration file for new implicit root path | Update configuration file for new implicit root path
| JavaScript | bsd-3-clause | busterjs/buster-cli | ---
+++
@@ -2,5 +2,5 @@
config["Node tests"] = {
environment: "node",
- tests: ["test/*.js"]
+ tests: ["./*-test.js"]
}; |
5a24e17fc6f172526d68428c4a40b0e59bc0fea9 | index.js | index.js | 'use strict';
var HOSTS = process.platform === 'win32'
? 'C:/Windows/System32/drivers/etc/hosts'
: '/etc/hosts'
var readFileSync = require('fs').readFileSync;
module.exports = function () {
return readFileSync(HOSTS, { encoding: 'utf8' })
.split(/\r?\n/)
.map(function(line){
// R.E from feross/hostile
var matches = /^\s*?([^#]+?)\s+([^#]+?)$/.exec(line)
if (matches && matches.length === 3) {
return [matches[1],matches[2]]
}
})
.filter(function(h){return !!h}); // Need to avoid this.
};
| 'use strict';
var once = require('once');
var split = require('split');
var through = require('through');
var readFileSync = require('fs').readFileSync;
var createReadStream = require('fs').createReadStream;
var HOSTS = process.platform === 'win32' ?
'C:/Windows/System32/drivers/etc/hosts' : '/etc/hosts';
var massageItem = function(line){
// R.E from feross/hostile
var matches = /^\s*?([^#]+?)\s+([^#]+?)$/.exec(line)
if (matches && matches.length === 3) {
var hostMap = {};
hostMap[matches[2]] = matches[1]; // host:ip
return hostMap;
}
};
var massageData = function(data) {
return data.split(/\r?\n/)
.map(massageItem)
.filter(Boolean);
};
var massageStream = function(){
return through(function write(data){
var hostMap = massageItem(data);
if (hostMap) {
this.queue(data);
}
})
};
module.exports = function(cb) {
if (typeof cb !== 'function') {
return massageData(readFileSync(HOSTS, {
encoding: 'utf8'
}));
} else {
cb = once(cb);
createReadStream(HOSTS, {
encoding: 'utf8'
})
.pipe(split())
.pipe(massageStream())
.on('data', function(data) {
//Should send the data here.
})
.on('error', function(err) {
cb(err, false);
})
}
};
| Return array of objs and using stream. | Return array of objs and using stream.
| JavaScript | mit | hemanth/get-hosts | ---
+++
@@ -1,17 +1,53 @@
'use strict';
-var HOSTS = process.platform === 'win32'
- ? 'C:/Windows/System32/drivers/etc/hosts'
- : '/etc/hosts'
+var once = require('once');
+var split = require('split');
+var through = require('through');
var readFileSync = require('fs').readFileSync;
-module.exports = function () {
- return readFileSync(HOSTS, { encoding: 'utf8' })
- .split(/\r?\n/)
- .map(function(line){
- // R.E from feross/hostile
- var matches = /^\s*?([^#]+?)\s+([^#]+?)$/.exec(line)
- if (matches && matches.length === 3) {
- return [matches[1],matches[2]]
- }
- })
- .filter(function(h){return !!h}); // Need to avoid this.
+var createReadStream = require('fs').createReadStream;
+var HOSTS = process.platform === 'win32' ?
+ 'C:/Windows/System32/drivers/etc/hosts' : '/etc/hosts';
+var massageItem = function(line){
+ // R.E from feross/hostile
+ var matches = /^\s*?([^#]+?)\s+([^#]+?)$/.exec(line)
+ if (matches && matches.length === 3) {
+ var hostMap = {};
+ hostMap[matches[2]] = matches[1]; // host:ip
+ return hostMap;
+ }
};
+
+var massageData = function(data) {
+ return data.split(/\r?\n/)
+ .map(massageItem)
+ .filter(Boolean);
+};
+
+var massageStream = function(){
+ return through(function write(data){
+ var hostMap = massageItem(data);
+ if (hostMap) {
+ this.queue(data);
+ }
+ })
+};
+
+module.exports = function(cb) {
+ if (typeof cb !== 'function') {
+ return massageData(readFileSync(HOSTS, {
+ encoding: 'utf8'
+ }));
+ } else {
+ cb = once(cb);
+ createReadStream(HOSTS, {
+ encoding: 'utf8'
+ })
+ .pipe(split())
+ .pipe(massageStream())
+ .on('data', function(data) {
+ //Should send the data here.
+ })
+ .on('error', function(err) {
+ cb(err, false);
+ })
+ }
+}; |
d26945e785f8b98776ff8e0c0e0bc6ecdf5fc81d | index.js | index.js | 'use strict';
var _ = require('underscore');
var config = require('./config');
var express = require('express');
var knox = require('knox');
var app = express();
// Configure knox.
app.s3 = knox.createClient({
key: config.accessKeyId,
secret: config.secretAccessKey,
bucket: config.bucket
});
// Don't waste bytes on an extra header.
app.disable('x-powered-by');
// Helpful vendor middleware.
app.use(express.compress());
app.use(express.bodyParser());
app.use(express.methodOverride());
// Enable CORS on demand.
if (config.cors) app.use(require('./lib/cors'));
// Set req.authorized based on servo key.
app.use(require('./lib/authorize'));
// Upload files to the S3 bucket.
app.put('*', require('./lib/update-files'));
// Delete a file from the S3 bucket.
app.del('*', require('./lib/delete-file'));
// Requests should be in the form /path/to/image(-job-name)(.extension)
app.get(
/^(\/.*?)(?:-(.*?))?(?:\.(.*))?$/,
require('./lib/check-user-agent'),
require('./lib/read-file')
);
// Ensure bad responses aren't cached.
app.use(require('./lib/handle-error'));
// Start listening for requests.
var server = app.listen(config.port);
process.on('SIGTERM', _.bind(server.close, server));
| 'use strict';
var _ = require('underscore');
var config = require('./config');
var express = require('express');
var knox = require('knox');
var app = express();
// Configure knox.
app.s3 = knox.createClient({
key: config.accessKeyId,
secret: config.secretAccessKey,
bucket: config.bucket
});
// Don't waste bytes on an extra header.
app.disable('x-powered-by');
// Helpful vendor middleware.
app.use(express.compress());
app.use(express.urlencoded());
app.use(express.json());
app.use(express.methodOverride());
// Enable CORS on demand.
if (config.cors) app.use(require('./lib/cors'));
// Set req.authorized based on servo key.
app.use(require('./lib/authorize'));
// Upload files to the S3 bucket.
app.put('*', require('./lib/update-files'));
// Delete a file from the S3 bucket.
app.del('*', require('./lib/delete-file'));
// Requests should be in the form /path/to/image(-job-name)(.extension)
app.get(
/^(\/.*?)(?:-(.*?))?(?:\.(.*))?$/,
require('./lib/check-user-agent'),
require('./lib/read-file')
);
// Ensure bad responses aren't cached.
app.use(require('./lib/handle-error'));
// Start listening for requests.
var server = app.listen(config.port);
process.on('SIGTERM', _.bind(server.close, server));
| Remove Connect 3 deprecation warning | Remove Connect 3 deprecation warning
| JavaScript | mit | orgsync/servo | ---
+++
@@ -19,7 +19,8 @@
// Helpful vendor middleware.
app.use(express.compress());
-app.use(express.bodyParser());
+app.use(express.urlencoded());
+app.use(express.json());
app.use(express.methodOverride());
// Enable CORS on demand. |
4c92ec1ab4ee06effe7fab8a7ae59ba4a80e9dd4 | index.js | index.js | 'use strict';
const runner = require('toisu-middleware-runner');
const stacks = new WeakMap();
class Toisu {
constructor() {
stacks.set(this, []);
this.handleError = Toisu.defaultHandleError;
}
use(middleware) {
stacks.get(this).push(middleware);
return this;
}
get requestHandler() {
return (req, res) => {
const stack = stacks.get(this);
const context = new Map();
return runner.call(context, req, res, stack)
.then(() => {
if (!res.headersSent) {
res.statusCode = 404;
res.end();
}
})
.catch(error => this.handleError.call(context, req, res, error));
};
}
static defaultHandleError(req, res) {
res.statusCode = 502;
res.end();
}
}
module.exports = Toisu;
| 'use strict';
const runner = require('toisu-middleware-runner');
const stacks = new WeakMap();
class Toisu {
constructor() {
stacks.set(this, []);
this.handleError = Toisu.defaultHandleError;
}
use(middleware) {
stacks.get(this).push(middleware);
return this;
}
get requestHandler() {
return (req, res) => {
const stack = stacks.get(this);
const context = new Map();
return runner.call(context, req, res, stack)
.then(() => {
if (!res.headersSent) {
res.statusCode = 404;
res.end();
}
})
.catch(error => this.handleError.call(context, req, res, error));
};
}
static defaultHandleError(req, res) {
res.statusCode = 500;
res.end();
}
}
module.exports = Toisu;
| Use correct error status code. | Use correct error status code.
| JavaScript | mit | qubyte/toisu | ---
+++
@@ -31,7 +31,7 @@
}
static defaultHandleError(req, res) {
- res.statusCode = 502;
+ res.statusCode = 500;
res.end();
}
} |
40a0ffde6c20f5201adac18671230c08c08b39d1 | index.js | index.js | "use strict";
module.exports = {
rules: {
"jquery-var-name": require("./lib/rules/jquery-var-name"),
"check-closure-globals": require("./lib/rules/check-closure-globals")
},
rulesConfig: {
"jquery-var-name": [2],
"check-closure-globals": [2]
}
};
| "use strict";
module.exports = {
rules: {
"jquery-var-name": require("./lib/rules/jquery-var-name"),
"check-closure-globals": require("./lib/rules/check-closure-globals")
},
rulesConfig: {
"jquery-var-name": [1],
"check-closure-globals": [1]
}
};
| Make default level a warning | Make default level a warning
| JavaScript | mit | theodoreb/eslint-plugin-drupal | ---
+++
@@ -6,7 +6,7 @@
"check-closure-globals": require("./lib/rules/check-closure-globals")
},
rulesConfig: {
- "jquery-var-name": [2],
- "check-closure-globals": [2]
+ "jquery-var-name": [1],
+ "check-closure-globals": [1]
}
}; |
9b562aed4d0d8490f9f2a36d8cf3eac64d80eb61 | index.js | index.js | var VOWELS = /[aeiou]+/gi;
var WHITE_SPACE = /\s+/g;
var NOTHING = '';
function tokenize(str){
return str.split(WHITE_SPACE);
}
function replace(tokens){
return tokens.map(function(t){
return t.replace(VOWELS,NOTHING);
});
}
exports.parse = function parse(string, join){
if(typeof string !== 'string'){
throw new TypeError('Expected a string as the first option');
}
join = join || false;
var tokens = tokenize(string);
var unvoweled = replace(tokens);
return join ? unvoweled.join('') : unvoweled.join(' ');
};
| var VOWELS = /[aeiou]/gi;
var VOWELS_AND_SPACE = /[aeiou\s]/g;
exports.parse = function parse(string, join){
if(typeof string !== 'string'){
throw new TypeError('Expected a string as the first option');
}
join = join || false;
var replacer = VOWELS;
if (join) {
replacer = VOWELS_AND_SPACE;
}
return string.replace(replacer, '');
};
| Reduce amount of transformations by ~66% | Reduce amount of transformations by ~66%
| JavaScript | mit | lestoni/unvowel | ---
+++
@@ -1,16 +1,5 @@
-var VOWELS = /[aeiou]+/gi;
-var WHITE_SPACE = /\s+/g;
-var NOTHING = '';
-
-function tokenize(str){
- return str.split(WHITE_SPACE);
-}
-
-function replace(tokens){
- return tokens.map(function(t){
- return t.replace(VOWELS,NOTHING);
- });
-}
+var VOWELS = /[aeiou]/gi;
+var VOWELS_AND_SPACE = /[aeiou\s]/g;
exports.parse = function parse(string, join){
if(typeof string !== 'string'){
@@ -18,9 +7,10 @@
}
join = join || false;
+ var replacer = VOWELS;
+ if (join) {
+ replacer = VOWELS_AND_SPACE;
+ }
- var tokens = tokenize(string);
- var unvoweled = replace(tokens);
-
- return join ? unvoweled.join('') : unvoweled.join(' ');
+ return string.replace(replacer, '');
}; |
3c4a2e9a777e1d18f7886df57d616f5a9d69925c | tests/index.js | tests/index.js | // let referee = require('referee')
// let {assert} = referee
// let {beforeEach, afterEach} = window
//
// // assertions counting
// let expected = 0
// referee.add('expect', {
// assert: (exp) => {
// expected = exp
// return true
// }
// })
// beforeEach(() => {
// referee.count = 0
// })
// afterEach(function () {
// var self = this
// if (expected === false) return
// try {
// assert(expected === referee.count - 1, 'expected ' + expected + ' assertions, got ' + referee.count)
// } catch (err) {
// err.message = err.message + ' in ' + self.currentTest.title
// throw err
// // self.currentTest.emit('error', err)
// // self.test.emit('error', err)
// }
// expected = false
// })
let testsContext = require.context('.', true, /Test$/)
testsContext.keys().forEach(testsContext)
| // let referee = require('referee')
// let {assert} = referee
// let {beforeEach, afterEach} = window
//
// // assertions counting
// let expected = 0
// referee.add('expect', {
// assert: (exp) => {
// expected = exp
// return true
// }
// })
// beforeEach(() => {
// referee.count = 0
// })
// afterEach(function () {
// var self = this
// if (expected === false) return
// try {
// assert(expected === referee.count - 1, 'expected ' + expected + ' assertions, got ' + referee.count)
// } catch (err) {
// err.message = err.message + ' in ' + self.currentTest.title
// throw err
// // self.currentTest.emit('error', err)
// // self.test.emit('error', err)
// }
// expected = false
// })
// need to do this for co to work
let Promise = require('es6-promise').Promise
window.Promise = Promise
let testsContext = require.context('.', true, /Test$/)
testsContext.keys().forEach(testsContext)
| Make tests pass in all browsers (co relies on global Promise) | Make tests pass in all browsers (co relies on global Promise)
| JavaScript | mit | QubitProducts/cherrytree,QubitProducts/cherrytree,nathanboktae/cherrytree,nathanboktae/cherrytree | ---
+++
@@ -27,5 +27,9 @@
// expected = false
// })
+// need to do this for co to work
+let Promise = require('es6-promise').Promise
+window.Promise = Promise
+
let testsContext = require.context('.', true, /Test$/)
testsContext.keys().forEach(testsContext) |
2b330e110da8849d5edd4258f6e65e266fd48073 | index.js | index.js | var fs = require('fs');
var _ = require('lodash');
var Datastore = require('nedb'),
db = new Datastore({ filename: './data/xkcd', autoload: true });
module.exports = function (words, callback) {
db.find({ word: { $in: words } }, function (err, docs) {
if (err) return callback(err);
if (!docs.length) {
callback(null, []);
return;
}
var entries = _.map(docs, 'entries');
var result = _.intersection.apply(_, entries);
if (result.length && docs.length == words.length) {
callback(null, result)
} else {
callback(null, [])
}
});
}
| var fs = require('fs');
var _ = require('lodash');
var Datastore = require('nedb'),
db = new Datastore({ filename: __dirname + '/data/xkcd', autoload: true });
module.exports = function (words, callback) {
db.find({ word: { $in: words } }, function (err, docs) {
if (err) return callback(err);
if (!docs.length) {
callback(null, []);
return;
}
var entries = _.map(docs, 'entries');
var result = _.intersection.apply(_, entries);
if (result.length && docs.length == words.length) {
callback(null, result)
} else {
callback(null, [])
}
});
}
| Use an absolute path to load the db file | Use an absolute path to load the db file
This makes it so that the module can also be used in other node projects even when xkcd-cli is contained within the `node_modules` of the depending package | JavaScript | mit | necccc/xkcd-cli | ---
+++
@@ -2,7 +2,7 @@
var _ = require('lodash');
var Datastore = require('nedb'),
- db = new Datastore({ filename: './data/xkcd', autoload: true });
+ db = new Datastore({ filename: __dirname + '/data/xkcd', autoload: true });
module.exports = function (words, callback) { |
fd6144bacd22dbf4d8b9e74ebb56835726d631d8 | index.js | index.js | 'use strict';
module.exports = {
name: 'ember-cli-stripe'
};
| 'use strict';
module.exports = {
name: 'ember-cli-stripe',
contentFor: function(type) {
if(type === 'body') {
return '<script src="https://checkout.stripe.com/checkout.js"></script>';
}
},
};
| Add content-for hook to add Stripe's checkout.js | Add content-for hook to add Stripe's checkout.js
| JavaScript | mit | vladucu/ember-cli-stripe,vladucu/ember-cli-stripe | ---
+++
@@ -1,5 +1,11 @@
'use strict';
module.exports = {
- name: 'ember-cli-stripe'
+ name: 'ember-cli-stripe',
+
+ contentFor: function(type) {
+ if(type === 'body') {
+ return '<script src="https://checkout.stripe.com/checkout.js"></script>';
+ }
+ },
}; |
32c5de2ad9c490aa9ae9eb05745947f060fb1ea9 | www/js/main.js | www/js/main.js | window.onload = action
var action = document.pesan.action = login();
function login() {
var nama = document.pesan.nama.value;
var no-bpjs = document.pesan.no-bpjs.value;
var name = "Andre Christoga";
var bpjs-no = "";
if ((nama == name) && (no-bpjs == bpjs-no)) {
window.location.href = "rs.html";
};
else {
alert("Harap mendaftar terlebih dahulu")
}
}
| window.onload = action
var action = document.pesan.action = login();
function login() {
var nama = document.pesan.nama.value;
var no-bpjs = document.pesan.no-bpjs.value;
var name = "Andre Christoga";
var bpjs-no = "";
if ((nama == name) && (no-bpjs == bpjs-no)) {
window.location.href = "rs.html";
return true;
};
else {
alert("Harap mendaftar terlebih dahulu")
}
}
| Return true if its true | Return true if its true
| JavaScript | mit | cepatsembuh/cordova,christoga/cepatsembuh,cepatsembuh/cordova,mercysmart/cepatsembuh,mercysmart/cepatsembuh,mercysmart/cepatsembuh,mercysmart/cepatsembuh,mercysmart/cepatsembuh,cepatsembuh/cordova,christoga/cepatsembuh,cepatsembuh/cordova,christoga/cepatsembuh,christoga/cepatsembuh,cepatsembuh/cordova,christoga/cepatsembuh | ---
+++
@@ -9,6 +9,7 @@
if ((nama == name) && (no-bpjs == bpjs-no)) {
window.location.href = "rs.html";
+ return true;
};
else {
alert("Harap mendaftar terlebih dahulu") |
27704f4330fd2307ce5013b34fdb8a0e7bde6b2a | config/env/production.js | config/env/production.js | 'use strict';
module.exports = {
db: 'mongodb://localhost/mean-prod',
app: {
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
},
emailFrom : 'SENDER EMAIL ADDRESS', // sender address like ABC <abc@example.com>
mailer: {
service: 'SERVICE_PROVIDER',
auth: {
user: 'EMAIL_ID',
pass: 'PASSWORD'
}
}
};
| 'use strict';
module.exports = {
db: process.env.MONGOHQ_URL,
app: {
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
},
emailFrom : 'SENDER EMAIL ADDRESS', // sender address like ABC <abc@example.com>
mailer: {
service: 'SERVICE_PROVIDER',
auth: {
user: 'EMAIL_ID',
pass: 'PASSWORD'
}
}
};
| Use config property for db. | Use config property for db.
| JavaScript | mit | wombleton/hardholdr,wombleton/hardholdr | ---
+++
@@ -1,7 +1,7 @@
'use strict';
module.exports = {
- db: 'mongodb://localhost/mean-prod',
+ db: process.env.MONGOHQ_URL,
app: {
name: 'MEAN - A Modern Stack - Production'
}, |
360f33015fb0c4f7c33099b9b24cf6216f1adcc6 | src/helpers.js | src/helpers.js | import { flatten, groupBy, map, omit } from 'lodash';
import { plural } from 'pluralize';
export function populateByService(app, documents, idField, typeField, options) {
let types = groupBy(documents, typeField);
return Promise.all(
Object.keys(types).map((type) => {
let entries = types[type];
return app.service(plural(type)).find(Object.assign({
query: {
_id: { $in: map(entries, idField) },
}
}, options));
})
).then((results) => {
results = options.provider? flatten(map(results, 'data')) : flatten(results);
documents = map(documents, (doc) => {
return Object.assign({ _id: doc.id }, doc, results.find((item) => {
return String(doc[idField]) === String(item.id);
}));
});
return documents;
});
} | import fp from 'lodash/fp';
import { plural } from 'pluralize';
const populateList = (list, idField) => (data) => {
return fp.map((doc) => {
let item = data.find((item) => {
return String(doc[idField]) === String(item.id);
});
return item;
})(list);
};
const populateByService = (app, idField, typeField, options) => (list) => {
let types = fp.groupBy(typeField, list);
return Promise.all(
Object.keys(types).map((type) => {
let entries = types[type];
return app.service(plural(type)).find(Object.assign({
query: {
_id: { $in: fp.map(idField, entries) },
}
}, options));
})
).then((results) => {
return fp.flow(
options.provider? fp.flow(fp.map('data'), fp.flatten) : fp.flatten,
populateList(list, idField),
fp.compact
)(results);
});
};
export default { populateList, populateByService }; | Fix populateByService and make it functional | Fix populateByService and make it functional
| JavaScript | mit | PlayingIO/playing-content-services | ---
+++
@@ -1,24 +1,33 @@
-import { flatten, groupBy, map, omit } from 'lodash';
+import fp from 'lodash/fp';
import { plural } from 'pluralize';
-export function populateByService(app, documents, idField, typeField, options) {
- let types = groupBy(documents, typeField);
+const populateList = (list, idField) => (data) => {
+ return fp.map((doc) => {
+ let item = data.find((item) => {
+ return String(doc[idField]) === String(item.id);
+ });
+ return item;
+ })(list);
+};
+
+const populateByService = (app, idField, typeField, options) => (list) => {
+ let types = fp.groupBy(typeField, list);
return Promise.all(
Object.keys(types).map((type) => {
let entries = types[type];
return app.service(plural(type)).find(Object.assign({
query: {
- _id: { $in: map(entries, idField) },
+ _id: { $in: fp.map(idField, entries) },
}
}, options));
})
).then((results) => {
- results = options.provider? flatten(map(results, 'data')) : flatten(results);
- documents = map(documents, (doc) => {
- return Object.assign({ _id: doc.id }, doc, results.find((item) => {
- return String(doc[idField]) === String(item.id);
- }));
- });
- return documents;
+ return fp.flow(
+ options.provider? fp.flow(fp.map('data'), fp.flatten) : fp.flatten,
+ populateList(list, idField),
+ fp.compact
+ )(results);
});
-}
+};
+
+export default { populateList, populateByService }; |
598bce8e87b46e4a65e70034fad397cfdb38907f | dist/angular-metrics-graphics.min.js | dist/angular-metrics-graphics.min.js | /* Compiled 2015-12-15 09:12:28 */
"use strict";angular.module("metricsgraphics",[]).directive("chart",function(){return{link:function(a,b){function c(a){for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ",c="",d=0;a>d;d++){var e=Math.floor(Math.random()*b.length);c+=b.substring(e,e+1)}return"mg-chart-"+c}var d={baselines:[],description:null,height:200,right:0,title:null,width:b[0].parentElement.clientWidth||300,x_accessor:null,y_accessor:null};a.options&&Object.keys(a.options).forEach(function(b){d[b]=a.options[b]}),b[0].id=b[0].id?b[0].id:c(5),d.data=a.data||[],d.target="#"+b[0].id,a.convertDateField&&(d.data=MG.convert.date(d.data,a.convertDateField)),MG.data_graphic(d)},restrict:"E",scope:{convertDateField:"@",data:"=",options:"="}}});
//# sourceMappingURL=angular-metrics-graphics.min.map | /* Compiled 2015-12-15 09:12:13 */
"use strict";angular.module("metricsgraphics",[]).directive("chart",function(){return{link:function(a,b){function c(a){for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ",c="",d=0;a>d;d++){var e=Math.floor(Math.random()*b.length);c+=b.substring(e,e+1)}return"mg-chart-"+c}var d={baselines:[],description:null,height:200,right:0,title:null,width:b[0].parentElement.clientWidth||300,x_accessor:null,y_accessor:null};a.options&&Object.keys(a.options).forEach(function(b){d[b]=a.options[b]}),b[0].id=b[0].id?b[0].id:c(5),d.data=a.data||[],d.target="#"+b[0].id,a.convertDateField&&(d.data=MG.convert.date(d.data,a.convertDateField)),MG.data_graphic(d)},restrict:"E",scope:{convertDateField:"@",data:"=",options:"="}}});
//# sourceMappingURL=angular-metrics-graphics.min.map | Add option to preprocess date fields for inline data. | Add option to preprocess date fields for inline data.
resolve #3
| JavaScript | mit | elmarquez/angular-metrics-graphics,elmarquez/angular-metrics-graphics | ---
+++
@@ -1,4 +1,4 @@
-/* Compiled 2015-12-15 09:12:28 */
+/* Compiled 2015-12-15 09:12:13 */
"use strict";angular.module("metricsgraphics",[]).directive("chart",function(){return{link:function(a,b){function c(a){for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ",c="",d=0;a>d;d++){var e=Math.floor(Math.random()*b.length);c+=b.substring(e,e+1)}return"mg-chart-"+c}var d={baselines:[],description:null,height:200,right:0,title:null,width:b[0].parentElement.clientWidth||300,x_accessor:null,y_accessor:null};a.options&&Object.keys(a.options).forEach(function(b){d[b]=a.options[b]}),b[0].id=b[0].id?b[0].id:c(5),d.data=a.data||[],d.target="#"+b[0].id,a.convertDateField&&(d.data=MG.convert.date(d.data,a.convertDateField)),MG.data_graphic(d)},restrict:"E",scope:{convertDateField:"@",data:"=",options:"="}}});
//# sourceMappingURL=angular-metrics-graphics.min.map |
50d1f0fd46066aa370aa7753d9102b2514a62caa | src/router/index.js | src/router/index.js | import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Hello',
component: Hello
}
]
})
| import Vue from 'vue'
import Router from 'vue-router'
import Conversations from '@/components/Conversations.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'conversations-list',
component: Conversations
}
]
})
| Update router to conversation list | Update router to conversation list
| JavaScript | apache-2.0 | Serubin/PulseClient,Serubin/PulseClient | ---
+++
@@ -1,6 +1,6 @@
import Vue from 'vue'
import Router from 'vue-router'
-import Hello from '@/components/Hello'
+import Conversations from '@/components/Conversations.vue'
Vue.use(Router)
@@ -8,8 +8,8 @@
routes: [
{
path: '/',
- name: 'Hello',
- component: Hello
+ name: 'conversations-list',
+ component: Conversations
}
]
}) |
9ac734d489af8e44a64c535e688d4e7c8663f62b | src/hooks/use-moralis.js | src/hooks/use-moralis.js | let Moralis;
export function useMoralis() {
if (Moralis) return { Moralis };
// Moralis Initialization
if (typeof window !== `undefined`) {
Moralis = require('moralis');
Moralis.initialize('knjJS1n0Hf0vkWjluePnByHQKVgUNdujnbtPbMUD');
Moralis.serverURL = 'https://memk9nntn6p4.moralis.io:2053/server';
}
return { Moralis };
}
| let Moralis;
export function useMoralis() {
if (Moralis) return { Moralis };
// Moralis Initialization
if (typeof window !== `undefined`) {
Moralis = require('moralis');
Moralis.initialize(process.env.MORALIS_APPLICATION_ID);
Moralis.serverURL = process.env.MORALIS_SERVER_ID;
}
return { Moralis };
}
| Switch back to env variables, troubleshoot with Fleek | Switch back to env variables, troubleshoot with Fleek
| JavaScript | mit | iammatthias/.com,iammatthias/.com,iammatthias/.com | ---
+++
@@ -4,8 +4,8 @@
// Moralis Initialization
if (typeof window !== `undefined`) {
Moralis = require('moralis');
- Moralis.initialize('knjJS1n0Hf0vkWjluePnByHQKVgUNdujnbtPbMUD');
- Moralis.serverURL = 'https://memk9nntn6p4.moralis.io:2053/server';
+ Moralis.initialize(process.env.MORALIS_APPLICATION_ID);
+ Moralis.serverURL = process.env.MORALIS_SERVER_ID;
}
return { Moralis };
} |
0ef21e977f51aeffa279442326785704a16347fe | src/supp_classes.js | src/supp_classes.js |
export class Date{
constructor(day, hour, min){
this.day = day;
this.hour = hour;
this.min = min;
}
toString(){
return ("date: " + this.day + "-- " + this.hour + ":" + this.min);
}
/*
if a < b : return -1
if a == b : return 0
if a > b : return 1
*/
static compare(a, b){
if (a.day<b.day)
return -1;
if (a.day>b.day)
return 1;
if (a.hour<b.hour)
return -1;
if (a.hour>b.hour)
return 1;
if (a.min<b.min)
return -1;
if (a.min>b.min)
return 1;
return 0;
}
}
export class Event{
constructor(name) {
this.name = name;
}
}
export class EventOption{
constructor(event, option, instances) {
this.event = event;
this.option = option;
this.instances = instances;
}
}
export class EventOptionInstance{
constructor(start, end){
this.start = start;
this.end = end;
}
}
|
export class Date{
constructor(day, hour, min){
this.day = day;
this.hour = hour;
this.min = min;
}
toString(){
return ("date: " + this.day + "-- " + this.hour + ":" + this.min);
}
/*
if a < b : return -1
if a == b : return 0
if a > b : return 1
*/
static compare(a, b){
if (a.day == 6 && b.day == 0)
return -1;
if (a.day == 0 && b.day == 6)
return 1;
if (a.day<b.day)
return -1;
if (a.day>b.day)
return 1;
if (a.hour<b.hour)
return -1;
if (a.hour>b.hour)
return 1;
if (a.min<b.min)
return -1;
if (a.min>b.min)
return 1;
return 0;
}
}
export class Event{
constructor(name) {
this.name = name;
}
}
export class EventOption{
constructor(event, option, instances) {
this.event = event;
this.option = option;
this.instances = instances;
}
}
export class EventOptionInstance{
constructor(start, end){
this.start = start;
this.end = end;
}
}
| Fix comparison for weekly limits | Fix comparison for weekly limits
| JavaScript | mit | bnan/dhroraryus,bnan/dhroraryus | ---
+++
@@ -15,6 +15,10 @@
if a > b : return 1
*/
static compare(a, b){
+ if (a.day == 6 && b.day == 0)
+ return -1;
+ if (a.day == 0 && b.day == 6)
+ return 1;
if (a.day<b.day)
return -1;
if (a.day>b.day) |
3620be72778c761dbd61e8549ccbbf15496ebc8f | server/static-seo-server.js | server/static-seo-server.js | "use strict";
var system = require("system");
if (system.args.length < 2) {
console.log("Missing arguments.");
phantom.exit();
}
var server = require("webserver").create();
var url = system.args[1];
var renderHtml = function(url, cb) {
var page = require("webpage").create();
var finished = false;
page.settings.loadImages = false;
page.settings.localToRemoteUrlAccessEnabled = true;
page.onCallback = function() {
setTimeout(function() {
if (!finished) {
cb(page.content);
page.close();
finished = true;
}
}, 100);
};
page.onInitialized = function() {
page.evaluate(function() {
document.addEventListener("__htmlReady__", function() {
window.callPhantom();
}, false);
});
};
page.open(url);
setTimeout(function() {
if (!finished) {
cb(page.content);
page.close();
finished = true;
}
}, 10000);
};
renderHtml(url, function(html) {
console.log(html);
phantom.exit();
}); | "use strict";
var system = require("system");
if (system.args.length < 2) {
console.log("Missing arguments.");
phantom.exit();
}
var url = system.args[1];
var renderHtml = function(url, cb) {
var page = require("webpage").create();
var finished = false;
page.settings.loadImages = false;
page.settings.localToRemoteUrlAccessEnabled = true;
page.onCallback = function() {
setTimeout(function() {
if (!finished) {
cb(page.content);
page.close();
finished = true;
}
}, 100);
};
page.onInitialized = function() {
page.evaluate(function() {
document.addEventListener("__htmlReady__", function() {
window.callPhantom();
}, false);
});
};
page.open(url);
setTimeout(function() {
if (!finished) {
cb(page.content);
page.close();
finished = true;
}
}, 10000);
};
renderHtml(url, function(html) {
console.log(html);
phantom.exit();
}); | Remove dead code in phantomjs server. | Remove dead code in phantomjs server.
| JavaScript | mit | zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io,zaknelson/hike.io | ---
+++
@@ -1,13 +1,10 @@
"use strict";
var system = require("system");
-
if (system.args.length < 2) {
console.log("Missing arguments.");
phantom.exit();
}
-
-var server = require("webserver").create();
var url = system.args[1];
var renderHtml = function(url, cb) {
@@ -42,7 +39,6 @@
}, 10000);
};
-
renderHtml(url, function(html) {
console.log(html);
phantom.exit(); |
34f89e654a07a99216d666ea78e34916fa28df57 | src/components/Navbar.js | src/components/Navbar.js | import React, { Component } from 'react'
import { connect } from 'react-redux'
import LoginButton from './LoginButton'
import LogoutButton from './LogoutButton'
import { getIsAuthenticated } from '../selectors/user'
class Navbar extends Component {
render() {
return (
<nav className='navbar navbar-default'>
<div className='container-fluid'>
<a className="navbar-brand" href="#">Choir Master</a>
<div className='navbar-form'>
{this.props.isAuthenticated ? <LogoutButton /> : <LoginButton />}
</div>
</div>
</nav>
);
}
}
export default connect(
state => ({
isAuthenticated: getIsAuthenticated(state)
})
)(Navbar); | import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Nav, NavItem } from 'react-bootstrap'
import { Navbar as NavbarReactBootstrap } from 'react-bootstrap'
import LoginButton from './LoginButton'
import LogoutButton from './LogoutButton'
import { getIsAuthenticated } from '../selectors/user'
class Navbar extends Component {
render() {
return (
<NavbarReactBootstrap>
<NavbarReactBootstrap.Header>
<NavbarReactBootstrap.Brand>
<a href="#">Choir Master</a>
</NavbarReactBootstrap.Brand>
</NavbarReactBootstrap.Header>
<Nav>
<NavItem eventKey={1} href="#/dashboard">Organizations</NavItem>
</Nav>
<NavbarReactBootstrap.Collapse>
<NavbarReactBootstrap.Form pullRight>
{this.props.isAuthenticated ? <LogoutButton /> : <LoginButton />}
</NavbarReactBootstrap.Form>
</NavbarReactBootstrap.Collapse>
</NavbarReactBootstrap>
);
}
}
export default connect(
state => ({
isAuthenticated: getIsAuthenticated(state)
})
)(Navbar); | Add organizations link in navbar | Add organizations link in navbar
| JavaScript | apache-2.0 | CovenantCollege/ChoirMasterClient,CovenantCollege/ChoirMasterClient | ---
+++
@@ -1,5 +1,7 @@
import React, { Component } from 'react'
import { connect } from 'react-redux'
+import { Nav, NavItem } from 'react-bootstrap'
+import { Navbar as NavbarReactBootstrap } from 'react-bootstrap'
import LoginButton from './LoginButton'
import LogoutButton from './LogoutButton'
import { getIsAuthenticated } from '../selectors/user'
@@ -7,14 +9,21 @@
class Navbar extends Component {
render() {
return (
- <nav className='navbar navbar-default'>
- <div className='container-fluid'>
- <a className="navbar-brand" href="#">Choir Master</a>
- <div className='navbar-form'>
+ <NavbarReactBootstrap>
+ <NavbarReactBootstrap.Header>
+ <NavbarReactBootstrap.Brand>
+ <a href="#">Choir Master</a>
+ </NavbarReactBootstrap.Brand>
+ </NavbarReactBootstrap.Header>
+ <Nav>
+ <NavItem eventKey={1} href="#/dashboard">Organizations</NavItem>
+ </Nav>
+ <NavbarReactBootstrap.Collapse>
+ <NavbarReactBootstrap.Form pullRight>
{this.props.isAuthenticated ? <LogoutButton /> : <LoginButton />}
- </div>
- </div>
- </nav>
+ </NavbarReactBootstrap.Form>
+ </NavbarReactBootstrap.Collapse>
+ </NavbarReactBootstrap>
);
}
} |
384d069210bfecc66dcff065847e3b2d1af7779a | src/computers/constant_infinite_computer.js | src/computers/constant_infinite_computer.js | var InfiniteComputer = require('./infinite_computer.js');
class ConstantInfiniteComputer extends InfiniteComputer {
getTotalScrollableHeight(): number {
return this.heightData * this.numberOfChildren;
}
getDisplayIndexStart(windowTop: number): number {
return Math.floor(windowTop / this.heightData);
}
getDisplayIndexEnd(windowBottom: number): number {
var nonZeroIndex = Math.ceil(windowBottom / this.heightData);
if (nonZeroIndex > 0) {
return nonZeroIndex - 1;
}
return nonZeroIndex;
}
getTopSpacerHeight(displayIndexStart: number): number {
return displayIndexStart * this.heightData;
}
getBottomSpacerHeight(displayIndexEnd: number): number {
var nonZeroIndex = displayIndexEnd + 1;
return Math.max(0, (this.numberOfChildren - nonZeroIndex) * this.heightData);
}
}
module.exports = ConstantInfiniteComputer;
| /* @flow */
var InfiniteComputer = require('./infinite_computer.js');
class ConstantInfiniteComputer extends InfiniteComputer {
getTotalScrollableHeight()/* : number */ {
return this.heightData * this.numberOfChildren;
}
getDisplayIndexStart(windowTop/* : number */)/* : number */ {
return Math.floor(windowTop / this.heightData);
}
getDisplayIndexEnd(windowBottom/* : number */)/* : number */ {
var nonZeroIndex = Math.ceil(windowBottom / this.heightData);
if (nonZeroIndex > 0) {
return nonZeroIndex - 1;
}
return nonZeroIndex;
}
getTopSpacerHeight(displayIndexStart/* : number */)/* : number */ {
return displayIndexStart * this.heightData;
}
getBottomSpacerHeight(displayIndexEnd/* : number */)/* : number */ {
var nonZeroIndex = displayIndexEnd + 1;
return Math.max(0, (this.numberOfChildren - nonZeroIndex) * this.heightData);
}
}
module.exports = ConstantInfiniteComputer;
| Add to one more file. | Add to one more file.
| JavaScript | bsd-3-clause | NordicSemiconductor/react-infinite,ahutchings/react-infinite,cesarandreu/react-infinite,pierregoutheraud/react-infinite,herojobs/react-infinite,beni55/react-infinite,NordicSemiconductor/react-infinite,amplii/react-infinite,noitakomentaja/react-infinite | ---
+++
@@ -1,15 +1,17 @@
+/* @flow */
+
var InfiniteComputer = require('./infinite_computer.js');
class ConstantInfiniteComputer extends InfiniteComputer {
- getTotalScrollableHeight(): number {
+ getTotalScrollableHeight()/* : number */ {
return this.heightData * this.numberOfChildren;
}
- getDisplayIndexStart(windowTop: number): number {
+ getDisplayIndexStart(windowTop/* : number */)/* : number */ {
return Math.floor(windowTop / this.heightData);
}
- getDisplayIndexEnd(windowBottom: number): number {
+ getDisplayIndexEnd(windowBottom/* : number */)/* : number */ {
var nonZeroIndex = Math.ceil(windowBottom / this.heightData);
if (nonZeroIndex > 0) {
return nonZeroIndex - 1;
@@ -17,11 +19,11 @@
return nonZeroIndex;
}
- getTopSpacerHeight(displayIndexStart: number): number {
+ getTopSpacerHeight(displayIndexStart/* : number */)/* : number */ {
return displayIndexStart * this.heightData;
}
- getBottomSpacerHeight(displayIndexEnd: number): number {
+ getBottomSpacerHeight(displayIndexEnd/* : number */)/* : number */ {
var nonZeroIndex = displayIndexEnd + 1;
return Math.max(0, (this.numberOfChildren - nonZeroIndex) * this.heightData);
} |
9b35d559517447e9ffb9f32468eb14f0b6c6b4da | src/main/webapp/js/hayabusa-shortcutkeys.js | src/main/webapp/js/hayabusa-shortcutkeys.js | //open command bar
Mousetrap.bindGlobal(['shift+up', 'ctrl+shift+.'], function(e) {
document.getElementById('light').style.display='block';
return false;
});
//close command bar
Mousetrap.bindGlobal(['shift+down', 'esc'], function(e) {
document.getElementById('light').style.display='none';
return false;
});
| //open command bar
Mousetrap.bindGlobal(['shift+up'], function(e) {
document.getElementById('light').style.display='block';
return false;
});
//close command bar
Mousetrap.bindGlobal(['shift+down', 'esc'], function(e) {
document.getElementById('light').style.display='none';
return false;
});
//open command bar and trigger voice search
Mousetrap.bindGlobal(['ctrl+shift+.'], function(e) {
document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'
return false;
});
| Update again to show voice engine dialog for shortcutkeys | Update again to show voice engine dialog for shortcutkeys
| JavaScript | bsd-3-clause | blackboard/hayabusa,blackboard/hayabusa,blackboard/hayabusa | ---
+++
@@ -1,5 +1,5 @@
//open command bar
-Mousetrap.bindGlobal(['shift+up', 'ctrl+shift+.'], function(e) {
+Mousetrap.bindGlobal(['shift+up'], function(e) {
document.getElementById('light').style.display='block';
return false;
});
@@ -10,4 +10,9 @@
return false;
});
+//open command bar and trigger voice search
+Mousetrap.bindGlobal(['ctrl+shift+.'], function(e) {
+ document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'
+ return false;
+});
|
b6198eacf719c91614f635b189a980afb97ffed2 | test/config.js | test/config.js | /*jslint sloppy: true */
module.exports = function (config) {
config.set({
basePath: '../',
frameworks: ['jasmine'],
browsers: ['Chrome', 'PhantomJS'],
autoWatch: true,
files: [
{pattern: 'bower_components/**/*.js', watched: false, server: true, included: true},
'lib/matrix.js',
{pattern: 'test/**/*.spec.js'}
],
reportSlowerThan: 500
});
}; | /*jslint sloppy: true */
module.exports = function (config) {
config.set({
basePath: '../',
frameworks: ['jasmine'],
browsers: ['Chrome', 'PhantomJS'],
autoWatch: true,
files: [
{pattern: 'bower_components/**/*.js', watched: false, server: true, included: true},
'lib/matrix.js',
'lib/ui.js',
'lib/layout.js',
{pattern: 'test/**/*.spec.js'}
],
reportSlowerThan: 500
});
}; | Add additional files to karma setup | Add additional files to karma setup
| JavaScript | mit | yetu/pocketry | ---
+++
@@ -9,6 +9,8 @@
files: [
{pattern: 'bower_components/**/*.js', watched: false, server: true, included: true},
'lib/matrix.js',
+ 'lib/ui.js',
+ 'lib/layout.js',
{pattern: 'test/**/*.spec.js'}
],
|
3fbe8a01d93b77b496a28229ffdf3792ebab22c1 | test/helper.js | test/helper.js | var browserify = require('browserify')
var cp = require('child_process')
var envify = require('envify/custom')
var fs = require('fs')
var once = require('once')
var path = require('path')
var CHROME = process.env.CHROME || '/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary'
var BUNDLE_PATH = path.join(__dirname, 'chrome-app/bundle.js')
exports.browserify = function (filename, env, cb) {
if (!env) env = {}
if (!cb) cb = function () {}
cb = once(cb)
var b = browserify()
b.add(path.join(__dirname, 'client', filename))
b.transform(envify(env))
b.bundle()
.pipe(fs.createWriteStream(BUNDLE_PATH))
.on('close', cb)
.on('error', cb)
}
exports.launchBrowser = function () {
// chrome 40.0.2188.2 won't open extensions without absolute path.
var app = path.join(__dirname, '..', 'test/chrome-app')
var command = CHROME + ' --load-and-launch-app=' + app
var env = { cwd: path.join(__dirname, '..') }
return cp.exec(command, env, function () {})
}
| var browserify = require('browserify')
var cp = require('child_process')
var envify = require('envify/custom')
var fs = require('fs')
var once = require('once')
var path = require('path')
var CHROME
if (process.env.CHROME) {
CHROME = process.env.CHROME
} else if (process.platform === 'win32') {
CHROME = '"%ProgramFiles(x86)%\\Google\\Chrome\\Application\\chrome.exe"'
} else {
CHROME = '/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary'
}
var BUNDLE_PATH = path.join(__dirname, 'chrome-app/bundle.js')
exports.browserify = function (filename, env, cb) {
if (!env) env = {}
if (!cb) cb = function () {}
cb = once(cb)
var b = browserify()
b.add(path.join(__dirname, 'client', filename))
b.transform(envify(env))
b.bundle()
.pipe(fs.createWriteStream(BUNDLE_PATH))
.on('close', cb)
.on('error', cb)
}
exports.launchBrowser = function () {
// chrome 40.0.2188.2 won't open extensions without absolute path.
var app = path.join(__dirname, '..', 'test/chrome-app')
var command = CHROME + ' --load-and-launch-app=' + app
var env = { cwd: path.join(__dirname, '..') }
return cp.exec(command, env, function () {})
}
| Add Chrome path for Windows | tests: Add Chrome path for Windows
| JavaScript | mit | feross/chrome-net,feross/chrome-net | ---
+++
@@ -5,7 +5,15 @@
var once = require('once')
var path = require('path')
-var CHROME = process.env.CHROME || '/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary'
+var CHROME
+if (process.env.CHROME) {
+ CHROME = process.env.CHROME
+} else if (process.platform === 'win32') {
+ CHROME = '"%ProgramFiles(x86)%\\Google\\Chrome\\Application\\chrome.exe"'
+} else {
+ CHROME = '/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary'
+}
+
var BUNDLE_PATH = path.join(__dirname, 'chrome-app/bundle.js')
exports.browserify = function (filename, env, cb) { |
e7b58e5c5438ff630c00638714db087a691b002f | task/config.js | task/config.js | // config.js
var http2 = require('http2');
var path = require('./path');
module.exports = {
task: {
watch: {
exclude: /\.map$/
}
},
plugin: {
pug: {
pretty: '\t',
basedir: path.source.template
},
htmlmin: {
removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true,
collapseWhitespace: true
},
cssnano: {
autoprefixer: false
},
inlinesource: {
attribute: 'data-inline'
},
server: {
server: {
baseDir: path.public.main
},
reloadDebounce: 250,
online: true,
https: true,
httpModule: http2
}
}
};
| // config.js
var path = require('./path');
module.exports = {
task: {
watch: {
exclude: /\.map$/
}
},
plugin: {
pug: {
pretty: '\t',
basedir: path.source.template
},
htmlmin: {
removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true,
collapseWhitespace: true
},
cssnano: {
autoprefixer: false
},
inlinesource: {
attribute: 'data-inline'
},
server: {
server: {
baseDir: path.public.main
},
reloadDebounce: 250,
online: true,
https: true
}
}
};
| Remove http2 usage on browser-sync | Remove http2 usage on browser-sync
| JavaScript | cc0-1.0 | thasmo/website | ---
+++
@@ -1,6 +1,5 @@
// config.js
-var http2 = require('http2');
var path = require('./path');
module.exports = {
@@ -37,8 +36,7 @@
},
reloadDebounce: 250,
online: true,
- https: true,
- httpModule: http2
+ https: true
}
}
}; |
e4d5ed7973c7c597f55ffa86a97cc1a072a4a92a | client/src/js/account/components/API/CreateInfo.js | client/src/js/account/components/API/CreateInfo.js | import React from "react";
import styled from "styled-components";
import { connect } from "react-redux";
import { Alert, Icon } from "../../../base";
const StyledCreateAPIKeyInfo = styled(Alert)`
display: flex;
margin-bottom: 5px;
i {
line-height: 20px;
}
p {
margin-left: 5px;
}
`;
export const CreateAPIKeyInfo = ({ administrator }) => {
if (administrator) {
return (
<StyledCreateAPIKeyInfo>
<Icon name="user-shield" />
<div>
<p>
<strong>You are an administrator and can create API keys with any permissions you want.</strong>
</p>
<p>
If you lose you administrator role, this API key will revert to your new limited set of
permissions.
</p>
</div>
</StyledCreateAPIKeyInfo>
);
}
return null;
};
const mapStateToProps = state => ({
administrator: state.account.administrator
});
export default connect(mapStateToProps)(CreateAPIKeyInfo);
| import React from "react";
import styled from "styled-components";
import { connect } from "react-redux";
import { Alert, Icon } from "../../../base";
const StyledCreateAPIKeyInfo = styled(Alert)`
display: flex;
margin-bottom: 5px;
i {
line-height: 20px;
}
p {
margin-left: 5px;
}
`;
export const CreateAPIKeyInfo = ({ administrator }) => {
if (administrator) {
return (
<StyledCreateAPIKeyInfo>
<Icon name="user-shield" />
<div>
<p>
<strong>You are an administrator and can create API keys with any permissions you want.</strong>
</p>
<p>
If you lose your administrator role, this API key will revert to your new limited set of
permissions.
</p>
</div>
</StyledCreateAPIKeyInfo>
);
}
return null;
};
const mapStateToProps = state => ({
administrator: state.account.administrator
});
export default connect(mapStateToProps)(CreateAPIKeyInfo);
| Fix spelling error in API key creation modal | Fix spelling error in API key creation modal
| JavaScript | mit | igboyes/virtool,virtool/virtool,virtool/virtool,igboyes/virtool | ---
+++
@@ -26,7 +26,7 @@
<strong>You are an administrator and can create API keys with any permissions you want.</strong>
</p>
<p>
- If you lose you administrator role, this API key will revert to your new limited set of
+ If you lose your administrator role, this API key will revert to your new limited set of
permissions.
</p>
</div> |
a4c0dc926c6986cee7dd9f9b3156559fcad0be8d | test/eslint-test.js | test/eslint-test.js | const cp = require('child_process')
describe('eslint-test', function() {
it('eslint should pass', function() {
cp.execSync('npm run eslint')
})
}) | const cp = require('child_process')
describe('eslint-test', function() {
it('eslint should pass', process.env.MIGSI_SKIP_ESLINT ? undefined : function() {
cp.execSync('npm run eslint')
})
}) | Allow skipping eslint test with an environment variable | Allow skipping eslint test with an environment variable
This can be helpful when developing new tests, so that you do not need to be 100% compliant at all times
| JavaScript | mit | BaronaGroup/migsi,BaronaGroup/migsi | ---
+++
@@ -1,7 +1,7 @@
const cp = require('child_process')
describe('eslint-test', function() {
- it('eslint should pass', function() {
+ it('eslint should pass', process.env.MIGSI_SKIP_ESLINT ? undefined : function() {
cp.execSync('npm run eslint')
})
}) |
1f3c9a469a96b8b80134a16f3843cda1a368f097 | src/style_manager/view/PropertyColorView.js | src/style_manager/view/PropertyColorView.js | import PropertyIntegerView from './PropertyIntegerView';
import InputColor from 'domain_abstract/ui/InputColor';
export default PropertyIntegerView.extend({
setValue(value, opts = {}) {
opts = { ...opts, silent: 1 };
this.inputInst.setValue(value, opts);
},
remove() {
PropertyIntegerView.prototype.remove.apply(this, arguments);
this.inputInst.remove();
['inputInst', '$color'].forEach(i => (this[i] = {}));
},
onRender() {
if (!this.input) {
const ppfx = this.ppfx;
const inputColor = new InputColor({
target: this.target,
model: this.model,
ppfx
});
const input = inputColor.render();
this.el.querySelector(`.${ppfx}fields`).appendChild(input.el);
this.$input = input.inputEl;
this.$color = input.colorEl;
this.input = this.$input.get(0);
this.inputInst = input;
}
}
});
| import PropertyIntegerView from './PropertyIntegerView';
import InputColor from 'domain_abstract/ui/InputColor';
export default PropertyIntegerView.extend({
setValue(value, opts = {}) {
opts = { ...opts, silent: 1 };
this.inputInst.setValue(value, opts);
},
remove() {
PropertyIntegerView.prototype.remove.apply(this, arguments);
const inp = this.inputInst;
inp && inp.remove();
['inputInst', '$color'].forEach(i => (this[i] = {}));
},
onRender() {
if (!this.input) {
const ppfx = this.ppfx;
const inputColor = new InputColor({
target: this.target,
model: this.model,
ppfx
});
const input = inputColor.render();
this.el.querySelector(`.${ppfx}fields`).appendChild(input.el);
this.$input = input.inputEl;
this.$color = input.colorEl;
this.input = this.$input.get(0);
this.inputInst = input;
}
}
});
| Check if input exists before remove | Check if input exists before remove
| JavaScript | bsd-3-clause | artf/grapesjs,artf/grapesjs,artf/grapesjs | ---
+++
@@ -9,7 +9,8 @@
remove() {
PropertyIntegerView.prototype.remove.apply(this, arguments);
- this.inputInst.remove();
+ const inp = this.inputInst;
+ inp && inp.remove();
['inputInst', '$color'].forEach(i => (this[i] = {}));
},
|
739ba2e9ebfb12617d5ef1926702248274ced74b | test/runner.js | test/runner.js | var checkForDevFile = function (callback) {
var cwd = process.cwd();
var fs = require("fs");
var path = require("path");
var testFile = path.join(cwd, "lib", "modernizr-dev.js");
var remoteTestFile = "http://modernizr.com/downloads/modernizr-latest.js";
var http = require("http");
var file = fs.createWriteStream(testFile);
var request = http.get(remoteTestFile, function (response) {
response.pipe(file);
response.on("end", function () {
callback();
});
});
};
checkForDevFile(function () {
var Mocha = require("mocha");
var mocha = new Mocha({
setup : "bdd",
reporter : process.env.TRAVIS ? "tap" : "spec",
slow : 5000,
timeout : 30000
});
mocha.addFile("test/tests.js");
var runner = mocha.run();
runner.on("fail", function (test, err) {
process.stderr.write(" " + err.toString() + "\n\n");
process.exit(1);
});
});
| var checkForDevFile = function (callback) {
var cwd = process.cwd();
var fs = require("fs");
var path = require("path");
var testFile = path.join(cwd, "lib", "modernizr-dev.js");
var remoteTestFile = "http://modernizr.com/downloads/modernizr-latest.js";
var http = require("http");
var file = fs.createWriteStream(testFile);
var request = http.get(remoteTestFile, function (response) {
response.pipe(file);
response.on("end", function () {
callback();
});
});
};
checkForDevFile(function () {
var Mocha = require("mocha");
var mocha = new Mocha({
setup : "bdd",
reporter : process.env.TRAVIS ? "tap" : "spec",
slow : 5000,
timeout : 30000
});
mocha.addFile("test/tests.js");
var runner = mocha.run();
runner.on("fail", function (test, err) {
var cp = require("child_process");
var cwd = process.cwd();
var path = require("path");
var child = cp.spawn("git", [
"checkout", "--", path.join(cwd, "Gruntfile.js")
], {
stdio: "inherit"
});
child.on("exit", function () {
process.exit(1);
});
process.stderr.write(" " + err.toString() + "\n\n");
});
});
| Reset the Gruntfile after a test failure. | Reset the Gruntfile after a test failure. | JavaScript | mit | dailymotion/grunt-modernizr,mrawdon/grunt-modernizr,Irmiz/grunt-modernizr,Modernizr/grunt-modernizr,GrimaceOfDespair/grunt-modernizr,shadowmint/grunt-modernizr,grumpydev22/grunt-modernizr,bdaenen/grunt-modernizr,optimizely/grunt-modernizr,CastroIgnacio/grunt-modernizr,tobania/grunt-modernizr,virtualidentityag/grunt-modernizr,niksy/grunt-modernizr,metaloha/grunt-modernizr | ---
+++
@@ -33,7 +33,20 @@
var runner = mocha.run();
runner.on("fail", function (test, err) {
+ var cp = require("child_process");
+ var cwd = process.cwd();
+ var path = require("path");
+
+ var child = cp.spawn("git", [
+ "checkout", "--", path.join(cwd, "Gruntfile.js")
+ ], {
+ stdio: "inherit"
+ });
+
+ child.on("exit", function () {
+ process.exit(1);
+ });
+
process.stderr.write(" " + err.toString() + "\n\n");
- process.exit(1);
});
}); |
1b433b5b0e73838ecaa365f3fa5d4cb2f5edbff8 | aura-components/src/main/components/ui/image/imageController.js | aura-components/src/main/components/ui/image/imageController.js | /*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
init: function (component) {
if (!component || !component.isValid()) {
return;
}
var cmp = component.getConcreteComponent();
var imageType = cmp.get('v.imageType'),
altText = cmp.get('v.alt') || '',
id = cmp.getLocalId() || cmp.getGlobalId() || '';
if (imageType === 'informational' && altText.length == 0) {
$A.warning('component: ' + id + ' "alt" attribute should not be empty for informational image');
} else if (imageType === 'decorative' && altText.length > 0) {
$A.warning('component: ' + id + ': "alt" attribute should be empty for decorative image');
}
}
})
| /*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
init: function (component) {
var cmp = component.getConcreteComponent();
var imageType = cmp.get('v.imageType'),
altText = cmp.get('v.alt') || '',
id = cmp.getLocalId() || cmp.getGlobalId() || '';
if (imageType === 'informational' && altText.length == 0) {
$A.warning('component: ' + id + ' "alt" attribute should not be empty for informational image');
} else if (imageType === 'decorative' && altText.length > 0) {
$A.warning('component: ' + id + ': "alt" attribute should be empty for decorative image');
}
}
})
| Revert the ui:image cmp validity checking. @bug W-2533777@ | Revert the ui:image cmp validity checking.
@bug W-2533777@
| JavaScript | apache-2.0 | madmax983/aura,SalesforceSFDC/aura,madmax983/aura,DebalinaDey/AuraDevelopDeb,navyliu/aura,DebalinaDey/AuraDevelopDeb,TribeMedia/aura,SalesforceSFDC/aura,badlogicmanpreet/aura,navyliu/aura,badlogicmanpreet/aura,madmax983/aura,DebalinaDey/AuraDevelopDeb,lcnbala/aura,SalesforceSFDC/aura,TribeMedia/aura,DebalinaDey/AuraDevelopDeb,badlogicmanpreet/aura,badlogicmanpreet/aura,badlogicmanpreet/aura,lcnbala/aura,navyliu/aura,navyliu/aura,madmax983/aura,TribeMedia/aura,lcnbala/aura,TribeMedia/aura,madmax983/aura,navyliu/aura,SalesforceSFDC/aura,madmax983/aura,SalesforceSFDC/aura,forcedotcom/aura,DebalinaDey/AuraDevelopDeb,forcedotcom/aura,forcedotcom/aura,TribeMedia/aura,forcedotcom/aura,TribeMedia/aura,lcnbala/aura,forcedotcom/aura,lcnbala/aura,lcnbala/aura,badlogicmanpreet/aura,navyliu/aura,DebalinaDey/AuraDevelopDeb,SalesforceSFDC/aura | ---
+++
@@ -15,9 +15,6 @@
*/
({
init: function (component) {
- if (!component || !component.isValid()) {
- return;
- }
var cmp = component.getConcreteComponent();
var imageType = cmp.get('v.imageType'),
altText = cmp.get('v.alt') || '', |
f888316ee7907e94b30f32040a98c56ef2334649 | tasks/xcode.js | tasks/xcode.js | /*
* grunt-xcode
* https://github.com/matiassingers/grunt-xcode
*
* Copyright (c) 2014 Matias Singers
* Licensed under the MIT license.
*/
'use strict';
var Promise = require('bluebird');
var exec = Promise.promisify(require('child_process').exec);
String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
formatted = formatted.replace(
RegExp('\\{' + i + '\\}', 'g'), arguments[i]);
}
return formatted;
};
module.exports = function(grunt) {
grunt.registerMultiTask('xcode', 'Build and export Xcode projects with Grunt', function() {
var done = this.async();
});
};
| /*
* grunt-xcode
* https://github.com/matiassingers/grunt-xcode
*
* Copyright (c) 2014 Matias Singers
* Licensed under the MIT license.
*/
'use strict';
var Promise = require('bluebird');
var exec = Promise.promisify(require('child_process').exec);
String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
formatted = formatted.replace(
RegExp('\\{' + i + '\\}', 'g'), arguments[i]);
}
return formatted;
};
module.exports = function(grunt) {
function executeCommand(command){
grunt.verbose.writeln('Running command: {0}'.format(command));
return exec(command)
.catch(handleCommandError);
}
function handleCommandError(error){
if (error){
grunt.warn(error);
}
}
grunt.registerMultiTask('xcode', 'Build and export Xcode projects with Grunt', function() {
var done = this.async();
});
};
| Create executeCommand and handleCommandError helper functions | Create executeCommand and handleCommandError helper functions
| JavaScript | mit | matiassingers/grunt-xcode | ---
+++
@@ -20,6 +20,17 @@
};
module.exports = function(grunt) {
+ function executeCommand(command){
+ grunt.verbose.writeln('Running command: {0}'.format(command));
+ return exec(command)
+ .catch(handleCommandError);
+ }
+ function handleCommandError(error){
+ if (error){
+ grunt.warn(error);
+ }
+ }
+
grunt.registerMultiTask('xcode', 'Build and export Xcode projects with Grunt', function() {
var done = this.async();
|
9e1de3f52aaecc9532b3b3b0988a14aaf4ab713f | lib/global-admin/addon/cluster-templates/new/route.js | lib/global-admin/addon/cluster-templates/new/route.js | import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
export default Route.extend({
globalStore: service(),
access: service(),
clusterTemplates: service(),
model() {
return hash({
clusterTemplate: this.globalStore.createRecord({ type: 'clustertemplate', }),
clusterTemplateRevision: this.globalStore.createRecord({
name: 'first-revision',
type: 'clusterTemplateRevision',
enabled: true,
clusterConfig: this.globalStore.createRecord({
type: 'clusterSpecBase',
rancherKubernetesEngineConfig: this.globalStore.createRecord({ type: 'rancherKubernetesEngineConfig' })
})
}),
psps: this.globalStore.findAll('podSecurityPolicyTemplate'),
users: this.globalStore.findAll('user'),
});
},
afterModel(model, transition) {
if (transition.from && transition.from.name === 'global-admin.clusters.index') {
this.controllerFor(this.routeName).set('parentRoute', transition.from.name);
}
return this.clusterTemplates.fetchQuestionsSchema();
},
});
| import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
export default Route.extend({
globalStore: service(),
access: service(),
clusterTemplates: service(),
model() {
return hash({
clusterTemplate: this.globalStore.createRecord({ type: 'clustertemplate', }),
clusterTemplateRevision: this.globalStore.createRecord({
name: 'v1',
type: 'clusterTemplateRevision',
enabled: true,
clusterConfig: this.globalStore.createRecord({
type: 'clusterSpecBase',
rancherKubernetesEngineConfig: this.globalStore.createRecord({ type: 'rancherKubernetesEngineConfig' })
})
}),
psps: this.globalStore.findAll('podSecurityPolicyTemplate'),
users: this.globalStore.findAll('user'),
});
},
afterModel(model, transition) {
if (transition.from && transition.from.name === 'global-admin.clusters.index') {
this.controllerFor(this.routeName).set('parentRoute', transition.from.name);
}
return this.clusterTemplates.fetchQuestionsSchema();
},
});
| Change ct default revision name to v1 | Change ct default revision name to v1
https://github.com/rancher/rancher/issues/22162
| JavaScript | apache-2.0 | rancher/ui,westlywright/ui,vincent99/ui,westlywright/ui,rancher/ui,vincent99/ui,rancherio/ui,rancherio/ui,rancher/ui,westlywright/ui,vincent99/ui,rancherio/ui | ---
+++
@@ -11,7 +11,7 @@
return hash({
clusterTemplate: this.globalStore.createRecord({ type: 'clustertemplate', }),
clusterTemplateRevision: this.globalStore.createRecord({
- name: 'first-revision',
+ name: 'v1',
type: 'clusterTemplateRevision',
enabled: true,
clusterConfig: this.globalStore.createRecord({ |
80ed34fea18a6311b4490b5998df69636a4e34a9 | lib/index.js | lib/index.js | var request = require('request');
var Scholarcheck = function(apiKey) {
this.apiUrl = "https://api.scholarcheck.io/api/v1/";
this.apiKey = apiKey || '';
};
Scholarcheck.prototype._apiCall = function(endpoint, callback) {
var options = {
url: this.apiUrl + endpoint,
headers: {
'Token': this.apiKey
},
rejectUnauthorized: false
}; //rejectUnauthorized must be true until the SSL cert is changed to include api.scholarcheck.io
request(options, function(err, res, body) {
callback(err, JSON.parse(body));
});
};
Scholarcheck.prototype.valid = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
return cb(err);
}
return cb(null, data.valid);
});
};
Scholarcheck.prototype.institution = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
cb(err);
}
return cb(null, data.institution);
});
};
Scholarcheck.prototype.rawData = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
return cb(err);
}
return cb(null, data);
});
};
module.exports = Scholarcheck;
| var request = require('request');
var Scholarcheck = function(apiKey) {
this.apiUrl = "https://app.scholarcheck.io/api/v1/";
this.apiKey = apiKey || '';
};
Scholarcheck.prototype._apiCall = function(endpoint, callback) {
var options = {
url: this.apiUrl + endpoint,
headers: {
'Token': this.apiKey
},
rejectUnauthorized: false
}; //rejectUnauthorized must be true until the SSL cert is changed to include api.scholarcheck.io
request(options, function(err, res, body) {
callback(err, JSON.parse(body));
});
};
Scholarcheck.prototype.valid = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
return cb(err);
}
return cb(null, data.valid);
});
};
Scholarcheck.prototype.institution = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
cb(err);
}
return cb(null, data.institution);
});
};
Scholarcheck.prototype.rawData = function(email, cb) {
var apiReq = 'email/' + email;
this._apiCall(apiReq, function(err, data) {
if (!!err) {
return cb(err);
}
return cb(null, data);
});
};
module.exports = Scholarcheck;
| Fix typo on API URL | Fix typo on API URL
| JavaScript | mit | caffeinewriter/node-scholarcheck,caffeinewriter/node-scholarcheck | ---
+++
@@ -1,6 +1,6 @@
var request = require('request');
var Scholarcheck = function(apiKey) {
- this.apiUrl = "https://api.scholarcheck.io/api/v1/";
+ this.apiUrl = "https://app.scholarcheck.io/api/v1/";
this.apiKey = apiKey || '';
};
|
4f4e6454f6a498fbb1a13320c4bb66c6c9ba83ec | lib/index.js | lib/index.js | 'use strict';
var hash = require('./hash');
exports.escapeDiacritic = require('./escape_diacritic');
exports.escapeHTML = require('./escape_html');
exports.escapeRegExp = require('./escape_regexp');
exports.highlight = require('./highlight');
exports.htmlTag = require('./html_tag');
exports.Pattern = require('./pattern');
exports.Permalink = require('./permalink');
exports.slugize = require('./slugize');
exports.spawn = require('./spawn');
exports.stripHTML = require('./strip_html');
exports.truncate = require('./truncate');
exports.wordWrap = require('./word_wrap');
exports.hash = hash.hash;
exports.HashStream = hash.HashStream;
exports.CacheStream = require('./cache_stream');
| 'use strict';
var hash = require('./hash');
exports.escapeDiacritic = require('./escape_diacritic');
exports.escapeHTML = require('./escape_html');
exports.escapeRegExp = require('./escape_regexp');
exports.highlight = require('./highlight');
exports.htmlTag = require('./html_tag');
exports.Pattern = require('./pattern');
exports.Permalink = require('./permalink');
exports.slugize = require('./slugize');
exports.spawn = require('./spawn');
exports.stripHTML = require('./strip_html');
exports.truncate = require('./truncate');
exports.wordWrap = require('./word_wrap');
exports.hash = hash.hash;
exports.HashStream = hash.HashStream;
exports.CacheStream = require('./cache_stream');
exports.camelCaseKeys = require('./camel_case_keys');
| Fix camelCaseKeys is not exported | Fix camelCaseKeys is not exported
| JavaScript | mit | hexojs/hexo-util,hexojs/hexo-util | ---
+++
@@ -17,3 +17,4 @@
exports.hash = hash.hash;
exports.HashStream = hash.HashStream;
exports.CacheStream = require('./cache_stream');
+exports.camelCaseKeys = require('./camel_case_keys'); |
11ceffc8dc5578dc089c52f3a0a80a35d31bae8c | lib/index.js | lib/index.js | 'use strict';
var configViewer = require('./configViewer');
var jQueryName = 'D2L.LP.Web.UI.Html.jQuery';
var vuiName = 'D2L.LP.Web.UI.Html.Vui';
module.exports.jquery = function( opts ) {
return configViewer.readConfig( jQueryName, opts )
.then( function( value ) {
return value.jqueryBaseLocation + 'jquery.js';
} );
};
module.exports.jqueryui = function( opts ) {
return configViewer.readConfig( jQueryName, opts )
.then( function( value ) {
return value.jqueryUIBaseLocation + 'jquery-ui.js';
} );
};
module.exports.valenceui = function( opts ) {
return configViewer.readConfig( vuiName, opts )
.then( function( value ) {
return value.baseLocation + 'valenceui.js';
} );
};
module.exports.jquerySync = function( opts ) {
return configViewer.readConfigSync( jQueryName, opts ).jqueryBaseLocation + 'jquery.js';
};
module.exports.jqueryuiSync = function( opts ) {
return configViewer.readConfigSync( jQueryName, opts ).jqueryUIBaseLocation + 'jquery-ui.js';
};
module.exports.valenceuiSync = function( opts ) {
return configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.js';
};
| 'use strict';
var configViewer = require('./configViewer');
var jQueryName = 'D2L.LP.Web.UI.Html.jQuery';
var vuiName = 'D2L.LP.Web.UI.Html.Vui';
module.exports.jquery = function( opts ) {
return configViewer.readConfig( jQueryName, opts )
.then( function( value ) {
return value.jqueryBaseLocation + 'jquery.js';
} );
};
module.exports.jqueryui = function( opts ) {
return configViewer.readConfig( jQueryName, opts )
.then( function( value ) {
return value.jqueryUIBaseLocation + 'jquery-ui.js';
} );
};
module.exports.valenceui = function( opts ) {
return configViewer.readConfig( vuiName, opts )
.then( function( value ) {
return value.baseLocation + 'valenceui.js';
} );
};
module.exports.jquerySync = function( opts ) {
return configViewer.readConfigSync( jQueryName, opts ).jqueryBaseLocation + 'jquery.js';
};
module.exports.jqueryuiSync = function( opts ) {
return configViewer.readConfigSync( jQueryName, opts ).jqueryUIBaseLocation + 'jquery-ui.js';
};
module.exports.valenceuiSync = function( opts ) {
return [
configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.css',
configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.js'
];
};
| Include CSS files in VUI loaded library. | Include CSS files in VUI loaded library.
| JavaScript | apache-2.0 | Brightspace/web-library-loader | ---
+++
@@ -35,5 +35,8 @@
};
module.exports.valenceuiSync = function( opts ) {
- return configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.js';
+ return [
+ configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.css',
+ configViewer.readConfigSync( vuiName, opts ).baseLocation + 'valenceui.js'
+ ];
}; |
241548146e98b69e90809451b0b17942da296a58 | test/helper.js | test/helper.js | process.env.NODE_ENV = 'test';
require('sugar');
require('colors');
module.exports.chai = require('chai');
module.exports.chai.Assertion.includeStack = true;
module.exports.chai.use(require('chai-http'));
module.exports.async = require('async');
module.exports.debug = console.log;
// module.exports.longjohn = require('longjohn');
// module.exports.longjohn.async_trace_limit = 3;
// REVIEW: http://chaijs.com/plugins
module.exports.flag = function(value, default_value) {
if (typeof value === 'undefined') {
return (default_value === undefined) ? false : default_value;
} else {
return (/^1|true$/i).test('' + value); // ...to avoid the boolean/truthy ghetto.
}
};
module.exports.API = function() {
var app = function(req, res) {
res.writeHeader(200, {
'content-type': 'application/json',
'x-powered-by': 'connect'
});
res.end(JSON.stringify({hello: "world"}));
};
var api = require('connect')();
api.use(require('../').apply(this, arguments));
api.use(app);
return api;
};
| process.env.NODE_ENV = 'test';
process.setMaxListeners(process.env.MAX_LISTENERS || 0);
require('sugar');
require('colors');
module.exports.chai = require('chai');
module.exports.chai.Assertion.includeStack = true;
module.exports.chai.use(require('chai-http'));
module.exports.async = require('async');
module.exports.debug = console.log;
// module.exports.longjohn = require('longjohn');
// module.exports.longjohn.async_trace_limit = 3;
// REVIEW: http://chaijs.com/plugins
module.exports.flag = function(value, default_value) {
if (typeof value === 'undefined') {
return (default_value === undefined) ? false : default_value;
} else {
return (/^1|true$/i).test('' + value); // ...to avoid the boolean/truthy ghetto.
}
};
module.exports.API = function() {
var app = function(req, res) {
res.writeHeader(200, {
'content-type': 'application/json',
'x-powered-by': 'connect'
});
res.end(JSON.stringify({hello: "world"}));
};
var api = require('connect')();
api.use(require('../').apply(this, arguments));
api.use(app);
return api;
};
| Use `process.setMaxListeners(0)` for tests to avoid annoying warnings. | Use `process.setMaxListeners(0)` for tests to avoid annoying warnings. | JavaScript | mit | grimen/node-document-api | ---
+++
@@ -1,4 +1,6 @@
process.env.NODE_ENV = 'test';
+
+process.setMaxListeners(process.env.MAX_LISTENERS || 0);
require('sugar');
require('colors'); |
25d859b3a2597ba00c988ed4a814452558e2c1b4 | foundation-ui/utils/ReactUtil.js | foundation-ui/utils/ReactUtil.js | import React from 'react';
const ReactUil = {
/**
* Wrap React elements
*
* @param {Array.<ReactElement>|ReactElement} elements
* @param {function|String} wrapper component
* @param {boolean} [alwaysWrap]
*
* @returns {ReactElement} wrapped react elements
*/
wrapElements(elements, wrapper = 'div', alwaysWrap = false) {
if (elements == null && !alwaysWrap) {
return null;
}
if (Array.isArray(elements) && elements.length === 1 && !alwaysWrap) {
return elements[0];
}
if (React.isValidElement(elements) && !alwaysWrap) {
return elements;
}
return React.createElement(wrapper, null, elements);
}
};
module.exports = ReactUil;
| import React from 'react';
const ReactUil = {
/**
* Wrap React elements
*
* If elements is an array with a single element, it will not be wrapped
* unless alwaysWrap is true.
*
* @param {Array.<ReactElement>|ReactElement} elements
* @param {function|String} wrapper component
* @param {boolean} [alwaysWrap]
*
* @returns {ReactElement} wrapped react elements
*/
wrapElements(elements, wrapper = 'div', alwaysWrap = false) {
if (elements == null && !alwaysWrap) {
return null;
}
if (Array.isArray(elements) && elements.length === 1 && !alwaysWrap) {
return elements[0];
}
if (React.isValidElement(elements) && !alwaysWrap) {
return elements;
}
return React.createElement(wrapper, null, elements);
}
};
module.exports = ReactUil;
| Expand description to include single-element array behavior | Expand description to include single-element array behavior
| JavaScript | apache-2.0 | dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui | ---
+++
@@ -3,6 +3,9 @@
const ReactUil = {
/**
* Wrap React elements
+ *
+ * If elements is an array with a single element, it will not be wrapped
+ * unless alwaysWrap is true.
*
* @param {Array.<ReactElement>|ReactElement} elements
* @param {function|String} wrapper component |
4878fc74206e4cb01cd8874570f50f5fc2db903a | fixtures/users.js | fixtures/users.js | module.exports = [
{
"model": "User",
"data": {
"email": "test@abakus.no",
"name": "Test Bruker",
// Password: test
hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
}
},
{
"model": "User",
"data": {
"email": "backup@abakus.no",
"name": "Backup bruker",
// Password: test
hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
}
}
];
| module.exports = [
{
model: 'User',
data: {
email: 'test@abakus.no',
name: 'Test Bruker',
// Password: test
hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
}
},
{
model: 'User',
data: {
email: 'backup@abakus.no',
name: 'Backup bruker',
// Password: test
hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
}
}
];
| Fix linting errors in fixture | Fix linting errors in fixture
| JavaScript | mit | abakusbackup/abacash-api,abakusbackup/abacash-api | ---
+++
@@ -1,20 +1,20 @@
module.exports = [
- {
- "model": "User",
- "data": {
- "email": "test@abakus.no",
- "name": "Test Bruker",
- // Password: test
- hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
+ {
+ model: 'User',
+ data: {
+ email: 'test@abakus.no',
+ name: 'Test Bruker',
+ // Password: test
+ hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
+ }
+ },
+ {
+ model: 'User',
+ data: {
+ email: 'backup@abakus.no',
+ name: 'Backup bruker',
+ // Password: test
+ hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
+ }
}
- },
- {
- "model": "User",
- "data": {
- "email": "backup@abakus.no",
- "name": "Backup bruker",
- // Password: test
- hash: '$2a$10$Gm09SZEHzdqx4eBV06nNheenfKpw3R1rXrMzmYfjX/.9UFPHnaAn6'
- }
- }
]; |
077ab3f2110c6c2e5984484596209383c2df3c01 | flow-typed/npm/@storybook/addon-info_v3.x.x.js | flow-typed/npm/@storybook/addon-info_v3.x.x.js | import type { RenderFunction, Story } from '@storybook/react';
declare module '@storybook/addon-info' {
declare type Options = {
inline?: boolean,
header?: boolean,
source?: boolean,
propTables?: ?Array<React$Element<*>>,
maxPropsIntoLine?: number,
maxPropObjectKeys?: number,
maxPropArrayLength?: number,
maxPropStringLength?: number,
};
declare export function addWithInfo(
storyName: string,
info: string,
callback: RenderFunction,
options: Options,
): Story;
}
| import type { RenderFunction, Story } from '@storybook/react';
declare module '@storybook/addon-info' {
declare type Renderable = React$Element<any>;
declare type RenderFunction = () => Renderable;
declare type Options = {
text?: string | Renderable,
inline?: boolean,
header?: boolean,
source?: boolean,
propTables?: ?Array<Renderable>,
maxPropsIntoLine?: number,
maxPropObjectKeys?: number,
maxPropArrayLength?: number,
maxPropStringLength?: number,
};
declare export function addWithInfo(
storyName: string,
info: string,
callback: RenderFunction,
options: Options,
): Story;
declare export function withInfo(options: Options): Story;
}
| Update Storybook info addon Flow types | Update Storybook info addon Flow types
| JavaScript | unlicense | pascalduez/react-module-boilerplate | ---
+++
@@ -1,11 +1,15 @@
import type { RenderFunction, Story } from '@storybook/react';
declare module '@storybook/addon-info' {
+ declare type Renderable = React$Element<any>;
+ declare type RenderFunction = () => Renderable;
+
declare type Options = {
+ text?: string | Renderable,
inline?: boolean,
header?: boolean,
source?: boolean,
- propTables?: ?Array<React$Element<*>>,
+ propTables?: ?Array<Renderable>,
maxPropsIntoLine?: number,
maxPropObjectKeys?: number,
maxPropArrayLength?: number,
@@ -18,4 +22,6 @@
callback: RenderFunction,
options: Options,
): Story;
+
+ declare export function withInfo(options: Options): Story;
} |
53e7dd095e1ae09b64b3cdadd6f961db22403098 | src/www/js/setup/seg_desktop_include.js | src/www/js/setup/seg_desktop_include.js | document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/merged/seg_desktop.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-notifier.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-form-onebuttonform.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/lib/desktop/i-page.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/lib/u-basics.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-progress.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-upgrade.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-pull.js"></script>');
| document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/merged/seg_desktop.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-notifier.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-form-onebuttonform.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/lib/desktop/m-page.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/lib/u-basics.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-progress.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-upgrade.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-pull.js"></script>');
| Update manipulator include for setup | Update manipulator include for setup
| JavaScript | mit | parentnode/janitor,parentnode/janitor,parentnode/janitor | ---
+++
@@ -2,11 +2,11 @@
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-notifier.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/manipulator/v0_9_3-janitor/src/beta-u-form-onebuttonform.js"></script>');
-document.write('<script type="text/javascript" src="/janitor/admin/js/lib/desktop/i-page.js"></script>');
+document.write('<script type="text/javascript" src="/janitor/admin/js/lib/desktop/m-page.js"></script>');
document.write('<script type="text/javascript" src="/janitor/admin/js/lib/u-basics.js"></script>');
-document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-progress.js"></script>');
-document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-upgrade.js"></script>');
-document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/i-pull.js"></script>');
+document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-progress.js"></script>');
+document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-upgrade.js"></script>');
+document.write('<script type="text/javascript" src="/janitor/admin/js/setup/desktop/m-pull.js"></script>');
|
b621b1fadebcaec9a7c200aebad8c965cad328fc | src/client/app/app.react.js | src/client/app/app.react.js | import './app.styl';
import * as state from '../state';
import Component from '../components/component.react';
import Footer from './footer.react';
import Menu from './menu.react';
import React from 'react';
import persistState from './persiststate.react';
import {RouteHandler} from 'react-router';
// Remember to import all app stores here.
import '../auth/store';
import '../todos/store';
import '../users/store';
class App extends Component {
constructor(props) {
super(props);
this.state = this.getState();
}
getState() {
return {
auth: state.authCursor(),
pendingActions: state.pendingActionsCursor(),
todos: state.todosCursor(),
users: state.usersCursor(),
viewer: state.usersCursor().get('viewer')
};
}
componentWillMount() {
if (!process.env.IS_BROWSER) return;
state.state.on('change', () => {
if ('production' !== process.env.NODE_ENV)
console.time('app render'); // eslint-disable-line no-console
this.setState(this.getState(), () => {
if ('production' !== process.env.NODE_ENV)
console.timeEnd('app render'); // eslint-disable-line no-console
});
});
}
render() {
return (
<div className="page">
<Menu viewer={this.state.viewer} />
<RouteHandler {...this.state} />
<Footer />
</div>
);
}
}
App = persistState(App);
export default App;
| import './app.styl';
import * as state from '../state';
import Component from '../components/component.react';
import Footer from './footer.react';
import Menu from './menu.react';
import React from 'react';
import persistState from './persiststate.react';
import {RouteHandler} from 'react-router';
// Remember to import all app stores here.
import '../auth/store';
import '../todos/store';
import '../users/store';
class App extends Component {
constructor(props) {
super(props);
this.state = this.getState();
}
getState() {
return {
auth: state.authCursor(),
pendingActions: state.pendingActionsCursor(),
todos: state.todosCursor(),
users: state.usersCursor(),
viewer: state.usersCursor().get('viewer')
};
}
// https://github.com/steida/este/issues/274
componentWillMount() {
if (!process.env.IS_BROWSER) return;
state.state.on('change', () => {
if ('production' !== process.env.NODE_ENV)
console.time('app render'); // eslint-disable-line no-console
this.setState(this.getState(), () => {
if ('production' !== process.env.NODE_ENV)
console.timeEnd('app render'); // eslint-disable-line no-console
});
});
}
render() {
return (
<div className="page">
<Menu viewer={this.state.viewer} />
<RouteHandler {...this.state} />
<Footer />
</div>
);
}
}
App = persistState(App);
export default App;
| Add link explaining why componentWillMount is used. | Add link explaining why componentWillMount is used.
| JavaScript | mit | aindre/este-example,AugustinLF/este,XeeD/test,amrsekilly/updatedEste,skallet/este,robinpokorny/este,AlesJiranek/este,syroegkin/mikora.eu,shawn-dsz/este,XeeD/este,AlesJiranek/este,youprofit/este,AugustinLF/este,laxplaer/este,christophediprima/este,este/este,zanj2006/este,puzzfuzz/othello-redux,Brainfock/este,skaldo/este,GarrettSmith/schizophrenia,sikhote/davidsinclair,estaub/my-este,cjk/smart-home-app,TheoMer/este,aindre/este-example,XeeD/este,christophediprima/este,abelaska/este,syroegkin/mikora.eu,neozhangthe1/framedrop-web,srhmgn/markdowner,blueberryapps/este,robinpokorny/este,abelaska/este,neozhangthe1/framedrop-web,glaserp/Maturita-Project,steida/este,SidhNor/este-cordova-starter-kit,vacuumlabs/este,amrsekilly/updatedEste,langpavel/este,hsrob/league-este,grabbou/este,este/este,jaeh/este,robinpokorny/este,este/este,steida/este,sljuka/bucka-portfolio,TheoMer/este,neozhangthe1/framedrop-web,cazacugmihai/este,blueberryapps/este,estaub/my-este,langpavel/este,TheoMer/Gyms-Of-The-World,neozhangthe1/framedrop-web,nason/este,puzzfuzz/othello-redux,skyuplam/debt_mgmt,sikhote/davidsinclair,christophediprima/este,neozhangthe1/framedrop-web,este/este,vacuumlabs/este,TheoMer/Gyms-Of-The-World,XeeD/test,sljuka/portfulio,skallet/este,obimod/este,Tzitzian/Oppex,sljuka/portfolio-este,zanj2006/este,gaurav-/este,glaserp/Maturita-Project,christophediprima/este,syroegkin/mikora.eu,sljuka/portfolio-este,MartinPavlik/este,TheoMer/este,amrsekilly/updatedEste,nezaidu/este,skallet/este,abelaska/este,GarrettSmith/schizophrenia,TheoMer/Gyms-Of-The-World,sljuka/portfulio,sikhote/davidsinclair,terakilobyte/esterethinksocketchat,estaub/my-este,GarrettSmith/schizophrenia,skyuplam/debt_mgmt,ViliamKopecky/este | ---
+++
@@ -29,6 +29,7 @@
};
}
+ // https://github.com/steida/este/issues/274
componentWillMount() {
if (!process.env.IS_BROWSER) return;
state.state.on('change', () => { |
d9549a5a002c25e054e1b4bd1a377ff444fcb403 | src/data/historyEntry.js | src/data/historyEntry.js | import partial from 'lodash-es/partial'
import makeProto from '../wrap'
import { parseDate } from '../util'
import wrapMedia from './media'
import wrapRoom from './room'
import wrapUser from './user'
export default function wrapHistoryEntry (mp, raw) {
const entry = {
id: raw.id,
// wrapMedia expects a playlist ID, but we don't know it--pass null instead.
media: wrapMedia(mp, null, raw),
room: wrapRoom(mp, raw.room),
user: wrapUser(mp, raw.user),
time: parseDate(raw.timestamp),
score: raw.score
}
return makeProto(entry, {
getUser: partial(mp.getUser, raw.user.id)
})
}
| import partial from 'lodash-es/partial'
import makeProto from '../wrap'
import { parseDate } from '../util'
import wrapMedia from './media'
import wrapRoom from './room'
import wrapUser from './user'
export default function wrapHistoryEntry (mp, raw) {
const entry = {
id: raw.id,
// wrapMedia expects a playlist ID, but we don't know it--pass null instead.
media: wrapMedia(mp, null, raw.media),
room: wrapRoom(mp, raw.room),
user: wrapUser(mp, raw.user),
time: parseDate(raw.timestamp),
score: raw.score
}
return makeProto(entry, {
getUser: partial(mp.getUser, raw.user.id)
})
}
| Fix Media prop on HistoryEntries. | Fix Media prop on HistoryEntries.
| JavaScript | mit | goto-bus-stop/miniplug | ---
+++
@@ -9,7 +9,7 @@
const entry = {
id: raw.id,
// wrapMedia expects a playlist ID, but we don't know it--pass null instead.
- media: wrapMedia(mp, null, raw),
+ media: wrapMedia(mp, null, raw.media),
room: wrapRoom(mp, raw.room),
user: wrapUser(mp, raw.user),
time: parseDate(raw.timestamp), |
76df4116aaec99c285f9ab7bee45f253ce652b8d | lib/ModalFooter/examples/ModalFooterExample.js | lib/ModalFooter/examples/ModalFooterExample.js | /**
* Modal: With ModalFooter component
*/
/* eslint-disable */
import React from 'react';
import ModalFooter from '@folio/stripes-components/lib/ModalFooter';
import Button from '@folio/stripes-components/lib/Button';
import Modal from '@folio/stripes-components/lib/Modal';
export default () => {
const footer = (
<ModalFooter
primaryButton={{
label: 'Save',
onClick: () => alert('You clicked save'),
}}
secondaryButton={{
label: 'Cancel',
onClick: () => alert('You clicked cancel'),
}}
/>
);
return (
<Modal
open={true}
label="Modal with ModalFooter"
footer={footer}
>
Modal Content
</Modal>
);
};
| /**
* Modal: With ModalFooter component
*/
/* eslint-disable */
import React from 'react';
import ModalFooter from '../ModalFooter';
import Button from '../../Button';
import Modal from '../../Modal';
export default () => {
const footer = (
<ModalFooter
primaryButton={{
label: 'Save',
onClick: () => alert('You clicked save'),
}}
secondaryButton={{
label: 'Cancel',
onClick: () => alert('You clicked cancel'),
}}
/>
);
return (
<Modal
open={true}
label="Modal with ModalFooter"
footer={footer}
>
Modal Content
</Modal>
);
};
| Fix paths for ModalFooter story CSS | Fix paths for ModalFooter story CSS
| JavaScript | apache-2.0 | folio-org/stripes-components,folio-org/stripes-components | ---
+++
@@ -4,9 +4,9 @@
/* eslint-disable */
import React from 'react';
-import ModalFooter from '@folio/stripes-components/lib/ModalFooter';
-import Button from '@folio/stripes-components/lib/Button';
-import Modal from '@folio/stripes-components/lib/Modal';
+import ModalFooter from '../ModalFooter';
+import Button from '../../Button';
+import Modal from '../../Modal';
export default () => {
const footer = ( |
b29eb395840f11f8a981040b2e75a9116f9def34 | time/client.js | time/client.js | (function () {
function adjust_all_times() {
$('time').each(function () {
var t = $(this);
var d = t.attr('datetime').replace(/-/g, '/'
).replace('T', ' ').replace('Z', ' GMT');
t.html(readable_time(new Date(d).getTime()));
});
}
adjust_all_times();
})();
| (function () {
function adjust_all_times() {
$('time').each(function () {
var date = date_from_time_el(this);
this.innerHTML = readable_time(date.getTime());
});
}
function date_from_time_el(el) {
var d = el.getAttribute('datetime').replace(/-/g, '/'
).replace('T', ' ').replace('Z', ' GMT');
return new Date(d);
}
adjust_all_times();
})();
| Optimize adjust_all_times() and extract helper | Optimize adjust_all_times() and extract helper
| JavaScript | mit | vampiricwulf/ex-tanoshiine,reiclone/doushio,lalcmellkmal/doushio,reiclone/doushio,theGaggle/sleepingpizza,vampiricwulf/ex-tanoshiine,lalcmellkmal/doushio,alokal/meguca,alokal/meguca,lalcmellkmal/doushio,vampiricwulf/tanoshiine,theGaggle/sleepingpizza,vampiricwulf/tanoshiine,lalcmellkmal/doushio,alokal/meguca,reiclone/doushio,reiclone/doushio,alokal/meguca,vampiricwulf/ex-tanoshiine,vampiricwulf/ex-tanoshiine,vampiricwulf/tanoshiine,vampiricwulf/tanoshiine,theGaggle/sleepingpizza,vampiricwulf/tanoshiine,reiclone/doushio,KoinoAoi/meguca,KoinoAoi/meguca,theGaggle/sleepingpizza,theGaggle/sleepingpizza,KoinoAoi/meguca,lalcmellkmal/doushio,theGaggle/sleepingpizza,KoinoAoi/meguca,KoinoAoi/meguca,alokal/meguca,vampiricwulf/ex-tanoshiine | ---
+++
@@ -2,11 +2,15 @@
function adjust_all_times() {
$('time').each(function () {
- var t = $(this);
- var d = t.attr('datetime').replace(/-/g, '/'
- ).replace('T', ' ').replace('Z', ' GMT');
- t.html(readable_time(new Date(d).getTime()));
+ var date = date_from_time_el(this);
+ this.innerHTML = readable_time(date.getTime());
});
+}
+
+function date_from_time_el(el) {
+ var d = el.getAttribute('datetime').replace(/-/g, '/'
+ ).replace('T', ' ').replace('Z', ' GMT');
+ return new Date(d);
}
adjust_all_times(); |
b9270fe41a91bf51f775f8fea818b4bdce222cb7 | logology-v12/src/www/js/app/views/lemmaList.js | logology-v12/src/www/js/app/views/lemmaList.js | "use strict";
import h from "yasmf-h";
import el from "$LIB/templates/el";
import L from "$APP/localization/localization";
import glyph from "$WIDGETS/glyph";
import list from "$WIDGETS/list";
import listItem from "$WIDGETS/listItem";
import listItemContents from "$WIDGETS/listItemContents";
import listItemActions from "$WIDGETS/listItemActions";
import listIndicator from "$WIDGETS/listIndicator";
export default function lemmaList(lemmas) {
return list({
contents: lemmas.map( lemma => {
return listItem({
contents: listItemContents({
props: {
value: lemma
},
contents: [
h.el("div.y-flex", lemma),
listIndicator()
]
}),
actions: listItemActions({
contents: [
glyph({icon:"fav", title:"Save this item as a favorite", contents: "Favorite"}),
glyph({icon:"share", title:"Share this item", contents: "Share"}),
glyph({icon:"note", title:"Create or edit a note", contents: "Note"})
]
})
});
})
});
}
| "use strict";
import h from "yasmf-h";
import el from "$LIB/templates/el";
import L from "$APP/localization/localization";
import glyph from "$WIDGETS/glyph";
import list from "$WIDGETS/list";
import listItem from "$WIDGETS/listItem";
import listItemContents from "$WIDGETS/listItemContents";
import listItemActions from "$WIDGETS/listItemActions";
import lemmaActions from "./lemmaActions";
export default function lemmaList(lemmas) {
return list({
contents: lemmas.map( lemma => {
return listItem({
contents: listItemContents({
props: {
value: lemma
},
contents: [
h.el("div.y-flex", lemma)
]
}),
actions: listItemActions({ contents: lemmaActions() })
});
})
});
}
| Remove indicator; refactor actions to separate view | Remove indicator; refactor actions to separate view
| JavaScript | mit | kerrishotts/Mastering-PhoneGap-Code-Package,kerrishotts/Mastering-PhoneGap-Code-Package,kerrishotts/Mastering-PhoneGap-Code-Package,kerrishotts/Mastering-PhoneGap-Code-Package | ---
+++
@@ -9,7 +9,7 @@
import listItem from "$WIDGETS/listItem";
import listItemContents from "$WIDGETS/listItemContents";
import listItemActions from "$WIDGETS/listItemActions";
-import listIndicator from "$WIDGETS/listIndicator";
+import lemmaActions from "./lemmaActions";
export default function lemmaList(lemmas) {
return list({
@@ -20,17 +20,10 @@
value: lemma
},
contents: [
- h.el("div.y-flex", lemma),
- listIndicator()
+ h.el("div.y-flex", lemma)
]
}),
- actions: listItemActions({
- contents: [
- glyph({icon:"fav", title:"Save this item as a favorite", contents: "Favorite"}),
- glyph({icon:"share", title:"Share this item", contents: "Share"}),
- glyph({icon:"note", title:"Create or edit a note", contents: "Note"})
- ]
- })
+ actions: listItemActions({ contents: lemmaActions() })
});
})
}); |
3ad8c63ebeb63d0739287888a717a14833b04b92 | modules/core/ui/test/shape-item-promise-handler.js | modules/core/ui/test/shape-item-promise-handler.js | // DecentCMS (c) 2014 Bertrand Le Roy, under MIT. See LICENSE.txt for licensing details.
'use strict';
var expect = require('chai').expect;
describe('Shape Item Promise Handler', function() {
it('changes the promise shape into a content shape and runs a new rendering life cycle for the item', function(done) {
var promiseShape = {
meta: {type: 'shape-item-promise'},
id: 'widget:bar'
};
var item = {id: 'widget:bar', meta: {type: 'foo'}};
var context = {
shape: promiseShape,
renderStream: {},
scope: {
require: function(service) {
switch(service) {
case 'storage-manager':
return {
getAvailableItem: function () {
return item;
}
};
case 'shape':
return require('../services/shape');
}
},
lifecycle: function() {
return function(context, next) {
expect(context.shape.temp.item).to.equal(item);
next();
}
}
}
};
var ShapeItemPromiseHandler = require('../services/shape-item-promise-handler');
ShapeItemPromiseHandler.handle(context, function() {
expect(context.shape.meta.type).to.equal('content');
expect(context.shape.temp.item).to.equal(item);
expect(context.shape.meta.alternates).to.deep.equal(['content-foo', 'content-widget']);
done();
});
});
});
| // DecentCMS (c) 2014 Bertrand Le Roy, under MIT. See LICENSE.txt for licensing details.
'use strict';
var expect = require('chai').expect;
describe('Shape Item Promise Handler', function() {
it('changes the promise shape into a content shape and runs a new rendering life cycle for the item', function(done) {
var promiseShape = {
meta: {type: 'shape-item-promise'},
id: 'widget:bar'
};
var item = {id: 'widget:bar', meta: {type: 'foo'}};
var context = {
shape: promiseShape,
renderStream: {},
scope: {
require: function(service) {
switch(service) {
case 'storage-manager':
return {
getAvailableItem: function () {
return item;
}
};
case 'shape':
return require('../services/shape');
case 'content-manager':
return {
getPartNames: function() {
return [];
}
};
}
},
lifecycle: function() {
return function(context, next) {
expect(context.shape.temp.item).to.equal(item);
next();
}
}
}
};
var ShapeItemPromiseHandler = require('../services/shape-item-promise-handler');
ShapeItemPromiseHandler.handle(context, function() {
expect(context.shape.meta.type).to.equal('content');
expect(context.shape.temp.item).to.equal(item);
expect(context.shape.meta.alternates).to.deep.equal(['content-foo', 'content-widget']);
done();
});
});
});
| Fix shape item promise handler test suite | Fix shape item promise handler test suite
| JavaScript | mit | DecentCMS/DecentCMS | ---
+++
@@ -23,6 +23,12 @@
};
case 'shape':
return require('../services/shape');
+ case 'content-manager':
+ return {
+ getPartNames: function() {
+ return [];
+ }
+ };
}
},
lifecycle: function() { |
90d450bf4183942e81865a20f91780d27f208994 | src/main/web/florence/js/functions/_viewLogIn.js | src/main/web/florence/js/functions/_viewLogIn.js | function viewLogIn() {
var login_form = templates.login;
$('.section').html(login_form);
$('.form-login').submit(function (e) {
e.preventDefault();
var email = $('.fl-user-and-access__email').val();
var password = $('.fl-user-and-access__password').val();
postLogin(email, password);
});
}
| function viewLogIn() {
var login_form = templates.login;
$('.section').html(login_form);
$('.form-login').submit(function (e) {
e.preventDefault();
loadingBtn($('#login'));
var email = $('.fl-user-and-access__email').val();
var password = $('.fl-user-and-access__password').val();
postLogin(email, password);
});
}
| Add loading icon to login screen | Add loading icon to login screen
| JavaScript | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,13 +1,14 @@
function viewLogIn() {
- var login_form = templates.login;
- $('.section').html(login_form);
+ var login_form = templates.login;
+ $('.section').html(login_form);
- $('.form-login').submit(function (e) {
- e.preventDefault();
- var email = $('.fl-user-and-access__email').val();
- var password = $('.fl-user-and-access__password').val();
- postLogin(email, password);
- });
+ $('.form-login').submit(function (e) {
+ e.preventDefault();
+ loadingBtn($('#login'));
+ var email = $('.fl-user-and-access__email').val();
+ var password = $('.fl-user-and-access__password').val();
+ postLogin(email, password);
+ });
}
|
f9569ceee9c7db8c35240c66f511ef8472d936f0 | ui/features/lti_collaborations/index.js | ui/features/lti_collaborations/index.js | /*
* Copyright (C) 2014 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import router from './react/router'
router.start()
| /*
* Copyright (C) 2014 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import router from './react/router'
import ready from '@instructure/ready'
ready(() => {
router.start()
})
| Fix lti collaborations page unresponsive on load in chrome | Fix lti collaborations page unresponsive on load in chrome
fixes VICE-2440
flag=none
Test Plan:
- follow repro steps in linked ticket
Change-Id: I9b682719ea1e258f98caf90a197167a031995f7b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284881
Reviewed-by: Jeffrey Johnson <7a0f98bfe168bc29d5611ba0275e88567b492abc@instructure.com>
Product-Review: Jeffrey Johnson <7a0f98bfe168bc29d5611ba0275e88567b492abc@instructure.com>
QA-Review: Caleb Guanzon <54fa1f30d451e4f3c341a8f3c47c9215fd0be9c6@instructure.com>
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
| JavaScript | agpl-3.0 | sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms | ---
+++
@@ -17,5 +17,8 @@
*/
import router from './react/router'
+import ready from '@instructure/ready'
-router.start()
+ready(() => {
+ router.start()
+}) |
16e2716fddd2d217b53ab0141f74fadf628d589c | config/database.js | config/database.js | var mongodb = require('mongodb');
var host = "alex.mongohq.com";
var port = 10016;
var options = {};
var server = new mongodb.Server(host, port, options, {native_parser: true});
var Database = new mongodb.Db("TexasEstimateEm", server, {safe: false});
var inspect = require('eyes').inspector({ stream: null });
exports.close = function(){
Database.close();
};
exports.open = function(callback){
console.log(inspect('Opening database...'));
Database.open(function(error, db){
if(error){return callback.call(this, error);}
console.log(inspect('Authenticating...'));
db.authenticate('narciso', 'guillen', function (err, replies) {
console.log(inspect("We are now connected and authenticated ."));
var collections = {
users: new mongodb.Collection(db, "users")
};
return callback.call(this, err, collections);
});
});
};
| var mongodb = require('mongodb');
var host = "alex.mongohq.com";
var port = 10016;
var options = {};
var server = new mongodb.Server(host, port, options, {native_parser: true});
var Database = new mongodb.Db("TexasEstimateEm", server, {safe: false});
var inspect = require('eyes').inspector({ stream: null });
exports.close = function(){
Database.close();
};
exports.open = function(callback){
console.log(inspect('Opening database...'));
Database.open(function(error, db){
if(error){return callback.call(this, error);}
console.log(inspect('Authenticating...'));
db.authenticate('narciso', 'guillen', function (err, replies) {
console.log(inspect("We are now connected and authenticated ."));
var collections = {
users: new mongodb.Collection(db, "users"),
tasks: new mongodb.Collection(db, "tasks"),
games: new mongodb.Collection(db, "games")
};
return callback.call(this, err, collections);
});
});
};
| Add games and tasks collections | Add games and tasks collections
| JavaScript | mit | tangosource/pokerestimate,tangosource/pokerestimate | ---
+++
@@ -25,7 +25,9 @@
console.log(inspect("We are now connected and authenticated ."));
var collections = {
- users: new mongodb.Collection(db, "users")
+ users: new mongodb.Collection(db, "users"),
+ tasks: new mongodb.Collection(db, "tasks"),
+ games: new mongodb.Collection(db, "games")
};
return callback.call(this, err, collections); |
b52d81de1ccf370e813e7f35dee48d0340e542a6 | app/redux/constants.js | app/redux/constants.js | export default {
FETCH_DATA_BATCH_SIZE: 75,
FETCH_DATA_EXPIRE_SEC: 30,
DEFAULT_SORT_ORDER: 'trending',
JULY_14_HACK: new Date('2016-07-14T00:00:00Z').getTime(),
};
| export default {
FETCH_DATA_BATCH_SIZE: 20,
FETCH_DATA_EXPIRE_SEC: 30,
DEFAULT_SORT_ORDER: 'trending',
JULY_14_HACK: new Date('2016-07-14T00:00:00Z').getTime(),
};
| Revert "Temp increase fetch batch size to work around missing blog history" | Revert "Temp increase fetch batch size to work around missing blog history"
This reverts commit edc49e88c559aee6ee42fae6cd8e93a43e1457b3.
| JavaScript | mit | steemit-intl/steemit.com,TimCliff/steemit.com,GolosChain/tolstoy,TimCliff/steemit.com,enisey14/platform,steemit/steemit.com,steemit/steemit.com,steemit-intl/steemit.com,enisey14/platform,GolosChain/tolstoy,TimCliff/steemit.com,GolosChain/tolstoy,steemit/steemit.com | ---
+++
@@ -1,5 +1,5 @@
export default {
- FETCH_DATA_BATCH_SIZE: 75,
+ FETCH_DATA_BATCH_SIZE: 20,
FETCH_DATA_EXPIRE_SEC: 30,
DEFAULT_SORT_ORDER: 'trending',
JULY_14_HACK: new Date('2016-07-14T00:00:00Z').getTime(), |
0a480399709fb4b22b1e6be4edc32ceb261520f8 | tests/system/test-trigger-upload-on-file-selection.js | tests/system/test-trigger-upload-on-file-selection.js | const numberOfPlannedTests = 6
casper.test.begin('test-trigger-upload-on-file-selection', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}/trigger-on-file-select`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryForm', { my_file: `${fixturePath}/1.jpg` })
this.waitFor(function () {
return curr !== this.getCurrentUrl()
})
})
casper.then(function () {
this.test.assertTextExists('ASSEMBLY_COMPLETED')
})
casper.run(function () {
this.test.done()
})
})
| const numberOfPlannedTests = 5
casper.test.begin('test-trigger-upload-on-file-selection', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}/trigger-on-file-select`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryForm', { my_file: `${fixturePath}/1.jpg` })
this.waitFor(function () {
return curr !== this.getCurrentUrl()
})
})
casper.then(function () {
this.test.assertTextExists('ASSEMBLY_COMPLETED')
})
casper.run(function () {
this.test.done()
})
})
| Change num of planned tests. | Change num of planned tests.
| JavaScript | mit | transloadit/jquery-sdk,transloadit/jquery-sdk,transloadit/jquery-sdk | ---
+++
@@ -1,4 +1,4 @@
-const numberOfPlannedTests = 6
+const numberOfPlannedTests = 5
casper.test.begin('test-trigger-upload-on-file-selection', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}/trigger-on-file-select`, function () {
}) |
a01fac7c6dc5979b98d1206b91d8798cdfbcf33e | src/Oro/Bundle/EmailBundle/Resources/public/js/app/modules/views-module.js | src/Oro/Bundle/EmailBundle/Resources/public/js/app/modules/views-module.js | require([
'oroui/js/app/controllers/base/controller'
], function(BaseController) {
'use strict';
BaseController.loadBeforeAction([
'jquery',
'oroemail/js/app/components/email-notification-component',
'oroemail/js/app/components/new-email-message-component',
'oroemail/js/app/models/email-notification/email-notification-count-model'
], function($, EmailNotificationComponent, NewEmailMessageComponent, EmailNotificationCountModel) {
BaseController.addToReuse('emailNotification', {
compose: function() {
var $menu = $('.email-notification-menu');
var $notification = $menu.find('.new-email-notification');
if ($menu.length !== 0) {
var options = $menu.data('page-component-options');
options._sourceElement = $menu.find('.dropdown-menu');
options._iconElement = $menu.find('.email-notification-icon');
options.countModel = new EmailNotificationCountModel({'unreadEmailsCount': options.count});
this.component = new EmailNotificationComponent(options);
}
this.emailNotificationComponent = new NewEmailMessageComponent({
notificationElement: $notification.length > 0 ? $notification : null
});
}
});
});
});
| require([
'oroui/js/app/controllers/base/controller'
], function(BaseController) {
'use strict';
BaseController.loadBeforeAction([
'jquery',
'oroemail/js/app/components/email-notification-component',
'oroemail/js/app/models/email-notification/email-notification-count-model'
], function($, EmailNotificationComponent, EmailNotificationCountModel) {
BaseController.addToReuse('emailNotification', {
compose: function() {
var $menu = $('.email-notification-menu');
if ($menu.length !== 0) {
var options = $menu.data('page-component-options');
options._sourceElement = $menu.find('.dropdown-menu');
options._iconElement = $menu.find('.email-notification-icon');
options.countModel = new EmailNotificationCountModel({'unreadEmailsCount': options.count});
this.component = new EmailNotificationComponent(options);
}
}
});
});
BaseController.loadBeforeAction([
'jquery',
'oroemail/js/app/components/new-email-message-component'
], function($, NewEmailMessageComponent) {
BaseController.addToReuse('mewEmailMessage', {
compose: function() {
var $notification = $('.email-notification-menu .new-email-notification');
this.component = new NewEmailMessageComponent({
notificationElement: $notification.length > 0 ? $notification : null
});
}
});
});
});
| Fix "You have a new email" message | CRM-4194: Fix "You have a new email" message
fixed compositions concept | JavaScript | mit | orocrm/platform,orocrm/platform,geoffroycochard/platform,ramunasd/platform,trustify/oroplatform,geoffroycochard/platform,geoffroycochard/platform,ramunasd/platform,Djamy/platform,orocrm/platform,trustify/oroplatform,ramunasd/platform,Djamy/platform,trustify/oroplatform,Djamy/platform | ---
+++
@@ -6,13 +6,11 @@
BaseController.loadBeforeAction([
'jquery',
'oroemail/js/app/components/email-notification-component',
- 'oroemail/js/app/components/new-email-message-component',
'oroemail/js/app/models/email-notification/email-notification-count-model'
- ], function($, EmailNotificationComponent, NewEmailMessageComponent, EmailNotificationCountModel) {
+ ], function($, EmailNotificationComponent, EmailNotificationCountModel) {
BaseController.addToReuse('emailNotification', {
compose: function() {
var $menu = $('.email-notification-menu');
- var $notification = $menu.find('.new-email-notification');
if ($menu.length !== 0) {
var options = $menu.data('page-component-options');
options._sourceElement = $menu.find('.dropdown-menu');
@@ -20,7 +18,18 @@
options.countModel = new EmailNotificationCountModel({'unreadEmailsCount': options.count});
this.component = new EmailNotificationComponent(options);
}
- this.emailNotificationComponent = new NewEmailMessageComponent({
+ }
+ });
+ });
+
+ BaseController.loadBeforeAction([
+ 'jquery',
+ 'oroemail/js/app/components/new-email-message-component'
+ ], function($, NewEmailMessageComponent) {
+ BaseController.addToReuse('mewEmailMessage', {
+ compose: function() {
+ var $notification = $('.email-notification-menu .new-email-notification');
+ this.component = new NewEmailMessageComponent({
notificationElement: $notification.length > 0 ? $notification : null
});
} |
7ba9860efaf5e6eee85d3343cd257e8f46c78a06 | assets/js/components/notifications/site/mark-notification.js | assets/js/components/notifications/site/mark-notification.js | /**
* External dependencies
*/
import data, { TYPE_CORE } from 'GoogleComponents/data';
import { trackEvent } from 'assets/js/util/tracking';
const ACCEPTED = 'accepted';
const DISMISSED = 'dismissed';
/**
* Marks the given notification with the provided state.
*
* @param {string} id Notification ID.
* @param {state} state Notification state.
*/
export async function markNotification( id, state ) {
// Invalidate the cache so that notifications will be fetched fresh
// to not show a marked notification again.
data.invalidateCacheGroup( TYPE_CORE, 'site', 'notifications' );
trackEvent( 'site_notifications', state, id );
return await data.set( TYPE_CORE, 'site', 'mark-notification', {
notificationID: id,
notificationState: state,
} );
}
/**
* Marks the given notification as accepted.
*
* @param {string} id Notification ID.
*/
export async function acceptNotification( id ) {
return await markNotification( id, ACCEPTED );
}
/**
* Marks the given notification as dismissed.
*
* @param {string} id Notification ID.
*/
export async function dismissNotification( id ) {
return await markNotification( id, DISMISSED );
}
| /**
* External dependencies
*/
import data, { TYPE_CORE } from 'GoogleComponents/data';
import { trackEvent } from 'assets/js/util/tracking';
const ACCEPTED = 'accepted';
const DISMISSED = 'dismissed';
/**
* Marks the given notification with the provided state.
*
* @param {string} id Notification ID.
* @param {string} state Notification state.
*/
export async function markNotification( id, state ) {
// Invalidate the cache so that notifications will be fetched fresh
// to not show a marked notification again.
data.invalidateCacheGroup( TYPE_CORE, 'site', 'notifications' );
trackEvent( 'site_notifications', state, id );
return await data.set( TYPE_CORE, 'site', 'mark-notification', {
notificationID: id,
notificationState: state,
} );
}
/**
* Marks the given notification as accepted.
*
* @param {string} id Notification ID.
*/
export async function acceptNotification( id ) {
return await markNotification( id, ACCEPTED );
}
/**
* Marks the given notification as dismissed.
*
* @param {string} id Notification ID.
*/
export async function dismissNotification( id ) {
return await markNotification( id, DISMISSED );
}
| Fix invalid type in JSdoc. | Fix invalid type in JSdoc.
| JavaScript | apache-2.0 | google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp | ---
+++
@@ -10,8 +10,8 @@
/**
* Marks the given notification with the provided state.
*
- * @param {string} id Notification ID.
- * @param {state} state Notification state.
+ * @param {string} id Notification ID.
+ * @param {string} state Notification state.
*/
export async function markNotification( id, state ) {
// Invalidate the cache so that notifications will be fetched fresh |
4ed024451e1bcfd5657c0814f16cd1ce56ed620e | scripts/publishForDesktop.js | scripts/publishForDesktop.js | const fs = require('fs');
const glob = require('glob');
const path = require('path');
const rimraf = require('rimraf');
const workspaceRoot = path.join(__dirname, '..');
const desktopUpdatesPath = path.join(workspaceRoot, '..', 'toolkit-for-ynab-gh-pages', 'desktop-updates');
// Clear out the directory and create it clean.
rimraf.sync(desktopUpdatesPath);
fs.mkdirSync(desktopUpdatesPath);
// Copy the extension over first.
const filesToCopy = glob.sync(path.join(workspaceRoot, 'dist/*.zip'));
if (filesToCopy.length !== 1) {
throw new Error(`There must be precisely one zip file to copy. Found ${filesToCopy.length}!`);
}
fs.copyFileSync(filesToCopy[0], path.join(desktopUpdatesPath, 'toolkitforynab_desktop.zip'));
// And now we can copy over the manifest too.
fs.copyFileSync(
path.join(workspaceRoot, 'dist', 'extension', 'manifest.json'),
path.join(desktopUpdatesPath, 'manifest.json')
);
| const fs = require('fs');
const glob = require('glob');
const path = require('path');
const rimraf = require('rimraf');
const workspaceRoot = path.join(__dirname, '..');
const desktopUpdatesPath = path.join(workspaceRoot, '..', 'toolkit-for-ynab-gh-pages', 'desktop-updates');
// Clear out the directory and create it clean.
rimraf.sync(desktopUpdatesPath);
fs.mkdirSync(desktopUpdatesPath);
// Copy the extension over first.
const filesToCopy = glob.sync(path.join(workspaceRoot, 'dist/toolkit-for-ynab-v*.zip'));
if (filesToCopy.length !== 1) {
throw new Error(`There must be precisely one zip file to copy. Found ${filesToCopy.length}!`);
}
fs.copyFileSync(filesToCopy[0], path.join(desktopUpdatesPath, 'toolkitforynab_desktop.zip'));
// And now we can copy over the manifest too.
fs.copyFileSync(
path.join(workspaceRoot, 'dist', 'extension', 'manifest.json'),
path.join(desktopUpdatesPath, 'manifest.json')
);
| Update publish for desktop script | Update publish for desktop script
| JavaScript | mit | toolkit-for-ynab/toolkit-for-ynab,dbaldon/toolkit-for-ynab,dbaldon/toolkit-for-ynab,dbaldon/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,dbaldon/toolkit-for-ynab,blargity/toolkit-for-ynab,blargity/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,falkencreative/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,falkencreative/toolkit-for-ynab,falkencreative/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,blargity/toolkit-for-ynab,falkencreative/toolkit-for-ynab,blargity/toolkit-for-ynab | ---
+++
@@ -11,7 +11,7 @@
fs.mkdirSync(desktopUpdatesPath);
// Copy the extension over first.
-const filesToCopy = glob.sync(path.join(workspaceRoot, 'dist/*.zip'));
+const filesToCopy = glob.sync(path.join(workspaceRoot, 'dist/toolkit-for-ynab-v*.zip'));
if (filesToCopy.length !== 1) {
throw new Error(`There must be precisely one zip file to copy. Found ${filesToCopy.length}!`); |
4e335d931c15995c29989cc2e5e6b2ac77fbd4eb | assets/js/wikipedia.js | assets/js/wikipedia.js | /**
* Retrieves the first wikipedia article for a provided
* name and passes it to the provided callback. If it fails,
* "null" will be provided to the callback, or if provided,
* the failCallback will be called.
*/
function getWikipediaExcerpt(name, callback, failCallback)
{
$.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=" + name + "&redirects=1&callback=?",
function(json) {
handleAPIResponse(json, callback, failCallback);
})
.fail(handleAPIResponse(null, failCallback, failCallback));
}
function handleAPIResponse(wikipediaData, callback, failCallback)
{
if (failCallback === null) {
failCallback = callback;
}
if (wikipediaData === null) {
failCallback(null);
} else {
let query = wikipediaData.query.pages;
for (first in query) break;
if (query[first].hasOwnProperty('missing')) {
failCallback(null);
} else {
let data = []
data.title = query[first].title;
data.extract = query[first].extract;
data.url = 'https://en.wikipedia.org/wiki/' + data.title
callback(data);
}
}
}
| /**
* Retrieves the first wikipedia article for a provided
* name and passes it to the provided callback. If it fails,
* "null" will be provided to the callback, or if provided,
* the failCallback will be called.
*/
function getWikipediaExcerpt(name, callback, failCallback)
{
$.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=" + encodeURIComponent(name) + "&redirects=1&callback=?")
.done(function(json) {
handleAPIResponse(json, callback, failCallback);
})
.fail(function(data) {
handleAPIResponse(null, failCallback, failCallback)
});
}
function handleAPIResponse(wikipediaData, callback, failCallback)
{
if (failCallback === null) {
failCallback = callback;
}
if (wikipediaData === null) {
failCallback(null);
} else {
let query = wikipediaData.query.pages;
for (first in query) break;
if (query[first].hasOwnProperty('missing')) {
failCallback(null);
} else {
let data = []
data.title = query[first].title;
data.extract = query[first].extract;
data.url = 'https://en.wikipedia.org/wiki/' + data.title
callback(data);
}
}
}
| Fix calling fail every time | Fix calling fail every time
| JavaScript | mit | thenaterhood/todayinmy.city,thenaterhood/todayinmy.city,thenaterhood/todayinmy.city | ---
+++
@@ -6,11 +6,13 @@
*/
function getWikipediaExcerpt(name, callback, failCallback)
{
- $.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=" + name + "&redirects=1&callback=?",
- function(json) {
+ $.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=" + encodeURIComponent(name) + "&redirects=1&callback=?")
+ .done(function(json) {
handleAPIResponse(json, callback, failCallback);
})
- .fail(handleAPIResponse(null, failCallback, failCallback));
+ .fail(function(data) {
+ handleAPIResponse(null, failCallback, failCallback)
+ });
}
function handleAPIResponse(wikipediaData, callback, failCallback)
@@ -22,7 +24,6 @@
if (wikipediaData === null) {
failCallback(null);
} else {
-
let query = wikipediaData.query.pages;
for (first in query) break;
|
de4f102e9e02ecdf6778ee3a2e5cd60a65cea2c4 | assets/github.js | assets/github.js | require([ 'gitbook' ], function (gitbook) {
gitbook.events.bind('start', function (e, config) {
var githubURL = config.github.url;
if (githubURL) {
jQuery('.book-header > h1').before(
'<a href="' + githubURL + '" _target="blank" class="btn pull-right github-sharing-link sharing-link" aria-label="GitHub">' +
'<i class="fa fa-github"></i>' +
'</a>'
);
}
});
});
| require([ 'gitbook' ], function (gitbook) {
var githubURL;
function insertGitHubLink() {
if (githubURL && jQuery('.github-sharing-link').length === 0) {
jQuery('.book-header > h1').before(
'<a href="' + githubURL + '" _target="blank" class="btn pull-right github-sharing-link sharing-link" aria-label="GitHub">' +
'<i class="fa fa-github"></i>' +
'</a>'
);
}
}
gitbook.events.bind('start', function (e, config) {
githubURL = config.github.url;
insertGitHubLink();
});
gitbook.events.bind('page.change', function () {
insertGitHubLink();
});
});
| Update link on page.change event | Update link on page.change event
| JavaScript | apache-2.0 | GitbookIO/plugin-github | ---
+++
@@ -1,13 +1,22 @@
require([ 'gitbook' ], function (gitbook) {
- gitbook.events.bind('start', function (e, config) {
- var githubURL = config.github.url;
+ var githubURL;
- if (githubURL) {
+ function insertGitHubLink() {
+ if (githubURL && jQuery('.github-sharing-link').length === 0) {
jQuery('.book-header > h1').before(
'<a href="' + githubURL + '" _target="blank" class="btn pull-right github-sharing-link sharing-link" aria-label="GitHub">' +
'<i class="fa fa-github"></i>' +
'</a>'
);
}
+ }
+
+ gitbook.events.bind('start', function (e, config) {
+ githubURL = config.github.url;
+ insertGitHubLink();
+ });
+
+ gitbook.events.bind('page.change', function () {
+ insertGitHubLink();
});
}); |
101d2d24a28145bd1352c96d4e361223dd0a464d | src/js/components/Footer.js | src/js/components/Footer.js | import React from 'react';
import SocialLinks from './SocialLinks';
import { withClassName } from './HOC';
import { currentYear } from '../utils';
function Footer({ className }) {
return (
<footer className={className}>
<SocialLinks />
<p>
<small className="footer__copy">
Slava Pavlutin © 2016-{ currentYear() }
</small>
</p>
</footer>
);
}
export default withClassName('footer')(Footer);
| import React from 'react';
import SocialLinks from './SocialLinks';
import { withClassName } from './HOC';
import { currentYear } from '../utils';
function Footer({ className }) {
return (
<footer className={className}>
<SocialLinks />
<div>
<small className="footer__copy">
Slava Pavlutin © 2016-{ currentYear() }
</small>
</div>
</footer>
);
}
export default withClassName('footer')(Footer);
| Replace <p> with <div> in .footer | Replace <p> with <div> in .footer [skip ci]
| JavaScript | mit | slavapavlutin/pavlutin-node,slavapavlutin/pavlutin-node | ---
+++
@@ -8,11 +8,11 @@
return (
<footer className={className}>
<SocialLinks />
- <p>
+ <div>
<small className="footer__copy">
Slava Pavlutin © 2016-{ currentYear() }
</small>
- </p>
+ </div>
</footer>
);
} |
abc6c2d42c1f5d7063974ac0bd196bbf05b3205a | src/mixins/updateable.js | src/mixins/updateable.js | var updatable = function() {
var self = this;
// Update all children
this.on('update', dt => {
self.children.forEach(child => {
if (child.update) {
child.trigger('update', dt);
}
});
});
};
export default updatable;
| import checkForFlag from 'flockn/utils/ckeckforflag';
var isStatic = checkForFlag('static');
// TODO: This is not completely how I want it be as it only sets the children as static and not the element itself
var updatable = function updateable() {
// Update all children
this.on('update', dt => {
if (!isStatic.call(this)) {
return;
}
this.children.forEach(child => {
if (child.update) {
child.trigger('update', dt);
}
});
});
};
export default updatable;
| Add an "visible" equivalent for update mixin | Add an "visible" equivalent for update mixin
| JavaScript | mit | freezedev/flockn,freezedev/flockn | ---
+++
@@ -1,9 +1,16 @@
-var updatable = function() {
- var self = this;
+import checkForFlag from 'flockn/utils/ckeckforflag';
+var isStatic = checkForFlag('static');
+
+// TODO: This is not completely how I want it be as it only sets the children as static and not the element itself
+var updatable = function updateable() {
// Update all children
this.on('update', dt => {
- self.children.forEach(child => {
+ if (!isStatic.call(this)) {
+ return;
+ }
+
+ this.children.forEach(child => {
if (child.update) {
child.trigger('update', dt);
} |
7d68d53d3ad32b8c1e6a301a8c5a038e0d0f89f6 | coeus-webapp/src/main/webapp/scripts/common/global.js | coeus-webapp/src/main/webapp/scripts/common/global.js | var Kc = Kc || {};
Kc.Global = Kc.Global || {};
(function (namespace, $) {
// set all modals to static behavior (clicking out does not close)
$.fn.modal.Constructor.DEFAULTS.backdrop = "static";
})(Kc.Global, jQuery); | var Kc = Kc || {};
Kc.Global = Kc.Global || {};
(function (namespace, $) {
// set all modals to static behavior (clicking out does not close)
$.fn.modal.Constructor.DEFAULTS.backdrop = "static";
$(document).on("ready", function(){
// date conversion for date fields to full leading 0 - for days and months and to full year dates
$(document).on("blur", ".uif-dateControl", function(){
var dateFormat = $.datepicker._defaults.dateFormat;
var date = $(this).val();
if (!date) {
return;
}
date = date.replace(/-/g, "/");
if (date && (date.match(/\//g) || []).length === 2) {
// find the expected position and value of year in the string based on date format
var year;
if (dateFormat.indexOf("y") === 0) {
year = date.substr(0, date.indexOf("/"));
}
else {
year = date.substr(date.lastIndexOf("/") + 1, date.length - 1);
}
// when year is length of 2 append the first 2 numbers of the current full year (ie 14 -> 2014)
if (year.length === 2) {
var currentDate = new Date();
year = currentDate.getFullYear().toString().substr(0,2) + year;
}
var dateObj = new Date(date);
if (isNaN(dateObj.valueOf())) {
// not valid abandon conversion
return;
}
dateObj.setFullYear(year);
var formattedDate = $.datepicker.formatDate(dateFormat, dateObj);
$(this).val(formattedDate);
}
});
});
})(Kc.Global, jQuery); | Convert non-full date to full date on loss of focus in js | [KRACOEUS-8479] Convert non-full date to full date on loss of focus in js
| JavaScript | agpl-3.0 | iu-uits-es/kc,jwillia/kc-old1,mukadder/kc,kuali/kc,ColostateResearchServices/kc,iu-uits-es/kc,kuali/kc,UniversityOfHawaiiORS/kc,jwillia/kc-old1,iu-uits-es/kc,ColostateResearchServices/kc,jwillia/kc-old1,UniversityOfHawaiiORS/kc,jwillia/kc-old1,mukadder/kc,UniversityOfHawaiiORS/kc,mukadder/kc,ColostateResearchServices/kc,kuali/kc | ---
+++
@@ -3,4 +3,46 @@
(function (namespace, $) {
// set all modals to static behavior (clicking out does not close)
$.fn.modal.Constructor.DEFAULTS.backdrop = "static";
+
+ $(document).on("ready", function(){
+ // date conversion for date fields to full leading 0 - for days and months and to full year dates
+ $(document).on("blur", ".uif-dateControl", function(){
+ var dateFormat = $.datepicker._defaults.dateFormat;
+ var date = $(this).val();
+ if (!date) {
+ return;
+ }
+
+ date = date.replace(/-/g, "/");
+
+ if (date && (date.match(/\//g) || []).length === 2) {
+
+ // find the expected position and value of year in the string based on date format
+ var year;
+ if (dateFormat.indexOf("y") === 0) {
+ year = date.substr(0, date.indexOf("/"));
+ }
+ else {
+ year = date.substr(date.lastIndexOf("/") + 1, date.length - 1);
+ }
+
+ // when year is length of 2 append the first 2 numbers of the current full year (ie 14 -> 2014)
+ if (year.length === 2) {
+ var currentDate = new Date();
+ year = currentDate.getFullYear().toString().substr(0,2) + year;
+ }
+
+ var dateObj = new Date(date);
+ if (isNaN(dateObj.valueOf())) {
+ // not valid abandon conversion
+ return;
+ }
+
+ dateObj.setFullYear(year);
+
+ var formattedDate = $.datepicker.formatDate(dateFormat, dateObj);
+ $(this).val(formattedDate);
+ }
+ });
+ });
})(Kc.Global, jQuery); |
3f7e152cbcbca8429658b45a6805d0ff5d721d05 | app/models/employee.js | app/models/employee.js | import DS from 'ember-data';
import ProjectedModel from './projected-model';
import Proj from '../utils/projection-attributes';
var Model = ProjectedModel.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
birthDate: DS.attr('date'),
employee1: DS.belongsTo('employee', { inverse: null, async: false }),
orders: DS.hasMany('order', { inverse: null, async: false }),
// Validation rules.
validations: {
firstName: {
presence: true,
length: { minimum: 5 }
},
lastName: {
presence: true,
length: { minimum: 5 }
}
}
});
Model.defineProjection('EmployeeE', 'employee', {
firstName: Proj.attr('First Name'),
lastName: Proj.attr('Last Name'),
birthDate: Proj.attr('Birth Date'),
employee1: Proj.belongsTo('employee', {
firstName: Proj.attr('Reports To - First Name'),
lastName: Proj.attr('Reports To - Last Name', { hidden: true })
}),
orders: Proj.hasMany('order', {
shipName: Proj.attr('Ship Name'),
ShipCountry: Proj.attr('Ship Country'),
OrderDate: Proj.attr('Order Date')
})
});
Model.defineProjection('EmployeeL', 'employee', {
firstName: Proj.attr('First Name'),
lastName: Proj.attr('Last Name')
});
export default Model;
| import DS from 'ember-data';
import ProjectedModel from './projected-model';
import Proj from '../utils/projection-attributes';
var Model = ProjectedModel.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
birthDate: DS.attr('date'),
employee1: DS.belongsTo('employee', { inverse: null, async: false }),
orders: DS.hasMany('order', { inverse: null, async: false }),
// Validation rules.
validations: {
firstName: {
presence: true,
length: { minimum: 5 }
},
lastName: {
presence: true,
length: { minimum: 5 }
}
}
});
Model.defineProjection('EmployeeE', 'employee', {
firstName: Proj.attr('First Name'),
lastName: Proj.attr('Last Name'),
birthDate: Proj.attr('Birth Date'),
employee1: Proj.belongsTo('employee', {
firstName: Proj.attr('Reports To - First Name'),
lastName: Proj.attr('Reports To - Last Name', { hidden: true })
}),
orders: Proj.hasMany('order', {
shipName: Proj.attr('Ship Name'),
shipCountry: Proj.attr('Ship Country'),
orderDate: Proj.attr('Order Date')
})
});
Model.defineProjection('EmployeeL', 'employee', {
firstName: Proj.attr('First Name'),
lastName: Proj.attr('Last Name')
});
export default Model;
| Fix typos in EmployeeE projection | Fix typos in EmployeeE projection
| JavaScript | mit | Flexberry/ember-flexberry,Flexberry/ember-flexberry,Flexberry/ember-flexberry,Flexberry/ember-flexberry | ---
+++
@@ -32,8 +32,8 @@
}),
orders: Proj.hasMany('order', {
shipName: Proj.attr('Ship Name'),
- ShipCountry: Proj.attr('Ship Country'),
- OrderDate: Proj.attr('Order Date')
+ shipCountry: Proj.attr('Ship Country'),
+ orderDate: Proj.attr('Order Date')
})
});
|
e53e51c0adf5a027148067ccbf06535e49bea469 | numeric-string/numeric-string.js | numeric-string/numeric-string.js | var numericString = function (number) {
var string = ('' + number).split('.'),
length = string[0].length,
places = 0;
while (--length) {
places += 1;
// At every third position we want to insert a comma
if (places % 3 === 0) {
string[0] = string[0].substr(0, length) + ',' + string[0].substr(length);
}
}
return string.join('.');
};
| var numericString = function (number) {
var parts = ('' + number).split('.'),
length = parts[0].length,
places = 0;
while (--length) {
places += 1;
// At every third position we want to insert a comma
if (places % 3 === 0) {
parts[0] = parts[0].substr(0, length) + ',' + parts[0].substr(length);
}
}
return parts.join('.');
};
// Example using regular expression - let me know if I can skip the split step
// some how
var numericString = function (number) {
var parts = ('' + number).split('.');
parts[0] = parts[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
return parts.join('.');
};
| Implement regex numeric string solution. | Implement regex numeric string solution.
| JavaScript | mit | saurabhjn76/code-problems,angelkar/code-problems,sethdame/code-problems,jefimenko/code-problems,lgulliver/code-problems,caoglish/code-problems,lgulliver/code-problems,SterlingVix/code-problems,aloisdg/code-problems,diversedition/code-problems,patrickford/code-problems,caoglish/code-problems,caoglish/code-problems,patrickford/code-problems,faruzzy/code-problems,netuoso/code-problems,blakeembrey/code-problems,ranveer-git/code-problems,marcoviappiani/code-problems,faruzzy/code-problems,nacho-gil/code-problems,cjjavellana/code-problems,blakeembrey/code-problems,SterlingVix/code-problems,marcoviappiani/code-problems,sisirkoppaka/code-problems,angelkar/code-problems,marcoviappiani/code-problems,netuoso/code-problems,nacho-gil/code-problems,patrickford/code-problems,ranveer-git/code-problems,faruzzy/code-problems,netuoso/code-problems,cjjavellana/code-problems,ockang/code-problems,dwatson3/code-problems,SterlingVix/code-problems,AndrewKishino/code-problems,hlan2/code-problems,faruzzy/code-problems,aloisdg/code-problems,ankur-anand/code-problems,marcoviappiani/code-problems,jmera/code-problems,tahoeRobbo/code-problems,caoglish/code-problems,hlan2/code-problems,ankur-anand/code-problems,dwatson3/code-problems,netuoso/code-problems,cjjavellana/code-problems,ranveer-git/code-problems,AndrewKishino/code-problems,blakeembrey/code-problems,SterlingVix/code-problems,netuoso/code-problems,nacho-gil/code-problems,nacho-gil/code-problems,faruzzy/code-problems,caoglish/code-problems,tahoeRobbo/code-problems,angelkar/code-problems,AndrewKishino/code-problems,saurabhjn76/code-problems,ockang/code-problems,marcoviappiani/code-problems,ankur-anand/code-problems,blakeembrey/code-problems,blakeembrey/code-problems,hlan2/code-problems,marcoviappiani/code-problems,aloisdg/code-problems,jefimenko/code-problems,SterlingVix/code-problems,jefimenko/code-problems,sethdame/code-problems,netuoso/code-problems,dwatson3/code-problems,BastinRobin/code-problems,tahoeRobbo/code-problems,diversedition/code-problems,sisirkoppaka/code-problems,aloisdg/code-problems,caoglish/code-problems,nacho-gil/code-problems,BastinRobin/code-problems,AndrewKishino/code-problems,saurabhjn76/code-problems,Widea/code-problems,nickell-andrew/code-problems,Widea/code-problems,tahoeRobbo/code-problems,diversedition/code-problems,patrickford/code-problems,angelkar/code-problems,angelkar/code-problems,ockang/code-problems,akaragkiozidis/code-problems,caoglish/code-problems,patrickford/code-problems,SterlingVix/code-problems,netuoso/code-problems,angelkar/code-problems,nacho-gil/code-problems,rkho/code-problems,saurabhjn76/code-problems,hlan2/code-problems,nickell-andrew/code-problems,sisirkoppaka/code-problems,modulexcite/code-problems,blakeembrey/code-problems,cjjavellana/code-problems,lgulliver/code-problems,sisirkoppaka/code-problems,akaragkiozidis/code-problems,jefimenko/code-problems,rkho/code-problems,nacho-gil/code-problems,ankur-anand/code-problems,ankur-anand/code-problems,modulexcite/code-problems,ranveer-git/code-problems,patrickford/code-problems,nickell-andrew/code-problems,AndrewKishino/code-problems,cjjavellana/code-problems,tahoeRobbo/code-problems,cjjavellana/code-problems,BastinRobin/code-problems,jefimenko/code-problems,jefimenko/code-problems,jmera/code-problems,diversedition/code-problems,Widea/code-problems,nickell-andrew/code-problems,AndrewKishino/code-problems,aloisdg/code-problems,nacho-gil/code-problems,ankur-anand/code-problems,BastinRobin/code-problems,ranveer-git/code-problems,modulexcite/code-problems,sethdame/code-problems,saurabhjn76/code-problems,ockang/code-problems,tahoeRobbo/code-problems,jmera/code-problems,diversedition/code-problems,modulexcite/code-problems,modulexcite/code-problems,cjjavellana/code-problems,ankur-anand/code-problems,modulexcite/code-problems,faruzzy/code-problems,ockang/code-problems,aloisdg/code-problems,sisirkoppaka/code-problems,marcoviappiani/code-problems,diversedition/code-problems,jefimenko/code-problems,rkho/code-problems,nacho-gil/code-problems,diversedition/code-problems,jmera/code-problems,modulexcite/code-problems,aloisdg/code-problems,saurabhjn76/code-problems,Widea/code-problems,netuoso/code-problems,Widea/code-problems,rkho/code-problems,tahoeRobbo/code-problems,aloisdg/code-problems,blakeembrey/code-problems,patrickford/code-problems,Widea/code-problems,nickell-andrew/code-problems,sethdame/code-problems,caoglish/code-problems,BastinRobin/code-problems,sethdame/code-problems,ankur-anand/code-problems,lgulliver/code-problems,ockang/code-problems,hlan2/code-problems,hlan2/code-problems,SterlingVix/code-problems,faruzzy/code-problems,patrickford/code-problems,sisirkoppaka/code-problems,patrickford/code-problems,rkho/code-problems,jefimenko/code-problems,Widea/code-problems,sethdame/code-problems,faruzzy/code-problems,diversedition/code-problems,modulexcite/code-problems,marcoviappiani/code-problems,marcoviappiani/code-problems,blakeembrey/code-problems,angelkar/code-problems,angelkar/code-problems,BastinRobin/code-problems,Widea/code-problems,diversedition/code-problems,saurabhjn76/code-problems,jmera/code-problems,faruzzy/code-problems,ankur-anand/code-problems,lgulliver/code-problems,modulexcite/code-problems,BastinRobin/code-problems,hlan2/code-problems,nickell-andrew/code-problems,nickell-andrew/code-problems,akaragkiozidis/code-problems,lgulliver/code-problems,tahoeRobbo/code-problems,sethdame/code-problems,sisirkoppaka/code-problems,lgulliver/code-problems,nickell-andrew/code-problems,Widea/code-problems,ockang/code-problems,jefimenko/code-problems,sethdame/code-problems,AndrewKishino/code-problems,dwatson3/code-problems,sisirkoppaka/code-problems,marcoviappiani/code-problems,caoglish/code-problems,rkho/code-problems,akaragkiozidis/code-problems,jmera/code-problems,AndrewKishino/code-problems,nickell-andrew/code-problems,saurabhjn76/code-problems,hlan2/code-problems,angelkar/code-problems,akaragkiozidis/code-problems,BastinRobin/code-problems,aloisdg/code-problems,ockang/code-problems,ockang/code-problems,rkho/code-problems,jefimenko/code-problems,ranveer-git/code-problems,akaragkiozidis/code-problems,modulexcite/code-problems,hlan2/code-problems,saurabhjn76/code-problems,ranveer-git/code-problems,AndrewKishino/code-problems,jmera/code-problems,rkho/code-problems,tahoeRobbo/code-problems,dwatson3/code-problems,tahoeRobbo/code-problems,sethdame/code-problems,dwatson3/code-problems,jmera/code-problems,angelkar/code-problems,caoglish/code-problems,ranveer-git/code-problems,SterlingVix/code-problems,ockang/code-problems,cjjavellana/code-problems,cjjavellana/code-problems,SterlingVix/code-problems,jmera/code-problems,ankur-anand/code-problems,netuoso/code-problems,akaragkiozidis/code-problems,patrickford/code-problems,sethdame/code-problems,faruzzy/code-problems,nacho-gil/code-problems,cjjavellana/code-problems,hlan2/code-problems,lgulliver/code-problems,nickell-andrew/code-problems,ranveer-git/code-problems,rkho/code-problems,lgulliver/code-problems,ranveer-git/code-problems,akaragkiozidis/code-problems,lgulliver/code-problems,rkho/code-problems,BastinRobin/code-problems,dwatson3/code-problems,akaragkiozidis/code-problems,akaragkiozidis/code-problems,dwatson3/code-problems,aloisdg/code-problems,dwatson3/code-problems,SterlingVix/code-problems,saurabhjn76/code-problems,blakeembrey/code-problems,jmera/code-problems,sisirkoppaka/code-problems,dwatson3/code-problems,AndrewKishino/code-problems,sisirkoppaka/code-problems,Widea/code-problems,blakeembrey/code-problems | ---
+++
@@ -1,15 +1,25 @@
var numericString = function (number) {
- var string = ('' + number).split('.'),
- length = string[0].length,
+ var parts = ('' + number).split('.'),
+ length = parts[0].length,
places = 0;
while (--length) {
places += 1;
// At every third position we want to insert a comma
if (places % 3 === 0) {
- string[0] = string[0].substr(0, length) + ',' + string[0].substr(length);
+ parts[0] = parts[0].substr(0, length) + ',' + parts[0].substr(length);
}
}
- return string.join('.');
+ return parts.join('.');
};
+
+// Example using regular expression - let me know if I can skip the split step
+// some how
+var numericString = function (number) {
+ var parts = ('' + number).split('.');
+
+ parts[0] = parts[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
+
+ return parts.join('.');
+}; |
1b95d90af76ebeea88e3c12b34c3360b09486ea8 | src/reducers/reducerTone.js | src/reducers/reducerTone.js | import { GET_TONE } from '../actions/index';
export default function (state = [], action) {
switch (action.type) {
case GET_TONE:
return action.payload.data;
default:
return state;
}
}
| import { GET_TONE } from '../actions/index';
export default function (state = [], action) {
switch (action.type) {
case GET_TONE:
if (action.payload.status === 200) {
return action.payload.data;
}
return state;
default:
return state;
}
}
| Add conditional to tone reducer | Add conditional to tone reducer
| JavaScript | mit | badT/Chatson,badT/twitchBot,dramich/twitchBot,dramich/Chatson,dramich/Chatson,TerryCapan/twitchBot,TerryCapan/twitchBot,dramich/twitchBot,badT/Chatson,badT/twitchBot | ---
+++
@@ -3,8 +3,10 @@
export default function (state = [], action) {
switch (action.type) {
case GET_TONE:
- return action.payload.data;
-
+ if (action.payload.status === 200) {
+ return action.payload.data;
+ }
+ return state;
default:
return state;
} |
a44798bff6aae4b6436ed15c62af5d4f700b6552 | website/mcapp.projects/src/app/project/experiments/experiment/components/processes/mc-workflow-process-templates.component.js | website/mcapp.projects/src/app/project/experiments/experiment/components/processes/mc-workflow-process-templates.component.js | class MCWorkflowProcessTemplatesComponentController {
/*@ngInit*/
constructor(templates) {
this.templates = templates.get();
this.templateTypes = [
{
title: 'CREATE SAMPLES',
cssClass: 'mc-create-samples-color',
icon: 'fa-cubes',
margin: true,
templates: this.templates.filter(t => t.process_type === 'create' && t.name === 'Create Samples')
},
{
title: 'TRANSFORMATION',
cssClass: 'mc-transform-color',
icon: 'fa-exclamation-triangle',
templates: this.templates.filter(t => t.process_type === 'transform' && t.name !== 'Create Samples')
},
{
title: 'MEASUREMENT',
cssClass: 'mc-measurement-color',
icon: 'fa-circle',
templates: this.templates.filter(t => t.process_type === 'measurement')
},
{
title: 'ANALYSIS',
cssClass: 'mc-analysis-color',
icon: 'fa-square',
templates: this.templates.filter(t => t.process_type === 'analysis')
}
];
}
chooseTemplate(t) {
if (this.onSelected) {
this.onSelected({templateId: t.name, processId: ''});
}
}
}
angular.module('materialscommons').component('mcWorkflowProcessTemplates', {
templateUrl: 'app/project/experiments/experiment/components/processes/mc-workflow-process-templates.html',
controller: MCWorkflowProcessTemplatesComponentController,
bindings: {
onSelected: '&'
}
});
| class MCWorkflowProcessTemplatesComponentController {
/*@ngInit*/
constructor(templates) {
this.templates = templates.get();
this.templateTypes = [
{
title: 'CREATE SAMPLES',
cssClass: 'mc-create-samples-color',
icon: 'fa-cubes',
margin: true,
templates: this.templates.filter(t => t.process_type === 'create')
},
{
title: 'TRANSFORMATION',
cssClass: 'mc-transform-color',
icon: 'fa-exclamation-triangle',
templates: this.templates.filter(t => t.process_type === 'transform')
},
{
title: 'MEASUREMENT',
cssClass: 'mc-measurement-color',
icon: 'fa-circle',
templates: this.templates.filter(t => t.process_type === 'measurement')
},
{
title: 'ANALYSIS',
cssClass: 'mc-analysis-color',
icon: 'fa-square',
templates: this.templates.filter(t => t.process_type === 'analysis')
}
];
}
chooseTemplate(t) {
if (this.onSelected) {
this.onSelected({templateId: t.name, processId: ''});
}
}
}
angular.module('materialscommons').component('mcWorkflowProcessTemplates', {
templateUrl: 'app/project/experiments/experiment/components/processes/mc-workflow-process-templates.html',
controller: MCWorkflowProcessTemplatesComponentController,
bindings: {
onSelected: '&'
}
});
| Modify filter to show new computational sample templates. | Modify filter to show new computational sample templates.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -8,13 +8,13 @@
cssClass: 'mc-create-samples-color',
icon: 'fa-cubes',
margin: true,
- templates: this.templates.filter(t => t.process_type === 'create' && t.name === 'Create Samples')
+ templates: this.templates.filter(t => t.process_type === 'create')
},
{
title: 'TRANSFORMATION',
cssClass: 'mc-transform-color',
icon: 'fa-exclamation-triangle',
- templates: this.templates.filter(t => t.process_type === 'transform' && t.name !== 'Create Samples')
+ templates: this.templates.filter(t => t.process_type === 'transform')
},
{
title: 'MEASUREMENT', |
b8a79dd951253822bcfe1f48f6eb7f351d457f02 | IPython/html/static/notebook/js/widgets/button.js | IPython/html/static/notebook/js/widgets/button.js | //----------------------------------------------------------------------------
// Copyright (C) 2013 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// ButtonWidget
//============================================================================
/**
* @module IPython
* @namespace IPython
**/
define(["notebook/js/widget"], function(widget_manager){
var ButtonWidgetModel = IPython.WidgetModel.extend({});
widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel);
var ButtonView = IPython.WidgetView.extend({
// Called when view is rendered.
render : function(){
var that = this;
this.$el = $("<button />")
.addClass('btn')
.click(function() {
that.model.set('clicks', that.model.get('clicks') + 1);
that.model.update_other_views(that);
});
this._ensureElement();
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
var description = this.model.get('description');
description = description.replace(/ /g, ' ', 'm');
description = description.replace(/\n/g, '<br>\n', 'm');
if (description.length == 0) {
this.$el.html(' '); // Preserve button height
} else {
this.$el.html(description);
}
return IPython.WidgetView.prototype.update.call(this);
},
});
widget_manager.register_widget_view('ButtonView', ButtonView);
});
| //----------------------------------------------------------------------------
// Copyright (C) 2013 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// ButtonWidget
//============================================================================
/**
* @module IPython
* @namespace IPython
**/
define(["notebook/js/widget"], function(widget_manager){
var ButtonWidgetModel = IPython.WidgetModel.extend({});
widget_manager.register_widget_model('ButtonWidgetModel', ButtonWidgetModel);
var ButtonView = IPython.WidgetView.extend({
// Called when view is rendered.
render : function(){
var that = this;
this.setElement($("<button />")
.addClass('btn')
.click(function() {
that.model.set('clicks', that.model.get('clicks') + 1);
that.model.update_other_views(that);
}));
this.update(); // Set defaults.
},
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
var description = this.model.get('description');
description = description.replace(/ /g, ' ', 'm');
description = description.replace(/\n/g, '<br>\n', 'm');
if (description.length == 0) {
this.$el.html(' '); // Preserve button height
} else {
this.$el.html(description);
}
return IPython.WidgetView.prototype.update.call(this);
},
});
widget_manager.register_widget_view('ButtonView', ButtonView);
});
| Use setElement to set the view's element properly. | Use setElement to set the view's element properly.
| JavaScript | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -24,13 +24,12 @@
// Called when view is rendered.
render : function(){
var that = this;
- this.$el = $("<button />")
+ this.setElement($("<button />")
.addClass('btn')
.click(function() {
that.model.set('clicks', that.model.get('clicks') + 1);
that.model.update_other_views(that);
- });
- this._ensureElement();
+ }));
this.update(); // Set defaults.
}, |
a773fb3910892ce18e9566f849a8ab3069367c0d | app/templates/_main.js | app/templates/_main.js | import Vue from 'vue';
import app from './App';<% if (extraConfig.isUseVueRouter) { %>
import VueRouter from 'vue-router';
import { configRouter } from './route';<% } %>
<% if (extraConfig.isUseVueRouter) { %>
Vue.use(VueRouter);
const App = Vue.extend(app);
const router = new VueRouter();
configRouter(router);
router.start(App, 'app');
<% } else { %>
const App = new Vue({
el: 'body',
components: {
app
}
});
<% } %>
Vue.config.debug = process.env.NODE_ENV !== 'production';
| import Vue from 'vue';
import app from './App';<% if (extraConfig.isUseVueRouter) { %>
import VueRouter from 'vue-router';
import { configRouter } from './route';<% } %>
<% if (extraConfig.isUseVueRouter) { %>
Vue.use(VueRouter);
const App = Vue.extend(app);
const router = new VueRouter();
configRouter(router);
router.start(App, 'app');
<% } else { %>
const App = new Vue({
el: 'body',
components: {
app,
},
});
<% } %>
Vue.config.debug = process.env.NODE_ENV !== 'production';
| Fix code style error in main.js | Fix code style error in main.js
| JavaScript | mit | PeachScript/generator-abstack-vuejs,PeachScript/generator-abstack-vuejs | ---
+++
@@ -14,8 +14,8 @@
const App = new Vue({
el: 'body',
components: {
- app
- }
+ app,
+ },
});
<% } %>
Vue.config.debug = process.env.NODE_ENV !== 'production'; |
9fc6057d0c29a21ea40284a13ad4af79251cde10 | app/assets/javascripts/koi/controllers/application.js | app/assets/javascripts/koi/controllers/application.js | import { Application } from "@hotwired/stimulus"
// Stimulus controllers. This should ultimately be moved to koi/admin.js
import "@hotwired/turbo-rails"
import "trix";
import "@rails/actiontext";
const application = Application.start()
window.Stimulus = application
export { application }
| import { Application } from "@hotwired/stimulus"
// Stimulus controllers. This should ultimately be moved to koi/admin.js
import "@hotwired/turbo-rails"
import "@rails/actiontext";
const application = Application.start()
window.Stimulus = application
export { application }
| Move trix dependency to content gem | FRIN23-19: Move trix dependency to content gem
| JavaScript | mit | katalyst/koi,katalyst/koi,katalyst/koi | ---
+++
@@ -2,7 +2,6 @@
// Stimulus controllers. This should ultimately be moved to koi/admin.js
import "@hotwired/turbo-rails"
-import "trix";
import "@rails/actiontext";
const application = Application.start() |
ca78cd4901e2322a5f63fcd4c0f555b5c553dde9 | assets/js/functions.js | assets/js/functions.js | $(document).ready(function () {
attachResizeVideo();
switchAd();
});
function attachResizeVideo() {
$(window).resize(function () {
resizeVideo();
});
resizeVideo();
}
function resizeVideo() {
console.log("fired");
var $ytplayer = $('#ytplayer');
var $parent = $ytplayer.parent();
var newWidth = $parent.width() - 40;
var aspectRatio = $ytplayer.get(0).height / $ytplayer.get(0).width;
console.log(aspectRatio);
$ytplayer
.width(newWidth)
.height(newWidth * aspectRatio);
}
function switchAd() {
setInterval(function () {
console.log('update');
var $ads = $('.advertisement-wrapper');
var len = $ads.length;
var $curAd = $ads.filter('.active');
$curAd.removeClass('active');
console.log($ads.index($curAd));
if ($ads.index($curAd) < len - 1) {
$curAd.next().addClass('active');
} else {
$ads.first().addClass('active');
}
}, 10000);
} | $(document).ready(function () {
attachResizeVideo();
switchAd();
});
function attachResizeVideo() {
$(window).resize(function () {
resizeVideo();
});
resizeVideo();
}
function resizeVideo() {
console.log("fired");
var $ytplayer = $('#ytplayer');
var $parent = $ytplayer.parent();
var newHeight = $parent.height();
var aspectRatio = $ytplayer.get(0).height / $ytplayer.get(0).width;
console.log(aspectRatio);
$ytplayer
.height(newHeight)
.width(newHeight / aspectRatio);
if ($ytplayer.width() > $parent.width()) {
console.log('correction');
var newWidth = $parent.width();
$ytplayer
.height(newWidth * aspectRatio)
.width(newWidth);
}
}
function switchAd() {
setInterval(function () {
console.log('update');
var $ads = $('.advertisement-wrapper');
var len = $ads.length;
var $curAd = $ads.filter('.active');
$curAd.removeClass('active');
console.log($ads.index($curAd));
if ($ads.index($curAd) < len - 1) {
$curAd.next().addClass('active');
} else {
$ads.first().addClass('active');
}
}, 10000);
} | Add width checking to video javascript. | Add width checking to video javascript.
| JavaScript | unlicense | LiteracyFanatic/TruckAdvertisements,LiteracyFanatic/TruckAdvertisements | ---
+++
@@ -20,18 +20,28 @@
var $parent = $ytplayer.parent();
- var newWidth = $parent.width() - 40;
+ var newHeight = $parent.height();
var aspectRatio = $ytplayer.get(0).height / $ytplayer.get(0).width;
console.log(aspectRatio);
$ytplayer
- .width(newWidth)
- .height(newWidth * aspectRatio);
+ .height(newHeight)
+ .width(newHeight / aspectRatio);
+
+ if ($ytplayer.width() > $parent.width()) {
+ console.log('correction');
+
+ var newWidth = $parent.width();
+
+ $ytplayer
+ .height(newWidth * aspectRatio)
+ .width(newWidth);
+ }
}
-function switchAd() {
+function switchAd() {
setInterval(function () {
console.log('update'); |
b15abeabe4b0b395485cb8754e05732c9de4953d | test/integration/server/test_bunyan.js | test/integration/server/test_bunyan.js |
'use strict';
var path = require('path');
var expect = require('thehelp-test').expect;
var util = require('./util');
describe('bunyan', function() {
var child;
before(function(done) {
this.timeout(10000);
util.setupScenario('bunyan', function(err) {
if (err) {
throw err;
}
child = util.startProcess(
path.join(__dirname, '../../scenarios/bunyan/go.js'));
child.on('close', function() {
done();
});
});
});
after(function(done) {
util.cleanupScenario('bunyan', done);
});
it('does not log verbose by default', function() {
expect(child.stdoutResult).not.to.match(/default verbose text/);
});
it('should have logged info', function() {
expect(child.stdoutResult).to.match(/info text { data: { yes:/);
});
it('should have logged warn and printed out the supplied callback', function() {
expect(child.stdoutResult).to.match(/warn text/);
expect(child.stdoutResult).to.match(/jshint unused/);
});
it('should have logged error', function() {
expect(child.stdoutResult).to.match(/error interpolation/);
});
it('logs custom verbose level', function() {
expect(child.stdoutResult).to.match(/custom verbose text/);
});
});
|
'use strict';
var path = require('path');
var expect = require('thehelp-test').expect;
var util = require('./util');
describe('bunyan', function() {
var child;
before(function(done) {
this.timeout(30000);
util.setupScenario('bunyan', function(err) {
if (err) {
throw err;
}
child = util.startProcess(
path.join(__dirname, '../../scenarios/bunyan/go.js'));
child.on('close', function() {
done();
});
});
});
after(function(done) {
util.cleanupScenario('bunyan', done);
});
it('does not log verbose by default', function() {
expect(child.stdoutResult).not.to.match(/default verbose text/);
});
it('should have logged info', function() {
expect(child.stdoutResult).to.match(/info text { data: { yes:/);
});
it('should have logged warn and printed out the supplied callback', function() {
expect(child.stdoutResult).to.match(/warn text/);
expect(child.stdoutResult).to.match(/jshint unused/);
});
it('should have logged error', function() {
expect(child.stdoutResult).to.match(/error interpolation/);
});
it('logs custom verbose level', function() {
expect(child.stdoutResult).to.match(/custom verbose text/);
});
});
| Increase timeout for bunyan test | Increase timeout for bunyan test
Build can sometimes take a long time… | JavaScript | mit | thehelp/log-shim | ---
+++
@@ -12,7 +12,7 @@
var child;
before(function(done) {
- this.timeout(10000);
+ this.timeout(30000);
util.setupScenario('bunyan', function(err) {
if (err) { |
b5750d7cb92e99e8eb2fb6e419336d2e5a96c521 | server/api/controllers/utils/utilsCtrl.spec.js | server/api/controllers/utils/utilsCtrl.spec.js | 'use strict';
var should = require('should');
var utils = require('./utilsCtrl.js');
describe('utilsCtrl tests', function() {
it('should find list with some id', function(done) {
var lists = {
listContainer1: [ {id: 'idlist1'}, {id: 'idlist2'}, {id: 'idlist3'} ],
listContainer2: [ {id: 'idlist4'}, {id: 'idlist5'}, {id: 'idlist6'} ],
listContainer3: [ {id: 'idlist7'}, {id: 'idlist8'}, {id: 'idlist9'} ]
};
var successSearch = utils.searchList('idlist8', lists);
var falseSearch = utils.searchList('idlist10', lists);
should(successSearch).be.ok();
should(falseSearch).not.be.ok();
done();
});
it('should get diff of dates', function(done) {
var dateDiff = utils.getDateDiff('2016-01-08', '2016-01-10');
should(dateDiff).be.eql(172800000);
done();
});
});
| 'use strict';
var should = require('should');
var utils = require('./utilsCtrl.js');
describe('utils module tests', function() {
it('should find list with some id', function(done) {
var lists = {
listContainer1: [ {id: 'idlist1'}, {id: 'idlist2'}, {id: 'idlist3'} ],
listContainer2: [ {id: 'idlist4'}, {id: 'idlist5'}, {id: 'idlist6'} ],
listContainer3: [ {id: 'idlist7'}, {id: 'idlist8'}, {id: 'idlist9'} ]
};
var successSearch = utils.searchList('idlist8', lists);
var falseSearch = utils.searchList('idlist10', lists);
should(successSearch).be.ok();
should(falseSearch).not.be.ok();
done();
});
it('should get diff of dates', function(done) {
var dateDiff = utils.getDateDiff('2016-01-08', '2016-01-10');
should(dateDiff).be.eql(172800000);
done();
});
it('should convert unix date to human readable date', function(done) {
var unixDate = 172800000;
var humanReadable = utils.getHumanReadableTime(unixDate);
should(humanReadable).have.property('time');
should(humanReadable).have.property('format');
should(humanReadable.time).be.eql(2);
should(humanReadable.format).be.eql('days');
done();
});
});
| Add automatic test for utils | Add automatic test for utils
| JavaScript | mit | safv12/trello-metrics,safv12/trello-metrics | ---
+++
@@ -3,7 +3,7 @@
var should = require('should');
var utils = require('./utilsCtrl.js');
-describe('utilsCtrl tests', function() {
+describe('utils module tests', function() {
it('should find list with some id', function(done) {
@@ -28,4 +28,18 @@
should(dateDiff).be.eql(172800000);
done();
});
+
+
+ it('should convert unix date to human readable date', function(done) {
+ var unixDate = 172800000;
+
+ var humanReadable = utils.getHumanReadableTime(unixDate);
+
+ should(humanReadable).have.property('time');
+ should(humanReadable).have.property('format');
+ should(humanReadable.time).be.eql(2);
+ should(humanReadable.format).be.eql('days');
+
+ done();
+ });
}); |
9b53d4814b4170dd3e502e459e2a145ff3eec779 | app/operation/operation.js | app/operation/operation.js | 'use strict';
angular.module('myApp.operation', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/operation', {
templateUrl: 'operation/operation.html',
controller: 'OperationController'
});
}])
.controller('OperationController', ['$scope', '$rootScope', function($scope, $rootScope) {
$rootScope.menu = {
home: false,
operation: true,
contact: false
};
}]);
| 'use strict';
angular.module('myApp.operation', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/operation', {
templateUrl: 'operation/operation.html',
controller: 'OperationController'
});
}])
.controller('OperationController', ['$scope', '$rootScope', function($scope, $rootScope) {
$rootScope.menu = {
home: false,
operation: true,
contact: false
};
$scope.typeOperation = 'rent';
}]);
| Set typeOperation for default to select option | Set typeOperation for default to select option
| JavaScript | mit | AitorRodriguez990/angular-testing-examples,AitorRodriguez990/angular-testing-examples | ---
+++
@@ -15,4 +15,6 @@
operation: true,
contact: false
};
+
+ $scope.typeOperation = 'rent';
}]); |
e45662e92bee7e48ef2df981d0b6322f7522b463 | app/scripts/src/request.js | app/scripts/src/request.js | 'use strict';
var Settings = require('./settings.js');
var ChromeStorage = require('./chrome-storage.js');
function Request() {};
Request._send = function _send(options, accessToken) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('trakt-api-key', Settings.clientId);
xhr.setRequestHeader('trakt-api-version', Settings.apiVersion);
xhr.timeout = 4000; // increase the timeout for trakt.tv calls
if (accessToken) {
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
}
xhr.onload = function() {
if (this.status >= 200 && this.status < 400) {
options.success.call(this, this.response);
} else {
options.error.call(this, this.status, this.responseText);
}
};
xhr.onerror = options.error;
xhr.send(JSON.stringify(options.params));
};
Request.send = function send(options) {
ChromeStorage.get('access_token', function(data) {
Request._send(options, data.access_token);
}.bind(this));
};
module.exports = Request;
| 'use strict';
var Settings = require('./settings.js');
var ChromeStorage = require('./chrome-storage.js');
function Request() {};
Request._send = function _send(options, accessToken) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, options.url, true);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('trakt-api-key', Settings.clientId);
xhr.setRequestHeader('trakt-api-version', Settings.apiVersion);
xhr.timeout = 10000; // increase the timeout for trakt.tv calls
if (accessToken) {
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
}
xhr.onload = function() {
if (this.status >= 200 && this.status < 400) {
options.success.call(this, this.response);
} else {
options.error.call(this, this.status, this.responseText);
}
};
xhr.onerror = options.error;
xhr.send(JSON.stringify(options.params));
};
Request.send = function send(options) {
ChromeStorage.get('access_token', function(data) {
Request._send(options, data.access_token);
}.bind(this));
};
module.exports = Request;
| Increase timeout for trakt.tv API calls | Increase timeout for trakt.tv API calls
| JavaScript | mit | tegon/traktflix,MrMamen/traktflix,MrMamen/traktflix,tegon/traktflix | ---
+++
@@ -12,7 +12,7 @@
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('trakt-api-key', Settings.clientId);
xhr.setRequestHeader('trakt-api-version', Settings.apiVersion);
- xhr.timeout = 4000; // increase the timeout for trakt.tv calls
+ xhr.timeout = 10000; // increase the timeout for trakt.tv calls
if (accessToken) {
xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken); |
10d041569a0b19dee2024001f7aae310ddd89dca | tests/unit/components/compiler-test.js | tests/unit/components/compiler-test.js | import hbs from 'htmlbars-inline-precompile';
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('my-component', {
integration: true
});
test('precompile enabled flags', function(assert) {
this.render(hbs`
{{#if-flag-ENABLE_FOO}}Foo{{/if-flag-ENABLE_FOO}}
`);
assert.equal(this.$().text().trim(), 'Foo');
});
test('precompile disabled flags', function(assert) {
this.render(hbs`
{{#if-flag-ENABLE_BAR}}Bar{{/if-flag-ENABLE_BAR}}
`);
assert.equal(this.$().text().trim(), '');
});
| import hbs from 'htmlbars-inline-precompile';
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('my-component', {
integration: true
});
test('precompile enabled flags', function(assert) {
this.render(hbs`
{{#if-flag-ENABLE_FOO}}Foo{{/if-flag-ENABLE_FOO}}
`);
assert.equal(this.$().text().trim(), 'Foo');
});
test('precompile disabled flags', function(assert) {
this.render(hbs`
{{#if-flag-ENABLE_BAR}}Bar{{/if-flag-ENABLE_BAR}}
`);
assert.equal(this.$().text().trim(), '');
});
test('precompile else block', function(assert) {
this.render(hbs`
{{#if-flag-ENABLE_BAR}}Bar{{else}}Baz{{/if-flag-ENABLE_BAR}}
`);
assert.equal(this.$().text().trim(), 'Baz');
});
| Add test for {{else}} block | Add test for {{else}} block
| JavaScript | mit | minichate/ember-cli-conditional-compile,minichate/ember-cli-conditional-compile | ---
+++
@@ -20,3 +20,11 @@
assert.equal(this.$().text().trim(), '');
});
+
+test('precompile else block', function(assert) {
+ this.render(hbs`
+ {{#if-flag-ENABLE_BAR}}Bar{{else}}Baz{{/if-flag-ENABLE_BAR}}
+ `);
+
+ assert.equal(this.$().text().trim(), 'Baz');
+}); |
01d5c7a264f47306646e04cabab5d5e08ec76d20 | template/share/spice/example/example.js | template/share/spice/example/example.js | (function (env) {
"use strict";
env.ddg_spice_<: $lia_name :> = function(api_result){
// Validate the response (customize for your Spice)
if (api_result.error) {
return Spice.failed('<: $lia_name :>');
}
// Render the response
Spice.add({
id: "<: $lia_name :>",
// Customize these properties
name: "AnswerBar title",
data: api_result,
meta: {
sourceName: "Example.com",
sourceUrl: 'http://example.com/url/to/details/' + api_result.name
},
templates: {
group: 'your-template-group',
options: {
content: Spice.<: $lia_name :>.content,
moreAt: true
}
}
});
};
}(this));
| (function (env) {
"use strict";
env.ddg_spice_<: $lia_name :> = function(api_result){
// Validate the response (customize for your Spice)
if (api_result.error) {
return Spice.failed('<: $lia_name :>');
}
// Render the response
Spice.add({
id: "<: $lia_name :>",
// Customize these properties
name: "AnswerBar title",
data: api_result,
meta: {
sourceName: "Example.com",
sourceUrl: 'http://<: $ia_domain :>/details/' + api_result.name
},
templates: {
group: '<: $ia_group :>',
options: {
content: Spice.<: $lia_name :>.content,
moreAt: true
}
<: $ia_rel :>
});
};
}(this));
| Add new placeholders to Example.js | Add new placeholders to Example.js | JavaScript | apache-2.0 | shyamalschandra/zeroclickinfo-spice,P71/zeroclickinfo-spice,soleo/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,imwally/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,stennie/zeroclickinfo-spice,echosa/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,echosa/zeroclickinfo-spice,sevki/zeroclickinfo-spice,soleo/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,mayo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,lernae/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,ppant/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,stennie/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,loganom/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,levaly/zeroclickinfo-spice,loganom/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,sevki/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,imwally/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,levaly/zeroclickinfo-spice,imwally/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,ppant/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,sevki/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,deserted/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,stennie/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,soleo/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,lernae/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,lerna/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,deserted/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,P71/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,lernae/zeroclickinfo-spice,levaly/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,echosa/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,mayo/zeroclickinfo-spice,P71/zeroclickinfo-spice,loganom/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,imwally/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,loganom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,lernae/zeroclickinfo-spice,ppant/zeroclickinfo-spice,soleo/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,lerna/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,sevki/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,imwally/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,lerna/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,P71/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,echosa/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,deserted/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,lerna/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,deserted/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,deserted/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,soleo/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,lernae/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,stennie/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,levaly/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,levaly/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,soleo/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,echosa/zeroclickinfo-spice,deserted/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,levaly/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,ppant/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,mayo/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice | ---
+++
@@ -16,15 +16,15 @@
data: api_result,
meta: {
sourceName: "Example.com",
- sourceUrl: 'http://example.com/url/to/details/' + api_result.name
+ sourceUrl: 'http://<: $ia_domain :>/details/' + api_result.name
},
templates: {
- group: 'your-template-group',
+ group: '<: $ia_group :>',
options: {
content: Spice.<: $lia_name :>.content,
moreAt: true
}
- }
+ <: $ia_rel :>
});
};
}(this)); |
3febb3230f340f61103a3a93b8ca0623b57613d9 | .eslintrc.js | .eslintrc.js | const package = require('./package.json')
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:react/recommended',
'plugin:flowtype/recommended',
// suppress conflicted rules
'plugin:prettier/recommended',
'prettier/flowtype',
'prettier/react'
],
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true
},
sourceType: 'module'
},
plugins: ['flowtype'],
settings: {
react: {
version: package.dependencies.react
}
},
rules: {
'no-console': 'warn',
'flowtype/require-valid-file-annotation': ['warn', 'always'],
'react/no-deprecated': 'warn',
'react/prefer-stateless-function': 'error'
}
}
| const package = require('./package.json')
module.exports = {
parser: 'babel-eslint',
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:react/recommended',
'plugin:flowtype/recommended',
// suppress conflicted rules
'plugin:prettier/recommended',
'prettier/flowtype',
'prettier/react'
],
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true
},
sourceType: 'module'
},
plugins: [],
settings: {
react: {
version: package.dependencies.react
}
},
rules: {
'no-console': 'warn',
'flowtype/require-valid-file-annotation': ['warn', 'always'],
'react/no-deprecated': 'warn',
'react/prefer-stateless-function': 'error'
}
}
| Remove unnecessary plugin using declaration | :shower: Remove unnecessary plugin using declaration
| JavaScript | mit | keik/gh,keik/gh,keik/gh | ---
+++
@@ -27,7 +27,7 @@
},
sourceType: 'module'
},
- plugins: ['flowtype'],
+ plugins: [],
settings: {
react: {
version: package.dependencies.react |
e5773320c3bd1b47c00388f9fda6d3ece8f0fb1c | .eslintrc.js | .eslintrc.js | module.exports = {
"env": {
"browser": true,
"node": true
},
"globals": {
"app": true,
"angular": true,
"_": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
};
| module.exports = {
"env": {
"browser": true,
"node": true
},
"globals": {
"app": true,
"angular": true,
"_": true
},
"extends": "eslint:recommended",
"rules": {
"no-console": [
"error", { allow: ["log", "warn", "error"] }
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
};
| Allow console log warn error | Allow console log warn error
| JavaScript | mit | FreaKzero/gzdoom-launcher,FreaKzero/gzdoom-launcher | ---
+++
@@ -12,6 +12,10 @@
"extends": "eslint:recommended",
"rules": {
+
+ "no-console": [
+ "error", { allow: ["log", "warn", "error"] }
+ ],
"indent": [
"error",
2 |
7551cdf761228536485caaa838b106092050d300 | .eslintrc.js | .eslintrc.js | module.exports = {
"env": {
"browser": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"globals": {
"$": true,
"it": true,
"describe": true,
"beforeEach": true,
"chai": true,
"jQuery": true,
"chrome": true,
"modal": true,
"modalTimeout": true,
"modalHTML": true,
"Modal": true,
"flashInterval": true,
"currentScript": true
}
};
| module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"globals": {
"$": true,
"it": true,
"describe": true,
"beforeEach": true,
"chai": true,
"jQuery": true,
"chrome": true,
"modal": true,
"modalTimeout": true,
"modalHTML": true,
"Modal": true,
"flashInterval": true,
"currentScript": true
}
};
| Allow eslint to use node and es6 | Allow eslint to use node and es6
| JavaScript | mit | albertyw/gentle-alerts,albertyw/gentle-alerts | ---
+++
@@ -1,6 +1,8 @@
module.exports = {
"env": {
- "browser": true
+ "browser": true,
+ "es6": true,
+ "node": true
},
"extends": "eslint:recommended",
"rules": { |
6a0a7cf7e91b7d9e216d58230c3ef87b5a5af305 | static/js/logs-screen.js | static/js/logs-screen.js | /**
* Logs Screen
*
* Shows all logs
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
const Log = require('./logs/log');
const LogsScreen = {
init: function() {
this.view = document.getElementById('logs-view');
this.logsContainer = this.view.querySelector('.logs');
this.logs = [
new Log('virtual-things-2', 'level'),
new Log('weather-8b8f279cfcc42b05f2b3cdfd4b0c7f9c5eac5b18',
'temperature'),
new Log('philips-hue-001788fffe4f2113-sensors-2',
'temperature'),
];
this.onWindowResize = this.onWindowResize.bind(this);
window.addEventListener('resize', this.onWindowResize);
this.onWindowResize();
},
show: function() {
this.logsContainer.innerHTML = '';
this.logs.forEach((log) => {
log.reload();
this.logsContainer.appendChild(log.elt);
});
},
onWindowResize: function() {
},
};
module.exports = LogsScreen;
| /**
* Logs Screen
*
* Shows all logs
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
const Log = require('./logs/log');
const LogsScreen = {
init: function() {
this.view = document.getElementById('logs-view');
this.logsContainer = this.view.querySelector('.logs');
this.logs = [
new Log('virtual-things-2', 'level'),
new Log('virtual-things-2', 'on'),
new Log('weather-8b8f279cfcc42b05f2b3cdfd4b0c7f9c5eac5b18',
'temperature'),
new Log('philips-hue-001788fffe4f2113-sensors-2',
'temperature'),
];
this.onWindowResize = this.onWindowResize.bind(this);
window.addEventListener('resize', this.onWindowResize);
this.onWindowResize();
},
show: function() {
this.logsContainer.innerHTML = '';
this.logs.forEach((log) => {
log.reload();
this.logsContainer.appendChild(log.elt);
});
},
onWindowResize: function() {
},
};
module.exports = LogsScreen;
| Add graph of boolean property | Add graph of boolean property
| JavaScript | mpl-2.0 | moziot/gateway,mozilla-iot/gateway,mozilla-iot/gateway,moziot/gateway,mozilla-iot/gateway,moziot/gateway,mozilla-iot/gateway,mozilla-iot/gateway | ---
+++
@@ -17,6 +17,7 @@
this.logsContainer = this.view.querySelector('.logs');
this.logs = [
new Log('virtual-things-2', 'level'),
+ new Log('virtual-things-2', 'on'),
new Log('weather-8b8f279cfcc42b05f2b3cdfd4b0c7f9c5eac5b18',
'temperature'),
new Log('philips-hue-001788fffe4f2113-sensors-2', |
508f54ba5774bc2a3a6597cb709fa67ad0632a8b | lib/livereload.js | lib/livereload.js | 'use strict';
// socket.io-client requires the window object, and navigator.userAgent to be present.
var window = {},
navigator = {userAgent: 'tvos'};
var io = require('socket.io-client');
/*
import * as router from 'lib/router';
*/
function resume(lastLocation) {
if (!lastLocation) {
return;
}
//router.goTo(lastLocation);
}
function logDebug(msg) {
if (console && console.debug) {
console.debug(msg);
}
}
module.exports = {
connect: function (connectURL, app, launchOptions) {
var socket = io(connectURL);
socket.on('connect', function () {
logDebug('Live reload: connected');
});
socket.on('compile', function () {
logDebug('Live reload: compiling, prepare for reload');
});
// reload app on reload event
socket.on('live-reload', function () {
app.reload()//{when: 'now'}, {
//lastLocation: router.getLocation()
//});
});
if (launchOptions.reloadData) {
resume(launchOptions.reloadData || {});
}
}
};
| 'use strict';
// socket.io-client requires the window object, and navigator.userAgent to be present.
var window = global;
window.navigator = {userAgent: 'tvos'};
var io = require('socket.io-client');
function resume(lastLocation) {
if (!lastLocation) {
return;
}
}
function logDebug(msg) {
if (console && console.debug) {
console.debug(msg);
}
}
module.exports = {
connect: function (connectURL, app, launchOptions) {
var socket = io(connectURL);
socket.on('connect', function () {
logDebug('Live reload: connected');
});
socket.on('compile', function () {
logDebug('Live reload: compiling, prepare for reload');
});
// reload app on reload event
socket.on('live-reload', function () {
app.reload();
});
if (launchOptions && launchOptions.reloadData) {
resume(launchOptions.reloadData || {});
}
}
};
| Fix reload errors with latest tvOS | Fix reload errors with latest tvOS
| JavaScript | mit | hypery2k/tvml-kit-livereload | ---
+++
@@ -1,21 +1,15 @@
'use strict';
// socket.io-client requires the window object, and navigator.userAgent to be present.
-var window = {},
- navigator = {userAgent: 'tvos'};
+var window = global;
+window.navigator = {userAgent: 'tvos'};
var io = require('socket.io-client');
-
-/*
- import * as router from 'lib/router';
- */
function resume(lastLocation) {
if (!lastLocation) {
return;
}
-
- //router.goTo(lastLocation);
}
function logDebug(msg) {
@@ -37,12 +31,10 @@
// reload app on reload event
socket.on('live-reload', function () {
- app.reload()//{when: 'now'}, {
- //lastLocation: router.getLocation()
- //});
+ app.reload();
});
- if (launchOptions.reloadData) {
+ if (launchOptions && launchOptions.reloadData) {
resume(launchOptions.reloadData || {});
}
|
a588182dfe07bee8c74ccf9c3ae9e3e6e572652a | lib/logFactory.js | lib/logFactory.js | var LogStream = require('./LogStream');
var lodash = require('lodash');
/**
* The LogFactory constructor.
* @constructor
*/
var LogFactory = function () {
var self = this;
self._streams = {};
self._filters = [];
};
/**
* Create a new LogStream.
* @param name The name of the component originating the logs.
* @returns {LogStream}
*/
LogFactory.prototype.create = function (name) {
var self = this;
self._streams[name] = new LogStream(name);
self._streams[name].on('error', function (error) {
self.streams['BeagleDrone.server.LogFactory'].error(error);
});
return self._streams[name];
};
/**
* Connect all loggers to an output stream.
*
* Example:
* logFactory.pipe(process.stdout)
*
* @param outputStream A node stream.Writable that will accept all log events.
*/
LogFactory.prototype.pipe = function (outputStream) {
var self = this;
lodash.forEach(self._streams, function (stream) {
stream.pipe(outputStream, {
end: false
});
});
};
// It's a single instance.
module.exports = new LogFactory(); | var LogStream = require('./LogStream');
var lodash = require('lodash');
/**
* The LogFactory constructor.
* @constructor
*/
var LogFactory = function () {
var self = this;
self._inputs = {};
self._outputs = [];
};
/**
* Create a new LogStream.
* @param name The name of the component originating the logs.
* @returns {LogStream}
*/
LogFactory.prototype.create = function (name) {
var self = this;
self._inputs[name] = new LogStream(name);
lodash.forEach(self._outputs, function (outputStream) {
self._inputs[name].pipe(outputStream);
});
return self._inputs[name];
};
/**
* Connect all loggers to an output stream.
*
* Example:
* logFactory.pipe(process.stdout)
*
* @param outputStream A node stream.Writable that will accept all log events.
*/
LogFactory.prototype.pipe = function (outputStream) {
var self = this;
self._outputs.push(outputStream);
lodash.forEach(self._inputs, function (stream) {
stream.pipe(outputStream, {
end: false
});
});
};
// It's a single instance.
module.exports = new LogFactory(); | Fix a race condition when adding output streams before all input streams are added. | Fix a race condition when adding output streams before all input streams are added.
| JavaScript | mit | ericrini/node-streamlogger | ---
+++
@@ -7,8 +7,8 @@
*/
var LogFactory = function () {
var self = this;
- self._streams = {};
- self._filters = [];
+ self._inputs = {};
+ self._outputs = [];
};
/**
@@ -18,11 +18,11 @@
*/
LogFactory.prototype.create = function (name) {
var self = this;
- self._streams[name] = new LogStream(name);
- self._streams[name].on('error', function (error) {
- self.streams['BeagleDrone.server.LogFactory'].error(error);
+ self._inputs[name] = new LogStream(name);
+ lodash.forEach(self._outputs, function (outputStream) {
+ self._inputs[name].pipe(outputStream);
});
- return self._streams[name];
+ return self._inputs[name];
};
/**
@@ -35,7 +35,8 @@
*/
LogFactory.prototype.pipe = function (outputStream) {
var self = this;
- lodash.forEach(self._streams, function (stream) {
+ self._outputs.push(outputStream);
+ lodash.forEach(self._inputs, function (stream) {
stream.pipe(outputStream, {
end: false
}); |
f5bc7da306376fb34171ad2eb9f2869dbf68a35f | apps/baumeister_web/web/static/js/app.js | apps/baumeister_web/web/static/js/app.js | // Brunch automatically concatenates all files in your
// watched paths. Those paths can be configured at
// config.paths.watched in "brunch-config.js".
//
// However, those files will only be executed if
// explicitly imported. The only exception are files
// in vendor, which are never wrapped in imports and
// therefore are always executed.
// Import dependencies
//
// If you no longer want to use a dependency, remember
// to also remove its path from "config.paths.watched".
import "phoenix_html"
// Import local files
//
// Local files can be imported directly using relative
// paths "./socket" or full ones "web/static/js/socket".
// import socket from "./socket"
| // Brunch automatically concatenates all files in your
// watched paths. Those paths can be configured at
// config.paths.watched in "brunch-config.js".
//
// However, those files will only be executed if
// explicitly imported. The only exception are files
// in vendor, which are never wrapped in imports and
// therefore are always executed.
// Import dependencies
//
// If you no longer want to use a dependency, remember
// to also remove its path from "config.paths.watched".
import "phoenix_html"
// Import local files
//
// Local files can be imported directly using relative
// paths "./socket" or full ones "web/static/js/socket".
import socket from "./socket"
| Enable the web socket for channel transports | Enable the web socket for channel transports
| JavaScript | apache-2.0 | alfert/baumeister,alfert/baumeister,alfert/baumeister | ---
+++
@@ -18,4 +18,4 @@
// Local files can be imported directly using relative
// paths "./socket" or full ones "web/static/js/socket".
-// import socket from "./socket"
+import socket from "./socket" |
1dd9f0bc886a501ce015dfcf3bcbc947566641b4 | src/mui/button/SaveButton.js | src/mui/button/SaveButton.js | import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import ContentSave from 'material-ui/svg-icons/content/save';
const SaveButton = () => <RaisedButton
type="submit"
label="Save"
icon={<ContentSave />}
primary
style={{
margin: '10px 24px',
position: 'relative',
}}
/>;
export default SaveButton;
| import React, { Component } from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import ContentSave from 'material-ui/svg-icons/content/save';
import CircularProgress from 'material-ui/CircularProgress';
class SaveButton extends Component {
constructor(props) {
super(props);
this.state = {
submitting: false,
};
}
handleClick = (e) => {
if (this.state.submitting) {
// prevent double submission
e.preventDefault();
}
this.setState({ submitting: true });
}
render() {
return <RaisedButton
type="submit"
label="Save"
icon={this.state.submitting ? <CircularProgress size={25} thickness={2} /> : <ContentSave />}
onClick={this.handleClick}
primary={!this.state.submitting}
style={{
margin: '10px 24px',
position: 'relative',
}}
/>;
}
}
export default SaveButton;
| Add double submission protection in Save button | Add double submission protection in Save button
| JavaScript | mit | marmelab/admin-on-rest,matteolc/admin-on-rest,matteolc/admin-on-rest,marmelab/admin-on-rest | ---
+++
@@ -1,16 +1,37 @@
-import React from 'react';
+import React, { Component } from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import ContentSave from 'material-ui/svg-icons/content/save';
+import CircularProgress from 'material-ui/CircularProgress';
-const SaveButton = () => <RaisedButton
- type="submit"
- label="Save"
- icon={<ContentSave />}
- primary
- style={{
- margin: '10px 24px',
- position: 'relative',
- }}
-/>;
+class SaveButton extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ submitting: false,
+ };
+ }
+
+ handleClick = (e) => {
+ if (this.state.submitting) {
+ // prevent double submission
+ e.preventDefault();
+ }
+ this.setState({ submitting: true });
+ }
+
+ render() {
+ return <RaisedButton
+ type="submit"
+ label="Save"
+ icon={this.state.submitting ? <CircularProgress size={25} thickness={2} /> : <ContentSave />}
+ onClick={this.handleClick}
+ primary={!this.state.submitting}
+ style={{
+ margin: '10px 24px',
+ position: 'relative',
+ }}
+ />;
+ }
+}
export default SaveButton; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.