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 |
|---|---|---|---|---|---|---|---|---|---|---|
000f6cad08be02edfd1bb7e3485734d878fa67ca | server/database/seeders/20190125162811-default-config.js | server/database/seeders/20190125162811-default-config.js | module.exports = {
up: queryInterface => {
return queryInterface.bulkInsert('configs', [{
app: 'default',
baseUrl: 'https://domain.com',
currency: 'EUR',
defaultCity: 'Berlin',
defaultCountry: 'Germany',
defaultLatitude: 52.53647,
defaultLongitude: 13.40780,
description: 'HOFFNUNG 3000 is a festival',
festivalDateEnd: '2017-08-27',
festivalDateStart: '2017-08-24',
festivalTicketPrice: 10.00,
gifStreamServerUrl: '',
isActivityStreamEnabled: true,
isAnonymizationEnabled: true,
isInboxEnabled: true,
isRandomMeetingEnabled: true,
isSignUpParticipantEnabled: true,
isSignUpVisitorEnabled: true,
mailAddressAdmin: 'admin@domain.com',
mailAddressRobot: 'noreply@domain.com',
maximumParticipantsCount: 30,
participationPrice: 25.00,
title: 'HOFFNUNG 3000',
transferBIC: '',
transferBankName: '',
transferIBAN: '',
transferReceiverName: '',
videoHomeId: '',
videoIntroductionId: '',
}])
},
down: queryInterface => {
return queryInterface.bulkDelete('configs', [])
},
}
| module.exports = {
up: queryInterface => {
return queryInterface.bulkInsert('configs', [{
app: 'default',
baseUrl: 'https://domain.com',
currency: 'EUR',
defaultCity: 'Berlin',
defaultCountry: 'Germany',
defaultLatitude: 52.53647,
defaultLongitude: 13.40780,
description: 'HOFFNUNG 3000 is a festival',
festivalDateEnd: '2017-08-27',
festivalDateStart: '2017-08-24',
festivalTicketPrice: 10.00,
gifStreamServerUrl: '',
isActivityStreamEnabled: true,
isAnonymizationEnabled: true,
isDerMarktEnabled: true,
isInboxEnabled: true,
isRandomMeetingEnabled: true,
isSignUpParticipantEnabled: true,
isSignUpVisitorEnabled: true,
mailAddressAdmin: 'admin@domain.com',
mailAddressRobot: 'noreply@domain.com',
maximumParticipantsCount: 30,
participationPrice: 25.00,
title: 'HOFFNUNG 3000',
transferBIC: '',
transferBankName: '',
transferIBAN: '',
transferReceiverName: '',
videoHomeId: '',
videoIntroductionId: '',
}])
},
down: queryInterface => {
return queryInterface.bulkDelete('configs', [])
},
}
| Add isDerMarktEnabled to defaultConfigs seeder | Add isDerMarktEnabled to defaultConfigs seeder
| JavaScript | agpl-3.0 | adzialocha/hoffnung3000,adzialocha/hoffnung3000 | ---
+++
@@ -15,6 +15,7 @@
gifStreamServerUrl: '',
isActivityStreamEnabled: true,
isAnonymizationEnabled: true,
+ isDerMarktEnabled: true,
isInboxEnabled: true,
isRandomMeetingEnabled: true,
isSignUpParticipantEnabled: true, |
847c0ae6ca511b13c6929156b0cb7efdbb6b382d | src/stream/push-stream.js | src/stream/push-stream.js | define([
'./stream',
'../functional/isFunction',
'../functional/isDefined',
'../functional/invoke'
], function (Stream, isFunction, isDefined, invoke) {
'use strict';
/**
* @param {Function} [implementation]
* @param {Function} [destroy]
* @constructor
*/
function PushStream(implementation, destroy) {
var callbacks = [], self = this;
Stream.call(this, function (sinkNext, sinkError, sinkComplete) {
isFunction(implementation) && implementation(sinkNext, sinkError, sinkComplete);
callbacks.push({
value: sinkNext,
error: sinkError,
complete: sinkComplete
});
});
function push(value, error) {
if (isDefined(error)) {
invoke(callbacks, 'error', error, self);
} else if (isDefined(value)) {
invoke(callbacks, 'value', value);
} else {
invoke(callbacks, 'complete');
isFunction(destroy) && destroy();
}
}
this.push = push;
}
PushStream.constructor = PushStream;
PushStream.prototype = Object.create(Stream.prototype);
return PushStream;
});
| define([
'./stream',
'../functional/isFunction',
'../functional/isDefined',
'../functional/invoke'
], function (Stream, isFunction, isDefined, invoke) {
'use strict';
/**
* @param {Function} [implementation]
* @param {Function} [destroy]
* @constructor
*/
function PushStream(implementation, destroy) {
var callbacks = [], self = this;
Stream.call(this, function (sinkNext, sinkError, sinkComplete) {
isFunction(implementation) && implementation(sinkNext, sinkError, sinkComplete);
callbacks.push({
value: sinkNext,
error: sinkError,
complete: sinkComplete
});
});
function push(value, error) {
if (isDefined(error)) {
invoke(callbacks, 'error', error, self);
} else if (isDefined(value)) {
invoke(callbacks, 'value', value);
} else {
invoke(callbacks, 'complete');
isFunction(destroy) && destroy();
}
}
this.push = push;
}
PushStream.constructor = PushStream;
PushStream.prototype = Object.create(Stream.prototype);
PushStream.prototype.constructor = PushStream;
return PushStream;
});
| Fix push stream prototype constructor. | Fix push stream prototype constructor.
| JavaScript | mit | widmogrod/jef,widmogrod/jef | ---
+++
@@ -40,6 +40,7 @@
PushStream.constructor = PushStream;
PushStream.prototype = Object.create(Stream.prototype);
+ PushStream.prototype.constructor = PushStream;
return PushStream;
}); |
12139de66b4cb3f67bfcee86a68f0f5f21c4a4cf | type/helma/Picture/actions.js | type/helma/Picture/actions.js | function main_action() {
if (/\/$/.test(req.path)) { // Path ends with / -> we're in a popup
this.renderPopup({
content: this.renderTemplate('picture', {
// Make sure we're rendering the popup image versioned even if
// the site is not using versioning, as it will show in a
// different size.
picture: this.renderImage(Hash.append({ versioned: true },
this.MAX_POPUP_SIZE))
})
}, res);
} else { // Just the file
// If we're using versioning, make sure it's a valid thumbnail id:
// If not, we're still allowing one version of the file, which is
// just however the site is rendering it. The side needs to make
// sure it is not rendering it in two different sizes then.
if (!this.VERSIONED || /[a-z0-9]{32}/.test(req.data.v)) {
var file = this.getVersionFile(req.data.v);
if (file.exists())
this.forwardFile(file);
}
this.forwardFile();
}
}
| Picture.inject({
main_action: function() {
if (/\/$/.test(req.path)) { // Path ends with / -> we're in a popup
this.renderPopup({
content: this.renderTemplate('picture', {
// Make sure we're rendering the popup image versioned even if
// the site is not using versioning, as it will show in a
// different size.
picture: this.renderImage(Hash.append({ versioned: true },
this.MAX_POPUP_SIZE))
})
}, res);
} else { // Just the file
// If we're using versioning, make sure it's a valid thumbnail id:
// If not, we're still allowing one version of the file, which is
// just however the site is rendering it. The side needs to make
// sure it is not rendering it in two different sizes then.
if (!this.VERSIONED || /[a-z0-9]{32}/.test(req.data.v)) {
var file = this.getVersionFile(req.data.v);
if (file.exists())
this.forwardFile(file);
}
this.forwardFile();
}
}
}); | Convert main_action function definition to using inject(). | Convert main_action function definition to using inject().
| JavaScript | mit | lehni/boots,lehni/boots | ---
+++
@@ -1,24 +1,26 @@
-function main_action() {
- if (/\/$/.test(req.path)) { // Path ends with / -> we're in a popup
- this.renderPopup({
- content: this.renderTemplate('picture', {
- // Make sure we're rendering the popup image versioned even if
- // the site is not using versioning, as it will show in a
- // different size.
- picture: this.renderImage(Hash.append({ versioned: true },
- this.MAX_POPUP_SIZE))
- })
- }, res);
- } else { // Just the file
- // If we're using versioning, make sure it's a valid thumbnail id:
- // If not, we're still allowing one version of the file, which is
- // just however the site is rendering it. The side needs to make
- // sure it is not rendering it in two different sizes then.
- if (!this.VERSIONED || /[a-z0-9]{32}/.test(req.data.v)) {
- var file = this.getVersionFile(req.data.v);
- if (file.exists())
- this.forwardFile(file);
+Picture.inject({
+ main_action: function() {
+ if (/\/$/.test(req.path)) { // Path ends with / -> we're in a popup
+ this.renderPopup({
+ content: this.renderTemplate('picture', {
+ // Make sure we're rendering the popup image versioned even if
+ // the site is not using versioning, as it will show in a
+ // different size.
+ picture: this.renderImage(Hash.append({ versioned: true },
+ this.MAX_POPUP_SIZE))
+ })
+ }, res);
+ } else { // Just the file
+ // If we're using versioning, make sure it's a valid thumbnail id:
+ // If not, we're still allowing one version of the file, which is
+ // just however the site is rendering it. The side needs to make
+ // sure it is not rendering it in two different sizes then.
+ if (!this.VERSIONED || /[a-z0-9]{32}/.test(req.data.v)) {
+ var file = this.getVersionFile(req.data.v);
+ if (file.exists())
+ this.forwardFile(file);
+ }
+ this.forwardFile();
}
- this.forwardFile();
}
-}
+}); |
1dc865d620a379d748b615606a54db191a981519 | mocha-sinon.js | mocha-sinon.js | (function(){
function mochaSinon(sinon){
if (typeof beforeEach !== "function") {
throw "mocha-sinon relies on mocha having been loaded.";
}
beforeEach(function() {
if (null == this.sinon) {
if (sinon.createSandbox) {
// Sinon 2+ (sinon.sandbox.create triggers a deprecation warning in Sinon 5)
this.sinon = sinon.createSandbox();
} else {
this.sinon = sinon.sandbox.create();
}
} else {
this.sinon.restore();
}
});
}
(function(plugin){
if (
typeof window === "object"
&& typeof window.sinon === "object"
) {
plugin(window.sinon);
} else if (typeof require === "function") {
var sinon = require('sinon');
module.exports = function () {
plugin(sinon);
};
plugin(sinon);
} else {
throw "We could not find sinon through a supported module loading technique. Pull requests are welcome!";
}
})(mochaSinon);
})();
| (function(){
function mochaSinon(sinon){
if (typeof beforeEach !== "function") {
throw "mocha-sinon relies on mocha having been loaded.";
}
beforeEach(function() {
if (null == this.sinon) {
if (sinon.createSandbox) {
// Sinon 2+ (sinon.sandbox.create triggers a deprecation warning in Sinon 5)
this.sinon = sinon.createSandbox();
} else {
this.sinon = sinon.sandbox.create();
}
} else {
this.sinon.restore();
}
});
after(function() {
// avoid test pollution for the last test that runs
if (this.sinon) {
this.sinon.restore();
}
});
}
(function(plugin){
if (
typeof window === "object"
&& typeof window.sinon === "object"
) {
plugin(window.sinon);
} else if (typeof require === "function") {
var sinon = require('sinon');
module.exports = function () {
plugin(sinon);
};
plugin(sinon);
} else {
throw "We could not find sinon through a supported module loading technique. Pull requests are welcome!";
}
})(mochaSinon);
})();
| Clean the sandbox after the last test | Clean the sandbox after the last test
Otherwise there can be some weird test pollution
| JavaScript | mit | elliotf/mocha-sinon,elliotf/mocha-sinon | ---
+++
@@ -14,6 +14,13 @@
this.sinon = sinon.sandbox.create();
}
} else {
+ this.sinon.restore();
+ }
+ });
+
+ after(function() {
+ // avoid test pollution for the last test that runs
+ if (this.sinon) {
this.sinon.restore();
}
}); |
f2366dfdb6621855782065dd491bab2d7acab056 | example/tasks/test-long.js | example/tasks/test-long.js | 'use strict';
var events = require('events'),
util = require('util');
module.exports = function(manager, data) {
events.EventEmitter.call(this);
var self = this,
timeout = 10000 * Math.random();
manager.log('timing out in ' + timeout);
// This task echos timeout! after intervals
var timer = setInterval(function() {
manager.log('timeout!');
manager.emit('timeout', 'timeout!');
}, timeout);
// Stop when requested
manager.on('stop', function() {
// Stop task
clearTimeout(timer);
// Notify stopped
self.emit('_stop');
});
};
util.inherits(module.exports, events.EventEmitter);
| 'use strict';
var events = require('events'),
util = require('util');
module.exports = function(manager, data) {
events.EventEmitter.call(this);
var self = this,
timeout = 10000 * Math.random();
manager.log('timing out in ' + timeout);
// This task echos timeout! after intervals
var timer = setInterval(function() {
manager.log('timeout!');
manager.emit('timeout', 'timeout!');
// Update Redis to avoid task timeout
self.emit('_update');
}, timeout);
// Stop when requested
manager.on('stop', function() {
// Stop task
clearTimeout(timer);
// Notify stopped
self.emit('_stop');
});
};
util.inherits(module.exports, events.EventEmitter);
| Fix bug where not updating task would make monitor requeue it | Fix bug where not updating task would make monitor requeue it
| JavaScript | mit | Oxygem/TaskSwarm.js,Oxygem/TaskSwarm.js | ---
+++
@@ -14,6 +14,8 @@
var timer = setInterval(function() {
manager.log('timeout!');
manager.emit('timeout', 'timeout!');
+ // Update Redis to avoid task timeout
+ self.emit('_update');
}, timeout);
// Stop when requested |
28827db85d4df7e0b746250f280b95a51df8d78e | demo/index.js | demo/index.js | 'use strict';
import React from 'react/addons';
import Accordion from '../src/Accordion';
import AccordionItem from '../src/AccordionItem';
class Demo extends React.Component {
render() {
return (
<Accordion>
<AccordionItem title="First item">
<p>First item content</p>
</AccordionItem>
<AccordionItem title="Second item">
<p>Second item content</p>
</AccordionItem>
</Accordion>
);
}
}
React.render(
<Demo />,
document.body
);
| 'use strict';
import React from 'react/addons';
import Accordion from '../src/Accordion';
import AccordionItem from '../src/AccordionItem';
class Demo extends React.Component {
render() {
return (
<Accordion>
{[1, 2, 3, 4, 5].map((item) => {
return (
<AccordionItem title={`Item ${ item }`} key={item}>
<p>{`Item ${ item } content`}</p>
</AccordionItem>
);
})}
</Accordion>
);
}
}
React.render(
<Demo />,
document.body
);
| Add more items to demo | Add more items to demo
| JavaScript | mit | gracelauren/react-sanfona,clemsos/react-sanfona,thoshith/react-sanfona,daviferreira/react-sanfona,thoshith/react-sanfona,clemsos/react-sanfona | ---
+++
@@ -10,12 +10,13 @@
render() {
return (
<Accordion>
- <AccordionItem title="First item">
- <p>First item content</p>
- </AccordionItem>
- <AccordionItem title="Second item">
- <p>Second item content</p>
- </AccordionItem>
+ {[1, 2, 3, 4, 5].map((item) => {
+ return (
+ <AccordionItem title={`Item ${ item }`} key={item}>
+ <p>{`Item ${ item } content`}</p>
+ </AccordionItem>
+ );
+ })}
</Accordion>
);
} |
46cbe420845c06082054acbe852c2c91ede21942 | config/sw-precache.js | config/sw-precache.js | const fs = require('fs');
const path = require('path');
const jsFiles = fs.readdirSync(path.resolve('dist', 'chrome')).filter(filename => filename.endsWith('.js.br')).map(filename => `dist/chrome/${filename}`);
module.exports = {
staticFileGlobs: ['/shell','dist/chrome/*.js'],
dynamicUrlToDependencies: {
'/shell': jsFiles
},
navigateFallback: '/shell',
runtimeCaching: [{
urlPattern: /\/api\/list\//,
handler: 'networkFirst'
},{
urlPattern: /\/api\/comments\//,
handler: 'networkFirst'
}],
} | const fs = require('fs');
const path = require('path');
const jsFiles = fs.readdirSync(path.resolve('dist', 'chrome')).filter(filename => filename.endsWith('.js.br')).map(filename => `dist/chrome/${filename}`);
module.exports = {
staticFileGlobs: ['/shell','dist/chrome/*.js'],
dynamicUrlToDependencies: {
'/shell': jsFiles
},
navigateFallback: '/shell',
runtimeCaching: [{
urlPattern: /\/api\/list\//,
handler: 'networkFirst'
},{
urlPattern: /\/api\/comments\//,
handler: 'networkFirst'
},{
urlPattern: /\/api\/items\//,
handler: 'networkFirst'
}],
} | Add api items to network first list. | Add api items to network first list.
| JavaScript | mit | kristoferbaxter/preact-hn,kristoferbaxter/preact-hn | ---
+++
@@ -15,5 +15,8 @@
},{
urlPattern: /\/api\/comments\//,
handler: 'networkFirst'
+ },{
+ urlPattern: /\/api\/items\//,
+ handler: 'networkFirst'
}],
} |
efd73128ab38ef6aa7eb24f4b5ce2626ffa82520 | websocket/static/js/chat.js | websocket/static/js/chat.js | var messageTxt;
var messages;
$(function () {
messageTxt = $("#messageTxt");
messages = $("#messages");
w = new Ws("ws://" + HOST + "/my_endpoint");
w.OnConnect(function () {
console.log("Websocket connection enstablished");
});
w.OnDisconnect(function () {
appendMessage($("<div><center><h3>Disconnected</h3></center></div>"));
});
w.On("chat", function (message) {
appendMessage($("<div>" + message + "</div>"));
});
$("#sendBtn").click(function () {
w.Emit("chat", messageTxt.val().toString());
messageTxt.val("");
});
})
function appendMessage(messageDiv) {
var theDiv = messages[0];
var doScroll = theDiv.scrollTop == theDiv.scrollHeight - theDiv.clientHeight;
messageDiv.appendTo(messages);
if (doScroll) {
theDiv.scrollTop = theDiv.scrollHeight - theDiv.clientHeight;
}
}
| var messageTxt;
var messages;
$(function () {
messageTxt = $("#messageTxt");
messages = $("#messages");
w = new Ws("ws://" + HOST + "/my_endpoint");
w.OnConnect(function () {
console.log("Websocket connection established");
});
w.OnDisconnect(function () {
appendMessage($("<div><center><h3>Disconnected</h3></center></div>"));
});
w.On("chat", function (message) {
appendMessage($("<div>" + message + "</div>"));
});
$("#sendBtn").click(function () {
w.Emit("chat", messageTxt.val().toString());
messageTxt.val("");
});
})
function appendMessage(messageDiv) {
var theDiv = messages[0];
var doScroll = theDiv.scrollTop == theDiv.scrollHeight - theDiv.clientHeight;
messageDiv.appendTo(messages);
if (doScroll) {
theDiv.scrollTop = theDiv.scrollHeight - theDiv.clientHeight;
}
}
| Fix typo in websocket example | Fix typo in websocket example | JavaScript | mit | iris-contrib/examples,iris-contrib/examples,iris-contrib/examples,iris-contrib/examples | ---
+++
@@ -9,7 +9,7 @@
w = new Ws("ws://" + HOST + "/my_endpoint");
w.OnConnect(function () {
- console.log("Websocket connection enstablished");
+ console.log("Websocket connection established");
});
w.OnDisconnect(function () { |
798e42eac900ed4992b3e55a9a0289d2a0d12a36 | main.js | main.js | define(['exports',
'./lib/request',
'url'],
function(exports, Request, uri) {
function request(url, method, cb) {
var headers;
if (typeof url == 'object') {
var opts = url;
cb = method;
method = opts.method || 'GET';
url = uri.format(opts);
headers = opts.headers;
} else if (typeof method == 'function') {
cb = method;
method = 'GET';
}
var req = new Request(url, method);
if (headers) {
for (var name in headers) {
req.setHeader(name, headers[name]);
}
}
if (cb) req.on('response', cb);
return req;
}
function get(url, cb) {
var req = request(url, cb);
req.end();
return req;
}
exports.request = request;
exports.get = get;
});
| define(['exports',
'./lib/request',
'url'],
function(exports, Request, uri) {
function request(url, method, cb) {
var headers;
if (typeof url == 'object') {
var opts = url;
cb = method;
method = opts.method || 'GET';
url = uri.format(opts);
headers = opts.headers;
} else if (typeof method == 'function') {
cb = method;
method = 'GET';
}
var req = new Request(url, method);
if (headers) {
for (var name in headers) {
req.setHeader(name, headers[name]);
}
}
if (cb) req.on('response', cb);
return req;
}
function get(url, cb) {
var req = request(url, cb);
req.send();
return req;
}
exports.request = request;
exports.get = get;
});
| Call req.send when using get convienience function. | Call req.send when using get convienience function.
| JavaScript | mit | anchorjs/ajax,anchorjs/ajax | ---
+++
@@ -29,7 +29,7 @@
function get(url, cb) {
var req = request(url, cb);
- req.end();
+ req.send();
return req;
}
|
b65a9293ea64c784f0005420285ffc748887923e | index.js | index.js | module.exports = {
parser: 'babel-eslint',
extends: 'airbnb',
globals: {
before: true,
beforeEach: true,
after: true,
afterEach: true,
describe: true,
it: true,
xit: true,
xdescribe: true,
},
rules: {
'arrow-body-style': ['off'],
'react/jsx-no-bind': ['off'],
'react/jsx-curly-spacing': [2, 'always'],
'object-shorthand': ['off'],
},
};
| module.exports = {
parser: 'babel-eslint',
extends: 'airbnb',
globals: {
before: true,
beforeEach: true,
after: true,
afterEach: true,
describe: true,
it: true,
xit: true,
xdescribe: true,
},
rules: {
'arrow-body-style': ['off'],
'object-shorthand': ['off'],
'react/jsx-no-bind': ['off'],
'react/jsx-curly-spacing': [2, 'always'],
'react/no-multi-comp': ['off']
},
};
| Allow multiple components defined in one file. | Allow multiple components defined in one file.
| JavaScript | mit | crewmeister/eslint-config-crewmeister | ---
+++
@@ -13,8 +13,9 @@
},
rules: {
'arrow-body-style': ['off'],
+ 'object-shorthand': ['off'],
'react/jsx-no-bind': ['off'],
'react/jsx-curly-spacing': [2, 'always'],
- 'object-shorthand': ['off'],
+ 'react/no-multi-comp': ['off']
},
}; |
103780267d930eb84fa76195e3aab87d17ce81dc | index.js | index.js | 'use strict'
var jsYAML = require('js-yaml')
module.exports = yamlConfig
// Modify remark to read configuration from comments.
function yamlConfig() {
var Parser = this.Parser
var Compiler = this.Compiler
var parser = Parser && Parser.prototype.blockTokenizers
var compiler = Compiler && Compiler.prototype.visitors
if (parser && parser.yamlFrontMatter) {
parser.yamlFrontMatter = factory(parser.yamlFrontMatter)
}
if (compiler && compiler.yaml) {
compiler.yaml = factory(compiler.yaml)
}
}
// Wrapper factory.
function factory(original) {
replacement.locator = original.locator
return replacement
// Replacer for tokeniser or visitor.
function replacement(node) {
var self = this
var result = original.apply(self, arguments)
var marker = result && result.type ? result : node
var data
try {
data = jsYAML.safeLoad(marker.value)
data = data && data.remark
if (data) {
self.setOptions(data)
}
} catch (error) {
self.file.fail(error.message, marker)
}
return result
}
}
| 'use strict'
var jsYAML = require('js-yaml')
module.exports = yamlConfig
var origin = 'remark-yaml-config:invalid-options'
// Modify remark to read configuration from comments.
function yamlConfig() {
var Parser = this.Parser
var Compiler = this.Compiler
var parser = Parser && Parser.prototype.blockTokenizers
var compiler = Compiler && Compiler.prototype.visitors
if (parser && parser.yamlFrontMatter) {
parser.yamlFrontMatter = factory(parser.yamlFrontMatter)
}
if (compiler && compiler.yaml) {
compiler.yaml = factory(compiler.yaml)
}
}
// Wrapper factory.
function factory(original) {
replacement.locator = original.locator
return replacement
// Replacer for tokeniser or visitor.
function replacement(node) {
var self = this
var result = original.apply(self, arguments)
var marker = result && result.type ? result : node
var data
try {
data = jsYAML.safeLoad(marker.value)
data = data && data.remark
if (data) {
self.setOptions(data)
}
} catch (error) {
self.file.fail(error.message, marker, origin)
}
return result
}
}
| Add origin to option setting failure | Add origin to option setting failure
| JavaScript | mit | wooorm/mdast-yaml-config,wooorm/remark-yaml-config | ---
+++
@@ -3,6 +3,8 @@
var jsYAML = require('js-yaml')
module.exports = yamlConfig
+
+var origin = 'remark-yaml-config:invalid-options'
// Modify remark to read configuration from comments.
function yamlConfig() {
@@ -41,7 +43,7 @@
self.setOptions(data)
}
} catch (error) {
- self.file.fail(error.message, marker)
+ self.file.fail(error.message, marker, origin)
}
return result |
290579181706f659131662ea22644b6559235663 | lib/util/which.js | lib/util/which.js | var join = require('path').join;
var execFileSync = require('child_process').execFileSync;
var WHERE_PATH = join(process.env.WINDIR, 'System32', 'where.exe');
var cache = {};
var originalWhich = require('which');
var isWin = process.platform === 'win32';
function which(name, opt, cb) {
if (typeof opt === 'function') {
cb = opt;
opt = {};
}
if (isWin) {
var result = whichSync(name);
if (result) {
cb(null, result);
} else {
cb(new Error('Could not find ' + name + ' in PATH'));
}
} else {
originalWhich(name, opt, cb);
}
}
function whichSync(name, opt) {
if (name in cache) {
return cache[name];
}
if (isWin) {
var stdout = execFileSync(WHERE_PATH, ['$PATH:' + name], {
stdio: ['pipe', 'pipe', 'ignore']
}).toString();
var matches = stdout.split('\r\n');
if (matches.length === 0) {
throw new Error('Could not find ' + name + ' in PATH');
}
var result = matches[0].trim();
cache[name] = result;
return result;
}
var result = originalWhich.sync(name, opt);
cache[name] = result;
return result;
}
which.sync = whichSync;
module.exports = which;
| var join = require('path').join;
var execFileSync = require('child_process').execFileSync;
var cache = {};
var originalWhich = require('which');
var isWin = process.platform === 'win32';
function which(name, opt, cb) {
if (typeof opt === 'function') {
cb = opt;
opt = {};
}
if (isWin) {
var result = whichSync(name);
if (result) {
cb(null, result);
} else {
cb(new Error('Could not find ' + name + ' in PATH'));
}
} else {
originalWhich(name, opt, cb);
}
}
function whichSync(name, opt) {
if (name in cache) {
return cache[name];
}
if (isWin) {
var WHERE_PATH = join(process.env.WINDIR, 'System32', 'where.exe');
var stdout = execFileSync(WHERE_PATH, ['$PATH:' + name], {
stdio: ['pipe', 'pipe', 'ignore']
}).toString();
var matches = stdout.split('\r\n');
if (matches.length === 0) {
throw new Error('Could not find ' + name + ' in PATH');
}
var result = matches[0].trim();
cache[name] = result;
return result;
}
var result = originalWhich.sync(name, opt);
cache[name] = result;
return result;
}
which.sync = whichSync;
module.exports = which;
| Fix running bower on non-windows | Fix running bower on non-windows
| JavaScript | mit | bower/bower | ---
+++
@@ -1,6 +1,5 @@
var join = require('path').join;
var execFileSync = require('child_process').execFileSync;
-var WHERE_PATH = join(process.env.WINDIR, 'System32', 'where.exe');
var cache = {};
var originalWhich = require('which');
@@ -29,6 +28,7 @@
return cache[name];
}
if (isWin) {
+ var WHERE_PATH = join(process.env.WINDIR, 'System32', 'where.exe');
var stdout = execFileSync(WHERE_PATH, ['$PATH:' + name], {
stdio: ['pipe', 'pipe', 'ignore']
}).toString(); |
37910ee13640757f545494aa527a1bb3234d7102 | na-backend/js/index.js | na-backend/js/index.js | import uuid from 'node-uuid';
import express from 'express';
import OrientDB from 'orientjs';
import {BinaryServer} from 'binaryjs';
import setupStreamServer from './lib/setup-stream-server';
import {setupInitQueue, setupNextSong} from './lib/server-helper';
import { setupClients, setupStreamers } from './lib/server-setup';
import setupRoutes from './routes/routes-setup';
import config from './config';
const clients = setupClients();
const streamers = setupStreamers();
const app = express();
const server = OrientDB({
host: config.databaseHost,
port: config.databasePort,
username: config.username,
password: config.password
});
const db = server.use('music');
const populateQueue = setupInitQueue(db, streamers);
const nextSongInQueue = setupNextSong(db, streamers);
const updateTrackListing = setupTrackListUpdate(db);
setupRoutes(app, db, clients, populateQueue);
app.use(express.static('public'));
const appServer = app.listen(config.webPort, function () {
const host = appServer.address().address;
const port = appServer.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
const streamerServer = BinaryServer({port: config.streamPort});
streamerServer.on('connection', function(streamer) {
console.log('stream connected');
streamer.on('stream', setupStreamHandler(clients, streamers, updateTrackListing, nextSongInQueue));
};);
| import uuid from 'node-uuid';
import express from 'express';
import OrientDB from 'orientjs';
import {BinaryServer} from 'binaryjs';
import {setupInitQueue, setupNextSong, setupTrackListUpdate} from './lib/server-helper';
import {setupClients, setupStreamers} from './lib/server-setup';
import setupStreamHandler from './lib/setup-stream-handler';
import setupRoutes from './routes/routes-setup';
import config from './config';
const clients = setupClients();
const streamers = setupStreamers();
const app = express();
const server = OrientDB({
host: config.databaseHost,
port: config.databasePort,
username: config.username,
password: config.password
});
const db = server.use('music');
const populateQueue = setupInitQueue(db, streamers);
const nextSongInQueue = setupNextSong(db, streamers);
const updateTrackListing = setupTrackListUpdate(db);
setupRoutes(app, db, clients, populateQueue);
app.use(express.static('public'));
const appServer = app.listen(config.webPort, function () {
const host = appServer.address().address;
const port = appServer.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
const streamerServer = BinaryServer({port: config.streamPort});
streamerServer.on('connection', function(streamer) {
console.log('stream connected');
streamer.on('stream', setupStreamHandler(clients, streamers, updateTrackListing, nextSongInQueue));
});
| Fix a few imports missing, and errors | Fix a few imports missing, and errors
| JavaScript | mit | d3spis3d/na-streamer,d3spis3d/na-streamer | ---
+++
@@ -3,9 +3,9 @@
import OrientDB from 'orientjs';
import {BinaryServer} from 'binaryjs';
-import setupStreamServer from './lib/setup-stream-server';
-import {setupInitQueue, setupNextSong} from './lib/server-helper';
-import { setupClients, setupStreamers } from './lib/server-setup';
+import {setupInitQueue, setupNextSong, setupTrackListUpdate} from './lib/server-helper';
+import {setupClients, setupStreamers} from './lib/server-setup';
+import setupStreamHandler from './lib/setup-stream-handler';
import setupRoutes from './routes/routes-setup';
import config from './config';
@@ -41,4 +41,4 @@
streamerServer.on('connection', function(streamer) {
console.log('stream connected');
streamer.on('stream', setupStreamHandler(clients, streamers, updateTrackListing, nextSongInQueue));
-};);
+}); |
662dc290f8ef6b6c8e75a5ba4d793fa4d05310cc | index.js | index.js | 'use strict'
module.exports = visit
var visitParents = require('unist-util-visit-parents')
visit.CONTINUE = visitParents.CONTINUE
visit.SKIP = visitParents.SKIP
visit.EXIT = visitParents.EXIT
function visit(tree, test, visitor, reverse) {
if (typeof test === 'function' && typeof visitor !== 'function') {
reverse = visitor
visitor = test
test = null
}
visitParents(tree, test, overload, reverse)
function overload(node, parents) {
var parent = parents[parents.length - 1]
var index = parent ? parent.children.indexOf(node) : null
return visitor(node, index, parent)
}
}
| 'use strict'
module.exports = visit
var visitParents = require('unist-util-visit-parents')
visit.CONTINUE = visitParents.CONTINUE
visit.SKIP = visitParents.SKIP
visit.EXIT = visitParents.EXIT
function visit(tree, test, visitor, reverse) {
if (typeof test === 'function' && typeof visitor !== 'function') {
reverse = visitor
visitor = test
test = null
}
visitParents(tree, test, overload, reverse)
function overload(node, parents) {
var parent = parents[parents.length - 1]
return visitor(node, parent ? parent.children.indexOf(node) : null, parent)
}
}
| Refactor to improve bundle size | Refactor to improve bundle size
| JavaScript | mit | wooorm/mdast-util-visit,wooorm/unist-util-visit | ---
+++
@@ -19,7 +19,6 @@
function overload(node, parents) {
var parent = parents[parents.length - 1]
- var index = parent ? parent.children.indexOf(node) : null
- return visitor(node, index, parent)
+ return visitor(node, parent ? parent.children.indexOf(node) : null, parent)
}
} |
c82ccfd1a8fef8b9c349c99373f7d627f3d89268 | index.js | index.js | const pluginLodash = require('babel-plugin-lodash')
const pluginReactRequire = require('babel-plugin-react-require').default
const presetEnv = require('babel-preset-env')
const presetStage1 = require('babel-preset-stage-1')
const presetReact = require('babel-preset-react')
const {BABEL_ENV} = process.env
const defaultOptions = {
lodash: true,
modules: BABEL_ENV === 'cjs' ? 'commonjs' : false,
targets: {
browsers: ['IE 11', 'last 2 Edge versions', 'Firefox >= 45', 'last 2 Chrome versions'],
node: 8,
},
}
module.exports = (context, userOptions) => {
const options = Object.assign({}, defaultOptions, userOptions)
return {
plugins: [options.lodash && pluginLodash, pluginReactRequire].filter(Boolean),
presets: [
[presetEnv, {modules: options.modules, targets: options.targets}],
presetStage1,
presetReact,
],
}
}
| const pluginLodash = require('babel-plugin-lodash')
const pluginReactRequire = require('babel-plugin-react-require').default
const presetEnv = require('babel-preset-env')
const presetStage1 = require('babel-preset-stage-1')
const presetReact = require('babel-preset-react')
const {BABEL_ENV} = process.env
const defaultOptions = {
lodash: true,
modules: ['cjs', 'test'].includes(BABEL_ENV) ? 'commonjs' : false,
targets: {
browsers: ['IE 11', 'last 2 Edge versions', 'Firefox >= 45', 'last 2 Chrome versions'],
node: 8,
},
}
module.exports = (context, userOptions) => {
const options = Object.assign({}, defaultOptions, userOptions)
return {
plugins: [options.lodash && pluginLodash, pluginReactRequire].filter(Boolean),
presets: [
[presetEnv, {modules: options.modules, targets: options.targets}],
presetStage1,
presetReact,
],
}
}
| Transform ESM to CJS when BABEL_ENV is "test" | Transform ESM to CJS when BABEL_ENV is "test"
| JavaScript | mit | kensho/babel-preset-kensho,kensho/babel-preset-kensho | ---
+++
@@ -8,7 +8,7 @@
const defaultOptions = {
lodash: true,
- modules: BABEL_ENV === 'cjs' ? 'commonjs' : false,
+ modules: ['cjs', 'test'].includes(BABEL_ENV) ? 'commonjs' : false,
targets: {
browsers: ['IE 11', 'last 2 Edge versions', 'Firefox >= 45', 'last 2 Chrome versions'],
node: 8, |
f7849ab1de520add24e2b41a0b8523f7bcffa39b | index.js | index.js | module.exports = (function store() {
'use strict';
function nope() { /* Fallback for when no store is supported */ }
try {
sessionStorage.setItem('foo', 'bar');
if (sessionStorage.getItem('foo') !== 'bar') throw 1;
} catch (e) {
var storage = require('window.name')
, koekje = require('koekje');
return storage.supported ? storage : (koekje.supported ? koekje : {
length: 0,
getItem: nope, setItem: nope, removeItem: nope, clear: nope
});
}
return sessionStorage;
}());
| module.exports = (function store() {
'use strict';
function nope() { /* Fallback for when no store is supported */ }
try {
sessionStorage.setItem('foo', 'bar');
if (sessionStorage.getItem('foo') !== 'bar') throw 1;
sessionStorage.removeItem('foo');
} catch (e) {
var storage = require('window.name')
, koekje = require('koekje');
return storage.supported ? storage : (koekje.supported ? koekje : {
length: 0,
getItem: nope, setItem: nope, removeItem: nope, clear: nope
});
}
return sessionStorage;
}());
| Remove 'foo' From Session Storage | Remove 'foo' From Session Storage
Just a little cleanup for those OCD folks out there. | JavaScript | mit | unshiftio/sessionstorage | ---
+++
@@ -6,6 +6,7 @@
try {
sessionStorage.setItem('foo', 'bar');
if (sessionStorage.getItem('foo') !== 'bar') throw 1;
+ sessionStorage.removeItem('foo');
} catch (e) {
var storage = require('window.name')
, koekje = require('koekje'); |
36ba97c81a0b5e566fa91cd6060055cfa8bf7333 | index.js | index.js | var Q = require('q');
module.exports = function(AWS){
AWS.Request.prototype.promise = function(){
var deferred = Q.defer();
this.
on('success', function(response) {
deferred.resolve(response);
}).
on('error', function(response) {
deferred.reject(response);
}).
send();
return deferred.promise;
};
AWS.Request.prototype.then = function(callback){
return this.promise().then(callback);
};
AWS.Request.prototype.fail = function(callback){
return this.promise().fail(callback);
};
}; | var Q = require('q');
module.exports = function(AWS){
AWS.Request.prototype.promise = function(){
var deferred = Q.defer();
this.
on('success', function(response) {
deferred.resolve(response.data);
}).
on('error', function(response) {
deferred.reject(response);
}).
send();
return deferred.promise;
};
AWS.Request.prototype.then = function(callback){
return this.promise().then(callback);
};
AWS.Request.prototype.fail = function(callback){
return this.promise().fail(callback);
};
}; | Change successful event to resolve response data | Change successful event to resolve response data
| JavaScript | mit | Trioxis/aws-q | ---
+++
@@ -6,7 +6,7 @@
this.
on('success', function(response) {
- deferred.resolve(response);
+ deferred.resolve(response.data);
}).
on('error', function(response) {
deferred.reject(response); |
fd086cb8c2036f6df2121cc43c9fb1c458da0ea3 | index.js | index.js | 'use strict';
const colors = require('ansicolors');
const pluralize = require('pluralize');
const CLIEngine = require('eslint').CLIEngine;
class ESLinter {
constructor(brunchConfig) {
this.config = (brunchConfig && brunchConfig.plugins && brunchConfig.plugins.eslint) || {};
this.warnOnly = (this.config.warnOnly === true);
this.pattern = this.config.pattern || /^app[\/\\].*\.js?$/;
this.engineOptions = this.config.config || {};
this.linter = new CLIEngine(this.engineOptions);
}
lint(data, path) {
const result = this.linter.executeOnText(data, path).results[0];
const errorCount = result.errorCount;
if (errorCount === 0) {
return Promise.resolve();
}
const errorMsg = result.messages.map(error => {
return `${colors.blue(error.message)} (${error.line}:${error.column})`;
});
errorMsg.unshift(`ESLint detected ${errorCount} ${(pluralize('problem', errorCount))}:`);
let msg = errorMsg.join('\n');
if (this.warnOnly) {
msg = `warn: ${msg}`;
}
return (msg ? Promise.reject(msg) : Promise.resolve());
}
}
ESLinter.prototype.brunchPlugin = true;
ESLinter.prototype.type = 'javascript';
ESLinter.prototype.extension = 'js';
module.exports = ESLinter;
| 'use strict';
const colors = require('ansicolors');
const pluralize = require('pluralize');
const CLIEngine = require('eslint').CLIEngine;
class ESLinter {
constructor(brunchConfig) {
this.config = (brunchConfig && brunchConfig.plugins && brunchConfig.plugins.eslint) || {};
this.warnOnly = (this.config.warnOnly === true);
this.pattern = this.config.pattern || /^app[\/\\].*\.js?$/;
this.engineOptions = this.config.config || {};
this.linter = new CLIEngine(this.engineOptions);
}
lint(data, path) {
const result = this.linter.executeOnText(data, path).results[0];
const errorCount = result.errorCount;
const warningCount = result.warningCount;
if (errorCount === 0 && warningCount === 0) {
return Promise.resolve();
}
const errorMsg = result.messages.map(error => {
return `${colors.blue(error.message)} (${error.line}:${error.column})`;
});
errorMsg.unshift(`ESLint detected ${errorCount} ${(pluralize('problem', errorCount))}:`);
let msg = errorMsg.join('\n');
if (this.warnOnly) {
msg = `warn: ${msg}`;
}
return (msg ? Promise.reject(msg) : Promise.resolve());
}
}
ESLinter.prototype.brunchPlugin = true;
ESLinter.prototype.type = 'javascript';
ESLinter.prototype.extension = 'js';
module.exports = ESLinter;
| Check warningCount as well as errorCount | Check warningCount as well as errorCount
http://eslint.org/docs/developer-guide/nodejs-api#executeonfiles
"The errorCount and warningCount give the exact number of
errors and warnings respectively on the given file."
| JavaScript | mit | spyl94/eslint-brunch,brunch/eslint-brunch | ---
+++
@@ -16,7 +16,8 @@
lint(data, path) {
const result = this.linter.executeOnText(data, path).results[0];
const errorCount = result.errorCount;
- if (errorCount === 0) {
+ const warningCount = result.warningCount;
+ if (errorCount === 0 && warningCount === 0) {
return Promise.resolve();
}
const errorMsg = result.messages.map(error => { |
6c769fe72a23cd88da6a49de6672591a153bf9e4 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-place-autocomplete',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = "//maps.googleapis.com/maps/api/js",
placeAutocompleteConfig = config['place-autocomplete'] || {},
params = [],
exclude = placeAutocompleteConfig.exclude,
key = placeAutocompleteConfig.key;
if (!exclude) {
if (key)
params.push('key=' + encodeURIComponent(key));
src += '?' + params.join('&') + "&libraries=places";
content = '<script type="text/javascript" src="' + src + '"></script>';
}
}
return content;
}
};
| /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-place-autocomplete',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = "//maps.googleapis.com/maps/api/js",
placeAutocompleteConfig = config['place-autocomplete'] || {},
params = [],
exclude = placeAutocompleteConfig.exclude,
client = placeAutocompleteConfig.client,
key = placeAutocompleteConfig.key;
if (!exclude) {
if (key)
params.push('key=' + encodeURIComponent(key));
if (client)
params.push('client=' + encodeURIComponent(client) + '&v=3.24');
src += '?' + params.join('&') + "&libraries=places";
content = '<script type="text/javascript" src="' + src + '"></script>';
}
}
return content;
}
};
| Add config for client ID for premium g maps users | Add config for client ID for premium g maps users | JavaScript | mit | dmuneras/ember-place-autocomplete,dmuneras/ember-place-autocomplete | ---
+++
@@ -10,10 +10,13 @@
placeAutocompleteConfig = config['place-autocomplete'] || {},
params = [],
exclude = placeAutocompleteConfig.exclude,
+ client = placeAutocompleteConfig.client,
key = placeAutocompleteConfig.key;
if (!exclude) {
if (key)
params.push('key=' + encodeURIComponent(key));
+ if (client)
+ params.push('client=' + encodeURIComponent(client) + '&v=3.24');
src += '?' + params.join('&') + "&libraries=places";
content = '<script type="text/javascript" src="' + src + '"></script>';
} |
d4ca2e310726bb8b83223704dfa6695fa905a676 | index.js | index.js | "use strict";
var request = require('request');
var bodyParser = require('body-parser');
var express = require('express');
var app = express();
app.use('/', express.static(__dirname + '/public'));
app.use(bodyParser.json());
app.route('/api/proxy')
.get(
function(req, res) {
request(req.query.url).pipe(res);
}
);
app.listen(3000, function() {
console.log('Server is up and running');
}); | "use strict";
var request = require('request');
var bodyParser = require('body-parser');
var express = require('express');
var app = express();
app.use('/', express.static(__dirname + '/public'));
app.use(bodyParser.json());
app.route('/api/proxy')
.get(
function(req, res) {
request(req.query.url).pipe(res);
}
);
app.listen(process.env.PORT || 3000, function() {
console.log('Server is up and running');
}); | Use dynamic port for heroku | Use dynamic port for heroku
| JavaScript | mit | flammenmensch/pact,flammenmensch/pact | ---
+++
@@ -16,6 +16,6 @@
}
);
-app.listen(3000, function() {
+app.listen(process.env.PORT || 3000, function() {
console.log('Server is up and running');
}); |
6e074e40c5418964b5b937c9e4578d649b611702 | index.js | index.js | 'use strict';
const schedule = require('node-schedule');
const jenkins = require('./lib/jenkins');
const redis = require('./lib/redis');
const gitter = require('./lib/gitter');
const sendgrid = require('./lib/sendgrid');
const pkg = require('./package.json');
console.log(`Staring ${pkg.name} v${pkg.version}`);
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
console.log('Running Cron Job...');
console.log('Fetching Jenkins nodes...');
jenkins.getComputers(function(err, nodes) {
if (err) { throw err; }
console.log(`Found ${nodes.length} Jenkins nodes.`);
console.log('Checking changed Jenkins nodes...');
redis.jenkinsChanged(nodes, function(err, changed) {
if (err) { throw err; }
console.log(`${changed.length} node(s) changed.`);
if (changed.length > 0) {
console.log('Posting to Gitter...');
gitter.post(changed, function(err) {
if (err) { throw err; }
console.log('Gitter: Ok!');
});
console.log('Notifying via Sendgrid...');
sendgrid.notify(changed, function(err) {
if (err) { throw err; }
console.log('Sendgrid: Ok!');
});
}
});
});
});
| 'use strict';
const schedule = require('node-schedule');
const jenkins = require('./lib/jenkins');
const redis = require('./lib/redis');
const gitter = require('./lib/gitter');
const sendgrid = require('./lib/sendgrid');
const pkg = require('./package.json');
console.log(new Date(), `Staring ${pkg.name} v${pkg.version}`);
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
console.log(new Date(), 'Running Cron Job...');
console.log(new Date(), 'Fetching Jenkins nodes...');
jenkins.getComputers(function(err, nodes) {
if (err) { throw err; }
console.log(new Date(), `Found ${nodes.length} Jenkins nodes.`);
console.log(new Date(), 'Checking changed Jenkins nodes...');
redis.jenkinsChanged(nodes, function(err, changed) {
if (err) { throw err; }
console.log(new Date(), `${changed.length} node(s) changed.`);
if (changed.length > 0) {
console.log(new Date(), 'Posting to Gitter...');
gitter.post(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Gitter: Ok!');
});
console.log(new Date(), 'Notifying via Sendgrid...');
sendgrid.notify(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Sendgrid: Ok!');
});
}
});
});
});
| Add date time to all console log output | Add date time to all console log output
| JavaScript | mit | Starefossen/jenkins-monitor | ---
+++
@@ -9,33 +9,33 @@
const sendgrid = require('./lib/sendgrid');
const pkg = require('./package.json');
-console.log(`Staring ${pkg.name} v${pkg.version}`);
+console.log(new Date(), `Staring ${pkg.name} v${pkg.version}`);
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
- console.log('Running Cron Job...');
+ console.log(new Date(), 'Running Cron Job...');
- console.log('Fetching Jenkins nodes...');
+ console.log(new Date(), 'Fetching Jenkins nodes...');
jenkins.getComputers(function(err, nodes) {
if (err) { throw err; }
- console.log(`Found ${nodes.length} Jenkins nodes.`);
+ console.log(new Date(), `Found ${nodes.length} Jenkins nodes.`);
- console.log('Checking changed Jenkins nodes...');
+ console.log(new Date(), 'Checking changed Jenkins nodes...');
redis.jenkinsChanged(nodes, function(err, changed) {
if (err) { throw err; }
- console.log(`${changed.length} node(s) changed.`);
+ console.log(new Date(), `${changed.length} node(s) changed.`);
if (changed.length > 0) {
- console.log('Posting to Gitter...');
+ console.log(new Date(), 'Posting to Gitter...');
gitter.post(changed, function(err) {
if (err) { throw err; }
- console.log('Gitter: Ok!');
+ console.log(new Date(), 'Gitter: Ok!');
});
- console.log('Notifying via Sendgrid...');
+ console.log(new Date(), 'Notifying via Sendgrid...');
sendgrid.notify(changed, function(err) {
if (err) { throw err; }
- console.log('Sendgrid: Ok!');
+ console.log(new Date(), 'Sendgrid: Ok!');
});
}
}); |
6f0cfb0e09a602175c0b5e6b90b8f8a2bd90f96f | index.js | index.js | import {default as color, Color} from "./src/color";
import {default as rgb, Rgb} from "./src/rgb";
import {default as hsl, Hsl} from "./src/hsl";
import {default as lab, Lab} from "./src/lab";
import {default as hcl, Hcl} from "./src/hcl";
import {default as cubehelix, Cubehelix} from "./src/cubehelix";
import interpolateRgb from "./src/interpolateRgb";
import interpolateHsl from "./src/interpolateHsl";
import interpolateHslLong from "./src/interpolateHslLong";
import interpolateLab from "./src/interpolateLab";
import interpolateHcl from "./src/interpolateHcl";
import interpolateHclLong from "./src/interpolateHclLong";
import interpolateCubehelixGamma from "./src/interpolateCubehelixGamma";
import interpolateCubehelixGammaLong from "./src/interpolateCubehelixGammaLong";
export var interpolateCubehelix = interpolateCubehelixGamma(1);
export var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);
export {
color,
rgb,
hsl,
lab,
hcl,
cubehelix,
interpolateRgb,
interpolateHsl,
interpolateHslLong,
interpolateLab,
interpolateHcl,
interpolateHclLong,
interpolateCubehelixGamma,
interpolateCubehelixGammaLong
};
| import color from "./src/color";
import rgb from "./src/rgb";
import hsl from "./src/hsl";
import lab from "./src/lab";
import hcl from "./src/hcl";
import cubehelix from "./src/cubehelix";
import interpolateRgb from "./src/interpolateRgb";
import interpolateHsl from "./src/interpolateHsl";
import interpolateHslLong from "./src/interpolateHslLong";
import interpolateLab from "./src/interpolateLab";
import interpolateHcl from "./src/interpolateHcl";
import interpolateHclLong from "./src/interpolateHclLong";
import interpolateCubehelixGamma from "./src/interpolateCubehelixGamma";
import interpolateCubehelixGammaLong from "./src/interpolateCubehelixGammaLong";
export var interpolateCubehelix = interpolateCubehelixGamma(1);
export var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);
export {
color,
rgb,
hsl,
lab,
hcl,
cubehelix,
interpolateRgb,
interpolateHsl,
interpolateHslLong,
interpolateLab,
interpolateHcl,
interpolateHclLong,
interpolateCubehelixGamma,
interpolateCubehelixGammaLong
};
| Use just the default exports | Use just the default exports
| JavaScript | isc | d3/d3-color | ---
+++
@@ -1,9 +1,9 @@
-import {default as color, Color} from "./src/color";
-import {default as rgb, Rgb} from "./src/rgb";
-import {default as hsl, Hsl} from "./src/hsl";
-import {default as lab, Lab} from "./src/lab";
-import {default as hcl, Hcl} from "./src/hcl";
-import {default as cubehelix, Cubehelix} from "./src/cubehelix";
+import color from "./src/color";
+import rgb from "./src/rgb";
+import hsl from "./src/hsl";
+import lab from "./src/lab";
+import hcl from "./src/hcl";
+import cubehelix from "./src/cubehelix";
import interpolateRgb from "./src/interpolateRgb";
import interpolateHsl from "./src/interpolateHsl";
import interpolateHslLong from "./src/interpolateHslLong"; |
ca8499e1b7d2ee822991234bd3881b03d117495a | resources/scripts/animation.js | resources/scripts/animation.js | $(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 1) {
/* add header animation */
$('header').addClass('scroll-nav scroll-animation');
/* add hamburger icon animation */
$('.hamburger-icon').addClass('scroll-icon');
} else {
/* remove header animation */
$('header').removeClass('scroll-nav').addClass('scroll-animation');
/* remove hamburger icon animation */
$('.hamburger-icon').removeClass('scroll-icon').addClass('scroll-animation');
}
});
}); | $(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 1) {
/* add header animation */
$('header').addClass('scroll-nav scroll-animation');
/* add hamburger icon trigger adjustment */
$('.hamburgerTrigger').addClass('pushHamburgerIcon');
} else {
/* remove header animation */
$('header').removeClass('scroll-nav').addClass('scroll-animation');
/* remove hamburger icon trigger adjustment */
$('.hamburgerTrigger').removeClass('pushHamburgerIcon').addClass('scroll-animation');
}
});
}); | Add pushHamburgerIcon and remove .scroll-icon | Add pushHamburgerIcon and remove .scroll-icon
| JavaScript | mit | andrewsgardner/AdaptiveNav,andrewsgardner/AdaptiveNav,andrewsgardner/AdaptiveNav | ---
+++
@@ -6,16 +6,16 @@
/* add header animation */
$('header').addClass('scroll-nav scroll-animation');
- /* add hamburger icon animation */
- $('.hamburger-icon').addClass('scroll-icon');
+ /* add hamburger icon trigger adjustment */
+ $('.hamburgerTrigger').addClass('pushHamburgerIcon');
} else {
/* remove header animation */
$('header').removeClass('scroll-nav').addClass('scroll-animation');
- /* remove hamburger icon animation */
- $('.hamburger-icon').removeClass('scroll-icon').addClass('scroll-animation');
+ /* remove hamburger icon trigger adjustment */
+ $('.hamburgerTrigger').removeClass('pushHamburgerIcon').addClass('scroll-animation');
}
}); |
66efbdf3be4505842bcfd38909a03809d3084ce4 | example/2-generate-keypair.js | example/2-generate-keypair.js | 'use strict';
var storj = require('storj');
var fs = require('fs');
// Set the bridge api URL
var api = 'https://api.storj.io';
// Create client for interacting with API
// API credentials
var user = {email: 'example@storj.io', password: 'examplePass'};
var client = storj.BridgeClient(api, {basicauth: user});
// Generate KeyPair
var keypair = storj.KeyPair();
// Add the keypair public key to the user account for authentication
client.addPublicKey(keypair.getPublicKey(), function(err) {
if (err) {
// Handle error on failure.
return console.log('error', err.message);
}
// Save the private key for using to login later.
// You should probably encrypt this
fs.writeFileSync('./private.key', keypair.getPrivateKey());
});
| 'use strict';
var storj = require('storj');
var fs = require('fs');
// Set the bridge api URL
var api = 'https://api.storj.io';
// Create client for interacting with API
// API credentials
var user = {email: 'example@storj.io', password: 'examplePass'};
var client = storj.BridgeClient(api, {basicAuth: user});
// Generate KeyPair
var keypair = storj.KeyPair();
// Add the keypair public key to the user account for authentication
client.addPublicKey(keypair.getPublicKey(), function(err) {
if (err) {
// Handle error on failure.
return console.log('error', err.message);
}
// Save the private key for using to login later.
// You should probably encrypt this
fs.writeFileSync('./private.key', keypair.getPrivateKey());
});
| Correct typo in keypair generation example | Correct typo in keypair generation example | JavaScript | agpl-3.0 | retrohacker/core,Storj/core,orcproject/orc,Storj/node-storj,orcproject/orc,bookchin/orc,bookchin/orc,aleitner/core,gordonwritescode/storj-core | ---
+++
@@ -8,7 +8,7 @@
// API credentials
var user = {email: 'example@storj.io', password: 'examplePass'};
-var client = storj.BridgeClient(api, {basicauth: user});
+var client = storj.BridgeClient(api, {basicAuth: user});
// Generate KeyPair
var keypair = storj.KeyPair(); |
b5967babb15e165b72bf0e10b79f562112f105d3 | docs/js/ga.js | docs/js/ga.js | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65024936-1', 'auto');
ga('send', 'pageview');
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65024936-1', 'auto');
ga('send', 'pageview');
| Switch google analytics to always use https, since they redirect theselves | Switch google analytics to always use https, since they redirect theselves
| JavaScript | mit | outsideris/mocha,adamgruber/mocha,igwejk/mocha,hoverduck/mocha,mochajs/mocha,adamgruber/mocha,boneskull/mocha,boneskull/mocha,adamgruber/mocha,boneskull/mocha,igwejk/mocha,hoverduck/mocha,hoverduck/mocha,mochajs/mocha,hoverduck/mocha,outsideris/mocha,mochajs/mocha | ---
+++
@@ -1,7 +1,7 @@
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65024936-1', 'auto');
ga('send', 'pageview'); |
63c17b633da0843e1d118319d4029651a3c49b36 | server/lib/utilities.js | server/lib/utilities.js | const bodyParser = require('body-parser');
const request = require('request');
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities(); // decode strings like '&'
module.exports.fetchWiki = function(req, res) {
const url = 'http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles='
+ req.query.exactWikiTitle
+ '&format=json&exintro=1';
request(url, (err, requestResponse, body) => {
if (err) {
console.log('Error in Wikipedia fetch', err);
} else {
const query = (JSON.parse(body)).query.pages;
const text = query[(Object.keys(query)[0])].extract;
const regex = /(<([^>]+)>)/ig;
const firstParagraph = text.slice(0, text.indexOf('\n'));
const result = firstParagraph.replace(regex, '');
const regexApostrophes = /(\')/ig;
let output = result.replace(regexApostrophes, '\'');
output = entities.decode(output);
console.log('Sending scrubbed wiki text:', output);
res.status(200).send(JSON.stringify(output));
}
});
}; | const bodyParser = require('body-parser');
const request = require('request');
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities(); // decode strings like '&'
module.exports.fetchWiki = function(req, res) {
console.log('🍊 Starting Wikipedia API request for ', req.query.exactWikiTitle);
const url = 'http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles='
+ req.query.exactWikiTitle
+ '&format=json&exintro=1';
request(url, (err, requestResponse, body) => {
if (err) {
console.log('Error in Wikipedia fetch', err);
} else {
const query = (JSON.parse(body)).query.pages;
if (query['-1']) {
console.log('🍊 bad title for Wikipedia API request:', query['-1'].title);
res.status(404).send('Not Found');
return;
}
const text = query[(Object.keys(query)[0])].extract;
const regex = /(<([^>]+)>)/ig;
const firstParagraph = text.slice(0, text.indexOf('\n'));
const result = firstParagraph.replace(regex, '');
const regexApostrophes = /(\')/ig;
let output = result.replace(regexApostrophes, '\'');
output = entities.decode(output);
console.log('🍊 Sending scrubbed text to client:', output.slice(0, 55) + '...');
res.status(200).send(JSON.stringify(output));
}
});
}; | Handle bad title requests on getWiki endpoint | Handle bad title requests on getWiki endpoint
| JavaScript | mit | francoabaroa/escape-reality,lowtalkers/escape-reality,lowtalkers/escape-reality,francoabaroa/escape-reality | ---
+++
@@ -5,15 +5,23 @@
const entities = new Entities(); // decode strings like '&'
module.exports.fetchWiki = function(req, res) {
+ console.log('🍊 Starting Wikipedia API request for ', req.query.exactWikiTitle);
const url = 'http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles='
+ req.query.exactWikiTitle
+ '&format=json&exintro=1';
-
+
request(url, (err, requestResponse, body) => {
if (err) {
console.log('Error in Wikipedia fetch', err);
} else {
const query = (JSON.parse(body)).query.pages;
+
+ if (query['-1']) {
+ console.log('🍊 bad title for Wikipedia API request:', query['-1'].title);
+ res.status(404).send('Not Found');
+ return;
+ }
+
const text = query[(Object.keys(query)[0])].extract;
const regex = /(<([^>]+)>)/ig;
const firstParagraph = text.slice(0, text.indexOf('\n'));
@@ -22,7 +30,7 @@
const regexApostrophes = /(\')/ig;
let output = result.replace(regexApostrophes, '\'');
output = entities.decode(output);
- console.log('Sending scrubbed wiki text:', output);
+ console.log('🍊 Sending scrubbed text to client:', output.slice(0, 55) + '...');
res.status(200).send(JSON.stringify(output));
} |
a5f6a7eb800f66b0f43f50452f3d7be95214631f | src/js/components/User.js | src/js/components/User.js | import React, { PropTypes, Component } from 'react';
import { Link } from 'react-router';
import shouldPureComponentUpdate from 'react-pure-render/function';
import selectn from 'selectn';
export default class User extends Component {
static propTypes = {
user: PropTypes.object.isRequired
};
shouldComponentUpdate = shouldPureComponentUpdate;
render() {
const { user } = this.props;
let imgSrc = user.picture ? `https://dev.nekuno.com/media/cache/resolve/profile_picture/user/images/${user.picture}` : 'https://dev.nekuno.com/media/cache/user_avatar_180x180/bundles/qnoowweb/images/user-no-img.jpg';
return (
<div className="User">
<div className="content-block user-block">
<div className="user-image">
<img src={imgSrc} />
</div>
<div className="user-data">
<div className="user-username">
{user.username}
</div>
<div className="user-location">
<span className="icon-marker"></span> {selectn('location.address', user) ? user.location.address : 'Madrid'}
</div>
</div>
</div>
</div>
);
}
}
| import React, { PropTypes, Component } from 'react';
import { Link } from 'react-router';
import shouldPureComponentUpdate from 'react-pure-render/function';
import selectn from 'selectn';
export default class User extends Component {
static propTypes = {
user: PropTypes.object.isRequired
};
shouldComponentUpdate = shouldPureComponentUpdate;
render() {
const { user } = this.props;
let imgSrc = user.picture ? `https://dev.nekuno.com/media/cache/user_avatar_180x180/user/images/${user.picture}` : 'https://dev.nekuno.com/media/cache/user_avatar_180x180/bundles/qnoowweb/images/user-no-img.jpg';
return (
<div className="User">
<div className="content-block user-block">
<div className="user-image">
<img src={imgSrc} />
</div>
<div className="user-data">
<div className="user-username">
{user.username}
</div>
<div className="user-location">
<span className="icon-marker"></span> {selectn('location.address', user) ? user.location.address : 'Madrid'}
</div>
</div>
</div>
</div>
);
}
}
| Use bigger image for user picture | Use bigger image for user picture
| JavaScript | agpl-3.0 | nekuno/client,nekuno/client | ---
+++
@@ -12,7 +12,7 @@
render() {
const { user } = this.props;
- let imgSrc = user.picture ? `https://dev.nekuno.com/media/cache/resolve/profile_picture/user/images/${user.picture}` : 'https://dev.nekuno.com/media/cache/user_avatar_180x180/bundles/qnoowweb/images/user-no-img.jpg';
+ let imgSrc = user.picture ? `https://dev.nekuno.com/media/cache/user_avatar_180x180/user/images/${user.picture}` : 'https://dev.nekuno.com/media/cache/user_avatar_180x180/bundles/qnoowweb/images/user-no-img.jpg';
return (
<div className="User">
<div className="content-block user-block"> |
42075c62334e7f8d28bb833c8a442a92aa26cf9f | src/js/select2/i18n/gl.js | src/js/select2/i18n/gl.js | define(function () {
// Galician
return {
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'Engada ';
if (overChars === 1) {
message += 'un carácter';
} else {
message += overChars + ' caracteres';
}
return message;
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'Elimine ';
if (remainingChars === 1) {
message += 'un carácter';
} else {
message += remainingChars + ' caracteres';
}
return message;
},
loadingMore: function () {
return 'Cargando máis resultados…';
},
maximumSelected: function (args) {
var message = 'Só pode ';
if (args.maximum === 1) {
message += 'un elemento';
} else {
message += args.maximum + ' elementos';
}
return message;
},
noResults: function () {
return 'Non se atoparon resultados';
},
searching: function () {
return 'Buscando…';
}
};
});
| define(function () {
// Galician
return {
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'Elimine ';
if (overChars === 1) {
message += 'un carácter';
} else {
message += overChars + ' caracteres';
}
return message;
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'Engada ';
if (remainingChars === 1) {
message += 'un carácter';
} else {
message += remainingChars + ' caracteres';
}
return message;
},
loadingMore: function () {
return 'Cargando máis resultados…';
},
maximumSelected: function (args) {
var message = 'Só pode ';
if (args.maximum === 1) {
message += 'un elemento';
} else {
message += args.maximum + ' elementos';
}
return message;
},
noResults: function () {
return 'Non se atoparon resultados';
},
searching: function () {
return 'Buscando…';
}
};
});
| Swap inputTooLong and inputTooShort error messages | Swap inputTooLong and inputTooShort error messages
"Engada" in galician is "to add" and therefore should be the base text used for the inputTooShort method, asking the use to add more chars. It seems to be mistakenly defined exactly the opposite it should be (as inputTooLong was containing the right text). | JavaScript | mit | binary-koan/select2,jiawenbo/select2,murb/select2,matixmatix/select2,bottomline/select2,lewis-ing/select2,megahallon/select2,UziTech/select2,zhaoyan158567/select2,xtrepo/select2,afelixnieto/select2,syndbg/select2,openbizgit/select2,keitler/select2,tb/select2,marcoheyrex/select2,Restless-ET/select2,zhangwei900808/select2,theyec/select2,merutak/select2,blackbricksoftware/select2,select2/select2,od3n/select2,Youraiseme/select2,brees01/select2,AhmedMoosa/select2,select2/select2,CodingJoker/select2,gitkiselev/select2,myactionreplay/select2,mizalewski/select2,jkgroupe/select2,sitexa/select2,nikolas/select2,loogart/select2,jiawenbo/select2,shuai959980629/select2,marcoheyrex/select2,fk/select2,fashionsun/select2,stretch4x4/select2,lewis-ing/select2,tzellman/select2,Restless-ET/select2,NabiKAZ/select2,InteractiveIntelligence/select2,jkgroupe/select2,MAubreyK/select2,matixmatix/select2,stretch4x4/select2,nopash/select2,brees01/select2,AhmedMoosa/select2,ianawilson/select2,adrianpietka/select2,gianndall/select2,khallaghi/select2,merutak/select2,chungth/select2,murb/select2,michael-brade/select2,BenJenkinson/select2,tb/select2,khallaghi/select2,MAubreyK/select2,riiiiizzzzzohmmmmm/select2,LockonZero/select2,perdona/select2,theyec/select2,NabiKAZ/select2,IntelliTect/select2,alexlondon07/select2,slowcolor/select2,zhaoyan158567/select2,fk/select2,vgrish/select2,michael-brade/select2,binaryvo/select2,jlgarciakitmaker/select2,ibrahimyu/select2,megahallon/select2,kahwee/select2,xtrepo/select2,Burick/select2,RickMeasham/select2,fashionsun/select2,AnthonyDiSanti/select2,loogart/select2,ZaArsProgger/select2,18098924759/select2,taf2/select2,Burick/select2,azotos/select2,binary-koan/select2,iestruch/select2,IntelliTect/select2,kahwee/select2,alexlondon07/select2,Youraiseme/select2,thiagocarlossilverio/select2,ForeverPx/select2,LockonZero/select2,goodwall/select2,InteractiveIntelligence/select2,CodingJoker/select2,ZaArsProgger/select2,AnthonyDiSanti/select2,syndbg/select2,shuai959980629/select2,sujonvidia/select2,perdona/select2,binaryvo/select2,sitexa/select2,keitler/select2,ForeverPx/select2,farzak/select2,UziTech/select2,od3n/select2,sujonvidia/select2,Currency-One/select2-v4,farzak/select2,trileuco/select2,gitkiselev/select2,nikolas/select2,jlgarciakitmaker/select2,thiagocarlossilverio/select2,lisong521/select2,inway/select2,Currency-One/select2-v4,vgrish/select2,BenJenkinson/select2,goodwall/select2,taf2/select2,chungth/select2,iestruch/select2,zhangwei900808/select2,18098924759/select2,nopash/select2,azotos/select2,RickMeasham/select2,qq645381995/select2,lisong521/select2,inway/select2,qq645381995/select2,ianawilson/select2,riiiiizzzzzohmmmmm/select2,slowcolor/select2,openbizgit/select2,adrianpietka/select2,blackbricksoftware/select2,ibrahimyu/select2,gianndall/select2,mizalewski/select2,bottomline/select2,trileuco/select2,afelixnieto/select2,tzellman/select2,myactionreplay/select2 | ---
+++
@@ -4,7 +4,7 @@
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
- var message = 'Engada ';
+ var message = 'Elimine ';
if (overChars === 1) {
message += 'un carácter';
@@ -17,7 +17,7 @@
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
- var message = 'Elimine ';
+ var message = 'Engada ';
if (remainingChars === 1) {
message += 'un carácter'; |
c5a120528daf4a1bae5b1d7bde43a275559b4e5c | index.js | index.js | var dgram = require('dgram');
const PORT = 5050
const PING_PAYLOAD = "dd00000a000000000000000400000002"
const POWER_PAYLOAD = "dd02001300000010"
module.exports = Xbox;
function Xbox(ip, id) {
this.ip = ip;
this.id = id;
return this;
}
Xbox.prototype.powerOn = function(callback) {
callback = callback || function() {};
// Counter some older node compatibility issues with `new Buffer(1).fill(0)`
var zeroBuffer = new Buffer(1);
zeroBuffer.write('\u0000');
var message = Buffer.concat([new Buffer(POWER_PAYLOAD, 'hex'), new Buffer(this.id), zeroBuffer]);
var socket = dgram.createSocket('udp4');
socket.send(message, 0, message.length, PORT, this.ip, function(err, bytes) {
if (err) throw err;
socket.close();
callback();
});
}
| var dgram = require('dgram');
const PORT = 5050;
module.exports = Xbox;
function Xbox(ip, id) {
this.ip = ip;
this.id = id;
return this;
}
Xbox.prototype.powerOn = function(callback) {
callback = callback || function() {};
// Open socket
var socket = dgram.createSocket('udp4');
// Create payload
var powerPayload = Buffer.from('\x00' + String.fromCharCode(this.id.length) + this.id + '\x00'),
powerPayloadLength = Buffer.from(String.fromCharCode(powerPayload.length)),
powerHeader = Buffer.concat([Buffer.from('dd0200', 'hex'), powerPayloadLength, Buffer.from('0000', 'hex')]),
powerPacket = Buffer.concat([powerHeader, powerPayload]);
// Send
socket.send(powerPacket, 0, powerPacket.length, PORT, this.ip, function(err) {
if (err) throw err;
socket.close();
callback();
});
};
| Create packet assuming variable LiveID length | Create packet assuming variable LiveID length
Fixes #7
| JavaScript | mit | arcreative/xbox-on | ---
+++
@@ -1,8 +1,6 @@
var dgram = require('dgram');
-const PORT = 5050
-const PING_PAYLOAD = "dd00000a000000000000000400000002"
-const POWER_PAYLOAD = "dd02001300000010"
+const PORT = 5050;
module.exports = Xbox;
@@ -14,16 +12,20 @@
Xbox.prototype.powerOn = function(callback) {
callback = callback || function() {};
-
- // Counter some older node compatibility issues with `new Buffer(1).fill(0)`
- var zeroBuffer = new Buffer(1);
- zeroBuffer.write('\u0000');
-
- var message = Buffer.concat([new Buffer(POWER_PAYLOAD, 'hex'), new Buffer(this.id), zeroBuffer]);
+
+ // Open socket
var socket = dgram.createSocket('udp4');
- socket.send(message, 0, message.length, PORT, this.ip, function(err, bytes) {
+
+ // Create payload
+ var powerPayload = Buffer.from('\x00' + String.fromCharCode(this.id.length) + this.id + '\x00'),
+ powerPayloadLength = Buffer.from(String.fromCharCode(powerPayload.length)),
+ powerHeader = Buffer.concat([Buffer.from('dd0200', 'hex'), powerPayloadLength, Buffer.from('0000', 'hex')]),
+ powerPacket = Buffer.concat([powerHeader, powerPayload]);
+
+ // Send
+ socket.send(powerPacket, 0, powerPacket.length, PORT, this.ip, function(err) {
if (err) throw err;
socket.close();
callback();
});
-}
+}; |
2a138e6ca9f5e55f7f233c4c36e625580033bdb6 | index.js | index.js | var fse = require("fs-extra");
function WebpackCopyAfterBuildPlugin(mappings) {
this._mappings = mappings || {};
}
WebpackCopyAfterBuildPlugin.prototype.apply = function(compiler) {
var mappings = this._mappings;
compiler.plugin("done", function(stats) {
var statsJson = stats.toJson();
var chunks = statsJson.chunks;
chunks.forEach(function(chunk) {
var bundleName = chunk.names[0];
var mapping = mappings[bundleName];
if (mapping) {
var outputPath = compiler.options.output.path;
var webpackContext = compiler.options.context;
var chunkHashFileName = chunk.files[0];
var from = webpackContext + "/" + outputPath + "/" + chunkHashFileName;
var to = webpackContext + "/" + outputPath + "/" + mapping;
fse.copySync(from, to);
}
});
});
};
module.exports = WebpackCopyAfterBuildPlugin;
| var fse = require("fs-extra");
function WebpackCopyAfterBuildPlugin(mappings) {
this._mappings = mappings || {};
}
WebpackCopyAfterBuildPlugin.prototype.apply = function(compiler) {
var mappings = this._mappings;
compiler.plugin("done", function(stats) {
var statsJson = stats.toJson();
var chunks = statsJson.chunks;
chunks.forEach(function(chunk) {
var bundleName = chunk.names[0];
var mapping = mappings[bundleName];
if (mapping) {
var devServer = compiler.options.devServer;
var outputPath;
if (devServer && devServer.contentBase) {
outputPath = devServer.contentBase;
} else {
outputPath = compiler.options.output.path;
}
var webpackContext = compiler.options.context;
var chunkHashFileName = chunk.files[0];
var from = webpackContext + "/" + outputPath + "/" + chunkHashFileName;
var to = webpackContext + "/" + outputPath + "/" + mapping;
fse.copySync(from, to);
}
});
});
};
module.exports = WebpackCopyAfterBuildPlugin;
| Add support for Webpack dev server | Add support for Webpack dev server
| JavaScript | mit | rupurt/webpack-copy-after-build-plugin | ---
+++
@@ -16,7 +16,15 @@
var mapping = mappings[bundleName];
if (mapping) {
- var outputPath = compiler.options.output.path;
+ var devServer = compiler.options.devServer;
+ var outputPath;
+
+ if (devServer && devServer.contentBase) {
+ outputPath = devServer.contentBase;
+ } else {
+ outputPath = compiler.options.output.path;
+ }
+
var webpackContext = compiler.options.context;
var chunkHashFileName = chunk.files[0];
var from = webpackContext + "/" + outputPath + "/" + chunkHashFileName; |
818da6248af63e209c6bbde9977fde9ba6569120 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-g-recaptcha',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = 'https://www.google.com/recaptcha/api.js?render=explicit';
content = '<script type="text/javascript" src="'+src+'"></script>';
}
return content;
}
};
| /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-g-recaptcha',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = 'https://www.google.com/recaptcha/api.js?render=explicit';
content = '<script type="text/javascript" src="'+src+'" async></script>';
}
return content;
}
};
| Add async to script tag | Add async to script tag
| JavaScript | mit | algonauti/ember-g-recaptcha,algonauti/ember-g-recaptcha | ---
+++
@@ -8,7 +8,7 @@
var content = '';
if (type === 'body-footer') {
var src = 'https://www.google.com/recaptcha/api.js?render=explicit';
- content = '<script type="text/javascript" src="'+src+'"></script>';
+ content = '<script type="text/javascript" src="'+src+'" async></script>';
}
return content;
} |
af05d45c247772363e2a0f7eb6b70d3b4225fed6 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-full-story'
};
| /* jshint node: true */
'use strict';
function fsValidateConfig(config) {
if (!config.org) {
throw new Error('ember-full-story requires an org to be configured.');
}
}
function fsRecordingSnipppet(config) {
return [
"<script>",
"window['_fs_debug'] = false;",
"window['_fs_host'] = 'www.fullstory.com';",
"window['_fs_org'] = '" + config.org + "';",
"(function(m,n,e,t,l,o,g,y){",
" g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[];",
" o=n.createElement(t);o.async=1;o.src='https://'+_fs_host+'/s/fs.js';",
" y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);",
" g.identify=function(i,v){g(l,{uid:i});if(v)g(l,v)};g.setUserVars=function(v){FS(l,v)};",
" g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;FS(o,v)};",
" g.clearUserCookie=function(d,i){d=n.domain;while(1){n.cookie='fs_uid=;domain='+d+",
" ';path=/;expires='+new Date(0);i=d.indexOf('.');if(i<0)break;d=d.slice(i+1)}}",
"})(window,document,'FS','script','user');",
"</script>"
].join('\n');
}
module.exports = {
name: 'ember-full-story',
contentFor: function(type, config) {
if (type === 'head-footer') {
fsValidateConfig(config);
return fsRecordingSnippet(config);
}
}
};
| Include FullStory recording snippet in content-for header-footer | Include FullStory recording snippet in content-for header-footer
| JavaScript | mit | HeroicEric/ember-full-story,HeroicEric/ember-full-story | ---
+++
@@ -1,6 +1,39 @@
/* jshint node: true */
'use strict';
+function fsValidateConfig(config) {
+ if (!config.org) {
+ throw new Error('ember-full-story requires an org to be configured.');
+ }
+}
+
+function fsRecordingSnipppet(config) {
+ return [
+ "<script>",
+ "window['_fs_debug'] = false;",
+ "window['_fs_host'] = 'www.fullstory.com';",
+ "window['_fs_org'] = '" + config.org + "';",
+ "(function(m,n,e,t,l,o,g,y){",
+ " g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[];",
+ " o=n.createElement(t);o.async=1;o.src='https://'+_fs_host+'/s/fs.js';",
+ " y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);",
+ " g.identify=function(i,v){g(l,{uid:i});if(v)g(l,v)};g.setUserVars=function(v){FS(l,v)};",
+ " g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;FS(o,v)};",
+ " g.clearUserCookie=function(d,i){d=n.domain;while(1){n.cookie='fs_uid=;domain='+d+",
+ " ';path=/;expires='+new Date(0);i=d.indexOf('.');if(i<0)break;d=d.slice(i+1)}}",
+ "})(window,document,'FS','script','user');",
+ "</script>"
+ ].join('\n');
+}
+
module.exports = {
- name: 'ember-full-story'
+ name: 'ember-full-story',
+
+ contentFor: function(type, config) {
+ if (type === 'head-footer') {
+ fsValidateConfig(config);
+
+ return fsRecordingSnippet(config);
+ }
+ }
}; |
407747697543d59daac59b94084070a9ce4ac945 | cli/src/commands/init.js | cli/src/commands/init.js | // @flow
/* eslint-disable no-console */
import path from 'path';
import { green } from 'chalk';
import inquirer from 'inquirer';
import createConfig from '../createConfig';
import { fileExists } from '../util/fs';
import { printErrors } from '../printErrors';
import typeof Yargs from 'yargs';
import type { BaseArgs } from './index';
const name = 'init';
const description = 'Creates a .amazeeio.yml config in the current working directory';
export async function setup(yargs: Yargs): Promise<Object> {
return yargs.usage(`$0 ${name} - ${description}`).argv;
}
export async function run({ cwd, clog = console.log }: BaseArgs): Promise<number> {
const filepath = path.join(cwd, '.amazeeio.yml');
if (await fileExists(filepath)) {
const { replace } = await inquirer.prompt([
{
type: 'confirm',
name: 'replace',
message: `File '${filepath}' already exists! Replace?`,
default: false,
},
]);
if (!replace) return printErrors(clog, `Not replacing existing file '${filepath}'.`);
}
try {
clog(`Creating file '${filepath}'...`);
await writeDefaultConfig(filepath);
clog(green('Configuration file created!'));
} catch (e) {
return printErrors(clog, `Error occurred while writing to ${filepath}:`, e);
}
return 0;
}
export default {
setup,
name,
description,
run,
};
| // @flow
/* eslint-disable no-console */
import path from 'path';
import { green } from 'chalk';
import inquirer from 'inquirer';
import createConfig from '../createConfig';
import { fileExists } from '../util/fs';
import { printErrors } from '../printErrors';
import typeof Yargs from 'yargs';
import type { BaseArgs } from './index';
const name = 'init';
const description = 'Creates a .amazeeio.yml config in the current working directory';
export async function setup(yargs: Yargs): Promise<Object> {
return yargs.usage(`$0 ${name} - ${description}`).argv;
}
export async function run({ cwd, clog = console.log }: BaseArgs): Promise<number> {
const filepath = path.join(cwd, '.amazeeio.yml');
if (await fileExists(filepath)) {
const { overwrite } = await inquirer.prompt([
{
type: 'confirm',
name: 'overwrite',
message: `File '${filepath}' already exists! Overwrite?`,
default: false,
},
]);
if (!overwrite) return printErrors(clog, `Not overwriting existing file '${filepath}'.`);
}
try {
clog(`Creating file '${filepath}'...`);
await writeDefaultConfig(filepath);
clog(green('Configuration file created!'));
} catch (e) {
return printErrors(clog, `Error occurred while writing to ${filepath}:`, e);
}
return 0;
}
export default {
setup,
name,
description,
run,
};
| Improve naming of variable and message | Improve naming of variable and message
| JavaScript | apache-2.0 | amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon | ---
+++
@@ -23,15 +23,15 @@
const filepath = path.join(cwd, '.amazeeio.yml');
if (await fileExists(filepath)) {
- const { replace } = await inquirer.prompt([
+ const { overwrite } = await inquirer.prompt([
{
type: 'confirm',
- name: 'replace',
- message: `File '${filepath}' already exists! Replace?`,
+ name: 'overwrite',
+ message: `File '${filepath}' already exists! Overwrite?`,
default: false,
},
]);
- if (!replace) return printErrors(clog, `Not replacing existing file '${filepath}'.`);
+ if (!overwrite) return printErrors(clog, `Not overwriting existing file '${filepath}'.`);
}
try { |
36f054590d4f5fa994af5f2e7d592840bf9f9d27 | index.js | index.js | 'use strict';
var toStr = Object.prototype.toString;
var fnToStr = Function.prototype.toString;
var isFnRegex = /^\s*function\*/;
module.exports = function isGeneratorFunction(fn) {
var fnStr = toStr.call(fn);
return fnStr === '[object Function]' && isFnRegex.test(fnToStr.call(fn));
};
| 'use strict';
var toStr = Object.prototype.toString;
var fnToStr = Function.prototype.toString;
var isFnRegex = /^\s*function\*/;
module.exports = function isGeneratorFunction(fn) {
var fnStr = toStr.call(fn);
return (fnStr === '[object Function]' || fnStr === '[object GeneratorFunction]') && isFnRegex.test(fnToStr.call(fn));
};
| Fix tests in newer v8 (and io.js) | Fix tests in newer v8 (and io.js) | JavaScript | mit | ljharb/is-generator-function | ---
+++
@@ -6,6 +6,6 @@
module.exports = function isGeneratorFunction(fn) {
var fnStr = toStr.call(fn);
- return fnStr === '[object Function]' && isFnRegex.test(fnToStr.call(fn));
+ return (fnStr === '[object Function]' || fnStr === '[object GeneratorFunction]') && isFnRegex.test(fnToStr.call(fn));
};
|
82ce0eac8fba63e292ce6a8acffb353c3847ac53 | index.js | index.js | if (process.env.SUPERSTRING_USE_BROWSER_VERSION) {
module.exports = require('./browser');
} else {
try {
module.exports = require('./build/Release/superstring.node')
} catch (e) {
module.exports = require('./build/Debug/superstring.node')
}
}
| if (process.env.SUPERSTRING_USE_BROWSER_VERSION) {
module.exports = require('./browser');
} else {
try {
module.exports = require('./build/Release/superstring.node')
} catch (e1) {
try {
module.exports = require('./build/Debug/superstring.node')
} catch (e2) {
throw e1
}
}
}
| Throw original error if debug module cannot be found | Throw original error if debug module cannot be found
Otherwise all errors end up looking like a problem finding the debug
module, which often isn't the case.
| JavaScript | mit | atom/superstring,atom/superstring,atom/superstring,atom/superstring,atom/superstring | ---
+++
@@ -3,7 +3,11 @@
} else {
try {
module.exports = require('./build/Release/superstring.node')
- } catch (e) {
- module.exports = require('./build/Debug/superstring.node')
+ } catch (e1) {
+ try {
+ module.exports = require('./build/Debug/superstring.node')
+ } catch (e2) {
+ throw e1
+ }
}
} |
b02325d6aab94f7d8f8c674b7883be95b98803cc | index.js | index.js | module.exports = stringify
stringify.default = stringify
function stringify (obj) {
if (typeof obj === 'object' && typeof obj.toJSON !== 'function') {
decirc(obj, '', [], null)
}
return JSON.stringify(obj)
}
function Circle (val, k, parent) {
this.val = val
this.k = k
this.parent = parent
this.count = 1
}
Circle.prototype.toJSON = function toJSON () {
if (--this.count === 0) {
this.parent[this.k] = this.val
}
return '[Circular]'
}
function decirc (val, k, stack, parent) {
var keys, len, i
if (typeof val !== 'object' || val === null) {
// not an object, nothing to do
return
} else if (val instanceof Circle) {
val.count++
return
} else if (typeof val.toJSON === 'function') {
return
} else if (parent) {
if (~stack.indexOf(val)) {
parent[k] = new Circle(val, k, parent)
return
}
}
stack.push(val)
keys = Object.keys(val)
len = keys.length
i = 0
for (; i < len; i++) {
k = keys[i]
decirc(val[k], k, stack, val)
}
stack.pop()
}
| module.exports = stringify
stringify.default = stringify
function stringify (obj) {
if (obj !== null && typeof obj === 'object' && typeof obj.toJSON !== 'function') {
decirc(obj, '', [], null)
}
return JSON.stringify(obj)
}
function Circle (val, k, parent) {
this.val = val
this.k = k
this.parent = parent
this.count = 1
}
Circle.prototype.toJSON = function toJSON () {
if (--this.count === 0) {
this.parent[this.k] = this.val
}
return '[Circular]'
}
function decirc (val, k, stack, parent) {
var keys, len, i
if (typeof val !== 'object' || val === null) {
// not an object, nothing to do
return
} else if (val instanceof Circle) {
val.count++
return
} else if (typeof val.toJSON === 'function') {
return
} else if (parent) {
if (~stack.indexOf(val)) {
parent[k] = new Circle(val, k, parent)
return
}
}
stack.push(val)
keys = Object.keys(val)
len = keys.length
i = 0
for (; i < len; i++) {
k = keys[i]
decirc(val[k], k, stack, val)
}
stack.pop()
}
| Check if obj is null to avoid TypeError in pino | Check if obj is null to avoid TypeError in pino
Currently I'm getting this error in pino since some obj passed by pino to fast-safe-stringify is null. To avoid this and to restore JSON.stringify(null) behavior an additional null check is introduced here.
```
if (typeof obj === 'object' && typeof obj.toJSON !== 'function') {
^
TypeError: Cannot read property 'toJSON' of null
at EventEmitter.stringify (C:\p\codellama.io\web\server\node_modules\fast-safe-stringify\index.js:4:44)
at EventEmitter.asJson (C:\p\codellama.io\web\server\node_modules\pino\pino.js:137:22)
at EventEmitter.pinoWrite (C:\p\codellama.io\web\server\node_modules\pino\pino.js:193:16)
at EventEmitter.LOG (C:\p\codellama.io\web\server\node_modules\pino\lib\tools.js:117:10)
at C:\p\codellama.io\web\server\lib\stats.js:8:12
at C:\p\codellama.io\web\server\app\middleware.js:26:58
at Array.<anonymous> (C:\p\codellama.io\web\server\node_modules\express-req-metrics\index.js:22:7)
at listener (C:\p\codellama.io\web\server\node_modules\on-finished\index.js:169:15)
at onFinish (C:\p\codellama.io\web\server\node_modules\on-finished\index.js:100:5)
at callback (C:\p\codellama.io\web\server\node_modules\ee-first\index.js:55:10)
``` | JavaScript | mit | davidmarkclements/fast-safe-stringify | ---
+++
@@ -1,7 +1,7 @@
module.exports = stringify
stringify.default = stringify
function stringify (obj) {
- if (typeof obj === 'object' && typeof obj.toJSON !== 'function') {
+ if (obj !== null && typeof obj === 'object' && typeof obj.toJSON !== 'function') {
decirc(obj, '', [], null)
}
return JSON.stringify(obj) |
189680a189a7216546ab6880c64c082eff596ebc | index.js | index.js | 'use strict';
var isWeekend = function (date) {
var dateString = date,
weekDay = dateString.getDay(),
hour = dateString.getHours();
return ((weekDay === 5 && hour >= 17) || weekDay === 6 || weekDay === 0);
};
var ere = function (date) {
if (!date instanceof Date) {
throw new Error('Invalid date format. Use new Date()');
}
date = date || new Date();
return isWeekend(date);
};
exports.ere = ere;
| 'use strict';
var isWeekend = function (date) {
var dateString = date,
weekDay = dateString.getDay(),
hour = ((dateString.getHours() + 11) % 12 + 1);
return ((weekDay === 5 && hour >= 5) || weekDay === 6 || weekDay === 0);
};
var ere = function (date) {
if (!date instanceof Date) {
throw new Error('Invalid date format. Use new Date()');
}
date = date || new Date();
return isWeekend(date);
};
exports.ere = ere;
| Fix for AM/PM with hours | Fix for AM/PM with hours
AM/PM does not have 17 hours, obviously
| JavaScript | mit | wibron/helg | ---
+++
@@ -2,8 +2,8 @@
var isWeekend = function (date) {
var dateString = date,
weekDay = dateString.getDay(),
- hour = dateString.getHours();
- return ((weekDay === 5 && hour >= 17) || weekDay === 6 || weekDay === 0);
+ hour = ((dateString.getHours() + 11) % 12 + 1);
+ return ((weekDay === 5 && hour >= 5) || weekDay === 6 || weekDay === 0);
};
var ere = function (date) { |
2804dff377eb18be7e38f56dcc9258ce5c8efdee | index.js | index.js | /* 2017 Omikhleia
* License: MIT
*
* RoomJS bot main.
*/
const bunyan = require('bunyan')
const dotenv = require('dotenv')
const RoomJSBot = require('./src/room-js-bot')
const pkg = require('./package.json')
dotenv.config()
const config = {
username: process.env.BOT_USER,
password: process.env.BOT_PASSWORD,
character: process.env.BOT_CHARACTER,
address: process.env.ADDRESS || '127.0.0.1',
port: process.env.PORT || '8888',
inactivity: parseInt(process.env.BOT_INACTIVITY) || 60000,
speed: parseInt(process.env.BOT_CPM) || 800,
logLevel: process.env.LOG_LEVEL || 'info',
appName: pkg.name
}
const { appName, logLevel } = config
const logger = bunyan.createLogger({ name: appName, level: logLevel })
if (config.username && config.password && config.character) {
const client = new RoomJSBot(logger, config)
} else {
this.logger.fatal('Credentials missing from environment configuration')
process.exit(1)
}
| /* 2017 Omikhleia
* License: MIT
*
* RoomJS bot main.
*/
const bunyan = require('bunyan')
const dotenv = require('dotenv')
const RoomJSBot = require('./src/room-js-bot')
const pkg = require('./package.json')
dotenv.config()
const config = {
username: process.env.BOT_USER,
password: process.env.BOT_PASSWORD,
character: process.env.BOT_CHARACTER,
address: process.env.ADDRESS || '127.0.0.1',
port: process.env.PORT || '8888',
inactivity: parseInt(process.env.BOT_INACTIVITY) || 60000,
speed: parseInt(process.env.BOT_CPM) || 800,
logLevel: process.env.LOG_LEVEL || 'info',
appName: pkg.name
}
const { appName, logLevel } = config
const logger = bunyan.createLogger({ name: appName, level: logLevel })
if (config.username && config.password && config.character) {
const client = new RoomJSBot(logger, config)
} else {
logger.fatal('Credentials missing from environment configuration')
process.exit(1)
}
| Fix logger error case at start-up | Fix logger error case at start-up
| JavaScript | mit | Omikhleia/room.js-bot | ---
+++
@@ -28,6 +28,6 @@
if (config.username && config.password && config.character) {
const client = new RoomJSBot(logger, config)
} else {
- this.logger.fatal('Credentials missing from environment configuration')
+ logger.fatal('Credentials missing from environment configuration')
process.exit(1)
} |
cc045ac777181deee31b53ef6e7af15948149a2f | index.js | index.js | var fs = require('fs');
var minify = require('node-json-minify');
var argv = require('minimist')(process.argv.slice(2));
var jsesc = require('jsesc');
var elasticsearch = require('elasticsearch');
var esHost = argv.esHost || 'localhost';
var esPort = argv.esPort || '9200';
if (!argv.dashboard) {
console.log('You must specify a file containing the dashboard json with --dashboard.');
process.exit(1);
}
var es = new elasticsearch.Client({
host: esHost + ':' + esPort,
log: 'trace'
});
var dashboard = minify(fs.readFileSync(argv.dashboard).toString());
console.log(jsesc(dashboard, {'quotes': 'double'})); | var fs = require('fs');
var minify = require('node-json-minify');
var argv = require('minimist')(process.argv.slice(2));
var jsesc = require('jsesc');
var elasticsearch = require('elasticsearch');
var esHost = argv.esHost || 'localhost';
var esPort = argv.esPort || '9200';
if (!argv.dashboard) {
console.log('You must specify a file containing the dashboard json with --dashboard.');
process.exit(1);
}
var es = new elasticsearch.Client({
host: esHost + ':' + esPort,
log: 'trace'
});
try {
var dashboard = JSON.parse(fs.readFileSync(argv.dashboard).toString());
} catch(e) {
console.log('File specified with --dashboard is not valid JSON');
process.exit(1);
}
es.update({
index: 'grafana-dash',
type: 'dashboard',
id: dashboard.name,
doc: {
dashboard: jsesc(minify(JSON.stringify(dashboard.dashboard)), {'quotes': 'double'})
}
}, function(err, res) {
console.dir(err);
console.dir(res);
}); | Add support for adding dashboard to elastic search | Add support for adding dashboard to elastic search
| JavaScript | mit | jirwin/grapr | ---
+++
@@ -17,6 +17,21 @@
log: 'trace'
});
-var dashboard = minify(fs.readFileSync(argv.dashboard).toString());
+try {
+ var dashboard = JSON.parse(fs.readFileSync(argv.dashboard).toString());
+} catch(e) {
+ console.log('File specified with --dashboard is not valid JSON');
+ process.exit(1);
+}
-console.log(jsesc(dashboard, {'quotes': 'double'}));
+es.update({
+ index: 'grafana-dash',
+ type: 'dashboard',
+ id: dashboard.name,
+ doc: {
+ dashboard: jsesc(minify(JSON.stringify(dashboard.dashboard)), {'quotes': 'double'})
+ }
+}, function(err, res) {
+ console.dir(err);
+ console.dir(res);
+}); |
2141406c86217e7faf8726f273b1307f5f0176f0 | packages/babel-types/src/definitions/experimental.js | packages/babel-types/src/definitions/experimental.js | /* @flow */
import defineType, { assertNodeType } from "./index";
defineType("AwaitExpression", {
builder: ["argument"],
visitor: ["argument"],
aliases: ["Expression", "Terminatorless"],
fields: {
argument: {
validate: assertNodeType("Expression"),
}
}
});
defineType("BindExpression", {
visitor: ["object", "callee"],
fields: {
// todo
}
});
defineType("Decorator", {
visitor: ["expression"],
fields: {
expression: {
validate: assertNodeType("Expression")
}
}
});
defineType("DoExpression", {
visitor: ["body"],
aliases: ["Expression"],
fields: {
body: {
validate: assertNodeType("BlockStatement")
}
}
});
defineType("ExportDefaultSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: assertNodeType("Identifier")
}
}
});
defineType("ExportNamespaceSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: assertNodeType("Identifier")
}
}
});
defineType("RestProperty", {
visitor: ["argument"],
aliases: ["UnaryLike"],
fields: {
argument: {
validate: assertNodeType("LVal")
}
}
});
defineType("SpreadProperty", {
visitor: ["argument"],
aliases: ["UnaryLike"],
fields: {
argument: {
validate: assertNodeType("Expression")
}
}
});
| /* @flow */
import defineType, { assertNodeType } from "./index";
defineType("AwaitExpression", {
builder: ["argument"],
visitor: ["argument"],
aliases: ["Expression", "Terminatorless"],
fields: {
argument: {
validate: assertNodeType("Expression"),
}
}
});
defineType("BindExpression", {
visitor: ["object", "callee"],
aliases: ["Expression"],
fields: {
// todo
}
});
defineType("Decorator", {
visitor: ["expression"],
fields: {
expression: {
validate: assertNodeType("Expression")
}
}
});
defineType("DoExpression", {
visitor: ["body"],
aliases: ["Expression"],
fields: {
body: {
validate: assertNodeType("BlockStatement")
}
}
});
defineType("ExportDefaultSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: assertNodeType("Identifier")
}
}
});
defineType("ExportNamespaceSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: assertNodeType("Identifier")
}
}
});
defineType("RestProperty", {
visitor: ["argument"],
aliases: ["UnaryLike"],
fields: {
argument: {
validate: assertNodeType("LVal")
}
}
});
defineType("SpreadProperty", {
visitor: ["argument"],
aliases: ["UnaryLike"],
fields: {
argument: {
validate: assertNodeType("Expression")
}
}
});
| Add Expression alias to BindExpression | Add Expression alias to BindExpression | JavaScript | mit | tikotzky/babel,claudiopro/babel,zjmiller/babel,samwgoldman/babel,tikotzky/babel,kassens/babel,existentialism/babel,kedromelon/babel,garyjN7/babel,jridgewell/babel,vadzim/babel,lxe/babel,chicoxyzzy/babel,ameyms/babel,rmacklin/babel,hulkish/babel,bcoe/babel,jridgewell/babel,vhf/babel,mrtrizer/babel,PolymerLabs/babel,CrocoDillon/babel,samwgoldman/babel,kellyselden/babel,krasimir/babel,bcoe/babel,STRML/babel,KunGha/babel,zjmiller/babel,ccschneidr/babel,zertosh/babel,DmitrySoshnikov/babel,ccschneidr/babel,CrocoDillon/babel,samwgoldman/babel,claudiopro/babel,chicoxyzzy/babel,hulkish/babel,kellyselden/babel,existentialism/babel,KunGha/babel,PolymerLabs/babel,AgentME/babel,jhen0409/babel,shuhei/babel,kedromelon/babel,DmitrySoshnikov/babel,hzoo/babel,jchip/babel,kellyselden/babel,maurobringolf/babel,chicoxyzzy/babel,Skillupco/babel,benjamn/babel,benjamn/babel,jridgewell/babel,lxe/babel,zertosh/babel,guybedford/babel,guybedford/babel,hulkish/babel,Skillupco/babel,shuhei/babel,jchip/babel,zenparsing/babel,claudiopro/babel,zenparsing/babel,Skillupco/babel,iamchenxin/babel,kaicataldo/babel,iamchenxin/babel,babel/babel,jridgewell/babel,garyjN7/babel,dustyjewett/babel-plugin-transform-es2015-modules-commonjs-ember,hulkish/babel,antn/babel,kaicataldo/babel,maurobringolf/babel,vhf/babel,kaicataldo/babel,kellyselden/babel,Skillupco/babel,iamchenxin/babel,kedromelon/babel,antn/babel,babel/babel,krasimir/babel,shuhei/babel,jhen0409/babel,AgentME/babel,ameyms/babel,PolymerLabs/babel,maurobringolf/babel,vadzim/babel,chicoxyzzy/babel,rmacklin/babel,existentialism/babel,kaicataldo/babel,babel/babel,guybedford/babel,babel/babel,hzoo/babel,hzoo/babel,kassens/babel,mrtrizer/babel,hzoo/babel,STRML/babel | ---
+++
@@ -15,6 +15,7 @@
defineType("BindExpression", {
visitor: ["object", "callee"],
+ aliases: ["Expression"],
fields: {
// todo
} |
5e7ba3b111159c1ef15cf54e2fc593860c903ce6 | index.js | index.js | // see:
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/hotkeys
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/windows#BrowserWindow
var self = require('sdk/self');
var { Hotkey } = require("sdk/hotkeys");
var hopUpKey = Hotkey({
combo: "accel-alt-shift-]",
onPress: function() {
hopTabs("up");
}
});
var hopDownKey = Hotkey({
combo: "accel-alt-shift-[",
onPress: function() {
hopTabs("down");
}
});
function hopTabs(direction) {
var window = require("sdk/windows").browserWindows.activeWindow;
var hop = require('sdk/simple-prefs').prefs['tabhopperHop'];
if (direction == "down") {
hop = -hop;
}
var nextTab = window.tabs.activeTab.index + hop;
if (nextTab >= window.tabs.length) {
nextTab = window.tabs.length - 1;
} else if (nextTab < 0) {
nextTab = 0;
}
window.tabs[nextTab].activate();
}
| // see:
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/hotkeys
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/simple-prefs
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/windows#BrowserWindow
var self = require('sdk/self');
var { Hotkey } = require("sdk/hotkeys");
var hopUpKey = Hotkey({
combo: "accel-alt-shift-]",
onPress: function() {
hopTabs("up");
}
});
var hopDownKey = Hotkey({
combo: "accel-alt-shift-[",
onPress: function() {
hopTabs("down");
}
});
function hopTabs(direction) {
var window = require("sdk/windows").browserWindows.activeWindow;
var hop = require('sdk/simple-prefs').prefs['tabhopperHop'];
if (direction == "down") {
hop = -hop;
}
var nextTab = window.tabs.activeTab.index + hop;
if (nextTab >= window.tabs.length) {
nextTab = window.tabs.length - 1;
} else if (nextTab < 0) {
nextTab = 0;
}
window.tabs[nextTab].activate();
}
| Add link for simple-prefs doc | Add link for simple-prefs doc
| JavaScript | mpl-2.0 | bensteinberg/tabhopper | ---
+++
@@ -1,5 +1,6 @@
// see:
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/hotkeys
+// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/simple-prefs
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs
// https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/windows#BrowserWindow
|
67de61b778758fda74ddcf266b55cd63be3118dc | Backbone.uriSync.js | Backbone.uriSync.js | function uriSync(method, model, options) {
var resp = null,
S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
},
guid = function() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
},
URI = {
parse: function(){
var hash = window.location.href.split("#")[1] || "",
json = decodeURIComponent(hash),
data = {};
try {
data = json ? JSON.parse(json) : {};
}
catch(e) {}
return data;
},
stringify: function(data) {
return encodeURIComponent(JSON.stringify(data));
}
};
var data = URI.parse() || {};
switch (method) {
case "read":
resp = model.id ? data[model.id] || {} : data;
break;
case "create":
if (!model.id) {
model.set('id', guid());
}
resp = data[model.id] = model;
window.location.hash = URI.stringify(data);
break;
case "update":
resp = data[model.id] = model;
window.location.hash = URI.stringify(data);
break;
case "delete":
delete data[model.id];
window.location.hash = URI.stringify(data);
break;
}
if (resp) {
options.success(resp);
} else {
options.error("Record not found");
}
}
| function uriSync(method, model, options) {
var resp = null,
S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
},
guid = function() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
},
URI = {
parse: function() {
var hash = window.location.href.split("#")[1] || "",
json = decodeURIComponent(hash),
data = {};
try {
data = json ? JSON.parse(json) : {};
}
catch(e) {}
return data;
},
stringify: function(data) {
return encodeURIComponent(JSON.stringify(data));
}
};
var data = URI.parse() || {};
switch (method) {
case "read":
resp = model.id ? data[model.id] || {} : data;
break;
case "create":
if (!model.id) {
model.set('id', guid());
}
resp = data[model.id] = model;
window.location.hash = URI.stringify(data);
break;
case "update":
resp = data[model.id] = model;
window.location.hash = URI.stringify(data);
break;
case "delete":
delete data[model.id];
window.location.hash = URI.stringify(data);
break;
}
if (resp) {
options.success(resp);
} else {
options.error("Record not found");
}
}
| Add missing space for curly. NOTE: Last commit comment was truncated from typo, basically was a fix for Firefox and an escaping bug with window.location.hash. | Add missing space for curly. NOTE: Last commit comment was truncated from typo, basically was a fix for Firefox and an escaping bug with window.location.hash.
| JavaScript | mit | uzikilon/backbone-uriStorage | ---
+++
@@ -7,7 +7,7 @@
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
},
URI = {
- parse: function(){
+ parse: function() {
var hash = window.location.href.split("#")[1] || "",
json = decodeURIComponent(hash),
data = {}; |
2469d54612f13561c8765e6869f2f25ad81e6896 | karma.conf.js | karma.conf.js | // Karma configuration
// Generated on Fri May 10 2013 21:56:54 GMT+0200 (CEST)
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files / patterns to load in the browser
files = [
MOCHA,
MOCHA_ADAPTER,
'js/*.js'
];
// list of files to exclude
exclude = [
];
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['progress'];
// web server port
port = 9876;
// cli runner port
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
autoWatch = true;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['Chrome'];
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 60000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;
| // Karma configuration
// Generated on Fri May 10 2013 21:56:54 GMT+0200 (CEST)
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files / patterns to load in the browser
files = [
MOCHA,
MOCHA_ADAPTER,
'test/browser/chai.js',
'js/app.js',
'test/spec/app.js'
];
// list of files to exclude
exclude = [
];
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['progress'];
// web server port
port = 9876;
// cli runner port
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
autoWatch = true;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['Chrome'];
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 60000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;
| Add req. files to run tests using chai | Add req. files to run tests using chai
| JavaScript | mit | davidlitmark/beatsheet | ---
+++
@@ -10,13 +10,15 @@
files = [
MOCHA,
MOCHA_ADAPTER,
- 'js/*.js'
+ 'test/browser/chai.js',
+ 'js/app.js',
+ 'test/spec/app.js'
];
// list of files to exclude
exclude = [
-
+
];
|
3b568238237e5741bc40d6d7ea45ee67aa48aee6 | karma.conf.js | karma.conf.js | module.exports = function(config){
config.set({
basePath : './',
files : [
'app/bower_components/angular/angular.min.js',
'app/bower_components/angular-ui-router/release/angular-ui-router.min.js',
'app/bower_components/angular-resource/angular-resource.min.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/ng-table/dist/ng-table.min.js',
'app/bower_components/spin.js/spin.js',
'app/bower_components/angular-loading/angular-loading.min.js',
'app/search/**/*.js',
'app/services/**/*.js'
],
preprocessors: {
'app/search/*.js': ['coverage', 'coveralls'],
'app/services/*.js': ['coverage', 'coveralls']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'lcov',
dir: 'coverage/'
},
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['Chrome'],
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-coverage',
'karma-coveralls'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};
| module.exports = function(config){
config.set({
basePath : './',
files : [
'app/bower_components/angular/angular.min.js',
'app/bower_components/angular-ui-router/release/angular-ui-router.min.js',
'app/bower_components/angular-resource/angular-resource.min.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/ng-table/dist/ng-table.min.js',
'app/bower_components/spin.js/spin.js',
'app/bower_components/angular-loading/angular-loading.min.js',
'app/search/**/*.js',
'app/services/**/*.js'
],
preprocessors: {
'app/search/*.js': ['coverage', 'coveralls'],
'app/services/*.js': ['coverage', 'coveralls']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'lcov',
dir: 'coverage/'
},
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['Chrome'],
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-coverage',
'coveralls',
'karma-coveralls'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};
| Add coveralls back to list of plugins | Add coveralls back to list of plugins
| JavaScript | mit | excellalabs/ncarb-certification-search,excellalabs/ncarb-certification-search | ---
+++
@@ -39,6 +39,7 @@
'karma-jasmine',
'karma-junit-reporter',
'karma-coverage',
+ 'coveralls',
'karma-coveralls'
],
|
204e0e86e94f1ba34e9734d6e6fa324b9c5bd237 | lib/handlebars/t-namespace-inserter.js | lib/handlebars/t-namespace-inserter.js | /**
An HTMLBars AST transformation that updates all {{t}} statements to
ensure they have a namespace argument.
*/
var path = require('path');
function EnsureTNamespace(options) {
this.syntax = null;
this.options = options;
}
EnsureTNamespace.prototype.transform = function EnsureTNamespace_transform(ast) {
var traverse = this.syntax.traverse;
var builders = this.syntax.builders;
var options = this.options;
traverse(ast, {
MustacheStatement(node) {
if (isT(node)) {
ensureNamespace(node, builders, options);
}
}
});
return ast;
};
function isT(node) {
return node.path.original === 't';
}
function ensureNamespace(node, builders, options) {
var params = node.params;
var templateModuleName = options.moduleName || 'unknown';
templateModuleName = templateModuleName.replace(/\.hbs$/, '');
params.push(builders.string(templateModuleName));
}
module.exports = EnsureTNamespace;
| /**
An HTMLBars AST transformation that updates all {{t}} statements to
ensure they have a namespace argument.
*/
var path = require('path');
function EnsureTNamespace(options) {
this.syntax = null;
this.options = options;
}
EnsureTNamespace.prototype.transform = function EnsureTNamespace_transform(ast) {
var traverse = this.syntax.traverse;
var builders = this.syntax.builders;
var options = this.options;
traverse(ast, {
MustacheStatement: function(node) {
if (isT(node)) {
ensureNamespace(node, builders, options);
}
},
SubExpression: function(node) {
if (isT(node)) {
ensureNamespace(node, builders, options);
}
}
});
return ast;
};
function isT(node) {
return node.path.original === 't';
}
function ensureNamespace(node, builders, options) {
var params = node.params;
var templateModuleName = options.moduleName || 'unknown';
templateModuleName = templateModuleName.replace(/\.hbs$/, '');
params.push(builders.string(templateModuleName));
}
module.exports = EnsureTNamespace;
| Add support for (t) subexpressions | Add support for (t) subexpressions
| JavaScript | mit | zackthehuman/ember-template-i18n,zackthehuman/ember-template-i18n | ---
+++
@@ -15,7 +15,12 @@
var options = this.options;
traverse(ast, {
- MustacheStatement(node) {
+ MustacheStatement: function(node) {
+ if (isT(node)) {
+ ensureNamespace(node, builders, options);
+ }
+ },
+ SubExpression: function(node) {
if (isT(node)) {
ensureNamespace(node, builders, options);
} |
eeae82455bba5e665c87705873e6f5336530b2ea | src/redux/stores/index.js | src/redux/stores/index.js | const configureStore = process.env.NODE_ENV === 'development' ?
'./configureStore.dev.js' :
'./configureStore.js';
// eslint-disable-next-line import/no-dynamic-require
module.exports = require(configureStore);
| /* eslint-disable global-require */
if (process.env.NODE_ENV === 'development') {
module.exports = require('./configureStore.dev.js');
} else {
module.exports = require('./configureStore.js');
}
| Make sure webpack can remove an unnecessary require from the redux store's entry point | Make sure webpack can remove an unnecessary require from the redux store's entry point
| JavaScript | mit | nodaguti/word-quiz-generator-webapp,nodaguti/word-quiz-generator-webapp | ---
+++
@@ -1,6 +1,8 @@
-const configureStore = process.env.NODE_ENV === 'development' ?
- './configureStore.dev.js' :
- './configureStore.js';
+/* eslint-disable global-require */
-// eslint-disable-next-line import/no-dynamic-require
-module.exports = require(configureStore);
+if (process.env.NODE_ENV === 'development') {
+ module.exports = require('./configureStore.dev.js');
+} else {
+ module.exports = require('./configureStore.js');
+}
+ |
393b9acf689ae77658d12cc3bb16e5bb9b3fc49d | dripBot-css.js | dripBot-css.js | $('#dripbot-title').css({
"display": "inline-block",
"margin-right": "20px"
});
$('#dripbot').css({
"text-align": "left"
});
$('#dripbot-toggle.stop').css({
"background-color": "#e9656d",
"color": "white",
"margin-top": "-10px"
});
$('#dripbot ul li p').css({
"margin-bottom":"5px",
"margin-right": "40px",
"display": "inline-block"
});
$('img#dripbot-logo').css({
"margin-bottom": "10px",
"margin-right": "5px"
});
$('div#dripbot-update').css({
"background-color": "#e9656d"
});
$('div#dripbot-update h1').css({
"font-weight": "800",
});
| $('#dripbot-title').css({
"display": "inline-block",
"margin-right": "20px"
});
$('#dripbot').css({
"text-align": "left"
});
$('#dripbot-toggle.stop').css({
"background-color": "#e9656d",
"color": "white",
"margin-top": "-10px"
});
$('#dripbot ul li p').css({
"margin-bottom":"5px",
"margin-right": "40px",
"display": "inline-block"
});
$('img#dripbot-logo').css({
"margin-bottom": "10px",
"margin-right": "5px"
});
$('div#dripbot-update').css({
"background-color": "#47a447",
"padding": "10px"
});
$('div#dripbot-update h1').css({
"font-weight": "800",
});
| Tweak css for update box. | Tweak css for update box.
| JavaScript | mit | catofclysm/testing,kyotie/bot,apottere/DripBot,kyotie/bot,apottere/DripBot,catofclysm/testing | ---
+++
@@ -25,7 +25,8 @@
});
$('div#dripbot-update').css({
- "background-color": "#e9656d"
+ "background-color": "#47a447",
+ "padding": "10px"
});
$('div#dripbot-update h1').css({ |
b35b7b23767f7721e8fbb265e8515ac43e7603af | webpack-example.config.js | webpack-example.config.js | const webpack = require('webpack');
const path = require('path');
const common = require('./webpack-common');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const entry = common.getEntries(false);
const config = {
resolve: {
alias: {
'@boundlessgeo/sdk': path.resolve(__dirname, 'src/'),
},
},
// Entry points to the project
entry: entry,
devtool: 'source-map',
node: {fs: "empty"},
output: {
path: __dirname, // Path of output file
// [name] refers to the entry point's name.
filename: 'build/hosted/examples/[name]/[name].bundle.js',
},
plugins: [
new ExtractTextPlugin('build/hosted/examples/sdk.css'),
new UglifyJSPlugin({sourceMap: true})
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
},
}, {
test: /\.s?css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', {
loader: 'sass-loader',
options: {
includePaths: ['node_modules'],
}
}],
}),
}
],
},
};
module.exports = config;
| const webpack = require('webpack');
const path = require('path');
const common = require('./webpack-common');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const entry = common.getEntries(false);
const config = {
resolve: {
alias: {
'@boundlessgeo/sdk': path.resolve(__dirname, 'src/'),
},
},
// Entry points to the project
entry: entry,
devtool: 'source-map',
node: {fs: "empty"},
output: {
path: __dirname, // Path of output file
// [name] refers to the entry point's name.
filename: 'build/hosted/examples/[name]/[name].bundle.js',
},
plugins: [
new ExtractTextPlugin('build/hosted/examples/sdk.css'),
new UglifyJSPlugin({
sourceMap: true,
uglifyOptions: {
compress: {
warnings: false,
comparisons: false, // don't optimize comparisons
},
},
}),
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
},
}, {
test: /\.s?css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', {
loader: 'sass-loader',
options: {
includePaths: ['node_modules'],
}
}],
}),
}
],
},
};
module.exports = config;
| Fix mapbox gl errors in production mode | Fix mapbox gl errors in production mode
| JavaScript | apache-2.0 | bartvde/sdk,boundlessgeo/sdk,jjmulenex/sdk,jjmulenex/sdk,boundlessgeo/sdk,bartvde/sdk | ---
+++
@@ -24,7 +24,15 @@
},
plugins: [
new ExtractTextPlugin('build/hosted/examples/sdk.css'),
- new UglifyJSPlugin({sourceMap: true})
+ new UglifyJSPlugin({
+ sourceMap: true,
+ uglifyOptions: {
+ compress: {
+ warnings: false,
+ comparisons: false, // don't optimize comparisons
+ },
+ },
+ }),
],
module: {
rules: [ |
ec3c232eccf82d221015a67a96060d798b24ac29 | routes/editor.js | 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 | acburdine/Ghost-Admin,kevinansfield/Ghost-Admin,JohnONolan/Ghost-Admin,acburdine/Ghost-Admin,JohnONolan/Ghost-Admin,dbalders/Ghost-Admin,airycanon/Ghost-Admin,TryGhost/Ghost-Admin,airycanon/Ghost-Admin,kevinansfield/Ghost-Admin,TryGhost/Ghost-Admin,dbalders/Ghost-Admin | ---
+++
@@ -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');
+ });
}
});
|
2d4a2d6bd053f9f544960d32241a50e0ef3e206c | crawl.js | crawl.js | var ini = require('ini');
var fs = require('graceful-fs');
var Log = require('log');
var arguments = require(__dirname + '/lib/arguments.js');
global.log = new Log('debug', fs.createWriteStream(__dirname + '/crawler.log'));
global.parameters = ini.parse(
fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
).parameters;
global.filmError = {};
arguments.getAction(function(action, id) {
var crawler = require(__dirname + '/lib/actions/' + action + '.js');
process.on('uncaughtException', function (err) {
// console.log('UNCAUGHT EXCEPTION - keeping process alive:', err);
});
if (action === 'user_friends' || action === 'id') {
crawler.start(id);
} else {
crawler.start();
}
});
| var ini = require('ini');
var fs = require('graceful-fs');
var Log = require('log');
var arguments = require(__dirname + '/lib/arguments.js');
global.log = new Log(
'debug',
fs.createWriteStream(__dirname + '/crawler.log', {
flags: 'a',
encoding: null,
mode: 0666
})
);
global.parameters = ini.parse(
fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
).parameters;
global.filmError = {};
arguments.getAction(function (action, id) {
var crawler = require(__dirname + '/lib/actions/' + action + '.js');
process.on('uncaughtException', function (err) {
// console.log('UNCAUGHT EXCEPTION - keeping process alive:', err);
});
if (action === 'user_friends' || action === 'id') {
crawler.start(id);
} else {
crawler.start();
}
});
| Append logs (before it was truncating the log file) | Append logs (before it was truncating the log file)
| JavaScript | mit | franjid/filmaffinity-crawler | ---
+++
@@ -4,24 +4,31 @@
var arguments = require(__dirname + '/lib/arguments.js');
-global.log = new Log('debug', fs.createWriteStream(__dirname + '/crawler.log'));
+global.log = new Log(
+ 'debug',
+ fs.createWriteStream(__dirname + '/crawler.log', {
+ flags: 'a',
+ encoding: null,
+ mode: 0666
+ })
+);
global.parameters = ini.parse(
- fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
+ fs.readFileSync(__dirname + '/config/parameters.ini', 'utf-8')
).parameters;
global.filmError = {};
-arguments.getAction(function(action, id) {
- var crawler = require(__dirname + '/lib/actions/' + action + '.js');
+arguments.getAction(function (action, id) {
+ var crawler = require(__dirname + '/lib/actions/' + action + '.js');
- process.on('uncaughtException', function (err) {
- // console.log('UNCAUGHT EXCEPTION - keeping process alive:', err);
- });
+ process.on('uncaughtException', function (err) {
+ // console.log('UNCAUGHT EXCEPTION - keeping process alive:', err);
+ });
- if (action === 'user_friends' || action === 'id') {
- crawler.start(id);
- } else {
- crawler.start();
- }
+ if (action === 'user_friends' || action === 'id') {
+ crawler.start(id);
+ } else {
+ crawler.start();
+ }
}); |
380cf68be7d9299b1ce12d3e49615a237510e800 | app/src/containers/FeedbackContainer/reducer.js | app/src/containers/FeedbackContainer/reducer.js | import * as types from './constants';
export const initialState = {
openFeedbackModal: false,
};
const feedbackReducer =
(state = initialState, action) => {
switch (action.type) {
case types.OPEN_FEEDBACK_MODAL:
return {
...state,
openFeedbackModal: true,
};
default:
return state;
}
};
export default feedbackReducer;
| import * as types from './constants';
export const initialState = {
isAddingFeedback: false,
};
const feedbackReducer =
(state = initialState, action) => {
switch (action.type) {
case types.OPEN_FEEDBACK_MODAL:
return {
...state,
isAddingFeedback: !state.isAddingFeedback,
};
default:
return state;
}
};
export default feedbackReducer;
| Update the name of state being updated | Update: Update the name of state being updated
| JavaScript | mit | udacityalumni/udacity-alumni-fe,udacityalumni/alumni-client,udacityalumni/alumni-client,udacityalumni/udacity-alumni-fe | ---
+++
@@ -1,7 +1,7 @@
import * as types from './constants';
export const initialState = {
- openFeedbackModal: false,
+ isAddingFeedback: false,
};
const feedbackReducer =
@@ -10,7 +10,7 @@
case types.OPEN_FEEDBACK_MODAL:
return {
...state,
- openFeedbackModal: true,
+ isAddingFeedback: !state.isAddingFeedback,
};
default:
return state; |
3959092d6782d73d91b30cba3006555d187588b7 | lib/response-from-object.js | lib/response-from-object.js | const responseFromObject = (mockResponse, response) => {
// statusCode
if (mockResponse.statusCode) {
response.statusCode = mockResponse.statusCode
}
// statusMessage
if (mockResponse.statusMessage) {
response.statusMessage = mockResponse.statusMessage
}
// headers
if (mockResponse.headers) {
Object.keys(mockResponse.header).map((name) => (
[name, mockResponse.headers[name]]
)).forEach(([name, value]) => response.setHeader(name, value));
}
// trailers
if (mockResponse.trailers) {
// get all trailer keys and set the trailer header
response.setHeader('Trailer', Object.keys(mockResponse.trailers).join(', '));
}
// body
// TODO: consider automatically setting the Content-type header if it isn't
// already set
// if (mockResponse.body && typeof mockResponse.body.pipe === 'function') {
// mockResponse.body.pipe(response);
// } else {
// }
response.write(
((b) => {
if (
typeof b === 'string' ||
b instanceof Buffer
) {
return b;
}
return JSON.stringify(b, null, 2);
})(mockResponse.body)
);
// trailers - again
if (mockResponse.trailers) {
// add the actual trailers
response.addTrailers(mockResponse.trailers);
}
response.end();
};
module.exports = responseFromObject;
| const responseFromObject = (mockResponse, response) => {
// statusCode
if (mockResponse.statusCode) {
response.statusCode = mockResponse.statusCode
}
// statusMessage
if (mockResponse.statusMessage) {
response.statusMessage = mockResponse.statusMessage
}
// headers
if (mockResponse.headers) {
Object.keys(mockResponse.headers).map((name) => (
[name, mockResponse.headers[name]]
)).forEach(([name, value]) => response.setHeader(name, value));
}
// trailers
if (mockResponse.trailers) {
// get all trailer keys and set the trailer header
response.setHeader('Trailer', Object.keys(mockResponse.trailers).join(', '));
}
// body
// TODO: consider automatically setting the Content-type header if it isn't
// already set
// if (mockResponse.body && typeof mockResponse.body.pipe === 'function') {
// mockResponse.body.pipe(response);
// } else {
// }
response.write(
((b) => {
if (
typeof b === 'string' ||
b instanceof Buffer
) {
return b;
}
return JSON.stringify(b, null, 2);
})(mockResponse.body)
);
// trailers - again
if (mockResponse.trailers) {
// add the actual trailers
response.addTrailers(mockResponse.trailers);
}
response.end();
};
module.exports = responseFromObject;
| Fix a typo bug referencing headers | Fix a typo bug referencing headers
| JavaScript | mit | amadsen/satire | ---
+++
@@ -9,7 +9,7 @@
}
// headers
if (mockResponse.headers) {
- Object.keys(mockResponse.header).map((name) => (
+ Object.keys(mockResponse.headers).map((name) => (
[name, mockResponse.headers[name]]
)).forEach(([name, value]) => response.setHeader(name, value));
} |
cc44c7a42facb03c0894442d057658fc3496fc40 | app/components/language-picker/component.js | app/components/language-picker/component.js | import Ember from 'ember';
import countries from './countries';
export default Ember.Component.extend({
i18n: Ember.inject.service(),
countries: countries,
languages: Ember.computed('countries', function() {
var langs = [];
this.get('countries').forEach((country) => {
country.languages.forEach((lang) => {
langs.push({
countryCode: country.code,
name: lang.name,
code: lang.code
});
});
});
langs.sort(function(a, b) {
if (a.countryCode > b.countryCode) {
return 1;
}
if (a.countryCode < b.countryCode) {
return -1;
}
return 0;
});
return langs;
}),
onPick: null,
country: null,
actions: {
pickLanguage(language, code) {
this.get('onPick')(language, code);
this.set('i18n.locale', code);
}
}
});
| import Ember from 'ember';
import countries from './countries';
export default Ember.Component.extend({
i18n: Ember.inject.service(),
countries: countries,
languages: Ember.computed('countries', function() {
var langs = [];
this.get('countries').forEach((country) => {
country.languages.forEach((lang) => {
langs.push({
countryCode: country.code,
countryName: country.name,
name: lang.name,
code: lang.code
});
});
});
langs.sort(function(a, b) {
if (a.countryName > b.countryName) {
return 1;
}
if (a.countryName < b.countryName) {
return -1;
}
return 0;
});
return langs;
}),
onPick: null,
country: null,
actions: {
pickLanguage(language, code) {
this.get('onPick')(language, code);
this.set('i18n.locale', code);
}
}
});
| Sort languages by country name | Sort languages by country name
Instead of sorting languages by country
code, sort by country name.
| JavaScript | apache-2.0 | CenterForOpenScience/isp,CenterForOpenScience/isp,CenterForOpenScience/isp | ---
+++
@@ -12,16 +12,17 @@
country.languages.forEach((lang) => {
langs.push({
countryCode: country.code,
+ countryName: country.name,
name: lang.name,
code: lang.code
});
});
});
langs.sort(function(a, b) {
- if (a.countryCode > b.countryCode) {
+ if (a.countryName > b.countryName) {
return 1;
}
- if (a.countryCode < b.countryCode) {
+ if (a.countryName < b.countryName) {
return -1;
}
return 0; |
bfc1e0ae3f2b94da09038df235897d4bd5f2c53f | app/components/namespace-table/component.js | app/components/namespace-table/component.js | import Component from '@ember/component';
import layout from './template';
import { inject as service } from '@ember/service';
const headers = [
{
name: 'state',
sort: ['sortState', 'displayName'],
searchField: 'displayState',
translationKey: 'generic.state',
width: 120
},
{
name: 'name',
sort: ['displayName'],
searchField: ['displayName', 'name'],
translationKey: 'projectsPage.ns.label',
},
{
classNames: 'text-right pr-20',
name: 'created',
sort: ['createdTs'],
searchField: false,
translationKey: 'projectsPage.created.label',
width: 250,
},
];
export default Component.extend({
scope: service(),
layout,
headers,
tagName: '',
sortBy: 'name',
searchText: '',
subRows: true,
suffix: true,
paging: true,
extraSearchFields: [
'displayUserLabelStrings',
],
});
| import Component from '@ember/component';
import layout from './template';
import { inject as service } from '@ember/service';
const headers = [
{
name: 'state',
sort: ['sortState', 'displayName'],
searchField: 'displayState',
translationKey: 'generic.state',
width: 120
},
{
name: 'name',
sort: ['displayName'],
searchField: ['displayName', 'name'],
translationKey: 'projectsPage.ns.label',
},
{
classNames: 'text-right pr-20',
name: 'created',
sort: ['createdTs'],
searchField: false,
translationKey: 'projectsPage.created.label',
width: 250,
},
];
export default Component.extend({
scope: service(),
layout,
headers,
tagName: '',
sortBy: 'name',
searchText: '',
subRows: true,
suffix: true,
paging: true,
extraSearchFields: [
'displayUserLabelStrings',
'project.displayName',
],
});
| Fix namespace page can not search project name | Fix namespace page can not search project name
https://github.com/rancher/rancher/issues/21380
| JavaScript | apache-2.0 | lvuch/ui,rancherio/ui,westlywright/ui,rancherio/ui,vincent99/ui,vincent99/ui,westlywright/ui,lvuch/ui,rancher/ui,rancher/ui,lvuch/ui,vincent99/ui,rancherio/ui,westlywright/ui,rancher/ui | ---
+++
@@ -39,5 +39,6 @@
paging: true,
extraSearchFields: [
'displayUserLabelStrings',
+ 'project.displayName',
],
}); |
aad3c64a5290e35ed5e2af01e6eb3d40b595daac | rules/local-modules.js | rules/local-modules.js | 'use strict';
var utils = require('./utils/utils');
//------------------------------------------------------------------------------
// General rule - Create local version of Ember.* and DS.*
//------------------------------------------------------------------------------
module.exports = function(context) {
var message = 'Create local version of ';
var report = function(node, name) {
var msg = message + name + '.' + node.property.name;
context.report(node, msg);
};
var allowedEmberProperties = ['$', 'Object', 'Router'];
var allowedDSProperties = [];
var isExpressionForbidden = function (objectName, node, allowedProperties) {
return node.object.name === objectName &&
node.property.name.length &&
allowedProperties.indexOf(node.property.name) === -1;
};
return {
CallExpression: function(node) {
var callee = node.callee;
var obj = utils.isMemberExpression(callee.object) ? callee.object : callee;
if (
utils.isIdentifier(obj.object) &&
utils.isIdentifier(obj.property)
) {
if (isExpressionForbidden('Ember', obj, allowedEmberProperties)) {
report(obj, 'Ember');
}
if (isExpressionForbidden('DS', obj, allowedDSProperties)) {
report(obj, 'DS');
}
}
}
};
};
| 'use strict';
var utils = require('./utils/utils');
//------------------------------------------------------------------------------
// General rule - Create local version of Ember.* and DS.*
//------------------------------------------------------------------------------
module.exports = function(context) {
var message = 'Create local version of ';
var report = function(node, name) {
var msg = message + name + '.' + node.property.name;
context.report(node, msg);
};
var allowedEmberProperties = ['$', 'Object', 'Router', 'String'];
var allowedDSProperties = [];
var isExpressionForbidden = function (objectName, node, allowedProperties) {
return node.object.name === objectName &&
node.property.name.length &&
allowedProperties.indexOf(node.property.name) === -1;
};
return {
CallExpression: function(node) {
var callee = node.callee;
var obj = utils.isMemberExpression(callee.object) ? callee.object : callee;
if (
utils.isIdentifier(obj.object) &&
utils.isIdentifier(obj.property)
) {
if (isExpressionForbidden('Ember', obj, allowedEmberProperties)) {
report(obj, 'Ember');
}
if (isExpressionForbidden('DS', obj, allowedDSProperties)) {
report(obj, 'DS');
}
}
}
};
};
| Add "String" as allowed property | Add "String" as allowed property
| JavaScript | mit | netguru/eslint-plugin-ember | ---
+++
@@ -15,7 +15,7 @@
context.report(node, msg);
};
- var allowedEmberProperties = ['$', 'Object', 'Router'];
+ var allowedEmberProperties = ['$', 'Object', 'Router', 'String'];
var allowedDSProperties = [];
var isExpressionForbidden = function (objectName, node, allowedProperties) { |
a22efd728018feb0ef93bab1643fe3f0b59751f0 | index.js | index.js | var command = process.argv[2]
var target = process.argv[3]
var concerns = require('cfg/concerns.json')
var types = require('cfg/types.json')
var tasks = {
new: {
runner: require('tasks/new'),
help: "new"
},
install: {
runner: require('tasks/install'),
help: "install"
},
search: {
runner: require('tasks/search'),
help: "search"
},
help: {
runner: require('tasks/help'),
help: "help"
}
}
if (tasks[command])
tasks[command].runner(target)
else
console.log("No task was found for command [" + command + "] and target [" + target + "]!")
| var command = process.argv[2]
var target = process.argv[3]
var concerns = require('./cfg/concerns.json')
var types = require('./cfg/types.json')
var tasks = {
new: {
runner: require('tasks/new'),
help: "new"
},
install: {
runner: require('tasks/install'),
help: "install"
},
search: {
runner: require('tasks/search'),
help: "search"
},
help: {
runner: require('tasks/help'),
help: "help"
}
}
if (tasks[command])
tasks[command].runner(target)
else
console.log("No task was found for command [" + command + "] and target [" + target + "]!")
| Fix require calls with leading . | Fix require calls with leading .
Signed-off-by: Nathan Stier <013f9af474b4ba6f842b41368c6f02c1ee9e9e08@gmail.com>
| JavaScript | mit | YWebCA/ywca-cli | ---
+++
@@ -1,8 +1,8 @@
var command = process.argv[2]
var target = process.argv[3]
-var concerns = require('cfg/concerns.json')
-var types = require('cfg/types.json')
+var concerns = require('./cfg/concerns.json')
+var types = require('./cfg/types.json')
var tasks = {
new: { |
abc25d8f6670a340e946fd10f86ed8fdaab7caba | index.js | index.js | 'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var objectAssign = require('object-assign');
var to5 = require('6to5');
module.exports = function (opts) {
opts = opts || {};
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isStream()) {
cb(new gutil.PluginError('gulp-6to5', 'Streaming not supported'));
return;
}
try {
var fileOpts = objectAssign({}, opts, {
filename: file.path,
sourceMap: !!file.sourceMap
});
var res = to5.transform(file.contents.toString(), fileOpts);
if (file.sourceMap && res.map) {
applySourceMap(file, res.map);
}
file.contents = new Buffer(res.code);
this.push(file);
} catch (err) {
this.emit('error', new gutil.PluginError('gulp-6to5', err, {fileName: file.path}));
}
cb();
});
};
| 'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var objectAssign = require('object-assign');
var to5 = require('6to5');
module.exports = function (opts) {
opts = opts || {};
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isStream()) {
cb(new gutil.PluginError('gulp-6to5', 'Streaming not supported'));
return;
}
try {
var fileOpts = objectAssign({}, opts, {
filename: file.path,
filenameRelative: file.relative,
sourceMap: !!file.sourceMap
});
var res = to5.transform(file.contents.toString(), fileOpts);
if (file.sourceMap && res.map) {
applySourceMap(file, res.map);
}
file.contents = new Buffer(res.code);
this.push(file);
} catch (err) {
this.emit('error', new gutil.PluginError('gulp-6to5', err, {fileName: file.path}));
}
cb();
});
};
| Add filenameRelative to opts to support AMD module names | Add filenameRelative to opts to support AMD module names
| JavaScript | mit | benderTheCrime/gulp-babel,exponentjs/gulp-babel,StartPolymer/gulp-html-babel,metaraine/gulp-babel,chrisvariety/gulp-babel,woodne/gulp-babel,babel/gulp-babel,clarkmalmgren/gulp-babel | ---
+++
@@ -22,6 +22,7 @@
try {
var fileOpts = objectAssign({}, opts, {
filename: file.path,
+ filenameRelative: file.relative,
sourceMap: !!file.sourceMap
});
|
7d192d3b28db92f2ed3934edc3ea6f5bd4f53e85 | index.js | index.js | 'use strict';
const defaults = {
currency: '€',
currencyPosition: 'after',
decimals: 2,
decimalSeparator: ',',
orderSeparator: '.',
zeroDecimals: '',
space: ' '
};
module.exports = (value, options) => {
const config = Object.assign({}, defaults, options);
if (isNaN(value) || value === null) {
return '';
}
value = Number(value);
value = value.toFixed(~~config.decimals);
const parts = value.split('.');
const fnums = parts[0];
let dec = parts[1] ? config.decimalSeparator + parts[1] : '';
let curr = '';
if (config.currency) {
curr = config.currencyPosition === 'before' ?
config.currency + config.space :
config.space + config.currency;
}
// Do something with zero-valued decimals
if (
(config.zeroDecimals !== null || config.zeroDecimals !== undefined) &&
parseInt(parts[1], 10) === 0
) {
if (config.zeroDecimals === '') {
// Strip away zero-valued decimals
dec = '';
} else {
// Add custom string
dec = config.decimalSeparator + config.zeroDecimals;
}
}
const formattedValue =
fnums.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + config.orderSeparator) + dec;
return config.currencyPosition === 'before' ?
// As in '$ 123'
curr + formattedValue :
// As in '123 €'
formattedValue + curr;
};
| 'use strict';
const defaults = {
currency: '€',
currencyPosition: 'after',
decimals: 2,
decimalSeparator: ',',
orderSeparator: '.',
zeroDecimals: '',
space: ' '
};
module.exports = (value, options) => {
const config = Object.assign({}, defaults, options);
if (isNaN(value) || value === null) {
return '';
}
value = Number(value);
value = value.toFixed(~~config.decimals);
const parts = value.split('.');
const fnums = parts[0];
let dec = parts[1] ? config.decimalSeparator + parts[1] : '';
let curr = '';
if (config.currency) {
curr = config.currencyPosition === 'before' ?
config.currency + config.space :
config.space + config.currency;
}
// Do something with zero-valued decimals
if (typeof config.zeroDecimals === 'string' && parseInt(parts[1], 10) === 0) {
if (config.zeroDecimals === '') {
// Strip away zero-valued decimals
dec = '';
} else {
// Add custom string
dec = config.decimalSeparator + config.zeroDecimals;
}
}
const formattedValue =
fnums.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + config.orderSeparator) + dec;
return config.currencyPosition === 'before' ?
// As in '$ 123'
curr + formattedValue :
// As in '123 €'
formattedValue + curr;
};
| Fix a bug with non-string zero decimals. | Fix a bug with non-string zero decimals.
| JavaScript | mit | Dreamseer/geld,Dreamseer/geld,Dreamseer/geld | ---
+++
@@ -31,10 +31,7 @@
}
// Do something with zero-valued decimals
- if (
- (config.zeroDecimals !== null || config.zeroDecimals !== undefined) &&
- parseInt(parts[1], 10) === 0
- ) {
+ if (typeof config.zeroDecimals === 'string' && parseInt(parts[1], 10) === 0) {
if (config.zeroDecimals === '') {
// Strip away zero-valued decimals
dec = ''; |
1fb7db4e4b6a5b74fe64a4bc6199add13838d419 | index.js | index.js | var fs = require('fs');
var chalk = require('chalk');
var partiesAbbreviation = require('./util/parties-abbreviations.js');
module.exports = function splitResults(json, directory) {
var electionDate = json.electionDate;
// save each json.races item as a separate file
json.races.forEach(function(race, index, array) {
// create file name
var state = race.reportingUnits[0].statePostal;
var party = race.party;
var raceType = race.raceType;
var filename = directory + '/' + [state, party, raceType].join('-') + '.json';
// add election date to race
race.electionDate = electionDate;
// add party name to race
race.partyName = partiesAbbreviation[race.party];
fs.writeFileSync(filename, JSON.stringify(race, null, 2));
console.log(chalk.green('Writing ' + filename));
});
}
| var fs = require('fs');
var chalk = require('chalk');
module.exports = function splitResults(json, directory) {
var electionDate = json.electionDate;
// save each json.races item as a separate file
json.races.forEach(function(race, index, array) {
// create file name
var state = race.reportingUnits[0].statePostal;
var party = race.party;
var raceType = race.raceType;
var filename = directory + '/' + [state, party, raceType].join('-') + '.json';
// add election date to race
race.electionDate = electionDate;
fs.writeFileSync(filename, JSON.stringify(race, null, 2));
console.log(chalk.green('Writing ' + filename));
});
}
| Revert "Add party name to race" | Revert "Add party name to race"
This reverts commit 5102a124f45b3f5118f3056200c76ad2fa57e01d.
| JavaScript | mit | gabrielflorit/ap2json,gabrielflorit/APtoJSON | ---
+++
@@ -1,6 +1,5 @@
var fs = require('fs');
var chalk = require('chalk');
-var partiesAbbreviation = require('./util/parties-abbreviations.js');
module.exports = function splitResults(json, directory) {
@@ -18,9 +17,6 @@
// add election date to race
race.electionDate = electionDate;
- // add party name to race
- race.partyName = partiesAbbreviation[race.party];
-
fs.writeFileSync(filename, JSON.stringify(race, null, 2));
console.log(chalk.green('Writing ' + filename));
|
98ae624de5a246dd086ccfe629101a5234df43d4 | index.js | index.js | 'use strict';
const xRegExp = require('xregexp');
module.exports = (text, separator) => {
if (typeof text !== 'string') {
throw new TypeError('Expected a string');
}
separator = typeof separator === 'undefined' ? '_' : separator;
const regex1 = xRegExp('([\\p{Ll}\\d])(\\p{Lu})', 'g');
const regex2 = xRegExp('(\\p{Lu}+)(\\p{Lu}[\\p{Ll}\\d]+)', 'g');
return text
.replace(regex1, `$1${separator}$2`)
.replace(regex2, `$1${separator}$2`)
.toLowerCase();
};
| 'use strict';
const xRegExp = require('xregexp');
module.exports = (text, separator) => {
if (typeof text !== 'string') {
throw new TypeError('Expected a string');
}
separator = typeof separator === 'undefined' ? '_' : separator;
const regex1 = xRegExp('([\\p{Ll}\\d])(\\p{Lu})', 'g');
const regex2 = xRegExp('(\\p{Lu}+)(\\p{Lu}[\\p{Ll}\\d]+)', 'g');
return text
// TODO: Use this instead of `xregexp` when targeting Node.js 10:
// .replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, `$1${separator}$2`)
// .replace(/(\p{Lowercase_Letter}+)(\p{Uppercase_Letter}[\p{Lowercase_Letter}\d]+)/gu, `$1${separator}$2`)
.replace(regex1, `$1${separator}$2`)
.replace(regex2, `$1${separator}$2`)
.toLowerCase();
};
| Add comment about future regex | Add comment about future regex
| JavaScript | mit | sindresorhus/decamelize,sindresorhus/decamelize | ---
+++
@@ -12,6 +12,9 @@
const regex2 = xRegExp('(\\p{Lu}+)(\\p{Lu}[\\p{Ll}\\d]+)', 'g');
return text
+ // TODO: Use this instead of `xregexp` when targeting Node.js 10:
+ // .replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, `$1${separator}$2`)
+ // .replace(/(\p{Lowercase_Letter}+)(\p{Uppercase_Letter}[\p{Lowercase_Letter}\d]+)/gu, `$1${separator}$2`)
.replace(regex1, `$1${separator}$2`)
.replace(regex2, `$1${separator}$2`)
.toLowerCase(); |
54c7145a717d4b94a0dd1645534df6ee15bb3853 | index.js | index.js | module.exports = {
devices: require("./src/lib/devices"),
drivers: require("./src/lib/drivers"),
events: require("./src/lib/events"),
maps: require("./src/lib/maps")
}; | module.exports = {
devices: require("./src/lib/devices"),
drivers: require("./src/lib/drivers"),
events: require("./src/lib/events")
}; | Remove problematic maps from export | Remove problematic maps from export
| JavaScript | mit | deHugo/hid-robot | ---
+++
@@ -1,6 +1,5 @@
module.exports = {
devices: require("./src/lib/devices"),
drivers: require("./src/lib/drivers"),
- events: require("./src/lib/events"),
- maps: require("./src/lib/maps")
+ events: require("./src/lib/events")
}; |
4c288518a673a0f5e92b00a6965d47af5ca73d73 | index.js | index.js | var Disclosure = function(el) {
var self = this;
self.el = el;
self.isActive = false;
self.details = el.querySelectorAll('[data-details]');
el.addEventListener('click', function(e) { self.toggle(e) });
self.hide();
};
Disclosure.prototype.hide = function() {
for (var i = 0; i < this.details.length; i++) {
this.details[i].style.display = 'none';
}
};
Disclosure.prototype.show = function() {
for (var i = 0; i < el.details.length; i++) {
this.details[i].style.display = 'block';
}
};
Disclosure.prototype.toggle = function(e) {
e.stopPropagation();
this.isActive = !this.isActive;
if (this.isActive) { this.show() } else { this.hide() }
};
module.exports = function(el) {
return new Disclosure(el);
};
| var Disclosure = function(el) {
var self = this;
self.el = el;
self.isActive = false;
self.details = el.querySelectorAll('[data-details]');
el.addEventListener('click', function(e) { self.toggle(e) });
self.hide();
};
Disclosure.prototype.hide = function() {
for (var i = 0; i < this.details.length; i++) {
this.details[i].style.display = 'none';
}
};
Disclosure.prototype.show = function() {
for (var i = 0; i < el.details.length; i++) {
this.details[i].style.display = 'block';
}
};
Disclosure.prototype.toggle = function(e) {
e.stopPropagation();
this.isActive = !this.isActive;
if (this.isActive) { this.show() } else { this.hide() }
};
module.exports = {
create: function(el) {
return new Disclosure(el);
},
all: function() {
var els = document.querySelectorAll("[data-disclose]");
for (var i = 0; i < els.length; i++) {
new Disclosure(els[i]);
}
}
};
| Expand the api to have an all() | Expand the api to have an all()
| JavaScript | mit | wunderlist/disclose | ---
+++
@@ -25,6 +25,14 @@
if (this.isActive) { this.show() } else { this.hide() }
};
-module.exports = function(el) {
- return new Disclosure(el);
+module.exports = {
+ create: function(el) {
+ return new Disclosure(el);
+ },
+ all: function() {
+ var els = document.querySelectorAll("[data-disclose]");
+ for (var i = 0; i < els.length; i++) {
+ new Disclosure(els[i]);
+ }
+ }
}; |
f54449a5bd5b47422cecedd37eeeba2146636d93 | index.js | index.js | 'use strict';
// Load the http module to create an http server.
var http = require('http');
var listenPort = process.env.VCAP_APP_PORT || 8000;
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
console.log('Another happy world served!');
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(listenPort);
// Put a friendly message on the terminal
console.log('Server running on port ' + listenPort);
| 'use strict';
// Load the http module to create an http server.
var http = require('http');
var listenPort = process.env.VCAP_APP_PORT || 8000;
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
response.write(process.env.VCAP_SERVICES);
console.log('Another happy world served!');
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(listenPort);
// Put a friendly message on the terminal
console.log('Server running on port ' + listenPort);
| Add a line to inspect VCAP_SERVICES | Add a line to inspect VCAP_SERVICES
| JavaScript | mit | clhynfield/hello-foundry | ---
+++
@@ -9,6 +9,7 @@
var server = http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
+ response.write(process.env.VCAP_SERVICES);
console.log('Another happy world served!');
});
|
610403ccff3f35289271152636d3cd755933ddbf | index.js | index.js | 'use strict';
var getArrowFunctions = function getArrowFunctions() {
return [
Function('return (a, b) => a * b;')(),
Function('return () => 42;')(),
Function('return () => function () {};')(),
Function('return () => x => x * x;')(),
Function('return x => x * x;')()
];
};
var arrowFuncs = [];
try { arrowFuncs = getArrowFunctions(); } catch (e) {/**/}
module.exports = function makeArrowFunction() {
return arrowFuncs[0];
};
module.exports.list = function makeArrowFunctions() {
return arrowFuncs.slice();
};
| 'use strict';
var getArrowFunctions = function getArrowFunctions() {
return [
Function('return (a, b) => a * b;')(),
Function('return () => 42;')(),
Function('return () => function () {};')(),
Function('return () => x => x * x;')(),
Function('return x => x * x;')(),
Function('return x => { return x * x; }')(),
Function('return (x, y) => { return x + x; }')()
];
};
var arrowFuncs = [];
try { arrowFuncs = getArrowFunctions(); } catch (e) {/**/}
module.exports = function makeArrowFunction() {
return arrowFuncs[0];
};
module.exports.list = function makeArrowFunctions() {
return arrowFuncs.slice();
};
| Add arrow functions with explicit block bodies. | Add arrow functions with explicit block bodies. | JavaScript | mit | tomhughes/make-arrow-function,ljharb/make-arrow-function | ---
+++
@@ -6,7 +6,9 @@
Function('return () => 42;')(),
Function('return () => function () {};')(),
Function('return () => x => x * x;')(),
- Function('return x => x * x;')()
+ Function('return x => x * x;')(),
+ Function('return x => { return x * x; }')(),
+ Function('return (x, y) => { return x + x; }')()
];
};
var arrowFuncs = []; |
2d8b974dc886445162f83e93d187d9b6fd121385 | index.js | index.js | module.exports = semanticEditionParse
var digit = '[1-9][0-9]*'
var EUCD = new RegExp(
'^' +
'(' + digit + ')e' +
'(?:' +
'(' + digit + ')u' +
'(?:' +
'(' + digit + ')c' + ')?' + ')?' +
'(?:' +
'(' + digit + ')d' + ')?' +
'$')
var components = [ 'edition', 'update', 'correction', 'draft' ]
function semanticEditionParse(argument) {
var parsed = EUCD.exec(argument)
var returned = { }
components.forEach(function(component, index) {
var group = ( index + 1 )
var value = parsed[group]
if (value !== undefined) {
returned[component] = parseInt(value) } })
return returned }
| module.exports = semanticEditionParse
var captureDigit = '([1-9][0-9]*)'
var EUCD = new RegExp(
'^' +
captureDigit + 'e' +
'(?:' +
captureDigit + 'u' +
'(?:' +
captureDigit + 'c' + ')?' + ')?' +
'(?:' +
captureDigit + 'd' + ')?' +
'$')
var components = [ 'edition', 'update', 'correction', 'draft' ]
function semanticEditionParse(argument) {
var parsed = EUCD.exec(argument)
var returned = { }
components.forEach(function(component, index) {
var group = ( index + 1 )
var value = parsed[group]
if (value !== undefined) {
returned[component] = parseInt(value) } })
return returned }
| Refactor regular expression digit pattern | Refactor regular expression digit pattern
| JavaScript | mit | kemitchell/reviewers-edition-parse.js | ---
+++
@@ -1,16 +1,16 @@
module.exports = semanticEditionParse
-var digit = '[1-9][0-9]*'
+var captureDigit = '([1-9][0-9]*)'
var EUCD = new RegExp(
'^' +
- '(' + digit + ')e' +
+ captureDigit + 'e' +
'(?:' +
- '(' + digit + ')u' +
+ captureDigit + 'u' +
'(?:' +
- '(' + digit + ')c' + ')?' + ')?' +
+ captureDigit + 'c' + ')?' + ')?' +
'(?:' +
- '(' + digit + ')d' + ')?' +
+ captureDigit + 'd' + ')?' +
'$')
var components = [ 'edition', 'update', 'correction', 'draft' ] |
d8b9c5cc2b17811fc663dde384f4b1a1d5ef571a | index.js | index.js | 'use strict';
var eco = require('eco');
exports.name = 'eco';
exports.outputFormat = 'html';
exports.render = function (str, options) {
return eco.render(str, options);
};
| 'use strict';
var eco = require('eco');
exports.name = 'eco';
exports.outputFormat = 'xml';
exports.render = function (str, options) {
return eco.render(str, options);
};
| Use XML as output format | Use XML as output format
[ci skip] | JavaScript | mit | jstransformers/jstransformer-eco,jstransformers/jstransformer-eco | ---
+++
@@ -3,7 +3,7 @@
var eco = require('eco');
exports.name = 'eco';
-exports.outputFormat = 'html';
+exports.outputFormat = 'xml';
exports.render = function (str, options) {
return eco.render(str, options);
}; |
c99347702cec08822804ac695f5981bfdb9bbb09 | index.js | index.js | var through = require('through-gulp')
var gutil = require('gulp-util')
var rext = require('replace-ext')
var preprocessor = require('sourdough-preprocessor')
var PluginError = gutil.PluginError
var PLUGIN_NAME = 'gulp-sourdough'
function sourdough(options) {
options = options || {}
return through(function (file, enc, cb) {
if (file.isStream()) {
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported'))
}
if (file.isBuffer()) {
try {
file.path = rext(file.path, '.css')
file.contents = new Buffer(preprocessor(String(file.contents), options))
} catch (e) {
return cb(new PluginError(PLUGIN_NAME, e))
}
}
this.push(file)
cb()
}, function (cb) {
cb()
});
}
module.exports = sourdough
| var through = require('through-gulp')
var gutil = require('gulp-util')
var rext = require('replace-ext')
var preprocessor = require('sourdough-preprocessor')
var PluginError = gutil.PluginError
var PLUGIN_NAME = 'gulp-sourdough'
function sourdough(options) {
options = options || {}
return through(function (file, enc, cb) {
if (options.from === undefined) {
options.from = file.path
}
if (file.isStream()) {
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported'))
}
if (file.isBuffer()) {
try {
file.path = rext(file.path, '.css')
file.contents = new Buffer(preprocessor(String(file.contents), options))
} catch (e) {
return cb(new PluginError(PLUGIN_NAME, e))
}
}
this.push(file)
cb()
}, function (cb) {
cb()
});
}
module.exports = sourdough
| Add from prop to fix imports | Add from prop to fix imports
| JavaScript | mit | sourdough-css/gulp-sourdough | ---
+++
@@ -9,6 +9,11 @@
function sourdough(options) {
options = options || {}
return through(function (file, enc, cb) {
+
+ if (options.from === undefined) {
+ options.from = file.path
+ }
+
if (file.isStream()) {
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported'))
} |
3af5dc02cbd32fbd6bc7a23d32c37b6d10fd4a50 | index.js | index.js | #!/usr/bin/env node
module.exports = (function() {
var turboLogo = require('turbo-logo'),
colors = require('colors/safe');
return {
print: finalPrint
};
/////////
function getText() {
return 'Burger JS';
}
function getBurgerAscii() {
return ' _..----.._ \r\n .\' o \'. \r\n \/ o o \\\r\n |o o o|\r\n \/\'-.._o __.-\'\\\r\n \\ ````` \/\r\n |``--........--\'`|\r\n \\ \/\r\n `\'----------\'`';
}
function finalPrint(options) {
var burger = getBurgerAscii(),
text = getText(),
color = options && options.color || 'rainbow';
console.log(colors[color](burger));
turboLogo(text, color);
}
})();
| #!/usr/bin/env node
module.exports = (function() {
'use strict';
var turboLogo = require('turbo-logo'),
colors = require('colors/safe');
return {
print: finalPrint
};
/////////
function getText() {
return 'Burger JS';
}
function getBurgerAscii() {
return ' _..----.._ \r\n .\' o \'. \r\n \/ o o \\\r\n |o o o|\r\n \/\'-.._o __.-\'\\\r\n \\ ````` \/\r\n |``--........--\'`|\r\n \\ \/\r\n `\'----------\'`';
}
function finalPrint(options) {
var burger = getBurgerAscii(),
text = getText(),
color = options && options.color || 'rainbow';
console.log(colors[color](burger));
turboLogo(text, color);
}
})();
| Add 'use-strict' just to trigger the build | Add 'use-strict' just to trigger the build
| JavaScript | mit | sfabrizio/burgerjs-logo | ---
+++
@@ -1,6 +1,8 @@
#!/usr/bin/env node
module.exports = (function() {
+ 'use strict';
+
var turboLogo = require('turbo-logo'),
colors = require('colors/safe');
|
e09500cf8e9a98c47110e08578935ba31a45dccb | index.js | index.js | 'use strict';
module.exports = makeError;
function makeError(code, message, options) {
var line = options.line;
var column = options.column;
var filename = options.filename;
var src = options.src;
var fullMessage;
var location = line + (column ? ':' + column : '');
if (src) {
var lines = src.split('\n');
var start = Math.max(line - 3, 0);
var end = Math.min(lines.length, line + 3);
// Error context
var context = lines.slice(start, end).map(function(text, i){
var curr = i + start + 1;
return (curr == line ? ' > ' : ' ')
+ curr
+ '| '
+ text;
}).join('\n');
fullMessage = (filename || 'Jade') + ':' + location + '\n' + context + '\n\n' + message;
} else {
fullMessage = (filename || 'Jade') + ':' + location + '\n\n' + message;
}
var err = new Error(fullMessage);
err.code = 'JADE:' + code;
err.msg = message;
err.line = line;
err.column = column;
err.filename = filename;
err.src = src;
return err;
}
| 'use strict';
module.exports = makeError;
function makeError(code, message, options) {
var line = options.line;
var column = options.column;
var filename = options.filename;
var src = options.src;
var fullMessage;
var location = line + (column ? ':' + column : '');
if (src) {
var lines = src.split('\n');
var start = Math.max(line - 3, 0);
var end = Math.min(lines.length, line + 3);
// Error context
var context = lines.slice(start, end).map(function(text, i){
var curr = i + start + 1;
return (curr == line ? ' > ' : ' ')
+ curr
+ '| '
+ text;
}).join('\n');
fullMessage = (filename || 'Jade') + ':' + location + '\n' + context + '\n\n' + message;
} else {
fullMessage = (filename || 'Jade') + ':' + location + '\n\n' + message;
}
var err = new Error(fullMessage);
err.code = 'JADE:' + code;
err.msg = message;
err.line = line;
err.column = column;
err.filename = filename;
err.src = src;
err.toJSON = function () {
return {
code: this.code,
msg: this.msg,
line: this.line,
column: this.column,
filename: this.filename
};
};
return err;
}
| Add a toJSON method to the error object | Add a toJSON method to the error object
| JavaScript | mit | pugjs/pug-error,pugjs/jade-error,jadejs/jade-error | ---
+++
@@ -31,5 +31,14 @@
err.column = column;
err.filename = filename;
err.src = src;
+ err.toJSON = function () {
+ return {
+ code: this.code,
+ msg: this.msg,
+ line: this.line,
+ column: this.column,
+ filename: this.filename
+ };
+ };
return err;
} |
07eb76fb3d19873e834ac2728d1480792df87878 | index.js | index.js | const fs = require('fs');
const Fuze = require('fuse.js');
const mustache = require('mustache');
const template = fs.readFileSync('./template.md', {encoding: 'utf-8'});
module.exports = robot => {
robot.on('issues.opened', async (event, context) => {
const github = await robot.auth(event.payload.installation.id);
// Get all issues that aren't the new issue
const allIssues = await github.issues.getForRepo(context.repo());
const otherIssues = allIssues.filter(issue => issue.number !== context.issue().number);
const theIssue = allIssues.find(issue => issue.number === context.issue().number);
const fuse = new Fuze(otherIssues, {
shouldSort: true,
threshold: 0.2,
keys: [{
name: 'title',
weight: 0.8
}, {
name: 'body',
weight: 0.2
}]
});
const results = fuse.search(theIssue.title);
if (results.length > 0) {
const commentBody = mustache.render(template, {
payload: event.payload,
issues: otherIssues.slice(0, 3)
});
await github.issues.createComment(context.issue({body: commentBody}));
}
});
};
| const fs = require('fs');
const Fuze = require('fuse.js');
const mustache = require('mustache');
const defaultTemplate = fs.readFileSync('./template.md', {encoding: 'utf-8'});
module.exports = robot => {
robot.on('issues.opened', async (event, context) => {
const github = await robot.auth(event.payload.installation.id);
// Get all issues that aren't the new issue
const allIssues = await github.issues.getForRepo(context.repo());
const otherIssues = allIssues.filter(issue => issue.number !== context.issue().number);
const theIssue = allIssues.find(issue => issue.number === context.issue().number);
const fuse = new Fuze(otherIssues, {
shouldSort: true,
threshold: 0.2,
keys: [{
name: 'title',
weight: 0.8
}, {
name: 'body',
weight: 0.2
}]
});
const results = fuse.search(theIssue.title);
if (results.length > 0) {
let template;
try {
// Try to get issue template from the repository
const params = context.repo({path: '.github/DUPLICATE_ISSUE_TEMPLATE.md'});
const data = await github.repos.getContent(params);
template = new Buffer(data.content, 'base64').toString();
} catch (err) {
// It doesn't have one, so let's use the default
template = defaultTemplate;
}
const commentBody = mustache.render(template, {
payload: event.payload,
issues: otherIssues.slice(0, 3)
});
await github.issues.createComment(context.issue({body: commentBody}));
}
});
};
| Use `.github/DUPLICATE_ISSUE_TEMPLATE.md` if it exists | Use `.github/DUPLICATE_ISSUE_TEMPLATE.md` if it exists
| JavaScript | isc | MarshallOfSound/probot-issue-duplicate-detection | ---
+++
@@ -2,7 +2,7 @@
const Fuze = require('fuse.js');
const mustache = require('mustache');
-const template = fs.readFileSync('./template.md', {encoding: 'utf-8'});
+const defaultTemplate = fs.readFileSync('./template.md', {encoding: 'utf-8'});
module.exports = robot => {
robot.on('issues.opened', async (event, context) => {
@@ -26,7 +26,20 @@
});
const results = fuse.search(theIssue.title);
+
if (results.length > 0) {
+ let template;
+
+ try {
+ // Try to get issue template from the repository
+ const params = context.repo({path: '.github/DUPLICATE_ISSUE_TEMPLATE.md'});
+ const data = await github.repos.getContent(params);
+ template = new Buffer(data.content, 'base64').toString();
+ } catch (err) {
+ // It doesn't have one, so let's use the default
+ template = defaultTemplate;
+ }
+
const commentBody = mustache.render(template, {
payload: event.payload,
issues: otherIssues.slice(0, 3) |
875b8d4eebdb588db43ee1ff70477a5e118d6475 | index.js | index.js | 'use strict'
var State = require('dover')
var Observ = require('observ')
var emailRegex = require('email-regex')({exact: true})
var isEmail = emailRegex.test.bind(emailRegex)
var h = require('virtual-dom/h')
var changeEvent = require('value-event/change')
module.exports = EmailInput
function EmailInput (data) {
data = data || {}
var state = State({
value: Observ(data.value || ''),
valid: Observ(isEmail(data.value) || false),
placeholder: Observ(data.placeholder || ''),
channels: {
change: change
}
})
state.value(function (email) {
state.valid.set(isEmail(email))
})
return state
}
function change (state, data) {
state.value.set(data.email)
}
EmailInput.render = function render (state) {
return h('input', {
type: 'email',
value: state.value,
name: 'email',
'ev-event': changeEvent(state.channels.change),
placeholder: state.placeholder
})
}
| 'use strict'
var State = require('dover')
var Observ = require('observ')
var emailRegex = require('email-regex')({exact: true})
var isEmail = emailRegex.test.bind(emailRegex)
var h = require('virtual-dom/h')
var changeEvent = require('value-event/change')
module.exports = EmailInput
function EmailInput (data) {
data = data || {}
var state = State({
value: Observ(data.value || ''),
valid: Observ(isEmail(data.value) || false),
channels: {
change: change
}
})
state.value(function (email) {
state.valid.set(isEmail(email))
})
return state
}
function change (state, data) {
state.value.set(data.email)
}
EmailInput.render = function render (state) {
return h('input', {
type: 'email',
value: state.value,
name: 'email',
'ev-event': changeEvent(state.channels.change)
})
}
| Remove placeholder from state atom | Remove placeholder from state atom
| JavaScript | mit | bendrucker/email-input | ---
+++
@@ -15,7 +15,6 @@
var state = State({
value: Observ(data.value || ''),
valid: Observ(isEmail(data.value) || false),
- placeholder: Observ(data.placeholder || ''),
channels: {
change: change
}
@@ -37,7 +36,6 @@
type: 'email',
value: state.value,
name: 'email',
- 'ev-event': changeEvent(state.channels.change),
- placeholder: state.placeholder
+ 'ev-event': changeEvent(state.channels.change)
})
} |
dc00673b7c056392409139dba451305a828a230d | js/plugins.js | js/plugins.js | // Avoid `console` errors in browsers that lack a console.
(function() {
var noop = function noop() {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = window.console || {};
while (length--) {
// Only stub undefined methods.
console[methods[length]] = console[methods[length]] || noop;
}
}());
// Place any jQuery/helper plugins in here.
| // Avoid `console` errors in browsers that lack a console.
(function() {
var noop = function noop() {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
// Only stub undefined methods.
console[methods[length]] = console[methods[length]] || noop;
}
}());
// Place any jQuery/helper plugins in here.
| Fix `console` stubbing method in oldIE | Fix `console` stubbing method in oldIE
Expose `console` object to global scope in IE6 and IE7
Reference: gh-1229
| JavaScript | mit | briankelleher/html5-boilerplate,rodrigolins/html5-boilerplate,hisherear/html5-boilerplate,yk92/is117-Project1,klokie/howlermonkeygods.github.com,hfb7/HTML-FORM-TUTORIAL-,zachmorgan/webdevHollywoodFitness-team-02,wp34/PSD-to-HTML,nanakojoaba/project1,elbernante/html5-boilerplate,katy-400/Boiler,tonyalee1169/html5-boilerplate,wagnus/boiler,MP395/test2,JohnnyWalkerDesign/html5-boilerplate,ezequielo/html5-boilerplate,Kevaughn/Assignment1,Samalamabanana/project2,l0rd0fwar/html5-boilerplate,js829/form1,Zarkoned/Jregistration,js829/final,hfb7/test1,Victorgichohi/html5-boilerplate,akrawchyk/ColorGrid,ShrutikaM/is117,cesaral1510/project,ac486/html5-boilerplate,iixx/html5-boilerplate,KubaZ/DevEnvironment,Upmacis-Andrejs/untrips_Front-end,al285/is322_hw1,gd46/is117,binoy14/is322_hw1,MP395/final,jdiaz33/html5-boilerplate-practice,cjrojas72/IS117final_test,mds39/is117new,diehard226/is117finalproject,roopalk/project1,sinsunsan/d3,juanibrex/html5-boilerplate,Mako88/thatguy-boilerplate,elbernante/html5-boilerplate,amorwilliams/html5-boilerplate,ronakt307/html5boilerplate,gd46/Backbone_Practice,cmichaelcooper/css-presentation,rcastano1019/IS117-html5,andrescarceller/html5-boilerplate,ryandnieves/improve,hubert-zheng/html5-boilerplate,onetwopunch/websume,webcultist/html5-boilerplate,kaw393939/html5-bp2,webdough/Venturi,misscs/nyccfb-styleguide,js829/IS117project1,ortegaj716/IS217-UnitTesting,rcastano1019/IS117-Webpage,APKaur/project0,briankelleher/html5-boilerplate,qiruiyin/html5-boilerplate,AllisonM114/Final-Project,las36/Project1,MaitreyPatel/assigment1,paksu/html5-boilerplate,Jary007/is-117,andreaslangsays/html5-boilerplate,cw089416/html5is117,Upmacis-Andrejs/2nd_demo_project_for_SEM.lv_Front-end,RatulGhosh/html5-boilerplate,geosu93/HelloWorld1,tarraschk/Argaus,cjrojas72/IS117final_test,matthewcanty/html5-boilerplate,derekjohnson/boilerplate,rutgersnjit2113/HTMLtags,gagiksargsyan/html5-boilerplate,diehard226/is117html5,joana83/Mytestrepository,RanesJan/istest,aed7/bootstrap,WillSmith21/Finalpro,briankelleher/html5-boilerplate,ArlonBatilaran/IS117,dts23/projectTwo,DanielMarquard/html5-boilerplate,hisherear/html5-boilerplate,jaroot32/html5-boilerplate,webdough/Venturi,kerolesanwar/is322,gd46/hw2-part3,sn357/is117html5-,mosafiullah/webpage,fady/html5-boilerplate,ar582/html5,pulkitsharma550/html5-boilerplate,robertocastro/clidocs,gavinblair/paca,ar548/project1,lirun3196/html5-boilerplate,kaw393939/117,kaw393939/html5-is117-001,roblarsen/html5-boilerplate,Mako88/thatguy-boilerplate,ac486/is117project2,fly19890211/html5-boilerplate,majaradichevich/majaradichevich.github.io,JalenMoorer/is117-Test1,AliKalkandelen/html5boilerplate,NJITGN44/TestRepo,LeCoMedia/IS217,arifgursel/html5-boilerplate,Soullivaneuh/html5-boilerplate,misscs/sasschops-theshop,jdiaz33/final_project,tarraschk/Argaus,NJITGN44/Project1,ppf3/jquery2,jshah4563/finaltest,binoy14/is117-h5bp,mosafiullah/Test1,Soullivaneuh/html5-boilerplate,ofk2/htmlcss,gd46/hammers2,h5bp/html5-boilerplate,js829/form1,maulik03/Is-117-project-1,Big-Zam/is117,matt-newman/html5-boilerplate,misscs/nyccfb-styleguide,econne01/agentmavens,roopalk/project1,AlexDF/is217,edivancamargo/html5-boilerplate,js829/exam,al73/FinalProject,jason-zhai/ccm_prototyping,Kevaughn/Assignment1,deborahleehamel/html5-boilerplate,kprokken/pagodaboxtest,AllisonM114/IS-218-Homework1,lcs6/project1,kaw393939/is117-001a,RanesJan/html5-boilerplate,extiser/html5-boilerplate,jasonblanchard/js-chops,joana83/MyFirstForm,yk92/project2,IcyLeez/QBee,kmj22/is117final,lopezja2186/UsePHP,durai145/html5-boilerplate,Edwinshinobi/html5-IS117,SabaNabeel/HTML-Boilerplate,rasata/html5-boilerplate,rn226/IS117FinalProject,dts23/Project1,cnbin/html5-boilerplate,unixboy/html5-boilerplate,tarraschk/Argaus,kmj22/is117final,Missybur/html5-boilerplate,cnhernand989/IS332,jlbaez/IS322,Strider89/IS217,AliKalkandelen/is117webpagelayout,Mounika15/html5-boilerplate,forging2012/html5-boilerplate,lopezja2186/LT09252015,kcmckell/html5-boilerplate,Jiasi/html5-boilerplate-practice,econne01/conmancode,RanikaR/Assignment_1,maulik03/117testing,bas39/projecto1,Big-Zam/final,ppf3/IS117-BoilerPlate,Rishabh110/Mobile-App-Dev,Samruddhi-Technologies-Private-Limited/html5-boilerplate,Samalamabanana/project1,urvesh/html5-boilerplate,Upmacis-Andrejs/12guru_Front-end,byog/html5-boilerplate,userkiller/final,bogem/my-html5-boilerplate,WillSmith21/NewProject,elkingtonmcb/html5-boilerplate,js829/IS117project1,webmasterpro/html5-boilerplate,Terminocity/terminocity.github.io,madepste/form-validation,dad29/project1,sg772/Assignment1,sn357/is117htmltags,js829/exam,jasonwalkow/html5-boilerplate,maulik03/Is-117-project-1,AndrewT51/html5-boilerplate,swarrier16/boilerCommits,dad29/htmlforms,roblarsen/html5-boilerplate,arifgursel/html5-boilerplate,birthdayalex/html5-boilerplate,aac43/Remote-Origin,sjp46/timeline,hfb7/IS117-,jb376/Photography-website,lopezja2186/FS102014,rrd25/test1,rcastano1019/IS117-Project2,jimi8394/is117project1,LiamMahady/is322project,RanesJan/is117,madepste/lasttest,rrd25/forms,nandadotexe/html5-boilerplate,jinjian1991/html5-boilerplate,dy45/IS217,wstanulis/is322_bootsrap,las36/HTML5,sungurovm/HTML-5-boilerplate-repository,Jazz-Man/html5-boilerplate,nikolav/me-herokuapp,daglipinank/html5-boilerplate,MP395/form,homer4hire247/IS117-Boilerplate,rcastano1019/IS117-html5,taupecat/career-day,birthdayalex/html5-boilerplate,TunedMystic/website-nonprofit,binoy14/is117-h5bp,zhengguilin001/html5-boilerplate,bradsauce/oneMoreBP,fizzvr/html5-boilerplate,kaw393939/test2,kaw393939/project1,claimsmall/html5-boilerplate,userkiller/is117,Krisrinidhi/html5-boilerplate,lcs6/HTML-Elements,las36/quiz1,av255/av255,gd46/hw2-final,nicktheo59/seedhack,jdiaz33/formVal,durai145/html5-boilerplate,WillSmith21/Final-Exam,RanesJan/is218,WillSmith21/NJIT-Repo,danieljbell/html5-boilerplate,bradsauce/yetAnotherBP,VillageFox/is117,yk92/project2,kprokken/pagodaboxtest,zhangsanjin/html5-boilerplate,DaHarris/boilerplate-news,RanesJan/jqTestForm,osmanjaffery/IS117,gd46/swipeGesturetutorial,rrd25/project1,pba3/htmlboilerplate,al285/IS117,brettkan/html5-boilerplate,AliKalkandelen/is117webpagelayout,aac43/Remote-Origin,turb0charged/Boilerstrap,byog/html5-boilerplate,elj4/is117-website,onetwopunch/websume,bradsauce/html5-is117,koushikdhar88/html5-bp,Nickkaczmarek/html5-boilerplate,jshah4563/finaltest,DaHarris/boilerplate-news,KubaZ/DevEnvironment,sn357/is117htmltags,rolinzcy/html5-boilerplate,bradsauce/yetAnotherBP,dg253/is217,asrendon/HTML5-boiler,nishanoire/html5-boilerplate,hfb7/HTML-FORM-TUTORIAL-,fjsevillamora/html5-boilerplate,ofk2/htmlcss,LIBOTAO/html5-boilerplate,las36/HTML5,Kuzonn/html5-bp,jasonwalkow/html5-boilerplate,ashokyadav006/Route-runner,jaroot32/html5-boilerplate,JalenMoorer/is117-Test1,jshah4563/practice1,cmichaelcooper/css-presentation,Paqmind/html5-boilerplate,hajamie/tree,youprofit/html5-boilerplate,fady/html5-boilerplate,gagiksargsyan/html5-boilerplate-less,mer22/My-Assignments,madepste/testwebpage,zachmorgan/pagodabox-test,dvd545/is217,ankitsharma0904/html5-boilerplate,kaw393939/project1s,madepste/contactpage,dts23/Project1,haliale/myassignment,dts23/ff,lirun3196/html5-boilerplate,sn357/is117final,LiamMahady/is322project,kwan098/IS-117,Serabass/html5-boilerplate,ecmartinez/html5-boilerplate,JoDa8765/project1,hfb7/FINALPROJECT-,nn265/niceproject,possumtech/memento,sn357/is117finalexam,greenpeaceuk/gp-bsd-form,Mako88/thatguy-boilerplate,JaylonQi/html5-boilerplate,hdiana09/is117-Spring-14,SabaNabeel/HTML-Boilerplate,kaw393939/is117-spring2014,RanesJan/test301,itnovator/html5-boilerplate,iancampelo/html5-boilerplate,cspotcode/html5-boilerplate,joshvillahermosa/IS322-GitTutorial,aed7/html5-bp,joana83/Myfirstsite,bb245/html5-boilerplate_Practice,taupecat/career-day,econne01/agentmavens,bchok/boilerplate4,jacquesdeklerk/jacquesdeklerk,andreaslangsays/html5-boilerplate,rutgersnjit2113/First-Website,bipinmathew29/IS117,aaroncolon/html5-boilerplate,briankelleher/html5-boilerplate,RanesJan/test301,jamesgriffith/NJIT,Upmacis-Andrejs/untrips_Front-end,Deepakzz/assignment1,ac486/websiteproject,darshilpatel95/IS117Project1,bradsauce/oneMoreBP,AliKalkandelen/html5boilerplate,nandadotexe/html5-boilerplate,metal88888/html5-boilerplate,gagiksargsyan/html5-boilerplate-less,madepste/project1,ar582/Project,js829/IS117Project2,sanomi/html5-boilerplate-prev,JinWooShin/html5-boilerplate,AndrewT51/html5-boilerplate,madepste/website1,Rexz/googleapitest,sct24/sanford-,sjp46/timeline,deftcat/Fei_Boilerplate,medixdev/html5-boilerplate,dramos0921/website,jdiaz33/final-project-1,JohnnyWalkerDesign/html5-boilerplate,alexbutirskiy/html5-boilerplate,hfb7/IS117-,madepste/project1,BlazerR/Assignment1,Guerrerito/html5-boilerplate,sjp46/assignment3,wendelas/html5-boilerplate,acolavin/grad-portfolio-melissa,nderituedwin/html5-boilerplate,ar582/Project1,Gia636/clone,lcs6/HTML-Elements,bradsauce/fixedjq,lcs6/finalrepo,wendelas/html5-boilerplate,pj92/project1,obliviga/217,rcastano1019/IS117-html5,jeffreysantos/is218,gast499/IS218_assignment1,dramos0921/test1,rp528/html5-boilerplate,zachmorgan/webdevHollywoodFitness-team-02,WillSmith21/NJIT-Repo,rrd25/test1,vkhorozian/fivePage,youprofit/html5-boilerplate,hfb7/117FINALEXAM,Deepakzz/assignment1,matei1987/HTML5BP_EX,vkhorozian/fivePage,leegee/require-html5-boilerplate-jquery-mocha,misscs/nyccfb-styleguide,CodingHouseFI/html5-boilerplate,yk92/Portfolio-Page,ryandnieves/project1,ppf3/IS117-HTML-CSS,possumtech/memento,nchlswtsn/html5-boilerplate,Jiasi/html5-boilerplate-practice,forging2012/html5-boilerplate,l0rd0fwar/html5-boilerplate,Brunation11/html5-boilerplate,dad29/finalexam,SamanthaDegges/html5-boilerplate,jshah4563/practice2,rutgersnjit2113/First-Website,didijc/mommieand.me,bradsauce/inclass-redo,spratt/githubscrum,rasata/html5-boilerplate,bhobbs92/ROTC,ankitsharma0904/html5-boilerplate,rn226/HTML5IS117,LiamMahady/is322,jshah4563/htmltags,jshah4563/is117-project1,ar582/Project,z3v/pagodabox-test,ikoardian/html5-boilerplate,dramos0921/forms,webcultist/html5-boilerplate,mosafiullah/Test1,dts23/finalproject,rrd25/homework2,nicktheo59/seedhack,iixx/html5-boilerplate,jppope/SCG-Boilerplate,kaw393939/is117-test-again,diegoncampos/html5-boilerplate,jubileesun/is117-final-project,MikeiLL/html5-boilerplate,jshah4563/practice2,Paqmind/html5-boilerplate,mds39/is117new,lopezja2186/Final,h5bp/html5-boilerplate,madepste/resumewebsite,darshilpatel95/Final-Project,MP395/test2,Samalamabanana/project2,nanakojoaba/form-project,MSullivan22/is322-hammer,lopezja2186/EmpireWebsite,ses10/is117,RanesJan/html5-boilerplate,rprouse/html5-boilerplate,ar582/html5,Jazz-Man/html5-boilerplate,itnovator/html5-boilerplate,bradsauce/anotherBP,elkingtonmcb/html5-boilerplate,econne01/agentmatcher,kaw393939/html5is117,maulik03/is117-final,ShrutikaM/is117,ses10/is117-Final-Project,dengyaolong/html5-boilerplate,Joanna913/html5-boilerplate,dramos0921/project,forida06/html5bp,cw089416/finalproject117,didijc/mommieand.me,soumitad/html5_boilerplate,anbestephen/html5-boilerplate,cjrojas72/IS117Prac,cw089416/finalproject117,zhangsanjin/html5-boilerplate,testcodio/nomaster,cw089416/project01html,CodingHouseFI/html5-boilerplate,paksu/html5-boilerplate,sdeveloper/html5-boilerplate,kristywessel/html5-boilerplate,sourcelair/html5-boilerplate,spbNJIT/H5BP,wvspeters/boilandtrouble,derekjohnson/respimg-demos,josephhajduk/cqb,js829/final,mohand23/finalproject,tonyalee1169/html5-boilerplate,AmandaZummach/landingpage,mosafiullah/project1,Christopherallen/pagodaBoxTest,RanesJan/is117,gd46/hammerjs,elj4/is117-website,phillipalexander/html5-boilerplate,anbestephen/html5-boilerplate,maulik03/is-117-html,econne01/agentmatcher,parepallysvp/clone1,nick-forks/nick-html5-boilerplate,madepste/formval,kaw393939/is117evening,ppf3/Website,ac486/html5-boilerplate,ar548/html5,felipecorral/html5-boilerplate,sanomi/html5-boilerplate-prev,jb376/Constrution-website,rb496/html5-boilerplate,Abraar/html5-boilerplate,MetSystem/html5-boilerplate,katieunger/html5-boilerplate,xplanxalex/IS217,NJITGN44/IS117,mohand23/project0,rutgersnjit2113/final-exam,kaw393939/jquery-fixed-boilerplate,urvesh/sample,jshah4563/practice1,jinjian1991/html5-boilerplate,BrianSipple/html5-boilerplate,cesaral1510/html,ebramk/IS218,jbenkual/git_rocks,puvi034/WebsiteSourceCode,rutgersnjit2113/IS117project1,madepste/lasttest,derekjohnson/geocheck,Serabass/html5-boilerplate,rosshochwert/BoilerBootBookExample,dengyaolong/html5-boilerplate,cma9/IS117,kaw393939/is117001-forms,nbhamilton94/html5iss117,digitalbear/ParkMeHappy,wp34/html5-boilerplate,Big-Zam/project0,madepste/forms,AllisonM114/Is117GitWebsite,RanikaR/Assignment_1,Edwinshinobi/html5-IS117,NJITGN44/IS117,Joanna913/html5-boilerplate,JinWooShin/html5-boilerplate,rutgersnjit2113/final-exam,diehard226/is117website,cjrojas72/WebFinalProject,danharibo/approved,roccoricciardi/IS332Repo,Christopherallen/pagodaBoxTest,ofk2/is117something,kaw393939/html5-bp2,elj4/IS117FINAL,cjrojas72/html-prac,sdeveloper/html5-boilerplate,ar548/project1,ppf3/IS117-Test1,lcs6/finalrepo,Missybur/html5-boilerplate,RanesJan/jqTest,dramos0921/test1,PeterDaveHello/html5-boilerplate,NJITGN44/HTML5BoilerPlate,frialex/ExcavationReport,ar548/html5,madepste/webproj1,larmour/html-files,ac486/is117project1,michaeljunlove/html5-boilerplate,obliviga/217-Node.js,AlexDF/unit_test_hw,APKaur/project0,Christopherallen/HollywoodFitness,sourcelair/html5-boilerplate,evvels2131/is117,ShrutikaM/SP-Flowers,MikeiLL/html5-boilerplate,jacobroufa/html5-boilerplate,JalenMoorer/html5-bp,cesaral1510/project-,AllisonM114/Final-Project,AllisonM114/IS-218-Homework1,kevinburke/tarbz2.com,michaeljunlove/html5-boilerplate,kaw393939/is117boiler,rprouse/html5-boilerplate,MetSystem/html5-boilerplate,av255/av255,kaw393939/is117project1,CoolConfucius/html5-boilerplate,philipwalton/html5-boilerplate,StalynArroyo/Assignment1,leann09/project1,JalenMoorer/html5-bp,MaitreyPatel/assigment1,mzmang/html5-boilerplate,testcodio/nomaster,Big-Zam/project1,arkjoseph/boilerplate,MourviTrivedi/boilerplate,ryandnieves/improve,swarrier16/boilerCommits,shixiaomiaomiao/html5-boilerplate,Zarkoned/alpha,jdiaz33/final-project-1,MeilinLu/html5-boilerplate,darshilpatel95/ISFinalProject,misscs/sass-hack,ankurgyani/html5boilerplate,rb496/html5-boilerplate,pp423/htmlboilerplate,AliKalkandelen/is117webpagelayout,deborahleehamel/html5-boilerplate,Big-Zam/is117,bradsauce/BPTime,rutgersnjit2113/IS117project1,daglipinank/html5-boilerplate,maulik03/is117finalexam,danhedron/approved,forida06/html5bp,jbenkual/git_rocks,kaw393939/html5-is117-001,CoolConfucius/html5-boilerplate,moravic/mg,jesonn/html5-boilerplate,gjb7/is217-unit-test,RedSailDesign/html5-boilerplate,bchok/boilerplate4,isaacdamico/Practice,kaoriprice/Pagodabox,beera421/myfirstrepo,pearfish/newdle,diehard226/is117finalproject,wstanulis/is322,marmikbhatt/html5-boilerplate,bipinmathew29/IS117,impressivewebs/html5-boilerplate,shak212/webshak,iancampelo/html5-boilerplate,kaw393939/htm5-bp-example,rp528/html5-boilerplate,bradsauce/inclass-redo,lopezja2186/LT09252015,cjrojas72/FinalTestprep,briankelleher/html5-boilerplate,osmanjaffery/IS117,mtf22/Assignment-1,nn265/niceproject,IcyLeez/QBee,Rukawuba/HTML-5-Assignment,cnbin/html5-boilerplate,teresab/project-1,leann09/boiler-plate,jkjustjoshing/gravity-ball,jppope/SCG-Boilerplate,RanesJan/istest,jacquesdeklerk/jacquesdeklerk,ashokyadav006/Route-runner,arawkins/html5-boilerplate,Edwinshinobi/html5-IS117,kaw393939/is117-001a,ebramk/IS218,rutgersnjit2113/HTMLtags,pba3/htmlboilerplate,ezequielo/html5-boilerplate,DrOctogon/rl-landing,ankurgyani/html5boilerplate,elj4/html5boiler,ev8/responsive,RedSailDesign/html5-boilerplate,jason3375/IS-217,dramos0921/hw2,matt-newman/html5-boilerplate,leegee/require-html5-boilerplate-jquery-mocha,ses10/is117-Final-Project,hfb7/FINALPROJECT-,JoDa8765/html5IS117,ChrisBras/html5-bp-example,koushikdhar88/html5-bp,homer4hire247/IS117-Boilerplate,lcs6/final,fjsevillamora/html5-boilerplate,kaw393939/project1,heroseven/html5-boilerplate,hpaghdal/assignment3,rrd25/project2,sn357/is117final,unixboy/html5-boilerplate,kaw393939/project1s,shixiaomiaomiao/html5-boilerplate,inafis/IS217,hajamie/tree,z3v/pagodabox-test,ronakt307/html5boilerplate,mohand23/project1,lopezja2186/firstproject,joana83/Mytestrepository,sn357/is117html5-,kaw393939/is117-test-again,nschexni/sneaky_squirrel,juanibrex/html5-boilerplate,gast499/IS218_assignment1,phonghtran/cardViewer,RatulGhosh/html5-boilerplate,maulik03/117testing,jeffreysantos/is218,JoDa8765/html5IS117,node-skull/skull-html5-boilerplate,280455936/html5-boilerplate,geosu93/HelloWorld1,a3rd/html5-boilerplate,kwan098/IS-117,shak212/classproject1,evvels2131/is117,kmj22/html-form,jimi8394/is117project1,carltonstith/html5-boilerplate,al73/Unit5,nanakojoaba/form-project,nikkoroy1/IS117_Test,Abraar/html5-boilerplate,Samalamabanana/bp5,andreyvarganov/html5-boilerplate,bsides/ibep,koushikdhar88/form-validation,jacquesdeklerk/jacquesdeklerk,kristywessel/html5-boilerplate,KayWatson/pagodabox,rodrigolins/html5-boilerplate,edivancamargo/html5-boilerplate,arawkins/html5-boilerplate,Mounika15/html5-boilerplate,fizzvr/html5-boilerplate,wp34/html5-boilerplate,1ClickComputing/html5-boilerplate,js829/form1,nderituedwin/html5-boilerplate,RanesJan/is218,cw089416/project02html,shak212/webshak,JoDa8765/project1,deftcat/Fei_Boilerplate,WinOnWorld/is117evening,rn226/IS117FinalProject,al73/Unit6,rrd25/project1,jdiaz33/formVal,nishanoire/html5-boilerplate,av255/github,rockmans/KyleAndEmily,janina2489/as1,larmour/html-files,AllisonM114/Is117GitWebsite,phonghtran/numberScroller,rockmans/KyleAndEmily,yepesasecas/closeIframeTest,bogem/my-html5-boilerplate,js829/IS117Project2,kaw393939/html5is117,kk96/IS117,authorpenzwell/IS-217,bradsauce/anotherBP,docluv/html5-boilerplate,lcs6/project1,klokie/howlermonkeygods.github.com,fly19890211/html5-boilerplate,shak212/classproject1,tchalvak/html5-boilerplate,anealkhimani/helloworld,mer22/Project1,BlazerR/Assignment1,joana83/Homework2,wvspeters/boilandtrouble,kaw393939/is117,Big-Zam/project0,boxmein/boxmein.net,hfb7/IS117HW1-,krivenburg/boilerplate-updated,felipecorral/html5-boilerplate,urvesh/html5-boilerplate,kaw393939/is217,hpaghdal/assignment3,domingle/my-website,cjrojas72/WebFinalProject,bgato031/is117,extiser/html5-boilerplate,Terminocity/terminocity.github.io,jasonblanchard/js-chops,boklos/html5-bp,lt5/IS683_Project1,mpliang/jQuery-Project,a3rd/html5-boilerplate,ppf3/Website,snehaltandel/newboilerplate,Samalamabanana/project1,urvesh/sample,mer22/Project1,hubert-zheng/html5-boilerplate,dad29/htmlforms,dsheyp/boiler,las36/quiz1,sip5/html5_boilerplate,Gia636/clone,lopezja2186/firstproject,diehard226/is117website,haliale/myassignment,MourviTrivedi/boilerplate,katy-400/Boiler,rosshochwert/BoilerBootBookExample,jubileesun/is117-final-project,narutkowski/responsivewebsite,yk92/Portfolio-Page,Upmacis-Andrejs/1st_demo_project_for_SEM.lv_Front-end,madepste/contactpage2,kaw393939/is117boiler,Mako88/thatguy-boilerplate,marmikbhatt/html5-boilerplate,lcs6/HTMLForm,jdiaz33/html5-boilerplate-practice,lcs6/final,diegoncampos/html5-boilerplate,ofk2/is117something,zachmorgan/pagodabox-test,mzmang/html5-boilerplate,mohand23/project0,bridgenn/homework1,jesonn/html5-boilerplate,Brunation11/html5-boilerplate,CarlWrightII/JS217,sammyliriano/IS117,WillSmith21/Finalpro,dad29/finalexam,paregonta/html5-boilerplate,jamesonnuss/pagodabox_test,jacobroufa/html5-boilerplate,gbs2/unit5project,ses10/is117-Github-HW,kaw393939/test2,gd46/is322,Upmacis-Andrejs/2nd_demo_project_for_SEM.lv_Front-end,krivenburg/kr-html5-bp,simonfork/html5-boilerplate,andrescarceller/html5-boilerplate,ryandnieves/project1,possumtech/memento,WillSmith21/Final-Exam,josemujicap/safesteps-digidev,asrendon/HTML5-boiler,majaradichevich/majaradichevich.github.io,hfb7/117FINALEXAM,baiyanghese/html5-boilerplate,rikriki/boiler,madepste/aboutpage,Kuzonn/html5-bp,skinkie/furbee,pj92/project1,280455936/html5-boilerplate,WinOnWorld/is117evening,pulkitsharma550/html5-boilerplate,metal88888/html5-boilerplate,webmasterpro/html5-boilerplate,ar548/project_2,ppf3/Website,andreyvarganov/html5-boilerplate,leann09/project1,cesaral1510/html5,ac486/websiteproject,kaixins/kaixins.github.io,snehaltandel/newboilerplate,LIBOTAO/html5-boilerplate,sampesce/HTML5-bp-example,maulik03/is117finalexam,lcs6/Some-New-Repo,Krisrinidhi/html5-boilerplate,binoy14/is117-h5bp-Test1,kaw393939/somenewrepo,lw234/IS217,nikkoroy1/IS117_Test,ses10/is117,ars66/boilerplate,Sachin-Ganesh/html5-boilerplate,madepste/newhomepage,Upmacis-Andrejs/12guru_Front-end,jhanauska/pagodaboxinclass,sap64/mynewrepo,NJITGN44/TestRepo,sn357/is117finalexam,larmour/html-files,av255/github,diehard226/is117html5,cesaral1510/project,sap64/mynewrepo,NJITGN44/HTML5BoilerPlate,nbhamilton94/Project1fa15,Samalamabanana/project4,kmj22/html-form,kaw393939/somenewrepo,lcs6/HTMLForm,balakumarhs/Balakumar,kaw393939/is117project1,gd46/bootstrap,simonfork/html5-boilerplate,ecmartinez/html5-boilerplate,domingle/my-website,ar582/Project1,StalynArroyo/Assignment1,sumitrawat1/assignment1,Big-Zam/final,bradsauce/project1,gagiksargsyan/html5-boilerplate,Christopherallen/HollywoodFitness,hajamie/tree,bradsauce/BPTime,bhobbs92/is117,R4c00n/html5-boilerplate,binoy14/IS117-ClassRepo,NJITGN44/Project1,pankaj-tulaskar/wsda1,woshiniuren/html5-boilerplate,michaeloliveira/IS217,MSullivan22/is322,ppf3/Project2,jas38/IS_322,guddee2002/htmlbp,cedeon/h5bp-pdfui,binoy14/is117-h5bp-Test1,teresab/project-1,brettkan/html5-boilerplate,josemujicap/safesteps-digidev,danieljbell/html5-boilerplate,gcpantazis/holy-boilerplate,binoy14/IS117-ClassRepo,aaroncolon/html5-boilerplate,Samalamabanana/bp5,dramos0921/project,kaw393939/is322,Samruddhi-Technologies-Private-Limited/html5-boilerplate,woshiniuren/html5-boilerplate,asrendon/webdev,derekjohnson/boilerplate,cw089416/is117project1,gd46/is117_Final_Project,sumathi89/html5-boilerplate,maulik03/is117-final,msnonari/html5-boilerplate,nanakojoaba/project1,claimsmall/html5-boilerplate,mosafiullah/webpage,asrendon/webdev,bb245/IS-683-Website-assignment,cw089416/html5is117,econne01/conmancode,nikkoroy1/IS117_Proj1,leann09/boiler-plate,parepallysvp/clone1,rn226/Project2,jshah4563/is117-project1,sg772/Assignment1,MP395/Empire,paregonta/html5-boilerplate,alexbutirskiy/html5-boilerplate,dts23/ff,Jrijo/IS322,mohand23/project1,dad29/project1,moravic/mg,mohand23/finalproject,kaw393939/is117evening,mtf22/Assignment-1,Victorgichohi/html5-boilerplate,Nickkaczmarek/html5-boilerplate,bradsauce/html5-is117,SamanthaDegges/html5-boilerplate,jhanauska/pagodaboxinclass,AliKalkandelen/is117project2,carltonstith/html5-boilerplate,ses10/is117-Github-HW,jshah4563/htmltags,kevinburke/tarbz2.com,qiruiyin/html5-boilerplate,MeilinLu/html5-boilerplate,Big-Zam/project1,hajamie/tree,kaoriprice/Pagodabox,nbhamilton94/Project1fa15,sjp46/assignment3,madepste/project2,R4c00n/html5-boilerplate,cesaral1510/html5,hj69/5bp2,openumea/Facilities-example,elj4/html5boiler,jason-zhai/ccm_prototyping,DanielMarquard/html5-boilerplate,soumitad/html5_boilerplate,Zarkoned/alpha,kaixins/kaixins.github.io,JaylonQi/html5-boilerplate,chadbarth/html5-boilerplate,hj69/website-layout,katieunger/html5-boilerplate,rn226/HTML5IS117,cnhernand989/IS332_Bootstrap,mpliang/jQuery-Project,amorwilliams/html5-boilerplate,bradsauce/project1,maulik03/is-117-html,cjrojas72/IS117Prac,elj4/IS117FINAL,cw089416/project02html,sn357/htmlformtut,jamesonnuss/pagodabox_test,cjrojas72/FinalTestprep,cw089416/project01html,ppf3/Website,Guerrerito/html5-boilerplate,msnonari/html5-boilerplate,isaacdamico/Practice,balakumarhs/Balakumar,cw089416/is117project1,hj69/5bp2,tchalvak/html5-boilerplate,sn357/htmlformtut,PeterDaveHello/html5-boilerplate,phillipalexander/html5-boilerplate,abartolo/IS217,lcs6/Some-New-Repo,RanesJan/project1,rn226/Project2,nchlswtsn/html5-boilerplate,turb0charged/IS322,conif1/pantson,sct24/sanford-,ar548/formValidation,cesaral1510/project-,boxmein/boxmein.net,KayWatson/pagodabox,LiamMahady/is322boot,JoDa8765/final-exam,rockmans/KyleAndEmily,Sachin-Ganesh/html5-boilerplate,medixdev/html5-boilerplate,dad29/htmlforms,WillSmith21/NewProject,ppf3/IS117-BoilerPlate,kaw393939/is117001-forms,mer22/My-Assignments,JoDa8765/final-exam,madepste/finalproject,janina2489/as1,cjrojas72/html-prac,hfb7/IS117HW1-,cesaral1510/html,pankaj-tulaskar/wsda1,beera421/myfirstrepo,sungurovm/HTML-5-boilerplate-repository,sumathi89/html5-boilerplate,nbhamilton94/html5iss117,zhengguilin001/html5-boilerplate,nick-forks/nick-html5-boilerplate,ars66/boilerplate,sumitrawat1/assignment1,Jrijo/IS117,RanesJan/is218,ikoardian/html5-boilerplate,ppf3/IS117-Test1,ShrutikaM/SP-Flowers,Upmacis-Andrejs/1st_demo_project_for_SEM.lv_Front-end,rockmans/KyleAndEmily,yk92/is117-Project1,hfb7/test1,RanesJan/project2,misscs/sasschops-theshop | ---
+++
@@ -8,7 +8,7 @@
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
- var console = window.console || {};
+ var console = (window.console = window.console || {});
while (length--) {
// Only stub undefined methods. |
356fdb8abac0259d1016a93da57561b41acc07d6 | scripts/ayuda.js | scripts/ayuda.js | document.getElementById("ayuda").setAttribute("aria-current", "page");
var aside = document.getElementById("complementario");
var button = document.createElement("BUTTON");
var text = document.createTextNode("Prueba");
button.appendChild(text);
aside.appendChild(button);
button.addEventListener("click", prueba, true);
function prueba() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var div = document.createElement("DIV");
div.innerHTML(this.responseText);
aside.appendChild(div);
}
};
xhttp.open("GET", "../userGuide.html", true);
xhttp.send();
}
| document.getElementById("ayuda").setAttribute("aria-current", "page");
var aside = document.getElementById("complementario");
var button = document.createElement("BUTTON");
var text = document.createTextNode("Prueba");
button.appendChild(text);
aside.appendChild(button);
button.addEventListener("click", prueba, true);
function prueba() {
var xhttp = new XMLHttpRequest();
alert("prueba");
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var div = document.createElement("DIV");
div.innerHTML(this.responseText);
aside.appendChild(div);
}
};
xhttp.open("GET", "../userGuide.html", true);
xhttp.send();
}
| Add alert to test AJAX | Add alert to test AJAX
| JavaScript | mit | nvdaes/nvdaes.github.io,nvdaes/nvdaes.github.io | ---
+++
@@ -8,6 +8,7 @@
function prueba() {
var xhttp = new XMLHttpRequest();
+ alert("prueba");
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var div = document.createElement("DIV"); |
f63888293718914c86f373bb5974f82fe8bdced0 | src/assets/js/scrolling-nav.js | src/assets/js/scrolling-nav.js | function scrollTo(e) {
var distanceToTop = function (el) {
try {
return Math.floor(el.getBoundingClientRect().top);
} catch (err) {
console.log(err);
}
},
targetID = this.getAttribute("href"),
targetAnchor = document.querySelector(targetID),
originalTop = distanceToTop(targetAnchor),
offset = document.querySelector('.l-nav-primary-desktop').offsetHeight;
e.preventDefault();
if (!targetAnchor) {
return;
}
window.scrollBy({ top: originalTop - offset, left: 0, behavior: "smooth" });
}
// grab links
var linksToAnchors = document.querySelectorAll('a.page-scroll');
// Event handler for clicking on links
linksToAnchors.forEach(function (each) {
each.onclick = scrollTo;
});
| //@TODO: This is not yet working in Safari. Test and fix.
function scrollTo(e) {
var distanceToTop = function (el) {
try {
return Math.floor(el.getBoundingClientRect().top);
} catch (err) {
console.log(err);
}
},
targetID = this.getAttribute("href"),
targetAnchor = document.querySelector(targetID),
originalTop = distanceToTop(targetAnchor),
offset = document.querySelector('.l-nav-primary-desktop').offsetHeight;
e.preventDefault();
if (!targetAnchor) {
return;
}
window.scrollBy({ top: originalTop - offset, left: 0, behavior: "smooth" });
}
// grab links
var linksToAnchors = document.querySelectorAll('a.page-scroll');
// Event handler for clicking on links
linksToAnchors.forEach(function (each) {
each.onclick = scrollTo;
});
| Add @TODO as a reminder to fix the fact that the scrollTo is not working with Safari yet. | Add @TODO as a reminder to fix the fact that the scrollTo is not working with Safari yet.
| JavaScript | mit | deduced/bov-personal-portfolio,deduced/bov-personal-portfolio | ---
+++
@@ -1,3 +1,5 @@
+//@TODO: This is not yet working in Safari. Test and fix.
+
function scrollTo(e) {
var distanceToTop = function (el) {
try { |
232addfd19313b1a97ac6e4936de7965464b8602 | scripts/start.js | scripts/start.js | Bureaucracy.start.cols = [
{
_id: 'name',
name: "Name",
type: String
},
{
_id: 'date',
name: "Travel Date",
type: Date
},
{
_id: 'age',
name: "Age",
type: Number
},
{
_id: 'things',
name: "Things",
type: Array,
value: function(xs) {
return xs.length;
}
},
{
_id: 'location',
name: "Location",
type: Location
}
];
Bureaucracy.start.rows = [
{
_id: 'edgar',
name: "Edgar",
age: 77,
things: ["filing-cabinet"],
location: "DC",
date: "2015-02-01"
},
{
_id: 'dale',
name: "Dale",
age: 55,
things: ["microcassette recorder"],
location: "WA",
date: "2015-02-11"
},
{
_id: 'clarice',
name: "Clarice",
age: 52,
things: ["dresser", "cabinet"],
location: "OH",
date: "2015-01-30"
}
];
| Bureaucracy.start.cols = [
{
_id: 'name',
name: "Name",
type: String
},
{
_id: 'date',
name: "Travel Date",
type: Date
},
{
_id: 'age',
name: "Age",
type: Number
},
{
_id: 'things',
name: "Things",
type: Array,
value: function(row, col) {
var xs = row[col._id];
return xs.length;
}
},
{
_id: 'location',
name: "Location",
type: Location
}
];
Bureaucracy.start.rows = [
{
_id: 'edgar',
name: "Edgar",
age: 77,
things: ["filing-cabinet"],
location: "DC",
date: "2015-02-01"
},
{
_id: 'dale',
name: "Dale",
age: 55,
things: ["microcassette recorder"],
location: "WA",
date: "2015-02-11"
},
{
_id: 'clarice',
name: "Clarice",
age: 52,
things: ["dresser", "cabinet"],
location: "OH",
date: "2015-01-30"
}
];
| Fix computed value in demo | Fix computed value in demo
| JavaScript | mit | 1083/bureaucracy,1083/bureaucracy | ---
+++
@@ -18,7 +18,8 @@
_id: 'things',
name: "Things",
type: Array,
- value: function(xs) {
+ value: function(row, col) {
+ var xs = row[col._id];
return xs.length;
}
}, |
bc49a27f5f55d17967dde225ed606c15ea5bebc4 | sentiment/index.js | sentiment/index.js | // Include The 'require.async' Module
require("require.async")(require);
/**
* Tokenizes an input string.
*
* @param {String} Input
*
* @return {Array}
*/
function tokenize (input) {
return input
.replace(/[^a-zA-Z ]+/g, "")
.replace("/ {2,}/", " ")
.toLowerCase()
.split(" ");
}
/**
* Performs sentiment analysis on the provided input "term".
*
* @param {String} Input term
*
* @return {Object}
*/
module.exports = function (term, callback) {
// Include the AFINN Dictionary JSON asynchronously
require.async("./AFINN.json", function(afinn) {
// Split line term to letters only words array
var words = tokenize(term || "");
var score = 0;
var rate;
var i = 0;
function calculate(word) {
// Get the word rate from the AFINN dictionary
rate = afinn[word];
if (rate) {
// Add current word rate to the final calculated sentiment score
score += rate;
}
// Defer next turn execution (Etheration)
setImmediate(function() {
// Use callback for completion
if (i === (words.length - 1)) {
callback(null, score);
}
else {
// Invoke next turn
calculate(words[++i]);
}
});
}
// Start calculating
calculate(i);
});
};
| // Include The 'require.async' Module
require("require.async")(require);
/**
* Tokenizes an input string.
*
* @param {String} Input
*
* @return {Array}
*/
function tokenize (input) {
return input
.replace(/[^a-zA-Z ]+/g, "")
.replace("/ {2,}/", " ")
.toLowerCase()
.split(" ");
}
/**
* Performs sentiment analysis on the provided input "term".
*
* @param {String} Input term
*
* @return {Object}
*/
module.exports = function (term, callback) {
// Include the AFINN Dictionary JSON asynchronously
require.async("./AFINN.json", function(afinn) {
// Split line term to letters only words array
var words = tokenize(term || "");
var score = 0;
var rate;
var i = 0;
function calculate(word) {
// Get the word rate from the AFINN dictionary
rate = afinn[word];
if (rate) {
// Add current word rate to the final calculated sentiment score
score += rate;
}
// Defer next turn execution (Etheration)
setImmediate(function() {
// Use callback for completion
if (i === (words.length - 1)) {
callback(null, score);
}
else {
// Invoke next turn
calculate(words[++i]);
}
});
}
// Start calculating
calculate(words[i]);
});
};
| Fix bug in sentiment calculation | Fix bug in sentiment calculation
Signed-off-by: Itai Koren <7a3f8a9ea5df78694ad87e4c8117b31e1b103a24@gmail.com>
| JavaScript | mit | itkoren/Lets-Node-ex-7 | ---
+++
@@ -56,6 +56,6 @@
}
// Start calculating
- calculate(i);
+ calculate(words[i]);
});
}; |
5f06b4187d66c9d58edb36411e719c5bbe9320fd | controllers/redis_con.js | controllers/redis_con.js | var redis = require('redis'),
redisCon = module.exports = {};
redisCon.subClient = redis.createClient();
redisCon.pubClient = redis.createClient();
redisCon.subClient.psubscribe('__keyevent@0__:expired');
redisCon.register = function(input){
redisCon.pubClient.set(input, 'randomestring', 'EX', 900, redis.print);
analytics.track({
userId: 'null',
containerId: input,
event: 'start',
time: new Date()
});
console.log('redis register');
};
redisCon.stopCallback = function(cb){
redisCon.subClient.on('pmessage', function(pattern, channel, expiredKey){
console.log('key expired: ', expiredKey);
analytics.track({
userId: 'null',
containerId: expiredKey,
event: 'stop',
time: new Date()
});
console.log('redis stop');
cb(expiredKey);
});
};
| var redis = require('redis'),
redisCon = module.exports = {};
// redisCon.subClient = redis.createClient();
// redisCon.pubClient = redis.createClient();
redisCon.subClient = redis.createClient(10310,
"pub-redis-10310.us-east-1-4.1.ec2.garantiadata.com");
redisCon.subClient.auth("8BnAVVcUwskP", function(){
console.log("subClient Connected!");
});
redisCon.pubClient = redis.createClient(10310,
"pub-redis-10310.us-east-1-4.1.ec2.garantiadata.com");
redisCon.pubClient.auth("8BnAVVcUwskP", function(){
console.log("pubClient Connected!");
});
redisCon.subClient.psubscribe('__keyevent@0__:expired');
redisCon.register = function(input){
redisCon.pubClient.set(input, 'randomestring', 'EX', 900, redis.print);
analytics.track({
userId: 'null',
containerId: input,
event: 'start',
time: new Date()
});
console.log('redis register');
};
redisCon.stopCallback = function(cb){
redisCon.subClient.on('pmessage', function(pattern, channel, expiredKey){
console.log('key expired: ', expiredKey);
analytics.track({
userId: 'null',
containerId: expiredKey,
event: 'stop',
time: new Date()
});
console.log('redis stop');
cb(expiredKey);
});
};
| Add redis cloud, will it work? | Add redis cloud, will it work?
| JavaScript | mit | howtox/howtox-server,howtox/howtox-server | ---
+++
@@ -1,8 +1,20 @@
var redis = require('redis'),
redisCon = module.exports = {};
-redisCon.subClient = redis.createClient();
-redisCon.pubClient = redis.createClient();
+// redisCon.subClient = redis.createClient();
+// redisCon.pubClient = redis.createClient();
+
+redisCon.subClient = redis.createClient(10310,
+ "pub-redis-10310.us-east-1-4.1.ec2.garantiadata.com");
+redisCon.subClient.auth("8BnAVVcUwskP", function(){
+ console.log("subClient Connected!");
+});
+
+redisCon.pubClient = redis.createClient(10310,
+ "pub-redis-10310.us-east-1-4.1.ec2.garantiadata.com");
+redisCon.pubClient.auth("8BnAVVcUwskP", function(){
+ console.log("pubClient Connected!");
+});
redisCon.subClient.psubscribe('__keyevent@0__:expired');
@@ -25,8 +37,8 @@
containerId: expiredKey,
event: 'stop',
time: new Date()
- });
- console.log('redis stop');
+ });
+ console.log('redis stop');
cb(expiredKey);
});
}; |
60a9d9581242f35ff0250264dbe79dcabf654658 | karma.conf.js | karma.conf.js | /* eslint-env node */
const path = require('path');
var browsers = ['Chrome'];
if (process.env.NODE_ENV === 'test') {
browsers = ['PhantomJS'];
}
module.exports = (config) => {
config.set({
basePath: '.',
frameworks: ['mocha', 'chai', 'phantomjs-shim', 'es6-shim'],
files: [
'./tests/index.js'
],
preprocessors: {
'./tests/index.js': ['webpack', 'sourcemap']
},
webpack: {
resolve: {
alias: {
'react-easy-chart': path.join(__dirname, 'modules')
}
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ }
]
},
devtool: 'inline-source-map'
},
webpackServer: {
noInfo: true
},
browsers: browsers,
singleRun: true,
reporters: ['progress'],
plugins: [
require('karma-mocha'),
require('karma-chai'),
require('karma-webpack'),
require('karma-sourcemap-loader'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
require('karma-phantomjs-shim'),
require('karma-es6-shim')
]
});
};
| /* eslint-env node */
const path = require('path');
var browsers = ['Chrome'];
if (process.env.NODE_ENV === 'test') {
browsers = ['PhantomJS'];
}
module.exports = (config) => {
config.set({
basePath: '.',
frameworks: ['mocha', 'chai', 'es6-shim'],
files: [
'./tests/index.js'
],
preprocessors: {
'./tests/index.js': ['webpack', 'sourcemap']
},
webpack: {
resolve: {
alias: {
'react-easy-chart': path.join(__dirname, 'modules')
}
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ }
]
},
devtool: 'inline-source-map'
},
webpackServer: {
noInfo: true
},
browsers: browsers,
singleRun: true,
reporters: ['progress'],
plugins: [
require('karma-mocha'),
require('karma-chai'),
require('karma-webpack'),
require('karma-sourcemap-loader'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
require('karma-es6-shim')
]
});
};
| Replace phantomjs shim with es6-shim | Replace phantomjs shim with es6-shim
| JavaScript | bsd-3-clause | rma-consulting/rc-d3,rma-consulting/react-easy-chart,rma-consulting/react-easy-chart,rma-consulting/rc-d3 | ---
+++
@@ -9,7 +9,7 @@
module.exports = (config) => {
config.set({
basePath: '.',
- frameworks: ['mocha', 'chai', 'phantomjs-shim', 'es6-shim'],
+ frameworks: ['mocha', 'chai', 'es6-shim'],
files: [
'./tests/index.js'
],
@@ -42,7 +42,6 @@
require('karma-sourcemap-loader'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
- require('karma-phantomjs-shim'),
require('karma-es6-shim')
]
}); |
73b9d262433290c174cd7decce85f167aae28adb | index.js | index.js | "use strict";
var port = process.env.PORT || 8080;
var file = require("fs").readFileSync;
var glob = require("glob");
var path = require("path");
var rested = require("rested");
var routes = glob.sync("routes/*.js").map(function (e, i, a) {
return require(path.join(__dirname, e));
});
var server = rested.createServer({
"crt": file(path.join(__dirname, "files/api.munapps.ca.crt")),
"key": file(path.join(__dirname, "files/api.munapps.ca.key")),
"secure": true,
"routes": routes
});
server.listen(port, function () {
console.log("Server listening on port " + port);
});
| "use strict";
var port = process.env.PORT || 8080;
var file = require("fs").readFileSync;
var glob = require("glob");
var path = require("path");
var rested = require("rested");
var routes = glob.sync("routes/*.js").map(function (e, i, a) {
return require(path.join(__dirname, e));
});
var server = rested.createServer({
"crt": file(path.join(__dirname, "files/api.munapps.ca.crt")),
"key": file(path.join(__dirname, "files/api.munapps.ca.key")),
"secure": true,
"routes": routes
});
server.eachRequest(function (request, response) {
response.setHeader("X-Powered-By", "Coffee");
response.setHeader("X-Shenanigans", "none");
response.setHeader("X-GitHub", "http://git.io/3K55mA");
});
server.listen(port, function () {
console.log("Server listening on port " + port);
});
| Add headers common to each request | Add headers common to each request
| JavaScript | bsd-3-clause | munapps/munapps-api | ---
+++
@@ -18,6 +18,12 @@
"routes": routes
});
+server.eachRequest(function (request, response) {
+ response.setHeader("X-Powered-By", "Coffee");
+ response.setHeader("X-Shenanigans", "none");
+ response.setHeader("X-GitHub", "http://git.io/3K55mA");
+});
+
server.listen(port, function () {
console.log("Server listening on port " + port);
}); |
41b33a8470d2156ad5e4dcb4f5e8b7114661d46b | index.js | index.js | 'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
const port = process.env.PORT || 3000;
const verifyToken = process.env.VERIFY_TOKEN || '';
server.connection({port: port});
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
server.route({
method: 'GET',
path: '/webhook',
handler: function (request, reply) {
if (req.query['hub.verify_token'] === verifyToken) {
res.send(req.query['hub.challenge']);
}
res.send('Error, wrong validation token');
}
});
| 'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
const port = process.env.PORT || 3000;
const verifyToken = process.env.VERIFY_TOKEN || '';
server.connection({port: port});
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
server.route({
method: 'GET',
path: '/webhook',
handler: function (req, reply) {
if (req.query['hub.verify_token'] === verifyToken) {
reply(req.query['hub.challenge']);
}
reply('Error, wrong validation token');
}
});
| Change to hapi.js code instead of express | Change to hapi.js code instead of express
| JavaScript | mit | Keeprcom/keepr-bot | ---
+++
@@ -17,10 +17,10 @@
server.route({
method: 'GET',
path: '/webhook',
- handler: function (request, reply) {
+ handler: function (req, reply) {
if (req.query['hub.verify_token'] === verifyToken) {
- res.send(req.query['hub.challenge']);
+ reply(req.query['hub.challenge']);
}
- res.send('Error, wrong validation token');
+ reply('Error, wrong validation token');
}
}); |
33760ac596580da775a1dc3d5a9d766cb95dafb3 | index.js | index.js | #! /usr/bin/env ./node_modules/.bin/babel-node
import prompt from 'prompt';
import {parse} from 'nomnom';
const schema = {
properties: {
name: {
description: 'Package name: ',
pattern: /^[a-z]+[a-z\-_]+$/,
message: 'Name must be only letters, numbers, dashes and underscores',
required: true
}
}
};
prompt.message = '>'.green;
prompt.delimiter = ' ';
prompt.colors = false;
prompt.start();
const scaffold = () => {
prompt.get(schema, (err, {name}) =>
console.log(`Scaffolding ${name}...`));
};
// Check if script is run directly
if (require.main === module) {
scaffold(parse());
}
export default scaffold;
| #! /usr/bin/env ./node_modules/.bin/babel-node
import prompt from 'prompt';
import {parse} from 'nomnom';
const schema = {
properties: {
name: {
description: 'Package name: ',
pattern: /^[a-z]+[a-z\-_]+$/,
message: 'Name must be only letters, numbers, dashes and underscores',
required: true
}
}
};
Object.assign(prompt, {
message: '>'.green,
delimiter: ' ',
colors: false
});
prompt.start();
const scaffold = () => {
prompt.get(schema, (err, {name}) =>
console.log(`Scaffolding ${name}...`));
};
// Check if script is run directly
if (require.main === module) {
scaffold(parse());
}
export default scaffold;
| Use Object.assign for prompt confg | Use Object.assign for prompt confg
| JavaScript | mit | cloverfield-tools/cf-package,halhenke/cf-package,nkbt/cf-react-component-template,davegomez/cf-package | ---
+++
@@ -16,9 +16,12 @@
}
};
-prompt.message = '>'.green;
-prompt.delimiter = ' ';
-prompt.colors = false;
+
+Object.assign(prompt, {
+ message: '>'.green,
+ delimiter: ' ',
+ colors: false
+});
prompt.start();
|
95592d8cf6d543fe94ca616ad8ff17f6b0468bcd | index.js | index.js | // @flow
module.exports = {
extends: [
'plugin:flowtype/recommended',
'plugin:react/recommended',
'plugin:jest/recommended',
'./rules/imports.js',
// This comes last so that prettier-config can turn off appropriate rules given the order of precedence by eslint 'extends'
require.resolve('eslint-config-uber-universal-stage-3'),
],
plugins: [
'eslint-plugin-flowtype',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
],
rules: {
// Enforce flow file declarations
'flowtype/require-valid-file-annotation': ['error', 'always'],
// We should be using flow rather than propTypes
'react/prop-types': 'off',
// Enforces consistent spacing within generic type annotation parameters.
// https://github.com/gajus/eslint-plugin-flowtype/blob/master/.README/rules/generic-spacing.md
'flowtype/generic-spacing': 'off',
// Enforce hook rules
// https://reactjs.org/docs/hooks-faq.html#what-exactly-do-the-lint-rules-enforce
'react-hooks/rules-of-hooks': 'error',
// https://github.com/facebook/react/issues/14920
'react-hooks/exhaustive-deps': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
};
| // @flow
module.exports = {
extends: [
'plugin:flowtype/recommended',
'plugin:react/recommended',
'plugin:jest/recommended',
'./rules/imports.js',
// This comes last so that prettier-config can turn off appropriate rules given the order of precedence by eslint 'extends'
require.resolve('eslint-config-uber-universal-stage-3'),
],
plugins: [
'eslint-plugin-flowtype',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
],
rules: {
// Enforce flow file declarations
'flowtype/require-valid-file-annotation': ['error', 'always'],
// We should be using flow rather than propTypes
'react/prop-types': 'off',
// Enforces consistent spacing within generic type annotation parameters.
// https://github.com/gajus/eslint-plugin-flowtype/blob/master/.README/rules/generic-spacing.md
'flowtype/generic-spacing': 'off',
// Enforce hook rules
// https://reactjs.org/docs/hooks-faq.html#what-exactly-do-the-lint-rules-enforce
'react-hooks/rules-of-hooks': 'error',
// https://github.com/facebook/react/issues/14920
'react-hooks/exhaustive-deps': 'warn',
},
settings: {
react: {
version: 'latest',
},
},
};
| Fix version warning when react isn't installed | Fix version warning when react isn't installed
https://github.com/fusionjs/eslint-config-fusion/pull/140 | JavaScript | mit | fusionjs/eslint-config-fusion | ---
+++
@@ -33,7 +33,7 @@
},
settings: {
react: {
- version: 'detect',
+ version: 'latest',
},
},
}; |
b40f8f9e76c3f1060e1f90661b0689069b518a86 | index.js | index.js | 'use strict';
const compiler = require('vueify').compiler;
const fs = require('fs');
class VueBrunch {
constructor(config) {
this.config = config && config.plugins && config.plugins.vue || {};
this.styles = {};
}
compile(file) {
if (this.config) {
compiler.applyConfig(this.config);
}
compiler.on('style', args => {
this.styles[args.file] = args.style;
});
return new Promise((resolve, reject) => {
compiler.compile(file.data, file.path, (error, result) => {
if (error) {
reject(error);
}
resolve(result);
});
});
}
onCompile() {
if (this.config.extractCSS) {
this.extractCSS();
}
}
extractCSS() {
var outPath = this.config.out || this.config.o || 'bundle.css';
var css = Object.keys(this.styles || [])
.map(file => this.styles[file])
.join('\n');
if (typeof outPath === 'object' && outPath.write) {
outPath.write(css);
outPath.end();
} else if (typeof outPath === 'string') {
fs.writeFileSync(outPath, css);
}
}
}
VueBrunch.prototype.brunchPlugin = true;
VueBrunch.prototype.type = 'template';
VueBrunch.prototype.extension = 'vue';
module.exports = VueBrunch;
| 'use strict';
const compiler = require('vueify').compiler;
const fs = require('fs');
class VueBrunch {
constructor(config) {
this.config = config && config.plugins && config.plugins.vue || {};
this.styles = {};
}
compile(file) {
if (this.config) {
compiler.applyConfig(this.config);
}
compiler.on('style', args => {
this.styles[args.file] = args.style;
});
return new Promise((resolve, reject) => {
compiler.compile(file.data, file.path, (error, result) => {
if (error) {
reject(error);
}
resolve(result);
});
});
}
onCompile() {
if (this.config.extractCSS) {
this.extractCSS();
}
}
extractCSS() {
var outPath = this.config.out || this.config.o || 'bundle.css';
var css = Object.keys(this.styles || [])
.map(file => this.styles[file])
.join('\n');
if (typeof outPath === 'object' && outPath.write) {
outPath.write(css);
outPath.end();
} else if (typeof outPath === 'string') {
fs.writeFileSync(outPath, css);
}
}
}
VueBrunch.prototype.brunchPlugin = true;
VueBrunch.prototype.type = 'javascript';
VueBrunch.prototype.extension = 'vue';
module.exports = VueBrunch;
| Set type to javascript to force JS compilation | Set type to javascript to force JS compilation
| JavaScript | mit | nblackburn/vue-brunch | ---
+++
@@ -54,7 +54,7 @@
}
VueBrunch.prototype.brunchPlugin = true;
-VueBrunch.prototype.type = 'template';
+VueBrunch.prototype.type = 'javascript';
VueBrunch.prototype.extension = 'vue';
module.exports = VueBrunch; |
b96ebaa28f23f209edf14c1707fa975fa98c8601 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-power-select',
included: function(appOrAddon) {
var app = appOrAddon.app || appOrAddon;
if (!app.__emberPowerSelectIncludedInvoked) {
app.__emberPowerSelectIncludedInvoked = true;
this._super.included.apply(this, arguments);
// Don't include the precompiled css file if the user uses ember-cli-sass
if (!app.registry.availablePlugins['ember-cli-sass']) {
var addonConfig = app.options['ember-power-select'];
if (!addonConfig || !addonConfig.theme) {
app.import('vendor/ember-power-select.css');
} else {
app.import('vendor/ember-power-select-'+addonConfig.theme+'.css');
}
}
}
},
contentFor: function(type, config) {
var emberBasicDropdown = this.addons.filter(function(addon) {
return addon.name === 'ember-basic-dropdown';
})[0]
return emberBasicDropdown.contentFor(type, config);
}
};
| /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-power-select',
included: function(appOrAddon) {
var app = appOrAddon.app || appOrAddon;
if (!app.__emberPowerSelectIncludedInvoked) {
app.__emberPowerSelectIncludedInvoked = true;
// Since ember-power-select styles already `@import` styles of ember-basic-dropdown,
// this flag tells to ember-basic-dropdown to skip importing its styles.
app.__skipEmberBasicDropdownStyles = true;
this._super.included.apply(this, arguments);
// Don't include the precompiled css file if the user uses ember-cli-sass
if (!app.registry.availablePlugins['ember-cli-sass']) {
var addonConfig = app.options['ember-power-select'];
if (!addonConfig || !addonConfig.theme) {
app.import('vendor/ember-power-select.css');
} else {
app.import('vendor/ember-power-select-'+addonConfig.theme+'.css');
}
}
}
},
contentFor: function(type, config) {
var emberBasicDropdown = this.addons.filter(function(addon) {
return addon.name === 'ember-basic-dropdown';
})[0]
return emberBasicDropdown.contentFor(type, config);
}
};
| Enable flag in first invocation to ensure ember-basic-dropdown doesn't include its styles | Enable flag in first invocation to ensure ember-basic-dropdown doesn't include its styles
| JavaScript | mit | chrisgame/ember-power-select,cibernox/ember-power-select,cibernox/ember-power-select,esbanarango/ember-power-select,Dremora/ember-power-select,esbanarango/ember-power-select,cibernox/ember-power-select,Dremora/ember-power-select,chrisgame/ember-power-select,cibernox/ember-power-select,esbanarango/ember-power-select | ---
+++
@@ -8,6 +8,11 @@
var app = appOrAddon.app || appOrAddon;
if (!app.__emberPowerSelectIncludedInvoked) {
app.__emberPowerSelectIncludedInvoked = true;
+
+ // Since ember-power-select styles already `@import` styles of ember-basic-dropdown,
+ // this flag tells to ember-basic-dropdown to skip importing its styles.
+ app.__skipEmberBasicDropdownStyles = true;
+
this._super.included.apply(this, arguments);
// Don't include the precompiled css file if the user uses ember-cli-sass
if (!app.registry.availablePlugins['ember-cli-sass']) { |
f878604de6113018d04662430ee413f33019e73e | index.js | index.js | var Sandbox = require('sandbox');
module.exports = exports = function(json, callback) {
// run the code in a sandbox to thwart evil people
var s = new Sandbox();
// in a self executing function set json equal to a variable and stringify the result
json = "(function() { var j ="+json+"; return JSON.stringify(j); })()";
s.run(json, function(output) {
//chop off the extra quotes
var out = output.result;
out = out.substring(1, out.length-1);
if (output.result[1] == '{') {
callback(null, out)
} else {
callback(out, null)
}
});
} | var Sandbox = require('sandbox');
module.exports = exports = function(json, callback) {
// run the code in a sandbox to thwart evil people
var s = new Sandbox();
// in a self executing function set json equal to a variable and stringify the result
json = "(function() { var j ="+json+"; return JSON.stringify(j); })()";
s.run(json, function(output) {
//chop off the extra quotes
var out = output.result;
out = out.substring(1, out.length-1);
if (output.result[1] == '{') {
callback(null, out) //no error as valid responses will start with a {
} else {
callback(out, null) //error
}
});
};
| Add better documentation to library | Add better documentation to library
| JavaScript | mit | TechplexEngineer/json_sanitizer | ---
+++
@@ -14,10 +14,10 @@
out = out.substring(1, out.length-1);
if (output.result[1] == '{') {
- callback(null, out)
+ callback(null, out) //no error as valid responses will start with a {
} else {
- callback(out, null)
+ callback(out, null) //error
}
});
-}
+}; |
55d5062f219f38bfddec8ef15d8f17c9b5140387 | index.js | index.js | import postcss from 'postcss';
const postcssFlexibility = postcss.plugin('postcss-flexibility', () => css => {
css.walkRules(rule => {
const isDisabled = rule.some(({prop, text}) =>
prop === '-js-display' || text === 'flexibility-disable'
);
if (!isDisabled) {
rule.walkDecls('display', decl => {
const {value} = decl;
if (value === 'flex') {
decl.cloneBefore({prop: '-js-display'});
}
});
}
});
});
export default postcssFlexibility;
| import postcss from 'postcss';
const postcssFlexibility = postcss.plugin('postcss-flexibility', () => css => {
css.walkRules(rule => {
const isDisabled = rule.some(({prop, text}) =>
prop === '-js-display' || text === 'flexibility-disable' || text === '! flexibility-disable'
);
if (!isDisabled) {
rule.walkDecls('display', decl => {
const {value} = decl;
if (value === 'flex') {
decl.cloneBefore({prop: '-js-display'});
}
});
}
});
});
export default postcssFlexibility;
| Add support for loud comments | Add support for loud comments | JavaScript | mit | nozebra/postcss-flexibility,7rulnik/postcss-flexibility | ---
+++
@@ -3,7 +3,7 @@
const postcssFlexibility = postcss.plugin('postcss-flexibility', () => css => {
css.walkRules(rule => {
const isDisabled = rule.some(({prop, text}) =>
- prop === '-js-display' || text === 'flexibility-disable'
+ prop === '-js-display' || text === 'flexibility-disable' || text === '! flexibility-disable'
);
if (!isDisabled) { |
ca0ba0848959d90e10c015a3046bb0de980c98af | index.js | index.js | module.exports = function (promise, timeout, opts) {
var Promise = promise.constructor;
var rejectWith = opts && opts.rejectWith;
var resolveWith = opts && opts.resolveWith;
var timer;
var timeoutPromise = new Promise(function (resolve, reject) {
timer = setTimeout(function () {
if (rejectWith !== void 0)
reject(rejectWith);
else
resolve(resolveWith);
}, timeout);
});
return Promise.race([timeoutPromise, promise])
.then(function (value) {
if (timer.unref) timer.unref();
return value;
}, function (error) {
if (timer.unref) timer.unref();
throw error;
});
};
| module.exports = function (promise, timeout, opts) {
var Promise = promise.constructor;
var rejectWith = opts && opts.rejectWith;
var resolveWith = opts && opts.resolveWith;
var timer;
var timeoutPromise = new Promise(function (resolve, reject) {
timer = setTimeout(function () {
if (rejectWith !== void 0)
reject(rejectWith);
else
resolve(resolveWith);
}, timeout);
});
return Promise.race([timeoutPromise, promise])
.then(function (value) {
// For browser support: timer.unref is only available in Node.
if (timer.unref) timer.unref();
return value;
}, function (error) {
// For browser support: timer.unref is only available in Node.
if (timer.unref) timer.unref();
throw error;
});
};
| Add comment for timer.unref check | Add comment for timer.unref check | JavaScript | mit | inikulin/time-limit-promise | ---
+++
@@ -15,9 +15,11 @@
return Promise.race([timeoutPromise, promise])
.then(function (value) {
+ // For browser support: timer.unref is only available in Node.
if (timer.unref) timer.unref();
return value;
}, function (error) {
+ // For browser support: timer.unref is only available in Node.
if (timer.unref) timer.unref();
throw error;
}); |
542184e39a2258637a94af2b16e7928172790e39 | index.js | index.js | var exec = require('child_process').exec;
var _ = require('lodash');
var Q = require('q');
function UrlToImage() {
var api = {};
api.render = function(url, file, opts) {
var def = Q.defer();
var args = [
__dirname + 'url-to-image.js',
url,
file,
opts.width,
opts.height
];
var execOpts = {
maxBuffer: Infinity
};
exec('phantomjs ' + args.join(' '), execOpts, function(err, stdout) {
def.resolve(err);
});
return def;
};
return api;
}
module.exports = UrlToImage; | var path = require('path');
var exec = require('child_process').exec;
var _ = require('lodash');
var Q = require('q');
function UrlToImage() {
var api = {};
api.render = function(url, file, opts) {
var def = Q.defer();
var args = [
path.join(__dirname, 'url-to-image.js'),
url,
file,
opts.width,
opts.height
];
var execOpts = {
maxBuffer: Infinity
};
exec('phantomjs ' + args.join(' '), execOpts, function(err, stdout) {
def.resolve(err);
});
return def;
};
return api;
}
module.exports = UrlToImage; | Fix to use node path module to join path | Fix to use node path module to join path
| JavaScript | mit | kimmobrunfeldt/url-to-image | ---
+++
@@ -1,3 +1,4 @@
+var path = require('path');
var exec = require('child_process').exec;
var _ = require('lodash');
var Q = require('q');
@@ -10,7 +11,7 @@
var def = Q.defer();
var args = [
- __dirname + 'url-to-image.js',
+ path.join(__dirname, 'url-to-image.js'),
url,
file,
opts.width, |
03438de28023ae1587ea583b0bc3fee85b15a2b5 | index.js | index.js | !function(mocha) {
'use strict';
//mocha.checkLeaks();
mocha.options.ignoreLeaks = true;
mocha.globals(['chai', 'BatchGl', 'mocha', 'BatchGlMocks']);
mocha.run();
}(mocha);
| !function(mocha) {
'use strict';
mocha.checkLeaks();
mocha.globals(['chai', 'BatchGl', 'mocha', 'BatchGlMocks']);
mocha.run();
}(mocha);
| Make Mocha check for leaks. | Make Mocha check for leaks.
| JavaScript | mit | reissbaker/batchgl,reissbaker/batchgl | ---
+++
@@ -1,8 +1,7 @@
!function(mocha) {
'use strict';
- //mocha.checkLeaks();
- mocha.options.ignoreLeaks = true;
+ mocha.checkLeaks();
mocha.globals(['chai', 'BatchGl', 'mocha', 'BatchGlMocks']);
mocha.run();
}(mocha); |
199c960612d904e6a46f8cb81be8cd468c7f7b48 | index.js | index.js | var gulp = require('gulp'),
react = require('gulp-react'),
gulpIf = require('gulp-if'),
uglify = require('gulp-uglify'),
_ = require('underscore'),
elixir = require('laravel-elixir'),
utilities = require('laravel-elixir/ingredients/commands/Utilities'),
notification = require('laravel-elixir/ingredients/commands/Notification');
elixir.extend('react', function (src, options) {
var config = this,
defaultOptions = {
debug: ! config.production,
srcDir: config.assetsDir + 'js',
output: config.jsOutput
};
options = _.extend(defaultOptions, options);
src = "./" + utilities.buildGulpSrc(src, options.srcDir);
options = _.extend(defaultOptions, options);
gulp.task('react', function () {
var onError = function(e) {
new notification().error(e, 'React Compilation Failed!');
this.emit('end');
};
return gulp.src(src)
.pipe(react(options)).on('error', onError)
.pipe(gulpIf(! options.debug, uglify()))
.pipe(gulp.dest(options.output))
.pipe(new notification().message('React Compiled!'));
});
this.registerWatcher('react', options.srcDir + '/**/*.js');
return this.queueTask('react');
});
| var gulp = require('gulp'),
react = require('gulp-react'),
gulpIf = require('gulp-if'),
uglify = require('gulp-uglify'),
_ = require('underscore'),
elixir = require('laravel-elixir'),
utilities = require('laravel-elixir/ingredients/commands/Utilities'),
notification = require('laravel-elixir/ingredients/commands/Notification');
elixir.extend('react', function (src, options) {
var config = this,
defaultOptions = {
debug: ! config.production,
srcDir: config.assetsDir + 'js',
output: config.jsOutput
};
options = _.extend(defaultOptions, options);
src = "./" + utilities.buildGulpSrc(src, options.srcDir);
options = _.extend(defaultOptions, options);
gulp.task('react', function () {
var onError = function(e) {
new notification().error(e, 'React Compilation Failed!');
this.emit('end');
};
return gulp.src(src)
.pipe(react(options)).on('error', onError)
.pipe(gulpIf(! options.debug, uglify()))
.pipe(gulp.dest(options.output))
.pipe(new notification().message('React Compiled!'));
});
this.registerWatcher('react', options.srcDir + '/**/*.js');
this.registerWatcher('react', options.srcDir + '/**/*.jsx');
return this.queueTask('react');
});
| Add watcher for jsx files. | Add watcher for jsx files. | JavaScript | mit | joecohens/laravel-elixir-react | ---
+++
@@ -36,6 +36,7 @@
});
this.registerWatcher('react', options.srcDir + '/**/*.js');
+ this.registerWatcher('react', options.srcDir + '/**/*.jsx');
return this.queueTask('react');
}); |
4452a7c909eb3d01223d974fb5374564b585f6cd | index.js | index.js | 'use strict';
const chalk = require('chalk');
const isRoot = require('is-root');
const isDocker = require('is-docker');
module.exports = message => {
const defaultMessage = chalk`
{red.bold You are not allowed to run this app with root permissions.}
If running without {bold sudo} doesn't work, you can either fix your permission problems or change where npm stores global packages by putting {bold ~/npm/bin} in your PATH and running:
{blue npm config set prefix ~/npm}
See: {underline https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md}`;
if (isRoot() && !isDocker()) {
console.error(message || defaultMessage);
process.exit(77); // eslint-disable-line unicorn/no-process-exit
}
};
| 'use strict';
const chalk = require('chalk');
const isRoot = require('is-root');
const isDocker = require('is-docker');
module.exports = message => {
const defaultMessage = chalk`
{red.bold You are not allowed to run this app with root permissions.}
If running without {bold sudo} doesn't work, you can either fix your permission problems or change where npm stores global packages by putting {bold ~/npm/bin} in your PATH and running:
{blue npm config set prefix ~/npm}
See: {underline https://github.com/sindresorhus/guides/blob/main/npm-global-without-sudo.md}`;
if (isRoot() && !isDocker()) {
console.error(message || defaultMessage);
process.exit(77); // eslint-disable-line unicorn/no-process-exit
}
};
| Rename `master` branch to `main` | Rename `master` branch to `main`
| JavaScript | mit | sindresorhus/sudo-block,sindresorhus/sudo-block | ---
+++
@@ -9,7 +9,7 @@
If running without {bold sudo} doesn't work, you can either fix your permission problems or change where npm stores global packages by putting {bold ~/npm/bin} in your PATH and running:
{blue npm config set prefix ~/npm}
-See: {underline https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md}`;
+See: {underline https://github.com/sindresorhus/guides/blob/main/npm-global-without-sudo.md}`;
if (isRoot() && !isDocker()) {
console.error(message || defaultMessage); |
65f347df72317e2d14c131e3d1f655648a96390f | index.js | index.js | 'use strict';
module.exports = class TCache {
constructor(tag) {
this.tag = tag;
this._tasks = [];
this._fetching = false;
}
_run() {
this._fetching = true;
let firstTask = this._tasks[0];
firstTask[0](...firstTask.slice(1,-1), (err, result) => {
let curTask;
while (curTask = this._tasks.shift()) {
setImmediate(curTask.slice(-1)[0], err, result);
}
this._fetching = false;
});
}
push(func, ...args) {
if (typeof func !== 'function' ||
typeof args.slice(-1)[0] !== 'function') {
return false;
}
this._tasks.push([func, ...args]);
if (!this._fetching) this._run();
return true;
}
}
| 'use strict';
module.exports = class TCache {
constructor(tag) {
this.tag = tag;
this._tasks = [];
this._fetching = false;
}
get size() {
return this._tasks.length;
}
_run() {
this._fetching = true;
let firstTask = this._tasks[0];
firstTask[0](...firstTask.slice(1,-1), (err, result) => {
let curTask;
while (curTask = this._tasks.shift()) {
setImmediate(curTask.slice(-1)[0], err, result);
}
this._fetching = false;
});
}
push(func, ...args) {
if (typeof func !== 'function' ||
typeof args.slice(-1)[0] !== 'function') {
return false;
}
this._tasks.push([func, ...args]);
if (!this._fetching) this._run();
return true;
}
}
| Add getter of the size of total tasks. | Add getter of the size of total tasks.
| JavaScript | mit | Kevin-Xi/throttle-memo | ---
+++
@@ -6,6 +6,10 @@
this._tasks = [];
this._fetching = false;
+ }
+
+ get size() {
+ return this._tasks.length;
}
_run() { |
45fc2acf3cac89556e2534642e127846bedf9566 | index.js | index.js | var cookie = require('cookie');
var _cookies = cookie.parse((document && document.cookie) ? document.cookie : '');
for (var key in _cookies) {
try {
_cookies[key] = JSON.parse(_cookies[key]);
} catch(e) {
// Not serialized object
}
}
function load(name) {
return _cookies[name];
}
function save(name, val, opt) {
// Cookies only work in the browser
if (!document || !document.cookie) return;
_cookies[name] = val;
document.cookie = cookie.serialize(name, val, opt);
}
var reactCookie = {
load: load,
save: save
};
if (typeof module !== 'undefined') {
module.exports = reactCookie
}
if (typeof window !== 'undefined') {
window['reactCookie'] = reactCookie;
} | var cookie = require('cookie');
var _cookies = cookie.parse((typeof document !== 'undefined') ? document.cookie : '');
for (var key in _cookies) {
try {
_cookies[key] = JSON.parse(_cookies[key]);
} catch(e) {
// Not serialized object
}
}
function load(name) {
return _cookies[name];
}
function save(name, val, opt) {
_cookies[name] = val;
// Cookies only work in the browser
if (typeof document === 'undefined') return;
document.cookie = cookie.serialize(name, val, opt);
}
var reactCookie = {
load: load,
save: save
};
if (typeof module !== 'undefined') {
module.exports = reactCookie
}
if (typeof window !== 'undefined') {
window['reactCookie'] = reactCookie;
} | Fix the document undefined check | Fix the document undefined check
| JavaScript | mit | eXon/react-cookie,ChrisCinelli/react-cookie-async,reactivestack/cookies,xpepermint/react-cookie,reactivestack/cookies,reactivestack/cookies | ---
+++
@@ -1,6 +1,6 @@
var cookie = require('cookie');
-var _cookies = cookie.parse((document && document.cookie) ? document.cookie : '');
+var _cookies = cookie.parse((typeof document !== 'undefined') ? document.cookie : '');
for (var key in _cookies) {
try {
@@ -15,10 +15,11 @@
}
function save(name, val, opt) {
+ _cookies[name] = val;
+
// Cookies only work in the browser
- if (!document || !document.cookie) return;
-
- _cookies[name] = val;
+ if (typeof document === 'undefined') return;
+
document.cookie = cookie.serialize(name, val, opt);
}
|
0a058c8b02653b15565e309d48fde545242d0ec5 | index.js | index.js | /**
* Remove node_modules/hydro/ entries from the
* error stacks.
*
* @param {Object} hydro
* @api public
*/
module.exports = function(hydro) {
if (!hydro.get('cleanStacks')) return;
hydro.on('post:test', function(test) {
if (test.status !== 'failed') return;
var stack = test.error.stack.split('\n').filter(function(line) {
return line.indexOf('node_modules/hydro') === -1;
});
test.error.stack = stack.join('\n');
});
};
/**
* CLI flags.
*/
module.exports.flags = {
'--clean-stacks': 'remove hydro entries from error stacks'
};
| /**
* Remove node_modules/hydro/ entries from the
* error stacks.
*
* @param {Object} hydro
* @api public
*/
module.exports = function(hydro) {
if (!hydro.get('cleanStacks')) return;
hydro.on('post:test', function(test) {
if (test.status !== 'failed') return;
if (!test.error.stack) return;
var stack = test.error.stack.split('\n').filter(function(line) {
return line.indexOf('node_modules/hydro') === -1;
});
test.error.stack = stack.join('\n');
});
};
/**
* CLI flags.
*/
module.exports.flags = {
'--clean-stacks': 'remove hydro entries from error stacks'
};
| Handle errors without a stack | Handle errors without a stack | JavaScript | mit | hydrojs/clean-stacks | ---
+++
@@ -11,6 +11,7 @@
hydro.on('post:test', function(test) {
if (test.status !== 'failed') return;
+ if (!test.error.stack) return;
var stack = test.error.stack.split('\n').filter(function(line) {
return line.indexOf('node_modules/hydro') === -1;
}); |
8fe74297557c873cbece865373adaa7b1a739c1b | index.js | index.js | var hyperglue = require('hyperglue');
module.exports = function (html, data, scope) {
var keys = Object.keys(data),
_data = {},
_key = typeof scope !== 'undefined' ? scope + ' ' : '',
k;
for (k in keys) {
_key += '[data-bind=' + keys[k] + ']';
_data[_key] = data[keys[k]];
}
return hyperglue(html, _data);
};
| var hyperglue = require('hyperglue');
module.exports = function (html, data, scope) {
var keys = Object.keys(data),
_data = {},
_key = typeof scope !== 'undefined' ? scope + ' ' : '',
selector,
k;
for (k in keys) {
selector = _key + '[data-bind=' + keys[k] + ']';
_data[selector] = data[keys[k]];
}
return hyperglue(html, _data);
};
| Fix issue w/ building hyperglue selector data-bind selector | Fix issue w/ building hyperglue selector data-bind selector
| JavaScript | mit | derekr/hypergluten,derekr/hypergluten | ---
+++
@@ -4,11 +4,12 @@
var keys = Object.keys(data),
_data = {},
_key = typeof scope !== 'undefined' ? scope + ' ' : '',
+ selector,
k;
for (k in keys) {
- _key += '[data-bind=' + keys[k] + ']';
- _data[_key] = data[keys[k]];
+ selector = _key + '[data-bind=' + keys[k] + ']';
+ _data[selector] = data[keys[k]];
}
return hyperglue(html, _data); |
962be4f730dbc050f4fb706e28ff545aaf7dcee6 | karma.conf.js | karma.conf.js | // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ config.watch ? 'html' : 'text-summary', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 8081,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox'],
},
},
singleRun: false
});
};
| // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ config.watch ? 'html' : 'text-summary', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 8081,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--headless'],
},
},
singleRun: false
});
};
| Use Chrome in headless mode | Use Chrome in headless mode
| JavaScript | bsd-3-clause | cumulous/web,cumulous/web,cumulous/web,cumulous/web | ---
+++
@@ -38,11 +38,11 @@
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
- browsers: ['ChromeNoSandbox'],
+ browsers: ['ChromeHeadless'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
- flags: ['--no-sandbox'],
+ flags: ['--headless'],
},
},
singleRun: false |
9ee8605af644bd9b6489d8b648247730c9569750 | test/integration/index.js | test/integration/index.js | 'use strict'
var childProcess = require('child_process')
childProcess.exec('./index.js', function onBoot (err) {
if (err) {
throw err
}
})
| 'use strict'
var childProcess = require('child_process')
var path = require('path')
var assert = require('chai').assert
var TREAD = path.join(process.cwd(), 'index.js')
var proc = childProcess.fork(TREAD, ['-h'])
proc.on('error', function onError (error) {
assert.fail(error)
})
proc.on('exit', function onExit (code, signal) {
assert.equal(code, 0, 'should exit 0')
assert.isNull(signal, 'should not have exit signal')
})
| Add assertions to integration tests | Add assertions to integration tests
| JavaScript | isc | wraithan/tread | ---
+++
@@ -1,9 +1,18 @@
'use strict'
var childProcess = require('child_process')
+var path = require('path')
+var assert = require('chai').assert
-childProcess.exec('./index.js', function onBoot (err) {
- if (err) {
- throw err
- }
+var TREAD = path.join(process.cwd(), 'index.js')
+
+var proc = childProcess.fork(TREAD, ['-h'])
+
+proc.on('error', function onError (error) {
+ assert.fail(error)
})
+
+proc.on('exit', function onExit (code, signal) {
+ assert.equal(code, 0, 'should exit 0')
+ assert.isNull(signal, 'should not have exit signal')
+}) |
79a9b0b41691d545526d75a70636ad24c927400d | index.js | index.js | var DS = require('dslink');
var Increment = DS.createNode({
onInvoke: function(columns) {
// TODO: Support for columns.amount, requires bugfix.
var previous = link.getNode('/counter').lastValueUpdate.value;
link.getNode('/counter').updateValue(previous + 1);
}
});
// Process the arguments and initializes the default nodes.
var link = new DS.LinkProvider(process.argv.slice(2), 'javascript-template-', {
defaultNodes: {
counter: {
$type: 'int',
'?value': 0
},
increment: {
// references the increment profile, which makes this node an instance of
// our Increment class
$is: 'increment',
$invokable: 'write',
$columns: [
{
name: 'amount',
type: 'int',
default: 1
}
]
}
},
profiles: {
increment: function(path) {
return new Increment(path);
}
}
});
// Connect to the broker.
// link.connect() returns a Promise.
link.connect().catch(function(e) {
console.log(e.stack);
});
| var DS = require('dslink');
// creates a node with an action on it
var Increment = DS.createNode({
onInvoke: function(columns) {
// get current value of the link
var previous = link.getNode('/counter').lastValueUpdate.value;
// set new value by adding an amount to the previous amount
link.getNode('/counter').updateValue(previous + parseInt(columns.amount));
}
});
// Process the arguments and initializes the default nodes.
var link = new DS.LinkProvider(process.argv.slice(2), 'javascript-template-', {
defaultNodes: {
// counter is a value node, it holds the value of our counter
counter: {
$type: 'int',
'?value': 0
},
// increment is an action node, it will increment /counter
// by the specified amount
increment: {
// references the increment profile, which makes this node an instance of
// our Increment class
$is: 'increment',
$invokable: 'write',
// $params is the parameters that are passed to onInvoke
$params: [
{
name: 'amount',
type: 'int',
default: 1
}
]
}
},
// register our custom node here as a profile
// when we use $is with increment, it
// creates our Increment node
profiles: {
increment: function(path) {
return new Increment(path);
}
}
});
// Connect to the broker.
// link.connect() returns a Promise.
link.connect().catch(function(e) {
console.log(e.stack);
});
| Update template, add more examples. | Update template, add more examples.
| JavaScript | apache-2.0 | IOT-DSA/dslink-javascript-template | ---
+++
@@ -1,26 +1,33 @@
var DS = require('dslink');
+// creates a node with an action on it
var Increment = DS.createNode({
onInvoke: function(columns) {
- // TODO: Support for columns.amount, requires bugfix.
+ // get current value of the link
var previous = link.getNode('/counter').lastValueUpdate.value;
- link.getNode('/counter').updateValue(previous + 1);
+
+ // set new value by adding an amount to the previous amount
+ link.getNode('/counter').updateValue(previous + parseInt(columns.amount));
}
});
// Process the arguments and initializes the default nodes.
var link = new DS.LinkProvider(process.argv.slice(2), 'javascript-template-', {
defaultNodes: {
+ // counter is a value node, it holds the value of our counter
counter: {
$type: 'int',
'?value': 0
},
+ // increment is an action node, it will increment /counter
+ // by the specified amount
increment: {
// references the increment profile, which makes this node an instance of
// our Increment class
$is: 'increment',
$invokable: 'write',
- $columns: [
+ // $params is the parameters that are passed to onInvoke
+ $params: [
{
name: 'amount',
type: 'int',
@@ -29,6 +36,9 @@
]
}
},
+ // register our custom node here as a profile
+ // when we use $is with increment, it
+ // creates our Increment node
profiles: {
increment: function(path) {
return new Increment(path); |
cf0b212970d20fc9765f3098e98bf03e485965f6 | index.js | index.js | var uuid = require('uuid')
var blessThisCode = function(){
var blessingId = uuid.v4()
var blessing = `Blessing ID #${blessingId}: Our blessings are with you.`
return blessing
}
exports.blessThisCode = blessThisCode | var uuid = require('uuid')
var blessThisCode = function(){
var blessingId = uuid.v4()
var blessing = `Blessing ID #${blessingId}: Our blessings are with you.`
return blessing
}
var isCodeBlessed = function(){
return true
}
exports.blessThisCode = blessThisCode
exports.isCodeBlessed = isCodeBlessed
| Add method to return current code blessing status | Add method to return current code blessing status
| JavaScript | mit | rudimk/dua.js | ---
+++
@@ -6,4 +6,9 @@
return blessing
}
+var isCodeBlessed = function(){
+ return true
+}
+
exports.blessThisCode = blessThisCode
+exports.isCodeBlessed = isCodeBlessed |
74b82a74f7aa4625ab3b240398a93f164df1cfa4 | test/src/mocha/elmTest.js | test/src/mocha/elmTest.js | var expect = require('chai').expect;
var count = require('count-substring');
var htmlToText = require('html-to-text');
module.exports = function (browser) {
describe("The tests written in Elm", function () {
it('should pass', function () {
return browser
.url('http://localhost:8080/elm.html')
.waitUntil(function () {
return this.getHTML("#results").then(function (html) {
var passedCount = count(html, "All tests passed");
var failedCount = count(html, "FAILED");
if (passedCount > 0) {
return true;
}
if (failedCount > 0) {
console.log("Failed!\n");
console.log(htmlToText.fromString(html));
throw "Failed tests written in Elm";
}
return false;
});
}, 10000, 500);
});
});
};
| var expect = require('chai').expect;
var count = require('count-substring');
module.exports = function (browser) {
describe("The tests written in Elm", function () {
it('should pass', function () {
return browser
.url('http://localhost:8080/elm.html')
.waitUntil(function () {
return this.getText("#results").then(function (text) {
return text.indexOf("suites run") > 0;
});
}, 10000, 500)
.getText("#results")
.then(function (text) {
var failedCount = count(text, "FAILED");
if (failedCount != 0) console.log(text);
expect(failedCount).to.equal(0);
});
});
});
};
| Simplify checking to see if Elm tests have passed. | Simplify checking to see if Elm tests have passed.
| JavaScript | mit | rgrempel/elm-web-api,rgrempel/elm-web-api | ---
+++
@@ -1,6 +1,5 @@
var expect = require('chai').expect;
var count = require('count-substring');
-var htmlToText = require('html-to-text');
module.exports = function (browser) {
describe("The tests written in Elm", function () {
@@ -8,24 +7,16 @@
return browser
.url('http://localhost:8080/elm.html')
.waitUntil(function () {
- return this.getHTML("#results").then(function (html) {
- var passedCount = count(html, "All tests passed");
- var failedCount = count(html, "FAILED");
-
- if (passedCount > 0) {
- return true;
- }
-
- if (failedCount > 0) {
- console.log("Failed!\n");
- console.log(htmlToText.fromString(html));
-
- throw "Failed tests written in Elm";
- }
-
- return false;
+ return this.getText("#results").then(function (text) {
+ return text.indexOf("suites run") > 0;
});
- }, 10000, 500);
+ }, 10000, 500)
+ .getText("#results")
+ .then(function (text) {
+ var failedCount = count(text, "FAILED");
+ if (failedCount != 0) console.log(text);
+ expect(failedCount).to.equal(0);
+ });
});
});
}; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.