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 |
|---|---|---|---|---|---|---|---|---|---|---|
4bd2a3ccb73d9a2b8579a2fed42943548be51199 | sw-precache-config.js | sw-precache-config.js | /**
* https://github.com/GoogleChrome/sw-precache#command-line-interface
*/
module.exports = {
root: 'build',
staticFileGlobs: [
'build/javascripts/main.js',
'build/stylesheets/**.css',
'build/images/**/*.*',
],
stripPrefix: 'build/'
}
| /**
* https://github.com/GoogleChrome/sw-precache#command-line-interface
*/
module.exports = {
root: 'build',
swFile: 'sw-precache.js',
staticFileGlobs: [
'build/javascripts/main.js',
'build/stylesheets/**.css',
'build/images/**/*.*',
],
stripPrefix: 'build/'
}
| Rename service-worker.js -> sw-precache.js for other worker names | feat: Rename service-worker.js -> sw-precache.js for other worker names
| JavaScript | mit | Leko/WEB-EGG,Leko/WEB-EGG,Leko/WEB-EGG | ---
+++
@@ -3,6 +3,7 @@
*/
module.exports = {
root: 'build',
+ swFile: 'sw-precache.js',
staticFileGlobs: [
'build/javascripts/main.js',
'build/stylesheets/**.css', |
f74253045897f209768c7490d3b68c8b4488a623 | client/app/pages/admin/outdated-queries/index.js | client/app/pages/admin/outdated-queries/index.js |
import moment from 'moment';
import { Paginator } from '../../../utils';
import template from './outdated-queries.html';
function OutdatedQueriesCtrl($scope, Events, $http, $timeout) {
Events.record('view', 'page', 'admin/outdated_queries');
$scope.autoUpdate = true;
this.queries = new Paginator([], { itemsPerPage: 50 });
const refresh = () => {
if ($scope.autoUpdate) {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/outdated').success((data) => {
this.queries.updateRows(data.queries);
$scope.updatedAt = data.updated_at * 1000.0;
});
}
const timer = $timeout(refresh, 59 * 1000);
$scope.$on('$destroy', () => {
if (timer) {
$timeout.cancel(timer);
}
});
};
refresh();
}
export default function (ngModule) {
ngModule.component('outdatedQueriesPage', {
template,
controller: OutdatedQueriesCtrl,
});
return {
'/admin/queries/outdated': {
template: '<outdated-queries-page></outdated-queries-page>',
title: 'Outdated Queries',
},
};
}
| import moment from 'moment';
import { Paginator } from '../../../utils';
import template from './outdated-queries.html';
function OutdatedQueriesCtrl($scope, Events, $http, $timeout) {
Events.record('view', 'page', 'admin/outdated_queries');
$scope.autoUpdate = true;
this.queries = new Paginator([], { itemsPerPage: 50 });
const refresh = () => {
if ($scope.autoUpdate) {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/outdated').success((data) => {
this.queries.updateRows(data.queries);
$scope.updatedAt = data.updated_at * 1000.0;
});
}
const timer = $timeout(refresh, 59 * 1000);
$scope.$on('$destroy', () => {
if (timer) {
$timeout.cancel(timer);
}
});
};
refresh();
}
export default function (ngModule) {
ngModule.component('outdatedQueriesPage', {
template,
controller: OutdatedQueriesCtrl,
});
return {
'/admin/queries/outdated': {
template: '<outdated-queries-page></outdated-queries-page>',
title: 'Outdated Queries',
},
};
}
| Test line end carriages redo. | Test line end carriages redo.
| JavaScript | bsd-2-clause | moritz9/redash,moritz9/redash,moritz9/redash,moritz9/redash | ---
+++
@@ -1,4 +1,3 @@
-
import moment from 'moment';
import { Paginator } from '../../../utils'; |
d6dac26b729b9a2f0adade9d870dfd7edbd2c3b9 | .stylelintrc.js | .stylelintrc.js | const declarationBlockPropertiesOrder = require('./.csscomb.json')['sort-order'][0];
module.exports = {
extends: `stylelint-config-modularis`,
rules: {
'declaration-block-properties-order': declarationBlockPropertiesOrder,
'no-indistinguishable-colors': [true, { threshold: 1 }]
}
};
| const declarationBlockPropertiesOrder = require(`./.csscomb.json`)[`sort-order`][0];
module.exports = {
extends: `stylelint-config-modularis`,
rules: {
'declaration-block-properties-order': declarationBlockPropertiesOrder,
'no-indistinguishable-colors': [true, { threshold: 1 }],
},
};
| Fix code style errors in the stylelint config file | Fix code style errors in the stylelint config file
| JavaScript | mit | avalanchesass/avalanche-website,avalanchesass/avalanche-website | ---
+++
@@ -1,9 +1,9 @@
-const declarationBlockPropertiesOrder = require('./.csscomb.json')['sort-order'][0];
+const declarationBlockPropertiesOrder = require(`./.csscomb.json`)[`sort-order`][0];
module.exports = {
extends: `stylelint-config-modularis`,
rules: {
'declaration-block-properties-order': declarationBlockPropertiesOrder,
- 'no-indistinguishable-colors': [true, { threshold: 1 }]
- }
+ 'no-indistinguishable-colors': [true, { threshold: 1 }],
+ },
}; |
dd538b5472f01f45822f026624d98da78408e492 | lib/Procure.js | lib/Procure.js | var fs = require('fs');
var url = require('url');
var request = require('request');
/**
* @class
*/
var Procure = function() {};
/**
* "Procure" a resource, whether local or remote.
* @function procure
* @param {string} uri Some path to a file.
* @param {Procure~ProcuringComplete} callback Function called on sucess or failure.
*/
Procure.prototype.procure = function( uri , procured ) {
var info = url.parse( uri );
if (~['http:', 'https:'].indexOf( info.protocol )) {
request({
uri: uri,
headers: {
'Accept': 'application/json;q=0.9,*/*;q=0.8'
}
}, function(err, res, body) {
if (res.statusCode != 200 ) return procured('non-200 response');
return procured( err , body );
});
} else {
fs.readFile( uri , procured );
}
};
/**
* The callback function when the file is retrieved (or not).
* @callback Procure~ProcuringComplete
* @param {mixed} err Error message, if any. Null / undefined if none.
* @param {string} body Body of the requested content.
*/
module.exports = Procure;
| var fs = require('fs');
var url = require('url');
var request = require('request');
var package = require('../package.json');
/**
* @class
*/
var Procure = function() {};
/**
* "Procure" a resource, whether local or remote.
* @function procure
* @param {string} uri Some path to a file.
* @param {Procure~ProcuringComplete} callback Function called on sucess or failure.
*/
Procure.prototype.procure = function( uri , procured ) {
var info = url.parse( uri );
if (~['http:', 'https:'].indexOf( info.protocol )) {
request({
uri: uri,
headers: {
'Accept': 'application/json;q=0.9,*/*;q=0.8',
'User-Agent': 'procure/' + package.version
}
}, function(err, res, body) {
var statusCode = res.statusCode;
if (statusCode != 200 ) return procured('non-200 response ' + statusCode);
return procured( err , body );
});
} else {
fs.readFile( uri , procured );
}
};
/**
* The callback function when the file is retrieved (or not).
* @callback Procure~ProcuringComplete
* @param {mixed} err Error message, if any. Null / undefined if none.
* @param {string} body Body of the requested content.
*/
module.exports = Procure;
| Add User-Agent for GitHub calls. | Add User-Agent for GitHub calls.
| JavaScript | mit | martindale/procure | ---
+++
@@ -1,6 +1,7 @@
var fs = require('fs');
var url = require('url');
var request = require('request');
+var package = require('../package.json');
/**
* @class
@@ -20,10 +21,12 @@
request({
uri: uri,
headers: {
- 'Accept': 'application/json;q=0.9,*/*;q=0.8'
+ 'Accept': 'application/json;q=0.9,*/*;q=0.8',
+ 'User-Agent': 'procure/' + package.version
}
}, function(err, res, body) {
- if (res.statusCode != 200 ) return procured('non-200 response');
+ var statusCode = res.statusCode;
+ if (statusCode != 200 ) return procured('non-200 response ' + statusCode);
return procured( err , body );
});
} else { |
2538a506cc1dec5557a22ef51b11ce068a350440 | lib/actions.js | lib/actions.js | 'use strict';
var fluxApp = require('fluxapp');
var router = fluxApp.getRouter();
function isEnabled() {
return !! (typeof window !== 'undefined' && window.history);
}
module.exports = {
router: {
init: function init(url, meta) {
var request = router.build(url, meta);
if (! request) {
throw new Error('fluxapp:router:init unable to locate route specified', route);
}
if (isEnabled()) {
window.history.replaceState(
request,
request.title || '',
request.url
);
}
return request;
},
go: function go(id, meta) {
var request = router.build(id, meta);
if (! request) {
throw new Error('fluxapp:router:Go unable to locate route specified', route);
}
if (isEnabled()) {
window.history.pushState(
request,
request.title,
request.url
);
}
return request;
},
back: function back() {
if (isEnabled) {
window.history.back();
}
},
forward: function forward() {
if (isEnabled) {
window.history.forward();
}
}
}
}
| 'use strict';
var fluxApp = require('fluxapp');
var router = fluxApp.getRouter();
function isEnabled() {
return !! (typeof window !== 'undefined' && window.history);
}
module.exports = {
router: {
init: function init(url, meta) {
var request = router.build(url, meta, false);
if (! request) {
throw new Error('fluxapp:router:init unable to locate route specified', route);
}
if (isEnabled()) {
window.history.replaceState(
request,
request.title || '',
request.url
);
}
return request;
},
go: function go(id, meta) {
var request = router.build(id, meta);
if (! request) {
throw new Error('fluxapp:router:Go unable to locate route specified', route);
}
if (isEnabled()) {
window.history.pushState(
request,
request.title,
request.url
);
}
return request;
},
back: function back() {
if (isEnabled) {
window.history.back();
}
},
forward: function forward() {
if (isEnabled) {
window.history.forward();
}
}
}
}
| Allow for 404 not found | Allow for 404 not found | JavaScript | mit | colonyamerican/fluxapp-router | ---
+++
@@ -10,7 +10,7 @@
module.exports = {
router: {
init: function init(url, meta) {
- var request = router.build(url, meta);
+ var request = router.build(url, meta, false);
if (! request) {
throw new Error('fluxapp:router:init unable to locate route specified', route); |
5b7b02e254769ec79a9525c23b9eb85353e9b38e | src/components/body/ScrollerDirective.js | src/components/body/ScrollerDirective.js | import { requestAnimFrame } from '../../utils/utils';
import { scrollHelper } from './scrollHelper';
export function ScrollerDirective($timeout){
return {
restrict: 'E',
require:'^dtBody',
transclude: true,
template: `<div ng-style="scrollerStyles()" ng-transclude></div>`,
link: function($scope, $elm, $attrs, ctrl){
var ticking = false,
lastScrollY = 0,
lastScrollX = 0,
helper = scrollHelper.create($elm);
function update(){
$timeout(() => {
ctrl.options.internal.offsetY = lastScrollY;
ctrl.options.internal.offsetX = lastScrollX;
ctrl.updatePage();
});
ticking = false;
};
function requestTick() {
if(!ticking) {
requestAnimFrame(update);
ticking = true;
}
};
$elm.parent().on('scroll', function(ev) {
lastScrollY = this.scrollTop;
lastScrollX = this.scrollLeft;
requestTick();
});
$scope.scrollerStyles = function(scope){
return {
height: ctrl.count * ctrl.options.rowHeight + 'px'
}
};
}
};
};
| import { requestAnimFrame } from '../../utils/utils';
import { scrollHelper } from './scrollHelper';
export function ScrollerDirective($timeout){
return {
restrict: 'E',
require:'^dtBody',
transclude: true,
replace: true,
template: `<div ng-style="scrollerStyles()" ng-transclude></div>`,
link: function($scope, $elm, $attrs, ctrl){
var ticking = false,
lastScrollY = 0,
lastScrollX = 0,
helper = scrollHelper.create($elm.parent());
function update(){
$timeout(() => {
ctrl.options.internal.offsetY = lastScrollY;
ctrl.options.internal.offsetX = lastScrollX;
ctrl.updatePage();
});
ticking = false;
};
function requestTick() {
if(!ticking) {
requestAnimFrame(update);
ticking = true;
}
};
$elm.parent().on('scroll', function(ev) {
lastScrollY = this.scrollTop;
lastScrollX = this.scrollLeft;
requestTick();
});
$scope.scrollerStyles = function(scope){
return {
height: ctrl.count * ctrl.options.rowHeight + 'px'
}
};
}
};
};
| Fix footer paging not working | Fix footer paging not working
| JavaScript | mit | kuzman/angular-data-table,gabigeo/angular-data-table,kuzman/angular-data-table | ---
+++
@@ -6,12 +6,13 @@
restrict: 'E',
require:'^dtBody',
transclude: true,
+ replace: true,
template: `<div ng-style="scrollerStyles()" ng-transclude></div>`,
link: function($scope, $elm, $attrs, ctrl){
var ticking = false,
lastScrollY = 0,
lastScrollX = 0,
- helper = scrollHelper.create($elm);
+ helper = scrollHelper.create($elm.parent());
function update(){
$timeout(() => { |
c43bd67537d933ed345e79997ed315263f48c27c | examples/simple.js | examples/simple.js | "use strict";
const FigText = require('../lib/FigText');
const cursor = require('kittik-cursor').create().resetTTY();
FigText.create({
text: 'KittikJS\n Rules\n !!!',
x: 'center',
y: 'middle',
font: 'Star Wars',
foreground: 'yellow_1',
horizontalLayout: 'full'
}).render(cursor);
cursor.flush();
| "use strict";
const FigText = require('../lib/FigText');
const cursor = require('kittik-cursor').create().resetTTY();
FigText.create({
text: 'KittikJS',
x: 'center',
y: 'middle',
font: 'Star Wars',
foreground: 'yellow_1',
horizontalLayout: 'full'
}).render(cursor);
cursor.moveTo(1, process.stdout.rows).flush();
| Update shape-basic to the latest version | fix(shape): Update shape-basic to the latest version
| JavaScript | mit | kittikjs/shape-fig-text | ---
+++
@@ -4,7 +4,7 @@
const cursor = require('kittik-cursor').create().resetTTY();
FigText.create({
- text: 'KittikJS\n Rules\n !!!',
+ text: 'KittikJS',
x: 'center',
y: 'middle',
font: 'Star Wars',
@@ -12,4 +12,4 @@
horizontalLayout: 'full'
}).render(cursor);
-cursor.flush();
+cursor.moveTo(1, process.stdout.rows).flush(); |
523263d6b469f6b65a119b42c5c889f1b445d08e | src/fast_validation/helpers/types.js | src/fast_validation/helpers/types.js | 'use strict';
const { mapValues } = require('../../utilities');
const isObject = function (value) {
return value.constructor === Object;
};
const isObjectArray = function (value) {
return Array.isArray(value) && value.every(isObject);
};
const typeTest = ({ test: testFunc, message }) => name => ({
test ({ [name]: value }) {
if (value == null) { return true; }
return testFunc(value);
},
message: `'${name}' must be ${message}`,
});
const typeCheckers = {
stringTest: {
test: value => typeof value === 'string',
message: 'a string',
},
booleanTest: {
test: value => typeof value === 'boolean',
message: 'true or false',
},
numberTest: {
test: value => Number.isFinite(value),
message: 'a number',
},
integerTest: {
test: value => Number.isInteger(value),
message: 'an integer',
},
objectTest: {
test: isObject,
message: 'an object',
},
objectArrayTest: {
test: isObjectArray,
message: 'an array of objects',
},
objectOrArrayTest: {
test: value => isObject(value) || isObjectArray(value),
message: 'an array of objects',
},
};
const typeTests = mapValues(typeCheckers, typeTest);
module.exports = {
...typeTests,
};
| 'use strict';
const { mapValues, get } = require('../../utilities');
const isObject = function (value) {
return value.constructor === Object;
};
const isObjectArray = function (value) {
return Array.isArray(value) && value.every(isObject);
};
const typeTest = ({ test: testFunc, message }) => name => ({
test (value) {
const val = get(value, name.split('.'));
if (val == null) { return true; }
return testFunc(val);
},
message: `'${name}' must be ${message}`,
});
const typeCheckers = {
stringTest: {
test: value => typeof value === 'string',
message: 'a string',
},
booleanTest: {
test: value => typeof value === 'boolean',
message: 'true or false',
},
numberTest: {
test: value => Number.isFinite(value),
message: 'a number',
},
integerTest: {
test: value => Number.isInteger(value),
message: 'an integer',
},
objectTest: {
test: isObject,
message: 'an object',
},
objectArrayTest: {
test: isObjectArray,
message: 'an array of objects',
},
objectOrArrayTest: {
test: value => isObject(value) || isObjectArray(value),
message: 'an array of objects',
},
};
const typeTests = mapValues(typeCheckers, typeTest);
module.exports = {
...typeTests,
};
| Fix typeTest for deep attrs | Fix typeTest for deep attrs
| JavaScript | apache-2.0 | autoserver-org/autoserver,autoserver-org/autoserver | ---
+++
@@ -1,6 +1,6 @@
'use strict';
-const { mapValues } = require('../../utilities');
+const { mapValues, get } = require('../../utilities');
const isObject = function (value) {
return value.constructor === Object;
@@ -11,10 +11,12 @@
};
const typeTest = ({ test: testFunc, message }) => name => ({
- test ({ [name]: value }) {
- if (value == null) { return true; }
+ test (value) {
+ const val = get(value, name.split('.'));
- return testFunc(value);
+ if (val == null) { return true; }
+
+ return testFunc(val);
},
message: `'${name}' must be ${message}`,
}); |
762ea681fb722e0c08761e5daec6ea4979de6d11 | lib/get_all.js | lib/get_all.js | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
}).filter(fp.id).length > 0;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
| var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
}).filter(fp.id).length === zq.length;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
| Allow fuzzy searches to be combined | Allow fuzzy searches to be combined
Ie. v1/jsdelivr/libraries?name=jq*&lastversion=*.0.1 .
| JavaScript | mit | jsdelivr/api,MartinKolarik/api-sync,jsdelivr/api-sync,MartinKolarik/api,jsdelivr/api-sync,2947721120/jsdelivr-api,MartinKolarik/api-sync | ---
+++
@@ -26,7 +26,7 @@
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
- }).filter(fp.id).length > 0;
+ }).filter(fp.id).length === zq.length;
});
}
|
821c22c7318e4405058f56d5c2aacfd7cd23bf52 | packages/coinstac-server-core/src/services/logger.js | packages/coinstac-server-core/src/services/logger.js | 'use strict';
const mkdirp = require('mkdirp');
const path = require('path');
const pify = require('pify');
const touch = require('touch');
const winston = require('winston');
/**
* @module service/logger
*
* {@link https://www.npmjs.com/package/winston}
*/
/**
* Log file directory.
*
* @const {string}
*/
const LOG_DIR = '/var/log/coinstac';
/**
* Log file name.
*
* @const {string}
*/
const LOG_BASE = 'application.log';
/**
* Logger instance.
*
* @type {winston.Logger}
*/
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
level: 'info',
}),
],
});
/**
* Set up file transport async. If an error occurs the executable will catch the
* unhandled rejection and shut the server down.
*/
pify(mkdirp)(LOG_DIR)
.then(() => {
return new Promise((resolve, reject) => {
touch(path.join(LOG_DIR, LOG_BASE), error => {
if (error) {
reject(error);
} else {
resolve();
}
});
});
})
.then(() => {
logger.add(winston.transports.File, {
filename: path.join(LOG_DIR, LOG_BASE),
level: 'silly',
silent: false,
});
});
module.exports = logger;
| 'use strict';
const mkdirp = require('mkdirp');
const path = require('path');
const pify = require('pify');
const touch = require('touch');
const winston = require('winston');
/**
* @module service/logger
*
* {@link https://www.npmjs.com/package/winston}
*/
/**
* Log file directory.
*
* @const {string}
*/
const LOG_DIR = '/var/log/coinstac';
/**
* Log file name.
*
* @const {string}
*/
const LOG_BASE = 'application.log';
/**
* Logger instance.
*
* @type {winston.Logger}
*/
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
level: 'info',
}),
],
});
/**
* Set up file transport async. If an error occurs the executable will catch the
* unhandled rejection and shut the server down.
*/
pify(mkdirp)(LOG_DIR)
.then(() => pify(touch)(path.join(LOG_DIR, LOG_BASE)))
.catch(() => {
throw new Error(
`Couldn't create log file: ${path.join(LOG_DIR, LOG_BASE)}`
);
})
.then(() => {
logger.add(winston.transports.File, {
filename: path.join(LOG_DIR, LOG_BASE),
level: 'silly',
silent: false,
});
});
module.exports = logger;
| Make log `touch` error more human-readable. | Make log `touch` error more human-readable.
| JavaScript | mit | MRN-Code/coinstac,MRN-Code/coinstac,MRN-Code/coinstac | ---
+++
@@ -45,16 +45,11 @@
* unhandled rejection and shut the server down.
*/
pify(mkdirp)(LOG_DIR)
- .then(() => {
- return new Promise((resolve, reject) => {
- touch(path.join(LOG_DIR, LOG_BASE), error => {
- if (error) {
- reject(error);
- } else {
- resolve();
- }
- });
- });
+ .then(() => pify(touch)(path.join(LOG_DIR, LOG_BASE)))
+ .catch(() => {
+ throw new Error(
+ `Couldn't create log file: ${path.join(LOG_DIR, LOG_BASE)}`
+ );
})
.then(() => {
logger.add(winston.transports.File, { |
18e5fe55934899ba1e4454e1383ef49c5068dafb | ember-cli-build.js | ember-cli-build.js | /* eslint-env node */
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
'ember-cli-babel': {
includePolyfill: true
},
'ember-cli-mocha': {
useLintTree: false
},
sassOptions: {
includePaths: [
'addon/styles'
]
},
snippetPaths: [
'code-snippets'
],
snippetSearchPaths: [
'tests/dummy'
]
})
app.import('bower_components/highlightjs/styles/github.css')
app.import(app.project.addonPackages['ember-source']
? 'vendor/ember/ember-template-compiler.js' : 'bower_components/ember/ember-template-compiler.js')
return app.toTree()
}
| /* eslint-env node */
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
'ember-cli-babel': {
includePolyfill: true
},
sassOptions: {
includePaths: [
'addon/styles'
]
},
snippetPaths: [
'code-snippets'
],
snippetSearchPaths: [
'tests/dummy'
]
})
app.import('bower_components/highlightjs/styles/github.css')
app.import(app.project.addonPackages['ember-source']
? 'vendor/ember/ember-template-compiler.js' : 'bower_components/ember/ember-template-compiler.js')
return app.toTree()
}
| Remove useLintTree ember-cli-mocha build configuration | Remove useLintTree ember-cli-mocha build configuration
| JavaScript | mit | EWhite613/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,EWhite613/ember-frost-core,EWhite613/ember-frost-core | ---
+++
@@ -9,9 +9,6 @@
},
'ember-cli-babel': {
includePolyfill: true
- },
- 'ember-cli-mocha': {
- useLintTree: false
},
sassOptions: {
includePaths: [ |
d15cb49d88672b866158c5ef267d1f4c0bd7509b | lib/publish.js | lib/publish.js |
// get a url to a tarball, fetch it, read the package.json, and
// publish to the registry.
module.exports = publish
var fs = require("fs")
, path = require("path")
, chain = require("./utils/chain")
, rm = require("./utils/rm-rf")
, readJson = require("./utils/read-json")
, exec = require("./utils/exec")
, mkdir = require("./utils/mkdir-p")
, log = require("./utils/log")
, semver = require("./utils/semver")
, fetch = require("./utils/fetch")
, registry = require("./utils/registry")
, npm = require("../npm")
, url = require("url")
function publish (args, cb) {
log(args, "publish")
npm.commands.cache.add(args[0], args[1], function (er, data) {
if (er) return cb(er)
log(data, "publish")
if (!data) return cb(new Error("no data!?"))
registry.publish(data, cb)
})
}
|
module.exports = publish
var npm = require("../npm")
, registry = require("./utils/registry")
, log = require("./utils/log")
function publish (args, cb) {
log(args, "publish")
npm.commands.cache.add(args[0], args[1], function (er, data) {
if (er) return cb(er)
log(data, "publish")
if (!data) return cb(new Error("no data!?"))
registry.publish(data, cb)
})
}
| Remove a bunch of unnecessary require() statements | Remove a bunch of unnecessary require() statements
| JavaScript | artistic-2.0 | ekmartin/npm,kriskowal/npm,segmentio/npm,yibn2008/npm,kemitchell/npm,chadnickbok/npm,cchamberlain/npm,segmentio/npm,xalopp/npm,thomblake/npm,cchamberlain/npm,evocateur/npm,xalopp/npm,Volune/npm,segrey/npm,lxe/npm,xalopp/npm,princeofdarkness76/npm,segment-boneyard/npm,evocateur/npm,kemitchell/npm,cchamberlain/npm-msys2,segment-boneyard/npm,princeofdarkness76/npm,midniteio/npm,DIREKTSPEED-LTD/npm,yyx990803/npm,rsp/npm,cchamberlain/npm-msys2,thomblake/npm,yyx990803/npm,cchamberlain/npm,DIREKTSPEED-LTD/npm,segrey/npm,TimeToogo/npm,Volune/npm,kimshinelove/naver-npm,rsp/npm,ekmartin/npm,yibn2008/npm,misterbyrne/npm,segrey/npm,TimeToogo/npm,kimshinelove/naver-npm,evanlucas/npm,TimeToogo/npm,haggholm/npm,segment-boneyard/npm,Volune/npm,kemitchell/npm,haggholm/npm,misterbyrne/npm,lxe/npm,misterbyrne/npm,DIREKTSPEED-LTD/npm,yodeyer/npm,chadnickbok/npm,evanlucas/npm,evanlucas/npm,yodeyer/npm,princeofdarkness76/npm,kriskowal/npm,cchamberlain/npm-msys2,DaveEmmerson/npm,midniteio/npm,DaveEmmerson/npm,chadnickbok/npm,DaveEmmerson/npm,yyx990803/npm,ekmartin/npm,yibn2008/npm,rsp/npm,segmentio/npm,kimshinelove/naver-npm,thomblake/npm,kriskowal/npm,evocateur/npm,lxe/npm,haggholm/npm,yodeyer/npm,midniteio/npm | ---
+++
@@ -1,22 +1,9 @@
-
-// get a url to a tarball, fetch it, read the package.json, and
-// publish to the registry.
module.exports = publish
-var fs = require("fs")
- , path = require("path")
- , chain = require("./utils/chain")
- , rm = require("./utils/rm-rf")
- , readJson = require("./utils/read-json")
- , exec = require("./utils/exec")
- , mkdir = require("./utils/mkdir-p")
+var npm = require("../npm")
+ , registry = require("./utils/registry")
, log = require("./utils/log")
- , semver = require("./utils/semver")
- , fetch = require("./utils/fetch")
- , registry = require("./utils/registry")
- , npm = require("../npm")
- , url = require("url")
function publish (args, cb) {
log(args, "publish") |
15cf2fd1ca05cf8be0491f10672a36f4352a9d8e | packages/ember-model/tests/model_sideloading_test.js | packages/ember-model/tests/model_sideloading_test.js | var attr = Ember.attr;
module("Ember.Model sideloading");
test("data can be sideloaded without materializing records", function() {
expect(1);
var Model = Ember.Model.extend({
id: attr(),
name: attr()
});
Model.adapter = {
find: function(record, id) {
ok(false, "Adapter#find shouldn't be called for records with sideloaded data");
}
};
Model.load([{id: 1, name: "Erik"}]);
var record = Model.find(1);
ok(record.get('isLoaded'), "Record should be loaded immediately");
// ok(record.get('isLoaded'), "Record should be loaded immediately");
}); | var attr = Ember.attr;
module("Ember.Model sideloading");
test("data can be sideloaded without materializing records", function() {
expect(1);
var Model = Ember.Model.extend({
id: attr(),
name: attr(),
camelCase: attr()
});
Model.adapter = {
find: function(record, id) {
ok(false, "Adapter#find shouldn't be called for records with sideloaded data");
}
};
Model.load([{id: 1, name: "Erik", camel_case: "Dromedary"}]);
var record = Model.find(1);
ok(record.get('isLoaded'), "Record should be loaded immediately");
strictEqual(record.get('id'), 1, "Record ID retained successfully");
strictEqual(record.get('name'), "Erik", "Record name retained successfully");
strictEqual(record.get('camelCase'), "Dromedary", "camel cased attributes retained correctly");
// ok(record.get('isLoaded'), "Record should be loaded immediately");
});
| Add breaking test for sideloading data with camel cased attributes | Add breaking test for sideloading data with camel cased attributes
| JavaScript | mit | zenefits/ember-model,greyhwndz/ember-model,sohara/ember-model,asquet/ember-model,juggy/ember-model,GavinJoyce/ember-model,igorgoroshit/ember-model,ipavelpetrov/ember-model,CondeNast/ember-model,ebryn/ember-model,asquet/ember-model,ckung/ember-model,Swrve/ember-model,julkiewicz/ember-model,c0achmcguirk/ember-model,intercom/ember-model,gmedina/ember-model,ipavelpetrov/ember-model | ---
+++
@@ -7,7 +7,8 @@
var Model = Ember.Model.extend({
id: attr(),
- name: attr()
+ name: attr(),
+ camelCase: attr()
});
Model.adapter = {
find: function(record, id) {
@@ -15,9 +16,12 @@
}
};
- Model.load([{id: 1, name: "Erik"}]);
+ Model.load([{id: 1, name: "Erik", camel_case: "Dromedary"}]);
var record = Model.find(1);
ok(record.get('isLoaded'), "Record should be loaded immediately");
+ strictEqual(record.get('id'), 1, "Record ID retained successfully");
+ strictEqual(record.get('name'), "Erik", "Record name retained successfully");
+ strictEqual(record.get('camelCase'), "Dromedary", "camel cased attributes retained correctly");
// ok(record.get('isLoaded'), "Record should be loaded immediately");
}); |
9079ca9a5a9565b02a0bfae9b073f8a8edc789dc | app/scripts/museum/address-filter.js | app/scripts/museum/address-filter.js |
(function() {
'use strict';
/**
* Generate a human-readable address string from a single museum object
*
* Can get fancy here and prioritize one of the three address types provided:
* source address, geocoded address, physical address
*
* For now, default to geocoded address since that's what seems to always be populated
*/
/* ngInject */
function AddressFilter() {
return function (input) {
var address = input.gaddress;
var city = input.gcity;
var state = input.gstate;
var zip = input.gzip;
return address + ', ' + city + ', ' + state + ' ' + zip;
};
}
angular.module('imls.museum')
.filter('imlsAddress', AddressFilter);
})();
|
(function() {
'use strict';
/**
* Generate a human-readable address string from a single museum object
*
* Can get fancy here and prioritize one of the three address types provided:
* source address, geocoded address, physical address
*
* For now, default to geocoded address since that's what seems to always be populated
*/
/* ngInject */
function AddressFilter() {
return function (input) {
var address = input.adstreet;
var city = input.adcity;
var state = input.adstate;
var zip = input.adzip;
return address + ', ' + city + ', ' + state + ' ' + zip;
};
}
angular.module('imls.museum')
.filter('imlsAddress', AddressFilter);
})();
| Use valid columns in address filter | Bugfix: Use valid columns in address filter
| JavaScript | apache-2.0 | MuseumStat/imls-museum-data,azavea/imls-museum-data,azavea/imls-museum-data,azavea/imls-museum-data,MuseumStat/imls-museum-data,MuseumStat/imls-museum-data | ---
+++
@@ -13,10 +13,10 @@
/* ngInject */
function AddressFilter() {
return function (input) {
- var address = input.gaddress;
- var city = input.gcity;
- var state = input.gstate;
- var zip = input.gzip;
+ var address = input.adstreet;
+ var city = input.adcity;
+ var state = input.adstate;
+ var zip = input.adzip;
return address + ', ' + city + ', ' + state + ' ' + zip;
}; |
d17596670403e4f20efa4d1957aad1d1f52b4038 | lib/runtime.js | lib/runtime.js | var adt;
try {
adt = require("adt");
} catch (e) {
adt = null;
}
// Given an object and a class name, tries to determin if the object is an
// instance of said class.
function matchesTypeName (obj, name) {
if (adt && isADT(obj)) {
var types = adt.lookup(name);
if (types) {
for (var i = 0, len = types.length; i < len; i++) {
if (obj instanceof types[i]) return true;
}
}
return false;
}
if (obj.constructor && obj.constructor.name && obj.constructor.name === name) {
return true;
}
return false;
}
// Checks whether an object is an adt.js type.
function isADT (obj) {
return obj instanceof adt.__Base__;
}
// Export
module.exports = {
matchesTypeName: matchesTypeName,
isADT: isADT
};
| var adt;
try {
adt = require("adt");
} catch (e) {
adt = null;
}
// Given an object and a class name, tries to determin if the object is an
// instance of said class.
function matchesTypeName (obj, name) {
if (name === "Number") {
return typeof obj === "number";
}
else if (name === "String") {
return typeof obj === "string";
}
else if (name === "Function") {
return obj instanceof Function;
}
else if (name === "Object") {
return obj instanceof Object;
}
else if (adt && isADT(obj)) {
var types = adt.lookup(name);
if (types) {
for (var i = 0, len = types.length; i < len; i++) {
if (obj instanceof types[i]) return true;
}
}
return false;
}
return false;
}
// Checks whether an object is an adt.js type.
function isADT (obj) {
return obj instanceof adt.__Base__;
}
// Export
module.exports = {
matchesTypeName: matchesTypeName,
isADT: isADT
};
| Remove checking of constructor.name, instead just check primitive types and adt.js types | Remove checking of constructor.name, instead just check primitive types and adt.js types
| JavaScript | mit | ermouth/matches.js,natefaubion/matches.js | ---
+++
@@ -8,7 +8,23 @@
// Given an object and a class name, tries to determin if the object is an
// instance of said class.
function matchesTypeName (obj, name) {
- if (adt && isADT(obj)) {
+ if (name === "Number") {
+ return typeof obj === "number";
+ }
+
+ else if (name === "String") {
+ return typeof obj === "string";
+ }
+
+ else if (name === "Function") {
+ return obj instanceof Function;
+ }
+
+ else if (name === "Object") {
+ return obj instanceof Object;
+ }
+
+ else if (adt && isADT(obj)) {
var types = adt.lookup(name);
if (types) {
for (var i = 0, len = types.length; i < len; i++) {
@@ -16,10 +32,6 @@
}
}
return false;
- }
-
- if (obj.constructor && obj.constructor.name && obj.constructor.name === name) {
- return true;
}
return false; |
759e7a66ca850755d7dad05974bf4a559d51f984 | source/javascripts/pricing.js | source/javascripts/pricing.js | $(function () {
$.fn.equalHeights = function() {
var maxHeight = 0,
$this = $(this);
$this.each( function() {
var height = $(this).innerHeight();
if (height > maxHeight) {
maxHeight = height;
}
});
return $this.css('height', maxHeight);
};
function equilize() {
$('[data-equal]').each(function(){
var $this = $(this),
target = $this.data('equal');
if ($(window).width() >= 992) {
$this.find(target).css('height', '').equalHeights();
} else {
$this.find(target).css('height', '');
}
});
}
setTimeout(equilize, 500);
$(window).on('resize', equilize);
$('.js-faq-question').on('click', function (e) {
e.preventDefault();
isOpen = $(this).closest('.faq-item').is('.is-open');
$('.faq-item.is-open').removeClass('is-open');
if (!isOpen) {
$(this).closest('.faq-item').toggleClass('is-open');
}
});
});
| $(function () {
$.fn.equalHeights = function() {
var maxHeight = 0,
$this = $(this);
$this.each( function() {
var height = $(this).innerHeight();
if (height > maxHeight) {
maxHeight = height;
}
});
return $this.css('height', maxHeight);
};
function equilize() {
$('[data-equal]').each(function(){
var $this = $(this),
target = $this.data('equal');
if ($(window).width() >= 992) {
$this.find(target).css('height', '').equalHeights();
} else {
$this.find(target).css('height', '');
}
});
}
setTimeout(equilize, 500);
$(window).on('resize', equilize);
$('.featured-item-expand').on('click', function(e) {
var listExpander = $(this);
targetFeatureList = $($(this).attr('href'));
if (!targetFeatureList.is(':visible')) {
targetFeatureList.addClass('list-expanded');
listExpander.addClass('chevron-up');
} else {
targetFeatureList.removeClass('list-expanded');
listExpander.removeClass('chevron-up');
}
e.preventDefault();
});
$('.js-faq-question').on('click', function (e) {
e.preventDefault();
isOpen = $(this).closest('.faq-item').is('.is-open');
$('.faq-item.is-open').removeClass('is-open');
if (!isOpen) {
$(this).closest('.faq-item').toggleClass('is-open');
}
});
});
| Add event listener to expand/collapse edition card info | Add event listener to expand/collapse edition card info
| JavaScript | mit | damianhakert/damianhakert.github.io | ---
+++
@@ -30,6 +30,21 @@
setTimeout(equilize, 500);
$(window).on('resize', equilize);
+ $('.featured-item-expand').on('click', function(e) {
+ var listExpander = $(this);
+ targetFeatureList = $($(this).attr('href'));
+
+ if (!targetFeatureList.is(':visible')) {
+ targetFeatureList.addClass('list-expanded');
+ listExpander.addClass('chevron-up');
+ } else {
+ targetFeatureList.removeClass('list-expanded');
+ listExpander.removeClass('chevron-up');
+ }
+
+ e.preventDefault();
+ });
+
$('.js-faq-question').on('click', function (e) {
e.preventDefault();
isOpen = $(this).closest('.faq-item').is('.is-open'); |
493a5038a3afe675213e2f8e1802a088b2cfc38c | src/javascript/app_2/Stores/Modules/Trading/Helpers/end-time.js | src/javascript/app_2/Stores/Modules/Trading/Helpers/end-time.js | export const getSelectedTime = (
server_time,
selected_time,
market_open_time,
) => {
const boundaries = selected_time.isBefore(market_open_time)
? market_open_time.isBefore(server_time)
? server_time.add(5, 'minute')
: market_open_time.add(5, 'minute')
: selected_time;
return boundaries.format('HH:mm');
};
export const getBoundaries = (
server_time,
market_open_time,
market_close_time,
) => {
const boundaries = {
start: server_time.isBefore(market_open_time)
? market_open_time.add(5, 'minute')
: server_time.add(5, 'minute'),
end: market_close_time,
};
return boundaries;
};
| export const getSelectedTime = (
server_time,
selected_time,
market_open_time,
) => {
const value = selected_time.isBefore(market_open_time)
? market_open_time.isBefore(server_time)
? server_time.add(5, 'minute')
: market_open_time.add(5, 'minute')
: selected_time;
return value.format('HH:mm');
};
export const getBoundaries = (
server_time,
market_open_time,
market_close_time,
) => {
const boundaries = {
start: server_time.isBefore(market_open_time)
? market_open_time.add(5, 'minute')
: server_time.add(5, 'minute'),
end: market_close_time,
};
return boundaries;
};
| Rename boundaries -> value, on getSelectedTime | Rename boundaries -> value, on getSelectedTime
| JavaScript | apache-2.0 | ashkanx/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,binary-com/binary-static,binary-com/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,4p00rv/binary-static,4p00rv/binary-static,kellybinary/binary-static,kellybinary/binary-static | ---
+++
@@ -3,13 +3,13 @@
selected_time,
market_open_time,
) => {
- const boundaries = selected_time.isBefore(market_open_time)
+ const value = selected_time.isBefore(market_open_time)
? market_open_time.isBefore(server_time)
? server_time.add(5, 'minute')
: market_open_time.add(5, 'minute')
: selected_time;
- return boundaries.format('HH:mm');
+ return value.format('HH:mm');
};
export const getBoundaries = ( |
4f503b03227cf7eebc552672ae469443016c0d6d | src/index.js | src/index.js | require("./stylesheets/main.less");
var marked = require("marked");
var commands = codebox.require("core/commands");
var dialogs = codebox.require("utils/dialogs");
commands.register({
id: "markdown.preview",
title: "Markdown: Preview",
context: ["editor"],
run: function(args, context) {
return codebox.tabs.add(codebox.tabs.HtmlPanel, {
className: "component-markdown-preview",
content: marked(context.getContent())
}, {
type: "markdown",
title: "Markdown: " + context.model.get("name"),
section: "markdown"
});
}
});
| require("./stylesheets/main.less");
var marked = require("marked");
var commands = codebox.require("core/commands");
var dialogs = codebox.require("utils/dialogs");
commands.register({
id: "markdown.preview",
title: "Markdown: Preview",
context: ["editor"],
run: function(args, ctx) {
return codebox.tabs.add(codebox.tabs.HtmlPanel, {
className: "component-markdown-preview",
content: marked(ctx.editor.getContent())
}, {
type: "markdown",
title: "Markdown: " + ctx.editor.model.get("name"),
section: "markdown"
});
}
});
| Use new multiple cmd contexts | Use new multiple cmd contexts
| JavaScript | apache-2.0 | CodeboxIDE/package-markdown | ---
+++
@@ -8,13 +8,13 @@
id: "markdown.preview",
title: "Markdown: Preview",
context: ["editor"],
- run: function(args, context) {
+ run: function(args, ctx) {
return codebox.tabs.add(codebox.tabs.HtmlPanel, {
className: "component-markdown-preview",
- content: marked(context.getContent())
+ content: marked(ctx.editor.getContent())
}, {
type: "markdown",
- title: "Markdown: " + context.model.get("name"),
+ title: "Markdown: " + ctx.editor.model.get("name"),
section: "markdown"
});
} |
30fb1dd1918d561c8ac2a99708af962224824c9e | src/index.js | src/index.js | import {EntityManager} from './entity-manager';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
export {repository} from './decorator/repository';
export {validation} from './decorator/validation';
export {validatedResource} from './decorator/validated-resource';
export function configure(aurelia, configCallback) {
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
}
| import {EntityManager} from './entity-manager';
import {ValidationGroup} from 'aurelia-validation';
import {HasAssociationValidationRule} from './validator/has-association';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
export {OrmMetadata} from './orm-metadata';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
export {repository} from './decorator/repository';
export {validation} from './decorator/validation';
export {validatedResource} from './decorator/validated-resource';
export function configure(aurelia, configCallback) {
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
ValidationGroup.prototype.hasAssociation = function() {
return this.isNotEmpty().passesRule(new HasAssociationValidationRule());
};
}
| Add validation rule for associations to validator | feat(validator): Add validation rule for associations to validator
| JavaScript | mit | SpoonX/aurelia-orm,kellyethridge/aurelia-orm,freska-fi/aurelia-orm,freska-fi/aurelia-orm,doktordirk/aurelia-orm,kellyethridge/aurelia-orm,SpoonX/aurelia-orm,bas080/aurelia-orm,doktordirk/aurelia-orm,bas080/aurelia-orm | ---
+++
@@ -1,8 +1,11 @@
import {EntityManager} from './entity-manager';
+import {ValidationGroup} from 'aurelia-validation';
+import {HasAssociationValidationRule} from './validator/has-association';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
+export {OrmMetadata} from './orm-metadata';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
@@ -14,4 +17,8 @@
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
+
+ ValidationGroup.prototype.hasAssociation = function() {
+ return this.isNotEmpty().passesRule(new HasAssociationValidationRule());
+ };
} |
f71e561347293bdf7adb688739cc0b9e45e08a48 | test/test-creation.js | test/test-creation.js | /*global describe, beforeEach, it*/
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
describe('bespoke generator', function () {
beforeEach(function (done) {
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}
this.app = helpers.createGenerator('bespoke:app', [
'../../app'
]);
done();
}.bind(this));
});
it('creates expected files', function (done) {
var expected = [
// add files you expect to exist here.
'package.json',
'bower.json',
'Gruntfile.js',
'.gitignore',
'.jshintrc',
'.bowerrc',
'src/index.jade',
'src/js/js.js',
'src/css/css.styl'
];
helpers.mockPrompt(this.app, {
'name': 'Foo Bar',
'bullets': 'Y',
'hash': 'Y'
});
this.app.run({}, function () {
helpers.assertFiles(expected);
done();
});
});
});
| /*global describe, beforeEach, it*/
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
describe('bespoke generator', function () {
beforeEach(function (done) {
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}
this.app = helpers.createGenerator('bespoke:app', [
'../../app'
]);
done();
}.bind(this));
});
it('creates expected files', function (done) {
var expected = [
// add files you expect to exist here.
'package.json',
'bower.json',
'Gruntfile.js',
'.gitignore',
'.jshintrc',
'.bowerrc',
'src/index.jade',
'src/js/js.js',
'src/css/css.styl'
];
helpers.mockPrompt(this.app, {
'title': 'Foo Bar',
'bullets': 'Y',
'hash': 'Y'
});
this.app.run({}, function () {
helpers.assertFiles(expected);
done();
});
});
});
| Rename 'name' to 'title' in test | Rename 'name' to 'title' in test
| JavaScript | mit | pimterry/generator-bespoke,mikemaccana/generator-bespoke,bguiz/generator-bespoke,markdalgleish/generator-bespoke,bespokejs/generator-bespoke,markdalgleish/generator-bespoke,markdalgleish/generator-bespoke,bespokejs/generator-bespoke,bespokejs/generator-bespoke | ---
+++
@@ -34,7 +34,7 @@
];
helpers.mockPrompt(this.app, {
- 'name': 'Foo Bar',
+ 'title': 'Foo Bar',
'bullets': 'Y',
'hash': 'Y'
}); |
a24c7ca0ddbef44abeda4e12cd5382b7748a1204 | src/store.js | src/store.js | /** @babel */
import { applyMiddleware, createStore } from 'redux'
import createLogger from 'redux-logger'
import createSagaMiddleware from 'redux-saga'
import reducers from './reducers'
import rootSaga from './sagas'
const logger = createLogger()
const saga = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(logger, saga)
)
saga.run(rootSaga)
| /** @babel */
import { applyMiddleware, createStore } from 'redux'
import createLogger from 'redux-logger'
import createSagaMiddleware from 'redux-saga'
import reducers from './reducers'
import rootSaga from './sagas'
const logger = createLogger({ collapsed: true, diff: true })
const saga = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(logger, saga)
)
saga.run(rootSaga)
| Add collapsing to the logger | Add collapsing to the logger
| JavaScript | mit | sanack/atom-jq | ---
+++
@@ -6,7 +6,7 @@
import reducers from './reducers'
import rootSaga from './sagas'
-const logger = createLogger()
+const logger = createLogger({ collapsed: true, diff: true })
const saga = createSagaMiddleware()
export const store = createStore( |
c12f5f84fd3201298b84362cc0f5c0c6de4bc86c | lib/assets/javascripts/cartodb3/editor/layers/analysis-views/default-layer-analysis-view.js | lib/assets/javascripts/cartodb3/editor/layers/analysis-views/default-layer-analysis-view.js | var template = require('./default-layer-analysis-view.tpl');
/**
* View for an analysis node with a single input
*
* this.model is expected to be a analysis-definition-node-nodel
*/
module.exports = cdb.core.View.extend({
initialize: function (opts) {
if (!opts.layerDefinitionModel) throw new Error('layerDefinitionModel is required');
if (!opts.layerAnalysisViewFactory) throw new Error('layerAnalysisViewFactory is required');
this._layerDefinitionModel = opts.layerDefinitionModel;
this._layerAnalysisViewFactory = opts.layerAnalysisViewFactory;
this.model.on('change', this.render, this);
},
render: function () {
this.clearSubViews();
this.$el.html(template({
id: this.model.id,
title: this.model.get('type')
}));
var view = this._layerAnalysisViewFactory.createView(this.model.get('source_id'), this._layerDefinitionModel);
this.addView(view);
this.$el.append(view.render().el);
return this;
}
});
| var template = require('./default-layer-analysis-view.tpl');
/**
* View for an analysis node with a single input
*
* this.model is expected to be a analysis-definition-node-nodel
*/
module.exports = cdb.core.View.extend({
initialize: function (opts) {
if (!opts.layerDefinitionModel) throw new Error('layerDefinitionModel is required');
if (!opts.layerAnalysisViewFactory) throw new Error('layerAnalysisViewFactory is required');
this._layerDefinitionModel = opts.layerDefinitionModel;
this._layerAnalysisViewFactory = opts.layerAnalysisViewFactory;
this.model.on('change', this.render, this);
},
render: function () {
this.clearSubViews();
this.$el.html(template({
id: this.model.id,
title: this.model.get('type')
}));
var view = this._layerAnalysisViewFactory.createView(this.model.sourceIds()[0], this._layerDefinitionModel);
this.addView(view);
this.$el.append(view.render().el);
return this;
}
});
| Use sourceIds instead of hardcoded attribute name | Use sourceIds instead of hardcoded attribute name
The source_id attr just happened to work, use the sourceIds method
instead
| JavaScript | bsd-3-clause | bloomberg/cartodb,codeandtheory/cartodb,CartoDB/cartodb,splashblot/dronedb,bloomberg/cartodb,codeandtheory/cartodb,bloomberg/cartodb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,bloomberg/cartodb,codeandtheory/cartodb,CartoDB/cartodb,codeandtheory/cartodb,codeandtheory/cartodb,splashblot/dronedb,CartoDB/cartodb,bloomberg/cartodb,splashblot/dronedb,splashblot/dronedb | ---
+++
@@ -25,7 +25,7 @@
title: this.model.get('type')
}));
- var view = this._layerAnalysisViewFactory.createView(this.model.get('source_id'), this._layerDefinitionModel);
+ var view = this._layerAnalysisViewFactory.createView(this.model.sourceIds()[0], this._layerDefinitionModel);
this.addView(view);
this.$el.append(view.render().el);
|
57a4b691eb7dcc09c6f4f970b6880b6e5c1c2538 | src/process/normalizeToPercentage.js | src/process/normalizeToPercentage.js | // @flow
import type Series from '../series/Series';
type Config = {
key: string
};
export default function normalizeToPercentage(config: Config) {
const {key} = config;
return (series: Series) => {
series.preprocess.normalizeToPercentage = true;
series.preprocess.stacked = true;
series.preprocess.stackType = 'points';
const next = series.mapPoints((point) => {
const total = point.reduce((rr, point) => rr + (point[key] || 0), 0);
let sum = 0;
const nextPoints = point.map(point => {
let next = Object.assign({}, point);
next.originalValue = next[key];
sum += (next[key] || 0);
next[key] = sum / total;
return next;
});
return nextPoints;
});
return next;
};
}
| // @flow
import type Series from '../series/Series';
type Config = {
key: string
};
export default function normalizeToPercentage(config: Config) {
const {key} = config;
return (series: Series) => {
series.preprocess.normalizeToPercentage = true;
series.preprocess.stacked = true;
series.preprocess.stackType = 'points';
const next = series.mapPoints((point) => {
const total = point.reduce((rr, point) => rr + (point[key] || 0), 0);
let sum = 0;
const nextPoints = point.map(point => {
let next = Object.assign({}, point);
next.originalValue = next[key];
next.percentValue = ((next[key] || 0) / total);
sum += (next[key] || 0);
next[key] = sum / total;
return next;
});
return nextPoints;
});
return next;
};
}
| Add percentage value to points | Add percentage value to points
points contained their ending % position and original decimal value however did not contain a percentage value from the total of the series, this has been added. | JavaScript | mit | bigdatr/pnut,bigdatr/pnut | ---
+++
@@ -17,6 +17,7 @@
const nextPoints = point.map(point => {
let next = Object.assign({}, point);
next.originalValue = next[key];
+ next.percentValue = ((next[key] || 0) / total);
sum += (next[key] || 0);
next[key] = sum / total;
return next; |
0dd95707d02673649f113b3553c68b466f3dfdc4 | packages/@sanity/core/src/actions/dataset/chooseDatasetPrompt.js | packages/@sanity/core/src/actions/dataset/chooseDatasetPrompt.js | import debug from '../../debug'
import promptForDatasetName from './datasetNamePrompt'
module.exports = async (context, options = {}) => {
const {apiClient, prompt} = context
const {message, allowCreation} = options
const client = apiClient()
const datasets = await client.datasets.list()
const hasProduction = datasets.find(dataset => dataset.name === 'production')
const datasetChoices = datasets.map(dataset => ({value: dataset.name}))
const selected = await prompt.single({
message: message || 'Select dataset to use',
type: 'list',
choices: allowCreation
? [{value: 'new', name: 'Create new dataset'}, new prompt.Separator(), ...datasetChoices]
: datasetChoices
})
if (selected === 'new') {
debug('User wants to create a new dataset, prompting for name')
const newDatasetName = await promptForDatasetName(prompt, {
message: 'Name your dataset:',
default: hasProduction ? undefined : 'production'
})
await client.datasets.create(newDatasetName)
return newDatasetName
}
return selected
}
| import debug from '../../debug'
import promptForDatasetName from './datasetNamePrompt'
export default async (context, options = {}) => {
const {apiClient, prompt} = context
const {message, allowCreation} = options
const client = apiClient()
const datasets = await client.datasets.list()
const hasProduction = datasets.find(dataset => dataset.name === 'production')
const datasetChoices = datasets.map(dataset => ({value: dataset.name}))
const selected = await prompt.single({
message: message || 'Select dataset to use',
type: 'list',
choices: allowCreation
? [{value: 'new', name: 'Create new dataset'}, new prompt.Separator(), ...datasetChoices]
: datasetChoices
})
if (selected === 'new') {
debug('User wants to create a new dataset, prompting for name')
const newDatasetName = await promptForDatasetName(prompt, {
message: 'Name your dataset:',
default: hasProduction ? undefined : 'production'
})
await client.datasets.create(newDatasetName)
return newDatasetName
}
return selected
}
| Use ESM default export for dataset prompt | [core] Use ESM default export for dataset prompt
| JavaScript | mit | sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity | ---
+++
@@ -1,7 +1,7 @@
import debug from '../../debug'
import promptForDatasetName from './datasetNamePrompt'
-module.exports = async (context, options = {}) => {
+export default async (context, options = {}) => {
const {apiClient, prompt} = context
const {message, allowCreation} = options
const client = apiClient() |
3aee21ae0a0b376e101861e97431f09cc431a11a | packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/schema.js | packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/schema.js | import * as yup from 'yup';
import { translatedErrors } from '@strapi/helper-plugin';
const URL_REGEX = new RegExp('(^$)|((https?://.*)(d*)/?(.*))');
const schema = yup.object().shape({
email_confirmation_redirection: yup.mixed().when('email_confirmation', {
is: true,
then: yup
.string()
.matches(URL_REGEX)
.required(),
otherwise: yup.string().nullable(),
}),
email_reset_password: yup
.string(translatedErrors.string)
.matches(URL_REGEX, translatedErrors.regex)
.nullable(),
});
export default schema;
| import * as yup from 'yup';
import { translatedErrors } from '@strapi/helper-plugin';
const URL_REGEX = new RegExp('(^$)|((.+:\\/\\/.*)(d*)\\/?(.*))');
const schema = yup.object().shape({
email_confirmation_redirection: yup.mixed().when('email_confirmation', {
is: true,
then: yup
.string()
.matches(URL_REGEX)
.required(),
otherwise: yup.string().nullable(),
}),
email_reset_password: yup
.string(translatedErrors.string)
.matches(URL_REGEX, translatedErrors.regex)
.nullable(),
});
export default schema;
| Allow all URI schemes for setting reset password page | Allow all URI schemes for setting reset password page | JavaScript | mit | wistityhq/strapi,wistityhq/strapi | ---
+++
@@ -1,7 +1,7 @@
import * as yup from 'yup';
import { translatedErrors } from '@strapi/helper-plugin';
-const URL_REGEX = new RegExp('(^$)|((https?://.*)(d*)/?(.*))');
+const URL_REGEX = new RegExp('(^$)|((.+:\\/\\/.*)(d*)\\/?(.*))');
const schema = yup.object().shape({
email_confirmation_redirection: yup.mixed().when('email_confirmation', { |
77aa85536f93aea8caeb48b7008665ab1477d1c3 | src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/cell/select-cell.js | src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/cell/select-cell.js | define([
'underscore',
'backgrid',
'orodatagrid/js/datagrid/editor/select-cell-radio-editor'
], function(_, Backgrid, SelectCellRadioEditor) {
'use strict';
var SelectCell;
/**
* Select column cell. Added missing behaviour.
*
* @export oro/datagrid/cell/select-cell
* @class oro.datagrid.cell.SelectCell
* @extends Backgrid.SelectCell
*/
SelectCell = Backgrid.SelectCell.extend({
/**
* @inheritDoc
*/
initialize: function(options) {
if (this.expanded && !this.multiple) {
this.editor = SelectCellRadioEditor;
}
if (options.column.get('metadata').choices) {
this.optionValues = [];
_.each(options.column.get('metadata').choices, function(value, key) {
this.optionValues.push([value, key]);
}, this);
} else {
throw new Error('Column metadata must have choices specified');
}
SelectCell.__super__.initialize.apply(this, arguments);
}
});
return SelectCell;
});
| define([
'underscore',
'backgrid',
'orodatagrid/js/datagrid/editor/select-cell-radio-editor'
], function(_, Backgrid, SelectCellRadioEditor) {
'use strict';
var SelectCell;
/**
* Select column cell. Added missing behaviour.
*
* @export oro/datagrid/cell/select-cell
* @class oro.datagrid.cell.SelectCell
* @extends Backgrid.SelectCell
*/
SelectCell = Backgrid.SelectCell.extend({
/**
* @inheritDoc
*/
initialize: function(options) {
if (this.expanded && !this.multiple) {
this.editor = SelectCellRadioEditor;
}
if (options.column.get('metadata').choices) {
this.optionValues = [];
_.each(options.column.get('metadata').choices, function(value, key) {
this.optionValues.push([value, key]);
}, this);
} else {
throw new Error('Column metadata must have choices specified');
}
SelectCell.__super__.initialize.apply(this, arguments);
this.listenTo(this.model, 'change:' + this.column.get('name'), function() {
this.enterEditMode();
this.$el.find('select').uniform();
});
},
/**
* @inheritDoc
*/
render: function() {
var render = SelectCell.__super__.render.apply(this, arguments);
this.enterEditMode();
return render;
},
/**
* @inheritDoc
*/
enterEditMode: function() {
if (this.column.get('editable')) {
SelectCell.__super__.enterEditMode.apply(this, arguments);
}
},
/**
* @inheritDoc
*/
exitEditMode: function() {
this.$el.removeClass('error');
this.stopListening(this.currentEditor);
delete this.currentEditor;
}
});
return SelectCell;
});
| Test and merge to master - revert select cell functionality | BB-1315: Test and merge to master
- revert select cell functionality
| JavaScript | mit | ramunasd/platform,geoffroycochard/platform,trustify/oroplatform,Djamy/platform,trustify/oroplatform,orocrm/platform,orocrm/platform,trustify/oroplatform,ramunasd/platform,orocrm/platform,Djamy/platform,geoffroycochard/platform,Djamy/platform,geoffroycochard/platform,ramunasd/platform | ---
+++
@@ -32,6 +32,41 @@
throw new Error('Column metadata must have choices specified');
}
SelectCell.__super__.initialize.apply(this, arguments);
+
+ this.listenTo(this.model, 'change:' + this.column.get('name'), function() {
+ this.enterEditMode();
+
+ this.$el.find('select').uniform();
+ });
+ },
+
+ /**
+ * @inheritDoc
+ */
+ render: function() {
+ var render = SelectCell.__super__.render.apply(this, arguments);
+
+ this.enterEditMode();
+
+ return render;
+ },
+
+ /**
+ * @inheritDoc
+ */
+ enterEditMode: function() {
+ if (this.column.get('editable')) {
+ SelectCell.__super__.enterEditMode.apply(this, arguments);
+ }
+ },
+
+ /**
+ * @inheritDoc
+ */
+ exitEditMode: function() {
+ this.$el.removeClass('error');
+ this.stopListening(this.currentEditor);
+ delete this.currentEditor;
}
});
|
5298747365e5ecc6c15a2e5582da48e76ed34a4c | src/TypeaheadContext.js | src/TypeaheadContext.js | import {noop, pick} from 'lodash';
import createReactContext from 'create-react-context';
import React from 'react';
const TypeaheadContext = createReactContext({
activeIndex: -1,
hintText: '',
initialItem: null,
isOnlyResult: false,
onActiveItemChange: noop,
onAdd: noop,
onInitialItemChange: noop,
onMenuItemClick: noop,
selectHintOnEnter: false,
});
export const withContext = (Component, values) => (props) => (
<TypeaheadContext.Consumer>
{(context) => <Component {...props} {...pick(context, values)} />}
</TypeaheadContext.Consumer>
);
export default TypeaheadContext;
| import {noop, pick} from 'lodash';
import createReactContext from 'create-react-context';
import React from 'react';
const TypeaheadContext = createReactContext({
activeIndex: -1,
hintText: '',
initialItem: null,
isOnlyResult: false,
onActiveItemChange: noop,
onAdd: noop,
onInitialItemChange: noop,
onMenuItemClick: noop,
selectHintOnEnter: false,
});
export const withContext = (Component, values) => {
// Note: Use a class instead of function component to support refs.
/* eslint-disable-next-line react/prefer-stateless-function */
return class extends React.Component {
render() {
return (
<TypeaheadContext.Consumer>
{(context) => (
<Component {...this.props} {...pick(context, values)} />
)}
</TypeaheadContext.Consumer>
);
}
};
};
export default TypeaheadContext;
| Use class instead of stateless component in `withContext` | Use class instead of stateless component in `withContext`
| JavaScript | mit | ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead | ---
+++
@@ -14,10 +14,20 @@
selectHintOnEnter: false,
});
-export const withContext = (Component, values) => (props) => (
- <TypeaheadContext.Consumer>
- {(context) => <Component {...props} {...pick(context, values)} />}
- </TypeaheadContext.Consumer>
-);
+export const withContext = (Component, values) => {
+ // Note: Use a class instead of function component to support refs.
+ /* eslint-disable-next-line react/prefer-stateless-function */
+ return class extends React.Component {
+ render() {
+ return (
+ <TypeaheadContext.Consumer>
+ {(context) => (
+ <Component {...this.props} {...pick(context, values)} />
+ )}
+ </TypeaheadContext.Consumer>
+ );
+ }
+ };
+};
export default TypeaheadContext; |
5f9a7836146062c94ce08b98db2705c2bab10e34 | Kwf_js/Viewport.js | Kwf_js/Viewport.js |
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
}
}, this);
return ret;
}
});
Kwf.Viewport = Ext2.extend(Kwf.ViewportWithoutMenu, {
initComponent: function()
{
Kwf.menu = Ext2.ComponentMgr.create({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.items.push({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.layout = 'border';
Kwf.Viewport.superclass.initComponent.call(this);
}
});
|
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
}
}, this);
return ret;
}
});
Kwf.Viewport = Ext2.extend(Kwf.ViewportWithoutMenu, {
initComponent: function()
{
Kwf.menu = Ext2.ComponentMgr.create({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.items.push(Kwf.menu);
this.layout = 'border';
Kwf.Viewport.superclass.initComponent.call(this);
}
});
| Fix Menu reload after re-login | Fix Menu reload after re-login
This bug existed for ages. After re-login there always was this 'this.tr is undefined' error.
Problem was that two menu objects where created and the one actually rendered was not set to Kwf.menu. That caused the reload for the wrong object.
| JavaScript | bsd-2-clause | nsams/koala-framework,koala-framework/koala-framework,kaufmo/koala-framework,kaufmo/koala-framework,koala-framework/koala-framework,kaufmo/koala-framework,nsams/koala-framework,nsams/koala-framework | ---
+++
@@ -22,11 +22,7 @@
region: 'north',
height: 30
});
- this.items.push({
- xtype: 'kwf.menu',
- region: 'north',
- height: 30
- });
+ this.items.push(Kwf.menu);
this.layout = 'border';
Kwf.Viewport.superclass.initComponent.call(this);
} |
3ce6ed46cb1da34e631abc6bda5fd9f15ae4f53a | html/main.js | html/main.js |
var ProtoBuf = dcodeIO.ProtoBuf;
var Builder = ProtoBuf.loadProtoFile("proto/ClientMessage.proto");
ProtoBuf.loadProtoFile("proto/Login.proto", Builder);
var Message = Builder.build("msg");
var ClientMessage = Message.ClientMessage;
var LoginMessage = Message.Login;
var loginMsg = new LoginMessage("integr@gmail.com","secret");
var clientMsg = new ClientMessage({
"msgType" : "LoginType",
"login":{
"email":"integr@gmail.com", "password":"secret"}});
var ws;
window.onload=function(){
ws=new WebSocket("ws://localhost:8080/index");
ws.onmessage = function(evt) {
console.log(evt.data);
var loginFormSection = document.getElementById("loginFormSection");
if(evt.data == "AUTHPLS") {
loginFormSection.style.display = "block";
}
if(evt.data == "AUTHOKTHX") {
loginFormSection.style.display = "none";
document.getElementById("portal").style.display = "block";
}
};
ws.onopen=function(evt){
// ws.send("Hello");
ws.send(clientMsg.toArrayBuffer());
};
};
window.onclose=function(){
ws.close();
};
function loginSubmitEvent () {
var email = document.getElementById("loginEmail").value;
var password = document.getElementById("loginPassword").value;
ws.send(email + ":" + password);
}
|
var ProtoBuf = dcodeIO.ProtoBuf;
var Builder = ProtoBuf.loadProtoFile("proto/ClientMessage.proto");
ProtoBuf.loadProtoFile("proto/Login.proto", Builder);
var Message = Builder.build("msg");
var ClientMessage = Message.ClientMessage;
var LoginMessage = Message.Login;
var loginMsg = new LoginMessage("integr@gmail.com","secret");
var clientMsg = new ClientMessage({
"msgType" : "LoginType",
"login":{
"email":"integr@gmail.com", "password":"secret"}});
var ws;
window.onload=function(){
ws=new WebSocket("ws://localhost:8080/index");
ws.onmessage = function(evt) {
console.log(evt.data);
var loginFormSection = document.getElementById("loginFormSection");
if(evt.data == "AUTHPLS") {
loginFormSection.style.display = "block";
}
if(evt.data == "AUTHOKTHX") {
loginFormSection.style.display = "none";
document.getElementById("portal").style.display = "block";
}
};
ws.onopen=function(evt){
// ws.send("Hello");
for(i = 0; i < 1000; i++) {
ws.send(clientMsg.toArrayBuffer());
}
};
};
window.onclose=function(){
ws.close();
};
function loginSubmitEvent () {
var email = document.getElementById("loginEmail").value;
var password = document.getElementById("loginPassword").value;
ws.send(email + ":" + password);
}
| Send 1k messages on startup for testing. | Send 1k messages on startup for testing.
| JavaScript | mit | mjgerdes/cg,mjgerdes/cg,mjgerdes/cg,mjgerdes/cg | ---
+++
@@ -38,7 +38,9 @@
ws.onopen=function(evt){
// ws.send("Hello");
+ for(i = 0; i < 1000; i++) {
ws.send(clientMsg.toArrayBuffer());
+ }
};
};
|
d7505d1c5497192c8768bf5da3a0f8d585717241 | src/server/db/mongoHelper.js | src/server/db/mongoHelper.js | const mongoose = require('mongoose');
const Grid = require('gridfs-stream');
const mongoURI = process.env.MONGODB_URI || process.env.MONGOHQ_URL;
mongoose.Promise = Promise;
mongoose.connect(mongoURI, { useMongoClient: true });
const mongoHelper = {
init() {
const connection = mongoose.createConnection(mongoURI, { useMongoClient: true });
connection.once('open', () => {
mongoHelper.gridfs = Grid(connection.db, mongoose.mongo);
});
},
gridfs: undefined,
};
module.exports = mongoHelper;
| const mongoose = require('mongoose');
const Grid = require('gridfs-stream');
const mongoURI = process.env.MONGODB_URI || process.env.MONGOHQ_URL;
mongoose.Promise = Promise;
mongoose.connect(mongoURI);
const mongoHelper = {
init() {
const connection = mongoose.createConnection(mongoURI);
connection.once('open', () => {
mongoHelper.gridfs = Grid(connection.db, mongoose.mongo);
});
},
gridfs: undefined,
};
module.exports = mongoHelper;
| Revert "fix deprecated mongoose methods" | Revert "fix deprecated mongoose methods"
This reverts commit 4dce797
| JavaScript | mit | r3dDoX/geekplanet,r3dDoX/geekplanet,r3dDoX/geekplanet | ---
+++
@@ -3,11 +3,11 @@
const mongoURI = process.env.MONGODB_URI || process.env.MONGOHQ_URL;
mongoose.Promise = Promise;
-mongoose.connect(mongoURI, { useMongoClient: true });
+mongoose.connect(mongoURI);
const mongoHelper = {
init() {
- const connection = mongoose.createConnection(mongoURI, { useMongoClient: true });
+ const connection = mongoose.createConnection(mongoURI);
connection.once('open', () => {
mongoHelper.gridfs = Grid(connection.db, mongoose.mongo);
}); |
f69040c9d2b21491e33a9676a68ce20d97787ab4 | test/load.js | test/load.js | process.env.TZ = "America/Los_Angeles";
var smash = require("smash"),
jsdom = require("jsdom");
require("./XMLHttpRequest");
module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
sandbox = null;
files.unshift("src/start");
files.push("src/end");
function topic() {
smash.load(files, expression, sandbox, this.callback);
}
topic.expression = function(_) {
expression = _;
return topic;
};
topic.document = function(_) {
var document = jsdom.jsdom("<html><head></head><body></body></html>");
// Monkey-patch createRange support to JSDOM.
document.createRange = function() {
return {
selectNode: function() {},
createContextualFragment: jsdom.jsdom
};
};
sandbox = {
console: console,
XMLHttpRequest: XMLHttpRequest,
document: document,
window: document.createWindow(),
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Date: Date // so we can override Date.now in tests
};
return topic;
};
return topic;
};
process.on("uncaughtException", function(e) {
console.trace(e.stack);
});
| process.env.TZ = "America/Los_Angeles";
var smash = require("smash"),
jsdom = require("jsdom");
require("./XMLHttpRequest");
module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
sandbox = {Date: Date}; // so we can use deepEqual in tests
files.unshift("src/start");
files.push("src/end");
function topic() {
smash.load(files, expression, sandbox, this.callback);
}
topic.expression = function(_) {
expression = _;
return topic;
};
topic.document = function(_) {
var document = jsdom.jsdom("<html><head></head><body></body></html>");
// Monkey-patch createRange support to JSDOM.
document.createRange = function() {
return {
selectNode: function() {},
createContextualFragment: jsdom.jsdom
};
};
sandbox = {
console: console,
XMLHttpRequest: XMLHttpRequest,
document: document,
window: document.createWindow(),
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Date: Date // so we can override Date.now in tests, and use deepEqual
};
return topic;
};
return topic;
};
process.on("uncaughtException", function(e) {
console.trace(e.stack);
});
| Fix time tests by adding Date to sandbox. | Fix time tests by adding Date to sandbox.
Since tests are now run in their own sandbox, assert.deepEqual was not
properly testing the returned Date objects for equality, as they weren't
instances of the same Date class used by the test itself, causing type
inference to fail. It was always returning true, even for different
dates.
| JavaScript | bsd-3-clause | josealbertohm/d3,nishant8BITS/d3,Limky/d3,Jonathan-S-Phillips/d3,welloncn/d3,azilnoor/d3,mujiatong/d3,lijanele/d3,xiaojie123/d3,Sigfried/d3,madlen99/d3,jordancheah/d3,pradeeptas/d3,ornelaxh/d3,zhoux10/d3,Vardhan17/d3,zzzzw/d3,makenti/d3,Ali925/d3,aihua/d3,ishang27/d3,li0t/d3,nicgallardo/d3,mountwe/d34kpor,w124384389/d3,clarinete/d3,supriyantomaftuh/d3,ABaldwinHunter/d3,liang42hao/d3,kewal07/d3,whoinlee/d3,CallAnotherBarry/d3,burakkp/d3,kpcorda/d3,fsaglam2002/d3,ThinkedCoder/d3,abhuzz/d3,mainelander/d3,lunyang/d3,ssrx17/d3,Eric-Zhong/d3,atsolakid/d3,nonconforme/d3,lauraweaver/d3,idkwim/d3,angeliaz/d3,s-a-r-id/d3,JunichiWatanuki/d3,bestwpw/d3,christianevans214/d3,tempbottle/d3,standino/go-easy-portal,larskris/d3,kjeldandersen/d3,codingang/d3-1,charlesDADI/d3,danforthdesign/d3,geoff111/d3,s-a-r-id/d3,ZhuLiangwh/d3,roma07/d3,n1n9-jp/d3,aljachimiak/d3,nitishmadhukar/d3,aluck19/d3,house-fiction/d3,sk187/d3,yuanzhiqian/d3,jessiejea/d3,fredlang/d3,hqren/d3,smartinsantos/d3,MeganBeneteau/d3,RacingTadpole/d3,HardlyHaki/d3,lihanhui/d3,Petah/d3,dbirchak/d3,agarbuno/d3,okierie/d3,kaijie/d3,keyanzhang/d3,halcyonstar/d3,marianbida/d3,evdevgit/d3,vp2177/d3,buzybee83/d3,fatmazaman/d3,Petermuturi/d3,ABaldwinHunter/d3-classic,humanrelationships/d3,AromaR/d3,lukeskip/d3,cbtpro/d3,house-fiction/d3,supriyantomaftuh/d3,wangjun/d3,reynoldqi/TestFirst,ammula88/d3,sajeetharan/d3,Hbl15/d3,Ahmad-Hilali/d3,shaximinion/d3,DagoCIMA/Prueba1,kyroskoh/d3,berlynhubler/d3,keyanzhang/d3,Hbl15/d3,johnnyg3p/d3,ammula88/d3,ishang27/d3,leeleo26/d3,yuhualingfeng/d3,emirhartato/d3,kidaa/d3,wallmarkets/d3,jakimhartford/d3,stity/d3,radovanx/d3,nicksrandall/d3,kyoungchinseo/d3,GibbleBots/d3,xujie-nm/d3,npmcomponent/mbostock-d3,makenti/d3,hillaryskye/d3,behzad88/d3,AromaR/d3,AndBicScadMedia/d3,xiaochen0620/d3,hgarnelo/d3,anusornc/d3,markpj1/d3,Limky/d3,dongnhut/d3,ilovezy/d3,jessiejea/d3,trinath3/d3,ayshaabbas/d3,mountwe/d34kpor,johnochs/d3,radovanx/d3,JungMinu/d3,Acker2015/d3,allenjin/d3,8DTechnologies/d3,nbende/d3,burakkp/d3,ilo10/d3,Jonham/d3,onlyyouandty/d3,lypzln/d3,triggerThis/d3,ralic/d3,leohmoraes/d3,studiowangfei/d3,AlpinHologramm/d3,mendax-grip/d3,Teino1978-Corp/Teino1978-Corp-d3,woshiniuren/d3,smartpcr/d3,joehannes-libs/d3,liang42hao/d3,evdevgit/d3,chaoallsome/d3,salambolog/d3,tempbottle/d3,Sachin-Ganesh/d3,onlyyouandty/d3,okierie/d3,Henrilin28/d3,fatmazaman/d3,HomeMango/d3,Ali925/d3,XueQian/d3,nitishmadhukar/d3,UpstatePedro/d3,m-br/d3,iamcap/d3,Shuffguy/d3,VirosaLi/d3,guangyue/d3,mlawry/d3,nheinzer1210/d3,reiaaoyama/d3,batnasan06/d3,UmarMughal/d3,gyenumula/d3,Ahmad-Hilali/d3,nishant8BITS/d3,moodboom/d3,youprofit/d3,aihua/d3,edktsnr/d3,supzann3/d3,KevinMarkVI/d3,Petermuturi/d3,nirajvora/d3,JeebsM/d3,nbende/d3,1174751315/d3,ananya77041/d3,mssjtxwd/d3,guangyue/d3,Shuffguy/d3,2947721120/redolent-hockeypuck,mingyaaaa/d3,emmanuelq2/d3,MilkXin/dingTalk,monoc44/d3,UpstatePedro/d3,latur19318/d3,2947721120/redolent-hockeypuck,chenflat/d3,boshika/d3,peterwu8/d3,allenjin/d3,gorcz/d3,UmarMughal/d3,itxd/d3,xuzhaokui/d3,monoc44/d3,larskris/d3,taylorhxu/d3,salamer/d3,aigouzz/d3,qodbtn41/d3,JungMinu/d3,VirosaLi/d3,Simon-Lau/d3,juliaty/d3,moodboom/d3,nilqed/d3,eaglesjava/d3,leitzler/d3,smartpcr/d3,jordancheah/d3,ABaldwinHunter/d3,Eric-Zhong/d3,FangMath/d3,fredlang/d3,ilovezy/d3,patrickkillalea/d3,macressler/d3,kiwizhang/d3,chenflat/d3,maureenwaitherero/d3,MartinDavila/d3,macressler/d3,lukeskip/d3,hqren/d3,kx1911/d3,gorcz/d3,jakimhartford/d3,lovewitty/d3,sigma-random/d3,3mao/d3,RCGTDev/d3,shashi-dokania/d3,polzak/d3,folpindo/d3,LikeGit-2013/d3,JoaquinSiabra/d3,marianbida/d3,kaijie/d3,emmanuelq2/d3,trankmichael/d3,Wombatpm/d3,sunios/d3,awdesch/d3,imshibaji/d3,chiu/d3,LikeGit-2013/d3,emirhartato/d3,rlugojr/d3,supzann3/d3,Lchchen/d3,wallmarkets/d3,amccartney/d3,Sachin-Ganesh/d3,ansjcy/d3,chewett/d3,kitlomerc/d3,FredrikAhlberg/IconLiveD3.js,DataVizApril/d3,stefwalter/d3,darshanhs90/d3,erhanBLC/d3,zicouser/d3,fsaglam2002/d3,mattcale7/d3,studiowangfei/d3,lauraweaver/d3,markengelstad/d3,madlen99/d3,teefresh/d3,ansjcy/d3,vp2177/d3,cool-Blue/d3,amccartney/d3,suezse/d3,aaron-goshine/d3,anant10/dinto,sysexits/d3,aleksa000777/d3,mhsmith/d3,nicksrandall/d3,li0t/d3,smartinsantos/d3,MartinDavila/d3,alex-zhang/d3,Jonekee/d3,christianevans214/d3,JoaquinSiabra/d3,rubenv/d3,Simon-Lau/d3,oanaradulescu/d3,boshika/d3,XiqianZ/d3,joycedelatorre/d3,excelwang/d3,chaoallsome/d3,clayzermk1/d3,MeganBeneteau/d3,trinath3/d3,jeanpan/d3,ZhuLiangwh/d3,datawrapper/d3-light,imshibaji/d3,3mao/d3,chen-ben/d3,johnochs/d3,2947721120/squealing-octo-capsicum,alexgarciac/d3,forkmsrini/d3,quevedin/d3,n1n9-jp/d3,xc145214/d3,tessafallon/nypl-pg,jsan4christ/d3,yuanzhiqian/d3,bestwpw/d3,10000TB/d3,welloncn/d3,Tinysymphony/d3,CrandellWS/d3,uetsujitomoya/d3,dongnhut/d3,dogobox/d3,ayadoguchi/d3_practice,kevinresol/d3,CallAnotherBarry/d3,kx1911/d3,nheinzer1210/d3,dushmis/d3,caseytrombley/d3,10000TB/d3,kingland/d3,Acker2015/d3,hyrole/d3,xuzhaokui/d3,oanaradulescu/d3,kpcorda/d3,joycedelatorre/d3,iyogeshjoshi/d3,sysexits/d3,danforthdesign/d3,abhuzz/d3,suezse/d3,hillaryskye/d3,Petah/d3,mssjtxwd/d3,kitlomerc/d3,matheosu/d3,FangMath/d3,salamer/d3,ClaireRutkoske/d3,GibbleBots/d3,lrinili/d3,abgaryanharutyun/d3,darshanhs90/d3,iorikiir/d3,datawrapper/d3-light,angeliaz/d3,ChaofengZhou/d3,alex-zhang/d3,DagoCIMA/Prueba1,ykominami/d3,littlstar/d3,awdesch/d3,2947721120/squealing-octo-capsicum,xujie-nm/d3,nirajvora/d3,kyoungchinseo/d3,caseytrombley/d3,lunyang/d3,batnasan06/d3,dieface/d3,jsan4christ/d3,elpoisterio/d3,ssrx17/d3,krystism/d3,Ossehoht/d3,hkjels/d3,elpoisterio/d3,roma07/d3,kjeldandersen/d3,larskotthoff/d3,iyogeshjoshi/d3,mssyogi/d3,aleksa000777/d3,kennethd/d3,littlstar/d3,ABaldwinHunter/d3-classic,manashmndl/d3,amorwilliams/d3,idkwim/d3,leeleo26/d3,bqevin/d3,kbarnhart/d3,jeanpan/d3,mlawry/d3,1174751315/d3,navjotahuja92/d3,okcd00/d3,aigouzz/d3,datawrapper/d3-light,davidvmckay/d3,buzybee83/d3,KevinMarkVI/d3,woshiniuren/d3,fsanchezro/d3,rohittiwarirvt/d3,wangjun/d3,zicouser/d3,leohmoraes/d3,elkingtonmcb/d3,elancom/d3,uetsujitomoya/d3,julialintern/d3,latur19318/d3,danbwhiting/d3,Jonham/d3,Jonathan-S-Phillips/d3,chen-ben/d3,Naomifh/moboshock,nilqed/d3,kyroskoh/d3,nirmalks/d3,josealbertohm/d3,hyrole/d3,itxd/d3,ee08b397/d3,diazmartin/d3,mssyogi/d3,18Shubhamgupta/d3,codingang/d3-1,amorwilliams/d3,xc145214/d3,overmind1980/d3,bsipocz/d3,folpindo/d3,danbwhiting/d3,Lyoneidas/d3,jamesgarfield/d3,teefresh/d3,salambolog/d3,Jonekee/d3,witcxc/d3,Jai-Chaudhary/d3,alexgarciac/d3,okcd00/d3,aljachimiak/d3,whoinlee/d3,18Shubhamgupta/d3,standino/go-easy-portal,standino/go-easy-portal,d3/d3,halcyonstar/d3,lovewitty/d3,AndBicScadMedia/d3,Lyoneidas/d3,leitzler/d3,AlpinHologramm/d3,cool-Blue/d3,mattcale7/d3,jamesblunt/d3,aluck19/d3,DataVizApril/d3,ornelaxh/d3,mayblue9/d3,alex179ohm/d3,joehannes-libs/d3,sigma-random/d3,SystemicEmotions/d3,elkingtonmcb/d3,kevinresol/d3,larskotthoff/d3,kewal07/d3,sk187/d3,XueQian/d3,clarinete/d3,yuhualingfeng/d3,Sigfried/d3,qqqlllyyyy/d3,alex179ohm/d3,ThinkedCoder/d3,qodbtn41/d3,ee08b397/d3,diazmartin/d3,atsolakid/d3,stefanom/d3,patrickkillalea/d3,esparza83/d3,kaktus40/d3,julialintern/d3,standino/go-easy-portal,stefwalter/d3,youprofit/d3,hubandbob/d3,zhoux10/d3,kennethd/d3,edktsnr/d3,JunichiWatanuki/d3,jamesgarfield/d3,shaximinion/d3,ferrero-zhang/d3,omarbenites/d3,mainelander/d3,zzzzw/d3,nicgallardo/d3,Teino1978-Corp/Teino1978-Corp-d3,JeebsM/d3,SystemicEmotions/d3,RCGTDev/d3,ClaireRutkoske/d3,quevedin/d3,rubenv/d3,m4s0/d3,sunios/d3,dogobox/d3,v11yu/d3,ptkeller/d3,omarbenites/d3,kidaa/d3,HardlyHaki/d3,dbirchak/d3,manashmndl/d3,polzak/d3,markpj1/d3,ayshaabbas/d3,azilnoor/d3,KehindeAyanleye/d3,kbarnhart/d3,nirmalks/d3,jling90/d3,berlynhubler/d3,reynoldqi/TestFirst,mingyaaaa/d3,krystism/d3,nonconforme/d3,overmind1980/d3,geoff111/d3,mhsmith/d3,juliaty/d3,abgaryanharutyun/d3,Tinysymphony/d3,pradeeptas/d3,clayzermk1/d3,m4s0/d3,mayblue9/d3,xiaojie123/d3,anant10/dinto,bqevin/d3,hgarnelo/d3,esparza83/d3,lypzln/d3,vinicius5581/d3,sajeetharan/d3,stefanom/d3,dieface/d3,maureenwaitherero/d3,trankmichael/d3,lijanele/d3,ralic/d3,hkjels/d3,shashi-dokania/d3,v11yu/d3,Lchchen/d3,aaronhoffman/d3,hubandbob/d3,qqqlllyyyy/d3,vinicius5581/d3,Yelp/d3,lihanhui/d3,matheosu/d3,ferrero-zhang/d3,bsipocz/d3,rohittiwarirvt/d3,fsanchezro/d3,reiaaoyama/d3,staceb/d3,jamesblunt/d3,402332509/d3,Vardhan17/d3,jling90/d3,Genie77998/d3,taylorhxu/d3,ChaofengZhou/d3,triggerThis/d3,ptkeller/d3,peterwu8/d3,elancom/d3,anusornc/d3,markengelstad/d3,futuraprime/d3,XiqianZ/d3,Ossehoht/d3,xudongcamsys/d3,Genie77998/d3,ykominami/d3,mujiatong/d3,402332509/d3,iorikiir/d3,CrandellWS/d3,KehindeAyanleye/d3,futuraprime/d3,stity/d3,w124384389/d3,forkmsrini/d3,behzad88/d3,kiwizhang/d3,DaEunPark/d3,excelwang/d3,lrinili/d3,ananya77041/d3,cbtpro/d3,gyenumula/d3,tessafallon/nypl-pg,8DTechnologies/d3,HomeMango/d3,tessafallon/nypl-pg,xiaochen0620/d3,charlesDADI/d3,m-br/d3,chiu/d3,ilo10/d3,mendax-grip/d3,johnnyg3p/d3,suryasingh/d3 | ---
+++
@@ -8,7 +8,7 @@
module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
- sandbox = null;
+ sandbox = {Date: Date}; // so we can use deepEqual in tests
files.unshift("src/start");
files.push("src/end");
@@ -40,7 +40,7 @@
window: document.createWindow(),
setTimeout: setTimeout,
clearTimeout: clearTimeout,
- Date: Date // so we can override Date.now in tests
+ Date: Date // so we can override Date.now in tests, and use deepEqual
};
return topic; |
3425cb4aedf0a0c2160ea63f550bfd0f0de6d19d | ghost/admin/routes/editor.js | ghost/admin/routes/editor.js | import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var EditorRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['editor'],
controllerName: 'posts.post',
model: function (params) {
return this.store.find('post', params.post_id);
}
});
export default EditorRoute;
| import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var EditorRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['editor'],
controllerName: 'posts.post',
model: function (params) {
var post = this.store.getById('post', params.post_id);
if (post) {
return post;
}
return this.store.filter('post', { status: 'all' }, function (post) {
return post.get('id') === params.post_id;
}).then(function (records) {
return records.get('firstObject');
});
}
});
export default EditorRoute;
| Fix Editor/:postId 404 on draft | Fix Editor/:postId 404 on draft
closes #2857
- in EditorRoute, get model from the datastore if it's there
- if page is refreshed, get model from `/posts` API with `{status: 'all'}`
| JavaScript | mit | TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost | ---
+++
@@ -5,7 +5,17 @@
classNames: ['editor'],
controllerName: 'posts.post',
model: function (params) {
- return this.store.find('post', params.post_id);
+ var post = this.store.getById('post', params.post_id);
+
+ if (post) {
+ return post;
+ }
+
+ return this.store.filter('post', { status: 'all' }, function (post) {
+ return post.get('id') === params.post_id;
+ }).then(function (records) {
+ return records.get('firstObject');
+ });
}
});
|
116808327ac226934af7cd48ac8336d16e602af7 | addon/mixins/component-lookup-mixin.js | addon/mixins/component-lookup-mixin.js | import Ember from 'ember';
export default Ember.Mixin.create({
componentFor(name, owner) {
let component = this._super(name, owner);
// Ensure components are always managed my the container and thus have a connection to their styles
if (!component) {
owner.register(`component:${name}`, Ember.Component);
component = this._super(name, owner);
}
return component;
}
});
| import Ember from 'ember';
export default Ember.Mixin.create({
componentFor(name, owner) {
let component = this._super(name, owner);
// Ensure components are always managed my the container and thus have a connection to their styles
if (!component) {
if (owner.register) {
owner.register(`component:${name}`, Ember.Component);
} else {
owner._registry.register(`component:${name}`, Ember.Component); // Support for Ember 2.0.X
}
component = this._super(name, owner);
}
return component;
}
});
| Fix error in Ember 2.0 | Fix error in Ember 2.0
| JavaScript | mit | salsify/ember-css-modules,salsify/ember-css-modules | ---
+++
@@ -6,7 +6,11 @@
// Ensure components are always managed my the container and thus have a connection to their styles
if (!component) {
- owner.register(`component:${name}`, Ember.Component);
+ if (owner.register) {
+ owner.register(`component:${name}`, Ember.Component);
+ } else {
+ owner._registry.register(`component:${name}`, Ember.Component); // Support for Ember 2.0.X
+ }
component = this._super(name, owner);
}
|
49d0f365e0a2da4ab9ba2c571806229052a8cc83 | app/webpack/entities/circleBurger/Door.js | app/webpack/entities/circleBurger/Door.js | import NormalDoor from 'entities/Door';
import state from 'state';
import finish from 'finish';
import action from 'action';
import { changeScene } from 'currentScene';
import entrance from 'scenes/circleBurger/entrance';
export default class Door extends NormalDoor {
actions() {
return [
action(this.actionName, () => {
changeScene(this.destination);
state.currentTime.add(Math.floor((Math.random() * 5) + 1), 'minutes');
}),
action("Lock the door. (This ends the game. You can't go back.)", () => {
state.doorLocked = true;
if (this.destination === entrance) {
state.lockedIn = true;
}
if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
state.closedEarly = true;
}
if (state.currentTime.isAfter(
state.closingTime.clone().add(1, 'hour')
)) {
state.closedLate = true;
}
finish();
})
];
}
};
| import NormalDoor from 'entities/Door';
import state from 'state';
import finish from 'finish';
import action from 'action';
import { changeScene } from 'currentScene';
import entrance from 'scenes/circleBurger/entrance';
export default class Door extends NormalDoor {
actions() {
return [
action(this.actionName, () => {
changeScene(this.destination);
state.currentTime.add(Math.floor((Math.random() * 5) + 1), 'minutes');
}),
action("Lock the door. (This ends the game. You can't go back.)", () => {
if(confirm("Closing the Circle Burger ends the day.\n\nAre you sure you've done enough to keep your job?")) {
state.doorLocked = true;
if (this.destination === entrance) {
state.lockedIn = true;
}
if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
state.closedEarly = true;
}
if (state.currentTime.isAfter(
state.closingTime.clone().add(1, 'hour')
)) {
state.closedLate = true;
}
finish();
}
})
];
}
};
| Add confirm on end game door | Add confirm on end game door
| JavaScript | mit | TEAMBUTT/LD35 | ---
+++
@@ -14,23 +14,25 @@
}),
action("Lock the door. (This ends the game. You can't go back.)", () => {
- state.doorLocked = true;
+ if(confirm("Closing the Circle Burger ends the day.\n\nAre you sure you've done enough to keep your job?")) {
+ state.doorLocked = true;
- if (this.destination === entrance) {
- state.lockedIn = true;
+ if (this.destination === entrance) {
+ state.lockedIn = true;
+ }
+
+ if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
+ state.closedEarly = true;
+ }
+
+ if (state.currentTime.isAfter(
+ state.closingTime.clone().add(1, 'hour')
+ )) {
+ state.closedLate = true;
+ }
+
+ finish();
}
-
- if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
- state.closedEarly = true;
- }
-
- if (state.currentTime.isAfter(
- state.closingTime.clone().add(1, 'hour')
- )) {
- state.closedLate = true;
- }
-
- finish();
})
];
} |
a5d2080045c34b23e53b3da5798b806293cd4d9b | core/app/assets/javascripts/backbone/views/fact_relation_view.js | core/app/assets/javascripts/backbone/views/fact_relation_view.js | window.FactRelationView = Backbone.View.extend({
tagName: "li",
className: "fact-relation",
events: {
"click .relation-actions>.weakening": "disbelieveFactRelation",
"click .relation-actions>.supporting": "believeFactRelation"
},
initialize: function() {
this.useTemplate('fact_relations','fact_relation');
this.model.bind('destroy', this.remove, this);
this.model.bind('change', this.render, this);
},
remove: function() {
this.$el.fadeOut('fast', function() {
this.$el.remove();
});
},
render: function() {
this.$el.html(Mustache.to_html(this.tmpl, this.model.toJSON(), this.partials)).factlink();
$('a.supporting',this.$el).tooltip({'title':"This is relevant"});
$('a.weakening',this.$el).tooltip({'title':"This is not relevant", 'placement':'bottom'});
return this;
},
disbelieveFactRelation: function() {
this.model.disbelieve();
},
believeFactRelation: function() {
this.model.believe();
},
highlight: function() {
var self = this;
self.$el.animate({"background-color": "#ffffe1"}, {duration: 2000, complete: function() {
$(this).animate({"background-color": "#ffffff"}, 2000);
}});
}
});
| window.FactRelationView = Backbone.View.extend({
tagName: "li",
className: "fact-relation",
events: {
"click .relation-actions>.weakening": "disbelieveFactRelation",
"click .relation-actions>.supporting": "believeFactRelation"
},
initialize: function() {
this.useTemplate('fact_relations','fact_relation');
this.model.bind('destroy', this.remove, this);
this.model.bind('change', this.render, this);
},
remove: function() {
this.$el.fadeOut('fast', function() {
this.$el.remove();
});
},
render: function() {
$('a.weakening',this.$el).tooltip('hide');
$('a.supporting',this.$el).tooltip('hide');
this.$el.html(Mustache.to_html(this.tmpl, this.model.toJSON(), this.partials)).factlink();
$('a.supporting',this.$el).tooltip({'title':"This is relevant"});
$('a.weakening',this.$el).tooltip({'title':"This is not relevant", 'placement':'bottom'});
return this;
},
disbelieveFactRelation: function() {
this.model.disbelieve();
},
believeFactRelation: function() {
this.model.believe();
},
highlight: function() {
var self = this;
self.$el.animate({"background-color": "#ffffe1"}, {duration: 2000, complete: function() {
$(this).animate({"background-color": "#ffffff"}, 2000);
}});
}
});
| Make the tooltips hide when they are clicked. | Make the tooltips hide when they are clicked.
| JavaScript | mit | daukantas/factlink-core,Factlink/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core,Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core | ---
+++
@@ -21,7 +21,11 @@
},
render: function() {
+ $('a.weakening',this.$el).tooltip('hide');
+ $('a.supporting',this.$el).tooltip('hide');
+
this.$el.html(Mustache.to_html(this.tmpl, this.model.toJSON(), this.partials)).factlink();
+
$('a.supporting',this.$el).tooltip({'title':"This is relevant"});
$('a.weakening',this.$el).tooltip({'title':"This is not relevant", 'placement':'bottom'});
return this; |
c1c138acb4026af9173008dbf037f97fe4f19b9e | src/AppBundle/Resources/assets/javascripts/sticky.js | src/AppBundle/Resources/assets/javascripts/sticky.js | /*jshint browser: true */
(function () {
"use strict";
var root = this,
$ = root.jQuery,
body = $('body');
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }
var StickyHeader = function(element) {
this.top = $(element).offset().top - 30;
this.addEventHandlers();
};
StickyHeader.prototype.addEventHandlers = function () {
this.windowScrollHandler = this.getWindowScrollEventHandler();
window.onscroll = this.windowScrollHandler;
};
StickyHeader.prototype.getWindowScrollEventHandler = function () {
return function (e) {
this.handleWindowScroll($(e.target));
}.bind(this);
};
StickyHeader.prototype.handleWindowScroll = function () {
if (window.pageYOffset >= this.top) {
body.addClass('fixed');
} else {
body.removeClass('fixed');
}
};
root.GOVUK.StickyHeader = StickyHeader;
}).call(this);
| /*jshint browser: true */
(function () {
"use strict";
var root = this,
$ = root.jQuery,
body = $('body'),
mobileSafari = navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }
var StickyHeader = function(element) {
this.wrapper = $(element);
this.top = $(element).offset().top - 30;
this.addEventHandlers();
};
StickyHeader.prototype.addEventHandlers = function () {
this.windowScrollHandler = this.getWindowScrollEventHandler();
document.addEventListener("scroll", this.windowScrollHandler, false);
};
StickyHeader.prototype.getWindowScrollEventHandler = function () {
return function (e) {
this.handleWindowScroll($(e.target));
}.bind(this);
};
StickyHeader.prototype.handleWindowScroll = function () {
if (window.pageYOffset >= this.top) {
body.addClass('fixed');
// Mobile safari hides fixed elements when the keyboard is shown so use
// absolute instead.
if (mobileSafari) {
this.wrapper.css({
position: 'absolute',
top: window.pageYOffset + 'px',
left: 0
});
}
} else {
body.removeClass('fixed');
if (mobileSafari) {
this.wrapper.css({
position: 'static'
});
}
}
};
root.GOVUK.StickyHeader = StickyHeader;
}).call(this);
| Fix issue with Safari on IOS which caused the title to be hidden when entering data. | Fix issue with Safari on IOS which caused the title to be hidden when entering data.
| JavaScript | mit | ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client | ---
+++
@@ -1,32 +1,51 @@
/*jshint browser: true */
(function () {
"use strict";
-
+
var root = this,
$ = root.jQuery,
- body = $('body');
+ body = $('body'),
+ mobileSafari = navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }
var StickyHeader = function(element) {
+ this.wrapper = $(element);
this.top = $(element).offset().top - 30;
this.addEventHandlers();
};
StickyHeader.prototype.addEventHandlers = function () {
this.windowScrollHandler = this.getWindowScrollEventHandler();
- window.onscroll = this.windowScrollHandler;
+ document.addEventListener("scroll", this.windowScrollHandler, false);
};
StickyHeader.prototype.getWindowScrollEventHandler = function () {
return function (e) {
this.handleWindowScroll($(e.target));
}.bind(this);
};
+
StickyHeader.prototype.handleWindowScroll = function () {
if (window.pageYOffset >= this.top) {
body.addClass('fixed');
+
+ // Mobile safari hides fixed elements when the keyboard is shown so use
+ // absolute instead.
+ if (mobileSafari) {
+ this.wrapper.css({
+ position: 'absolute',
+ top: window.pageYOffset + 'px',
+ left: 0
+ });
+ }
+
} else {
body.removeClass('fixed');
+ if (mobileSafari) {
+ this.wrapper.css({
+ position: 'static'
+ });
+ }
}
};
|
222bf732b58e1f12b78c0c3aa2671d8993be8908 | http/assets/js/aside-menu.js | http/assets/js/aside-menu.js | 'use strict';
/**
* Open and close button for aside-menu
*/
$('show-aside-button').addEvent('click', function (event) {
// Get the aside current margin-left as integer
var asideMargin = parseInt($('aside-menu').getStyle('margin-left'));
/**
* Change aside margin to show or hide it
*/
$('aside-menu').setStyle(
'margin-left',
asideMargin === 0 ? '-18rem' : '0rem'
);
/**
* Change content width do adjust to fit on the side of aside
*/
$('content').setStyle(
'width',
asideMargin === 0 ? '100%' : 'calc(100% - 17rem)'
);
});
| 'use strict';
/**
* Change aside margin to show it
* Change content width do adjust to fit on the side of aside
*/
var showAside = (function() {
$('aside-menu').setStyle('margin-left', '0rem');
$('content').setStyle('width', 'calc(100% - 17rem)');
});
/**
* Change aside margin to hide it
* Change content width do adjust to fit on the side of aside
*/
var hideAside = (function() {
$('aside-menu').setStyle('margin-left', '-18rem');
$('content').setStyle('width', '100%');
});
/**
* Open and close button for aside-menu
*/
$('show-aside-button').addEvent('click', function (event) {
// Get the aside current margin-left as integer
var asideMargin = parseInt($('aside-menu').getStyle('margin-left'));
if (0 === asideMargin) {
hideAside();
return true;
}
showAside();
});
/**
* Catch all clicks on the content element, then check if we should close the
* aside or not.
*/
$('content').addEvent('click', function (event) {
var asideButtonVisible = $('show-aside-button').getStyle('display') === 'inline-block';
var asideVisible = parseInt($('aside-menu').getStyle('margin-left')) === 0;
if (false === asideButtonVisible && false === asideVisible) {
showAside();
}
if (true === asideButtonVisible && true === asideVisible) {
hideAside();
}
});
| Refactor and other ways to close the aside | Refactor and other ways to close the aside
| JavaScript | isc | etu/0bRSS,etu/0bRSS,etu/0bRSS | ---
+++
@@ -1,4 +1,28 @@
'use strict';
+
+
+
+/**
+ * Change aside margin to show it
+ * Change content width do adjust to fit on the side of aside
+ */
+var showAside = (function() {
+ $('aside-menu').setStyle('margin-left', '0rem');
+ $('content').setStyle('width', 'calc(100% - 17rem)');
+});
+
+
+
+/**
+ * Change aside margin to hide it
+ * Change content width do adjust to fit on the side of aside
+ */
+var hideAside = (function() {
+ $('aside-menu').setStyle('margin-left', '-18rem');
+ $('content').setStyle('width', '100%');
+});
+
+
/**
* Open and close button for aside-menu
@@ -7,19 +31,30 @@
// Get the aside current margin-left as integer
var asideMargin = parseInt($('aside-menu').getStyle('margin-left'));
- /**
- * Change aside margin to show or hide it
- */
- $('aside-menu').setStyle(
- 'margin-left',
- asideMargin === 0 ? '-18rem' : '0rem'
- );
+ if (0 === asideMargin) {
+ hideAside();
- /**
- * Change content width do adjust to fit on the side of aside
- */
- $('content').setStyle(
- 'width',
- asideMargin === 0 ? '100%' : 'calc(100% - 17rem)'
- );
+ return true;
+ }
+
+ showAside();
});
+
+
+
+/**
+ * Catch all clicks on the content element, then check if we should close the
+ * aside or not.
+ */
+$('content').addEvent('click', function (event) {
+ var asideButtonVisible = $('show-aside-button').getStyle('display') === 'inline-block';
+ var asideVisible = parseInt($('aside-menu').getStyle('margin-left')) === 0;
+
+ if (false === asideButtonVisible && false === asideVisible) {
+ showAside();
+ }
+
+ if (true === asideButtonVisible && true === asideVisible) {
+ hideAside();
+ }
+}); |
2c5953f6f7cb1c20ccada40ad3f41915b0e29c98 | npm-depends.js | npm-depends.js | #!/bin/env node
'use strict';
var agent = require('superagent');
var program = require('commander');
var semver = require('semver');
var name, version;
program
.version(require('./package.json').version)
.arguments('<name> <version>')
.action(function (name_, version_) {
name = name_;
version = version_;
})
.parse(process.argv);
// TODO shouldn't be needed, probably a bug in commander
if (!name) program.missingArgument('name');
if (!semver.valid(version)) {
console.error('invalid version number: ' + version);
process.exit(1);
}
var encodedName = encodeURIComponent(name);
var npmURL = 'https://skimdb.npmjs.com/registry/_design/app/_view/dependentVersions?startkey=%5B%22' + encodedName + '%22%5D&endkey=%5B%22' + encodedName + '%22%2C%7B%7D%5D&reduce=false';
agent.get(npmURL)
.set('Accept', 'application/json')
.end(function (error, response) {
if (error) {
throw error;
}
var packages = response.body.rows.filter(function (pack) {
return semver.satisfies(version, pack.key[1]);
}).map(function (pack) {
return pack.id;
});
if (packages.length) {
console.log(packages.join('\n'));
}
});
| #!/usr/bin/env node
'use strict';
var agent = require('superagent');
var program = require('commander');
var semver = require('semver');
var name, version;
program
.version(require('./package.json').version)
.arguments('<name> <version>')
.action(function (name_, version_) {
name = name_;
version = version_;
})
.parse(process.argv);
// TODO shouldn't be needed, probably a bug in commander
if (!name) program.missingArgument('name');
if (!semver.valid(version)) {
console.error('invalid version number: ' + version);
process.exit(1);
}
var encodedName = encodeURIComponent(name);
var npmURL = 'https://skimdb.npmjs.com/registry/_design/app/_view/dependentVersions?startkey=%5B%22' + encodedName + '%22%5D&endkey=%5B%22' + encodedName + '%22%2C%7B%7D%5D&reduce=false';
agent.get(npmURL)
.set('Accept', 'application/json')
.end(function (error, response) {
if (error) {
throw error;
}
var packages = response.body.rows.filter(function (pack) {
return semver.satisfies(version, pack.key[1]);
}).map(function (pack) {
return pack.id;
});
if (packages.length) {
console.log(packages.join('\n'));
}
});
| Correct shebang to use /usr/bin/env node. | Correct shebang to use /usr/bin/env node.
/bin/env is not the usual location for the shebang line. Instead use /usr/bin/env. | JavaScript | mit | targos/npm-depends | ---
+++
@@ -1,4 +1,4 @@
-#!/bin/env node
+#!/usr/bin/env node
'use strict';
|
fa59afebde57aff27c919e65222815b6497db8da | hyp-content-for.js | hyp-content-for.js | angular.module("hypContentFor", [])
.constant("HYP_CONTENT_FOR_IDS", [ ])
.directive("content", function (HYP_CONTENT_FOR_IDS) {
return {
scope: { "for": "@" },
transclude: true,
controller: function ($scope, $transclude) {
HYP_CONTENT_FOR_IDS[$scope["for"]] = $transclude();
}
};
})
.directive("yield", function ($interval, HYP_CONTENT_FOR_IDS) {
return {
scope: { to: "@" },
link: function (scope, elem) {
interval = null;
repeatFn = function () {
content = HYP_CONTENT_FOR_IDS[scope.to];
if (content) {
$interval.cancel(interval);
} else {
return;
}
elem.replaceWith(content);
}
repeatFn();
interval = $interval(repeatFn, 100, 9);
}
};
});
| angular.module("hypContentFor", [])
.value("HYP_CONTENT_FOR_IDS", { })
.directive("content", function () {
return {
scope: { "for": "@" },
transclude: true,
controller: function ($scope, $transclude, HYP_CONTENT_FOR_IDS) {
HYP_CONTENT_FOR_IDS[$scope["for"]] = $transclude();
}
};
})
.directive("yield", function ($interval, HYP_CONTENT_FOR_IDS) {
return {
scope: { to: "@" },
link: function (scope, elem) {
interval = null;
watchFn = function () { return HYP_CONTENT_FOR_IDS[scope.to]; };
scope.$watch(watchFn, function (newValue) {
elem.empty();
elem.append(newValue);
});
}
};
});
| Watch for changes on HYP_CONTENT_FOR_IDS | Watch for changes on HYP_CONTENT_FOR_IDS
| JavaScript | mit | hyperoslo/hyper-content-for-angular,hyperoslo/hyper-content-for-angular | ---
+++
@@ -1,13 +1,13 @@
angular.module("hypContentFor", [])
- .constant("HYP_CONTENT_FOR_IDS", [ ])
+ .value("HYP_CONTENT_FOR_IDS", { })
- .directive("content", function (HYP_CONTENT_FOR_IDS) {
+ .directive("content", function () {
return {
scope: { "for": "@" },
transclude: true,
- controller: function ($scope, $transclude) {
+ controller: function ($scope, $transclude, HYP_CONTENT_FOR_IDS) {
HYP_CONTENT_FOR_IDS[$scope["for"]] = $transclude();
}
};
@@ -20,20 +20,12 @@
link: function (scope, elem) {
interval = null;
- repeatFn = function () {
- content = HYP_CONTENT_FOR_IDS[scope.to];
+ watchFn = function () { return HYP_CONTENT_FOR_IDS[scope.to]; };
- if (content) {
- $interval.cancel(interval);
- } else {
- return;
- }
-
- elem.replaceWith(content);
- }
-
- repeatFn();
- interval = $interval(repeatFn, 100, 9);
+ scope.$watch(watchFn, function (newValue) {
+ elem.empty();
+ elem.append(newValue);
+ });
}
};
}); |
0e6ba9a3d53ec694c565273c9560ecf77485c010 | src/js/libs/load-new-data.js | src/js/libs/load-new-data.js | import getWeatherInfo from './get-weather-info';
import fetchRandomPhoto from './fetch-random-photo';
import { lessThanOneHourAgo, lessThan24HoursAgo } from './helpers';
/*
* Load the next image and update the weather
*/
const loadNewData = () => {
chrome.storage.sync.get('photoFrequency', result => {
const { photoFrequency } = result;
if (photoFrequency === 'newtab') {
fetchRandomPhoto();
return;
}
const nextImage = JSON.parse(localStorage.getItem('nextImage'));
if (
photoFrequency === 'everyhour' &&
!lessThanOneHourAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
return;
}
if (
photoFrequency === 'everyday' &&
!lessThan24HoursAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
}
});
chrome.storage.local.get('forecast', result => {
const { forecast } = result;
chrome.storage.sync.get('coords', d => {
const { coords } = d;
if (!forecast && coords) {
getWeatherInfo();
return;
}
if (forecast) {
const { timestamp } = forecast;
if (timestamp) {
if (!lessThanOneHourAgo(timestamp)) {
getWeatherInfo();
}
}
}
});
});
};
export default loadNewData;
| import getWeatherInfo from './get-weather-info';
import fetchRandomPhoto from './fetch-random-photo';
import { lessThanOneHourAgo, lessThan24HoursAgo } from './helpers';
/*
* Load the next image and update the weather
*/
const loadNewData = () => {
chrome.storage.sync.get('photoFrequency', result => {
const { photoFrequency } = result;
if (photoFrequency === 'newtab') {
fetchRandomPhoto();
return;
}
chrome.storage.local.get('nextImage', r => {
const { nextImage } = r;
if (
photoFrequency === 'everyhour' &&
!lessThanOneHourAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
return;
}
if (
photoFrequency === 'everyday' &&
!lessThan24HoursAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
}
});
});
chrome.storage.local.get('forecast', result => {
const { forecast } = result;
chrome.storage.sync.get('coords', d => {
const { coords } = d;
if (!forecast && coords) {
getWeatherInfo();
return;
}
if (forecast) {
const { timestamp } = forecast;
if (timestamp) {
if (!lessThanOneHourAgo(timestamp)) {
getWeatherInfo();
}
}
}
});
});
};
export default loadNewData;
| Change from local storage to chrome storage | Change from local storage to chrome storage
| JavaScript | mit | ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos | ---
+++
@@ -15,22 +15,24 @@
return;
}
- const nextImage = JSON.parse(localStorage.getItem('nextImage'));
+ chrome.storage.local.get('nextImage', r => {
+ const { nextImage } = r;
- if (
- photoFrequency === 'everyhour' &&
- !lessThanOneHourAgo(nextImage.timestamp)
- ) {
- fetchRandomPhoto();
- return;
- }
+ if (
+ photoFrequency === 'everyhour' &&
+ !lessThanOneHourAgo(nextImage.timestamp)
+ ) {
+ fetchRandomPhoto();
+ return;
+ }
- if (
- photoFrequency === 'everyday' &&
- !lessThan24HoursAgo(nextImage.timestamp)
- ) {
- fetchRandomPhoto();
- }
+ if (
+ photoFrequency === 'everyday' &&
+ !lessThan24HoursAgo(nextImage.timestamp)
+ ) {
+ fetchRandomPhoto();
+ }
+ });
});
chrome.storage.local.get('forecast', result => { |
f2875d45257f892607df8a460b253cd35fb0900a | config/http-get-param-interceptor.js | config/http-get-param-interceptor.js | 'use strict';
angular.module('gc.ngHttpGetParamInterceptor', [
'gc.utils'
]).factory('httpGetParamInterceptor', [
'utils',
function httpGetParamInterceptor(utils) {
function deleteUndefinedValues(obj) {
_.keys(obj).forEach(function(key) {
if (_.isUndefined(obj[key])) {
delete obj[key];
} else if (_.isObject(obj[key])) {
deleteUndefinedValues(obj[key]);
}
});
}
return {
request: function(config) {
// Manually build query params using custom logic because Angular and
// Rails do not handle nested query parameters in the same way
if (config.params) {
deleteUndefinedValues(config.params);
config.url = config.url + '?' + utils.param(config.params);
delete config.params;
}
return config;
}
};
}
]);
| 'use strict';
angular.module('gc.ngHttpGetParamInterceptor', [
'gc.utils'
]).factory('httpGetParamInterceptor', [
'utils',
function httpGetParamInterceptor(utils) {
return {
request: function(config) {
// Manually build query params using custom logic because Angular and
// Rails do not handle nested query parameters in the same way
if (config.params) {
config.url = config.url + '?' + utils.param(config.params);
delete config.params;
}
return config;
}
};
}
]);
| Revert "delete undefined properties from http config params" | Revert "delete undefined properties from http config params"
This reverts commit f52b94743e6539bf8088e773310359762b3d9cb5.
| JavaScript | mit | gocardless-ng/ng-gc-base-app-service | ---
+++
@@ -5,23 +5,11 @@
]).factory('httpGetParamInterceptor', [
'utils',
function httpGetParamInterceptor(utils) {
-
- function deleteUndefinedValues(obj) {
- _.keys(obj).forEach(function(key) {
- if (_.isUndefined(obj[key])) {
- delete obj[key];
- } else if (_.isObject(obj[key])) {
- deleteUndefinedValues(obj[key]);
- }
- });
- }
-
return {
request: function(config) {
// Manually build query params using custom logic because Angular and
// Rails do not handle nested query parameters in the same way
if (config.params) {
- deleteUndefinedValues(config.params);
config.url = config.url + '?' + utils.param(config.params);
delete config.params;
} |
0b3b4a73a06288627d6bb9e2c3f9d06bfad4fa18 | src/components/Brand/Brand.js | src/components/Brand/Brand.js | import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import Link from '../Link';
import s from './Brand.css';
function Brand(){
return (
<Link className={s.brand} to="//skoli.fr" rel="nofollow" target="_blank">Skoli</Link>
)
}
export default withStyles(s)(Brand);
| import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import Link from '../Link';
import s from './Brand.css';
function Brand(){
return (
<Link className={s.brand} to="http://skoli.fr" rel="nofollow" target="_blank">Skoli</Link>
)
}
export default withStyles(s)(Brand);
| Add http to skoli.fr link | Add http to skoli.fr link
| JavaScript | mit | Skoli-Code/DerangeonsLaChambre | ---
+++
@@ -6,7 +6,7 @@
function Brand(){
return (
- <Link className={s.brand} to="//skoli.fr" rel="nofollow" target="_blank">Skoli</Link>
+ <Link className={s.brand} to="http://skoli.fr" rel="nofollow" target="_blank">Skoli</Link>
)
}
|
6cbcdd143c822b6edefc28d8d70f123b0c53ea6d | tasks/remark.js | tasks/remark.js | 'use strict';
var remark = require('remark');
var engine = require('unified-engine');
module.exports = function(grunt) {
grunt.registerMultiTask('remark', 'Process markdown with remark', function() {
var done = this.async();
var globs = this.filesSrc;
var options = this.options({
processor: remark,
globs: globs,
extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
pluginPrefix: 'remark',
presetPrefix: 'remark-preset',
rcName: '.remarkrc',
packageField: 'remarkConfig',
ignoreName: '.remarkignore',
color: true
});
engine(options, function(err) {
if (err) grunt.fail.warn(err);
done();
});
});
};
| 'use strict';
var remark = require('remark');
var engine = require('unified-engine');
module.exports = function(grunt) {
grunt.registerMultiTask('remark', 'Process markdown with remark', function() {
var done = this.async();
var globs = this.filesSrc;
var options = this.options({
processor: remark,
globs: globs,
extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
pluginPrefix: 'remark',
presetPrefix: 'remark-preset',
rcName: '.remarkrc',
packageField: 'remarkConfig',
ignoreName: '.remarkignore',
color: true
});
engine(options, function(err, status) {
if (err || status) grunt.fail.warn(err || 'Unsuccessful running');
done();
});
});
};
| Allow failure based off run status | Allow failure based off run status
Add a default message when an error message is not passed
| JavaScript | mit | ChristianMurphy/grunt-remark | ---
+++
@@ -19,8 +19,8 @@
color: true
});
- engine(options, function(err) {
- if (err) grunt.fail.warn(err);
+ engine(options, function(err, status) {
+ if (err || status) grunt.fail.warn(err || 'Unsuccessful running');
done();
});
}); |
7dbf771b1ce636ab3991458c955f7e34e6e2207f | app.js | app.js | /*!
* AllOrigins
* written by Gabriel Nunes <gabriel@multiverso.me>
* http://github.com/gnuns
*/
const express = require('express')
const {version} = require('./package.json')
const processRequest = require('./app/process-request')
// yep, global. it's ok
// https://softwareengineering.stackexchange.com/a/47926/289420
global.AO_VERSION = version
const app = express()
app.set('case sensitive routing', false)
app.disable('x-powered-by')
app.use(enableCORS)
app.all('/:format', processRequest)
function enableCORS (req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin || '*')
res.header('Access-Control-Allow-Credentials', true)
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PATCH, PUT, DELETE')
res.header('Via', `allOrigins v${version}`)
next()
}
module.exports = app
| /*!
* AllOrigins
* written by Gabriel Nunes <gabriel@multiverso.me>
* http://github.com/gnuns
*/
const express = require('express')
const {version} = require('./package.json')
// yep, global. it's ok
// https://softwareengineering.stackexchange.com/a/47926/289420
global.AO_VERSION = version
const processRequest = require('./app/process-request')
const app = express()
app.set('case sensitive routing', false)
app.disable('x-powered-by')
app.use(enableCORS)
app.all('/:format', processRequest)
function enableCORS (req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin || '*')
res.header('Access-Control-Allow-Credentials', true)
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PATCH, PUT, DELETE')
res.header('Via', `allOrigins v${version}`)
next()
}
module.exports = app
| Define AO_VERSION before require process-request | Define AO_VERSION before require process-request
| JavaScript | mit | gnuns/AllOrigins | ---
+++
@@ -7,11 +7,11 @@
const express = require('express')
const {version} = require('./package.json')
-const processRequest = require('./app/process-request')
-
// yep, global. it's ok
// https://softwareengineering.stackexchange.com/a/47926/289420
global.AO_VERSION = version
+
+const processRequest = require('./app/process-request')
const app = express()
|
48c8c0d3ef20cfef5aeb946f89c09155804be4ed | app.js | app.js | RTC({
// use the public google stun servers :)
ice: [
{ url: 'stun1.l.google.com:19302' },
{ url: 'stun2.l.google.com:19302' },
{ url: 'stun3.l.google.com:19302' },
{ url: 'stun4.l.google.com:19302' }
],
// we want this to work on iOS as well so we will use
// the rtc-plugin-nicta-ios plugin so we can use the
// build.rtc.io to create a native iOS app
plugins: [ RTC.IOS ]
});
| var conference = RTC({
// use the public google stun servers :)
ice: [
{ url: 'stun1.l.google.com:19302' },
{ url: 'stun2.l.google.com:19302' },
{ url: 'stun3.l.google.com:19302' },
{ url: 'stun4.l.google.com:19302' }
],
// we want this to work on iOS as well so we will use
// the rtc-plugin-nicta-ios plugin so we can use the
// build.rtc.io to create a native iOS app
plugins: [ RTC.IOS ]
});
| Create a conference variable that can be played with by forkers | Create a conference variable that can be played with by forkers
| JavaScript | mit | rtc-io/demo-helloworld,rtc-io/demo-helloworld,rtc-io/demo-helloworld | ---
+++
@@ -1,4 +1,4 @@
-RTC({
+var conference = RTC({
// use the public google stun servers :)
ice: [
{ url: 'stun1.l.google.com:19302' }, |
db0bcc505eaf95cae39d4dd0b2f7b39fc4e404c1 | test/unit/GameOfLife.spec.js | test/unit/GameOfLife.spec.js | var ALIVE = "alive", DEAD = "dead";
function Cell(initialState) {
var state = initialState || DEAD;
return {
setNeighbours: function (neighbours) {
var nbAliveCells = 0;
neighbours.forEach(function(neighbor) {
if(neighbor.state === ALIVE) {
nbAliveCells += 1;
}
});
if(nbAliveCells < 2) {
state = DEAD;
}
},
get state() {
return state;
}
};
}
describe('Live cell', function () {
it('should die when it has fewer than two live neighbours', function () {
var cell = new Cell(ALIVE);
cell.setNeighbours([new Cell(ALIVE)]);
expect(cell.state).toBe(DEAD);
});
}); |
var GameOfLife = (function() {
var ALIVE = "alive", DEAD = "dead";
function Cell(initialState) {
var state = initialState || DEAD;
function getNumberOfAlive(neighbours) {
var nbAliveCells = 0;
neighbours.forEach(function (neighbor) {
if (neighbor.isAlive()) {
nbAliveCells += 1;
}
});
return nbAliveCells;
}
return {
setNeighbours: function (neighbours) {
if(getNumberOfAlive(neighbours) < 2) {
state = DEAD;
}
},
isAlive: function() {
return state === ALIVE;
}
};
}
function AliveCell() {
return new Cell(ALIVE);
}
function DeadCell() {
return new Cell(DEAD);
}
return {
AliveCell: AliveCell,
DeadCell: DeadCell
};
})();
describe('Live cell', function () {
it('should die when it has fewer than two live neighbours', function () {
var cell = new GameOfLife.AliveCell();
cell.setNeighbours([new GameOfLife.AliveCell()]);
expect(cell.isAlive()).toBe(false);
});
}); | Refactor less than two neighbours then cell dies | Refactor less than two neighbours then cell dies
| JavaScript | mit | velcrin/GameOfLife | ---
+++
@@ -1,31 +1,52 @@
-var ALIVE = "alive", DEAD = "dead";
-function Cell(initialState) {
- var state = initialState || DEAD;
- return {
- setNeighbours: function (neighbours) {
+var GameOfLife = (function() {
+ var ALIVE = "alive", DEAD = "dead";
+
+ function Cell(initialState) {
+ var state = initialState || DEAD;
+
+ function getNumberOfAlive(neighbours) {
var nbAliveCells = 0;
- neighbours.forEach(function(neighbor) {
- if(neighbor.state === ALIVE) {
+ neighbours.forEach(function (neighbor) {
+ if (neighbor.isAlive()) {
nbAliveCells += 1;
}
});
- if(nbAliveCells < 2) {
- state = DEAD;
+ return nbAliveCells;
+ }
+
+ return {
+ setNeighbours: function (neighbours) {
+ if(getNumberOfAlive(neighbours) < 2) {
+ state = DEAD;
+ }
+ },
+ isAlive: function() {
+ return state === ALIVE;
}
- },
- get state() {
- return state;
- }
+ };
+ }
+
+ function AliveCell() {
+ return new Cell(ALIVE);
+ }
+
+ function DeadCell() {
+ return new Cell(DEAD);
+ }
+
+ return {
+ AliveCell: AliveCell,
+ DeadCell: DeadCell
};
-}
+})();
describe('Live cell', function () {
it('should die when it has fewer than two live neighbours', function () {
- var cell = new Cell(ALIVE);
+ var cell = new GameOfLife.AliveCell();
- cell.setNeighbours([new Cell(ALIVE)]);
+ cell.setNeighbours([new GameOfLife.AliveCell()]);
- expect(cell.state).toBe(DEAD);
+ expect(cell.isAlive()).toBe(false);
});
}); |
76c051f0874c76671a33e8974a8e0e2c0cba3ec8 | test/unit/controllersSpec.js | test/unit/controllersSpec.js | 'use strict';
/* jasmine specs for controllers go here */
describe('RootCtrl', function(){
beforeEach(module('swiftBrowser.controllers'));
it('should list containers', inject(function($controller, $httpBackend) {
var containers = [
{"count": 10, "bytes": 1234, "name": "foo"},
{"count": 20, "bytes": 2345, "name": "bar"},
];
var scope = {};
$httpBackend.whenGET('/v1/AUTH_abc?format=json')
.respond(200, containers);
$controller('RootCtrl', {$scope: scope});
expect(scope.containers).toEqual([]);
$httpBackend.flush();
expect(scope.containers).toEqual(containers);
}));
it('should set sort order', inject(function($controller) {
var scope = {};
$controller('RootCtrl', {$scope: scope});
expect(scope.orderProp).toEqual('name');
}));
});
| 'use strict';
/* jasmine specs for controllers go here */
describe('RootCtrl', function(){
var scope;
beforeEach(module('swiftBrowser.controllers'));
beforeEach(inject(function($controller) {
scope = {};
$controller('RootCtrl', {$scope: scope});
}));
it('should list containers', inject(function($httpBackend) {
var containers = [
{"count": 10, "bytes": 1234, "name": "foo"},
{"count": 20, "bytes": 2345, "name": "bar"},
];
$httpBackend.whenGET('/v1/AUTH_abc?format=json')
.respond(200, containers);
expect(scope.containers).toEqual([]);
$httpBackend.flush();
expect(scope.containers).toEqual(containers);
}));
it('should set sort order', function() {
expect(scope.orderProp).toEqual('name');
});
});
| Refactor common logic for setting up RootCtrl and scope | Refactor common logic for setting up RootCtrl and scope
| JavaScript | apache-2.0 | mgeisler/swift-browser,mindware/swift-browser,mgeisler/swift-browser,zerovm/swift-browser,mindware/swift-browser,zerovm/swift-browser | ---
+++
@@ -3,27 +3,30 @@
/* jasmine specs for controllers go here */
describe('RootCtrl', function(){
+ var scope;
+
beforeEach(module('swiftBrowser.controllers'));
- it('should list containers', inject(function($controller, $httpBackend) {
+ beforeEach(inject(function($controller) {
+ scope = {};
+ $controller('RootCtrl', {$scope: scope});
+ }));
+
+ it('should list containers', inject(function($httpBackend) {
var containers = [
{"count": 10, "bytes": 1234, "name": "foo"},
{"count": 20, "bytes": 2345, "name": "bar"},
];
- var scope = {};
$httpBackend.whenGET('/v1/AUTH_abc?format=json')
.respond(200, containers);
- $controller('RootCtrl', {$scope: scope});
expect(scope.containers).toEqual([]);
$httpBackend.flush();
expect(scope.containers).toEqual(containers);
}));
- it('should set sort order', inject(function($controller) {
- var scope = {};
- $controller('RootCtrl', {$scope: scope});
+ it('should set sort order', function() {
expect(scope.orderProp).toEqual('name');
- }));
+ });
}); |
897f72d6c7d52abcdc8274756644fb7c217c3572 | app/assets/javascripts/new_timeslot.js | app/assets/javascripts/new_timeslot.js | $(document).ready(function(){
$("#new-timeslot-form").submit(function(event){
event.preventDefault();
var data = createDate();
$("#modal_new_timeslot").modal('toggle');
$.ajax({
type: "POST",
url: "/api/timeslots",
data: { start: data }
}).done(function(response) {
swal({
title: "Great!",
text: "You have set up a tutoring availability!",
confirmButtonColor: "#66BB6A",
type: "success"
});
$('#tutor-cal').fullCalendar( 'refetchEvents' );
}).fail(function(response) {
swal({
title: "Oops...",
text: "Something went wrong!",
confirmButtonColor: "#EF5350",
type: "error"
});
});
})
})
var createDate = function() {
var date = $('.timepicker').val();
var time = $('.datepicker').val();
var dateTime = date + " " + time;
return (new Date(dateTime));
} | $(document).ready(function(){
$("#new-timeslot-form").submit(function(event){
event.preventDefault();
var data = createDate();
$("#modal_new_timeslot").modal('toggle');
$.ajax({
type: "POST",
url: "/api/timeslots",
data: { start: data },
beforeSend: customBlockUi(this)
}).done(function(response) {
swal({
title: "Great!",
text: "You have set up a tutoring availability!",
confirmButtonColor: "#66BB6A",
type: "success"
});
$('#tutor-cal').fullCalendar( 'refetchEvents' );
}).fail(function(response) {
swal({
title: "Oops...",
text: "Something went wrong!",
confirmButtonColor: "#EF5350",
type: "error"
});
});
})
})
var createDate = function() {
var date = $('.timepicker').val();
var time = $('.datepicker').val();
var dateTime = date + " " + time;
return (new Date(dateTime));
} | Add block ui to ajax call for creating new timeslot | Add block ui to ajax call for creating new timeslot
| JavaScript | mit | theresaboard/theres-a-board,theresaboard/theres-a-board,theresaboard/theres-a-board | ---
+++
@@ -7,7 +7,8 @@
$.ajax({
type: "POST",
url: "/api/timeslots",
- data: { start: data }
+ data: { start: data },
+ beforeSend: customBlockUi(this)
}).done(function(response) {
swal({
title: "Great!", |
85bee713801bb259fdcbf6c06358372c692b508b | src/ZSchema.js | src/ZSchema.js | "use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
forceMaxLength: false,
// force properties or patternProperties to be defined on "object" types
forceProperties: false,
// disallow usage of keywords that this validator can't handle
noExtraKeywords: false,
// disallow usage of schema's without "type" defined
noTypeless: false,
// disallow zero length strings in validated objects
noZeroLengthStrings: false,
// forces "uri" format to be in fully rfc3986 compliant
strictUris: false,
// forces "email" format to be validated more strictly
strictEmails: false,
// turn on all of the above
strict: false
};
/*
constructor
*/
function ZSchema(options) {
this.options = options;
}
/*
instance methods
*/
ZSchema.prototype.compileSchema = function (schema, callback) {
};
ZSchema.prototype.validateSchema = function (schema, callback) {
};
ZSchema.prototype.validate = function (json, schema, callback) {
};
/*
static methods
*/
ZSchema.registerFormat = function (formatName, validatorFunction) {
};
module.exports = ZSchema;
| "use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
forceMaxLength: false,
// force properties or patternProperties to be defined on "object" types
forceProperties: false,
// disallow usage of keywords that this validator can't handle
noExtraKeywords: false,
// disallow usage of schema's without "type" defined
noTypeless: false,
// disallow zero length strings in validated objects
noZeroLengthStrings: false,
// forces "uri" format to be in fully rfc3986 compliant
strictUris: false,
// forces "email" format to be validated more strictly
strictEmails: false,
// turn on all of the above
strict: false
};
/*
constructor
*/
function ZSchema(options) {
this.options = options;
}
/*
instance methods
*/
ZSchema.prototype.compileSchema = function (schema, callback) {
};
ZSchema.prototype.validateSchema = function (schema, callback) {
};
ZSchema.prototype.validate = function (json, schema, callback) {
};
/*
static methods
*/
ZSchema.registerFormat = function (formatName, validatorFunction) {
};
ZSchema.registerFormatter = function (formatterName, formatterFunction) {
};
module.exports = ZSchema;
| Add an API for formatter functionality. | Add an API for formatter functionality.
| JavaScript | mit | whitlockjc/z-schema,crypti/z-schema,whitlockjc/z-schema,crypti/z-schema | ---
+++
@@ -52,5 +52,8 @@
ZSchema.registerFormat = function (formatName, validatorFunction) {
};
+ZSchema.registerFormatter = function (formatterName, formatterFunction) {
+
+};
module.exports = ZSchema; |
081312e0ab495e4e8d2e93ce8ff3a8d7305644ea | src/interface/button.js | src/interface/button.js | /* @flow */
import { isPayPalDomain } from '@paypal/sdk-client/src';
import { PopupOpenError as _PopupOpenError, destroy as zoidDestroy, destroyComponents } from 'zoid/src';
import { setupLogger, allowIframe as _allowIframe } from '../lib';
import { getCheckoutComponent } from '../checkout';
import { getButtonsComponent } from '../buttons';
import { Buttons as _ButtonsTemplate } from '../buttons/template';
export const request = {
addHeaderBuilder: () => {
// pass
}
};
export const Buttons = {
__get__: () => getButtonsComponent()
};
export const Checkout = {
__get__: () => {
const component = getCheckoutComponent();
if (isPayPalDomain()) {
return component;
}
}
};
export const ButtonsTemplate = {
__get__: () => {
if (isPayPalDomain()) {
return _ButtonsTemplate;
}
}
};
export const PopupOpenError = {
__get__: () => {
if (isPayPalDomain()) {
return _PopupOpenError;
}
}
};
export const allowIframe = {
__get__: () => {
if (isPayPalDomain()) {
return _allowIframe;
}
}
};
export const destroyAll = {
__get__: () => {
if (isPayPalDomain() || __TEST__) {
return destroyComponents;
}
}
};
export function setup() {
setupLogger();
getButtonsComponent();
getCheckoutComponent();
}
export function destroy() {
zoidDestroy();
}
| /* @flow */
import { isPayPalDomain } from '@paypal/sdk-client/src';
import { PopupOpenError as _PopupOpenError, destroy as zoidDestroy, destroyComponents } from 'zoid/src';
import { setupLogger, allowIframe as _allowIframe } from '../lib';
import { getCheckoutComponent } from '../checkout';
import { getButtonsComponent } from '../buttons';
import { Buttons as _ButtonsTemplate } from '../buttons/template';
function protectedExport<T>(xport : T) : ?T {
if (isPayPalDomain()) {
return xport;
}
}
export const request = {
addHeaderBuilder: () => {
// pass
}
};
export const Buttons = {
__get__: () => getButtonsComponent()
};
export const Checkout = {
__get__: () => protectedExport(getCheckoutComponent())
};
export const ButtonsTemplate = {
__get__: () => protectedExport(_ButtonsTemplate)
};
export const PopupOpenError = {
__get__: () => protectedExport(_PopupOpenError)
};
export const allowIframe = {
__get__: () => protectedExport(_allowIframe)
};
export const forceIframe = {
__get__: () => protectedExport(_allowIframe)
};
export const destroyAll = {
__get__: () => protectedExport(destroyComponents)
};
export function setup() {
setupLogger();
getButtonsComponent();
getCheckoutComponent();
}
export function destroy() {
zoidDestroy();
}
| Add forceIframe as a protected export | Add forceIframe as a protected export
| JavaScript | apache-2.0 | paypal/paypal-checkout,paypal/paypal-checkout,paypal/paypal-checkout | ---
+++
@@ -7,6 +7,12 @@
import { getCheckoutComponent } from '../checkout';
import { getButtonsComponent } from '../buttons';
import { Buttons as _ButtonsTemplate } from '../buttons/template';
+
+function protectedExport<T>(xport : T) : ?T {
+ if (isPayPalDomain()) {
+ return xport;
+ }
+}
export const request = {
addHeaderBuilder: () => {
@@ -19,44 +25,27 @@
};
export const Checkout = {
- __get__: () => {
- const component = getCheckoutComponent();
- if (isPayPalDomain()) {
- return component;
- }
- }
+ __get__: () => protectedExport(getCheckoutComponent())
};
export const ButtonsTemplate = {
- __get__: () => {
- if (isPayPalDomain()) {
- return _ButtonsTemplate;
- }
- }
+ __get__: () => protectedExport(_ButtonsTemplate)
};
export const PopupOpenError = {
- __get__: () => {
- if (isPayPalDomain()) {
- return _PopupOpenError;
- }
- }
+ __get__: () => protectedExport(_PopupOpenError)
};
export const allowIframe = {
- __get__: () => {
- if (isPayPalDomain()) {
- return _allowIframe;
- }
- }
+ __get__: () => protectedExport(_allowIframe)
+};
+
+export const forceIframe = {
+ __get__: () => protectedExport(_allowIframe)
};
export const destroyAll = {
- __get__: () => {
- if (isPayPalDomain() || __TEST__) {
- return destroyComponents;
- }
- }
+ __get__: () => protectedExport(destroyComponents)
};
export function setup() { |
15659df3b6b540995f09892ba88fd29986e024e8 | src/models/UserAdmin.js | src/models/UserAdmin.js | import User from 'src/models/User';
import { auth } from 'src/config/firebase-admin';
User.prototype.login = function login(email, password) {
return auth
.signInWithEmailAndPassword(email, password)
.then((firebaseUser) => {
this.uid = firebaseUser.uid;
this.displayName = firebaseUser.displayName;
this.email = firebaseUser.email;
this.isAnonymous = firebaseUser.isAnonymous;
this.emailVerified = firebaseUser.emailVerified;
this.photoURL = firebaseUser.photoURL;
this.refreshToken = firebaseUser.refreshToken;
return this;
});
}
User.prototype.logout = () => auth.signOut();
export default User;
| import User from 'src/models/User';
import { auth } from 'src/config/firebase';
User.prototype.login = function login(email, password) {
return auth
.signInWithEmailAndPassword(email, password)
.then((firebaseUser) => {
this.uid = firebaseUser.uid;
this.displayName = firebaseUser.displayName;
this.email = firebaseUser.email;
this.isAnonymous = firebaseUser.isAnonymous;
this.emailVerified = firebaseUser.emailVerified;
this.photoURL = firebaseUser.photoURL;
this.refreshToken = firebaseUser.refreshToken;
return this;
});
}
User.prototype.logout = () => auth.signOut();
export default User;
| Use firebase here, server never imports this | Use firebase here, server never imports this
| JavaScript | mit | tuelsch/bolg,tuelsch/bolg | ---
+++
@@ -1,5 +1,5 @@
import User from 'src/models/User';
-import { auth } from 'src/config/firebase-admin';
+import { auth } from 'src/config/firebase';
User.prototype.login = function login(email, password) {
return auth |
95a72a64eb23dfd693e2df8be14e07ede94a9d5b | lib/util/sendJSON.js | lib/util/sendJSON.js | module.exports = function sendJSON(res, next) {
return _sendJSON(error, data) {
if (error) {
return next(error);
}
return res.json(data);
}
}; | module.exports = function sendJSON(res, next) {
return function _sendJSON(error, data) {
if (error) {
return next(error);
}
return res.json(data);
}
}; | Fix syntax error - missing function declaration | Fix syntax error - missing function declaration
| JavaScript | mit | ganemone/bookshelf-restful | ---
+++
@@ -1,5 +1,5 @@
module.exports = function sendJSON(res, next) {
- return _sendJSON(error, data) {
+ return function _sendJSON(error, data) {
if (error) {
return next(error);
} |
def0b69334011054fabaa1dc83b9ea4fb1a1b0cd | client/components/banettes/banettes.constant.js | client/components/banettes/banettes.constant.js | 'use strict';
angular.module('impactApp').constant('banettes', [
{
id: 'toutes',
label: 'Toutes'
},
{
id: 'emise',
label: 'Émise'
},
{
id: 'complet',
label: 'Complète'
},
{
id: 'incomplet',
label: 'Incomplète'
},
{
id: 'archive',
label: 'Archivée'
}
]);
| 'use strict';
angular.module('impactApp').constant('banettes', [
{
id: 'toutes',
label: 'Toutes'
},
{
id: 'emise',
label: 'Émise'
},
{
id: 'complet',
label: 'Complète'
},
{
id: 'incomplet',
label: 'Incomplète'
},
{
id: 'en_cours',
label: 'En cours de saisie'
},
{
id: 'archive',
label: 'Archivée'
}
]);
| Add display of new status | Add display of new status
| JavaScript | agpl-3.0 | sgmap/impact,sgmap/impact | ---
+++
@@ -18,6 +18,10 @@
label: 'Incomplète'
},
{
+ id: 'en_cours',
+ label: 'En cours de saisie'
+ },
+ {
id: 'archive',
label: 'Archivée'
} |
21eeb265e755b09ebd06249c5e0c7e6beadeb7d7 | client/src/components/pages/Login/index.js | client/src/components/pages/Login/index.js | import React from 'react';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { Toolbar, ToolbarTitle } from 'material-ui/Toolbar';
import Paper from 'material-ui/Paper';
import styles from './styles.css';
import LoginForm from './LoginForm';
const LoginPage = ({ isAuthenticated, location }) => {
const { from } = location.state || { from: { pathname: '/' } };
return isAuthenticated
? <Redirect t={ from } />
: <div className="login">
<div className="login__modal">
<Paper className="modal">
<Toolbar>
<ToolbarTitle
text="Welcome back."
style={{ color: 'white '}} />
</Toolbar>
<LoginForm />
</Paper>
</div>
</div>
};
export default connect(
({ root }) => ({
isAuthenticated: root.isAuthenticated
})
)(LoginPage);
| import React from 'react';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { Toolbar, ToolbarTitle } from 'material-ui/Toolbar';
import Paper from 'material-ui/Paper';
import styles from './styles.css';
import LoginForm from './LoginForm';
const LoginPage = ({ isAuthenticated, location }) => {
const { from } = location.state || { from: { pathname: '/' } };
return isAuthenticated
? <Redirect to={ from } />
: <div className="login">
<div className="login__modal">
<Paper className="modal">
<Toolbar>
<ToolbarTitle
text="Welcome back."
style={{ color: 'white '}} />
</Toolbar>
<LoginForm />
</Paper>
</div>
</div>
};
export default connect(
({ root }) => ({
isAuthenticated: root.isAuthenticated
})
)(LoginPage);
| Fix broken redirect after login | Fix broken redirect after login
| JavaScript | mit | mbchoa/presence,mbchoa/presence | ---
+++
@@ -11,7 +11,7 @@
const LoginPage = ({ isAuthenticated, location }) => {
const { from } = location.state || { from: { pathname: '/' } };
return isAuthenticated
- ? <Redirect t={ from } />
+ ? <Redirect to={ from } />
: <div className="login">
<div className="login__modal">
<Paper className="modal"> |
e6b0b562e53afde0dfc32abb90d367456ba9d1d8 | client/templates/courses/tagged-courses.js | client/templates/courses/tagged-courses.js | Template.taggedCourses.helpers({
'courses': function () {
return Courses.find().fetch();
},
'tag': function () {
// Get reference to template instance
var instance = this;
// Get tag from instance
var tag = instance.tag;
return tag;
}
});
Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagged with the current tag
instance.subscribe('taggedCourses', instance.tag);
// Subscribe to course images
instance.subscribe('images');
});
| Template.taggedCourses.helpers({
'courses': function () {
return Courses.find().fetch();
},
'tag': function () {
// Get reference to template instance
var instance = this;
// Get tag from instance
var tag = instance.tag;
return tag;
}
});
Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagged with the current tag
instance.subscribe('taggedCourses', instance.tag);
// Subscribe to course images
instance.subscribe('images');
});
Template.taggedCourses.rendered = function () {
// Get reference to template instance
var instance = this;
// Set the page site title for SEO
Meta.setTitle('Courses tagged "' + instance.tag + '"');
};
| Set page title on render | Set page title on render
| JavaScript | agpl-3.0 | Crowducate/crowducate-platform,Crowducate/crowducate-platform | ---
+++
@@ -29,3 +29,12 @@
// Subscribe to course images
instance.subscribe('images');
});
+
+
+Template.taggedCourses.rendered = function () {
+ // Get reference to template instance
+ var instance = this;
+
+ // Set the page site title for SEO
+ Meta.setTitle('Courses tagged "' + instance.tag + '"');
+}; |
ff1dd026c76dcf7592ddf3072a33a0a87d220ccc | lib/clients/carbon_client.js | lib/clients/carbon_client.js | var util = require('util'),
OxideClient = require('./oxide_client.js'),
Metric = require('../metrics/metric.js');
function CarbonClient (opts) {
OxideClient.call(this);
}
util.inherits(CarbonClient, OxideClient);
CarbonClient.prototype.record = function (path, value, timestamp) {
var opts = { path: this._pathify(path), value: value }
if (typeof timestamp !== 'undefined') {
opts.timestamp = timestamp
}
return this.enqueue(new Metric(opts));
}
module.exports = CarbonClient;
| var util = require('util'),
OxideClient = require('./oxide_client.js'),
Metric = require('../metrics/metric.js');
function CarbonClient (opts) {
OxideClient.call(this, opts);
}
util.inherits(CarbonClient, OxideClient);
CarbonClient.prototype.record = function (path, value, timestamp) {
var opts = { path: this._pathify(path), value: value }
if (typeof timestamp !== 'undefined') {
opts.timestamp = timestamp
}
return this.enqueue(new Metric(opts));
}
module.exports = CarbonClient;
| Fix passing opts through carbon client to oxide client | Fix passing opts through carbon client to oxide client | JavaScript | mit | MCProHosting/oxide | ---
+++
@@ -3,7 +3,7 @@
Metric = require('../metrics/metric.js');
function CarbonClient (opts) {
- OxideClient.call(this);
+ OxideClient.call(this, opts);
}
util.inherits(CarbonClient, OxideClient);
|
02cc9cfbd1e23bfedff71a256ed60c32936afb1e | cmd/tchaik/ui/static/js/__tests__/components/ArtworkImage-test.js | cmd/tchaik/ui/static/js/__tests__/components/ArtworkImage-test.js | var __path__ = '../../src/components/ArtworkImage.js';
jest.dontMock(__path__);
describe('ArtworkImage', function() {
var React, TestUtils, ArtworkImage;
var artworkImage;
beforeEach(function() {
React = require('react/addons');
TestUtils = React.addons.TestUtils;
ArtworkImage = require(__path__);
artworkImage = TestUtils.renderIntoDocument(
<ArtworkImage path='/artwork/19199193' />
)
});
it('works', function() {
expect(true).toBeTruthy();
});
});
| var __path__ = '../../src/components/ArtworkImage.js';
jest.dontMock(__path__);
describe('ArtworkImage', function() {
var React, TestUtils, ArtworkImage;
var domNode, artworkImage;
beforeEach(function() {
React = require('react/addons');
TestUtils = React.addons.TestUtils;
ArtworkImage = require(__path__);
artworkImage = TestUtils.renderIntoDocument(
<ArtworkImage path='/artwork/19199193' />
);
domNode = React.findDOMNode(artworkImage);
});
describe('in the initial state', function() {
it('should not be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).not.toContain('visible');
});
});
describe('after the image has loaded', function() {
beforeEach(function() {
TestUtils.Simulate.load(domNode);
});
it('should be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).toContain('visible');
});
});
describe('after the image has errored', function() {
beforeEach(function() {
TestUtils.Simulate.error(domNode);
});
it('should be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).not.toContain('visible');
});
});
});
| Add *useful* tests for the ArtworkImage component | Add *useful* tests for the ArtworkImage component
| JavaScript | bsd-2-clause | solarnz/tchaik,solarnz/tchaik,GrahamGoudeau21/tchaik,solarnz/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,solarnz/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik | ---
+++
@@ -4,7 +4,7 @@
describe('ArtworkImage', function() {
var React, TestUtils, ArtworkImage;
- var artworkImage;
+ var domNode, artworkImage;
beforeEach(function() {
React = require('react/addons');
@@ -13,10 +13,37 @@
artworkImage = TestUtils.renderIntoDocument(
<ArtworkImage path='/artwork/19199193' />
- )
+ );
+ domNode = React.findDOMNode(artworkImage);
});
- it('works', function() {
- expect(true).toBeTruthy();
+ describe('in the initial state', function() {
+ it('should not be visible', function() {
+ var classes = domNode.getAttribute('class').split(' ');
+ expect(classes).not.toContain('visible');
+ });
});
+
+ describe('after the image has loaded', function() {
+ beforeEach(function() {
+ TestUtils.Simulate.load(domNode);
+ });
+
+ it('should be visible', function() {
+ var classes = domNode.getAttribute('class').split(' ');
+ expect(classes).toContain('visible');
+ });
+ });
+
+ describe('after the image has errored', function() {
+ beforeEach(function() {
+ TestUtils.Simulate.error(domNode);
+ });
+
+ it('should be visible', function() {
+ var classes = domNode.getAttribute('class').split(' ');
+ expect(classes).not.toContain('visible');
+ });
+ });
+
}); |
d5baa6a9f98ddf3c6c46bb8eb8f6a98f62e4d8b7 | src/TodoApp/TodoList/Todo.js | src/TodoApp/TodoList/Todo.js | import React from 'react';
export default class Todo extends React.Component {
static propTypes = {
text: React.PropTypes.string.isRequired
}
render() {
return (
<li>{this.props.text}</li>
);
}
}
| import React from 'react';
export default class Todo extends React.Component {
static propTypes = {
text: React.PropTypes.string.isRequired
}
state = {
completed: false
}
render() {
const style = {
textDecoration: this.state.completed ? 'line-through' : undefined,
cursor: 'default'
};
return (
<li
style={style}
onClick={this.toggleCompleted}
>
{this.props.text}
</li>
);
}
toggleCompleted = (event) => {
this.setState({ completed: !this.state.completed });
}
}
| Add the ability to cross off items on the list | Add the ability to cross off items on the list
| JavaScript | cc0-1.0 | ksmithbaylor/react-todo-list,ksmithbaylor/react-todo-list | ---
+++
@@ -5,9 +5,27 @@
text: React.PropTypes.string.isRequired
}
+ state = {
+ completed: false
+ }
+
render() {
+ const style = {
+ textDecoration: this.state.completed ? 'line-through' : undefined,
+ cursor: 'default'
+ };
+
return (
- <li>{this.props.text}</li>
+ <li
+ style={style}
+ onClick={this.toggleCompleted}
+ >
+ {this.props.text}
+ </li>
);
}
+
+ toggleCompleted = (event) => {
+ this.setState({ completed: !this.state.completed });
+ }
} |
18e9cf3851ddaae9f865b326f4152d53ce5eb882 | types/number.js | types/number.js | "use strict";
let errors = require('../errors.js');
let Type = require('./type.js');
let Value = require('./value.js');
class NumberValue extends Value {
constructor(type) {
super(type);
this.value = 0;
}
assign(newValue) {
if (typeof newValue == 'number') {
this.value = newValue;
} else if (newValue.value !== undefined && typeof newValue.value == 'number') {
this.value = newValue.value;
} else {
throw new errors.Internal(`Trying to assign ${newValue.type} to Number;`);
}
}
equals(other) {
return this.type == other.type && this.value == other.value;
}
innerToString() {
return `${this.value}`;
}
toString() {
return `${this.value}`;
}
}
class NumberType extends Type {
constructor() {
super(null, null, 'Number');
}
equals(other) {
return other === NumberType.singleton;
}
makeDefaultValue() {
return new NumberValue(this);
}
toString() {
return 'Number';
}
}
NumberType.singleton = new NumberType();
module.exports = {
Type: NumberType,
Value: NumberValue,
};
| "use strict";
let errors = require('../errors.js');
let Type = require('./type.js');
let Value = require('./value.js');
class NumberValue extends Value {
constructor(type) {
super(type);
this.value = 0;
}
assign(newValue) {
if (typeof newValue == 'number') {
this.value = newValue;
} else if (newValue.value !== undefined && typeof newValue.value == 'number') {
this.value = newValue.value;
} else {
throw new errors.Internal(`Trying to assign ${newValue.type} to Number;`);
}
}
equals(other) {
return this.type == other.type && this.value == other.value;
}
innerToString() {
return `${this.value}`;
}
assignJSON(spec) {
this.value = spec;
}
toJSON() {
return this.value;
}
toString() {
return `${this.value}`;
}
}
class NumberType extends Type {
constructor() {
super(null, null, 'Number');
}
equals(other) {
return other === NumberType.singleton;
}
makeDefaultValue() {
return new NumberValue(this);
}
toString() {
return 'Number';
}
}
NumberType.singleton = new NumberType();
module.exports = {
Type: NumberType,
Value: NumberValue,
};
| Add assignJSON/toJSON to Number types | Add assignJSON/toJSON to Number types
| JavaScript | mit | salesforce/runway-browser,SalesforceEng/runway-browser,SalesforceEng/runway-browser | ---
+++
@@ -28,6 +28,14 @@
return `${this.value}`;
}
+ assignJSON(spec) {
+ this.value = spec;
+ }
+
+ toJSON() {
+ return this.value;
+ }
+
toString() {
return `${this.value}`;
} |
e9fa8ee78fc8630d67fcd9384e8731c2a13d4ff9 | languages/es-ES.js | languages/es-ES.js | /*!
* numbro.js language configuration
* language : spanish Spain
* author : Hernan Garcia : https://github.com/hgarcia
*/
(function () {
var language = {
delimiters: {
thousands: '.',
decimal: ','
},
abbreviations: {
thousand: 'k',
million: 'mm',
billion: 'b',
trillion: 't'
},
ordinal: function (number) {
var b = number % 10;
return (b === 1 || b === 3) ? 'er' :
(b === 2) ? 'do' :
(b === 7 || b === 0) ? 'mo' :
(b === 8) ? 'vo' :
(b === 9) ? 'no' : 'to';
},
currency: {
symbol: '€',
position: 'postfix'
},
defaults: {
currencyFormat: ',0000 a'
},
formats: {
fourDigits: '0000 a',
fullWithTwoDecimals: ',0.00 $',
fullWithTwoDecimalsNoCurrency: ',0.00',
fullWithNoDecimals: ',0 $'
}
};
// Node
if (typeof module !== 'undefined' && module.exports) {
module.exports = language;
}
// Browser
if (typeof window !== 'undefined' && this.numbro && this.numbro.language) {
this.numbro.language('es', language);
}
}());
| /*!
* numbro.js language configuration
* language : spanish Spain
* author : Hernan Garcia : https://github.com/hgarcia
*/
(function () {
var language = {
delimiters: {
thousands: '.',
decimal: ','
},
abbreviations: {
thousand: 'k',
million: 'mm',
billion: 'b',
trillion: 't'
},
ordinal: function (number) {
var b = number % 10;
return (b === 1 || b === 3) ? 'er' :
(b === 2) ? 'do' :
(b === 7 || b === 0) ? 'mo' :
(b === 8) ? 'vo' :
(b === 9) ? 'no' : 'to';
},
currency: {
symbol: '€',
position: 'postfix'
},
defaults: {
currencyFormat: ',0000 a'
},
formats: {
fourDigits: '0000 a',
fullWithTwoDecimals: ',0.00 $',
fullWithTwoDecimalsNoCurrency: ',0.00',
fullWithNoDecimals: ',0 $'
}
};
// Node
if (typeof module !== 'undefined' && module.exports) {
module.exports = language;
}
// Browser
if (typeof window !== 'undefined' && this.numbro && this.numbro.language) {
this.numbro.language('es-ES', language);
}
}());
| Correct culture code for Español | Correct culture code for Español
| JavaScript | mit | Stillat/numeral.php,foretagsplatsen/numbro,stewart42/numbro,rafde/numbro,clayzermk1/numbro,prantlf/numbro,atuttle/numbro,Kistler-Group/numbro,danghongthanh/numbro,BenjaminVanRyseghem/numbro,matthieuprat/numbro | ---
+++
@@ -44,6 +44,6 @@
}
// Browser
if (typeof window !== 'undefined' && this.numbro && this.numbro.language) {
- this.numbro.language('es', language);
+ this.numbro.language('es-ES', language);
}
}()); |
81c22ea31edcadd73f459470923cf8ee62b09a8a | website/js/dashboard-ajax.js | website/js/dashboard-ajax.js | // Common ajax-handling functions for dashboard-like pages. Looks for <reload/>
// elements to reload the page, and reports errors or failures via alerts.
g_action_url = "action.php";
// Note that this doesn't run if the $.ajax call has a 'success:' callback that
// generates an error.
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var fail = xmldoc.documentElement.getElementsByTagName("failure");
if (fail && fail.length > 0) {
console.log(xmldoc);
alert("Action failed: " + fail[0].textContent);
}
});
// <reload/> element
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var reload = xmldoc.documentElement.getElementsByTagName("reload");
if (reload && reload.length > 0) {
console.log('ajaxSuccess event: reloading page');
location.reload(true);
}
});
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
console.log("ajaxError: " + thrownError);
console.log(thrownError);
console.log(jqXHR);
console.log(jqXHR.responseText);
console.log(event);
alert("Ajax error: " + thrownError);
});
| // Common ajax-handling functions for dashboard-like pages. Looks for <reload/>
// elements to reload the page, and reports errors or failures via alerts.
g_action_url = "action.php";
// Note that this doesn't run if the $.ajax call has a 'success:' callback that
// generates an error.
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var fail = xmldoc.documentElement.getElementsByTagName("failure");
if (fail && fail.length > 0) {
console.log(xmldoc);
alert("Action failed: " + fail[0].textContent);
}
});
// <reload/> element
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var reload = xmldoc.documentElement.getElementsByTagName("reload");
if (reload && reload.length > 0) {
console.log('ajaxSuccess event: reloading page');
location.reload(true);
}
});
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
console.log("ajaxError: " + thrownError);
console.log(thrownError);
console.log(jqXHR);
console.log("Response text: " + jqXHR.responseText);
console.log("ReadyState: " + jqXHR.readyState);
console.log("status: " + jqXHR.status);
console.log(event);
alert("Ajax error: " + thrownError);
});
| Add some additional logging for ajax failures. | Add some additional logging for ajax failures.
| JavaScript | mit | jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet | ---
+++
@@ -26,7 +26,9 @@
console.log("ajaxError: " + thrownError);
console.log(thrownError);
console.log(jqXHR);
- console.log(jqXHR.responseText);
+ console.log("Response text: " + jqXHR.responseText);
+ console.log("ReadyState: " + jqXHR.readyState);
+ console.log("status: " + jqXHR.status);
console.log(event);
alert("Ajax error: " + thrownError);
}); |
cc56d5cce91d4031b4a12d71739bdabd86b8481d | lib/collections.js | lib/collections.js | CommitMessages = new Mongo.Collection("CommitMessages");
RepositoryList = new Mongo.Collection("RepositoryList");
Announcements = new Mongo.Collection("Announcements");
MentorQueue = new Mongo.Collection("MentorQueue");
AnonReports = new Mongo.Collection('AnonReports');
| CommitMessages = new Mongo.Collection("CommitMessages");
RepositoryList = new Mongo.Collection("RepositoryList");
Announcements = new Mongo.Collection("Announcements");
MentorQueue = new Mongo.Collection("MentorQueue");
AnonReports = new Mongo.Collection('AnonReports');
AnonUserData = new Mongo.Collection('AnonUserData'); | Initialize collection for anonymous data | Initialize collection for anonymous data
| JavaScript | mit | mpoegel/HackRPI-Status-Board,hack-rpi/Status-Board,hack-rpi/Status-Board,mpoegel/HackRPI-Status-Board,hack-rpi/Status-Board,mpoegel/HackRPI-Status-Board,mpoegel/HackRPI-Status-Board | ---
+++
@@ -3,3 +3,4 @@
Announcements = new Mongo.Collection("Announcements");
MentorQueue = new Mongo.Collection("MentorQueue");
AnonReports = new Mongo.Collection('AnonReports');
+AnonUserData = new Mongo.Collection('AnonUserData'); |
10c71a738177fc02053601dff5594ba17cb2ab61 | src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js | src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js | function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
$scope.renderModel.value = true;
}
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
$scope.renderModel.value = true;
}
}
setupViewModel();
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server
setupViewModel();
};
// Update the value when the toggle is clicked
$scope.toggle = function(){
if($scope.renderModel.value){
$scope.model.value = "0";
setupViewModel();
return;
}
$scope.model.value = "1";
setupViewModel();
};
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
| function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
$scope.renderModel.value = true;
}
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
$scope.renderModel.value = true;
}
}
setupViewModel();
if( $scope.model && !$scope.model.value ) {
$scope.model.value = ($scope.renderModel.value === true) ? '1' : '0';
}
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server
setupViewModel();
};
// Update the value when the toggle is clicked
$scope.toggle = function(){
if($scope.renderModel.value){
$scope.model.value = "0";
setupViewModel();
return;
}
$scope.model.value = "1";
setupViewModel();
};
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
| Set a initial $scope.model.value for true/false | Set a initial $scope.model.value for true/false
| JavaScript | mit | marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,lars-erik/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,WebCentrum/Umbraco-CMS,aaronpowell/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,aaronpowell/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,leekelleher/Umbraco-CMS,tompipe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,aaronpowell/Umbraco-CMS,umbraco/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,arknu/Umbraco-CMS | ---
+++
@@ -15,6 +15,10 @@
}
setupViewModel();
+
+ if( $scope.model && !$scope.model.value ) {
+ $scope.model.value = ($scope.renderModel.value === true) ? '1' : '0';
+ }
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster |
9bddc584038883014c928fd46120090b37827b4c | js/view.js | js/view.js |
( function( global, chrome, d )
{
// I know, UGLY, but it's just a prototype.
function View( $element, manager )
{
this.manager = manager;
this.$left = $element.find( '.left' );
this.$right = $element.find( '.right' );
}
View.prototype.display = function()
{
var self = this;
self.manager.getSections( function( sections )
{
sections.forEach( function( section )
{
var $column = ( section.title.substring( 0, 1 ) === '+' ) ? self.$left : self.$right;
$s = $( '<section></section>' );
$s.append( '<h1>' + section.title.substring( 1 ) + '</h1>' );
$column.append( $s );
( function( $section )
{
self.manager.getBookmarks(
section,
function( bookmarks )
{
bookmarks.forEach( function( bookmark )
{
var $link = $( '<a href="' + bookmark.url + '">' + bookmark.title + '</a>' );
$section.append( $link );
} );
}
);
} )( $s );
} );
} );
}
d.View = View;
} )( this, chrome, this.Dashboard = this.Dashboard || {} );
var $c = $( '#container' ), $s;
|
( function( global, chrome, d )
{
// I know, UGLY, but it's just a prototype.
// FIXME: Refactor, improve, rewrite from scrath, whatever but make it pretty and efficient !
function View( $element, manager )
{
this.manager = manager;
this.$left = $element.find( '.left' );
this.$right = $element.find( '.right' );
}
View.prototype.display = function()
{
var self = this;
self.manager.getSections( function( sections )
{
sections.forEach( function( section )
{
var $column = ( section.title.substring( 0, 1 ) === '+' ) ? self.$left : self.$right,
$s = $( '<section></section>' );
$s[ 0 ].id = section.id;
$s.append( '<h1>' + section.title.substring( 1 ) + '</h1>' );
$column.append( $s );
( function( $section )
{
self.manager.getBookmarks(
section,
function( bookmarks )
{
bookmarks.forEach( function( bookmark )
{
var $link = $( '<a>' + bookmark.title + '</a>' );
$link[ 0 ].id = bookmark.id;
$link[ 0 ].href = bookmark.url;
$section.append( $link );
} );
}
);
} )( $s );
} );
} );
}
d.View = View;
} )( this, chrome, this.Dashboard = this.Dashboard || {} );
var $c = $( '#container' ), $s;
| Set each bookmark's identifier on its DOM element 'id' attribute. | Set each bookmark's identifier on its DOM element 'id' attribute.
| JavaScript | mit | romac/mdash,romac/mdash,romac/mdash | ---
+++
@@ -2,6 +2,7 @@
( function( global, chrome, d )
{
// I know, UGLY, but it's just a prototype.
+ // FIXME: Refactor, improve, rewrite from scrath, whatever but make it pretty and efficient !
function View( $element, manager )
{
this.manager = manager;
@@ -17,9 +18,9 @@
{
sections.forEach( function( section )
{
- var $column = ( section.title.substring( 0, 1 ) === '+' ) ? self.$left : self.$right;
-
- $s = $( '<section></section>' );
+ var $column = ( section.title.substring( 0, 1 ) === '+' ) ? self.$left : self.$right,
+ $s = $( '<section></section>' );
+ $s[ 0 ].id = section.id;
$s.append( '<h1>' + section.title.substring( 1 ) + '</h1>' );
$column.append( $s );
@@ -32,7 +33,9 @@
{
bookmarks.forEach( function( bookmark )
{
- var $link = $( '<a href="' + bookmark.url + '">' + bookmark.title + '</a>' );
+ var $link = $( '<a>' + bookmark.title + '</a>' );
+ $link[ 0 ].id = bookmark.id;
+ $link[ 0 ].href = bookmark.url;
$section.append( $link );
} ); |
d85c88ca5e9e069d889fc6a54e26bfe90cefcf3b | gulpfile.js | gulpfile.js | var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('default', ['serve']);
gulp.task('serve', function() {
browserSync.init(null, {
server: {
baseDir: './'
},
notify: false
});
gulp.watch([
'./*.html',
'./css/**/*.css',
'./js/**/*.js'
], browserSync.reload);
});
| var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('default', ['serve']);
gulp.task('serve', function() {
browserSync.init(null, {
server: {
baseDir: './'
},
notify: false
});
gulp.watch([
'./*.html',
'./css/**/*.css',
'./js/**/*.js'
], function() {
browserSync.reload({ once: true });
});
});
| Make sure that the reload only triggers once for multiple file updates. | Make sure that the reload only triggers once for multiple file updates.
| JavaScript | mit | tvararu/tvararu.github.io,tvararu/tvararu.github.io | ---
+++
@@ -15,5 +15,7 @@
'./*.html',
'./css/**/*.css',
'./js/**/*.js'
- ], browserSync.reload);
+ ], function() {
+ browserSync.reload({ once: true });
+ });
}); |
4ccd42acf0f930562280640d176c5e5d80f6a18b | gulpfile.js | gulpfile.js | var gulp = require( 'gulp' ),
bower = require( 'gulp-bower' ),
del = require( 'del' ),
vui = require( 'vui-helpers' );
gulp.task( 'clean', function( cb ) {
del([ 'accordion.css' ], cb);
} );
gulp.task( 'lib', function() {
return bower( 'lib/' );
} );
gulp.task( 'css', function () {
return vui.makeCss(
'accordion.css.less',
'accordion.css',
{ 'lintOpts' : '.csslintrc' }
);
} );
gulp.task( 'default', [ 'clean' ], function() {
gulp.start( 'css' );
} );
gulp.task( 'test', [ 'lib' ], function () {
return vui.test(
'test/unit/karma.conf.js',
[
'lib/jquery/jquery.min.js',
'lib/jquery.ui/ui/jquery.ui.core.js',
'lib//jquery.ui/ui/jquery.ui.widget.js',
'test/unit/**/*Spec.js'
],
'accordion.css'
);
} ); | var gulp = require( 'gulp' ),
bower = require( 'gulp-bower' ),
del = require( 'del' ),
vui = require( 'vui-helpers' );
gulp.task( 'clean', function( cb ) {
del([ 'accordion.css' ], cb);
} );
gulp.task( 'lib', function() {
return bower( 'lib/' );
} );
gulp.task( 'css', function () {
return vui.makeCss(
'accordion.css.less',
'accordion.css',
{ 'lintOpts' : '.csslintrc' }
);
} );
gulp.task( 'default', [ 'clean' ], function() {
gulp.start( 'css' );
} );
gulp.task( 'test', [ 'lib' ], function () {
return vui.test(
'test/unit/karma.conf.js',
[
'lib/jquery/jquery.min.js',
'lib/jquery.ui/ui/jquery.ui.core.js',
'lib//jquery.ui/ui/jquery.ui.widget.js',
'accordion.js',
'test/unit/**/*Spec.js'
],
'accordion.css'
);
} ); | Include accordion.js in list of JavaScript files for testing. | Include accordion.js in list of JavaScript files for testing.
| JavaScript | apache-2.0 | Brightspace/jquery-valence-ui-accordion | ---
+++
@@ -30,6 +30,7 @@
'lib/jquery/jquery.min.js',
'lib/jquery.ui/ui/jquery.ui.core.js',
'lib//jquery.ui/ui/jquery.ui.widget.js',
+ 'accordion.js',
'test/unit/**/*Spec.js'
],
'accordion.css' |
f783cd58b4794d2c79430adb09533d60e3ad01af | gulpfile.js | gulpfile.js | var gulp = require('gulp');
var webpack = require('webpack');
var clientConfig = require('./config/webpack.prod.client.js')
var serverConfig = require('./config/webpack.prod.server.js')
gulp.task('bundle-client', function(done) {
webpack( clientConfig ).run(onBundle(done))
});
gulp.task('bundle-server', function(done) {
webpack( serverConfig ).run(onBundle(done))
});
gulp.task('move-index', function() {
gulp.src('./src/index.html').pipe(gulp.dest('./app'))
});
gulp.task('move-assets', ['move-index'], function() {
gulp.src('./src/assets/**/*', {base: './src'}).pipe(gulp.dest('./app/'))
});
gulp.task('bundle', ['bundle-client', 'bundle-server']);
gulp.task('build', ['bundle', 'move-assets'])
function onBundle(done) {
return function(err, stats) {
if (err) console.log('Error', err);
else console.log(stats.toString());
done()
}
}
| var gulp = require('gulp');
var webpack = require('webpack');
var clientConfig = require('./config/webpack.prod.client.js')
var serverConfig = require('./config/webpack.prod.server.js')
gulp.task('bundle-client', function(done) {
webpack( clientConfig ).run(onBundle(done))
});
gulp.task('bundle-server', function(done) {
webpack( serverConfig ).run(onBundle(done))
});
gulp.task('move-assets', function() {
gulp.src('./src/assets/**/*', {base: './src'}).pipe(gulp.dest('./app/'))
});
gulp.task('bundle', ['bundle-client', 'bundle-server']);
gulp.task('build', ['bundle', 'move-assets']) // TODO - elctron build
function onBundle(done) {
return function(err, stats) {
if (err) console.log('Error', err);
else console.log(stats.toString());
done()
}
}
| Remove gulp html task; done by webpack | Remove gulp html task; done by webpack
| JavaScript | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -13,18 +13,13 @@
webpack( serverConfig ).run(onBundle(done))
});
-
-gulp.task('move-index', function() {
- gulp.src('./src/index.html').pipe(gulp.dest('./app'))
-});
-
-gulp.task('move-assets', ['move-index'], function() {
+gulp.task('move-assets', function() {
gulp.src('./src/assets/**/*', {base: './src'}).pipe(gulp.dest('./app/'))
});
gulp.task('bundle', ['bundle-client', 'bundle-server']);
-gulp.task('build', ['bundle', 'move-assets'])
+gulp.task('build', ['bundle', 'move-assets']) // TODO - elctron build
function onBundle(done) { |
3af90105114d7e3c54d9c8113ac87f89b6aa839a | input/_relation.js | input/_relation.js | 'use strict';
var Db = require('dbjs')
, relation = module.exports = require('dbjs/lib/_relation');
require('./base');
relation.set('toDOMInputBox', function (document/*, options*/) {
var box, options = arguments[1];
box = this.ns.toDOMInputBox(document, options);
box.set(this.objectValue);
box.setAttribute('name', this._id_);
if (this.required && (!options || (options.type !== 'checkbox'))) {
box.setAttribute('required', true);
}
this.on('change', function () { box.set(this.objectValue); });
return box;
});
relation.set('toDOMInput', Db.Base.prototype.toDOMInput);
relation._getRel_('fieldHint').ns = Db.String;
relation.set('DOMId', function () {
return this._id_.replace(/:/g, '-');
});
| 'use strict';
var Db = require('dbjs')
, relation = module.exports = require('dbjs/lib/_relation');
require('./base');
relation.set('toDOMInputBox', function (document/*, options*/) {
var box, options = arguments[1];
box = this.ns.toDOMInputBox(document, options);
box.set(this.objectValue);
box.setAttribute('name', this._id_);
if (this.required && (!options || (options.type !== 'checkbox'))) {
box.setAttribute('required', true);
}
this.on('change', function () { box.set(this.objectValue); });
return box;
});
relation.set('toDOMInput', Db.Base.prototype.toDOMInput);
relation.get('fieldHint').ns = Db.String;
relation.set('DOMId', function () {
return this._id_.replace(/:/g, '-');
});
| Update up to changes in dbjs | Update up to changes in dbjs
| JavaScript | mit | medikoo/dbjs-dom | ---
+++
@@ -18,7 +18,7 @@
});
relation.set('toDOMInput', Db.Base.prototype.toDOMInput);
-relation._getRel_('fieldHint').ns = Db.String;
+relation.get('fieldHint').ns = Db.String;
relation.set('DOMId', function () {
return this._id_.replace(/:/g, '-');
}); |
e50e843f0fa2faa7f2d7b591f3273cffef538820 | js/check_result.js | js/check_result.js | 'use strict';
/* global TbplJob, Notification */
setTimeout(checkResult, 5000);
function checkResult() {
var tbpl = new TbplJob();
var result = 'Fail!';
if (tbpl.isDone()) {
if (tbpl.isSuccessful()) {
result = 'Success!';
}
Notification.requestPermission(function() {
var notification = new Notification(tbpl.description, { body: result });
notification.onclick = function() {
window.focus();
};
});
} else {
setTimeout(checkResult, 5000);
}
}
| 'use strict';
/* global TbplJob, Notification */
(function() {
var container = document.querySelector('#container');
addTrackingSign();
setTimeout(checkResult, 5000);
function checkResult() {
var tbpl = new TbplJob();
var result = 'Fail!';
if (tbpl.isDone()) {
if (tbpl.isSuccessful()) {
result = 'Success!';
}
Notification.requestPermission(function() {
var notification = new Notification(tbpl.description, { body: result });
notification.onclick = function() {
window.focus();
};
});
removeTrackingSign();
} else {
setTimeout(checkResult, 5000);
}
}
function addTrackingSign() {
container.style.borderStyle = 'dashed';
// Firefox light orange, https://www.mozilla.org/en-US/styleguide/identity/firefox/color/.
container.style.borderColor = '#FF9500';
}
function removeTrackingSign() {
container.style.borderStyle = null;
container.style.borderColor = null;
}
})();
| Add tracking sign as a border of the container element | Add tracking sign as a border of the container element
| JavaScript | mit | evanxd/tbpl-hou,evanxd/tbpl-hou | ---
+++
@@ -2,22 +2,41 @@
/* global TbplJob, Notification */
-setTimeout(checkResult, 5000);
+(function() {
+ var container = document.querySelector('#container');
-function checkResult() {
- var tbpl = new TbplJob();
- var result = 'Fail!';
- if (tbpl.isDone()) {
- if (tbpl.isSuccessful()) {
- result = 'Success!';
+ addTrackingSign();
+ setTimeout(checkResult, 5000);
+
+ function checkResult() {
+ var tbpl = new TbplJob();
+ var result = 'Fail!';
+ if (tbpl.isDone()) {
+ if (tbpl.isSuccessful()) {
+ result = 'Success!';
+ }
+
+ Notification.requestPermission(function() {
+ var notification = new Notification(tbpl.description, { body: result });
+ notification.onclick = function() {
+ window.focus();
+ };
+ });
+
+ removeTrackingSign();
+ } else {
+ setTimeout(checkResult, 5000);
}
- Notification.requestPermission(function() {
- var notification = new Notification(tbpl.description, { body: result });
- notification.onclick = function() {
- window.focus();
- };
- });
- } else {
- setTimeout(checkResult, 5000);
}
-}
+
+ function addTrackingSign() {
+ container.style.borderStyle = 'dashed';
+ // Firefox light orange, https://www.mozilla.org/en-US/styleguide/identity/firefox/color/.
+ container.style.borderColor = '#FF9500';
+ }
+
+ function removeTrackingSign() {
+ container.style.borderStyle = null;
+ container.style.borderColor = null;
+ }
+})(); |
ce50cd526f259ac44c593dc2a1914e4106f427a0 | app/assets/javascripts/roster/sorts/reverse_number.js | app/assets/javascripts/roster/sorts/reverse_number.js | (function(){
var cleanNumber = function(i) {
return i.replace(/[^\-?0-9.]/g, '');
},
compareNumberReverse = function(a, b) {
a = parseFloat(a);
b = parseFloat(b);
a = isNaN(a) ? 0 : a;
b = isNaN(b) ? 0 : b;
return b - a;
};
Tablesort.extend('reverse_number', function(item) {
return item.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
a = cleanNumber(a);
b = cleanNumber(b);
return compareNumberReverse(b, a);
});
}());
| (function(){
var cleanNumber = function(i) {
var n = parseFloat(i.replace(/[^\-?0-9.]/g, ''));
return isNaN(n) ? null : n;
},
compareNumberReverse = function(a, b) {
// Treat null as always greater
if (a === null) return 1;
if (b === null) return -1;
return a - b;
};
Tablesort.extend('reverse_number', function(item) {
return item.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
return compareNumberReverse(cleanNumber(a), cleanNumber(b));
});
}());
| Sort null risk levels correctly | Sort null risk levels correctly
I'm a little surprised that the Tablesort comparator works in the exact
opposite way to pretty much every other comparator, but it's late, and I
could be missing something.
addresses #344
| JavaScript | mit | jhilde/studentinsights,studentinsights/studentinsights,erose/studentinsights,studentinsights/studentinsights,jhilde/studentinsights,jhilde/studentinsights,erose/studentinsights,studentinsights/studentinsights,jhilde/studentinsights,erose/studentinsights,erose/studentinsights,studentinsights/studentinsights | ---
+++
@@ -1,16 +1,16 @@
(function(){
var cleanNumber = function(i) {
- return i.replace(/[^\-?0-9.]/g, '');
+ var n = parseFloat(i.replace(/[^\-?0-9.]/g, ''));
+
+ return isNaN(n) ? null : n;
},
compareNumberReverse = function(a, b) {
- a = parseFloat(a);
- b = parseFloat(b);
+ // Treat null as always greater
+ if (a === null) return 1;
+ if (b === null) return -1;
- a = isNaN(a) ? 0 : a;
- b = isNaN(b) ? 0 : b;
-
- return b - a;
+ return a - b;
};
Tablesort.extend('reverse_number', function(item) {
@@ -18,9 +18,6 @@
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
- a = cleanNumber(a);
- b = cleanNumber(b);
-
- return compareNumberReverse(b, a);
+ return compareNumberReverse(cleanNumber(a), cleanNumber(b));
});
}()); |
d3c0d76c26119347957d55dbf6631aeaea36cab0 | js/parser/stack.js | js/parser/stack.js | (function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
if( sep > -1 )
{
var dbName = token.substring( 0, sep );
var path = token.substring( sep+1 ).split( '|', 2 );
if( path.length > 1 )
return widget.util.get( dbName, path[0], path[1] );
else
return widget.util.get( dbName, path[0] );
}
else
{
context = context || (widget.util.getStack() || [])[0];
return widget.get( context, token ) || "${" + token + "}";
}
}
})(); | (function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
var path;
if( sep > -1 )
{
var dbName = token.substring( 0, sep );
path = token.substring( sep+1 ).split( '|', 2 );
return widget.util.get( dbName, path[0], path[1] );
}
else
{
context = context || (widget.util.getStack() || [])[0];
path = token.split( '|', 2 );
return widget.get( context, path[0], path[1] ) || "${" + token + "}";
}
}
})(); | Fix bug not letting default values through in ${} templates | Fix bug not letting default values through in ${} templates | JavaScript | mit | tony-jacobs/widget.js,tony-jacobs/widget.js | ---
+++
@@ -12,19 +12,18 @@
function decode( token, context )
{
var sep = token.indexOf( ',' );
+ var path;
if( sep > -1 )
{
var dbName = token.substring( 0, sep );
- var path = token.substring( sep+1 ).split( '|', 2 );
- if( path.length > 1 )
- return widget.util.get( dbName, path[0], path[1] );
- else
- return widget.util.get( dbName, path[0] );
+ path = token.substring( sep+1 ).split( '|', 2 );
+ return widget.util.get( dbName, path[0], path[1] );
}
else
{
context = context || (widget.util.getStack() || [])[0];
- return widget.get( context, token ) || "${" + token + "}";
+ path = token.split( '|', 2 );
+ return widget.get( context, path[0], path[1] ) || "${" + token + "}";
}
}
|
af2249bfb9a85a5517b7d4c0321173f5d862ee59 | src/L.RotatedMarker.js | src/L.RotatedMarker.js | L.RotatedMarker = L.Marker.extend({
options: {
angle: 0
},
statics: {
// determine the best and only CSS transform rule to use for this browser
bestTransform: L.DomUtil.testProp([
'transform',
'WebkitTransform',
'msTransform',
'MozTransform',
'OTransform'
])
},
_setPos: function (pos) {
L.Marker.prototype._setPos.call(this, pos);
var rotate = ' rotate(' + this.options.angle + 'deg)';
if (L.RotatedMarker.bestTransform) {
// use the CSS transform rule if available
this._icon.style[L.RotatedMarker.bestTransform] += rotate;
} else if(L.Browser.ie) {
// fallback for IE6, IE7, IE8
var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
costheta = Math.cos(rad),
sintheta = Math.sin(rad);
this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
}
}
}); | L.RotatedMarker = L.Marker.extend({
options: {
angle: 0
},
statics: {
// determine the best and only CSS transform rule to use for this browser
bestTransform: L.DomUtil.testProp([
'transform',
'WebkitTransform',
'msTransform',
'MozTransform',
'OTransform'
])
},
_setPos: function (pos) {
L.Marker.prototype._setPos.call(this, pos);
var rotate = ' rotate(' + this.options.angle + 'deg)';
if (L.RotatedMarker.bestTransform) {
// use the CSS transform rule if available
this._icon.style[L.RotatedMarker.bestTransform] += rotate;
} else if(L.Browser.ie) {
// fallback for IE6, IE7, IE8
var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
costheta = Math.cos(rad),
sintheta = Math.sin(rad);
this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
}
}
}); | Replace tabs coming from bad editor conf with spaces | Replace tabs coming from bad editor conf with spaces
| JavaScript | mit | Stonelinks/Leaflet.PolylineDecorator,bbecquet/Leaflet.PolylineDecorator,bbecquet/Leaflet.PolylineDecorator,Stonelinks/Leaflet.PolylineDecorator | ---
+++
@@ -2,30 +2,30 @@
options: {
angle: 0
},
- statics: {
- // determine the best and only CSS transform rule to use for this browser
- bestTransform: L.DomUtil.testProp([
- 'transform',
- 'WebkitTransform',
- 'msTransform',
- 'MozTransform',
- 'OTransform'
- ])
- },
+ statics: {
+ // determine the best and only CSS transform rule to use for this browser
+ bestTransform: L.DomUtil.testProp([
+ 'transform',
+ 'WebkitTransform',
+ 'msTransform',
+ 'MozTransform',
+ 'OTransform'
+ ])
+ },
_setPos: function (pos) {
L.Marker.prototype._setPos.call(this, pos);
-
- var rotate = ' rotate(' + this.options.angle + 'deg)';
- if (L.RotatedMarker.bestTransform) {
- // use the CSS transform rule if available
- this._icon.style[L.RotatedMarker.bestTransform] += rotate;
- } else if(L.Browser.ie) {
- // fallback for IE6, IE7, IE8
- var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
- costheta = Math.cos(rad),
- sintheta = Math.sin(rad);
- this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
- costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
- }
+
+ var rotate = ' rotate(' + this.options.angle + 'deg)';
+ if (L.RotatedMarker.bestTransform) {
+ // use the CSS transform rule if available
+ this._icon.style[L.RotatedMarker.bestTransform] += rotate;
+ } else if(L.Browser.ie) {
+ // fallback for IE6, IE7, IE8
+ var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
+ costheta = Math.cos(rad),
+ sintheta = Math.sin(rad);
+ this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
+ costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
+ }
}
}); |
3bbb038cd182d7f3694874acbabe9fce4b77b040 | test/bundle.js | test/bundle.js | var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
function bundle (file) {
test('bundle transform', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + file);
b.transform(__dirname + '/..');
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
}
bundle('/../example/bar.js');
function testBundle(src, t) {
function log (msg) {
t.equal(msg, 555);
}
vm.runInNewContext(src, {
console: { log: log }
});
} | var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
test('no options bundle', function(t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/../example/bar.js');
b.transform(__dirname + '/..');
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
test('options bundle', function(t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/../example/bar.js');
b.transform(require('../index.js').jade({
pretty: false
}));
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
function testBundle(src, t) {
function log (msg) {
t.equal(msg, 555);
}
vm.runInNewContext(src, {
console: { log: log }
});
} | Add test for options transfomr | Add test for options transfomr
| JavaScript | mit | sidorares/pugify,sidorares/pugify,sidorares/browserify-jade,deedw/pugify,tellnes/browserify-jade,sidorares/browserify-jade,deedw/pugify,tellnes/browserify-jade | ---
+++
@@ -2,21 +2,29 @@
var browserify = require('browserify');
var vm = require('vm');
-function bundle (file) {
- test('bundle transform', function (t) {
- t.plan(1);
+test('no options bundle', function(t) {
+ t.plan(1);
+ var b = browserify();
+ b.add(__dirname + '/../example/bar.js');
+ b.transform(__dirname + '/..');
+ b.bundle(function (err, src) {
+ if (err) t.fail(err);
+ testBundle(src, t);
+ });
+});
- var b = browserify();
- b.add(__dirname + file);
- b.transform(__dirname + '/..');
- b.bundle(function (err, src) {
- if (err) t.fail(err);
- testBundle(src, t);
- });
+test('options bundle', function(t) {
+ t.plan(1);
+ var b = browserify();
+ b.add(__dirname + '/../example/bar.js');
+ b.transform(require('../index.js').jade({
+ pretty: false
+ }));
+ b.bundle(function (err, src) {
+ if (err) t.fail(err);
+ testBundle(src, t);
});
-}
-
-bundle('/../example/bar.js');
+});
function testBundle(src, t) {
function log (msg) { |
6323a5ef929ac6322c5eb4cf3730e8a0df21cbca | test/loader.js | test/loader.js | var tests = Object.keys(window.__karma__.files).filter(function (file) {
return (/Spec\.js$/).test(file);
});
requirejs.config({
// Karma serves files from '/base'
baseUrl: "/base",
paths: {
"sugar-web": ".",
"mustache": "lib/mustache",
"text": "lib/text"
},
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});
| var tests = Object.keys(window.__karma__.files).filter(function (file) {
return (/Spec\.js$/).test(file);
});
requirejs.config({
// Karma serves files from '/base'
baseUrl: "/base",
paths: {
"sugar-web": ".",
"mustache": "lib/mustache",
"text": "lib/text",
"webL10n": "lib/webL10n"
},
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});
| Add webL10n missing definition path | Add webL10n missing definition path
| JavaScript | apache-2.0 | sugarlabs/sugar-web,godiard/sugar-web | ---
+++
@@ -9,7 +9,8 @@
paths: {
"sugar-web": ".",
"mustache": "lib/mustache",
- "text": "lib/text"
+ "text": "lib/text",
+ "webL10n": "lib/webL10n"
},
// ask Require.js to load these files (all our tests) |
e947a1094535d2b4ea7d1113194d0f4906cf0f0d | src/main/js/lib/rivets-cfg.js | src/main/js/lib/rivets-cfg.js | define([
'rivets',
'jquery',
'rivets-backbone-adapter'
], function (rivets, $) {
'use strict';
rivets.formatters.join = function (array, separator) {
return $.isArray(array) ? array.join(separator) : array;
};
rivets.formatters.contains = function (array, needle) {
return $.isArray(array) ? $.inArray(needle, array) > -1 : false;
};
rivets.formatters.not = function (value) {
return !value;
};
rivets.formatters.unit = function(value, unit) {
return value || value === 0 ? value + unit : value;
};
return rivets;
});
| define([
'rivets',
'underscore',
'rivets-backbone-adapter'
], function (rivets, _) {
'use strict';
/* Make sure Array.isArray is available (should be). */
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
rivets.formatters.join = function (array, separator) {
return isArray(array) ? array.join(separator) : array;
};
rivets.formatters.contains = function (array, needle) {
return isArray(array) ? _.indexOf(array, needle) > -1 : false;
};
rivets.formatters.not = function (value) {
return !value;
};
rivets.formatters.unit = function(value, unit) {
return value || value === 0 ? value + unit : value;
};
return rivets;
});
| Use underscore rather than jQuery for array utils | Use underscore rather than jQuery for array utils | JavaScript | unknown | cyChop/beverages-js,cyChop/teas-js,cyChop/beverages-js,cyChop/beverages-js,cyChop/teas-js | ---
+++
@@ -1,17 +1,24 @@
define([
'rivets',
- 'jquery',
+ 'underscore',
'rivets-backbone-adapter'
-], function (rivets, $) {
+], function (rivets, _) {
'use strict';
+
+ /* Make sure Array.isArray is available (should be). */
+ if (!Array.isArray) {
+ Array.isArray = function(arg) {
+ return Object.prototype.toString.call(arg) === '[object Array]';
+ };
+ }
rivets.formatters.join = function (array, separator) {
- return $.isArray(array) ? array.join(separator) : array;
+ return isArray(array) ? array.join(separator) : array;
};
rivets.formatters.contains = function (array, needle) {
- return $.isArray(array) ? $.inArray(needle, array) > -1 : false;
+ return isArray(array) ? _.indexOf(array, needle) > -1 : false;
};
rivets.formatters.not = function (value) { |
7b74cba2f228f7a4bbab0fe6856b4842c47aaae1 | app/lib/config/index.js | app/lib/config/index.js | import fs from 'fs';
import path from 'path';
import { logFatal } from '../log';
const configPath = path.resolve(__dirname, 'config.js');
if (!fs.existsSync(configPath)) {
logFatal(`No config file called config.js found at ${configPath}`);
}
const config = require('./config.js');
const keys = Object.keys(config);
const missingKeys = ['restroomBotToken', 'kitchenBotToken', 'livingRoomBotToken'].filter(key => {
return !keys.includes(key);
})
console.log(missingKeys)
if (missingKeys.length != 0) {
logFatal(`Missing configuration variables: ${missingKeys.join()}`);
}
export default config
| import fs from 'fs';
import path from 'path';
import { logFatal } from '../log';
const configPath = path.resolve(__dirname, 'config.js');
if (!fs.existsSync(configPath)) {
logFatal(`No config file called config.js found at ${configPath}`);
}
// Use require syntax here because ES2015 module declarations are hoisted
const config = require('./config.js');
const keys = Object.keys(config);
const missingKeys = ['restroomBotToken', 'kitchenBotToken', 'livingRoomBotToken'].filter(key => {
return !keys.includes(key);
});
if (missingKeys.length != 0) {
logFatal(`Missing configuration variables: ${missingKeys.join()}`);
}
export default config
| Remove some debug statements in config parsing | Remove some debug statements in config parsing
| JavaScript | mit | melonmanchan/telegram-bot-iot-home | ---
+++
@@ -9,13 +9,14 @@
logFatal(`No config file called config.js found at ${configPath}`);
}
+// Use require syntax here because ES2015 module declarations are hoisted
const config = require('./config.js');
+
const keys = Object.keys(config);
+
const missingKeys = ['restroomBotToken', 'kitchenBotToken', 'livingRoomBotToken'].filter(key => {
return !keys.includes(key);
-})
-
-console.log(missingKeys)
+});
if (missingKeys.length != 0) {
logFatal(`Missing configuration variables: ${missingKeys.join()}`); |
32e492a065a57a14337f3043ab4509257e4755aa | src/app/PageActions.js | src/app/PageActions.js | var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
| var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
| Add messages link to the floating actions bubble | Add messages link to the floating actions bubble
| JavaScript | mit | Sekhmet/busy,busyorg/busy,Sekhmet/busy,busyorg/busy,ryanbaer/busy,ryanbaer/busy | ---
+++
@@ -1,5 +1,5 @@
var React = require('react'),
- {Link} = require('react-router');
+ {Link} = require('react-router');
module.exports = React.createClass({
render: function() {
@@ -16,7 +16,7 @@
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
- {this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
+ {this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div> |
b04a607862cc6d7d4390403def025199682b4849 | auth.example.js | auth.example.js | module.exports = {
facebook: {
appID: 'FACEBOOK_APP_ID',
appSecret: 'FACEBOOK_APP_SECRET',
callbackUrl: 'http://localhost:3000/auth/facebook/callback',
profileFields: ['id', 'displayName', 'name', 'email', 'gender', 'age_range', 'link', 'picture', 'locale', 'timezone', 'updated_time', 'verified']
},
amazon: {
appID: 'AMAZON_APP_ID',
appSecret: 'AMAZON_APP_SECRET',
callbackUrl: 'http://127.0.0.1:3000/auth/amazon/callback'
}
} | module.exports = {
facebook: {
appID: 'FACEBOOK_APP_ID',
appSecret: 'FACEBOOK_APP_SECRET',
callbackUrl: 'http://localhost:3000/auth/facebook/callback',
profileFields: ['id', 'displayName', 'name', 'email', 'gender', 'age_range', 'link', 'picture', 'locale', 'timezone', 'updated_time', 'verified']
},
amazon: {
appID: 'AMAZON_APP_ID',
appSecret: 'AMAZON_APP_SECRET',
callbackUrl: 'http://127.0.0.1:3000/auth/amazon/callback'
},
google: {
type: 'service_account',
project_id: 'GOOGLE_PROJECT_ID',
private_key_id: 'GOOGLE_PRIVATE_KEY_ID',
private_key: 'GOOGLE_PRIVATE_KEY',
client_email: 'GOOGLE_CLIENT_EMAIL',
client_id: 'GOOGLE_CLIENT_ID',
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
token_uri: 'https://accounts.google.com/o/oauth2/token',
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
client_x509_cert_url: 'GOOGLE_CLIENT_x509_CERT_URL'
}
} | Add template for google cloud api keys | Add template for google cloud api keys
| JavaScript | mit | scrumptiousAmpersand/journey,scrumptiousAmpersand/journey | ---
+++
@@ -9,5 +9,17 @@
appID: 'AMAZON_APP_ID',
appSecret: 'AMAZON_APP_SECRET',
callbackUrl: 'http://127.0.0.1:3000/auth/amazon/callback'
+ },
+ google: {
+ type: 'service_account',
+ project_id: 'GOOGLE_PROJECT_ID',
+ private_key_id: 'GOOGLE_PRIVATE_KEY_ID',
+ private_key: 'GOOGLE_PRIVATE_KEY',
+ client_email: 'GOOGLE_CLIENT_EMAIL',
+ client_id: 'GOOGLE_CLIENT_ID',
+ auth_uri: 'https://accounts.google.com/o/oauth2/auth',
+ token_uri: 'https://accounts.google.com/o/oauth2/token',
+ auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
+ client_x509_cert_url: 'GOOGLE_CLIENT_x509_CERT_URL'
}
} |
98596d7e98dfdf253d95511ccad880ce07c6c898 | auto-updater.js | auto-updater.js | const autoUpdater = require('electron').autoUpdater
const Menu = require('electron').Menu
var state = 'checking'
exports.initialize = function () {
autoUpdater.on('checking-for-update', function () {
state = 'checking'
exports.updateMenu()
})
autoUpdater.on('update-available', function () {
state = 'checking'
exports.updateMenu()
})
autoUpdater.on('update-downloaded', function () {
state = 'installed'
exports.updateMenu()
})
autoUpdater.on('update-not-available', function () {
state = 'no-update'
exports.updateMenu()
})
autoUpdater.on('error', function () {
state = 'no-update'
exports.updateMenu()
})
autoUpdater.setFeedURL('https://electron-api-demos.githubapp.com/mac')
autoUpdater.checkForUpdates()
}
exports.updateMenu = function () {
var menu = Menu.getApplicationMenu()
if (!menu) return
menu.items.forEach(function (item) {
if (item.submenu) {
item.submenu.items.forEach(function (item) {
switch (item.key) {
case 'checkForUpdate':
item.visible = state === 'no-update'
break
case 'checkingForUpdate':
item.visible = state === 'checking'
break
case 'restartToUpdate':
item.visible = state === 'installed'
break
}
})
}
})
}
| const autoUpdater = require('electron').autoUpdater
const Menu = require('electron').Menu
var state = 'checking'
exports.initialize = function () {
autoUpdater.on('checking-for-update', function () {
state = 'checking'
exports.updateMenu()
})
autoUpdater.on('update-available', function () {
state = 'checking'
exports.updateMenu()
})
autoUpdater.on('update-downloaded', function () {
state = 'installed'
exports.updateMenu()
})
autoUpdater.on('update-not-available', function () {
state = 'no-update'
exports.updateMenu()
})
autoUpdater.on('error', function () {
state = 'no-update'
exports.updateMenu()
})
autoUpdater.setFeedURL('https://electron-api-demos.githubapp.com/updates')
autoUpdater.checkForUpdates()
}
exports.updateMenu = function () {
var menu = Menu.getApplicationMenu()
if (!menu) return
menu.items.forEach(function (item) {
if (item.submenu) {
item.submenu.items.forEach(function (item) {
switch (item.key) {
case 'checkForUpdate':
item.visible = state === 'no-update'
break
case 'checkingForUpdate':
item.visible = state === 'checking'
break
case 'restartToUpdate':
item.visible = state === 'installed'
break
}
})
}
})
}
| Update URL for new cross-platform endpoint | Update URL for new cross-platform endpoint
| JavaScript | mit | blep/electron-api-demos,PanCheng111/XDF_Personal_Analysis,PanCheng111/XDF_Personal_Analysis,blep/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,electron/electron-api-demos,PanCheng111/XDF_Personal_Analysis,blep/electron-api-demos,electron/electron-api-demos | ---
+++
@@ -29,7 +29,7 @@
exports.updateMenu()
})
- autoUpdater.setFeedURL('https://electron-api-demos.githubapp.com/mac')
+ autoUpdater.setFeedURL('https://electron-api-demos.githubapp.com/updates')
autoUpdater.checkForUpdates()
}
|
3b350f504badedb16d46cbb470de311b12891e64 | web/js/main.js | web/js/main.js | jQuery(function ($) {
setup_search_box();
$('.tablesorter').tablesorter({
sortList: [[1,0]],
headers: {
1: { sorter: 'text'},
2: { sorter: false }
}
});
});
function setup_search_box() {
var el = $('#my_search_box .search');
if ( ! el.length ) { return; }
// Here we have logic for handling cases where user views a repo
// and then presses "Back" to go back to the list. We want to
// (a) NOT scroll to search input if scroll position is offset.
// This is a "Back" after scrolling and viewing a repo
// (b) Refresh 'search' if search input has some text.
// This is a "Back" after clicking on search results
if ( $(window).scrollTop() == 0 ) {
el.focus();
}
if ( el.val().length ) {
userList.search(el.val());
}
}
| jQuery(function ($) {
setup_search_box();
$('.tablesorter').tablesorter({
sortList: [[0,0]],
headers: {
1: { sorter: 'text'},
2: { sorter: false }
}
});
});
function setup_search_box() {
var el = $('#my_search_box .search');
if ( ! el.length ) { return; }
// Here we have logic for handling cases where user views a repo
// and then presses "Back" to go back to the list. We want to
// (a) NOT scroll to search input if scroll position is offset.
// This is a "Back" after scrolling and viewing a repo
// (b) Refresh 'search' if search input has some text.
// This is a "Back" after clicking on search results
if ( $(window).scrollTop() == 0 ) {
el.focus();
}
if ( el.val().length ) {
userList.search(el.val());
}
}
| Fix default sort order. azawawi-- | Fix default sort order. azawawi--
| JavaScript | artistic-2.0 | perl6/modules.perl6.org,perl6/modules.perl6.org,perl6/modules.perl6.org,perl6/modules.perl6.org | ---
+++
@@ -1,7 +1,7 @@
jQuery(function ($) {
setup_search_box();
$('.tablesorter').tablesorter({
- sortList: [[1,0]],
+ sortList: [[0,0]],
headers: {
1: { sorter: 'text'},
2: { sorter: false } |
779b5dfc590226388052062c98b329362de8ada7 | money-format/money-format.js | money-format/money-format.js | 'use strict';
function formatMoney(value) {
var rem = value - ~~value;
var arr = String(~~value).split('');
var result = [];
while (arr.length) {
var from = Math.max(0, arr.length - 3);
result.unshift(arr.splice(from, 3));
}
return result.reduce(function (a, b) {
return a + ' ' + b.join('');
}) + rem.toFixed(2).slice(1);
}
| module.exports = function (value) {
var remaining = value - ~~value,
string = '' + ~~value,
length = string.length,
places = 0;
while (--length) {
places += 1;
// At every third position we want to insert a comma
if (places % 3 === 0) {
string = string.substr(0, length) + ',' + string.substr(length);
}
}
return '$' + string + remaining.toFixed(2).slice(1);
}
| Apply functionality from the number format to the money format solution. | Apply functionality from the number format to the money format solution.
| JavaScript | mit | akaragkiozidis/code-problems,AndrewKishino/code-problems,blakeembrey/code-problems,ankur-anand/code-problems,patrickford/code-problems,BastinRobin/code-problems,patrickford/code-problems,lgulliver/code-problems,blakeembrey/code-problems,cjjavellana/code-problems,nickell-andrew/code-problems,tahoeRobbo/code-problems,ranveer-git/code-problems,akaragkiozidis/code-problems,ockang/code-problems,ankur-anand/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,nacho-gil/code-problems,nickell-andrew/code-problems,saurabhjn76/code-problems,ankur-anand/code-problems,akaragkiozidis/code-problems,sethdame/code-problems,nickell-andrew/code-problems,faruzzy/code-problems,patrickford/code-problems,sethdame/code-problems,rkho/code-problems,jmera/code-problems,aloisdg/code-problems,saurabhjn76/code-problems,caoglish/code-problems,hlan2/code-problems,jmera/code-problems,nacho-gil/code-problems,AndrewKishino/code-problems,nacho-gil/code-problems,ranveer-git/code-problems,angelkar/code-problems,lgulliver/code-problems,netuoso/code-problems,sethdame/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,jefimenko/code-problems,dwatson3/code-problems,ockang/code-problems,AndrewKishino/code-problems,AndrewKishino/code-problems,blakeembrey/code-problems,rkho/code-problems,Widea/code-problems,nacho-gil/code-problems,akaragkiozidis/code-problems,aloisdg/code-problems,tahoeRobbo/code-problems,sisirkoppaka/code-problems,akaragkiozidis/code-problems,modulexcite/code-problems,diversedition/code-problems,ranveer-git/code-problems,blakeembrey/code-problems,tahoeRobbo/code-problems,nacho-gil/code-problems,Widea/code-problems,ranveer-git/code-problems,tahoeRobbo/code-problems,jefimenko/code-problems,marcoviappiani/code-problems,caoglish/code-problems,blakeembrey/code-problems,nickell-andrew/code-problems,tahoeRobbo/code-problems,lgulliver/code-problems,ankur-anand/code-problems,aloisdg/code-problems,ankur-anand/code-problems,akaragkiozidis/code-problems,dwatson3/code-problems,modulexcite/code-problems,BastinRobin/code-problems,angelkar/code-problems,sisirkoppaka/code-problems,SterlingVix/code-problems,nickell-andrew/code-problems,hlan2/code-problems,cjjavellana/code-problems,modulexcite/code-problems,ranveer-git/code-problems,dwatson3/code-problems,ockang/code-problems,hlan2/code-problems,diversedition/code-problems,caoglish/code-problems,marcoviappiani/code-problems,angelkar/code-problems,jmera/code-problems,cjjavellana/code-problems,ockang/code-problems,lgulliver/code-problems,patrickford/code-problems,aloisdg/code-problems,nacho-gil/code-problems,SterlingVix/code-problems,faruzzy/code-problems,marcoviappiani/code-problems,sisirkoppaka/code-problems,nacho-gil/code-problems,SterlingVix/code-problems,ranveer-git/code-problems,BastinRobin/code-problems,caoglish/code-problems,jmera/code-problems,SterlingVix/code-problems,jefimenko/code-problems,diversedition/code-problems,faruzzy/code-problems,BastinRobin/code-problems,AndrewKishino/code-problems,aloisdg/code-problems,diversedition/code-problems,caoglish/code-problems,saurabhjn76/code-problems,rkho/code-problems,akaragkiozidis/code-problems,modulexcite/code-problems,modulexcite/code-problems,faruzzy/code-problems,ockang/code-problems,modulexcite/code-problems,modulexcite/code-problems,sisirkoppaka/code-problems,jmera/code-problems,aloisdg/code-problems,rkho/code-problems,jefimenko/code-problems,marcoviappiani/code-problems,marcoviappiani/code-problems,patrickford/code-problems,sethdame/code-problems,lgulliver/code-problems,Widea/code-problems,BastinRobin/code-problems,ockang/code-problems,caoglish/code-problems,ockang/code-problems,jefimenko/code-problems,jefimenko/code-problems,modulexcite/code-problems,nickell-andrew/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,angelkar/code-problems,caoglish/code-problems,ankur-anand/code-problems,tahoeRobbo/code-problems,nickell-andrew/code-problems,sisirkoppaka/code-problems,dwatson3/code-problems,jmera/code-problems,jmera/code-problems,aloisdg/code-problems,marcoviappiani/code-problems,diversedition/code-problems,BastinRobin/code-problems,AndrewKishino/code-problems,rkho/code-problems,sethdame/code-problems,SterlingVix/code-problems,SterlingVix/code-problems,AndrewKishino/code-problems,ranveer-git/code-problems,saurabhjn76/code-problems,marcoviappiani/code-problems,angelkar/code-problems,angelkar/code-problems,faruzzy/code-problems,jmera/code-problems,akaragkiozidis/code-problems,cjjavellana/code-problems,sisirkoppaka/code-problems,angelkar/code-problems,marcoviappiani/code-problems,diversedition/code-problems,dwatson3/code-problems,hlan2/code-problems,Widea/code-problems,SterlingVix/code-problems,ankur-anand/code-problems,jefimenko/code-problems,angelkar/code-problems,lgulliver/code-problems,rkho/code-problems,modulexcite/code-problems,jefimenko/code-problems,netuoso/code-problems,nacho-gil/code-problems,sethdame/code-problems,saurabhjn76/code-problems,netuoso/code-problems,aloisdg/code-problems,faruzzy/code-problems,netuoso/code-problems,patrickford/code-problems,ankur-anand/code-problems,Widea/code-problems,netuoso/code-problems,hlan2/code-problems,faruzzy/code-problems,tahoeRobbo/code-problems,rkho/code-problems,cjjavellana/code-problems,sethdame/code-problems,dwatson3/code-problems,angelkar/code-problems,blakeembrey/code-problems,netuoso/code-problems,AndrewKishino/code-problems,diversedition/code-problems,akaragkiozidis/code-problems,ankur-anand/code-problems,faruzzy/code-problems,caoglish/code-problems,sisirkoppaka/code-problems,Widea/code-problems,jmera/code-problems,ranveer-git/code-problems,hlan2/code-problems,caoglish/code-problems,rkho/code-problems,cjjavellana/code-problems,patrickford/code-problems,tahoeRobbo/code-problems,cjjavellana/code-problems,Widea/code-problems,aloisdg/code-problems,jefimenko/code-problems,netuoso/code-problems,lgulliver/code-problems,Widea/code-problems,jmera/code-problems,tahoeRobbo/code-problems,hlan2/code-problems,BastinRobin/code-problems,sethdame/code-problems,nickell-andrew/code-problems,marcoviappiani/code-problems,cjjavellana/code-problems,modulexcite/code-problems,angelkar/code-problems,BastinRobin/code-problems,marcoviappiani/code-problems,netuoso/code-problems,hlan2/code-problems,dwatson3/code-problems,tahoeRobbo/code-problems,ockang/code-problems,SterlingVix/code-problems,dwatson3/code-problems,AndrewKishino/code-problems,AndrewKishino/code-problems,sethdame/code-problems,ockang/code-problems,sisirkoppaka/code-problems,sisirkoppaka/code-problems,saurabhjn76/code-problems,netuoso/code-problems,rkho/code-problems,lgulliver/code-problems,hlan2/code-problems,nickell-andrew/code-problems,patrickford/code-problems,nickell-andrew/code-problems,sethdame/code-problems,SterlingVix/code-problems,ranveer-git/code-problems,nacho-gil/code-problems,cjjavellana/code-problems,blakeembrey/code-problems,BastinRobin/code-problems,diversedition/code-problems,caoglish/code-problems,cjjavellana/code-problems,sisirkoppaka/code-problems,dwatson3/code-problems,lgulliver/code-problems,SterlingVix/code-problems,patrickford/code-problems,hlan2/code-problems,akaragkiozidis/code-problems,nacho-gil/code-problems,Widea/code-problems,aloisdg/code-problems,Widea/code-problems,jefimenko/code-problems,ranveer-git/code-problems,ankur-anand/code-problems,saurabhjn76/code-problems,rkho/code-problems,faruzzy/code-problems,faruzzy/code-problems,ockang/code-problems,diversedition/code-problems,lgulliver/code-problems,dwatson3/code-problems,patrickford/code-problems | ---
+++
@@ -1,16 +1,16 @@
-'use strict';
+module.exports = function (value) {
+ var remaining = value - ~~value,
+ string = '' + ~~value,
+ length = string.length,
+ places = 0;
-function formatMoney(value) {
- var rem = value - ~~value;
- var arr = String(~~value).split('');
- var result = [];
-
- while (arr.length) {
- var from = Math.max(0, arr.length - 3);
- result.unshift(arr.splice(from, 3));
+ while (--length) {
+ places += 1;
+ // At every third position we want to insert a comma
+ if (places % 3 === 0) {
+ string = string.substr(0, length) + ',' + string.substr(length);
+ }
}
- return result.reduce(function (a, b) {
- return a + ' ' + b.join('');
- }) + rem.toFixed(2).slice(1);
+ return '$' + string + remaining.toFixed(2).slice(1);
} |
4cf97eb49b15261f9aeb197a6c6c488f7082bea8 | src/containers/Home.js | src/containers/Home.js | import React from 'react'
import { getSiteProps } from 'react-static'
//
import logoImg from '../logo.png'
export default getSiteProps(() => (
<div>
<div id="social-media-links">
<a target="_blank" href="https://www.linkedin.com/in/tanay-prabhudesai-1029b073/"><i className="fa fa-linkedin" aria-hidden="true"></i></a>
<a target="_blank" href="https://plus.google.com/+TanayPrabhuDesai"><i className="fa fa-google" aria-hidden="true"></i></a>
<a target="_blank" href="https://twitter.com/tanayseven"><i className="fa fa-twitter" aria-hidden="true"></i></a>
<a target="_blank" href="https://github.com/tanayseven"><i className="fa fa-github" aria-hidden="true"></i></a>
</div>
<p>Hi, I'm Tanay PrabhuDesai.</p>
<p>I'm a software engineer based in Pune, India.</p>
<p>This website is generated using <a href="https://github.com/tanayseven/personal_website/">Frozen Flask</a></p>
</div>
))
| import React from 'react'
import { getSiteProps } from 'react-static'
//
import logoImg from '../logo.png'
export default getSiteProps(() => (
<div>
<div id="social-media-links">
<a target="_blank" href="https://www.linkedin.com/in/tanay-prabhudesai-1029b073/"><i className="fa fa-linkedin" aria-hidden="true"></i></a>
<a target="_blank" href="https://plus.google.com/+TanayPrabhuDesai"><i className="fa fa-google" aria-hidden="true"></i></a>
<a target="_blank" href="https://twitter.com/tanayseven"><i className="fa fa-twitter" aria-hidden="true"></i></a>
<a target="_blank" href="https://github.com/tanayseven"><i className="fa fa-github" aria-hidden="true"></i></a>
</div>
<p>Hi, I'm Tanay PrabhuDesai.</p>
<p>I'm a software engineer based in Pune, India.</p>
</div>
))
| Remove unnessary line from home page | Remove unnessary line from home page
| JavaScript | mit | tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website | ---
+++
@@ -13,6 +13,5 @@
</div>
<p>Hi, I'm Tanay PrabhuDesai.</p>
<p>I'm a software engineer based in Pune, India.</p>
- <p>This website is generated using <a href="https://github.com/tanayseven/personal_website/">Frozen Flask</a></p>
</div>
)) |
3f595eb3dee06021ca5fe5994bc8500844230286 | packages/apollo-server-env/src/index.browser.js | packages/apollo-server-env/src/index.browser.js | if (!global) {
global = self;
}
let { fetch, Request, Response, Headers, URL, URLSearchParams } = global;
fetch = fetch.bind(global);
export { fetch, Request, Response, Headers, URL, URLSearchParams };
if (!global.process) {
global.process = {};
}
if (!global.process.env) {
global.process.env = {
NODE_ENV: 'production',
};
}
if (!global.process.version) {
global.process.version = '';
}
if (!global.process.hrtime) {
// Adapted from https://github.com/kumavis/browser-process-hrtime
global.process.hrtime = function hrtime(previousTimestamp) {
var clocktime = Date.now() * 1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor((clocktime % 1) * 1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
if (nanoseconds < 0) {
seconds--;
nanoseconds += 1e9;
}
}
return [seconds, nanoseconds];
};
}
if (!global.os) {
// FIXME: Add some sensible values
global.os = {};
}
| if (!global) {
global = self;
}
let { fetch, Request, Response, Headers, URL, URLSearchParams } = global;
fetch = fetch.bind(global);
export { fetch, Request, Response, Headers, URL, URLSearchParams };
if (!global.process) {
global.process = {};
}
if (!global.process.env) {
global.process.env = {
// app is a global available on fly.io
NODE_ENV: app ? app.env : 'production',
};
}
if (!global.process.version) {
global.process.version = '';
}
if (!global.process.hrtime) {
// Adapted from https://github.com/kumavis/browser-process-hrtime
global.process.hrtime = function hrtime(previousTimestamp) {
var clocktime = Date.now() * 1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor((clocktime % 1) * 1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
if (nanoseconds < 0) {
seconds--;
nanoseconds += 1e9;
}
}
return [seconds, nanoseconds];
};
}
if (!global.os) {
// FIXME: Add some sensible values
global.os = {};
}
| Use fly.io app env when available | Use fly.io app env when available
| JavaScript | mit | apollostack/apollo-server | ---
+++
@@ -12,7 +12,8 @@
if (!global.process.env) {
global.process.env = {
- NODE_ENV: 'production',
+ // app is a global available on fly.io
+ NODE_ENV: app ? app.env : 'production',
};
}
|
8b357cc16eefad716cd1b22ceee75ee6423ac36c | packages/babel-plugin-react-server/src/index.js | packages/babel-plugin-react-server/src/index.js | import loggerSpec from 'react-server-module-tagger';
import path from 'path';
module.exports = function() {
return {
visitor: {
Identifier(p, state) {
const {node} = p;
const {name} = node;
const config = { trim: state.opts.trim };
const parent = path.resolve(path.join(process.cwd(), '..')) + path.sep;
const fp = this.file.opts.filename.replace(parent, '');
const file = { path: fp };
//TODO: Support labels
const moduleTag = loggerSpec.bind({ file, config })(fp);
let tokens;
if (state.opts.tokens) {
tokens = new Set(state.opts.tokens);
} else {
tokens = new Set(["__LOGGER__", "__CHANNEL__", "__CACHE__"]);
}
if (tokens.has(name)) {
// this strikes me as a dirty, nasty hack. I think it would be better
// to parse the object as json and coerce it to an array of
// ObjectProperties to construct an ObjectExpression
p.node.name = moduleTag;
}
},
},
};
}
| import loggerSpec from 'react-server-module-tagger';
import path from 'path';
module.exports = function() {
return {
visitor: {
Identifier(p, state) {
const {node} = p;
const {name} = node;
const trim = state.opts.trim;
const parent = path.resolve(path.join(process.cwd(), '..')) + path.sep;
const filePath = this.file.opts.filename.replace(parent, '');
//TODO: Support labels
const moduleTag = loggerSpec({ filePath, trim });
let tokens;
if (state.opts.tokens) {
tokens = new Set(state.opts.tokens);
} else {
tokens = new Set(["__LOGGER__", "__CHANNEL__", "__CACHE__"]);
}
if (tokens.has(name)) {
// this strikes me as a dirty, nasty hack. I think it would be better
// to parse the object as json and coerce it to an array of
// ObjectProperties to construct an ObjectExpression
p.node.name = moduleTag;
}
},
},
};
}
| Update babel-plugin-react-server to use new react-server-module-tagger interface | Update babel-plugin-react-server to use new react-server-module-tagger interface
| JavaScript | apache-2.0 | redfin/react-server,lidawang/react-server,emecell/react-server,emecell/react-server,doug-wade/react-server,davidalber/react-server,szhou8813/react-server,redfin/react-server,lidawang/react-server,doug-wade/react-server,davidalber/react-server,szhou8813/react-server | ---
+++
@@ -8,13 +8,12 @@
const {node} = p;
const {name} = node;
- const config = { trim: state.opts.trim };
+ const trim = state.opts.trim;
const parent = path.resolve(path.join(process.cwd(), '..')) + path.sep;
- const fp = this.file.opts.filename.replace(parent, '');
- const file = { path: fp };
+ const filePath = this.file.opts.filename.replace(parent, '');
//TODO: Support labels
- const moduleTag = loggerSpec.bind({ file, config })(fp);
+ const moduleTag = loggerSpec({ filePath, trim });
let tokens;
if (state.opts.tokens) { |
e97f2b91fbb50a63a5d831424d871f91499dba54 | src/project/job/run/client.js | src/project/job/run/client.js | 'use strict';
import JobClient from '../client';
let apiClient;
class DrushIORun {
constructor(client, project, job, identifier, data = {}) {
apiClient = client;
this.project = project;
this.job = job || new JobClient(client, project, data.job.id);
this.identifier = identifier;
this.data = data;
}
/**
* Retrieves run details for this job run.
* @return {Promise}
*/
get() {
return new Promise((resolve, reject) => {
apiClient.get(`/projects/${this.project.identifier}/${this.job.identifier}/run/${this.identifier}`).then((response) => {
this.data = response.body;
resolve(this)
}).catch((err) => {
reject(err);
});
});
}
}
export default DrushIORun;
| 'use strict';
import JobClient from '../client';
let apiClient;
class DrushIORun {
constructor(client, project, job, identifier, data = {}) {
apiClient = client;
this.project = project;
this.job = job || new JobClient(client, project, data.job.id);
this.identifier = identifier;
this.data = data;
}
/**
* Retrieves run details for this job run.
* @return {Promise}
*/
get() {
return new Promise((resolve, reject) => {
apiClient.get(`/projects/${this.project.identifier}/jobs/${this.job.identifier}/runs/${this.identifier}`).then((response) => {
this.data = response.body;
resolve(this)
}).catch((err) => {
reject(err);
});
});
}
}
export default DrushIORun;
| Fix bug in job run get() method. | Fix bug in job run get() method.
| JavaScript | mit | drush-io/api-client-js,drush-io/api-client-js | ---
+++
@@ -20,7 +20,7 @@
*/
get() {
return new Promise((resolve, reject) => {
- apiClient.get(`/projects/${this.project.identifier}/${this.job.identifier}/run/${this.identifier}`).then((response) => {
+ apiClient.get(`/projects/${this.project.identifier}/jobs/${this.job.identifier}/runs/${this.identifier}`).then((response) => {
this.data = response.body;
resolve(this)
}).catch((err) => { |
f4cf0a97431feccd5e34f8c12ba1b304a827afee | bin/gonzales.js | bin/gonzales.js | #!/usr/bin/env node
var parseArgs = require('minimist');
var gonzales = require('..');
var fs = require('fs');
var path = require('path');
var options = getOptions();
process.stdin.isTTY ? processFile(options._[0]) : processSTDIN();
function getOptions() {
var parserOptions = {
boolean: ['silent'],
alias: {
syntax: 's',
context: 'c'
}
};
return parseArgs(process.argv.slice(2), parserOptions);
}
function processSTDIN() {
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
input += data;
});
process.stdin.on('end', function () {
processInputData(input);
});
}
function processFile(file) {
if (!file) process.exit(0);
if (!options.syntax) options.syntax = path.extname(file).substring(1);
var css = fs.readFileSync(file, 'utf-8').trim();
processInputData(css);
}
function processInputData(input) {
try {
var ast = gonzales.parse(input, {
syntax: options.syntax,
rule: options.context
});
process.stdout.write(ast.toJson());
process.exit(0);
} catch (e) {
if (!options.silent) process.stderr.write(e.message);
process.exit(1);
}
}
| #!/usr/bin/env node
var parseArgs = require('minimist');
var gonzales = require('..');
var fs = require('fs');
var path = require('path');
var options = getOptions();
process.stdin.isTTY ? processFile(options._[0]) : processSTDIN();
function getOptions() {
var parserOptions = {
boolean: ['silent'],
alias: {
syntax: 's',
context: 'c'
}
};
return parseArgs(process.argv.slice(2), parserOptions);
}
function processSTDIN() {
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
input += data;
});
process.stdin.on('end', function () {
processInputData(input);
});
}
function processFile(file) {
if (!file) process.exit(0);
if (!options.syntax) options.syntax = path.extname(file).substring(1);
var css = fs.readFileSync(file, 'utf-8').trim();
processInputData(css);
}
function processInputData(input) {
try {
var ast = gonzales.parse(input, {
syntax: options.syntax,
rule: options.context
});
process.stdout.write(ast.toJson());
process.exit(0);
} catch (e) {
if (!options.silent) process.stderr.write(e.toString());
process.exit(1);
}
}
| Print more complete error message | [cli] Print more complete error message
| JavaScript | mit | brendanlacroix/gonzales-pe,brendanlacroix/gonzales-pe,tonyganch/gonzales-pe,tonyganch/gonzales-pe | ---
+++
@@ -47,7 +47,7 @@
process.stdout.write(ast.toJson());
process.exit(0);
} catch (e) {
- if (!options.silent) process.stderr.write(e.message);
+ if (!options.silent) process.stderr.write(e.toString());
process.exit(1);
}
} |
3003685020f4a81aeb363297e64aba430282fd2d | test/protractor.conf.js | test/protractor.conf.js | // An example configuration file.
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
allScriptsTimeout: 11000,
specs: [
'e2e/specs/*.js'
],
capabilities: {
'browserName': 'chrome'
},
chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
}; | // Docs for protractor 0.24:
// https://github.com/angular/protractor/blob/8582b195ed0f4d48a0d9513017b21e99f8feb2fe/docs/api.md
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
allScriptsTimeout: 11000,
specs: [
'e2e/specs/*.js'
],
capabilities: {
'browserName': 'chrome'
},
chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
}; | Add comment pointing to appropriate version of protractor API | Add comment pointing to appropriate version of protractor API
| JavaScript | mit | davidfurlong/ng-inspector,kennyx46/ng-inspector,rev087/ng-inspector,davidfurlong/ng-inspector,hafeez-syed/ng-inspector,hitesh97/ng-inspector,haithemaraissia/ng-inspector,rev087/ng-inspector,DrewML/ng-inspector,vitvad/ng-inspector,hitesh97/ng-inspector,vitvad/ng-inspector,hafeez-syed/ng-inspector,haithemaraissia/ng-inspector,DrewML/ng-inspector,kennyx46/ng-inspector | ---
+++
@@ -1,4 +1,5 @@
-// An example configuration file.
+// Docs for protractor 0.24:
+// https://github.com/angular/protractor/blob/8582b195ed0f4d48a0d9513017b21e99f8feb2fe/docs/api.md
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY, |
530736b932d75daddb7b5fa7c732ac8a35de3e73 | browser/menu.js | browser/menu.js | var app = require('app');
var BrowserWindow = require('browser-window');
var menu = module.exports = [];
var isDarwin = process.platform === 'darwin';
menu.push(
{
label: '&File',
submenu: [
{
label: '&Quit',
accelerator: 'CmdOrCtrl+Q',
click: function () {
app.quit();
}
}
]
}
);
menu.push(
{
label: '&Debug',
submenu: [
{
label: '&Reload',
accelerator: 'CmdOrCtrl+R',
click: function () {
BrowserWindow.getFocusedWindow().reloadIgnoringCache();
}
},
{
label: 'Toggle &Developer Tools',
accelerator: isDarwin ? 'Alt+Cmd+I' : 'Ctrl+Shift+I',
click: function () {
BrowserWindow.getFocusedWindow().toggleDevTools();
}
}
]
}
);
| var app = require('app');
var BrowserWindow = require('browser-window');
var menu = module.exports = [];
var isDarwin = process.platform === 'darwin';
menu.push(
{
label: '&File',
submenu: [
{
label: '&Quit',
accelerator: 'CmdOrCtrl+Q',
click: function () {
app.quit();
}
}
]
}
);
menu.push(
{
label: '&Debug',
submenu: [
{
label: '&Reload',
accelerator: 'CmdOrCtrl+R',
click: function () {
BrowserWindow.getFocusedWindow().reloadIgnoringCache();
}
},
{
label: 'Toggle &Developer Tools',
accelerator: isDarwin ? 'Alt+Cmd+I' : 'Ctrl+Shift+I',
click: function () {
BrowserWindow.getFocusedWindow().toggleDevTools();
}
}
]
}
);
menu.push(
{
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'Command+Z',
selector: 'undo:'
},
{
label: 'Redo',
accelerator: 'Shift+Command+Z',
selector: 'redo:'
},
{
type: 'separator'
},
{
label: 'Cut',
accelerator: 'Command+X',
selector: 'cut:'
},
{
label: 'Copy',
accelerator: 'Command+C',
selector: 'copy:'
},
{
label: 'Paste',
accelerator: 'Command+V',
selector: 'paste:'
},
{
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
},
]
}
);
| Allow copy and paste in electron app | Allow copy and paste in electron app
| JavaScript | lgpl-2.1 | GMOD/jbrowse,GMOD/jbrowse,erasche/jbrowse,GMOD/jbrowse,erasche/jbrowse,nathandunn/jbrowse,Arabidopsis-Information-Portal/jbrowse,Arabidopsis-Information-Portal/jbrowse,Arabidopsis-Information-Portal/jbrowse,erasche/jbrowse,nathandunn/jbrowse,GMOD/jbrowse,nathandunn/jbrowse,Arabidopsis-Information-Portal/jbrowse,Arabidopsis-Information-Portal/jbrowse,Arabidopsis-Information-Portal/jbrowse,erasche/jbrowse,erasche/jbrowse,Arabidopsis-Information-Portal/jbrowse,nathandunn/jbrowse,erasche/jbrowse,nathandunn/jbrowse,erasche/jbrowse,GMOD/jbrowse,erasche/jbrowse | ---
+++
@@ -40,3 +40,44 @@
]
}
);
+
+menu.push(
+ {
+ label: 'Edit',
+ submenu: [
+ {
+ label: 'Undo',
+ accelerator: 'Command+Z',
+ selector: 'undo:'
+ },
+ {
+ label: 'Redo',
+ accelerator: 'Shift+Command+Z',
+ selector: 'redo:'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ label: 'Cut',
+ accelerator: 'Command+X',
+ selector: 'cut:'
+ },
+ {
+ label: 'Copy',
+ accelerator: 'Command+C',
+ selector: 'copy:'
+ },
+ {
+ label: 'Paste',
+ accelerator: 'Command+V',
+ selector: 'paste:'
+ },
+ {
+ label: 'Select All',
+ accelerator: 'Command+A',
+ selector: 'selectAll:'
+ },
+ ]
+ }
+); |
2c9dc54e90aff065be59fa970975b33edc497e53 | src/scripts/formController.js | src/scripts/formController.js | /**
* Controller to bring functionality for the modal.
*
* @author Claire Wilgar
*/
/**
* Module export of controller function.
*
* @ngInject
* @param {angular.Service} $scope
* @param {angular.Service} $mdDialog
* @param {service} ApiService
* @param {var} item
*/
module.exports = function($scope, $mdDialog, ApiService, item) {
var self = this;
self.item = item;
if (!angular.isUndefined(self.item.available)) {
console.log(self.item.available);
self.item.available = new Date(self.item.available);
}
self.hide = function() {
$mdDialog.hide();
};
self.cancel = function() {
$mdDialog.cancel();
};
self.submitForm = function(data) {
ApiService.submitForm(data)
.then(function() {
$mdDialog.hide(data);
}, function(response) {
$mdDialog.cancel(response);
});
};
};
| /**
* Controller to bring functionality for the modal.
*
* @author Claire Wilgar
*/
/**
* Module export of controller function.
*
* @ngInject
* @param {angular.Service} $scope
* @param {angular.Service} $mdDialog
* @param {service} ApiService
* @param {var} item
*/
module.exports = function($scope, $mdDialog, ApiService, item) {
var self = this;
self.item = item;
if (!angular.isUndefined(self.item) && self.item != null) {
console.log(self.item.available);
self.item.available = new Date(self.item.available);
}
self.hide = function() {
$mdDialog.hide();
};
self.cancel = function() {
$mdDialog.cancel();
};
self.submitForm = function(data) {
ApiService.submitForm(data)
.then(function() {
$mdDialog.hide(data);
}, function(response) {
$mdDialog.cancel(response);
});
};
};
| Fix issue checking date when creating new item | Fix issue checking date when creating new item
| JavaScript | mit | clairebones/stockkeeper,clairebones/stockkeeper | ---
+++
@@ -19,7 +19,7 @@
self.item = item;
- if (!angular.isUndefined(self.item.available)) {
+ if (!angular.isUndefined(self.item) && self.item != null) {
console.log(self.item.available);
self.item.available = new Date(self.item.available);
} |
b9a1e215e2ce93daf684dfc1e3b5588352cea375 | admin/server/routes/signout.js | admin/server/routes/signout.js | var keystone = require('../../../');
var session = require('../../../lib/session');
module.exports = function (req, res) {
session.signout(req, res, function () {
if (typeof keystone.get('signout redirect') === 'string') {
return res.redirect(keystone.get('signout redirect'));
} else if (typeof keystone.get('signout redirect') === 'function') {
return keystone.get('signout redirect')(req, res);
} else {
return res.redirect('/' + keystone.get('admin path') + '/signin?signedout');
}
});
};
| var keystone = require('../../../');
var session = require('../../../lib/session');
module.exports = function (req, res) {
session.signout(req, res, function () {
if (typeof keystone.get('signout redirect') === 'string') {
return res.redirect(keystone.get('signout redirect'));
} else if (typeof keystone.get('signout redirect') === 'function') {
return keystone.get('signout redirect')(req, res);
} else {
return res.redirect('/' + keystone.get('admin path') + '/signin?signedout');
// After logging out, the user will be redirected to /signin?signedout
// It shows a bar on top of the sign in panel saying "You have been signed out".
}
});
};
| Comment for signin?signedout version added | Comment for signin?signedout version added
| JavaScript | mit | creynders/keystone,creynders/keystone | ---
+++
@@ -9,6 +9,8 @@
return keystone.get('signout redirect')(req, res);
} else {
return res.redirect('/' + keystone.get('admin path') + '/signin?signedout');
+ // After logging out, the user will be redirected to /signin?signedout
+ // It shows a bar on top of the sign in panel saying "You have been signed out".
}
});
}; |
21898f01d9ee9559e7d5413f6e96ab65ff2f02b1 | actions/actions.js | actions/actions.js |
// All actions, used by actions or reducers, go here
export const CLOSE_CARD = 'CLOSE_CARD'
export const LOAD_CARD_PAGE = 'LOAD_CARD_PAGE'
export const NAVIGATE = 'NAVIGATE'
export const OPEN_CARD = 'OPEN_CARD'
export const RECEIVE_ALL_REGIONS = 'RECEIVE_ALL_REGIONS'
export const RECEIVE_CARD_PAGE_DATA = 'RECEIVE_CARD_PAGE_DATA'
export const RECEIVE_CARD_PAGES = 'RECEIVE_CARD_PAGES'
export const RECEIVE_CARD_QUERY = 'RECEIVE_CARD_QUERY'
export const RECEIVE_CHART_DATA = 'RECEIVE_CHART_DATA'
export const RECEIVE_QUERY_RESULT = 'RECEIVE_QUERY_RESULT'
export const RECEIVE_REGION = 'RECEIVE_REGION'
export const RECEIVE_TABLE_HEADERS = 'RECEIVE_TABLE_HEADERS'
export const RECEIVE_TABLES = 'RECEIVE_TABLES'
export const REQUEST_CARD_QUERY = 'REQUEST_CARD_QUERY'
export const REQUEST_CHART_DATA = 'REQUEST_CHART_DATA'
export const REQUEST_REGION = 'REQUEST_REGION'
export const SELECT_DATA_VIEW = 'SELECT_DATA_VIEW'
export const UPDATE_CARD_QUERY = 'UPDATE_CARD_QUERY'
|
// All actions, used by actions or reducers, go here
export const CLOSE_CARD = 'CLOSE_CARD'
export const LOAD_CARD_PAGE = 'LOAD_CARD_PAGE'
export const NAVIGATE = 'NAVIGATE'
export const OPEN_CARD = 'OPEN_CARD'
export const RECEIVE_ALL_REGIONS = 'RECEIVE_ALL_REGIONS'
export const RECEIVE_CARD_PAGE_DATA = 'RECEIVE_CARD_PAGE_DATA'
export const RECEIVE_CARD_PAGES = 'RECEIVE_CARD_PAGES'
export const RECEIVE_CARD_QUERY = 'RECEIVE_CARD_QUERY'
export const RECEIVE_CHART_DATA = 'RECEIVE_CHART_DATA'
export const RECEIVE_QUERY_RESULT = 'RECEIVE_QUERY_RESULT'
export const RECEIVE_REGION = 'RECEIVE_REGION'
export const RECEIVE_TABLE_HEADERS = 'RECEIVE_TABLE_HEADERS'
export const RECEIVE_TABLES = 'RECEIVE_TABLES'
export const REQUEST_CARD_QUERY = 'REQUEST_CARD_QUERY'
export const REQUEST_CHART_DATA = 'REQUEST_CHART_DATA'
export const REQUEST_REGION = 'REQUEST_REGION'
export const SELECT_DATA_VIEW = 'SELECT_DATA_VIEW'
export const UPDATE_CARD_QUERY = 'UPDATE_CARD_QUERY'
export const SET_TABLE_VISIBILITY = 'SET_TABLE_VISIBILITY'
| Add action for fiddling with the show table button | Add action for fiddling with the show table button
| JavaScript | mit | bengler/imdikator,bengler/imdikator | ---
+++
@@ -22,3 +22,4 @@
export const SELECT_DATA_VIEW = 'SELECT_DATA_VIEW'
export const UPDATE_CARD_QUERY = 'UPDATE_CARD_QUERY'
+export const SET_TABLE_VISIBILITY = 'SET_TABLE_VISIBILITY' |
0011f6d4c08e2b5992e8329b5a60291c72144bf9 | src/services/dateFnsHelper.js | src/services/dateFnsHelper.js | import Vue from 'vue'
import distanceInWords from 'date-fns/distance_in_words'
export default new Vue({
data: {
locale: 'en',
loadedLocale: 'en',
locales: {},
now: new Date(),
},
created () {
setInterval(() => { this.now = new Date() }, 10 * 1000)
},
watch: {
async locale (locale) {
if (locale === 'zh') locale = 'zh_tw' // https://date-fns.org/v1.29.0/docs/I18n
Vue.set(this.locales, this.locale, await import(`date-fns/locale/${locale}`))
this.loadedLocale = this.locale
},
},
methods: {
distanceInWordsToNow (date, options = {}) {
if (options.disallowFuture && date > this.now) date = this.now
return distanceInWords(this.now, date, { locale: this.locales[this.loadedLocale], ...options })
},
},
})
| import Vue from 'vue'
import distanceInWords from 'date-fns/distance_in_words'
// https://date-fns.org/v1.29.0/docs/I18n
const localeMap = {
zh: 'zh_tw',
}
export default new Vue({
data: {
locale: 'en',
localeData: null,
now: new Date(),
},
created () {
setInterval(() => { this.now = new Date() }, 10 * 1000)
},
watch: {
async locale (locale) {
this.localeData = await import(`date-fns/locale/${localeMap[locale] || locale}`)
},
},
methods: {
distanceInWordsToNow (date, options = {}) {
if (options.disallowFuture && date > this.now) date = this.now
return distanceInWords(this.now, date, { locale: this.localeData, ...options })
},
},
})
| Simplify dateFns locale data handling + add map | Simplify dateFns locale data handling + add map
Previously cached it internally, but the import() gets cached
anyway.
| JavaScript | mit | yunity/karrot-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/foodsaving-frontend,yunity/karrot-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/foodsaving-frontend | ---
+++
@@ -1,11 +1,15 @@
import Vue from 'vue'
import distanceInWords from 'date-fns/distance_in_words'
+
+// https://date-fns.org/v1.29.0/docs/I18n
+const localeMap = {
+ zh: 'zh_tw',
+}
export default new Vue({
data: {
locale: 'en',
- loadedLocale: 'en',
- locales: {},
+ localeData: null,
now: new Date(),
},
created () {
@@ -13,15 +17,13 @@
},
watch: {
async locale (locale) {
- if (locale === 'zh') locale = 'zh_tw' // https://date-fns.org/v1.29.0/docs/I18n
- Vue.set(this.locales, this.locale, await import(`date-fns/locale/${locale}`))
- this.loadedLocale = this.locale
+ this.localeData = await import(`date-fns/locale/${localeMap[locale] || locale}`)
},
},
methods: {
distanceInWordsToNow (date, options = {}) {
if (options.disallowFuture && date > this.now) date = this.now
- return distanceInWords(this.now, date, { locale: this.locales[this.loadedLocale], ...options })
+ return distanceInWords(this.now, date, { locale: this.localeData, ...options })
},
},
}) |
4e1b1049d2b07d625a5473fbde365987f69bf5ab | lib/core/window.js | lib/core/window.js | /* See license.txt for terms of usage */
"use strict";
const { Trace, TraceError } = require("../core/trace.js").get(module.id);
const { once } = require("sdk/dom/events.js");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const { openTab } = require("sdk/tabs/utils");
// Module implementation
var Win = {};
/**
* Returns a promise that is resolved as soon as the window is loaded
* or immediately if the window is already loaded.
*
* @param {Window} The window object we need use when loaded.
*/
Win.loaded = win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "load", event => resolve(event.target));
}
});
// xxxHonza: we might want to merge with Win.loaded
Win.domContentLoaded = win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "DOMContentLoaded", event => resolve(event.target));
}
});
Win.openNewTab = function(url, options) {
let browser = getMostRecentBrowserWindow();
openTab(browser, url, options);
}
// Exports from this module
exports.Win = Win;
| /* See license.txt for terms of usage */
"use strict";
const { Cu } = require("chrome");
const { Trace, TraceError } = require("../core/trace.js").get(module.id);
const { once } = require("sdk/dom/events.js");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const { openTab } = require("sdk/tabs/utils");
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js");
// Module implementation
var Win = {};
/**
* Returns a promise that is resolved as soon as the window is loaded
* or immediately if the window is already loaded.
*
* @param {Window} The window object we need use when loaded.
*/
Win.loaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "load", event => resolve(event.target));
}
}));
// xxxHonza: we might want to merge with Win.loaded
Win.domContentLoaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "DOMContentLoaded", event => resolve(event.target));
}
}));
Win.openNewTab = function(url, options) {
let browser = getMostRecentBrowserWindow();
openTab(browser, url, options);
}
// Exports from this module
exports.Win = Win;
| Use make infallible for win load handlers | Use make infallible for win load handlers
| JavaScript | bsd-3-clause | vlajos/firebug.next,firebug/firebug.next,bmdeveloper/firebug.next,firebug/firebug.next,bmdeveloper/firebug.next,vlajos/firebug.next | ---
+++
@@ -1,11 +1,16 @@
/* See license.txt for terms of usage */
"use strict";
+
+const { Cu } = require("chrome");
const { Trace, TraceError } = require("../core/trace.js").get(module.id);
const { once } = require("sdk/dom/events.js");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const { openTab } = require("sdk/tabs/utils");
+
+const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js");
// Module implementation
var Win = {};
@@ -16,24 +21,24 @@
*
* @param {Window} The window object we need use when loaded.
*/
-Win.loaded = win => new Promise(resolve => {
+Win.loaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "load", event => resolve(event.target));
}
-});
+}));
// xxxHonza: we might want to merge with Win.loaded
-Win.domContentLoaded = win => new Promise(resolve => {
+Win.domContentLoaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "DOMContentLoaded", event => resolve(event.target));
}
-});
+}));
Win.openNewTab = function(url, options) {
let browser = getMostRecentBrowserWindow(); |
5cd9024bbc121cdcd3590d84cc5e3bb9e6efde64 | packages/rotonde-plugin-chat/src/index.js | packages/rotonde-plugin-chat/src/index.js | import { PLUGIN_TYPE } from 'rotonde-plugin';
export const TYPE = PLUGIN_TYPE.ISOMORPHIC;
export { default as ChatClientPlugin } from './client';
export { default as ChatServerPlugin } from './server';
| import { PLUGIN_TYPE } from 'rotonde-plugin';
import ChatClientPlugin from './client';
import ChatServerPlugin from './server';
export {
ChatClientPlugin,
ChatServerPlugin
};
// Plugin export.
export const TYPE = PLUGIN_TYPE.ISOMORPHIC;
export const ClientPlugin = ChatClientPlugin;
export const ServerPlugin = ChatServerPlugin;
| Use consistent exports for plugins | Use consistent exports for plugins
This allows us to use them generically
| JavaScript | mit | merveilles/Rotonde,merveilles/Rotonde | ---
+++
@@ -1,5 +1,13 @@
import { PLUGIN_TYPE } from 'rotonde-plugin';
+import ChatClientPlugin from './client';
+import ChatServerPlugin from './server';
+export {
+ ChatClientPlugin,
+ ChatServerPlugin
+};
+
+// Plugin export.
export const TYPE = PLUGIN_TYPE.ISOMORPHIC;
-export { default as ChatClientPlugin } from './client';
-export { default as ChatServerPlugin } from './server';
+export const ClientPlugin = ChatClientPlugin;
+export const ServerPlugin = ChatServerPlugin; |
591d4366c43173fa4d0490a1325a3eef25f95c48 | lib/js/spinners.js | lib/js/spinners.js | !function(){
window.attachSpinnerEvents = function () {
var spinners = document.querySelectorAll('.toggle-spinner'),
i = spinners.length;
while (i--) {
console.log('Attaching spinners');
var s = spinners[i];
s.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var target = e.target;
if (e.target.nodeName === 'I') {
target = e.target.parentNode;
}
var spinner = target.parentNode.querySelectorAll('.spinner')[0];
spinner.classList.toggle('active');
});
}
// Close spinner event handler
document.addEventListener('click', function (e) {
var els = document.querySelectorAll('.spinner'),
o = els.length;
while (o--) els[o].classList.remove('active');
});
}
attachSpinnerEvents();
}(); | !function(){
window.attachSpinnerEvents = function () {
var spinners = document.querySelectorAll('.toggle-spinner'),
i = spinners.length;
while (i--) {
var s = spinners[i];
s.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var target = e.target;
if (e.target.nodeName === 'I') {
target = e.target.parentNode;
}
var spinner = target.parentNode.querySelectorAll('.spinner')[0];
spinner.classList.toggle('active');
});
}
// Close spinner event handler
document.addEventListener('click', function (e) {
var els = document.querySelectorAll('.spinner'),
o = els.length;
while (o--) els[o].classList.remove('active');
});
}
attachSpinnerEvents();
}(); | Remove comment in the while loop | Remove comment in the while loop
| JavaScript | mit | Distrotech/fries,lilien1010/fries,wleopar-d/Fires,lilien1010/fries,jaunesarmiento/fries,eyecatchup/fries,wleopar-d/Fires,ao-forks/fries,ao-forks/fries,lilien1010/fries,jaunesarmiento/fries,wleopar-d/Fires | ---
+++
@@ -6,7 +6,7 @@
i = spinners.length;
while (i--) {
- console.log('Attaching spinners');
+
var s = spinners[i];
s.addEventListener('click', function (e) { |
0f160ecadb5487f42f540eeb038197f924d25647 | package/package.js | package/package.js | Package.describe({
name: 'meteortesting:mocha',
summary: 'Run Meteor package or app tests with Mocha',
git: 'https://github.com/meteortesting/meteor-mocha.git',
documentation: '../README.md',
version: '0.5.1',
testOnly: true,
});
Package.onUse(function onUse(api) {
api.use([
'practicalmeteor:mocha-core@1.0.0',
'ecmascript@0.3.0',
'lmieulet:meteor-coverage@1.1.4',
]);
api.use([
'browser-policy@1.0.0',
'http@1.1.1',
'meteortesting:browser-tests@0.2.0'
], 'server');
api.mainModule('client.js', 'client');
api.mainModule('server.js', 'server');
});
| Package.describe({
name: 'meteortesting:mocha',
summary: 'Run Meteor package or app tests with Mocha',
git: 'https://github.com/meteortesting/meteor-mocha.git',
documentation: '../README.md',
version: '0.5.1',
testOnly: true,
});
Package.onUse(function onUse(api) {
api.use([
'practicalmeteor:mocha-core@1.0.0',
'ecmascript@0.3.0',
'lmieulet:meteor-coverage@1.1.4 || 2.0.1',
]);
api.use([
'browser-policy@1.0.0',
'http@1.1.1',
'meteortesting:browser-tests@0.2.0'
], 'server');
api.mainModule('client.js', 'client');
api.mainModule('server.js', 'server');
});
| Allow using meteor-coverage 2.x.x, needed for code-coverage support from meteor 1.6.0 and onwards | Allow using meteor-coverage 2.x.x, needed for code-coverage support from meteor 1.6.0 and onwards
| JavaScript | mit | DispatchMe/meteor-mocha,meteortesting/meteor-mocha,meteortesting/meteor-mocha,DispatchMe/meteor-mocha,meteortesting/meteor-mocha,DispatchMe/meteor-mocha | ---
+++
@@ -11,7 +11,7 @@
api.use([
'practicalmeteor:mocha-core@1.0.0',
'ecmascript@0.3.0',
- 'lmieulet:meteor-coverage@1.1.4',
+ 'lmieulet:meteor-coverage@1.1.4 || 2.0.1',
]);
api.use([ |
c555183ef8f7a70ed4f9d1d8128e3aba50be937a | lib/transporter.js | lib/transporter.js | var env = process.env.NODE_ENV || 'development'
, config = require('../config/config')[env]
, nodemailer = require('nodemailer')
;
var transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST || config.EMAIL_HOST,
port: process.env.EMAIL_PORT || config.EMAIL_PORT,
auth: {
user: process.env.EMAIL || config.EMAIL,
pass: process.env.EMAIL_PASS || config.EMAIL_PASS
}
});
module.exports = transporter; | var env = process.env.NODE_ENV || 'development'
, config = require('../config/config')[env] || {}
, nodemailer = require('nodemailer')
;
var transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST || config.EMAIL_HOST,
port: process.env.EMAIL_PORT || config.EMAIL_PORT,
auth: {
user: process.env.EMAIL || config.EMAIL,
pass: process.env.EMAIL_PASS || config.EMAIL_PASS
}
});
module.exports = transporter;
| Make sure config isn't undefined for any env | Make sure config isn't undefined for any env
| JavaScript | mit | open-austin/mybuildingdoesntrecycle,open-austin/mybuildingdoesntrecycle,open-austin/mybuildingdoesntrecycle | ---
+++
@@ -1,5 +1,5 @@
var env = process.env.NODE_ENV || 'development'
- , config = require('../config/config')[env]
+ , config = require('../config/config')[env] || {}
, nodemailer = require('nodemailer')
;
|
7e4b602f830308cb8c0d2c1c066c9254b42dd87a | app/models/task.js | app/models/task.js | "use strict";
module.exports = function(sequelize, DataTypes) {
var Task = sequelize.define("Task", {
taskID: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true },
name: { type: DataTypes.STRING, allowNull: false },
taskType: { type: DataTypes.ENUM('todo', 'exercise', 'meal', 'meeting', 'other'), allowNull: false, defaultValue: 'other' },
date: { type: DataTypes.DATE, defaultValue: DataTypes.NOW },
time: { type: DataTypes.STRING, allowNull: true, defaultValue: null },
moveable: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true },
autoMoveable: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null },
description: { type: DataTypes.TEXT, allowNull: false, defaultValue: '' },
stravaID: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null },
isRecurring: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
recPeriod: { type: DataTypes.ENUM('weekly', 'monthly'), allowNull: true, defaultValue: null },
recRange: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null }
}, {
classMethods: {
associate: function(models) {
Task.belongsTo(models.User, {
onDelete: "CASCADE",
foreignKey: {
allowNull: false
}
});
Task.hasMany(models.TaskRecurrence);
}
}
});
return Task;
}
| "use strict";
module.exports = function(sequelize, DataTypes) {
var Task = sequelize.define("Task", {
taskID: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true },
name: { type: DataTypes.STRING, allowNull: false },
taskType: { type: DataTypes.ENUM('todo', 'exercise', 'meal', 'meeting', 'other'), allowNull: false, defaultValue: 'other' },
date: { type: DataTypes.DATE, defaultValue: DataTypes.NOW },
time: { type: DataTypes.STRING, allowNull: true, defaultValue: null },
moveable: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true },
autoMoveable: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null },
description: { type: DataTypes.TEXT, allowNull: false, defaultValue: '' },
stravaID: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null },
isRecurring: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
recPeriod: { type: DataTypes.ENUM('week', 'month'), allowNull: true, defaultValue: null },
recRange: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null }
}, {
classMethods: {
associate: function(models) {
Task.belongsTo(models.User, {
onDelete: "CASCADE",
foreignKey: {
allowNull: false
}
});
Task.hasMany(models.TaskRecurrence);
}
}
});
return Task;
}
| Fix enum (how did this work?) | Fix enum (how did this work?)
| JavaScript | mit | sirgraystar/diddleplan,sirgraystar/diddleplan | ---
+++
@@ -12,7 +12,7 @@
description: { type: DataTypes.TEXT, allowNull: false, defaultValue: '' },
stravaID: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null },
isRecurring: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
- recPeriod: { type: DataTypes.ENUM('weekly', 'monthly'), allowNull: true, defaultValue: null },
+ recPeriod: { type: DataTypes.ENUM('week', 'month'), allowNull: true, defaultValue: null },
recRange: { type: DataTypes.INTEGER, allowNull: true, defaultValue: null }
}, {
classMethods: { |
0468f019b6c040b978d6aae55dea27ec22a85cb7 | assets/js/racer.js | assets/js/racer.js | function Game(){
this.$track = $('#racetrack');
}
function Player(id){
this.player = $('.player')[id - 1];
this.position = 10;
}
Player.prototype.move = function(){
this.position += 10;
};
Player.prototype.updatePosition = function(){
$player = $(this.player);
$player.css('margin-left', this.position);
};
$(document).ready(function() {
var game = new Game();
var player1 = new Player(1);
var player2 = new Player(2);
$(document).on('keyup', function(keyPress){
if(keyPress.keyCode === 80) {
player1.move();
player1.updatePosition();
} else if (keyPress.keyCode === 81) {
player2.move();
player2.updatePosition();
}
});
}); | function Game(){
this.$track = $('#racetrack');
this.finishLine = this.$track.width() - 54;
}
function Player(id){
this.player = $('.player')[id - 1];
this.position = 10;
}
Player.prototype.move = function(){
this.position += 10;
};
Player.prototype.updatePosition = function(){
$player = $(this.player);
$player.css('margin-left', this.position);
};
$(document).ready(function() {
var game = new Game();
var player1 = new Player(1);
var player2 = new Player(2);
$(document).on('keyup', function(keyPress){
if(keyPress.keyCode === 80) {
player1.move();
player1.updatePosition();
} else if (keyPress.keyCode === 81) {
player2.move();
player2.updatePosition();
}
});
}); | Add finishLine state to Game object | Add finishLine state to Game object
| JavaScript | mit | SputterPuttRedux/basic-javascript-racer,SputterPuttRedux/basic-javascript-racer | ---
+++
@@ -1,5 +1,6 @@
function Game(){
this.$track = $('#racetrack');
+ this.finishLine = this.$track.width() - 54;
}
function Player(id){ |
b4b7fd4f7353c92587b55afc7ad593787575fe09 | app/routes/login.js | app/routes/login.js | import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
var win = window.open('/github_login', 'Authorization',
'width=1000,height=450,' +
'toolbar=0,scrollbars=1,status=1,resizable=1,' +
'location=1,menuBar=0');
if (!win) { return; }
// For the life of me I cannot figure out how to do this other than
// polling
var self = this;
var oauthInterval = window.setInterval(function(){
if (!win.closed) { return; }
window.clearInterval(oauthInterval);
var response = JSON.parse(localStorage.github_response);
if (!response.ok) {
self.controllerFor('application').set('flashError',
'Failed to log in');
return;
}
var data = response.data;
if (data.errors) {
var error = "Failed to log in: " + data.errors[0];
self.controllerFor('application').set('flashError', error);
return;
}
var user = self.store.push('user', data.user);
var transition = self.session.get('savedTransition');
self.session.loginUser(user);
if (transition) {
transition.retry();
}
}, 200);
transition.abort();
}
});
| import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
var win = window.open('/github_login', 'Authorization',
'width=1000,height=450,' +
'toolbar=0,scrollbars=1,status=1,resizable=1,' +
'location=1,menuBar=0');
if (!win) { return; }
// For the life of me I cannot figure out how to do this other than
// polling
var self = this;
var oauthInterval = window.setInterval(function(){
if (!win.closed) { return; }
window.clearInterval(oauthInterval);
var response = JSON.parse(localStorage.github_response);
if (!response.ok) {
self.controllerFor('application').set('flashError',
'Failed to log in');
return;
}
var data = response.data;
if (data.errors) {
var error = "Failed to log in: " + data.errors[0];
self.controllerFor('application').set('flashError', error);
return;
}
var user = self.store.push('user', data.user);
user.set('api_token', data.api_token);
var transition = self.session.get('savedTransition');
self.session.loginUser(user);
if (transition) {
transition.retry();
}
}, 200);
transition.abort();
}
});
| Set the api token from a successful authorization | Set the api token from a successful authorization
| JavaScript | apache-2.0 | withoutboats/crates.io,Gankro/crates.io,steveklabnik/crates.io,chenxizhang/crates.io,mbrubeck/crates.io,Gankro/crates.io,steveklabnik/crates.io,BlakeWilliams/crates.io,rust-lang/crates.io,achanda/crates.io,chenxizhang/crates.io,withoutboats/crates.io,achanda/crates.io,sfackler/crates.io,BlakeWilliams/crates.io,Gankro/crates.io,achanda/crates.io,Susurrus/crates.io,chenxizhang/crates.io,withoutboats/crates.io,rust-lang/crates.io,mbrubeck/crates.io,rust-lang/crates.io,sfackler/crates.io,BlakeWilliams/crates.io,Gankro/crates.io,chenxizhang/crates.io,BlakeWilliams/crates.io,Susurrus/crates.io,sfackler/crates.io,steveklabnik/crates.io,mbrubeck/crates.io,Susurrus/crates.io,rust-lang/crates.io,achanda/crates.io,withoutboats/crates.io,Susurrus/crates.io,mbrubeck/crates.io,steveklabnik/crates.io | ---
+++
@@ -29,6 +29,7 @@
}
var user = self.store.push('user', data.user);
+ user.set('api_token', data.api_token);
var transition = self.session.get('savedTransition');
self.session.loginUser(user);
if (transition) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.