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 |
|---|---|---|---|---|---|---|---|---|---|---|
bab8097c98d3d07b10ab096b9445f8585f416e69 | app/components/dashboard/unified-view/component.js | app/components/dashboard/unified-view/component.js | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout,
store: Ember.inject.service(),
internalState: Ember.inject.service(),
leftTitle: null,
leftView: null,
leftPanelColor: null,
leftModel: null,
rightTitle: null,
rightView: null,
rightPanelColor: null,
init() {
this._super(...arguments);
console.log("Left View = " + this.get("leftView"));
console.log("Right View = " + this.get("rightView"));
},
didRender() {
},
actions: {
onLeftModelChange: function (model) {
this.set("leftModel", model);
},
taleLaunched: function() {
// TODO convert this interaction to use the wholetale events service instead
// Update model and test if the interface updates automatically
let self = this;
this.get('store').unloadAll('instance');
this.get('store').findAll('instance', { reload: true, adapterOptions: { queryParams:{sort: "created", sortdir: "-1", limit: "0"}} })
.then(models => {
self.set('rightModelTop', models);
});
},
}
});
| import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout,
store: Ember.inject.service(),
internalState: Ember.inject.service(),
leftTitle: null,
leftView: null,
leftPanelColor: null,
leftModel: null,
rightTitle: null,
rightView: null,
rightPanelColor: null,
init() {
this._super(...arguments);
console.log("Left View = " + this.get("leftView"));
console.log("Right View = " + this.get("rightView"));
},
didRender() {
},
actions: {
onLeftModelChange: function (model) {
this.set("leftModel", model);
},
taleLaunched: function() {
// TODO convert this interaction to use the wt-events service instead
// Update right panel models
let self = this;
// NOTE: using store.query here as a work around to disable store.findAll caching
this.get('store').query('instance', {})
.then(models => {
self.set('rightModelTop', models);
});
},
}
});
| Update work around for disabling store caching | Update work around for disabling store caching
| JavaScript | mit | whole-tale/dashboard,whole-tale/dashboard,whole-tale/dashboard | ---
+++
@@ -30,11 +30,11 @@
this.set("leftModel", model);
},
taleLaunched: function() {
- // TODO convert this interaction to use the wholetale events service instead
- // Update model and test if the interface updates automatically
+ // TODO convert this interaction to use the wt-events service instead
+ // Update right panel models
let self = this;
- this.get('store').unloadAll('instance');
- this.get('store').findAll('instance', { reload: true, adapterOptions: { queryParams:{sort: "created", sortdir: "-1", limit: "0"}} })
+ // NOTE: using store.query here as a work around to disable store.findAll caching
+ this.get('store').query('instance', {})
.then(models => {
self.set('rightModelTop', models);
}); |
e4bdc029ca5e0345077de8fd2620638f30b20eee | lib/cli.js | lib/cli.js | /**
* Terminal client for the Ma3Route REST API
*/
"use strict";
// npm-installed modules
var decamelize = require("decamelize");
var parser = require("simple-argparse");
// own modules
var lib = require(".");
var pkg = require("../package.json");
parser
.version(pkg.version)
.description("ma3route", "terminal client for the Ma3Route REST API v2")
.epilog("See https://github.com/GochoMugo/ma3route-cli for source code and license")
.option("c", "config", "run configuration setup", lib.config.run)
.prerun(function() {
if (this.debug) {
process.env.DEBUG = process.env.DEBUG || 1;
delete this.debug;
}
});
// add options
for (var name in lib.options) {
var option = lib.options[name];
parser.option(option.descriptor.short, decamelize(name, "-"), option.description, option.run);
}
parser.parse();
| /**
* Terminal client for the Ma3Route REST API
*/
"use strict";
// npm-installed modules
var decamelize = require("decamelize");
var parser = require("simple-argparse");
// own modules
var lib = require("../lib");
var pkg = require("../package.json");
parser
.version(pkg.version)
.description("ma3route", "terminal client for the Ma3Route REST API v2")
.epilog("See https://github.com/GochoMugo/ma3route-cli for source code and license")
.option("c", "config", "run configuration setup", lib.config.run)
.prerun(function() {
if (this.debug) {
process.env.DEBUG = process.env.DEBUG || 1;
delete this.debug;
}
});
// add options
for (var name in lib.options) {
var option = lib.options[name];
parser.option(option.descriptor.short, decamelize(name, "-"), option.description, option.run);
}
parser.parse();
| Add backwards compatibility for Node 0.x series | Add backwards compatibility for Node 0.x series
| JavaScript | mit | GochoMugo/ma3route-cli | ---
+++
@@ -12,7 +12,7 @@
// own modules
-var lib = require(".");
+var lib = require("../lib");
var pkg = require("../package.json");
|
0cca0f1f63b05f4a61696e97a14b95add3538129 | src/addable.js | src/addable.js | udefine(function() {
return function(Factory, groupInstance) {
return function() {
var child = arguments[0];
var args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
if (!( child instanceof Factory)) {
if ( typeof child === 'string') {
if (Object.hasOwnProperty.call(store, child)) {
child = new Factory(Factory.store[child], args);
}
} else {
child = new Factory(child, args);
}
}
groupInstance.push(child);
child.parent = this;
child.trigger('add', child, args);
};
};
});
| udefine(function() {
return function(Factory, groupInstance) {
return function() {
var child = arguments[0];
var args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
if (!( child instanceof Factory)) {
if ( typeof child === 'string') {
if (Object.hasOwnProperty.call(store, child)) {
child = new Factory(Factory.store[child]);
}
} else {
child = new Factory(child);
}
}
groupInstance.push(child);
child.parent = this;
child.apply(args);
child.trigger('add', child, args);
};
};
});
| Call descriptor when a child is added | Call descriptor when a child is added
| JavaScript | mit | freezedev/flockn,freezedev/flockn | ---
+++
@@ -8,14 +8,16 @@
if (!( child instanceof Factory)) {
if ( typeof child === 'string') {
if (Object.hasOwnProperty.call(store, child)) {
- child = new Factory(Factory.store[child], args);
+ child = new Factory(Factory.store[child]);
}
} else {
- child = new Factory(child, args);
+ child = new Factory(child);
}
}
groupInstance.push(child);
child.parent = this;
+
+ child.apply(args);
child.trigger('add', child, args);
};
}; |
98cd42daefdafef5d0125ca33b8fca73905cb621 | app/core/directives/ext-href.js | app/core/directives/ext-href.js | /* global angular */
angular.module('app')
.directive('extHref', function (platformInfo) {
'use strict';
return {
restrict: 'A',
link: link
};
function link(scope, element, attributes) {
const url = attributes.extHref;
if (platformInfo.isCordova) {
element[0].onclick = onclick;
} else {
element[0].href = url;
}
function onclick() {
window.open(url, '_system');
return false;
}
}
});
| /* global angular, require */
angular.module('app')
.directive('extHref', function (platformInfo) {
'use strict';
return {
restrict: 'A',
link: link
};
function link(scope, element, attributes) {
const url = attributes.extHref;
element[0].onclick = () => {
if (platformInfo.isCordova) {
window.open(url, '_system');
} else {
require('electron').shell.openExternal(url);
}
return false;
};
}
});
| Clean up, and use electron functions to open urls | Clean up, and use electron functions to open urls
| JavaScript | agpl-3.0 | johansten/stargazer,johansten/stargazer,johansten/stargazer | ---
+++
@@ -1,4 +1,4 @@
-/* global angular */
+/* global angular, require */
angular.module('app')
.directive('extHref', function (platformInfo) {
@@ -10,16 +10,15 @@
};
function link(scope, element, attributes) {
+
const url = attributes.extHref;
- if (platformInfo.isCordova) {
- element[0].onclick = onclick;
- } else {
- element[0].href = url;
- }
-
- function onclick() {
- window.open(url, '_system');
+ element[0].onclick = () => {
+ if (platformInfo.isCordova) {
+ window.open(url, '_system');
+ } else {
+ require('electron').shell.openExternal(url);
+ }
return false;
- }
+ };
}
}); |
3a111bbc81c4a424b002b0ec00f473c4451097f0 | app/controllers/settings/theme/uploadtheme.js | app/controllers/settings/theme/uploadtheme.js | import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
export default class UploadThemeController extends Controller {
@service config;
get isAllowed() {
return !this.config.get('hostSettings')?.limits?.customThemes;
}
}
| import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
export default class UploadThemeController extends Controller {
@service config;
get isAllowed() {
return (!this.config.get('hostSettings')?.limits?.customThemes) || this.config.get('hostSettings').limits.customThemes.disabled;
}
}
| Fix UploadThemeController to support disable:true customThemes flag | Fix UploadThemeController to support disable:true customThemes flag
no issue
| JavaScript | mit | TryGhost/Ghost-Admin,TryGhost/Ghost-Admin | ---
+++
@@ -5,6 +5,6 @@
@service config;
get isAllowed() {
- return !this.config.get('hostSettings')?.limits?.customThemes;
+ return (!this.config.get('hostSettings')?.limits?.customThemes) || this.config.get('hostSettings').limits.customThemes.disabled;
}
} |
e5f1a0e1bd72d7f48a263532d18a4564bdf6d4b9 | client/templates/register/registrant/registrant.js | client/templates/register/registrant/registrant.js | Template.registrantDetails.helpers({
'registrationTypeOptions': function () {
// registration types used on the registration form
return [
{label: "Commuter", value: "commuter"},
{label: "Daily", value: "daily"},
{label: "Full Week", value: "weekly"}
];
}
});
Template.registrantDetails.events({
'change #registration_type': function () {
// clean up form values for accommodations and days
// to make sure no erroneous values remain
resetReactiveVars();
// Clear the accommodations selection
$("#accommodations").val("");
// Clear all day checkboxes
$('input[name="days"]').each(function() {
// make sure day is not checked
this.checked = false;
});
},
'change #age': function () {
// Get the value of the age field
var ageValue = $('#age').val();
// Calculate the age group based on the age value
var ageGroup = calculateAgeGroup(ageValue);
// Reset the accommodations selection
// as accommodations depend on age group
$("#accommodations").val("");
// Set the age group reactive variable
// for price calculations
ageGroupVar.set(ageGroup);
}
});
| Template.registrantDetails.helpers({
'registrationTypeOptions': function () {
// registration types used on the registration form
return [
{label: "Commuter", value: "commuter"},
{label: "Daily", value: "daily"},
{label: "Full Week", value: "weekly"}
];
},
/*
Determine if registrant is school aged
by checking age group
return true if age group is child, youth, or teen
*/
'schoolAgeGroup': function () {
var ageGroup = ageGroupVar.get();
// look at the value of age group
switch (ageGroup) {
// if child, youth or teen
// return true
case 'child':
return true;
break;
case 'youth':
return true;
break;
case 'teen':
return true;
break;
default:
return false;
break;
};
}
});
Template.registrantDetails.events({
'change #registration_type': function () {
// clean up form values for accommodations and days
// to make sure no erroneous values remain
resetReactiveVars();
// Clear the accommodations selection
$("#accommodations").val("");
// Clear all day checkboxes
$('input[name="days"]').each(function() {
// make sure day is not checked
this.checked = false;
});
},
'change #age': function () {
// Get the value of the age field
var ageValue = $('#age').val();
// Calculate the age group based on the age value
var ageGroup = calculateAgeGroup(ageValue);
// Reset the accommodations selection
// as accommodations depend on age group
$("#accommodations").val("");
// Set the age group reactive variable
// for price calculations
ageGroupVar.set(ageGroup);
}
});
| Add school age group template helper. | Add school age group template helper.
| JavaScript | agpl-3.0 | quaker-io/pym-online-registration,quaker-io/pym-online-registration,quaker-io/pym-2015,quaker-io/pym-2015 | ---
+++
@@ -6,6 +6,32 @@
{label: "Daily", value: "daily"},
{label: "Full Week", value: "weekly"}
];
+ },
+ /*
+ Determine if registrant is school aged
+ by checking age group
+ return true if age group is child, youth, or teen
+ */
+ 'schoolAgeGroup': function () {
+ var ageGroup = ageGroupVar.get();
+
+ // look at the value of age group
+ switch (ageGroup) {
+ // if child, youth or teen
+ // return true
+ case 'child':
+ return true;
+ break;
+ case 'youth':
+ return true;
+ break;
+ case 'teen':
+ return true;
+ break;
+ default:
+ return false;
+ break;
+ };
}
});
|
63d2a9cd58d424f13a38e8a078f37f64565a2771 | components/dashboards-web-component/jest.config.js | components/dashboards-web-component/jest.config.js | /*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
module.exports = {
verbose: true,
testRegex: 'test/.*\\.(js|jsx)$',
};
| /*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
module.exports = {
verbose: true,
testRegex: 'test/(.+)(.test.)(js|jsx)$',
moduleDirectories: ['node_modules', '<rootDir>'],
};
| Set test regex to select only *.test.js/jsx files in the test directory. | Set test regex to select only *.test.js/jsx files in the test directory.
And add the root directory as a module directory so that file imports
will be absolute.
| JavaScript | apache-2.0 | wso2/carbon-dashboards,ksdperera/carbon-dashboards,lasanthaS/carbon-dashboards,wso2/carbon-dashboards,ksdperera/carbon-dashboards,ksdperera/carbon-dashboards,lasanthaS/carbon-dashboards,lasanthaS/carbon-dashboards | ---
+++
@@ -18,5 +18,6 @@
module.exports = {
verbose: true,
- testRegex: 'test/.*\\.(js|jsx)$',
+ testRegex: 'test/(.+)(.test.)(js|jsx)$',
+ moduleDirectories: ['node_modules', '<rootDir>'],
}; |
1f7a5c9aa26d4752336fb5cd9e651f52c0d72253 | module/javascript/module.js | module/javascript/module.js | forge['contact'] = {
'select': function (success, error) {
forge.internal.call("contact.select", {}, success, error);
},
'selectById': function (id, success, error) {
forge.internal.call("contact.selectById", {id: id}, success, error);
},
'selectAll': function (fields, success, error) {
if (typeof fields === "function") {
error = success;
success = fields;
fields = [];
}
forge.internal.call("contact.selectAll", {fields: fields}, success, error);
},
'add': function (contact, success, error) {
if (typeof contact === "function") {
error = success;
success = contact;
contact = {};
}
forge.internal.call("contact.add", {contact: contact}, success, error);
},
'insert': function (contact, success, error) {
forge.internal.call("contact.insert", {contact: contact},
success, error);
}
};
| /* global forge */
forge['contact'] = {
'select': function (success, error) {
forge.internal.call("contact.select", {}, success, error);
},
'selectById': function (id, success, error) {
forge.internal.call("contact.selectById", {id: id}, success, error);
},
'selectAll': function (fields, success, error) {
if (typeof fields === "function") {
error = success;
success = fields;
fields = [];
}
forge.internal.call("contact.selectAll", {fields: fields}, success, error);
},
'add': function (contact, success, error) {
if (typeof contact === "function") {
error = success;
success = contact;
contact = {};
}
contact = JSON.parse(JSON.stringify(contact, function (k, v) { return v ==null ? undefined : v; }));
forge.internal.call("contact.add", {contact: contact}, success, error);
},
'insert': function (contact, success, error) {
contact = JSON.parse(JSON.stringify(contact, function (k, v) { return v ==null ? undefined : v; }));
forge.internal.call("contact.insert", {contact: contact},
success, error);
}
};
| Test failure on iOS13 when adding contacts with null property fields. | Fixed: Test failure on iOS13 when adding contacts with null property fields.
| JavaScript | bsd-2-clause | trigger-corp/trigger.io-contact,trigger-corp/trigger.io-contact | ---
+++
@@ -1,29 +1,33 @@
+/* global forge */
+
forge['contact'] = {
- 'select': function (success, error) {
- forge.internal.call("contact.select", {}, success, error);
- },
- 'selectById': function (id, success, error) {
- forge.internal.call("contact.selectById", {id: id}, success, error);
- },
- 'selectAll': function (fields, success, error) {
- if (typeof fields === "function") {
- error = success;
- success = fields;
- fields = [];
- }
- forge.internal.call("contact.selectAll", {fields: fields}, success, error);
- },
- 'add': function (contact, success, error) {
- if (typeof contact === "function") {
- error = success;
- success = contact;
- contact = {};
- }
- forge.internal.call("contact.add", {contact: contact}, success, error);
- },
+ 'select': function (success, error) {
+ forge.internal.call("contact.select", {}, success, error);
+ },
+ 'selectById': function (id, success, error) {
+ forge.internal.call("contact.selectById", {id: id}, success, error);
+ },
+ 'selectAll': function (fields, success, error) {
+ if (typeof fields === "function") {
+ error = success;
+ success = fields;
+ fields = [];
+ }
+ forge.internal.call("contact.selectAll", {fields: fields}, success, error);
+ },
+ 'add': function (contact, success, error) {
+ if (typeof contact === "function") {
+ error = success;
+ success = contact;
+ contact = {};
+ }
+ contact = JSON.parse(JSON.stringify(contact, function (k, v) { return v ==null ? undefined : v; }));
+ forge.internal.call("contact.add", {contact: contact}, success, error);
+ },
- 'insert': function (contact, success, error) {
- forge.internal.call("contact.insert", {contact: contact},
- success, error);
- }
+ 'insert': function (contact, success, error) {
+ contact = JSON.parse(JSON.stringify(contact, function (k, v) { return v ==null ? undefined : v; }));
+ forge.internal.call("contact.insert", {contact: contact},
+ success, error);
+ }
}; |
a96bd4f6c0063039b96d6e332fa6556b6f26d3ec | app/services/additional-data.js | app/services/additional-data.js | import Service from '@ember/service';
import Evented from '@ember/object/evented';
export default Service.extend(Evented, {
showWindow: false,
shownComponents: null,
popupContent: null,
addComponent(path) {
if (this.get('shownComponents') == null) {
this.set('shownComponents', []);
}
if (!this.get('shownComponents').includes(path)) {
this.get('shownComponents').push(path);
this.notifyPropertyChange('shownComponents');
}
},
removeComponent(path) {
if (!this.get('shownComponents'))
return;
var index = this.get('shownComponents').indexOf(path);
if (index !== -1){
this.get('shownComponents').splice(index, 1);
this.notifyPropertyChange('shownComponents');
}
// close everything when no components are left
if (this.get('shownComponents.length') == 0)
this.emptyAndClose()
},
emptyAndClose() {
this.close();
if (this.get('shownComponents')) {
this.set('shownComponents.length', 0);
}
},
close() {
this.set('showWindow', false);
this.trigger('showWindow');
},
openAdditionalData() {
this.set('showWindow', true);
this.trigger('showWindow');
},
setPopupContent(content) {
this.set('popupContent', content);
},
removePopup() {
this.set('popupContent', null);
}
});
| import Service from '@ember/service';
import Evented from '@ember/object/evented';
export default Service.extend(Evented, {
showWindow: false,
shownComponents: null,
popupContent: null,
addComponent(path) {
if (this.get('shownComponents') == null) {
this.set('shownComponents', []);
}
if (!this.get('shownComponents').includes(path)) {
this.get('shownComponents').unshift(path);
this.notifyPropertyChange('shownComponents');
}
},
removeComponent(path) {
if (!this.get('shownComponents'))
return;
var index = this.get('shownComponents').indexOf(path);
if (index !== -1){
this.get('shownComponents').splice(index, 1);
this.notifyPropertyChange('shownComponents');
}
// close everything when no components are left
if (this.get('shownComponents.length') == 0)
this.emptyAndClose()
},
emptyAndClose() {
this.close();
if (this.get('shownComponents')) {
this.set('shownComponents.length', 0);
}
},
close() {
this.set('showWindow', false);
this.trigger('showWindow');
},
openAdditionalData() {
this.set('showWindow', true);
this.trigger('showWindow');
},
setPopupContent(content) {
this.set('popupContent', content);
},
removePopup() {
this.set('popupContent', null);
}
});
| Add new components to top of sidebar | Add new components to top of sidebar
| JavaScript | apache-2.0 | ExplorViz/explorviz-ui-frontend,ExplorViz/explorviz-ui-frontend,ExplorViz/explorviz-ui-frontend | ---
+++
@@ -12,7 +12,7 @@
this.set('shownComponents', []);
}
if (!this.get('shownComponents').includes(path)) {
- this.get('shownComponents').push(path);
+ this.get('shownComponents').unshift(path);
this.notifyPropertyChange('shownComponents');
}
}, |
fba75405f7c3e2f206a62e890a5a74e8ceaa153c | app/src/presenters/Flashcard.js | app/src/presenters/Flashcard.js | // import node packages
import React from 'react';
function Flashcard(props) {
return (
<li>
Question: <span>{this.props.question}</span><br />
Answer: <span>{this.props.answer}</span>
</li>
);
}
export default Flashcard;
| // import node packages
import React from 'react';
function Flashcard(props) {
return (
<li>
Question: <span>{props.question}</span><br />
Answer: <span>{props.answer}</span>
</li>
);
}
export default Flashcard;
| Fix props usage for function vs class | Fix props usage for function vs class
| JavaScript | mit | subnotes/gemini,subnotes/gemini,subnotes/gemini | ---
+++
@@ -4,8 +4,8 @@
function Flashcard(props) {
return (
<li>
- Question: <span>{this.props.question}</span><br />
- Answer: <span>{this.props.answer}</span>
+ Question: <span>{props.question}</span><br />
+ Answer: <span>{props.answer}</span>
</li>
);
} |
d2b8d6ddd32ae28d2487f0d97848851e3b246626 | lib/url.js | lib/url.js | "use strict";
// considered using the node url library, but couldn't resolve dependencies
// without serious modifications, leading to maintenance nightmares
module.exports = {
parse: function(url) {
// rudimentary URL regex, could use some improvement
// but should suffice for now. capturing parentheses are:
// 1: protocol
// 2: host
// 3: path
// 4: query
var re = /^(?:([^:]+)?:?\/\/\/?)?([^\/]+)(?:(\/[^\?]*)(?:\??(.*))?)?$/,
match = re.exec(url) || [];
return {
protocol: match[1],
host: match[2],
path: match[3] || '/',
query: match[4]
};
},
format: function(obj) {
// based off the object returned from the parse url
return [
obj.protocol
? obj.protocol + '://'
: '//',
obj.host,
obj.path,
obj.query
? '?' + obj.query
: ''
].join('');
}
};
| "use strict";
// considered using the node url library, but couldn't resolve dependencies
// without serious modifications, leading to maintenance nightmares
module.exports = {
parse: function(url) {
// rudimentary URL regex, could use some improvement
// but should suffice for now. capturing parentheses are:
// 1: protocol
// 2: host
// 3: path
// 4: query
var re = /^(?:([^:]+)?:?\/\/\/?)?([^\/]+)?(?:(\/[^\?]*)(?:\??(.*))?)?$/,
match = re.exec(url) || [];
return {
protocol: match[1],
host: match[2],
path: match[3] || '/',
query: match[4]
};
},
format: function(obj) {
// based off the object returned from the parse url
return [
obj.protocol
? obj.protocol + '://'
: '//',
obj.host,
obj.path,
obj.query
? '?' + obj.query
: ''
].join('');
}
};
| Allow capture of relative URLs by making regex host segment optional | Allow capture of relative URLs by making regex host segment optional
| JavaScript | mit | 2sidedfigure/ouija | ---
+++
@@ -11,7 +11,7 @@
// 2: host
// 3: path
// 4: query
- var re = /^(?:([^:]+)?:?\/\/\/?)?([^\/]+)(?:(\/[^\?]*)(?:\??(.*))?)?$/,
+ var re = /^(?:([^:]+)?:?\/\/\/?)?([^\/]+)?(?:(\/[^\?]*)(?:\??(.*))?)?$/,
match = re.exec(url) || [];
return { |
91a94b95e13b0a4187c0b86a95a770e64cbc3000 | js/config.js | js/config.js | 'use strict';
(function(exports) {
exports.API_URL = '/';
}(window));
| 'use strict';
(function(exports) {
exports.API_URL = 'http://api.sensorweb.io/';
}(window));
| Switch to use real APIs on SensorWeb platform | Switch to use real APIs on SensorWeb platform
| JavaScript | mit | sensor-web/sensorweb-frontend,sensor-web/sensorweb-frontend,evanxd/sensorweb-frontend,evanxd/sensorweb-frontend | ---
+++
@@ -1,5 +1,5 @@
'use strict';
(function(exports) {
- exports.API_URL = '/';
+ exports.API_URL = 'http://api.sensorweb.io/';
}(window)); |
931155cd03d8ce9581240f3a68fd39a52160f0f9 | lib/networking/rest/channels/deleteMessages.js | lib/networking/rest/channels/deleteMessages.js | "use strict";
const Constants = require("../../../Constants");
const Events = Constants.Events;
const Endpoints = Constants.Endpoints;
const apiRequest = require("../../../core/ApiRequest");
module.exports = function(channelId, messages) {
console.log("deletes", messages)
return new Promise((rs, rj) => {
apiRequest
.post(this, {
url: `${Endpoints.MESSAGES(channelId)}/bulk_delete`,
body: {messages: messages}
})
.send((err, res) => {
return (!err && res.ok) ? rs() : rj(err);
});
});
};
| "use strict";
const Constants = require("../../../Constants");
const Events = Constants.Events;
const Endpoints = Constants.Endpoints;
const apiRequest = require("../../../core/ApiRequest");
module.exports = function(channelId, messages) {
return new Promise((rs, rj) => {
apiRequest
.post(this, {
url: `${Endpoints.MESSAGES(channelId)}/bulk_delete`,
body: {messages: messages}
})
.send((err, res) => {
return (!err && res.ok) ? rs() : rj(err);
});
});
};
| Remove log message on bulk delete | Remove log message on bulk delete
| JavaScript | bsd-2-clause | qeled/discordie | ---
+++
@@ -6,7 +6,6 @@
const apiRequest = require("../../../core/ApiRequest");
module.exports = function(channelId, messages) {
- console.log("deletes", messages)
return new Promise((rs, rj) => {
apiRequest
.post(this, { |
dca9db5e0efbdbf529c1fc15d6cf1121c8692822 | public/core.js | public/core.js | var muchTodo = angular.module('muchTodo', []);
function mainController($scope, $http) {
$scope.formData = {};
$http.get('/api/todos')
.success(function(data) {
$scope.todos = data;
console.log(data);
})
.error(function(data){
console.log(Error(data));
});
$scope.createTodo = function() {
$http.post('/api/todos', $scope.formData)
.success(function(data){
$scope.formData = {};
$scope.todos = data;
console.log(data);
})
.errror(function(data){
console.log("Error: " + data);
});
};
$scope.deleteTodo = function(id){
$http.delete('/api/todos'+ id)
.success(function(data){
$scope.todos = data;
console.log(data);
})
.error(function(data){
console.log("Error: "+ data);
});
};
} | Write CRD todo module for angular. | Write CRD todo module for angular.
| JavaScript | mit | lukert33/luke_gets_mean,lukert33/luke_gets_mean | ---
+++
@@ -0,0 +1,38 @@
+var muchTodo = angular.module('muchTodo', []);
+
+function mainController($scope, $http) {
+ $scope.formData = {};
+
+ $http.get('/api/todos')
+ .success(function(data) {
+ $scope.todos = data;
+ console.log(data);
+ })
+ .error(function(data){
+ console.log(Error(data));
+ });
+
+ $scope.createTodo = function() {
+ $http.post('/api/todos', $scope.formData)
+ .success(function(data){
+ $scope.formData = {};
+ $scope.todos = data;
+ console.log(data);
+ })
+ .errror(function(data){
+ console.log("Error: " + data);
+ });
+ };
+
+ $scope.deleteTodo = function(id){
+ $http.delete('/api/todos'+ id)
+ .success(function(data){
+ $scope.todos = data;
+ console.log(data);
+ })
+ .error(function(data){
+ console.log("Error: "+ data);
+ });
+ };
+
+} | |
3971842dc0f01025ba280ff7c3900ea35f36ee6e | test/api.js | test/api.js | var chai = require('chai');
var expect = chai.expect;
/* fake api server */
var server = require('./server');
var api = server.createServer();
var clubs = [
{
id: '205',
name: 'SURTEX',
logo: 'http://121.199.38.39/hphoto/logoclub/NewClub.jpgw76_h76.jpg'
}
];
var responses = {
'clubs/': server.createGetResponse(JSON.stringify(clubs), 'application/json')
};
var bot = require('..')({url: api.url});
before(function (done) {
api.listen(api.port, function () {
for (var route in responses) {
api.on('/' + route, responses[route]);
}
done();
});
});
/* test cases */
describe('letsface api', function (done) {
var req = {
weixin: {
MsgType: 'text',
Content: 'clubs'
}
};
var res = {
reply: function (result) {
expect(result).to.equal('1 clubs');
done();
}
};
it('should reply club list', function () {
bot(req, res);
});
});
| var chai = require('chai');
var expect = chai.expect;
/* fake api server */
var server = require('./server');
var api = server.createServer();
var clubs = [
{
id: '205',
name: 'SURTEX',
logo: 'http://121.199.38.39/hphoto/logoclub/NewClub.jpgw76_h76.jpg'
}
];
var responses = {
'clubs/': server.createGetResponse(JSON.stringify(clubs), 'application/json')
};
var bot = require('..')({url: api.url});
before(function (done) {
api.listen(api.port, function () {
for (var route in responses) {
api.on('/' + route, responses[route]);
}
done();
});
});
/* test cases */
describe('letsface api', function () {
it('should reply club list', function (done) {
var req = {
weixin: {
MsgType: 'text',
Content: 'clubs'
}
};
var res = {
reply: function (result) {
expect(result).to.equal('1 clubs');
done();
}
};
bot(req, res);
});
});
| Fix test error (still failing) | Fix test error (still failing)
| JavaScript | bsd-3-clause | rogerz/wechat-letsface-api | ---
+++
@@ -31,20 +31,20 @@
/* test cases */
-describe('letsface api', function (done) {
- var req = {
- weixin: {
- MsgType: 'text',
- Content: 'clubs'
- }
- };
- var res = {
- reply: function (result) {
- expect(result).to.equal('1 clubs');
- done();
- }
- };
- it('should reply club list', function () {
+describe('letsface api', function () {
+ it('should reply club list', function (done) {
+ var req = {
+ weixin: {
+ MsgType: 'text',
+ Content: 'clubs'
+ }
+ };
+ var res = {
+ reply: function (result) {
+ expect(result).to.equal('1 clubs');
+ done();
+ }
+ };
bot(req, res);
});
}); |
b91805c6d29d1afcd532666a9230c05ef2903bd1 | internals/testing/test-bundler.js | internals/testing/test-bundler.js | import 'babel-polyfill';
import sinon from 'sinon';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
import factory from 'fixture-factory';
chai.use(chaiEnzyme());
global.chai = chai;
global.sinon = sinon;
global.expect = chai.expect;
global.should = chai.should();
/**
* Register the story as factory model.
*/
factory.register('story', {
id: 'random.number',
title: 'random.words',
body: 'random.words',
liked: false,
author: {
name: 'random.words',
},
});
const __karmaWebpackManifest__ = [];
// Include all .js files under `app`, except app.js, reducers.js, routes.js and
// store.js. This is for isparta code coverage
const context = require.context(
'../../src/app',
true,
/^^((?!(client|server)).)*\.js$/
);
function inManifest(path) {
return __karmaWebpackManifest__.indexOf(path) >= 0;
}
let runnable = context.keys().filter(inManifest);
// Run all tests if we didn't find any changes
if (!runnable.length) {
runnable = context.keys();
}
runnable.forEach(context);
| import 'babel-polyfill';
import sinon from 'sinon';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
import factory from 'fixture-factory';
chai.use(chaiEnzyme());
global.chai = chai;
global.sinon = sinon;
global.expect = chai.expect;
global.should = chai.should();
/**
* Register the story as factory model.
*/
factory.register('story', {
id: 'random.number',
title: 'random.words',
excerpt: 'random.words',
body: 'random.words',
liked: false,
author: {
name: 'random.words',
},
created_at: 'date.recent.value',
});
factory.register('category', {
id: 'random.number',
name: 'random.word',
});
const __karmaWebpackManifest__ = [];
// Include all .js files under `app`, except app.js, reducers.js, routes.js and
// store.js. This is for isparta code coverage
const context = require.context(
'../../src/app',
true,
/^^((?!(client|server)).)*\.js$/
);
function inManifest(path) {
return __karmaWebpackManifest__.indexOf(path) >= 0;
}
let runnable = context.keys().filter(inManifest);
// Run all tests if we didn't find any changes
if (!runnable.length) {
runnable = context.keys();
}
runnable.forEach(context);
| Add excerpt to the story factor & add category factory | Add excerpt to the story factor & add category factory
| JavaScript | mit | reauv/persgroep-app,reauv/persgroep-app | ---
+++
@@ -18,11 +18,18 @@
factory.register('story', {
id: 'random.number',
title: 'random.words',
+ excerpt: 'random.words',
body: 'random.words',
liked: false,
author: {
name: 'random.words',
},
+ created_at: 'date.recent.value',
+});
+
+factory.register('category', {
+ id: 'random.number',
+ name: 'random.word',
});
const __karmaWebpackManifest__ = []; |
3ce1e166c2b114a3f87111e8e1b68e8c238990fe | src/utils/quote-style.js | src/utils/quote-style.js | /**
* As Recast is not preserving original quoting, we try to detect it.
* See https://github.com/benjamn/recast/issues/171
* and https://github.com/facebook/jscodeshift/issues/143
* @return 'double', 'single' or null
*/
export default function detectQuoteStyle(j, ast) {
let detectedQuoting = null;
ast
.find(j.Literal, {
value: v => typeof v === 'string',
raw: v => typeof v === 'string',
})
.forEach(p => {
// The raw value is from the original babel source
if (p.value.raw[0] === "'") {
detectedQuoting = 'single';
}
if (p.value.raw[0] === '"') {
detectedQuoting = 'double';
}
});
return detectedQuoting;
}
| /**
* As Recast is not preserving original quoting, we try to detect it.
* See https://github.com/benjamn/recast/issues/171
* and https://github.com/facebook/jscodeshift/issues/143
* @return 'double', 'single' or null
*/
export default function detectQuoteStyle(j, ast) {
let doubles = 0;
let singles = 0;
ast
.find(j.Literal, {
value: v => typeof v === 'string',
raw: v => typeof v === 'string',
})
.forEach(p => {
// The raw value is from the original babel source
const quote = p.value.raw[0];
if (quote === '"') {
doubles += 1;
}
if (quote === "'") {
singles += 1;
}
});
if (doubles === singles) {
return null;
}
return doubles > singles ? 'double' : 'single';
}
| Improve detectQuoteStyle (needed when adding imports and requires) | Improve detectQuoteStyle (needed when adding imports and requires)
| JavaScript | mit | skovhus/jest-codemods,skovhus/jest-codemods,skovhus/jest-codemods | ---
+++
@@ -5,7 +5,8 @@
* @return 'double', 'single' or null
*/
export default function detectQuoteStyle(j, ast) {
- let detectedQuoting = null;
+ let doubles = 0;
+ let singles = 0;
ast
.find(j.Literal, {
@@ -14,14 +15,17 @@
})
.forEach(p => {
// The raw value is from the original babel source
- if (p.value.raw[0] === "'") {
- detectedQuoting = 'single';
+ const quote = p.value.raw[0];
+ if (quote === '"') {
+ doubles += 1;
}
-
- if (p.value.raw[0] === '"') {
- detectedQuoting = 'double';
+ if (quote === "'") {
+ singles += 1;
}
});
- return detectedQuoting;
+ if (doubles === singles) {
+ return null;
+ }
+ return doubles > singles ? 'double' : 'single';
} |
39be85fb0ff6be401a17c92f2d54befbe612115a | plugins/treeview/web_client/routes.js | plugins/treeview/web_client/routes.js | import router from 'girder/router';
import events from 'girder/events';
import { exposePluginConfig } from 'girder/utilities/PluginUtils';
exposePluginConfig('treeview', 'plugins/treeview/config');
import ConfigView from './views/ConfigView';
router.route('plugins/treeview/config', 'treeviewConfig', function () {
events.trigger('g:navigateTo', ConfigView);
});
| /* eslint-disable import/first */
import router from 'girder/router';
import events from 'girder/events';
import { exposePluginConfig } from 'girder/utilities/PluginUtils';
exposePluginConfig('treeview', 'plugins/treeview/config');
import ConfigView from './views/ConfigView';
router.route('plugins/treeview/config', 'treeviewConfig', function () {
events.trigger('g:navigateTo', ConfigView);
});
| Fix style for compatibility with eslint rule changes | Fix style for compatibility with eslint rule changes
| JavaScript | apache-2.0 | Xarthisius/girder,kotfic/girder,RafaelPalomar/girder,jbeezley/girder,Xarthisius/girder,Kitware/girder,data-exp-lab/girder,Xarthisius/girder,RafaelPalomar/girder,manthey/girder,data-exp-lab/girder,kotfic/girder,kotfic/girder,data-exp-lab/girder,data-exp-lab/girder,girder/girder,Kitware/girder,manthey/girder,girder/girder,manthey/girder,girder/girder,jbeezley/girder,manthey/girder,jbeezley/girder,kotfic/girder,RafaelPalomar/girder,RafaelPalomar/girder,Xarthisius/girder,Xarthisius/girder,RafaelPalomar/girder,Kitware/girder,data-exp-lab/girder,jbeezley/girder,girder/girder,kotfic/girder,Kitware/girder | ---
+++
@@ -1,3 +1,4 @@
+/* eslint-disable import/first */
import router from 'girder/router';
import events from 'girder/events';
import { exposePluginConfig } from 'girder/utilities/PluginUtils'; |
01e2eab387d84a969b87c45f795a5df1335f3f30 | src/ui/DynamicPreview.js | src/ui/DynamicPreview.js | import React, { PropTypes } from 'react'
import styled from 'styled-components'
import AceEditor from 'react-ace'
const PreviewContainer = styled.div`
align-self: center;
padding: 28px;
width: 100%;
height: 400px;
background-color: white;
border: 1px solid rgba(0, 0, 0, 0.35);
box-shadow: 0 2px 16px 2px rgba(0, 0, 0, 0.25);
box-sizing: border-box;
overflow: scroll;
`
function DynamicPreview({ value, fontface, language, theme }) {
require(`brace/mode/${language}`) // eslint-disable-line
require(`brace/theme/${theme}`) // eslint-disable-line
return (
<PreviewContainer>
<AceEditor mode={language} theme={theme} value={value} style={{ fontFamily: fontface }} />
</PreviewContainer>
)
}
DynamicPreview.propTypes = {
value: PropTypes.string.isRequired,
fontface: PropTypes.string,
language: PropTypes.string.isRequired,
theme: PropTypes.string.isRequired
}
export default DynamicPreview
| import React, { PropTypes } from 'react'
import styled from 'styled-components'
import AceEditor from 'react-ace'
const PreviewContainer = styled.div`
align-self: center;
padding: 28px;
width: 100%;
height: 400px;
background-color: white;
border: 1px solid rgba(0, 0, 0, 0.35);
box-shadow: 0 2px 16px 2px rgba(0, 0, 0, 0.25);
box-sizing: border-box;
overflow: scroll;
`
function DynamicPreview({ value, fontface, language, theme }) {
require(`brace/mode/${language}`) // eslint-disable-line
require(`brace/theme/${theme}`) // eslint-disable-line
return (
<PreviewContainer>
<AceEditor
mode={language}
theme={theme}
value={value}
showGutter={false}
style={{ fontFamily: fontface }}
/>
</PreviewContainer>
)
}
DynamicPreview.propTypes = {
value: PropTypes.string.isRequired,
fontface: PropTypes.string,
language: PropTypes.string.isRequired,
theme: PropTypes.string.isRequired
}
export default DynamicPreview
| Remove gutter to match the output | Remove gutter to match the output
| JavaScript | mpl-2.0 | okonet/codestage,okonet/codestage | ---
+++
@@ -19,7 +19,13 @@
require(`brace/theme/${theme}`) // eslint-disable-line
return (
<PreviewContainer>
- <AceEditor mode={language} theme={theme} value={value} style={{ fontFamily: fontface }} />
+ <AceEditor
+ mode={language}
+ theme={theme}
+ value={value}
+ showGutter={false}
+ style={{ fontFamily: fontface }}
+ />
</PreviewContainer>
)
} |
7b9157180348613bd529e3ef21137d98f6c82c7f | lib/streams.js | lib/streams.js | /**
* Created by austin on 9/24/14.
*/
var streams = function (client) {
this.client = client;
};
var _qsAllowedProps = [
'resolution'
, 'series_type'
];
//===== streams endpoint =====
streams.prototype.activity = function(args,done) {
var endpoint = 'activities';
this._typeHelper(endpoint,args,done);
};
streams.prototype.effort = function(args,done) {
var endpoint = 'segment_efforts';
this._typeHelper(endpoint,args,done);
};
streams.prototype.segment = function(args,done) {
var endpoint = 'segments';
this._typeHelper(endpoint,args,done);
};
streams.prototype.route = function(args,done) {
var endpoint = 'routes';
this._typeHelper(endpoint,args,done);
};
//===== streams endpoint =====
//===== helpers =====
streams.prototype._typeHelper = function(endpoint,args,done) {
var err = null
, qs = this.client.getQS(_qsAllowedProps,args);
//require id
if(typeof args.id === 'undefined') {
throw new Error('args must include an id');
}
//require types
if(typeof args.types === 'undefined') {
throw new Error('args must include types');
}
endpoint += '/' + args.id + '/streams/' + args.types + '?' + qs;
return this.client.getEndpoint(endpoint,args,done);
};
//===== helpers =====
module.exports = streams;
| /**
* Created by austin on 9/24/14.
*/
var streams = function (client) {
this.client = client;
};
var _qsAllowedProps = [
'resolution'
, 'series_type'
];
//===== streams endpoint =====
streams.prototype.activity = function(args,done) {
var endpoint = 'activities';
return this._typeHelper(endpoint,args,done);
};
streams.prototype.effort = function(args,done) {
var endpoint = 'segment_efforts';
return this._typeHelper(endpoint,args,done);
};
streams.prototype.segment = function(args,done) {
var endpoint = 'segments';
return this._typeHelper(endpoint,args,done);
};
streams.prototype.route = function(args,done) {
var endpoint = 'routes';
return this._typeHelper(endpoint,args,done);
};
//===== streams endpoint =====
//===== helpers =====
streams.prototype._typeHelper = function(endpoint,args,done) {
var err = null
, qs = this.client.getQS(_qsAllowedProps,args);
//require id
if(typeof args.id === 'undefined') {
throw new Error('args must include an id');
}
//require types
if(typeof args.types === 'undefined') {
throw new Error('args must include types');
}
endpoint += '/' + args.id + '/streams/' + args.types + '?' + qs;
return this.client.getEndpoint(endpoint,args,done);
};
//===== helpers =====
module.exports = streams;
| Return value for client.stream.* calls | Return value for client.stream.* calls
These endpoints didn’t return anything, making them unusable with the
promises version of the API.
| JavaScript | mit | UnbounDev/node-strava-v3 | ---
+++
@@ -15,25 +15,25 @@
streams.prototype.activity = function(args,done) {
var endpoint = 'activities';
- this._typeHelper(endpoint,args,done);
+ return this._typeHelper(endpoint,args,done);
};
streams.prototype.effort = function(args,done) {
var endpoint = 'segment_efforts';
- this._typeHelper(endpoint,args,done);
+ return this._typeHelper(endpoint,args,done);
};
streams.prototype.segment = function(args,done) {
var endpoint = 'segments';
- this._typeHelper(endpoint,args,done);
+ return this._typeHelper(endpoint,args,done);
};
streams.prototype.route = function(args,done) {
var endpoint = 'routes';
- this._typeHelper(endpoint,args,done);
+ return this._typeHelper(endpoint,args,done);
};
//===== streams endpoint =====
|
771173699d6ec245c336d451601e6bf65d1f6058 | src/js/main.js | src/js/main.js | /* global console, Calendar, vis */
(function() {
"use strict";
var calendar = new Calendar();
calendar.init(document.getElementById('visualization'),
{
height: "100vh",
orientation: "top",
zoomKey: 'shiftKey',
zoomMax: 315360000000,
zoomMin: 600000,
editable: {
add: false,
updateTime: true,
updateGroup: false,
remove: true
},
groupOrder: function (a, b) {
if (a.id === "Demos") {
return -1;
}
if (b.id === "Demos") {
return 1;
}
var groups = [a.id, b.id];
groups.sort();
if (a.id === groups[0]) {
return -1;
} else {
return 1;
}
}
});
$(document).ready(function(){
$('.vis-center>.vis-content').on('scroll', function () {
$('.vis-left>.vis-content').scrollTop($(this).scrollTop());
});
$('.vis-left>.vis-content').on('scroll', function () {
$('.vis-center>.vis-content').scrollTop($(this).scrollTop());
});
});
})(); | /* global console, Calendar, vis */
(function() {
"use strict";
var calendar = new Calendar();
calendar.init(document.getElementById('visualization'),
{
height: "100vh",
orientation: "top",
zoomKey: 'shiftKey',
zoomMax: 315360000000,
zoomMin: 86400000,
editable: {
add: false,
updateTime: true,
updateGroup: false,
remove: true
},
groupOrder: function (a, b) {
if (a.id === "Demos") {
return -1;
}
if (b.id === "Demos") {
return 1;
}
var groups = [a.id, b.id];
groups.sort();
if (a.id === groups[0]) {
return -1;
} else {
return 1;
}
}
});
$(document).ready(function(){
$('.vis-center>.vis-content').on('scroll', function () {
$('.vis-left>.vis-content').scrollTop($(this).scrollTop());
});
$('.vis-left>.vis-content').on('scroll', function () {
$('.vis-center>.vis-content').scrollTop($(this).scrollTop());
});
});
})(); | Update minimun zoom to 24 hours | Update minimun zoom to 24 hours
| JavaScript | apache-2.0 | fidash/widget-calendar,fidash/widget-calendar | ---
+++
@@ -10,7 +10,7 @@
orientation: "top",
zoomKey: 'shiftKey',
zoomMax: 315360000000,
- zoomMin: 600000,
+ zoomMin: 86400000,
editable: {
add: false,
updateTime: true, |
0469f03e2f8cd10e2fc0e158c48b2f11b2e30e24 | src/loading.js | src/loading.js |
'use strict';
var EventEmitter = require('events'),
util = require('util');
/**
* The emitter returned by methods that load data from an external source.
* @constructor
* @fires Loading#error
* @fires Loading#loaded
*/
function Loading(config) {
EventEmitter.call(this);
}
util.inherits(Loading, EventEmitter);
Loading.prototype.loaded = function(data) {
this.emit('loaded', data);
};
Loading.prototype.error = function(error) {
if (typeof error === 'string') {
this.emit('error', new Error(error));
return;
}
else if (typeof error === 'object') {
if (error instanceof String) {
this.emit('error', new Error(error));
return;
}
else if (error instanceof Error) {
this.emit('error', error);
return;
}
}
this.emit('error', '' + error);
};
Loading.prototype.onLoaded = function(handler) {
this.on('loaded', handler);
};
Loading.prototype.onError = function(handler) {
this.on('error', handler);
};
/**
* Emitted when there is an error loading the data.
* @event Loading#error
*/
/**
* Emitted when the data has been loaded successfuly.
* @event Loading#loaded
*/
module.exports = Loading;
|
'use strict';
var EventEmitter = require('events'),
util = require('util');
/**
* The emitter returned by methods that load data from an external source.
* @constructor
* @fires Loading#error
* @fires Loading#loaded
*/
function Loading(config) {
EventEmitter.call(this);
}
util.inherits(Loading, EventEmitter);
Loading.prototype.loaded = function(data) {
this.emit('loaded', data);
return this;
};
Loading.prototype.error = function(error) {
if (typeof error === 'string') {
this.emit('error', new Error(error));
return this;
}
else if (typeof error === 'object') {
if (error instanceof String) {
this.emit('error', new Error(error));
return this;
}
else if (error instanceof Error) {
this.emit('error', error);
return this;
}
}
this.emit('error', '' + error);
return this;
};
Loading.prototype.onLoaded = function(handler) {
this.on('loaded', handler);
return this;
};
Loading.prototype.onError = function(handler) {
this.on('error', handler);
return this;
};
/**
* Emitted when there is an error loading the data.
* @event Loading#error
*/
/**
* Emitted when the data has been loaded successfuly.
* @event Loading#loaded
*/
module.exports = Loading;
| Return Loading from Loading methods. | Return Loading from Loading methods.
| JavaScript | mit | mattunderscorechampion/uk-petitions,mattunderscorechampion/uk-petitions | ---
+++
@@ -16,29 +16,33 @@
util.inherits(Loading, EventEmitter);
Loading.prototype.loaded = function(data) {
this.emit('loaded', data);
+ return this;
};
Loading.prototype.error = function(error) {
if (typeof error === 'string') {
this.emit('error', new Error(error));
- return;
+ return this;
}
else if (typeof error === 'object') {
if (error instanceof String) {
this.emit('error', new Error(error));
- return;
+ return this;
}
else if (error instanceof Error) {
this.emit('error', error);
- return;
+ return this;
}
}
this.emit('error', '' + error);
+ return this;
};
Loading.prototype.onLoaded = function(handler) {
this.on('loaded', handler);
+ return this;
};
Loading.prototype.onError = function(handler) {
this.on('error', handler);
+ return this;
};
/** |
303d211596c8ed7f48297198477d2f6054854f88 | test/spec/spec-helper.js | test/spec/spec-helper.js | "use strict";
// Angular is refusing to recognize the HawtioNav stuff
// when testing even though its being loaded
beforeEach(module(function ($provide) {
$provide.provider("HawtioNavBuilder", function() {
function Mocked() {}
this.create = function() {return this;};
this.id = function() {return this;};
this.title = function() {return this;};
this.template = function() {return this;};
this.isSelected = function() {return this;};
this.href = function() {return this;};
this.page = function() {return this;};
this.subPath = function() {return this;};
this.build = function() {return this;};
this.join = function() {return "";};
this.$get = function() {return new Mocked();};
});
$provide.factory("HawtioNav", function(){
return {add: function() {}};
});
$provide.factory("HawtioExtension", function() {
return {
add: function() {}
};
});
}));
// Make sure a base location exists in the generated test html
if (!$('head base').length) {
$('head').append($('<base href="/">'));
}
angular.module('openshiftConsole').config(function(AuthServiceProvider) {
AuthServiceProvider.UserStore('MemoryUserStore');
});
//load the module
beforeEach(module('openshiftConsole'));
| "use strict";
beforeEach(module(function ($provide) {
$provide.factory("HawtioExtension", function() {
return {
add: function() {}
};
});
}));
// Make sure a base location exists in the generated test html
if (!$('head base').length) {
$('head').append($('<base href="/">'));
}
angular.module('openshiftConsole').config(function(AuthServiceProvider) {
AuthServiceProvider.UserStore('MemoryUserStore');
});
//load the module
beforeEach(module('openshiftConsole'));
| Remove HawtioNav* mocks (no longer used) | Remove HawtioNav* mocks (no longer used)
We're using Patternfly nav now.
| JavaScript | apache-2.0 | openshift/origin-web-console,openshift/origin-web-console,openshift/origin-web-console,openshift/origin-web-console | ---
+++
@@ -1,32 +1,11 @@
"use strict";
-// Angular is refusing to recognize the HawtioNav stuff
-// when testing even though its being loaded
beforeEach(module(function ($provide) {
- $provide.provider("HawtioNavBuilder", function() {
- function Mocked() {}
- this.create = function() {return this;};
- this.id = function() {return this;};
- this.title = function() {return this;};
- this.template = function() {return this;};
- this.isSelected = function() {return this;};
- this.href = function() {return this;};
- this.page = function() {return this;};
- this.subPath = function() {return this;};
- this.build = function() {return this;};
- this.join = function() {return "";};
- this.$get = function() {return new Mocked();};
- });
-
- $provide.factory("HawtioNav", function(){
- return {add: function() {}};
- });
-
$provide.factory("HawtioExtension", function() {
return {
add: function() {}
};
});
-
+
}));
// Make sure a base location exists in the generated test html
@@ -37,6 +16,6 @@
angular.module('openshiftConsole').config(function(AuthServiceProvider) {
AuthServiceProvider.UserStore('MemoryUserStore');
});
-
+
//load the module
beforeEach(module('openshiftConsole')); |
0edcb9fd044cc56799184b8d6740e1b5894d75bf | src/methods/avatars/get.js | src/methods/avatars/get.js | import connection from '../../config/database';
module.exports.register = (server, options, next) => {
async function getAvatar(userid, next) {
try {
const employee = await connection
.table('avatars')
.filter({ userid: userid.toUpperCase() })
.nth(0)
.run();
next(null, employee);
} catch (error) {
next(error);
}
}
server.method('db.getAvatar', getAvatar, {});
next();
};
module.exports.register.attributes = {
name: 'method.db.getAvatar',
};
| import connection from '../../config/database';
module.exports.register = (server, options, next) => {
async function getAvatar(userid, next) {
try {
const employee = await connection
.table('avatars')
.filter({ userid: userid.toUpperCase() })
.orderBy(connection.desc('taken'))
.nth(0)
.run();
next(null, employee);
} catch (error) {
next(error);
}
}
server.method('db.getAvatar', getAvatar, {});
next();
};
module.exports.register.attributes = {
name: 'method.db.getAvatar',
};
| Add sort by "taken" date to avatar query, so the most recent image is returned for the person. | Add sort by "taken" date to avatar query, so the most recent
image is returned for the person.
| JavaScript | mit | ocean/higgins,ocean/higgins | ---
+++
@@ -6,6 +6,7 @@
const employee = await connection
.table('avatars')
.filter({ userid: userid.toUpperCase() })
+ .orderBy(connection.desc('taken'))
.nth(0)
.run();
|
9c225d0f19b19657b86a153f93562881048510b4 | lib/xpi.js | lib/xpi.js | var join = require("path").join;
var console = require("./utils").console;
var fs = require("fs-promise");
var zip = require("./zip");
var all = require("when").all;
var tmp = require('./tmp');
var bootstrapSrc = join(__dirname, "../data/bootstrap.js");
/**
* Takes a manifest object (from package.json) and build options
* object and zipz up the current directory into a XPI, copying
* over default `install.rdf` and `bootstrap.js` if needed
* and not yet defined. Returns a promise that resolves
* upon completion.
*
* @param {Object} manifest
* @param {Object} options
* @return {Promise}
*/
function xpi (manifest, options) {
var cwd = process.cwd();
var xpiName = (manifest.name || "jetpack") + ".xpi";
var xpiPath = join(cwd, xpiName);
var buildOptions = createBuildOptions(options);
return doFinalZip(cwd, xpiPath);
}
module.exports = xpi;
function doFinalZip(cwd, xpiPath) {
return zip(cwd, xpiPath).then(function () {
return xpiPath;
});
}
| var join = require("path").join;
var console = require("./utils").console;
var fs = require("fs-promise");
var zip = require("./zip");
var all = require("when").all;
var tmp = require('./tmp');
var bootstrapSrc = join(__dirname, "../data/bootstrap.js");
/**
* Takes a manifest object (from package.json) and build options
* object and zipz up the current directory into a XPI, copying
* over default `install.rdf` and `bootstrap.js` if needed
* and not yet defined. Returns a promise that resolves
* upon completion.
*
* @param {Object} manifest
* @param {Object} options
* @return {Promise}
*/
function xpi (manifest, options) {
var cwd = process.cwd();
var xpiName = (manifest.name || "jetpack") + ".xpi";
var xpiPath = join(cwd, xpiName);
return doFinalZip(cwd, xpiPath);
}
module.exports = xpi;
function doFinalZip(cwd, xpiPath) {
return zip(cwd, xpiPath).then(function () {
return xpiPath;
});
}
| Remove extra createBuildOptions for now | Remove extra createBuildOptions for now
| JavaScript | mpl-2.0 | Medeah/jpm,rpl/jpm,guyzmuch/jpm,wagnerand/jpm,guyzmuch/jpm,Medeah/jpm,matraska23/jpm,nikolas/jpm,freaktechnik/jpm,matraska23/jpm,alexduch/jpm,mozilla-jetpack/jpm,jsantell/jpm,Gozala/jpm,freaktechnik/jpm,rpl/jpm,nikolas/jpm,mozilla-jetpack/jpm,kkapsner/jpm,mozilla/jpm,mozilla-jetpack/jpm,jsantell/jpm,johannhof/jpm,alexduch/jpm,benbasson/jpm,guyzmuch/jpm,mozilla/jpm,freaktechnik/jpm,Medeah/jpm,johannhof/jpm,johannhof/jpm,benbasson/jpm,Gozala/jpm,benbasson/jpm,jsantell/jpm,alexduch/jpm,wagnerand/jpm,rpl/jpm,wagnerand/jpm,kkapsner/jpm,kkapsner/jpm,mozilla/jpm,nikolas/jpm,matraska23/jpm | ---
+++
@@ -22,7 +22,6 @@
var cwd = process.cwd();
var xpiName = (manifest.name || "jetpack") + ".xpi";
var xpiPath = join(cwd, xpiName);
- var buildOptions = createBuildOptions(options);
return doFinalZip(cwd, xpiPath);
} |
e9e5f9f971c2acec8046002308857512836cdb07 | library.js | library.js | (function () {
"use strict";
var Frame = function (elem) {
if (typeof elem === 'string') {
elem = document.getElementById(elem);
}
var height = elem.scrollHeight;
var width = elem.scrollWidth;
var viewAngle = 45;
var aspect = width / (1.0 * height);
var near = 0.1;
var far = 10000;
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(viewAngle, aspect, near, far);
this.camera.position.z = 10;
this.scene.add(this.camera);
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(width, height);
elem.appendChild(this.renderer.domElement);
};
window.Frame = Frame;
Frame.prototype.addNode = function (node) {
this.scene.add(node.mesh);
};
Frame.prototype.render = function () {
this.renderer.render(this.scene, this.camera);
};
var Node = function (x, y, z) {
var geometry = new THREE.SphereGeometry(1, 4, 4);
var material = new THREE.MeshBasicMaterial({color: 0x00ff00, wireframe: true});
this.mesh = new THREE.Mesh(geometry, material);
this.mesh.position = {x: x, y: y, z: z};
};
window.Node = Node;
}());
| (function () {
"use strict";
var Frame = function (elem) {
if (typeof elem === 'string') {
elem = document.getElementById(elem);
}
var height = elem.scrollHeight;
var width = elem.scrollWidth;
var viewAngle = 45;
var aspect = width / (1.0 * height);
var near = 0.1;
var far = 10000;
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(viewAngle, aspect, near, far);
this.camera.position.z = 10;
this.scene.add(this.camera);
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(width, height);
elem.appendChild(this.renderer.domElement);
};
window.Frame = Frame;
Frame.prototype.addNode = function (node) {
this.scene.add(node.mesh);
};
Frame.prototype.render = function () {
this.renderer.render(this.scene, this.camera);
};
var Node = function (x, y, z) {
var geometry = new THREE.SphereGeometry(1, 4, 4);
var material = new THREE.MeshBasicMaterial({color: 0x00ff00, wireframe: true});
this.mesh = new THREE.Mesh(geometry, material);
this.mesh.position = {x: x, y: y, z: z};
};
window.Node = Node;
Node.prototype.addTo = function (frame) {
frame.addNode(this);
};
}());
| Add a shortcut method on node to add to frame | Add a shortcut method on node to add to frame
| JavaScript | mpl-2.0 | frewsxcv/graphosaurus | ---
+++
@@ -42,4 +42,8 @@
this.mesh.position = {x: x, y: y, z: z};
};
window.Node = Node;
+
+ Node.prototype.addTo = function (frame) {
+ frame.addNode(this);
+ };
}()); |
1693507cc26a2e273981edbd85c18d34019a170f | lib/cli.js | lib/cli.js | #! /usr/bin/env node
var program = require('commander'),
fs = require('fs'),
path = require('path'),
polish = require('./polish');
program
.version('1.0.0')
.option('-s, --stylesheet <path>', 'Path to a stylesheet (in CSS, SCSS, Sass, or Less).')
.option('-P, --plugins-directory <path>', 'Path to a directory of linting plugins')
.option('-p, --plugins <modules>', 'Comma-separated list of linting plugins', function(modules) { return modules.split(','); })
.parse(process.argv);
/*
* Read the provided file and call PolishCSS
*/
fs.readFile(program.stylesheet, 'utf8', function(err, stylesheet) {
if (err) {
throw err;
}
polish(stylesheet, program.stylesheet, { plugins: program.plugins, pluginsDirectory: program.pluginsDirectory });
});
| #! /usr/bin/env node
var program = require('commander'),
fs = require('fs'),
path = require('path'),
polish = require('./polish');
program
.version('1.0.0')
.option('-s, --stylesheet <path>', 'Path to a stylesheet (in CSS, SCSS, Sass, or Less).')
.option('-P, --plugins-directory <path>', 'Path to a directory of linting plugins.')
.option('-p, --plugins <modules>', 'Comma-separated list of linting plugins.', function(modules) { return modules.split(','); })
.option('-q, --quiet', 'Prevent logging errors to the console.')
.parse(process.argv);
/*
* Read the provided file and call PolishCSS
*/
fs.readFile(program.stylesheet, 'utf8', function(err, stylesheet) {
var results;
if (err) {
throw err;
}
results = polish(stylesheet, program.stylesheet, { plugins: program.plugins, pluginsDirectory: program.pluginsDirectory });
if (!program.quiet) {
polish.reporter(program.stylesheet, results);
}
});
| Print results when using the CLI. Can be turned off with `-q` or `--quiet`. | Print results when using the CLI. Can be turned off with `-q` or `--quiet`.
| JavaScript | mit | brendanlacroix/polish-css | ---
+++
@@ -8,17 +8,24 @@
program
.version('1.0.0')
.option('-s, --stylesheet <path>', 'Path to a stylesheet (in CSS, SCSS, Sass, or Less).')
- .option('-P, --plugins-directory <path>', 'Path to a directory of linting plugins')
- .option('-p, --plugins <modules>', 'Comma-separated list of linting plugins', function(modules) { return modules.split(','); })
+ .option('-P, --plugins-directory <path>', 'Path to a directory of linting plugins.')
+ .option('-p, --plugins <modules>', 'Comma-separated list of linting plugins.', function(modules) { return modules.split(','); })
+ .option('-q, --quiet', 'Prevent logging errors to the console.')
.parse(process.argv);
/*
* Read the provided file and call PolishCSS
*/
fs.readFile(program.stylesheet, 'utf8', function(err, stylesheet) {
+ var results;
+
if (err) {
throw err;
}
- polish(stylesheet, program.stylesheet, { plugins: program.plugins, pluginsDirectory: program.pluginsDirectory });
+ results = polish(stylesheet, program.stylesheet, { plugins: program.plugins, pluginsDirectory: program.pluginsDirectory });
+
+ if (!program.quiet) {
+ polish.reporter(program.stylesheet, results);
+ }
}); |
3b9971fa4a272c3aaac06cc1541c5ff5b9b9c409 | lib/jwt.js | lib/jwt.js | const fs = require('fs');
const process = require('process');
const jwt = require('jsonwebtoken');
// sign with RSA SHA256
// FIXME: move to env var
const cert = fs.readFileSync('private-key.pem'); // get private key
module.exports = generate;
function generate() {
const payload = {
// issued at time
iat: Math.floor(new Date() / 1000),
// JWT expiration time
exp: (Math.floor(new Date() / 1000) + 60) * 5,
// Integration's GitHub identifier
iss: process.env.INTEGRATION_ID
};
return jwt.sign(payload, cert, {algorithm: 'RS256'});
}
| const fs = require('fs');
const process = require('process');
const jwt = require('jsonwebtoken');
const cert = process.env.PRIVATE_KEY || fs.readFileSync('private-key.pem');
module.exports = generate;
function generate() {
const payload = {
// issued at time
iat: Math.floor(new Date() / 1000),
// JWT expiration time
exp: (Math.floor(new Date() / 1000) + 60) * 5,
// Integration's GitHub identifier
iss: process.env.INTEGRATION_ID
};
// sign with RSA SHA256
return jwt.sign(payload, cert, {algorithm: 'RS256'});
}
| Load private key from env if possible | Load private key from env if possible
| JavaScript | isc | bkeepers/PRobot,probot/probot,pholleran-org/probot,pholleran-org/probot,pholleran-org/probot,probot/probot,probot/probot,bkeepers/PRobot | ---
+++
@@ -2,9 +2,7 @@
const process = require('process');
const jwt = require('jsonwebtoken');
-// sign with RSA SHA256
-// FIXME: move to env var
-const cert = fs.readFileSync('private-key.pem'); // get private key
+const cert = process.env.PRIVATE_KEY || fs.readFileSync('private-key.pem');
module.exports = generate;
@@ -18,5 +16,6 @@
iss: process.env.INTEGRATION_ID
};
+ // sign with RSA SHA256
return jwt.sign(payload, cert, {algorithm: 'RS256'});
} |
50ff490252eaa57c7858758cd8dbdc67a5dfe09c | app/js/root.js | app/js/root.js | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route, Redirect } from 'react-router';
import { syncReduxAndRouter } from 'redux-simple-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import createStore from './store';
import App from './app';
import Build from './build';
import Json from './json';
import Html from './html';
import forms from './forms';
const history = createBrowserHistory();
const store = createStore({});
syncReduxAndRouter(history, store);
function mapFormsToRoutes({section, component}) {
return <Route path={section} component={component} />;
}
ReactDOM.render((
<Provider store={store} >
<Router history={history}>
<Route path="/" component={App}>
<Redirect from="" to="build" />
<Route path="build" component={Build}>
{
forms.map(mapFormsToRoutes)
}
</Route>
<Route path="output" component={Html}/>
<Route path="json" component={Json}/>
</Route>
</Router>
</Provider>
), document.getElementById('app')); | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route, Redirect } from 'react-router';
import { syncReduxAndRouter } from 'redux-simple-router';
import createHashHistory from 'history/lib/createHashHistory';
import createStore from './store';
import App from './app';
import Build from './build';
import Json from './json';
import Html from './html';
import forms from './forms';
const history = createHashHistory();
const store = createStore({});
syncReduxAndRouter(history, store);
function mapFormsToRoutes({section, component}) {
return <Route path={section} component={component} />;
}
ReactDOM.render((
<Provider store={store} >
<Router history={history}>
<Redirect from="/" to="/build" />
<Route path="/" component={App}>
<Route path="build" component={Build}>
{
forms.map(mapFormsToRoutes)
}
</Route>
<Route path="output" component={Html}/>
<Route path="json" component={Json}/>
</Route>
</Router>
</Provider>
), document.getElementById('app')); | Switch to hash-based history, fix redirect to /build on boot | Switch to hash-based history, fix redirect to /build on boot
| JavaScript | mit | maxmechanic/resumaker,maxmechanic/resumaker | ---
+++
@@ -3,7 +3,7 @@
import { Provider } from 'react-redux';
import { Router, Route, Redirect } from 'react-router';
import { syncReduxAndRouter } from 'redux-simple-router';
-import createBrowserHistory from 'history/lib/createBrowserHistory';
+import createHashHistory from 'history/lib/createHashHistory';
import createStore from './store';
import App from './app';
import Build from './build';
@@ -11,7 +11,7 @@
import Html from './html';
import forms from './forms';
-const history = createBrowserHistory();
+const history = createHashHistory();
const store = createStore({});
syncReduxAndRouter(history, store);
@@ -23,8 +23,8 @@
ReactDOM.render((
<Provider store={store} >
<Router history={history}>
+ <Redirect from="/" to="/build" />
<Route path="/" component={App}>
- <Redirect from="" to="build" />
<Route path="build" component={Build}>
{
forms.map(mapFormsToRoutes)
@@ -32,6 +32,7 @@
</Route>
<Route path="output" component={Html}/>
<Route path="json" component={Json}/>
+
</Route>
</Router>
</Provider> |
4033d8d6106842797b477edce3b333b987e749d2 | lib/index.js | lib/index.js | exports.initialize = require('./Bootstrapper')
exports.dep = require('./DependencySpec')
exports.events = require('../sdk/Events')
exports.iterable = require('../sdk/Iterable')
exports.decorators = require('./DecoratorManager')
exports.testable = require('./Testable') | exports.bootstrap = require('./Bootstrapper')
exports.dep = require('./DependencySpec')
exports.events = require('../sdk/Events')
exports.iterable = require('../sdk/Iterable')
exports.decorators = require('./DecoratorManager')
exports.testable = require('./Testable') | Update exports to match bootstrap naming convention | Update exports to match bootstrap naming convention
| JavaScript | mit | bsgbryan/madul | ---
+++
@@ -1,4 +1,4 @@
-exports.initialize = require('./Bootstrapper')
+exports.bootstrap = require('./Bootstrapper')
exports.dep = require('./DependencySpec')
exports.events = require('../sdk/Events')
exports.iterable = require('../sdk/Iterable') |
b1fe753d47c00b293432d80de98a1c8b76b811e3 | lib/index.js | lib/index.js | var Sequelize = require('sequelize'),
_ = require('lodash');
module.exports = function(target) {
if (target instanceof Sequelize.Model) {
// Model
createHook(target);
} else {
// Sequelize instance
target.afterDefine(createHook);
}
}
function createHook(model) {
model.addHook('beforeFindAfterOptions', function(options) {
if (options.role) {
var role = options.role,
attributes = options.attributes,
includes = options.include;
options.attributes = attrAccessible(model, role, attributes);
cleanIncludesRecursive(includes, role);
}
});
}
function attrAccessible(model, role, attributes) {
var attrsToReject = attrProtected(model, role);
return rejectAttributes(attributes, attrsToReject);
}
function attrProtected(model, role) {
return _.keys(_.pickBy(model.attributes, function(attr, name) {
return !_.isUndefined(attr.access) && ( attr.access === false || attr.access[role] === false );
}));
}
function rejectAttributes(attributes, attrsToRemove) {
return _.reject(attributes, function(attr) {
if (_.isArray(attr)) {
attr = attr[1];
}
return _.includes(attrsToRemove, attr);
});
}
function cleanIncludesRecursive(includes, role) {
_.each(includes, function(include) {
var model = include.model,
attributes = include.attributes;
include.attributes = attrAccessible(model, role, attributes);
if (include.include) {
cleanIncludesRecursive(include.include, role);
}
});
}
| var Sequelize = require('sequelize'),
_ = require('lodash');
module.exports = function(target) {
if (target instanceof Sequelize.Model) {
// Model
createHook(target);
} else {
// Sequelize instance
target.afterDefine(createHook);
}
}
function createHook(model) {
model.addHook('beforeFindAfterOptions', function(options) {
if (options.role) {
var role = options.role,
attributes = options.attributes,
includes = options.include;
options.attributes = attrAccessible(model, role, attributes);
cleanIncludesRecursive(includes, role);
}
});
}
function attrAccessible(model, role, attributes) {
var attrsToReject = attrProtected(model, role);
return rejectAttributes(attributes, attrsToReject);
}
function attrProtected(model, role) {
return _.keys(_.pickBy(model.rawAttributes, function(attr, name) {
return !_.isUndefined(attr.access) && ( attr.access === false || attr.access[role] === false );
}));
}
function rejectAttributes(attributes, attrsToRemove) {
return _.reject(attributes, function(attr) {
if (_.isArray(attr)) {
attr = attr[1];
}
return _.includes(attrsToRemove, attr);
});
}
function cleanIncludesRecursive(includes, role) {
_.each(includes, function(include) {
var model = include.model,
attributes = include.attributes;
include.attributes = attrAccessible(model, role, attributes);
if (include.include) {
cleanIncludesRecursive(include.include, role);
}
});
}
| Replace usage of deprecated model.attributes | Replace usage of deprecated model.attributes | JavaScript | mit | ackerdev/sequelize-attribute-roles | ---
+++
@@ -30,7 +30,7 @@
}
function attrProtected(model, role) {
- return _.keys(_.pickBy(model.attributes, function(attr, name) {
+ return _.keys(_.pickBy(model.rawAttributes, function(attr, name) {
return !_.isUndefined(attr.access) && ( attr.access === false || attr.access[role] === false );
}));
} |
5d4acafb8b9ec0814c147a10c1a2bafc653a4afa | static/chat.js | static/chat.js | $(function() {
// When we're using HTTPS, use WSS too.
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var chatsock = new ReconnectingWebSocket(ws_scheme + '://' + window.location.host + "/chat" + window.location.pathname);
chatsock.onmessage = function(message) {
var data = JSON.parse(message.data);
$("#chat").append('<tr>'
+ '<td>' + data.timestamp + '</td>'
+ '<td>' + data.handle + '</td>'
+ '<td>' + data.message + ' </td>'
+ '</tr>');
};
$("#chatform").on("submit", function(event) {
var message = {
handle: $('#handle').val(),
message: $('#message').val(),
}
chatsock.send(JSON.stringify(message));
$("#message").val('').focus();
return false;
});
}); | $(function() {
// When we're using HTTPS, use WSS too.
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var chatsock = new ReconnectingWebSocket(ws_scheme + '://' + window.location.host + "/chat" + window.location.pathname);
chatsock.onmessage = function(message) {
var data = JSON.parse(message.data);
var chat = $("#chat")
var ele = $('<tr></tr>')
ele.append(
$("<td></td>").text(data.timestamp)
)
ele.append(
$("<td></td>").text(data.handle)
)
ele.append(
$("<td></td>").text(data.message)
)
chat.append(ele)
};
$("#chatform").on("submit", function(event) {
var message = {
handle: $('#handle').val(),
message: $('#message').val(),
}
chatsock.send(JSON.stringify(message));
$("#message").val('').focus();
return false;
});
}); | Fix XSS issue in demo | Fix XSS issue in demo
| JavaScript | bsd-3-clause | TranDinhKhang/funkychat,jacobian/channels-example,jacobian/channels-example,ZipoZ/chatapp,cloud-fire/signalnews,cloud-fire/signalnews,cloud-fire/signalnews,ZipoZ/chatapp,davidkjtoh/GlorgoChat,TranDinhKhang/funkychat,TranDinhKhang/funkychat,jacobian/channels-example,ZipoZ/chatapp,davidkjtoh/GlorgoChat,davidkjtoh/GlorgoChat | ---
+++
@@ -5,11 +5,20 @@
chatsock.onmessage = function(message) {
var data = JSON.parse(message.data);
- $("#chat").append('<tr>'
- + '<td>' + data.timestamp + '</td>'
- + '<td>' + data.handle + '</td>'
- + '<td>' + data.message + ' </td>'
- + '</tr>');
+ var chat = $("#chat")
+ var ele = $('<tr></tr>')
+
+ ele.append(
+ $("<td></td>").text(data.timestamp)
+ )
+ ele.append(
+ $("<td></td>").text(data.handle)
+ )
+ ele.append(
+ $("<td></td>").text(data.message)
+ )
+
+ chat.append(ele)
};
$("#chatform").on("submit", function(event) { |
72c2a692ac1a6c123328413bb35ddb7dd648691e | client/views/rooms/room_view.js | client/views/rooms/room_view.js | Template.roomView.helpers({
room: function () {
return Rooms.findOne({_id: Session.get('currentRoom')});
},
roomUsers: function () {
var room = Rooms.findOne({_id: Session.get('currentRoom')});
return Meteor.users.find({_id: {$in: room.users}});
},
currentRooms: function () {
return Rooms.find({users: Meteor.userId()});
},
currentRoom: function () {
return Session.get('currentRoom');
},
availableRooms: function () {
return Rooms.find();
}
});
Template.roomView.events({
'click #loadMore': function (e) {
Session.set('messageLimit', Session.get('messageLimit') + 20);
e.preventDefault();
}
});
Template.roomView.rendered = function () {
Meteor.call('setSeen', Session.get('currentRoom'));
Meteor.setTimeout(scrollChatToBottom, 100);
};
Template.roomView.created = function () {
Deps.autorun(function () {
Meteor.subscribe('messages', Session.get('currentRoom'), Session.get('messageLimit'));
Meteor.subscribe('feedbackMessages', Session.get('currentRoom'));
});
}; | Template.roomView.helpers({
room: function () {
return Rooms.findOne({_id: Session.get('currentRoom')});
},
roomUsers: function () {
var room = Rooms.findOne({_id: Session.get('currentRoom')});
if(room) {
return Meteor.users.find({_id: {$in: room.users}});
}
else{
return [];
}
},
currentRooms: function () {
return Rooms.find({users: Meteor.userId()});
},
currentRoom: function () {
return Session.get('currentRoom');
},
availableRooms: function () {
return Rooms.find();
}
});
Template.roomView.events({
'click #loadMore': function (e) {
Session.set('messageLimit', Session.get('messageLimit') + 20);
e.preventDefault();
}
});
Template.roomView.rendered = function () {
Meteor.call('setSeen', Session.get('currentRoom'));
Meteor.setTimeout(scrollChatToBottom, 100);
};
Template.roomView.created = function () {
Deps.autorun(function () {
Meteor.subscribe('messages', Session.get('currentRoom'), Session.get('messageLimit'));
Meteor.subscribe('feedbackMessages', Session.get('currentRoom'));
});
}; | Handle room users case when not in room | Handle room users case when not in room
| JavaScript | mit | mattfeldman/nullchat,mattfeldman/nullchat,coreyaus/nullchat,praneybehl/nullchat,katopz/nullchat,katopz/nullchat,coreyaus/nullchat,praneybehl/nullchat | ---
+++
@@ -4,7 +4,12 @@
},
roomUsers: function () {
var room = Rooms.findOne({_id: Session.get('currentRoom')});
- return Meteor.users.find({_id: {$in: room.users}});
+ if(room) {
+ return Meteor.users.find({_id: {$in: room.users}});
+ }
+ else{
+ return [];
+ }
},
currentRooms: function () {
return Rooms.find({users: Meteor.userId()}); |
a9d315cb1305ba4d5941767a03c452edfb3ed2ea | app.js | app.js | var express = require('express');
var http = require('http');
var socketIO = require('socket.io');
var path = require('path');
var game = require('./game.js');
var app = express();
var server = http.Server(app);
var io = socketIO(server);
app.set('views', path.join(__dirname, 'templates'));
app.set('view engine', 'jade');
app.use(express.static('public'));
app.get('/', function(req, res) {
var state0 = game.getInitialState()
res.render('index', state0);
})
io.on('connection', function(socket){
console.log('CONNECT', socket.id);
socket.on('log on', function(name){
console.log('LOG ON', name);
socket.broadcast.emit('log on', name);
})
socket.on('log off', function(name) {
console.log('LOG OFF', name);
socket.broadcast.emit('log off', name);
})
socket.on('disconnect', function(){
console.log('DISCONNECT', socket.id);
});
});
server.listen(3000, function() {
console.log("listening on port 3000");
});
| var express = require('express');
var http = require('http');
var socketIO = require('socket.io');
var path = require('path');
var game = require('./game.js');
var app = express();
var server = http.Server(app);
var io = socketIO(server);
app.set('views', path.join(__dirname, 'templates'));
app.set('view engine', 'jade');
app.use(express.static('public'));
app.get('/', function(req, res) {
var state0 = game.getInitialState()
res.render('index', state0);
})
io.on('connection', function(socket){
console.log('CONNECT', socket.id);
socket.on('log on', function(name){
console.log('LOG ON', name);
socket.broadcast.emit('log on', name);
})
socket.on('log off', function(name) {
console.log('LOG OFF', name);
socket.broadcast.emit('log off', name);
})
socket.on('disconnect', function(){
console.log('DISCONNECT', socket.id);
});
socket.on('card click', function(click){
console.log('CARD CLICK', click.user, click.card);
});
});
server.listen(3000, function() {
console.log("listening on port 3000");
});
| Handle incoming card click event with simple logger | Handle incoming card click event with simple logger
| JavaScript | mit | vakila/net-set,vakila/net-set | ---
+++
@@ -31,6 +31,9 @@
socket.on('disconnect', function(){
console.log('DISCONNECT', socket.id);
});
+ socket.on('card click', function(click){
+ console.log('CARD CLICK', click.user, click.card);
+ });
});
server.listen(3000, function() { |
f10a56b256cf34a8932c93b62af12d0e70babd19 | lib/cli.js | lib/cli.js | "use strict";
const generate = require("./generate");
const log = require("./log");
const init = require("./init");
const program = require("commander");
module.exports = function() {
program.version("0.0.1");
program.command("generate")
.description("Generate site.")
.option("-v, --verbose", "Enable verbose logging.", log.increaseVerbosity)
.action(generate.generate);
program.command("init")
.description("Initialize a new project.")
.option("-v, --verbose", "Enable verbose logging.", log.increaseVerbosity)
.action(init.init);
program.parse(process.argv);
};
| "use strict";
const generate = require("./generate");
const log = require("./log");
const init = require("./init");
const program = require("commander");
const version = require("../package.json").version;
module.exports = function() {
program.version(version);
program.command("generate")
.description("Generate site.")
.option("-v, --verbose", "Enable verbose logging.", log.increaseVerbosity)
.action(generate.generate);
program.command("init")
.description("Initialize a new project.")
.option("-v, --verbose", "Enable verbose logging.", log.increaseVerbosity)
.action(init.init);
program.parse(process.argv);
};
| Make lerret -V return the actual version number. | Make lerret -V return the actual version number.
| JavaScript | apache-2.0 | jgrh/lerret | ---
+++
@@ -4,9 +4,10 @@
const log = require("./log");
const init = require("./init");
const program = require("commander");
+const version = require("../package.json").version;
module.exports = function() {
- program.version("0.0.1");
+ program.version(version);
program.command("generate")
.description("Generate site.") |
bbddd52a58e0762324f281c22f9f4c876285b21b | app.js | app.js | var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
var spotify = require('spotify-node-applescript');
var SpotifyRemoteServer = require('./lib/spotify_remote_server');
io.enable('browser client minification');
io.enable('browser client etag');
io.enable('browser client gzip');
io.set('log level', 1);
app.configure(function() {
app.set('port', process.env.PORT || 3000);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.static(path.join(__dirname, 'public')));
});
app.configure('development', function() {
app.use(express.errorHandler());
});
app.get('/', function(req, res) {
res.sendfile(__dirname + '/public/index.html');
});
server.listen(app.get('port'), function() {
console.log('Your spotify remote is awaiting commands on: http://localhost:' + app.get('port'));
});
new SpotifyRemoteServer(io, spotify);
| var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
var spotify = require('spotify-node-applescript');
var SpotifyRemoteServer = require('./lib/spotify_remote_server');
io.enable('browser client minification');
io.enable('browser client etag');
io.enable('browser client gzip');
io.set('log level', 1);
app.configure(function() {
app.set('port', process.env.PORT || 3000);
app.use(express.favicon());
app.use(express.static(path.join(__dirname, 'public')));
});
app.get('/', function(req, res) {
res.sendfile(__dirname + '/public/index.html');
});
server.listen(app.get('port'), function() {
console.log('Your spotify remote is awaiting commands on: http://localhost:' + app.get('port'));
});
new SpotifyRemoteServer(io, spotify);
| Remove dev logging, don't need it. Console.log like in the old days! | Remove dev logging, don't need it. Console.log like in the old days!
| JavaScript | mit | david-crowell/spotify-remote,rmehner/spotify-remote | ---
+++
@@ -15,12 +15,7 @@
app.configure(function() {
app.set('port', process.env.PORT || 3000);
app.use(express.favicon());
- app.use(express.logger('dev'));
app.use(express.static(path.join(__dirname, 'public')));
-});
-
-app.configure('development', function() {
- app.use(express.errorHandler());
});
app.get('/', function(req, res) { |
fe9e1a025037fabbc2f4db1473537e42bfb5ecd9 | app.js | app.js | var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World from iojs ' + process.version + '!\n');
}).listen(process.env.port); | const http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(`Hello World from iojs ${process.version}!\n`);
}).listen(process.env.port); | Use const and string template | Use const and string template
| JavaScript | mit | felixrieseberg/iojs-azure,felixrieseberg/iojs-azure,thewazir/iojs-azure | ---
+++
@@ -1,6 +1,6 @@
-var http = require('http');
+const http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end('Hello World from iojs ' + process.version + '!\n');
+ res.end(`Hello World from iojs ${process.version}!\n`);
}).listen(process.env.port); |
865a1835651ee0c9223013b7b56ce07d4c9d25ae | module/index.js | module/index.js | const ifElse = require('1-liners/ifElse');
const isFunction = require('1-liners/isFunction');
const filter = require('1-liners/filter');
const compose = require('1-liners/compose');
const castBool = (val) => val === true;
const throwError = (msg) => () => { throw new Error(msg); };
const filterCurried = (filterFn) => ifElse(
Array.isArray,
(arr) => filter(compose(castBool, filterFn), arr),
throwError('Filter expected an array')
);
export default ifElse(
isFunction,
filterCurried,
throwError('Filter expected a function')
);
| const ifElse = require('1-liners/ifElse');
const isFunction = require('1-liners/isFunction');
const filter = require('1-liners/filter');
const throwError = (msg) => () => { throw new Error(msg); };
const filterCurried = (filterFn) => ifElse(
Array.isArray,
(arr) => filter(filterFn, arr),
throwError('Filter expected an array')
);
export default ifElse(
isFunction,
filterCurried,
throwError('Filter expected a function')
);
| Update logic to fixed test | Update logic to fixed test
| JavaScript | mit | studio-b12/doxie.filter | ---
+++
@@ -1,14 +1,12 @@
const ifElse = require('1-liners/ifElse');
const isFunction = require('1-liners/isFunction');
const filter = require('1-liners/filter');
-const compose = require('1-liners/compose');
-const castBool = (val) => val === true;
const throwError = (msg) => () => { throw new Error(msg); };
const filterCurried = (filterFn) => ifElse(
Array.isArray,
- (arr) => filter(compose(castBool, filterFn), arr),
+ (arr) => filter(filterFn, arr),
throwError('Filter expected an array')
);
|
c0bc950791feae6b5b81b5e08f5fb125ec0616bb | src/vs/editor/buildfile.js | src/vs/editor/buildfile.js | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
function createModuleDescription(name, exclude) {
var result= {};
result.name= name;
var excludes = ['vs/css', 'vs/nls', 'vs/text'];
if (Array.isArray(exclude) && exclude.length > 0) {
excludes = excludes.concat(exclude);
}
result.exclude= excludes;
return result;
}
function addInclude(config, include) {
if (!config.include) {
config.include = [];
}
config.include.push(include);
return config;
}
exports.collectModules= function() {
return [
// Include the severity module into the base worker code since it is used by many languages
// It can cause waterfall loading if one language excludes another language it depends on and
// both use vs/base/common/severity
addInclude(
createModuleDescription('vs/editor/common/worker/editorWorkerServer', ['vs/base/common/worker/workerServer']),
'vs/base/common/severity'
),
createModuleDescription('vs/editor/common/services/editorSimpleWorker'),
];
}; | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
function createModuleDescription(name, exclude) {
var result= {};
result.name= name;
var excludes = ['vs/css', 'vs/nls', 'vs/text'];
if (Array.isArray(exclude) && exclude.length > 0) {
excludes = excludes.concat(exclude);
}
result.exclude= excludes;
return result;
}
function addInclude(config, include) {
if (!config.include) {
config.include = [];
}
config.include.push(include);
return config;
}
exports.collectModules= function() {
return [
// Include the severity module into the base worker code since it is used by many languages
// It can cause waterfall loading if one language excludes another language it depends on and
// both use vs/base/common/severity
addInclude(
createModuleDescription('vs/editor/common/worker/editorWorkerServer', ['vs/base/common/worker/workerServer']),
'vs/base/common/severity'
),
createModuleDescription('vs/editor/common/services/editorSimpleWorker', ['vs/base/common/worker/simpleWorker']),
];
}; | Exclude `simpleWorker` from `editorSimpleWorker` in bundling | Exclude `simpleWorker` from `editorSimpleWorker` in bundling
| JavaScript | mit | williamcspace/vscode,0xmohit/vscode,hoovercj/vscode,0xmohit/vscode,DustinCampbell/vscode,KattMingMing/vscode,stringham/vscode,radshit/vscode,stringham/vscode,edumunoz/vscode,Zalastax/vscode,mjbvz/vscode,cleidigh/vscode,Zalastax/vscode,bsmr-x-script/vscode,edumunoz/vscode,SofianHn/vscode,microlv/vscode,hashhar/vscode,sifue/vscode,Krzysztof-Cieslak/vscode,hashhar/vscode,veeramarni/vscode,sifue/vscode,microsoft/vscode,eklavyamirani/vscode,zyml/vscode,veeramarni/vscode,Microsoft/vscode,joaomoreno/vscode,microlv/vscode,rishii7/vscode,matthewshirley/vscode,mjbvz/vscode,KattMingMing/vscode,sifue/vscode,bsmr-x-script/vscode,jchadwick/vscode,sifue/vscode,landonepps/vscode,KattMingMing/vscode,the-ress/vscode,microsoft/vscode,hashhar/vscode,radshit/vscode,cleidigh/vscode,gagangupt16/vscode,joaomoreno/vscode,rishii7/vscode,matthewshirley/vscode,sifue/vscode,sifue/vscode,gagangupt16/vscode,microsoft/vscode,ups216/vscode,veeramarni/vscode,0xmohit/vscode,zyml/vscode,joaomoreno/vscode,Zalastax/vscode,matthewshirley/vscode,microsoft/vscode,hashhar/vscode,ioklo/vscode,punker76/vscode,jchadwick/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,f111fei/vscode,charlespierce/vscode,zyml/vscode,cleidigh/vscode,eamodio/vscode,f111fei/vscode,mjbvz/vscode,sifue/vscode,gagangupt16/vscode,hungys/vscode,radshit/vscode,zyml/vscode,microlv/vscode,ioklo/vscode,DustinCampbell/vscode,williamcspace/vscode,bsmr-x-script/vscode,dersia/vscode,eamodio/vscode,SofianHn/vscode,williamcspace/vscode,gagangupt16/vscode,microsoft/vscode,radshit/vscode,landonepps/vscode,hoovercj/vscode,joaomoreno/vscode,alexandrudima/vscode,edumunoz/vscode,alexandrudima/vscode,zyml/vscode,0xmohit/vscode,Zalastax/vscode,ups216/vscode,hashhar/vscode,mjbvz/vscode,rishii7/vscode,bsmr-x-script/vscode,hashhar/vscode,cleidigh/vscode,eklavyamirani/vscode,0xmohit/vscode,veeramarni/vscode,zyml/vscode,the-ress/vscode,DustinCampbell/vscode,cleidigh/vscode,radshit/vscode,hashhar/vscode,ups216/vscode,microlv/vscode,joaomoreno/vscode,rishii7/vscode,matthewshirley/vscode,edumunoz/vscode,KattMingMing/vscode,hungys/vscode,f111fei/vscode,mjbvz/vscode,Zalastax/vscode,matthewshirley/vscode,joaomoreno/vscode,veeramarni/vscode,KattMingMing/vscode,rishii7/vscode,DustinCampbell/vscode,veeramarni/vscode,hoovercj/vscode,charlespierce/vscode,hoovercj/vscode,matthewshirley/vscode,DustinCampbell/vscode,DustinCampbell/vscode,KattMingMing/vscode,cleidigh/vscode,radshit/vscode,ups216/vscode,matthewshirley/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,microsoft/vscode,gagangupt16/vscode,charlespierce/vscode,0xmohit/vscode,cleidigh/vscode,landonepps/vscode,microlv/vscode,williamcspace/vscode,Microsoft/vscode,hashhar/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,jchadwick/vscode,williamcspace/vscode,microlv/vscode,hungys/vscode,charlespierce/vscode,dersia/vscode,ups216/vscode,hungys/vscode,ups216/vscode,eamodio/vscode,eklavyamirani/vscode,Zalastax/vscode,KattMingMing/vscode,edumunoz/vscode,sifue/vscode,hungys/vscode,charlespierce/vscode,edumunoz/vscode,rishii7/vscode,hoovercj/vscode,williamcspace/vscode,bsmr-x-script/vscode,hoovercj/vscode,bsmr-x-script/vscode,ioklo/vscode,stringham/vscode,Zalastax/vscode,DustinCampbell/vscode,0xmohit/vscode,mjbvz/vscode,f111fei/vscode,cleidigh/vscode,f111fei/vscode,williamcspace/vscode,veeramarni/vscode,eamodio/vscode,Microsoft/vscode,eklavyamirani/vscode,eamodio/vscode,the-ress/vscode,KattMingMing/vscode,jchadwick/vscode,hashhar/vscode,joaomoreno/vscode,ups216/vscode,0xmohit/vscode,Krzysztof-Cieslak/vscode,zyml/vscode,hashhar/vscode,landonepps/vscode,eamodio/vscode,veeramarni/vscode,the-ress/vscode,ioklo/vscode,hoovercj/vscode,f111fei/vscode,DustinCampbell/vscode,williamcspace/vscode,veeramarni/vscode,ups216/vscode,williamcspace/vscode,joaomoreno/vscode,gagangupt16/vscode,eamodio/vscode,Microsoft/vscode,ups216/vscode,0xmohit/vscode,ioklo/vscode,ioklo/vscode,landonepps/vscode,eklavyamirani/vscode,KattMingMing/vscode,landonepps/vscode,rishii7/vscode,rkeithhill/VSCode,microlv/vscode,the-ress/vscode,Zalastax/vscode,ups216/vscode,Zalastax/vscode,dersia/vscode,eklavyamirani/vscode,hoovercj/vscode,rishii7/vscode,KattMingMing/vscode,mjbvz/vscode,Microsoft/vscode,jchadwick/vscode,bsmr-x-script/vscode,stringham/vscode,hoovercj/vscode,radshit/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,sifue/vscode,eamodio/vscode,veeramarni/vscode,sifue/vscode,microsoft/vscode,zyml/vscode,mjbvz/vscode,punker76/vscode,DustinCampbell/vscode,KattMingMing/vscode,DustinCampbell/vscode,0xmohit/vscode,eamodio/vscode,Zalastax/vscode,stringham/vscode,radshit/vscode,eklavyamirani/vscode,hungys/vscode,mjbvz/vscode,hungys/vscode,edumunoz/vscode,edumunoz/vscode,cleidigh/vscode,the-ress/vscode,microlv/vscode,gagangupt16/vscode,ups216/vscode,Krzysztof-Cieslak/vscode,hungys/vscode,zyml/vscode,f111fei/vscode,joaomoreno/vscode,hungys/vscode,zyml/vscode,jchadwick/vscode,veeramarni/vscode,eklavyamirani/vscode,zyml/vscode,cleidigh/vscode,hoovercj/vscode,0xmohit/vscode,rishii7/vscode,bsmr-x-script/vscode,radshit/vscode,microsoft/vscode,microsoft/vscode,the-ress/vscode,jchadwick/vscode,ioklo/vscode,ups216/vscode,williamcspace/vscode,Microsoft/vscode,matthewshirley/vscode,williamcspace/vscode,edumunoz/vscode,bsmr-x-script/vscode,zyml/vscode,mjbvz/vscode,jchadwick/vscode,matthewshirley/vscode,eklavyamirani/vscode,cleidigh/vscode,hoovercj/vscode,ioklo/vscode,eklavyamirani/vscode,jchadwick/vscode,cleidigh/vscode,rishii7/vscode,KattMingMing/vscode,jchadwick/vscode,landonepps/vscode,stringham/vscode,matthewshirley/vscode,radshit/vscode,hashhar/vscode,hoovercj/vscode,KattMingMing/vscode,Zalastax/vscode,stringham/vscode,ups216/vscode,cleidigh/vscode,hoovercj/vscode,stringham/vscode,ups216/vscode,microsoft/vscode,zyml/vscode,0xmohit/vscode,0xmohit/vscode,stringham/vscode,Zalastax/vscode,matthewshirley/vscode,matthewshirley/vscode,bsmr-x-script/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,stringham/vscode,f111fei/vscode,sifue/vscode,edumunoz/vscode,eamodio/vscode,zyml/vscode,the-ress/vscode,matthewshirley/vscode,jchadwick/vscode,gagangupt16/vscode,matthewshirley/vscode,veeramarni/vscode,mjbvz/vscode,the-ress/vscode,eamodio/vscode,f111fei/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,KattMingMing/vscode,charlespierce/vscode,Krzysztof-Cieslak/vscode,charlespierce/vscode,DustinCampbell/vscode,zyml/vscode,radshit/vscode,jchadwick/vscode,hungys/vscode,Microsoft/vscode,gagangupt16/vscode,ioklo/vscode,Microsoft/vscode,landonepps/vscode,charlespierce/vscode,KattMingMing/vscode,ups216/vscode,mjbvz/vscode,stringham/vscode,williamcspace/vscode,Microsoft/vscode,KattMingMing/vscode,eklavyamirani/vscode,DustinCampbell/vscode,jchadwick/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,mjbvz/vscode,microsoft/vscode,landonepps/vscode,microlv/vscode,eklavyamirani/vscode,gagangupt16/vscode,Zalastax/vscode,ioklo/vscode,microsoft/vscode,ioklo/vscode,alexandrudima/vscode,edumunoz/vscode,stringham/vscode,microlv/vscode,hoovercj/vscode,jchadwick/vscode,landonepps/vscode,Microsoft/vscode,DustinCampbell/vscode,matthewshirley/vscode,ioklo/vscode,cleidigh/vscode,hungys/vscode,charlespierce/vscode,eklavyamirani/vscode,eamodio/vscode,veeramarni/vscode,landonepps/vscode,hungys/vscode,radshit/vscode,microlv/vscode,mjbvz/vscode,bsmr-x-script/vscode,joaomoreno/vscode,sifue/vscode,hashhar/vscode,ioklo/vscode,joaomoreno/vscode,charlespierce/vscode,sifue/vscode,jchadwick/vscode,edumunoz/vscode,edumunoz/vscode,matthewshirley/vscode,bsmr-x-script/vscode,the-ress/vscode,punker76/vscode,eamodio/vscode,sifue/vscode,sifue/vscode,rishii7/vscode,f111fei/vscode,stringham/vscode,bsmr-x-script/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,landonepps/vscode,microsoft/vscode,hashhar/vscode,radshit/vscode,f111fei/vscode,bsmr-x-script/vscode,ioklo/vscode,0xmohit/vscode,microlv/vscode,Microsoft/vscode,zyml/vscode,cleidigh/vscode,landonepps/vscode,dersia/vscode,radshit/vscode,bsmr-x-script/vscode,charlespierce/vscode,stringham/vscode,hungys/vscode,microlv/vscode,gagangupt16/vscode,mjbvz/vscode,charlespierce/vscode,hashhar/vscode,hungys/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,charlespierce/vscode,radshit/vscode,charlespierce/vscode,jchadwick/vscode,veeramarni/vscode,Zalastax/vscode,edumunoz/vscode,hoovercj/vscode,radshit/vscode,bsmr-x-script/vscode,sifue/vscode,cra0zy/VSCode,eklavyamirani/vscode,punker76/vscode,veeramarni/vscode,alexandrudima/vscode,charlespierce/vscode,veeramarni/vscode,0xmohit/vscode,ups216/vscode,Krzysztof-Cieslak/vscode,hashhar/vscode,gagangupt16/vscode,microsoft/vscode,cleidigh/vscode,landonepps/vscode,Microsoft/vscode,SofianHn/vscode,landonepps/vscode,Zalastax/vscode,cleidigh/vscode,charlespierce/vscode,eamodio/vscode,gagangupt16/vscode,microlv/vscode,the-ress/vscode,zyml/vscode,gagangupt16/vscode,eklavyamirani/vscode,Microsoft/vscode,hashhar/vscode,microlv/vscode,hoovercj/vscode,edumunoz/vscode,gagangupt16/vscode,stringham/vscode,microlv/vscode,the-ress/vscode,williamcspace/vscode,f111fei/vscode,hungys/vscode,charlespierce/vscode,stringham/vscode,rishii7/vscode,gagangupt16/vscode,the-ress/vscode,williamcspace/vscode,Zalastax/vscode,microsoft/vscode,microsoft/vscode,hoovercj/vscode,ioklo/vscode,f111fei/vscode,mjbvz/vscode,Microsoft/vscode,williamcspace/vscode,eklavyamirani/vscode,hashhar/vscode,williamcspace/vscode,mjbvz/vscode,williamcspace/vscode,eamodio/vscode,f111fei/vscode,hungys/vscode,0xmohit/vscode,rishii7/vscode,SofianHn/vscode,gagangupt16/vscode,matthewshirley/vscode,eklavyamirani/vscode,the-ress/vscode,f111fei/vscode,ups216/vscode,rishii7/vscode,radshit/vscode,joaomoreno/vscode,Zalastax/vscode,DustinCampbell/vscode,hungys/vscode,joaomoreno/vscode,DustinCampbell/vscode,microlv/vscode,rishii7/vscode,joaomoreno/vscode,ioklo/vscode,Microsoft/vscode,stringham/vscode,veeramarni/vscode,f111fei/vscode,microsoft/vscode,rishii7/vscode,jchadwick/vscode,edumunoz/vscode,0xmohit/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,eamodio/vscode,rishii7/vscode | ---
+++
@@ -32,6 +32,6 @@
createModuleDescription('vs/editor/common/worker/editorWorkerServer', ['vs/base/common/worker/workerServer']),
'vs/base/common/severity'
),
- createModuleDescription('vs/editor/common/services/editorSimpleWorker'),
+ createModuleDescription('vs/editor/common/services/editorSimpleWorker', ['vs/base/common/worker/simpleWorker']),
];
}; |
e227cf88360aab1c5a617df46aada1cd34a4aba0 | client/modules/core/components/.stories/poll_buttons.js | client/modules/core/components/.stories/poll_buttons.js | import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { withKnobs, text, boolean, number, object } from '@kadira/storybook-addon-knobs';
import { setComposerStub } from 'react-komposer';
import PollButtons from '../poll_buttons.jsx';
import palette from '../../libs/palette';
storiesOf('core.PollButtons', module)
.addDecorator(withKnobs)
.add('default view', () => {
const poll = object('poll', {
_id: 'abc123',
question: 'Ice Cream Flavors',
options: [
{
name: 'Chocolate',
votes: 10
},
{
name: 'Vanilla',
votes: 5
},
{
name: 'Rocky Road',
votes: 20
}
]
});
const colorScale = palette([ 'tol', 'tol-rainbow' ], poll.options.length);
return (
<PollButtons
poll={poll}
colorScale={colorScale}
vote={action('pollButtons-vote-clicked')}
/>
);
});
| import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { withKnobs, text, boolean, number, object } from '@kadira/storybook-addon-knobs';
import { setComposerStub } from 'react-komposer';
import PollButtons from '../poll_buttons.jsx';
import palette from '../../libs/palette';
storiesOf('core.PollButtons', module)
.addDecorator(withKnobs)
.add('default view', () => {
const poll = object('poll', {
_id: 'abc123',
question: 'Ice Cream Flavors',
options: [
{
name: 'Chocolate',
votes: 10
},
{
name: 'Vanilla',
votes: 5
},
{
name: 'Rocky Road',
votes: 20
}
]
});
const isLoggedIn = boolean('isLoggedIn', true);
const colorScale = palette([ 'tol', 'tol-rainbow' ], poll.options.length);
return (
<PollButtons
poll={poll}
colorScale={colorScale}
isLoggedIn={isLoggedIn}
vote={action('pollButtons-vote-clicked')}
/>
);
});
| Add isLoggedIn knob to story for pollButtons | Add isLoggedIn knob to story for pollButtons
| JavaScript | mit | thancock20/voting-app,thancock20/voting-app | ---
+++
@@ -26,11 +26,13 @@
}
]
});
+ const isLoggedIn = boolean('isLoggedIn', true);
const colorScale = palette([ 'tol', 'tol-rainbow' ], poll.options.length);
return (
<PollButtons
poll={poll}
colorScale={colorScale}
+ isLoggedIn={isLoggedIn}
vote={action('pollButtons-vote-clicked')}
/>
); |
5db4e14f5e228390520605e6123e86a6ce199dd2 | cli/run-yeoman-process.js | cli/run-yeoman-process.js | /**
* Copyright 2013-2020 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const chalk = require('chalk');
const packageJson = require('../package.json');
const { logger, toString, getCommandOptions, doneFactory } = require('./utils');
const EnvironmentBuilder = require('./environment-builder');
const env = EnvironmentBuilder.createDefaultBuilder().getEnvironment();
const command = process.argv[2];
const options = getCommandOptions(packageJson, process.argv.slice(3));
logger.info(chalk.yellow(`Executing ${command} on ${process.cwd()}`));
logger.info(chalk.yellow(`Options: ${toString(options)}`));
try {
env.run(command, options, doneFactory());
} catch (e) {
logger.error(e.message, e);
process.exitCode = 1;
}
| /**
* Copyright 2013-2020 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const chalk = require('chalk');
const packageJson = require('../package.json');
const { logger, toString, getCommandOptions, doneFactory } = require('./utils');
const EnvironmentBuilder = require('./environment-builder');
const env = EnvironmentBuilder.createDefaultBuilder().getEnvironment();
const command = process.argv[2];
const options = getCommandOptions(packageJson, process.argv.slice(3));
logger.info(chalk.yellow(`Executing ${command} on ${process.cwd()}`));
logger.debug(chalk.yellow(`Options: ${toString(options)}`));
try {
env.run(command, options, doneFactory());
} catch (e) {
logger.error(e.message, e);
process.exitCode = 1;
}
| Change another options log from info to debug | Change another options log from info to debug | JavaScript | apache-2.0 | PierreBesson/generator-jhipster,ctamisier/generator-jhipster,mraible/generator-jhipster,wmarques/generator-jhipster,atomfrede/generator-jhipster,pascalgrimaud/generator-jhipster,vivekmore/generator-jhipster,ctamisier/generator-jhipster,mraible/generator-jhipster,liseri/generator-jhipster,atomfrede/generator-jhipster,mraible/generator-jhipster,ruddell/generator-jhipster,dynamicguy/generator-jhipster,PierreBesson/generator-jhipster,cbornet/generator-jhipster,ruddell/generator-jhipster,wmarques/generator-jhipster,PierreBesson/generator-jhipster,pascalgrimaud/generator-jhipster,gmarziou/generator-jhipster,gmarziou/generator-jhipster,cbornet/generator-jhipster,atomfrede/generator-jhipster,gmarziou/generator-jhipster,pascalgrimaud/generator-jhipster,dynamicguy/generator-jhipster,liseri/generator-jhipster,ruddell/generator-jhipster,atomfrede/generator-jhipster,jhipster/generator-jhipster,dynamicguy/generator-jhipster,vivekmore/generator-jhipster,wmarques/generator-jhipster,liseri/generator-jhipster,cbornet/generator-jhipster,dynamicguy/generator-jhipster,liseri/generator-jhipster,ruddell/generator-jhipster,pascalgrimaud/generator-jhipster,vivekmore/generator-jhipster,ctamisier/generator-jhipster,cbornet/generator-jhipster,jhipster/generator-jhipster,ctamisier/generator-jhipster,jhipster/generator-jhipster,vivekmore/generator-jhipster,atomfrede/generator-jhipster,jhipster/generator-jhipster,gmarziou/generator-jhipster,pascalgrimaud/generator-jhipster,ctamisier/generator-jhipster,jhipster/generator-jhipster,PierreBesson/generator-jhipster,liseri/generator-jhipster,wmarques/generator-jhipster,vivekmore/generator-jhipster,PierreBesson/generator-jhipster,wmarques/generator-jhipster,ruddell/generator-jhipster,cbornet/generator-jhipster,gmarziou/generator-jhipster,mraible/generator-jhipster,mraible/generator-jhipster | ---
+++
@@ -27,7 +27,7 @@
const command = process.argv[2];
const options = getCommandOptions(packageJson, process.argv.slice(3));
logger.info(chalk.yellow(`Executing ${command} on ${process.cwd()}`));
-logger.info(chalk.yellow(`Options: ${toString(options)}`));
+logger.debug(chalk.yellow(`Options: ${toString(options)}`));
try {
env.run(command, options, doneFactory());
} catch (e) { |
d927838b6cfaa68c198a27eb23bc2447db9db819 | client/.storybook/main.js | client/.storybook/main.js | module.exports = {
"stories": [
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
],
"core": {
"builder": "webpack5"
}
}
| module.exports = {
"stories": [
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
],
"core": {
"builder": "webpack5"
},
"webpackFinal": (config) => {
config.resolve.fallback.crypto = false;
return config;
},
}
| Add crypto to storybook fallbacks | Add crypto to storybook fallbacks
| JavaScript | bsd-3-clause | gasman/wagtail,jnns/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,jnns/wagtail,wagtail/wagtail,torchbox/wagtail,mixxorz/wagtail,gasman/wagtail,rsalmaso/wagtail,wagtail/wagtail,wagtail/wagtail,thenewguy/wagtail,gasman/wagtail,thenewguy/wagtail,zerolab/wagtail,mixxorz/wagtail,zerolab/wagtail,thenewguy/wagtail,thenewguy/wagtail,gasman/wagtail,thenewguy/wagtail,torchbox/wagtail,mixxorz/wagtail,zerolab/wagtail,mixxorz/wagtail,zerolab/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,gasman/wagtail,wagtail/wagtail,jnns/wagtail,wagtail/wagtail,zerolab/wagtail,jnns/wagtail,torchbox/wagtail,torchbox/wagtail,mixxorz/wagtail | ---
+++
@@ -8,5 +8,9 @@
],
"core": {
"builder": "webpack5"
- }
+ },
+ "webpackFinal": (config) => {
+ config.resolve.fallback.crypto = false;
+ return config;
+ },
} |
bb8c64b15782626e15bf87a8d990dbefaf796791 | server/app/scripts/services/stdout.js | server/app/scripts/services/stdout.js | 'use strict';
angular.module('app').service('stdout', ['$window', function($window) {
var callback = undefined;
var websocket = undefined;
this.subscribe = function(path, _callback) {
callback = _callback;
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
var route = [proto, "://", $window.location.host, '/api/feed/stdout/', path].join('');
websocket = new WebSocket(route);
websocket.onmessage = function(event) {
if (callback != undefined) {
callback(event.data);
}
};
websocket.onclose = function(event) {
console.log('websocket closed at '+path);
};
};
this.unsubscribe = function() {
callback = undefined;
if (websocket != undefined) {
console.log('unsubscribing websocket at '+websocket.url);
websocket.close();
}
};
}]);
| 'use strict';
angular.module('app').service('stdout', ['$window', function($window) {
var callback = undefined;
var websocket = undefined;
this.subscribe = function(path, _callback) {
callback = _callback;
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
var route = [proto, "://", $window.location.host, '/api/stream/stdout/', path].join('');
websocket = new WebSocket(route);
websocket.onmessage = function(event) {
if (callback != undefined) {
callback(event.data);
}
};
websocket.onclose = function(event) {
console.log('websocket closed at '+path);
};
};
this.unsubscribe = function() {
callback = undefined;
if (websocket != undefined) {
console.log('unsubscribing websocket at '+websocket.url);
websocket.close();
}
};
}]);
| Update API endpoint for websockets | Update API endpoint for websockets
| JavaScript | apache-2.0 | armab/drone,dtan4/drone,Clever/drone,mvdkleijn/drone,reinbach/drone,feelobot/drone,pombredanne/drone,armab/drone,feelobot/drone,lins05/drone,gpndata/drone,olalonde/drone,oliveiradan/drone,opavader/drone,shift/drone,mikaelhg/drone,mvdkleijn/drone,nils-werner/drone,rancher/drone,carnivalmobile/drone,armab/drone,simonoff/drone,net2b/drone,toihrk/drone,globalxolutions/drone,fracting/drone,donatj/drone,masarakki/drone,philipz/drone,mikaelhg/drone,skarungan/drone,olalonde/drone,adoyle-h/drone,jgoldfar/drone,dakatsuka/drone,psytale/drone,hkjn/drone,rancher/drone,dakatsuka/drone,scrapinghub/drone,thoughtpalette/drone,fracting/drone,crhym3/drone,simonoff/drone,mikaelhg/drone,dakatsuka/drone,benschumacher/drone,shawnzhu/drone,deedubs/drone,carnivalmobile/drone,hkjn/drone,deedubs/drone,dtan4/drone,PermissionData/drone,oliveiradan/drone,globalxolutions/drone,masarakki/drone,bbmepic/drone,NamPNQ/drone,Clever/drone,feelobot/drone,nevermosby/drone,shiena/drone,beyondthestory/drone,psytale/drone,PermissionData/drone,albertyes/dronetest,llinder/drone,nils-werner/drone,msteinert/drone,letusfly85/drone,jdamick/drone,roth1002/drone,kausdev/drone,depay/drone,olalonde/drone,alexethan/drone,zaro0508/drone,flyinprogrammer/drone,shiena/drone,cdaguerre/drone,gregory90/drone,cedk/drone,kaedroho/drone,arobson/drone,k2wanko/drone,chlorm-forks/drone,mopemope/drone,kpacha/drone,alexethan/drone,philipz/drone,scrapinghub/drone,feelobot/drone,jdamick/drone,hkjn/drone,oliveiradan/drone,shift/drone,Jurisdesk/drone,toihrk/drone,vaijab/drone,msteinert/drone,reinbach/drone,psytale/drone,simonoff/drone,letusfly85/drone,adoyle-h/drone,Ablu/drone,zaro0508/drone,PermissionData/drone,nevermosby/drone,Jurisdesk/drone,donatj/drone,albertyes/dronetest,philipz/drone,kausdev/drone,Clever/drone,flyinprogrammer/drone,flyinprogrammer/drone,opavader/drone,letusfly85/drone,beyondthestory/drone,opavader/drone,thoughtpalette/drone,vtolstov/drone,armab/drone,net2b/drone,zaro0508/drone,Jurisdesk/drone,globalxolutions/drone,mopemope/drone,carnivalmobile/drone,romlinch/drone,alphagov/drone,rancher/drone,beyondthestory/drone,cedk/drone,skarungan/drone,thomasf/drone,kausdev/drone,zaro0508/drone,Ablu/drone,veghead/drone,jgoldfar/drone,fracting/drone,jgoldfar/drone,gpndata/drone,gpndata/drone,NamPNQ/drone,reinbach/drone,hkjn/drone,olalonde/drone,k2wanko/drone,adoyle-h/drone,kausdev/drone,PermissionData/drone,shiena/drone,kaedroho/drone,jackspirou/drone,deedubs/drone,oliveiradan/drone,Dataman-Cloud/drone,veghead/drone,cedk/drone,arobson/drone,gregory90/drone,romlinch/drone,Ablu/drone,dtan4/drone,beyondthestory/drone,dakatsuka/drone,llinder/drone,k2wanko/drone,roth1002/drone,adoyle-h/drone,Jurisdesk/drone,alexethan/drone,arobson/drone,benschumacher/drone,nevermosby/drone,albertyes/dronetest,opavader/drone,thomasf/drone,jgoldfar/drone,dtan4/drone,kpacha/drone,bbmepic/drone,scrapinghub/drone,kpacha/drone,gregory90/drone,psytale/drone,deedubs/drone,net2b/drone,globalxolutions/drone,thomasf/drone,llinder/drone,pombredanne/drone,letusfly85/drone,llinder/drone,skarungan/drone,shawnzhu/drone,mopemope/drone,donatj/drone,arobson/drone,crhym3/drone,Dataman-Cloud/drone,romlinch/drone,thoughtpalette/drone,Clever/drone,bbmepic/drone,scrapinghub/drone,shawnzhu/drone,alexethan/drone,skarungan/drone,crhym3/drone,toihrk/drone,mvdkleijn/drone,thoughtpalette/drone,depay/drone,pombredanne/drone,kaedroho/drone,kaedroho/drone,nils-werner/drone,vaijab/drone,roth1002/drone,roth1002/drone,shiena/drone,simonoff/drone,bsauvajon/drone,alphagov/drone,cdaguerre/drone,chlorm-forks/drone,mvdkleijn/drone,jackspirou/drone,shift/drone,cdaguerre/drone,Dataman-Cloud/drone,bbmepic/drone,bsauvajon/drone,depay/drone,philipz/drone,toihrk/drone,gregory90/drone,gpndata/drone,jackspirou/drone,depay/drone,shift/drone,mikaelhg/drone,reinbach/drone,vtolstov/drone,alphagov/drone,msteinert/drone,nevermosby/drone,kpacha/drone,lins05/drone | ---
+++
@@ -8,7 +8,7 @@
callback = _callback;
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
- var route = [proto, "://", $window.location.host, '/api/feed/stdout/', path].join('');
+ var route = [proto, "://", $window.location.host, '/api/stream/stdout/', path].join('');
websocket = new WebSocket(route);
websocket.onmessage = function(event) { |
d937ed31d5e106b0216a6007a095a92356474b3d | lib/cartodb/models/aggregation/aggregation-proxy.js | lib/cartodb/models/aggregation/aggregation-proxy.js | const RasterAggregation = require('./raster-aggregation');
const VectorAggregation = require('./vector-aggregation');
const RASTER_AGGREGATION = 'RasterAggregation';
const VECTOR_AGGREGATION = 'VectorAggregation';
module.exports = class AggregationProxy {
constructor (mapconfig, resolution = 256, threshold = 10e5, placement = 'centroid') {
this.mapconfig = mapconfig;
this.resolution = resolution;
this.threshold = threshold;
this.placement = placement;
this.implementation = this._getAggregationImplementation();
}
_getAggregationImplementation () {
let implementation = null;
switch (this._getAggregationType()) {
case VECTOR_AGGREGATION:
implementation = new VectorAggregation(this.resolution, this.threshold, this.placement);
break;
case RASTER_AGGREGATION:
implementation = new RasterAggregation(this.resolution, this.threshold, this.placement);
break;
default:
throw new Error('Unsupported aggregation type');
}
return implementation;
}
_getAggregationType () {
if (this.mapconfig.isVetorLayergroup()) {
return VECTOR_AGGREGATION;
}
return RASTER_AGGREGATION;
}
sql () {
return this.implementation.sql();
}
};
| const RasterAggregation = require('./raster-aggregation');
const VectorAggregation = require('./vector-aggregation');
const RASTER_AGGREGATION = 'RasterAggregation';
const VECTOR_AGGREGATION = 'VectorAggregation';
module.exports = class AggregationProxy {
constructor (mapconfig, { resolution = 256, threshold = 10e5, placement = 'centroid', columns = {}} = {}) {
this.mapconfig = mapconfig;
this.resolution = resolution;
this.threshold = threshold;
this.placement = placement;
this.columns = columns;
this.implementation = this._getAggregationImplementation();
}
_getAggregationImplementation () {
let implementation = null;
switch (this._getAggregationType()) {
case VECTOR_AGGREGATION:
implementation = new VectorAggregation(this.resolution, this.threshold, this.placement, this.columns);
break;
case RASTER_AGGREGATION:
implementation = new RasterAggregation(this.resolution, this.threshold, this.placement, this.columns);
break;
default:
throw new Error('Unsupported aggregation type');
}
return implementation;
}
_getAggregationType () {
if (this.mapconfig.isVetorLayergroup()) {
return VECTOR_AGGREGATION;
}
return RASTER_AGGREGATION;
}
sql () {
return this.implementation.sql();
}
};
| Add params to instantiate aggregation | Add params to instantiate aggregation
| JavaScript | bsd-3-clause | CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb | ---
+++
@@ -4,11 +4,12 @@
const VECTOR_AGGREGATION = 'VectorAggregation';
module.exports = class AggregationProxy {
- constructor (mapconfig, resolution = 256, threshold = 10e5, placement = 'centroid') {
+ constructor (mapconfig, { resolution = 256, threshold = 10e5, placement = 'centroid', columns = {}} = {}) {
this.mapconfig = mapconfig;
this.resolution = resolution;
this.threshold = threshold;
this.placement = placement;
+ this.columns = columns;
this.implementation = this._getAggregationImplementation();
}
@@ -17,10 +18,10 @@
switch (this._getAggregationType()) {
case VECTOR_AGGREGATION:
- implementation = new VectorAggregation(this.resolution, this.threshold, this.placement);
+ implementation = new VectorAggregation(this.resolution, this.threshold, this.placement, this.columns);
break;
case RASTER_AGGREGATION:
- implementation = new RasterAggregation(this.resolution, this.threshold, this.placement);
+ implementation = new RasterAggregation(this.resolution, this.threshold, this.placement, this.columns);
break;
default:
throw new Error('Unsupported aggregation type'); |
96bb0cbda0c92478633b3537b2593e81603aaa54 | src/browser/todos/Page.react.js | src/browser/todos/Page.react.js | import Buttons from './Buttons.react';
import Component from 'react-pure-render/component';
import DocumentTitle from 'react-document-title';
import List from './List.react';
import NewTodo from './NewTodo.react';
import React, {PropTypes} from 'react';
import fetch from '../../common/components/fetch';
import {fetchUserTodos} from '../../common/todos/actions';
// This decorator (higher order component) fetches todos both on client and
// server side. It's true isomorphic data fetching and rendering.
@fetch(fetchUserTodos)
export default class Page extends Component {
static propTypes = {
actions: PropTypes.object,
msg: PropTypes.object,
todos: PropTypes.object
}
render() {
const {actions, msg: {todos: msg}, todos: {newTodo, list}} = this.props;
return (
<DocumentTitle title={msg.title}>
<div className="todos-page">
<NewTodo {...{actions, msg, newTodo}} />
<List {...{actions, list, msg}} />
<Buttons clearAllEnabled={list.size > 0} {...{actions, msg}} />
</div>
</DocumentTitle>
);
}
}
| import Buttons from './Buttons.react';
import Component from 'react-pure-render/component';
import DocumentTitle from 'react-document-title';
import List from './List.react';
import NewTodo from './NewTodo.react';
import React, {PropTypes} from 'react';
import fetch from '../../common/components/fetch';
import {fetchUserTodos} from '../../common/todos/actions';
// This decorator (higher order component) fetches todos both in browser and
// on server side. It's true isomorphic data fetching and rendering.
@fetch(fetchUserTodos)
export default class Page extends Component {
static propTypes = {
actions: PropTypes.object,
msg: PropTypes.object,
todos: PropTypes.object
}
render() {
const {actions, msg: {todos: msg}, todos: {newTodo, list}} = this.props;
return (
<DocumentTitle title={msg.title}>
<div className="todos-page">
<NewTodo {...{actions, msg, newTodo}} />
<List {...{actions, list, msg}} />
<Buttons clearAllEnabled={list.size > 0} {...{actions, msg}} />
</div>
</DocumentTitle>
);
}
}
| Change mention of client to browser to match src structure | Change mention of client to browser to match src structure
| JavaScript | mit | GarrettSmith/schizophrenia,abelaska/este,langpavel/este,este/este,XeeD/este,TheoMer/este,estaub/my-este,TheoMer/Gyms-Of-The-World,skyuplam/debt_mgmt,syroegkin/mikora.eu,christophediprima/este,estaub/my-este,este/este,puzzfuzz/othello-redux,skallet/este,steida/este,sikhote/davidsinclair,este/este,robinpokorny/este,abelaska/este,sikhote/davidsinclair,skallet/este,vacuumlabs/este,langpavel/este,robinpokorny/este,syroegkin/mikora.eu,cjk/smart-home-app,glaserp/Maturita-Project,robinpokorny/este,AugustinLF/este,amrsekilly/updatedEste,TheoMer/este,abelaska/este,SidhNor/este-cordova-starter-kit,GarrettSmith/schizophrenia,skallet/este,puzzfuzz/othello-redux,vacuumlabs/este,blueberryapps/este,XeeD/este,este/este,amrsekilly/updatedEste,syroegkin/mikora.eu,sikhote/davidsinclair,steida/este,TheoMer/este,estaub/my-este,skyuplam/debt_mgmt,TheoMer/Gyms-Of-The-World,christophediprima/este,blueberryapps/este,christophediprima/este,aindre/este-example,AugustinLF/este,glaserp/Maturita-Project,TheoMer/Gyms-Of-The-World,christophediprima/este,aindre/este-example,GarrettSmith/schizophrenia,amrsekilly/updatedEste | ---
+++
@@ -7,8 +7,8 @@
import fetch from '../../common/components/fetch';
import {fetchUserTodos} from '../../common/todos/actions';
-// This decorator (higher order component) fetches todos both on client and
-// server side. It's true isomorphic data fetching and rendering.
+// This decorator (higher order component) fetches todos both in browser and
+// on server side. It's true isomorphic data fetching and rendering.
@fetch(fetchUserTodos)
export default class Page extends Component {
|
ccee089077bcf796f74b98421ec0f891da249382 | test/integration/sync_corpus.js | test/integration/sync_corpus.js | var test = require('tap').test;
var corpus = require('../fixtures/corpus');
var Sentiment = require('../../lib/index');
var sentiment = new Sentiment();
var dataset = corpus;
var result = sentiment.analyze(dataset);
test('synchronous corpus', function (t) {
t.type(result, 'object');
t.equal(result.score, -4);
t.equal(result.tokens.length, 1426);
t.equal(result.words.length, 74);
t.end();
});
| var test = require('tap').test;
var corpus = require('../fixtures/corpus');
var Sentiment = require('../../lib/index');
var sentiment = new Sentiment();
var dataset = corpus;
var result = sentiment.analyze(dataset);
test('synchronous corpus', function (t) {
t.type(result, 'object');
t.equal(result.score, -4);
t.equal(result.tokens.length, 1428);
t.equal(result.words.length, 74);
t.end();
});
| Fix integration test based on updates to tokenizer | Fix integration test based on updates to tokenizer
| JavaScript | mit | thisandagain/sentiment | ---
+++
@@ -9,7 +9,7 @@
test('synchronous corpus', function (t) {
t.type(result, 'object');
t.equal(result.score, -4);
- t.equal(result.tokens.length, 1426);
+ t.equal(result.tokens.length, 1428);
t.equal(result.words.length, 74);
t.end();
}); |
163482c08cb10b39decc90759a9c75a3d20677ea | test/common.js | test/common.js | /*global unexpected:true, expect:true, expectWithUnexpectedMagicPen:true, setImmediate:true, weknowhow*/
/* eslint no-unused-vars: "off" */
unexpected = typeof weknowhow === 'undefined' ?
require('../lib/').clone() :
weknowhow.expect.clone();
unexpected.output.preferredWidth = 80;
unexpected.addAssertion('<any> to inspect as <string>', function (expect, subject, value) {
expect(expect.inspect(subject).toString(), 'to equal', value);
}).addAssertion('<any> when delayed a little bit <assertion>', function (expect, subject) {
return expect.promise(function (run) {
setTimeout(run(function () {
return expect.shift();
}), 1);
});
}).addAssertion('<any> when delayed <number> <assertion>', function (expect, subject, value) {
return expect.promise(function (run) {
setTimeout(run(function () {
return expect.shift();
}), value);
});
});
expect = unexpected.clone();
expectWithUnexpectedMagicPen = unexpected.clone().use(typeof weknowhow === 'undefined' ?
require('unexpected-magicpen') :
weknowhow.unexpectedMagicPen
);
if (typeof setImmediate !== 'function') {
setImmediate = function (cb) {
setTimeout(cb, 0);
};
}
| /*global unexpected:true, expect:true, expectWithUnexpectedMagicPen:true, setImmediate:true, weknowhow, jasmine*/
/* eslint no-unused-vars: "off" */
unexpected = typeof weknowhow === 'undefined' ?
require('../lib/').clone() :
weknowhow.expect.clone();
unexpected.output.preferredWidth = 80;
unexpected.addAssertion('<any> to inspect as <string>', function (expect, subject, value) {
expect(expect.inspect(subject).toString(), 'to equal', value);
}).addAssertion('<any> when delayed a little bit <assertion>', function (expect, subject) {
return expect.promise(function (run) {
setTimeout(run(function () {
return expect.shift();
}), 1);
});
}).addAssertion('<any> when delayed <number> <assertion>', function (expect, subject, value) {
return expect.promise(function (run) {
setTimeout(run(function () {
return expect.shift();
}), value);
});
});
expect = unexpected.clone();
expectWithUnexpectedMagicPen = unexpected.clone().use(typeof weknowhow === 'undefined' ?
require('unexpected-magicpen') :
weknowhow.unexpectedMagicPen
);
if (typeof setImmediate !== 'function') {
setImmediate = function (cb) {
setTimeout(cb, 0);
};
}
if (typeof jasmine !== 'undefined') {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
}
| Set the Jest timeout to one minute | Set the Jest timeout to one minute
| JavaScript | mit | unexpectedjs/unexpected,alexjeffburke/unexpected,alexjeffburke/unexpected | ---
+++
@@ -1,4 +1,4 @@
-/*global unexpected:true, expect:true, expectWithUnexpectedMagicPen:true, setImmediate:true, weknowhow*/
+/*global unexpected:true, expect:true, expectWithUnexpectedMagicPen:true, setImmediate:true, weknowhow, jasmine*/
/* eslint no-unused-vars: "off" */
unexpected = typeof weknowhow === 'undefined' ?
require('../lib/').clone() :
@@ -34,3 +34,7 @@
setTimeout(cb, 0);
};
}
+
+if (typeof jasmine !== 'undefined') {
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
+} |
6d0ecec3d5e6d233dd50bd69554e1943256e6ed6 | tests/utils.js | tests/utils.js | const each = require('lodash/each');
function captureError(fn) {
try {
fn();
}
catch (e) {
return e;
}
return null;
}
function restore(obj) {
each(obj, v => {
if (v && v.toString() === 'stub') v.restore();
});
}
module.exports = {
captureError,
restore
};
| const each = require('lodash/each');
function captureError(fn) {
try {
fn();
}
catch (e) {
return e;
}
return null;
}
module.exports = {
captureError
};
| Remove unused restore() test util | Remove unused restore() test util
| JavaScript | bsd-3-clause | praekelt/numi-api | ---
+++
@@ -13,14 +13,6 @@
}
-function restore(obj) {
- each(obj, v => {
- if (v && v.toString() === 'stub') v.restore();
- });
-}
-
-
module.exports = {
- captureError,
- restore
+ captureError
}; |
94e033902bac9c948ff0cfb72576a8e6c7c3cdce | root/scripts/gebo/perform.js | root/scripts/gebo/perform.js | // For testing
if (typeof module !== 'undefined') {
$ = require('jquery');
gebo = require('../config').gebo;
FormData = require('./__mocks__/FormData');
}
/**
* Send a request to the gebo. The message can be sent
* as FormData or JSON.
*
* @param object
* @param FormData - optional
* @param function
*/
var perform = function(message, form, done) {
var data = {};
if (typeof form === 'object') {
data = new FormData(form);
}
else {
done = form;
}
Object.keys(message).forEach(function(key) {
var value = message[key];
if (typeof message[key] === 'object') {
value = JSON.stringify(value);
}
if (typeof form === 'object') {
data.append(key, value);
}
else {
data[key] = value;
}
});
return $.ajax({
url: gebo + '/perform',
type: 'POST',
data: data,
success: function(data) {
done();
},
error: function(xhr, status, err) {
done(err);
},
});
};
if (typeof module !== 'undefined') {
module.exports = perform;
}
| // For testing
if (typeof module !== 'undefined') {
$ = require('jquery');
gebo = require('../config').gebo;
FormData = require('./__mocks__/FormData');
}
/**
* Send a request to the gebo. The message can be sent
* as FormData or JSON.
*
* @param object
* @param FormData - optional
* @param function
*/
var perform = function(message, form, done) {
var data = {};
if (typeof form === 'object') {
data = new FormData(form);
}
else {
done = form;
}
Object.keys(message).forEach(function(key) {
var value = message[key];
if (typeof message[key] === 'object') {
value = JSON.stringify(value);
}
if (typeof form === 'object') {
data.append(key, value);
}
else {
data[key] = value;
}
});
return $.ajax({
url: gebo + '/perform',
type: 'POST',
data: data,
processData: false,
contentType: false,
success: function(data) {
done();
},
error: function(xhr, status, err) {
done(err);
},
});
};
if (typeof module !== 'undefined') {
module.exports = perform;
}
| Add processData and contentType properties to ajax call | Add processData and contentType properties to ajax call
| JavaScript | mit | RaphaelDeLaGhetto/grunt-init-gebo-react-hai,RaphaelDeLaGhetto/grunt-init-gebo-react-hai | ---
+++
@@ -41,6 +41,8 @@
url: gebo + '/perform',
type: 'POST',
data: data,
+ processData: false,
+ contentType: false,
success: function(data) {
done();
}, |
6988301e982506f361933b25149b89f2ceb3e54c | react/components/UI/Modal/Modal.js | react/components/UI/Modal/Modal.js | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import ModalDialog from 'react/components/UI/ModalDialog';
const ModalBackdrop = styled.div`
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(255, 255, 255, 0.9);
z-index: 6001;
`;
export default class Modal extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
onClose: PropTypes.func.isRequired,
}
ModalDialog = ModalDialog
render() {
const { children, onClose, ...rest } = this.props;
return (
<ModalBackdrop {...rest} onClick={onClose}>
<this.ModalDialog
onClick={e => e.stopPropagation()}
role="dialog"
>
{children}
</this.ModalDialog>
</ModalBackdrop>
);
}
}
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import ModalDialog from 'react/components/UI/ModalDialog';
const ModalBackdrop = styled.div`
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(255, 255, 255, 0.9);
z-index: 6001;
transform: translate3d(0, 0, 1px);
`;
export default class Modal extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
onClose: PropTypes.func.isRequired,
}
ModalDialog = ModalDialog
render() {
const { children, onClose, ...rest } = this.props;
return (
<ModalBackdrop {...rest} onClick={onClose}>
<this.ModalDialog
onClick={e => e.stopPropagation()}
role="dialog"
>
{children}
</this.ModalDialog>
</ModalBackdrop>
);
}
}
| Make sure modal dialog appears over topbar header | Make sure modal dialog appears over topbar header
| JavaScript | mit | aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell | ---
+++
@@ -15,6 +15,7 @@
left: 0;
background-color: rgba(255, 255, 255, 0.9);
z-index: 6001;
+ transform: translate3d(0, 0, 1px);
`;
export default class Modal extends Component { |
57835d31ab5419fcadfad2a06a63be11ae2796bb | list-sources.js | list-sources.js | const {readdirSync} = require('fs');
function listDir(dir) {
readdirSync(dir)
.filter(f => f.endsWith('.cc'))
.forEach(f => console.log(dir + '/' + f));
}
listDir('src');
listDir('src/UiArea');
listDir('src/arch/win32');
| const readdirSync = require('fs').readdirSync;
function listDir(dir) {
readdirSync(dir)
.filter(f => f.endsWith('.cc'))
.forEach(f => console.log(dir + '/' + f));
}
listDir('src');
listDir('src/UiArea');
listDir('src/arch/win32');
| Fix unsupported syntax in node 4 | Fix unsupported syntax in node 4
| JavaScript | mit | parro-it/libui-node,parro-it/libui-node,parro-it/libui-node,parro-it/libui-node | ---
+++
@@ -1,4 +1,4 @@
-const {readdirSync} = require('fs');
+const readdirSync = require('fs').readdirSync;
function listDir(dir) {
readdirSync(dir)
@@ -9,5 +9,3 @@
listDir('src');
listDir('src/UiArea');
listDir('src/arch/win32');
-
- |
9d46ac9ff9a7bfe0f2f661675d67243f851f5f7a | src/OAuth/Request.js | src/OAuth/Request.js | /**
* Factory object for XMLHttpRequest
*/
function Request(debug) {
var XMLHttpRequest;
switch (true)
{
case typeof global.Titanium.Network.createHTTPClient != 'undefined':
XMLHttpRequest = global.Titanium.Network.createHTTPClient();
break;
// CommonJS require
case typeof require != 'undefined':
XMLHttpRequest = new require("xhr").XMLHttpRequest();
break;
case typeof global.XMLHttpRequest != 'undefined':
XMLHttpRequest = new global.XMLHttpRequest();
break;
}
return XMLHttpRequest;
}
| /**
* Factory object for XMLHttpRequest
*/
function Request(debug) {
var XHR;
switch (true)
{
case typeof global.Titanium != 'undefined' && typeof global.Titanium.Network.createHTTPClient != 'undefined':
XHR = global.Titanium.Network.createHTTPClient();
break;
// CommonJS require
case typeof require != 'undefined':
XHR = new require("xhr").XMLHttpRequest();
break;
case typeof global.XMLHttpRequest != 'undefined':
XHR = new global.XMLHttpRequest();
break;
}
return XHR;
}
| Rename to XHR to avoid clashes, added extra check for Titanium object first | Rename to XHR to avoid clashes, added extra check for Titanium object first
| JavaScript | mit | maxogden/jsOAuth,aoman89757/jsOAuth,cklatik/jsOAuth,bytespider/jsOAuth,aoman89757/jsOAuth,cklatik/jsOAuth,bytespider/jsOAuth | ---
+++
@@ -2,24 +2,24 @@
* Factory object for XMLHttpRequest
*/
function Request(debug) {
- var XMLHttpRequest;
+ var XHR;
switch (true)
{
- case typeof global.Titanium.Network.createHTTPClient != 'undefined':
- XMLHttpRequest = global.Titanium.Network.createHTTPClient();
+ case typeof global.Titanium != 'undefined' && typeof global.Titanium.Network.createHTTPClient != 'undefined':
+ XHR = global.Titanium.Network.createHTTPClient();
break;
// CommonJS require
case typeof require != 'undefined':
- XMLHttpRequest = new require("xhr").XMLHttpRequest();
+ XHR = new require("xhr").XMLHttpRequest();
break;
case typeof global.XMLHttpRequest != 'undefined':
- XMLHttpRequest = new global.XMLHttpRequest();
+ XHR = new global.XMLHttpRequest();
break;
}
- return XMLHttpRequest;
+ return XHR;
} |
39e652b50a44fdea520d5b97a3cc305d008c409e | src/actions/index.js | src/actions/index.js | import { ReadingRecord, ChapterCache } from 'actions/ConfigActions';
export const markNotificationSent = async ({comicID, chapterID}) => {
try {
const readingRecord = await ReadingRecord.get(comicID);
ReadingRecord.put({
...readingRecord,
[chapterID]: 'notification_sent'
});
} catch(err) {
ReadingRecord.put({
_id: comicID,
[chapterID]: 'notification_sent'
});
}
};
export const replaceChapterCache = async ({comicID, chapters}) => {
try {
const chapterCache = await ChapterCache.get(comicID);
ReadingRecord.put({
...chapterCache,
chapters
});
} catch(err) {
ChapterCache.put({
_id: comicID,
chapters
});
}
};
| import { ReadingRecord, ChapterCache } from 'actions/ConfigActions';
export const markNotificationSent = async ({comicID, chapterID}) => {
try {
const readingRecord = await ReadingRecord.get(comicID);
ReadingRecord.put({
...readingRecord,
[chapterID]: 'notification_sent'
});
} catch(err) {
ReadingRecord.put({
_id: comicID,
[chapterID]: 'notification_sent'
});
}
};
export const replaceChapterCache = async ({comicID, chapters}) => {
try {
const chapterCache = await ChapterCache.get(comicID);
ChapterCache.put({
...chapterCache,
chapters
});
} catch(err) {
ChapterCache.put({
_id: comicID,
chapters
});
}
};
| Fix wrong model for replaceChapterCache | Fix wrong model for replaceChapterCache
| JavaScript | mit | ComicsReader/reader,ComicsReader/reader,ComicsReader/app,ComicsReader/app | ---
+++
@@ -18,7 +18,7 @@
export const replaceChapterCache = async ({comicID, chapters}) => {
try {
const chapterCache = await ChapterCache.get(comicID);
- ReadingRecord.put({
+ ChapterCache.put({
...chapterCache,
chapters
}); |
168ad7c6ee4e2e92db03e2061f4f5c1fb86a89a8 | src/reducers.js | src/reducers.js | import { combineReducers } from 'redux';
// import constellations from './constellations/reducers';
import core from './core/reducers';
// import galaxies from './galaxies/reducers';
// import universe from './universe/reducers';
const appReducer = combineReducers({
// constellations,
core,
// galaxies,
// universe,
});
const rootReducer = (state, action) => {
// space for extra steps
return appReducer(state, action);
};
export default rootReducer;
| import { combineReducers } from 'redux';
// import constellations from './constellations/reducers';
import core from './core/reducers';
// import galaxies from './galaxies/reducers';
// import universe from './universe/reducers';
// import metaverse from './metaverse/reducers';
// import userprofiles from './userprofiles/reducers';
const appReducer = combineReducers({
// constellations,
core,
// galaxies,
// universe,
// metaverse,
// userprofiles,
});
const rootReducer = (state, action) => {
// space for extra steps
return appReducer(state, action);
};
export default rootReducer;
| Add user profiles and metaverse | Add user profiles and metaverse
| JavaScript | mit | GetGee/G,GetGee/G | ---
+++
@@ -4,12 +4,16 @@
import core from './core/reducers';
// import galaxies from './galaxies/reducers';
// import universe from './universe/reducers';
+// import metaverse from './metaverse/reducers';
+// import userprofiles from './userprofiles/reducers';
const appReducer = combineReducers({
// constellations,
core,
// galaxies,
// universe,
+ // metaverse,
+ // userprofiles,
});
const rootReducer = (state, action) => { |
8881105f02d5ea1e7e67ee66c2c3972e7ecaa32e | package.js | package.js | Package.describe({
name: 'metemq:metemq',
version: '0.3.1',
// Brief, one-line summary of the package.
summary: 'MeteMQ',
// URL to the Git repository containing the source code for this package.
git: '',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting documentation, set this field to null.
documentation: 'README.md'
});
Npm.depends({
'mqtt': '1.12.0',
'mqtt-emitter': '1.2.4',
'mosca': '2.0.2', // For testing
'portfinder': '1.0.3',
'metemq-broker': '0.0.1'
});
Package.onUse(function(api) {
api.versionsFrom('1.4');
api.use('underscore@1.0.8');
api.use('accounts-password'); // For checking password
api.use('barbatus:typescript@0.4.0');
api.mainModule('client/index.ts', 'client');
api.mainModule('server/index.ts', 'server');
});
Package.onTest(function(api) {
api.use('metemq:metemq');
api.use('barbatus:typescript@0.4.0');
api.use(['practicalmeteor:mocha', 'practicalmeteor:chai']);
api.mainModule('test/index.ts');
});
| Package.describe({
name: 'metemq:metemq',
version: '0.3.2',
// Brief, one-line summary of the package.
summary: 'MeteMQ',
// URL to the Git repository containing the source code for this package.
git: '',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting documentation, set this field to null.
documentation: 'README.md'
});
Npm.depends({
'mqtt': '1.12.0',
'mqtt-emitter': '1.2.4',
'mosca': '2.0.2', // For testing
'portfinder': '1.0.3',
'metemq-broker': '0.0.1'
});
Package.onUse(function(api) {
api.versionsFrom('1.4.1');
api.use('underscore@1.0.8');
api.use('accounts-password'); // For checking password
api.use('barbatus:typescript@0.4.0');
api.mainModule('client/index.ts', 'client');
api.mainModule('server/index.ts', 'server');
});
Package.onTest(function(api) {
api.use('metemq:metemq');
api.use('barbatus:typescript@0.4.0');
api.use(['practicalmeteor:mocha', 'practicalmeteor:chai']);
api.mainModule('test/index.ts');
});
| Update meteor version to 1.4.1, bump version to 0.3.2 | Update meteor version to 1.4.1, bump version to 0.3.2
| JavaScript | mit | metemq/metemq,metemq/metemq | ---
+++
@@ -1,6 +1,6 @@
Package.describe({
name: 'metemq:metemq',
- version: '0.3.1',
+ version: '0.3.2',
// Brief, one-line summary of the package.
summary: 'MeteMQ',
// URL to the Git repository containing the source code for this package.
@@ -19,7 +19,7 @@
});
Package.onUse(function(api) {
- api.versionsFrom('1.4');
+ api.versionsFrom('1.4.1');
api.use('underscore@1.0.8');
api.use('accounts-password'); // For checking password
api.use('barbatus:typescript@0.4.0'); |
8d6af60aa805576907834e57f8e02b593775d2b1 | server/interests/interestsController.js | server/interests/interestsController.js | var Interests = require('./interests.server.model.js');
var Q = require('q');
module.exports = {
add: function (req, res, next) {
var interest = {};
interest.id = req.body.id;
//interest.user = req.user._id;
var addInterest = Q.nbind(Interests.create, Interests);
addInterest(interest)
.then(function (addedInterest) {
if (addedInterest) {
res.json(addedInterest);
}
})
.fail(function (error) {
next(error);
});
}
}; | var Interests = require('./interests.server.model.js');
var Q = require('q');
module.exports = {
add: function (req, res, next) {
var interest = {};
interest.id = req.body.id;
interest.user = req.user._id;
var addInterest = Q.nbind(Interests.create, Interests);
addInterest(interest)
.then(function (addedInterest) {
if (addedInterest) {
res.json(addedInterest);
}
})
.fail(function (error) {
next(error);
});
}
}; | Add user._id to interest document. | Add user._id to interest document.
| JavaScript | mit | HRR2-Brainstorm/Brainstorm,JulieMarie/Brainstorm,JulieMarie/Brainstorm,plauer/Brainstorm,drabinowitz/Brainstorm,ekeric13/Brainstorm,EJJ-Brainstorm/Brainstorm,EJJ-Brainstorm/Brainstorm,ekeric13/Brainstorm | ---
+++
@@ -5,7 +5,7 @@
add: function (req, res, next) {
var interest = {};
interest.id = req.body.id;
- //interest.user = req.user._id;
+ interest.user = req.user._id;
var addInterest = Q.nbind(Interests.create, Interests);
|
4499e00b0d4f12afa60be3cf57baf1362385cf2d | src/Plugins/Client/PrettyBrowserConsoleErrors.js | src/Plugins/Client/PrettyBrowserConsoleErrors.js | const JSONRPC = {};
JSONRPC.ClientPluginBase = require("../../ClientPluginBase");
/**
* PrettyBrowserConsoleErrors plugin.
* @class
* @extends JSONRPC.ClientPluginBase
*/
module.exports =
class PrettyBrowserConsoleErrors extends JSONRPC.ClientPluginBase
{
/**
* Catches the exception and prints it.
* @param {error} exception
*/
exceptionCatch(exception)
{
if(exception instanceof JSONRPC.Exception)
{
console.log("%c" + exception, "color: red");
console.log("%c JSONRPC_Exception: " + JSON.stringify(exception, null, 4), "color: red");
}
}
};
| const JSONRPC = {};
JSONRPC.ClientPluginBase = require("../../ClientPluginBase");
JSONRPC.Exception = require("../../Exception");
/**
* PrettyBrowserConsoleErrors plugin.
* @class
* @extends JSONRPC.ClientPluginBase
*/
module.exports =
class PrettyBrowserConsoleErrors extends JSONRPC.ClientPluginBase
{
/**
* Catches the exception and prints it.
* @param {error} exception
*/
exceptionCatch(exception)
{
if(exception instanceof JSONRPC.Exception)
{
console.log("%c" + exception, "color: red");
console.log("%c JSONRPC_Exception: " + JSON.stringify(exception, null, 4), "color: red");
}
}
};
| Add missing require in client plugin | Add missing require in client plugin
| JavaScript | mit | oxygen/jsonrpc-bidirectional,bigstepinc/jsonrpc-bidirectional,oxygen/jsonrpc-bidirectional,bigstepinc/jsonrpc-bidirectional | ---
+++
@@ -1,5 +1,6 @@
const JSONRPC = {};
JSONRPC.ClientPluginBase = require("../../ClientPluginBase");
+JSONRPC.Exception = require("../../Exception");
/**
* PrettyBrowserConsoleErrors plugin. |
5f823f52edc5ad4e9652e75f9474ba327a8e346d | src/api.js | src/api.js | import fetch from 'unfetch'
const apiBase = 'https://api.hackclub.com/'
const methods = ['get', 'put', 'post', 'patch']
const generateMethod = method => (path, options) => {
// authToken is shorthand for Authorization: Bearer `authtoken`
let filteredOptions = {}
for (let [key, value] of Object.entries(options)) {
switch (key) {
case 'authToken':
filteredOptions = {
...filteredOptions,
...{ headers: { Authorization: `Bearer ${value}` } }
}
break
case 'data':
filteredOptions = {
...filteredOptions,
...{
body: JSON.stringify(value),
headers: { 'Content-Type': 'application/json' }
}
}
break
default:
filteredOptions[key] = value
break
}
}
return fetch(apiBase + path, { method: method, ...filteredOptions })
.then(res => {
if (res.ok) {
const contentType = res.headers.get('content-type')
if (contentType && contentType.indexOf('application/json') !== -1) {
return res.json()
} else {
return res.text()
}
} else {
throw res
}
})
.catch(e => {
console.error(e)
throw e
})
}
let api = {}
methods.forEach(method => {
api[method] = generateMethod(method)
})
export default api
| import fetch from 'unfetch'
const apiBase = 'https://api.hackclub.com/'
const methods = ['get', 'put', 'post', 'patch']
const generateMethod = method => (path, options) => {
// authToken is shorthand for Authorization: Bearer `authtoken`
let filteredOptions = {}
for (let [key, value] of Object.entries(options)) {
switch (key) {
case 'authToken':
filteredOptions.headers = filteredOptions.headers || {}
filteredOptions.headers['Authorization'] = `Bearer ${value}`
break
case 'data':
filteredOptions.body = JSON.stringify(value)
filteredOptions.headers = filteredOptions.headers || {}
filteredOptions.headers['Content-Type'] = 'application/json'
break
default:
filteredOptions[key] = value
break
}
}
return fetch(apiBase + path, { method: method, ...filteredOptions })
.then(res => {
if (res.ok) {
const contentType = res.headers.get('content-type')
if (contentType && contentType.indexOf('application/json') !== -1) {
return res.json()
} else {
return res.text()
}
} else {
throw res
}
})
.catch(e => {
console.error(e)
throw e
})
}
let api = {}
methods.forEach(method => {
api[method] = generateMethod(method)
})
export default api
| Fix missing request body in API client | Fix missing request body in API client
| JavaScript | mit | hackclub/website,hackclub/website,hackclub/website | ---
+++
@@ -9,19 +9,13 @@
for (let [key, value] of Object.entries(options)) {
switch (key) {
case 'authToken':
- filteredOptions = {
- ...filteredOptions,
- ...{ headers: { Authorization: `Bearer ${value}` } }
- }
+ filteredOptions.headers = filteredOptions.headers || {}
+ filteredOptions.headers['Authorization'] = `Bearer ${value}`
break
case 'data':
- filteredOptions = {
- ...filteredOptions,
- ...{
- body: JSON.stringify(value),
- headers: { 'Content-Type': 'application/json' }
- }
- }
+ filteredOptions.body = JSON.stringify(value)
+ filteredOptions.headers = filteredOptions.headers || {}
+ filteredOptions.headers['Content-Type'] = 'application/json'
break
default:
filteredOptions[key] = value |
a7683d7f2b3611dd1429fd5725a32f12b78ba7d9 | src/app.js | src/app.js | const {
getQueryStringParam,
substanceGlobals,
platform
} = window.substance
const {
StencilaDesktopApp
} = window.stencila
const ipc = require('electron').ipcRenderer
const darServer = require('dar-server')
const { FSStorageClient } = darServer
const url = require('url')
const path = require('path')
const remote = require('electron').remote
const { shell } = remote
const host = require('stencila-node').host
// HACK: we should find a better solution to intercept window.open calls
// (e.g. as done by LinkComponent)
window.open = function(url /*, frameName, features*/) {
shell.openExternal(url)
}
window.addEventListener('load', () => {
substanceGlobals.DEBUG_RENDERING = platform.devtools
// Starts the stencila/node Host and connect it
// to the internal host via the STENCILA_HOSTS
// variable. There are probably better ways to do this
// but this works, providing integration with limited changes elsewhere
host.start().then(() => {
window.STENCILA_HOSTS = host.urls[0] + '|' + host.key
StencilaDesktopApp.mount({
archiveId: getQueryStringParam('archiveDir'),
ipc,
url,
path,
shell,
FSStorageClient,
__dirname
}, window.document.body)
})
})
| const {
getQueryStringParam,
substanceGlobals,
platform
} = window.substance
const {
StencilaDesktopApp
} = window.stencila
const ipc = require('electron').ipcRenderer
const darServer = require('dar-server')
const { FSStorageClient } = darServer
const url = require('url')
const path = require('path')
const remote = require('electron').remote
const { shell } = remote
const host = require('stencila-node').host
// HACK: we should find a better solution to intercept window.open calls
// (e.g. as done by LinkComponent)
window.open = function(url /*, frameName, features*/) {
shell.openExternal(url)
}
window.addEventListener('load', () => {
substanceGlobals.DEBUG_RENDERING = platform.devtools
// Starts the stencila/node Host and connect it
// to the internal host via the STENCILA_HOSTS
// variable. There are probably better ways to do this
// but this works, providing integration with limited changes elsewhere
host.start().then(() => {
window.STENCILA_HOSTS = host.urls[0] + '|' + host.key
StencilaDesktopApp.mount({
archiveId: getQueryStringParam('archiveDir'),
ipc,
url,
path,
shell,
FSStorageClient,
__dirname
}, window.document.body)
})
})
window.addEventListener('beforeunload', () => {
// Stop the host (and any peer hosts that it has spawned)
host.stop()
})
| Stop the host on window unload | Stop the host on window unload
| JavaScript | apache-2.0 | stencila/electron | ---
+++
@@ -44,3 +44,8 @@
}, window.document.body)
})
})
+
+window.addEventListener('beforeunload', () => {
+ // Stop the host (and any peer hosts that it has spawned)
+ host.stop()
+}) |
890aaddbf06a41a7daa2cec0b1f6a6f1a4a1cc78 | test/flora-cluster.spec.js | test/flora-cluster.spec.js | 'use strict';
var expect = require('chai').expect;
var floraCluster = require('../');
describe('flora-cluster', function () {
it('should be an object', function () {
expect(floraCluster).to.be.an('object');
});
});
| 'use strict';
var expect = require('chai').expect;
var floraCluster = require('../');
describe('flora-cluster', function () {
it('should be an object', function () {
expect(floraCluster).to.be.an('object');
});
it('should expose master and worker objects', function () {
expect(floraCluster).to.have.property('master');
expect(floraCluster).to.have.property('worker');
});
describe('worker', function () {
it('should be an object', function () {
expect(floraCluster.worker).to.be.an('object');
});
it('should expose functions', function () {
expect(floraCluster.worker).to.have.property('run');
expect(floraCluster.worker).to.have.property('attach');
expect(floraCluster.worker).to.have.property('serverStatus');
expect(floraCluster.worker).to.have.property('shutdown');
});
});
});
| Add some interface tests for flora-cluster | Add some interface tests for flora-cluster
| JavaScript | mit | godmodelabs/flora-cluster | ---
+++
@@ -8,4 +8,22 @@
it('should be an object', function () {
expect(floraCluster).to.be.an('object');
});
+
+ it('should expose master and worker objects', function () {
+ expect(floraCluster).to.have.property('master');
+ expect(floraCluster).to.have.property('worker');
+ });
+
+ describe('worker', function () {
+ it('should be an object', function () {
+ expect(floraCluster.worker).to.be.an('object');
+ });
+
+ it('should expose functions', function () {
+ expect(floraCluster.worker).to.have.property('run');
+ expect(floraCluster.worker).to.have.property('attach');
+ expect(floraCluster.worker).to.have.property('serverStatus');
+ expect(floraCluster.worker).to.have.property('shutdown');
+ });
+ });
}); |
96c3b3745357d6cd31d0ecf0e8512413b0b82bb3 | src/constants/defaults.js | src/constants/defaults.js | export const ROWS = 10;
export const COLUMNS = 8;
export const SECTOR_LIMIT = 10;
export const MIN_DIMENSION = 5;
export const MAX_DIMENSION = 20;
export const LAYER_NAME_LENGTH = 30;
export const DEFAULT_HEX_WIDTH = 50; // Hex width when not rendering sector
export const HEX_PADDING = 2; // Pixels between hexes
export const EXTRA_HEXES = 1; // Extra hexes around canvas edges
export const PIXEL_BUFFER = 75; // Pixel buffer between the sector and window
export const MAX_HEXES = 1250; // Number of hexagons to render before this generator is short circuited
export const TARGET_COLOR_WIDTH = 11;
| export const ROWS = 10;
export const COLUMNS = 8;
export const SECTOR_LIMIT = 10;
export const MIN_DIMENSION = 5;
export const MAX_DIMENSION = 20;
export const LAYER_NAME_LENGTH = 40;
export const DEFAULT_HEX_WIDTH = 50; // Hex width when not rendering sector
export const HEX_PADDING = 2; // Pixels between hexes
export const EXTRA_HEXES = 1; // Extra hexes around canvas edges
export const PIXEL_BUFFER = 75; // Pixel buffer between the sector and window
export const MAX_HEXES = 1250; // Number of hexagons to render before this generator is short circuited
export const TARGET_COLOR_WIDTH = 11;
| Increase faction name length back up to 40 | Increase faction name length back up to 40
| JavaScript | mit | mpigsley/sectors-without-number,mpigsley/sectors-without-number | ---
+++
@@ -3,7 +3,7 @@
export const SECTOR_LIMIT = 10;
export const MIN_DIMENSION = 5;
export const MAX_DIMENSION = 20;
-export const LAYER_NAME_LENGTH = 30;
+export const LAYER_NAME_LENGTH = 40;
export const DEFAULT_HEX_WIDTH = 50; // Hex width when not rendering sector
export const HEX_PADDING = 2; // Pixels between hexes
export const EXTRA_HEXES = 1; // Extra hexes around canvas edges |
b1eddfe37d30a653ebb23a2807eba407cea847de | src/javascripts/frigging_bootstrap/components/select.js | src/javascripts/frigging_bootstrap/components/select.js | var React = require("react/addons")
var {errorList, sizeClassNames, formGroupCx, label} = require("../util.js")
var {div, select, option} = React.DOM
var cx = require("classnames")
export default class extends React.Component {
displayName = "Frig.friggingBootstrap.Select"
static defaultProps = require("../default_props.js")
_inputHtml() {
return Object.assign({}, this.props.inputHtml, {
key: "input",
className: "form-control",
valueLink: this.props.valueLink,
})
}
_selectOption(o) {
let attrs = {
key: `option-${o.label}`,
value: o.value,
}
return option(attrs, o.label)
}
render() {
return div({className: cx(sizeClassNames(this.props))},
div({className: formGroupCx(this.props)},
label(this.props, {className: ""}),
div({className: "controls"},
select(this._inputHtml,
this.props.options.map(this._selectOption)
),
errorList(this.props.errors),
)
)
)
}
}
| let React = require("react/addons")
let cx = require("classnames")
let {errorList, sizeClassNames, formGroupCx, label} = require("../util.js")
let {div, select, option} = React.DOM
export default class extends React.Component {
displayName = "Frig.friggingBootstrap.Select"
static defaultProps = require("../default_props.js")
_inputHtml() {
return Object.assign({}, this.props.inputHtml, {
key: "input",
className: "form-control",
valueLink: this.props.valueLink,
})
}
_selectOption(o) {
let attrs = {
key: `option-${o.label}`,
value: o.value,
}
return option(attrs, o.label)
}
render() {
return div({className: cx(sizeClassNames(this.props))},
div({className: formGroupCx(this.props)},
label(this.props, {className: ""}),
div({className: "controls"},
select(this._inputHtml(),
this.props.options.map(this._selectOption)
),
errorList(this.props.errors),
)
)
)
}
}
| Change _inputHtml Into Function Call In Select | Change _inputHtml Into Function Call In Select
Change _inputHtml from just passing the function to calling it in the
Select Component when the select is rendered out. This allows the merge
props to be the default props of the select.
| JavaScript | mit | TouchBistro/frig,TouchBistro/frig,frig-js/frig,frig-js/frig | ---
+++
@@ -1,7 +1,8 @@
-var React = require("react/addons")
-var {errorList, sizeClassNames, formGroupCx, label} = require("../util.js")
-var {div, select, option} = React.DOM
-var cx = require("classnames")
+let React = require("react/addons")
+let cx = require("classnames")
+
+let {errorList, sizeClassNames, formGroupCx, label} = require("../util.js")
+let {div, select, option} = React.DOM
export default class extends React.Component {
@@ -30,7 +31,7 @@
div({className: formGroupCx(this.props)},
label(this.props, {className: ""}),
div({className: "controls"},
- select(this._inputHtml,
+ select(this._inputHtml(),
this.props.options.map(this._selectOption)
),
errorList(this.props.errors), |
9b02c4e166444a0f33126812506b6b5dbffa6655 | src/request/stores/request-detail-store.js | src/request/stores/request-detail-store.js | 'use strict';
var glimpse = require('glimpse');
var requestRepository = require('../repository/request-repository');
// TODO: Not sure I need to store the requests
var _requests = {};
var _viewModel = {
selectedId: null,
request: null
};
function requestChanged(targetRequests) {
glimpse.emit('shell.request.detail.changed', targetRequests);
}
// Clear Request
(function () {
function clearRequest() {
_viewModel.selectedId = null;
_viewModel.request = null;
requestChanged(_viewModel);
}
glimpse.on('shell.request.detail.closed', clearRequest);
})();
// Found Data
(function () {
function dataFound(payload) {
var newRequest = payload.newRequest;
_requests[newRequest.id] = newRequest;
if (_viewModel.selectedId === newRequest.id) {
_viewModel.request = newRequest;
requestChanged(_viewModel);
}
}
// External data coming in
glimpse.on('data.request.detail.found', dataFound);
})();
// Trigger Requests
(function () {
function triggerRequest(payload) {
var requestId = payload.requestId;
_viewModel.selectedId = requestId;
_viewModel.request = null;
requestChanged(_viewModel);
requestRepository.triggerGetDetailsFor(requestId);
}
glimpse.on('data.request.detail.requested', triggerRequest);
})();
| 'use strict';
var glimpse = require('glimpse');
var requestRepository = require('../repository/request-repository');
// TODO: Not sure I need to store the requests
var _requests = {};
var _viewModel = {
selectedId: null,
request: null
};
function requestChanged(targetRequests) {
glimpse.emit('shell.request.detail.changed', targetRequests);
}
// Clear Request
(function () {
function clearRequest() {
_viewModel.selectedId = null;
_viewModel.request = null;
requestChanged(_viewModel);
}
glimpse.on('shell.request.detail.closed', clearRequest);
})();
// Found Request
(function () {
function dataFound(payload) {
var newRequest = payload.newRequest;
_requests[newRequest.id] = newRequest;
if (_viewModel.selectedId === newRequest.id) {
_viewModel.request = newRequest;
requestChanged(_viewModel);
}
}
// External data coming in
glimpse.on('data.request.detail.found', dataFound);
})();
// Get Request
(function () {
function triggerRequest(payload) {
var requestId = payload.requestId;
_viewModel.selectedId = requestId;
_viewModel.request = null;
requestChanged(_viewModel);
requestRepository.triggerGetDetailsFor(requestId);
}
glimpse.on('data.request.detail.requested', triggerRequest);
})();
| Update comments to be clearer | Update comments to be clearer
| JavaScript | unknown | Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -26,7 +26,7 @@
glimpse.on('shell.request.detail.closed', clearRequest);
})();
-// Found Data
+// Found Request
(function () {
function dataFound(payload) {
var newRequest = payload.newRequest;
@@ -44,7 +44,7 @@
glimpse.on('data.request.detail.found', dataFound);
})();
-// Trigger Requests
+// Get Request
(function () {
function triggerRequest(payload) {
var requestId = payload.requestId; |
e111d680ac821e2f61bc405872caa4d29566b1c4 | src/components/logo.js | src/components/logo.js | export default class Logo {
render() {
return (
<div id="branding">
<a href="index.php" title="CosmoWiki.de" rel="home">
<img src="http://cosmowiki.de/img/cw_header.jpg" width="500" height="75" alt="CosmoWiki.de"/>
</a>
</div>
);
}
} | export default class Logo {
render() {
return (
<div id="branding">
<a href="/" title="CosmoWiki.de" rel="home">
<img src="/img/cw_header.jpg" width="500" height="75" alt="CosmoWiki.de"/>
</a>
</div>
);
}
} | Replace hard coded refs by relative. | Replace hard coded refs by relative. | JavaScript | mit | cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki | ---
+++
@@ -3,8 +3,8 @@
render() {
return (
<div id="branding">
- <a href="index.php" title="CosmoWiki.de" rel="home">
- <img src="http://cosmowiki.de/img/cw_header.jpg" width="500" height="75" alt="CosmoWiki.de"/>
+ <a href="/" title="CosmoWiki.de" rel="home">
+ <img src="/img/cw_header.jpg" width="500" height="75" alt="CosmoWiki.de"/>
</a>
</div>
|
d76a165efef5ce03cbc5eda8161288d85519d78a | lib/build/tasks/jasmine.js | lib/build/tasks/jasmine.js | var js_files = require('../files/js_files');
module.exports = {
cartodbui: {
src: js_files.all.concat([
'lib/build/user_data.js',
'<%= assets_dir %>/javascripts/templates_mustache.js',
'<%= assets_dir %>/javascripts/templates.js',
'lib/build/test_init.js']),
options: {
keepRunner: true, // do not delete the runner (added to gitignore anyway), makes sure the runner is up-to-date
outfile: '_SpecRunner.html',
summary: true,
display: 'short',
specs: js_files.specs,
helpers: ['http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12'].concat(js_files._spec_helpers)
// '--remote-debugger-port': 9000
}
},
affected: {
options: {
keepRunner: true,
outfile: '_SpecRunner-affected.html',
summary: true,
display: 'full',
helpers: js_files._spec_helpers3,
specs: [
'.grunt/vendor.affected-specs.js',
'.grunt/main.affected-specs.js'
],
vendor: [
'node_modules/jasmine-ajax/lib/mock-ajax.js',
'node_modules/underscore/underscore-min.js']
}
}
};
| var js_files = require('../files/js_files');
module.exports = {
cartodbui: {
src: js_files.all.concat([
'lib/build/user_data.js',
'<%= assets_dir %>/javascripts/templates_mustache.js',
'<%= assets_dir %>/javascripts/templates.js',
'lib/build/test_init.js']),
options: {
keepRunner: true, // do not delete the runner (added to gitignore anyway), makes sure the runner is up-to-date
outfile: '_SpecRunner.html',
summary: true,
display: 'short',
specs: js_files.specs,
helpers: ['http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12'].concat(js_files._spec_helpers)
// '--remote-debugger-port': 9000
}
},
affected: {
options: {
timeout: 20000,
keepRunner: true,
outfile: '_SpecRunner-affected.html',
summary: true,
display: 'full',
helpers: js_files._spec_helpers3,
specs: [
'.grunt/vendor.affected-specs.js',
'.grunt/main.affected-specs.js'
],
vendor: [
'node_modules/jasmine-ajax/lib/mock-ajax.js',
'node_modules/underscore/underscore-min.js']
}
}
};
| Increase timeout to 20 seconds (previously 10) | Increase timeout to 20 seconds (previously 10)
| JavaScript | bsd-3-clause | CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,splashblot/dronedb,splashblot/dronedb,CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb | ---
+++
@@ -20,6 +20,7 @@
affected: {
options: {
+ timeout: 20000,
keepRunner: true,
outfile: '_SpecRunner-affected.html',
summary: true, |
d99736f34d2001921c487fd987ae55e3b6c05a29 | lib/parse/block-element.js | lib/parse/block-element.js | import Set from 'es6-set';
import blockElements from 'block-elements';
const BLOCK_ELEMENTS = new Set(blockElements);
const TEXT_ELEMENTS = {
h1: 'header1',
h2: 'header2',
h3: 'header3',
h4: 'header4',
h5: 'header5',
h6: 'header6',
p: 'paragraph',
blockquote: 'blockquote'
};
const isPullQuote = (elm) => {
return elm.classList.contains('q');
};
// inject parse to avoid recursive requires
export default (parse, text) => {
return (elm, textOpts) => {
const tagName = elm.tagName.toLowerCase();
if (BLOCK_ELEMENTS.has(tagName)) {
const type = TEXT_ELEMENTS[tagName] || 'block';
const blockElement = {
type,
children: []
};
if (elm.childNodes.length) {
parse(elm.childNodes, text(textOpts, elm), blockElement.children);
}
if (type === 'blockquote') {
blockElement.pullQuote = isPullQuote(elm);
}
return blockElement;
}
};
};
| import Set from 'es6-set';
import blockElements from 'block-elements';
const BLOCK_ELEMENTS = new Set(blockElements);
const TEXT_ELEMENTS = {
h1: 'header1',
h2: 'header2',
h3: 'header3',
h4: 'header4',
h5: 'header5',
h6: 'header6',
p: 'paragraph',
blockquote: 'blockquote'
};
const isPullQuote = (elm) => {
return elm.classList.contains('q');
};
const createBlockElement = (type, elm) => {
if (type === 'blockquote') {
return {
type,
pullQuote: isPullQuote(elm),
children: []
};
} else {
return {
type,
children: []
};
}
};
// inject parse to avoid recursive requires
export default (parse, text) => {
return (elm, textOpts) => {
const tagName = elm.tagName.toLowerCase();
if (BLOCK_ELEMENTS.has(tagName)) {
const type = TEXT_ELEMENTS[tagName] || 'block';
const blockElement = createBlockElement(type, elm);
if (elm.childNodes.length) {
parse(elm.childNodes, text(textOpts, elm), blockElement.children);
}
return blockElement;
}
};
};
| Create new object instead of modifying, to make sure they are optimized by V8 | Create new object instead of modifying, to make sure they are optimized by V8
| JavaScript | mit | micnews/html-to-article-json,micnews/html-to-article-json | ---
+++
@@ -17,6 +17,21 @@
return elm.classList.contains('q');
};
+const createBlockElement = (type, elm) => {
+ if (type === 'blockquote') {
+ return {
+ type,
+ pullQuote: isPullQuote(elm),
+ children: []
+ };
+ } else {
+ return {
+ type,
+ children: []
+ };
+ }
+};
+
// inject parse to avoid recursive requires
export default (parse, text) => {
return (elm, textOpts) => {
@@ -24,16 +39,11 @@
if (BLOCK_ELEMENTS.has(tagName)) {
const type = TEXT_ELEMENTS[tagName] || 'block';
- const blockElement = {
- type,
- children: []
- };
+
+ const blockElement = createBlockElement(type, elm);
+
if (elm.childNodes.length) {
parse(elm.childNodes, text(textOpts, elm), blockElement.children);
- }
-
- if (type === 'blockquote') {
- blockElement.pullQuote = isPullQuote(elm);
}
return blockElement; |
87f3710f43e5fd2d899de6b1b74cad716e154b5b | addon/components/lt-row.js | addon/components/lt-row.js | import Ember from 'ember';
import layout from 'ember-light-table/templates/components/lt-row';
const {
Component,
computed
} = Ember;
const Row = Component.extend({
layout,
tagName: 'tr',
classNames: ['lt-row'],
classNameBindings: ['isSelected', 'isExpanded', 'canExpand:is-expandable', 'canSelect:is-selectable', 'row.classNames'],
attributeBindings: ['colspan'],
columns: null,
row: null,
tableActions: null,
canExpand: false,
canSelect: false,
colpan: 1,
isSelected: computed.readOnly('row.selected'),
isExpanded: computed.readOnly('row.expanded')
});
Row.reopenClass({
positionalParams: ['row', 'columns']
});
export default Row;
| import Ember from 'ember';
import layout from 'ember-light-table/templates/components/lt-row';
const {
Component,
computed
} = Ember;
const Row = Component.extend({
layout,
tagName: 'tr',
classNames: ['lt-row'],
classNameBindings: ['isSelected', 'isExpanded', 'canExpand:is-expandable', 'canSelect:is-selectable', 'row.classNames'],
attributeBindings: ['colspan'],
columns: null,
row: null,
tableActions: null,
canExpand: false,
canSelect: false,
colspan: 1,
isSelected: computed.readOnly('row.selected'),
isExpanded: computed.readOnly('row.expanded')
});
Row.reopenClass({
positionalParams: ['row', 'columns']
});
export default Row;
| Fix typo for default colspan | Fix typo for default colspan | JavaScript | mit | offirgolan/ember-light-table,offirgolan/ember-light-table | ---
+++
@@ -18,7 +18,7 @@
tableActions: null,
canExpand: false,
canSelect: false,
- colpan: 1,
+ colspan: 1,
isSelected: computed.readOnly('row.selected'),
isExpanded: computed.readOnly('row.expanded') |
95c064b50ff7d7d174b778a4f50dc1a9fca83925 | src/activities/pizza/shared/parameters.js | src/activities/pizza/shared/parameters.js | define({
RoundCount: 2,
MinPlayers: 4,
RoundDuration: 90000
});
| define({
RoundCount: 4,
MinPlayers: 4,
RoundDuration: 90000
});
| Increase round count for Pizza Productivity | Increase round count for Pizza Productivity
| JavaScript | mpl-2.0 | councilforeconed/interactive-activities,jugglinmike/cee,councilforeconed/interactive-activities,jugglinmike/cee,councilforeconed/interactive-activities | ---
+++
@@ -1,5 +1,5 @@
define({
- RoundCount: 2,
+ RoundCount: 4,
MinPlayers: 4,
RoundDuration: 90000
}); |
2127952f1775686e8da53a55e23b236e0d6e67d0 | src/modules/Assetic.js | src/modules/Assetic.js | import layout from '../../config/layout'
const fixLocalAsset = assets => (
(Array.isArray(assets) ? assets : [assets]).map(asset => `/${asset}`)
)
export const getAssets = (localAssets = []) => (
Array.concat(
layout.script.map(item => item.src),
layout.link.map(item => item.href),
localAssets.map(asset => fixLocalAsset(asset))
)
)
export const getAssetsByExtension = (extension, localAssets = []) => (
getAssets(localAssets).filter(asset => new RegExp('.(' + extension + ')$').test(asset))
)
export const getScripts = (localAssets = []) => (
getAssetsByExtension('js', localAssets)
)
export const getStyles = (localAssets = []) => (
getAssetsByExtension('css', localAssets)
)
| import layout from '../../config/layout'
const fixLocalAsset = assets => (
(Array.isArray(assets) ? assets : [assets]).map(asset => `/${asset}`)
)
const normalizeAssets = assets => {
let normalized = []
assets.forEach(item => {
if (Array.isArray(item)) {
item.forEach(asset => {
normalized.push(asset)
})
} else {
normalized.push(item)
}
})
return normalized
}
export const getAssets = (localAssets = []) => (
Array.concat(
layout.script.map(item => item.src),
layout.link.map(item => item.href),
normalizeAssets(localAssets.map(asset => fixLocalAsset(asset)))
)
)
export const getAssetsByExtension = (extension, localAssets = []) => (
getAssets(localAssets).filter(asset => new RegExp('.(' + extension + ')$').test(asset))
)
export const getScripts = (localAssets = []) => (
getAssetsByExtension('js', localAssets)
)
export const getStyles = (localAssets = []) => (
getAssetsByExtension('css', localAssets)
)
| Fix issue with multi dimensional arrays | Fix issue with multi dimensional arrays
| JavaScript | mit | janoist1/universal-react-redux-starter-kit | ---
+++
@@ -4,11 +4,27 @@
(Array.isArray(assets) ? assets : [assets]).map(asset => `/${asset}`)
)
+const normalizeAssets = assets => {
+ let normalized = []
+
+ assets.forEach(item => {
+ if (Array.isArray(item)) {
+ item.forEach(asset => {
+ normalized.push(asset)
+ })
+ } else {
+ normalized.push(item)
+ }
+ })
+
+ return normalized
+}
+
export const getAssets = (localAssets = []) => (
Array.concat(
layout.script.map(item => item.src),
layout.link.map(item => item.href),
- localAssets.map(asset => fixLocalAsset(asset))
+ normalizeAssets(localAssets.map(asset => fixLocalAsset(asset)))
)
)
|
2dd837ca80ea7ff8f357de0408c41f9f1cd627be | tests/functional/routes.js | tests/functional/routes.js | 'use strict';
/*global describe, it*/
var path = require('path');
var request = require('supertest');
var utils = require('../../lib/utils');
var app = require('../../app');
var routes = utils.requireDir(path.join(__dirname, '../../routes/'));
var host = process.env.manhattan_context__instance_hostname ||
'http://localhost:' + app.get('port');
console.log('Testing host: ' + host);
request = request(host);
function isRouter(stackEntry) {
return stackEntry.name === 'router';
}
function getRoutes(stackEntry) {
return stackEntry.handle.stack;
}
describe('Functional tests', function () {
// Assuming all files in /routes/ expect index.js match the name of the route
Object.keys(routes)
.map(app.getPathTo)
.forEach(function (routePath) {
it('correctly responds on the ' + routePath + ' route', function (done) {
request.get(routePath)
.expect(200)
.expect('Content-Type', 'text/html; charset=utf-8')
.end(done);
});
});
});
| 'use strict';
/*global describe, it*/
var path = require('path');
var request = require('supertest');
var utils = require('../../lib/utils');
var app = require('../../app');
var routes = utils.requireDir(path.join(__dirname, '../../routes/'));
var host = process.env.manhattan_context__instance_hostname || 'http://localhost';
request = request(host + ':' + app.get('port'));
function isRouter(stackEntry) {
return stackEntry.name === 'router';
}
function getRoutes(stackEntry) {
return stackEntry.handle.stack;
}
describe('Functional tests', function () {
// Assuming all files in /routes/ expect index.js match the name of the route
Object.keys(routes)
.map(app.getPathTo)
.forEach(function (routePath) {
it('correctly responds on the ' + routePath + ' route', function (done) {
request.get(routePath)
.expect(200)
.expect('Content-Type', 'text/html; charset=utf-8')
.end(done);
});
});
});
| Revert "Log which host is being functionally tested" | Revert "Log which host is being functionally tested"
This reverts commit 824ec144553499911160779833d978d282e88be6.
| JavaScript | bsd-3-clause | ericf/formatjs-site,ericf/formatjs-site | ---
+++
@@ -7,12 +7,9 @@
var app = require('../../app');
var routes = utils.requireDir(path.join(__dirname, '../../routes/'));
-var host = process.env.manhattan_context__instance_hostname ||
- 'http://localhost:' + app.get('port');
+var host = process.env.manhattan_context__instance_hostname || 'http://localhost';
-console.log('Testing host: ' + host);
-
-request = request(host);
+request = request(host + ':' + app.get('port'));
function isRouter(stackEntry) {
return stackEntry.name === 'router'; |
e55ba7f94a1e71c372881c423c7256b4acf0eba6 | web/webpack/plugins/recipes.js | web/webpack/plugins/recipes.js | const config = require('./config');
const pwaOptions = require('./pwaConfig');
const PUBLIC_PATH = config.PUBLIC_PATH;
/**
* optional plugins enabled by enabling their recipe.
* once enabled they succeed being required and get added to plugin list.
* order them in the order they should be added to the plugin lists.
*/
const optionalPlugins = [
{
recipe: 'hints',
name: 'resource-hints-webpack-plugin',
prodOnly: false,
},
{
recipe: 'pwa',
name: 'favicons-webpack-plugin',
prodOnly: false,
options: pwaOptions,
},
{
recipe: 'visualizer',
name: 'webpack-visualizer-plugin',
prodOnly: false,
options: {
filename: '../bundle_weight_report.html',
},
},
{
recipe: 'optimize',
name: 'optimize-js-plugin',
prodOnly: true,
options: {
sourceMap: false,
},
},
{
recipe: 'offline',
name: 'offline-plugin',
prodOnly: true,
options: {
relativePaths: false,
AppCache: false,
ServiceWorker: {
events: true,
},
publicPath: PUBLIC_PATH,
caches: 'all',
},
},
];
module.exports = optionalPlugins;
| const config = require('./config');
const pwaOptions = require('./pwaConfig');
const PUBLIC_PATH = config.PUBLIC_PATH;
/**
* optional plugins enabled by enabling their recipe.
* once enabled they succeed being required and get added to plugin list.
* order them in the order they should be added to the plugin lists.
*/
const optionalPlugins = [
{
recipe: 'hints',
name: 'preload-webpack-plugin',
prodOnly: false,
},
{
recipe: 'pwa',
name: 'favicons-webpack-plugin',
prodOnly: false,
options: pwaOptions,
},
{
recipe: 'visualizer',
name: 'webpack-visualizer-plugin',
prodOnly: false,
options: {
filename: '../bundle_weight_report.html',
},
},
{
recipe: 'optimize',
name: 'optimize-js-plugin',
prodOnly: true,
options: {
sourceMap: false,
},
},
{
recipe: 'offline',
name: 'offline-plugin',
prodOnly: true,
options: {
relativePaths: false,
AppCache: false,
ServiceWorker: {
events: true,
},
publicPath: PUBLIC_PATH,
caches: 'all',
},
},
];
module.exports = optionalPlugins;
| Fix using preload-webpack-plugin, not resource-hints-plugin | Fix using preload-webpack-plugin, not resource-hints-plugin
| JavaScript | mit | c-h-/universal-native-boilerplate,c-h-/universal-native-boilerplate,c-h-/universal-native-boilerplate,c-h-/universal-native-boilerplate,c-h-/universal-native-boilerplate | ---
+++
@@ -11,7 +11,7 @@
const optionalPlugins = [
{
recipe: 'hints',
- name: 'resource-hints-webpack-plugin',
+ name: 'preload-webpack-plugin',
prodOnly: false,
},
{ |
55a1f8d049c622edd4f68a6d9189c92e4adfe674 | lib/normalize-condition.js | lib/normalize-condition.js | var buildMoldsSelector = require('./build-molds-selector');
module.exports = function normalizeCondition(condition, alias) {
var moldsSelector = buildMoldsSelector(alias);
var moldSelected;
var normalized;
while(moldSelected = moldsSelector.exec(condition)) {
normalized = condition.replace(
moldSelected[0],
'fillers.' + moldSelected[1]
);
if(!normalized) return condition;
return normalized
}
};
| var buildMoldsSelector = require('./build-molds-selector');
module.exports = function normalizeCondition(condition, alias) {
var moldsSelector = buildMoldsSelector(alias);
var moldSelected;
while(moldSelected = moldsSelector.exec(condition)) {
condition = condition.replace(
new RegExp(moldSelected[0], 'g'),
'fillers.' + moldSelected[1]
);
}
return condition;
};
| Add support of multiple molds per condition | Add support of multiple molds per condition
| JavaScript | mit | qron/ongine | ---
+++
@@ -4,15 +4,14 @@
var moldsSelector = buildMoldsSelector(alias);
var moldSelected;
- var normalized;
while(moldSelected = moldsSelector.exec(condition)) {
- normalized = condition.replace(
- moldSelected[0],
+ condition = condition.replace(
+ new RegExp(moldSelected[0], 'g'),
'fillers.' + moldSelected[1]
);
- if(!normalized) return condition;
- return normalized
}
+ return condition;
+
}; |
b91f38017839b3ca0928cf3f145a71f172efd49f | src/components/Header.js | src/components/Header.js | import React, { Component } from 'react';
import Button from './Button';
export default class Header extends Component {
render() {
return (
<div className="App-header">
<div className="header-wrap">
<div className="header-content">
<h1>Connect. Collaborate. Create.</h1>
<h2>August 12, 2017 <br/> 8am - 8pm</h2>
<h3>Peoria Civic Center (Verizon Lounge)<br></br><i>In Partnership with <a className="headerLink" href="http://www.ignitepeoria.com/" target="blank">Ignite Peoria</a></i></h3>
<div className="button-group">
<Button href="registration">Get Registered</Button>
<Button href="sponsors" styleName="whitebutton">Sponsors</Button>
</div>
</div>
</div>
</div>
);
}
}
| import React, { Component } from 'react';
import Button from './Button';
export default class Header extends Component {
render() {
return (
<div className="App-header">
<div className="header-wrap">
<div className="header-content">
<h1>Connect. Collaborate. Create.</h1>
<h2>August 12, 2017 <br/> 8am - 8pm</h2>
<h3>Peoria Civic Center (Verizon Lounge)<br></br><i>In Partnership with <a className="headerLink" href="http://www.ignitepeoria.com/" target="blank">Ignite Peoria</a></i></h3>
<div className="button-group">
<Button href="/registration">Get Registered</Button>
<Button href="/sponsors" styleName="whitebutton">Sponsors</Button>
</div>
</div>
</div>
</div>
);
}
}
| Add slashes to buttons on homepage | Add slashes to buttons on homepage
| JavaScript | mit | theCoolKidsJavaScriptMeetup/cuddlyGuacamole,theCoolKidsJavaScriptMeetup/PeoriaHackathon,theCoolKidsJavaScriptMeetup/PeoriaHackathon,theCoolKidsJavaScriptMeetup/cuddlyGuacamole | ---
+++
@@ -11,8 +11,8 @@
<h2>August 12, 2017 <br/> 8am - 8pm</h2>
<h3>Peoria Civic Center (Verizon Lounge)<br></br><i>In Partnership with <a className="headerLink" href="http://www.ignitepeoria.com/" target="blank">Ignite Peoria</a></i></h3>
<div className="button-group">
- <Button href="registration">Get Registered</Button>
- <Button href="sponsors" styleName="whitebutton">Sponsors</Button>
+ <Button href="/registration">Get Registered</Button>
+ <Button href="/sponsors" styleName="whitebutton">Sponsors</Button>
</div>
</div>
</div> |
662b688b40b49f0d2300f935502891dc55289541 | public/docs.js | public/docs.js | var showing = null
function hashChange() {
var hash = document.location.hash.slice(1)
var found = document.getElementById(hash), prefix, sect
if (found && (prefix = /^([^\.]+)/.exec(hash)) && (sect = document.getElementById("part_" + prefix[1]))) {
if (!sect.style.display) {
sect.style.display = "block"
if (showing) showing.style.display = ""
showing = sect
var rect = found.getBoundingClientRect()
window.scrollTo(0, hash == prefix[1] ? 0 : rect.top)
}
}
}
window.addEventListener("hashchange", hashChange)
hashChange()
if (!showing) {
showing = document.querySelector("section")
showing.style.display = "block"
}
var toc = document.querySelector("nav ul")
var openToc = null
for (var item = toc.firstChild; item; item = item.nextSibling) {
if (item.nodeName != "li") (function(item) {
item.addEventListener("click", function(e) {
if (openToc == item) return
if (openToc) openToc.className = ""
item.className = "toc_open"
openToc = item
})
}(item))
}
| var showing = null
function hashChange() {
var hash = decodeURIComponent(document.location.hash.slice(1))
var found = document.getElementById(hash), prefix, sect
if (found && (prefix = /^([^\.]+)/.exec(hash)) && (sect = document.getElementById("part_" + prefix[1]))) {
if (!sect.style.display) {
sect.style.display = "block"
if (showing) showing.style.display = ""
showing = sect
var rect = found.getBoundingClientRect()
window.scrollTo(0, hash == prefix[1] ? 0 : rect.top)
}
}
}
window.addEventListener("hashchange", hashChange)
hashChange()
if (!showing) {
showing = document.querySelector("section")
showing.style.display = "block"
}
var toc = document.querySelector("nav ul")
var openToc = null
for (var item = toc.firstChild; item; item = item.nextSibling) {
if (item.nodeName != "li") (function(item) {
item.addEventListener("click", function(e) {
if (openToc == item) return
if (openToc) openToc.className = ""
item.className = "toc_open"
openToc = item
})
}(item))
}
| Fix problem with navigating to static methods in the reference guide | Fix problem with navigating to static methods in the reference guide
| JavaScript | mit | ProseMirror/website,ProseMirror/website | ---
+++
@@ -1,7 +1,7 @@
var showing = null
function hashChange() {
- var hash = document.location.hash.slice(1)
+ var hash = decodeURIComponent(document.location.hash.slice(1))
var found = document.getElementById(hash), prefix, sect
if (found && (prefix = /^([^\.]+)/.exec(hash)) && (sect = document.getElementById("part_" + prefix[1]))) {
if (!sect.style.display) { |
b08a4b1fe56352ad9dc30ef1a8dbc1498db46261 | core/client/components/gh-notification.js | core/client/components/gh-notification.js | var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
if (typeof message.toJSON === 'function') {
type = message.get('type');
dismissible = message.get('dismissible');
}
else {
type = message.type;
dismissible = message.dismissible;
}
classes += 'notification-' + type;
if (type === 'success' && dismissible !== false) {
classes += ' notification-passive';
}
return classes;
}.property(),
didInsertElement: function () {
var self = this;
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
self.notifications.removeObject(self.get('message'));
});
},
actions: {
closeNotification: function () {
var self = this;
self.notifications.closeNotification(self.get('message'));
}
}
});
export default NotificationComponent;
| var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
if (typeof message.toJSON === 'function') {
type = message.get('type');
dismissible = message.get('dismissible');
}
else {
type = message.type;
dismissible = message.dismissible;
}
classes += 'notification-' + type;
if (type === 'success' && dismissible !== false) {
classes += ' notification-passive';
}
return classes;
}.property(),
didInsertElement: function () {
var self = this;
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
if (event.originalEvent.animationName === 'fade-out') {
self.notifications.removeObject(self.get('message'));
}
});
},
actions: {
closeNotification: function () {
var self = this;
self.notifications.closeNotification(self.get('message'));
}
}
});
export default NotificationComponent;
| Check the end of notification fade-out animation | Check the end of notification fade-out animation
| JavaScript | mit | javorszky/Ghost,allanjsx/Ghost,francisco-filho/Ghost,mlabieniec/ghost-env,Sebastian1011/Ghost,metadevfoundation/Ghost,lanffy/Ghost,Kikobeats/Ghost,zeropaper/Ghost,v3rt1go/Ghost,epicmiller/pages,smaty1/Ghost,panezhang/Ghost,gabfssilva/Ghost,bsansouci/Ghost,thinq4yourself/Unmistakable-Blog,arvidsvensson/Ghost,Jai-Chaudhary/Ghost,handcode7/Ghost,davidenq/Ghost-Blog,daihuaye/Ghost,Coding-House/Ghost,mohanambati/Ghost,bisoe/Ghost,neynah/GhostSS,virtuallyearthed/Ghost,riyadhalnur/Ghost,leninhasda/Ghost,benstoltz/Ghost,rchrd2/Ghost,ManRueda/manrueda-blog,adam-paterson/blog,delgermurun/Ghost,kaiqigong/Ghost,ckousik/Ghost,novaugust/Ghost,sangcu/Ghost,kortemy/Ghost,panezhang/Ghost,Trendy/Ghost,prosenjit-itobuz/Ghost,jorgegilmoreira/ghost,dYale/blog,hilerchyn/Ghost,Trendy/Ghost,kolorahl/Ghost,allspiritseve/mindlikewater,jamesslock/Ghost,zumobi/Ghost,katrotz/blog.katrotz.space,tyrikio/Ghost,rizkyario/Ghost,DesenTao/Ghost,kaychaks/kaushikc.org,omaracrystal/Ghost,rollokb/Ghost,singular78/Ghost,camilodelvasto/localghost,johngeorgewright/blog.j-g-w.info,jeonghwan-kim/Ghost,lukaszklis/Ghost,Netazoic/bad-gateway,UnbounDev/Ghost,jparyani/GhostSS,sfpgmr/Ghost,GroupxDev/javaPress,Feitianyuan/Ghost,vainglori0us/urban-fortnight,stridespace/Ghost,IbrahimAmin/Ghost,jparyani/GhostSS,diogogmt/Ghost,yangli1990/Ghost,Smile42RU/Ghost,jacostag/Ghost,Kaenn/Ghost,bitjson/Ghost,sifatsultan/js-ghost,tmp-reg/Ghost,zhiyishou/Ghost,etdev/blog,nneko/Ghost,singular78/Ghost,dgem/Ghost,madole/diverse-learners,qdk0901/Ghost,nmukh/Ghost,nakamuraapp/new-ghost,lanffy/Ghost,memezilla/Ghost,veyo-care/Ghost,ashishapy/ghostpy,alecho/Ghost,Yarov/yarov,scopevale/wethepeopleweb.org,jorgegilmoreira/ghost,wemakeweb/Ghost,arvidsvensson/Ghost,ignasbernotas/nullifer,greyhwndz/Ghost,JonSmith/Ghost,pbevin/Ghost,gleneivey/Ghost,weareleka/blog,wspandihai/Ghost,schneidmaster/theventriloquist.us,TribeMedia/Ghost,Klaudit/Ghost,Kaenn/Ghost,acburdine/Ghost,pollbox/ghostblog,mohanambati/Ghost,kevinansfield/Ghost,yundt/seisenpenji,kaiqigong/Ghost,MadeOnMars/Ghost,e10/Ghost,exsodus3249/Ghost,pedroha/Ghost,JulienBrks/Ghost,sebgie/Ghost,darvelo/Ghost,denzelwamburu/denzel.xyz,Brunation11/Ghost,ananthhh/Ghost,kwangkim/Ghost,cicorias/Ghost,JohnONolan/Ghost,dylanchernick/ghostblog,vishnuharidas/Ghost,cncodog/Ghost-zh-codog,handcode7/Ghost,vloom/blog,floofydoug/Ghost,riyadhalnur/Ghost,ASwitlyk/Ghost,pedroha/Ghost,lukekhamilton/Ghost,francisco-filho/Ghost,UnbounDev/Ghost,acburdine/Ghost,PaulBGD/Ghost-Plus,ITJesse/Ghost-zh,patrickdbakke/ghost-spa,NovaDevelopGroup/Academy,beautyOfProgram/Ghost,olsio/Ghost,FredericBernardo/Ghost,aexmachina/blog-old,ryanbrunner/crafters,xiongjungit/Ghost,praveenscience/Ghost,mttschltz/ghostblog,r14r/fork_nodejs_ghost,cncodog/Ghost-zh-codog,davidmenger/nodejsfan,jaswilli/Ghost,JulienBrks/Ghost,cwonrails/Ghost,daihuaye/Ghost,wspandihai/Ghost,phillipalexander/Ghost,zumobi/Ghost,TryGhost/Ghost,mnitchie/Ghost,neynah/GhostSS,Remchi/Ghost,uploadcare/uploadcare-ghost-demo,rollokb/Ghost,petersucks/blog,klinker-apps/ghost,load11/ghost,jomahoney/Ghost,PepijnSenders/whatsontheotherside,LeandroNascimento/Ghost,vainglori0us/urban-fortnight,edsadr/Ghost,ladislas/ghost,ananthhh/Ghost,bosung90/Ghost,jomahoney/Ghost,Netazoic/bad-gateway,axross/ghost,SkynetInc/steam,FredericBernardo/Ghost,flpms/ghost-ad,chevex/undoctrinate,ASwitlyk/Ghost,jomofrodo/ccb-ghost,patterncoder/patterncoder,GarrethDottin/Habits-Design,kmeurer/GhostAzureSetup,makapen/Ghost,flpms/ghost-ad,sebgie/Ghost,laispace/laiblog,Shauky/Ghost,zackslash/Ghost,phillipalexander/Ghost,Loyalsoldier/Ghost,stridespace/Ghost,dymx101/Ghost,AlexKVal/Ghost,tchapi/igneet-blog,PeterCxy/Ghost,skleung/blog,optikalefx/Ghost,lethalbrains/Ghost,PDXIII/Ghost-FormMailer,hnarayanan/narayanan.co,adam-paterson/blog,johngeorgewright/blog.j-g-w.info,fredeerock/atlabghost,lukw00/Ghost,barbastan/Ghost,mdbw/ghost,k2byew/Ghost,developer-prosenjit/Ghost,skmezanul/Ghost,etanxing/Ghost,mtvillwock/Ghost,lukekhamilton/Ghost,dai-shi/Ghost,uploadcare/uploadcare-ghost-demo,davidmenger/nodejsfan,ghostchina/Ghost-zh,atandon/Ghost,shrimpy/Ghost,bastianbin/Ghost,BlueHatbRit/Ghost,jin/Ghost,duyetdev/islab,morficus/Ghost,SachaG/bjjbot-blog,Yarov/yarov,KnowLoading/Ghost,rameshponnada/Ghost,bigertech/Ghost,mohanambati/Ghost,sajmoon/Ghost,beautyOfProgram/Ghost,katiefenn/Ghost,r1N0Xmk2/Ghost,sunh3/Ghost,velimir0xff/Ghost,jamesslock/Ghost,denzelwamburu/denzel.xyz,InnoD-WebTier/hardboiled_ghost,chris-yoon90/Ghost,BlueHatbRit/Ghost,duyetdev/islab,dggr/Ghost-sr,ryansukale/ux.ryansukale.com,sebgie/Ghost,cwonrails/Ghost,codeincarnate/Ghost,alexandrachifor/Ghost,thehogfather/Ghost,NodeJSBarenko/Ghost,ashishapy/ghostpy,ErisDS/Ghost,allanjsx/Ghost,dylanchernick/ghostblog,mhhf/ghost-latex,davidenq/Ghost-Blog,delgermurun/Ghost,dqj/Ghost,aschmoe/jesse-ghost-app,ballPointPenguin/Ghost,mnitchie/Ghost,disordinary/Ghost,sunh3/Ghost,Japh/Ghost,flomotlik/Ghost,bbmepic/Ghost,metadevfoundation/Ghost,yanntech/Ghost,Netazoic/bad-gateway,wemakeweb/Ghost,thehogfather/Ghost,Loyalsoldier/Ghost,jgillich/Ghost,sceltoas/Ghost,RoopaS/demo-intern,KnowLoading/Ghost,rizkyario/Ghost,Remchi/Ghost,RufusMbugua/TheoryOfACoder,ErisDS/Ghost,InnoD-WebTier/hardboiled_ghost,dymx101/Ghost,NikolaiIvanov/Ghost,devleague/uber-hackathon,jparyani/GhostSS,influitive/crafters,AnthonyCorrado/Ghost,velimir0xff/Ghost,hoxoa/Ghost,ljhsai/Ghost,djensen47/Ghost,skleung/blog,smedrano/Ghost,jorgegilmoreira/ghost,VillainyStudios/Ghost,cwonrails/Ghost,tandrewnichols/ghost,psychobunny/Ghost,telco2011/Ghost,nneko/Ghost,schematical/Ghost,axross/ghost,ErisDS/Ghost,memezilla/Ghost,allspiritseve/mindlikewater,lowkeyfred/Ghost,cncodog/Ghost-zh-codog,TryGhost/Ghost,kmeurer/Ghost,davidenq/Ghost-Blog,kwangkim/Ghost,cysys/ghost-openshift,ivanoats/ivanstorck.com,jiangjian-zh/Ghost,Dnlyc/Ghost,telco2011/Ghost,edurangel/Ghost,flomotlik/Ghost,hnarayanan/narayanan.co,augbog/Ghost,manishchhabra/Ghost,letsjustfixit/Ghost,floofydoug/Ghost,bisoe/Ghost,alecho/Ghost,gabfssilva/Ghost,AlexKVal/Ghost,vloom/blog,MrMaksimize/sdg1,MadeOnMars/Ghost,Aaron1992/Ghost,Feitianyuan/Ghost,zeropaper/Ghost,akveo/akveo-blog,tanbo800/Ghost,exsodus3249/Ghost,Azzurrio/Ghost,DesenTao/Ghost,dgem/Ghost,AileenCGN/Ghost,JohnONolan/Ghost,load11/ghost,johnnymitch/Ghost,karmakaze/Ghost,stridespace/Ghost,notno/Ghost,bastianbin/Ghost,jaguerra/Ghost,Bunk/Ghost,tuan/Ghost,no1lov3sme/Ghost,kolorahl/Ghost,k2byew/Ghost,gleneivey/Ghost,omaracrystal/Ghost,rizkyario/Ghost,BayPhillips/Ghost,tksander/Ghost,RufusMbugua/TheoryOfACoder,sergeylukin/Ghost,ngosinafrica/SiteForNGOs,rameshponnada/Ghost,ManRueda/Ghost,lf2941270/Ghost,benstoltz/Ghost,GroupxDev/javaPress,liftup/ghost,manishchhabra/Ghost,liftup/ghost,ManRueda/manrueda-blog,julianromera/Ghost,psychobunny/Ghost,anijap/PhotoGhost,hnq90/Ghost,Elektro1776/javaPress,optikalefx/Ghost,yundt/seisenpenji,cysys/ghost-openshift,daimaqiao/Ghost-Bridge,Alxandr/Blog,Klaudit/Ghost,VillainyStudios/Ghost,skmezanul/Ghost,disordinary/Ghost,IbrahimAmin/Ghost,barbastan/Ghost,sangcu/Ghost,lcamacho/Ghost,ryansukale/ux.ryansukale.com,e10/Ghost,sankumsek/Ghost-ashram,Coding-House/Ghost,mattchupp/blog,thinq4yourself/Unmistakable-Blog,Elektro1776/javaPress,jiachenning/Ghost,tidyui/Ghost,trunk-studio/Ghost,mlabieniec/ghost-env,bitjson/Ghost,ClarkGH/Ghost,notno/Ghost,STANAPO/Ghost,Romdeau/Ghost,patterncoder/patterncoder,Kaenn/Ghost,InnoD-WebTier/hardboiled_ghost,shannonshsu/Ghost,claudiordgz/Ghost,UsmanJ/Ghost,LeandroNascimento/Ghost,obsoleted/Ghost,rito/Ghost,cqricky/Ghost,dbalders/Ghost,schneidmaster/theventriloquist.us,darvelo/Ghost,singular78/Ghost,TryGhost/Ghost,netputer/Ghost,hyokosdeveloper/Ghost,zhiyishou/Ghost,uniqname/everydaydelicious,Azzurrio/Ghost,pbevin/Ghost,andrewconnell/Ghost,leninhasda/Ghost,mdbw/ghost,klinker-apps/ghost,hoxoa/Ghost,novaugust/Ghost,JonathanZWhite/Ghost,aroneiermann/GhostJade,rmoorman/Ghost,gcamana/Ghost,tmp-reg/Ghost,trepafi/ghost-base,dbalders/Ghost,akveo/akveo-blog,r14r/fork_nodejs_ghost,TribeMedia/Ghost,claudiordgz/Ghost,jiachenning/Ghost,gcamana/Ghost,YY030913/Ghost,Kikobeats/Ghost,laispace/laiblog,imjerrybao/Ghost,ManRueda/Ghost,camilodelvasto/localghost,YY030913/Ghost,bbmepic/Ghost,carlosmtx/Ghost,hnq90/Ghost,imjerrybao/Ghost,edurangel/Ghost,prosenjit-itobuz/Ghost,ghostchina/Ghost.zh,dggr/Ghost-sr,JohnONolan/Ghost,etdev/blog,hilerchyn/Ghost,olsio/Ghost,devleague/uber-hackathon,theonlypat/Ghost,Japh/Ghost,achimos/ghost_as,sfpgmr/Ghost,camilodelvasto/herokughost,obsoleted/Ghost,telco2011/Ghost,blankmaker/Ghost,theonlypat/Ghost,pensierinmusica/Ghost,melissaroman/ghost-blog,ryanbrunner/crafters,chris-yoon90/Ghost,pensierinmusica/Ghost,NovaDevelopGroup/Academy,sceltoas/Ghost,dggr/Ghost-sr,cqricky/Ghost,lukaszklis/Ghost,ManRueda/Ghost,Gargol/Ghost,neynah/GhostSS,jiangjian-zh/Ghost,leonli/ghost,ThorstenHans/Ghost,ghostchina/Ghost-zh,ddeveloperr/Ghost,tidyui/Ghost,rmoorman/Ghost,acburdine/Ghost,xiongjungit/Ghost,zackslash/Ghost,johnnymitch/Ghost,PeterCxy/Ghost,katrotz/blog.katrotz.space,carlyledavis/Ghost,javimolla/Ghost,allanjsx/Ghost,tyrikio/Ghost,achimos/ghost_as,schematical/Ghost,etanxing/Ghost,netputer/Ghost,Alxandr/Blog,diancloud/Ghost,Elektro1776/javaPress,daimaqiao/Ghost-Bridge,llv22/Ghost,SachaG/bjjbot-blog,epicmiller/pages,camilodelvasto/herokughost,Kikobeats/Ghost,Xibao-Lv/Ghost,ghostchina/Ghost.zh,Rovak/Ghost,PaulBGD/Ghost-Plus,woodyrew/Ghost,dqj/Ghost,julianromera/Ghost,trunk-studio/Ghost,ladislas/ghost,tanbo800/Ghost,icowan/Ghost,pathayes/FoodBlog,janvt/Ghost,rito/Ghost,llv22/Ghost,UsmanJ/Ghost,lethalbrains/Ghost,Alxandr/Blog,ljhsai/Ghost,mattchupp/blog,Japh/shortcoffee,ghostchina/website,tandrewnichols/ghost,Polyrhythm/dolce,situkangsayur/Ghost,icowan/Ghost,rchrd2/Ghost,GroupxDev/javaPress,yanntech/Ghost,carlosmtx/Ghost,Brunation11/Ghost,fredeerock/atlabghost,Japh/shortcoffee,melissaroman/ghost-blog,mayconxhh/Ghost,petersucks/blog,STANAPO/Ghost,morficus/Ghost,wallmarkets/Ghost,freele/ghost,djensen47/Ghost,sajmoon/Ghost,rouanw/Ghost,shannonshsu/Ghost,anijap/PhotoGhost,letsjustfixit/Ghost,tksander/Ghost,blankmaker/Ghost,bosung90/Ghost,javimolla/Ghost,JonathanZWhite/Ghost,tadityar/Ghost,v3rt1go/Ghost,developer-prosenjit/Ghost,AnthonyCorrado/Ghost,SkynetInc/steam,NamedGod/Ghost,jaswilli/Ghost,lukw00/Ghost,aschmoe/jesse-ghost-app,diancloud/Ghost,dai-shi/Ghost,greyhwndz/Ghost,ivanoats/ivanstorck.com,pollbox/ghostblog,jgladch/taskworksource,ManRueda/manrueda-blog,dYale/blog,ITJesse/Ghost-zh,NamedGod/Ghost,thomasalrin/Ghost,JonSmith/Ghost,ineitzke/Ghost,javorszky/Ghost,jomofrodo/ccb-ghost,edsadr/Ghost,Gargol/Ghost,r1N0Xmk2/Ghost,kortemy/Ghost,karmakaze/Ghost,GarrethDottin/Habits-Design,kaychaks/kaushikc.org,ballPointPenguin/Ghost,praveenscience/Ghost,rouanw/Ghost,Dnlyc/Ghost,novaugust/Ghost,cicorias/Ghost,weareleka/blog,diogogmt/Ghost,smaty1/Ghost,thomasalrin/Ghost,yangli1990/Ghost,sergeylukin/Ghost,influitive/crafters,ckousik/Ghost,mttschltz/ghostblog,wangjun/Ghost,jomofrodo/ccb-ghost,cysys/ghost-openshift,mayconxhh/Ghost,ineitzke/Ghost,jgillich/Ghost,jeonghwan-kim/Ghost,augbog/Ghost,kortemy/Ghost,pathayes/FoodBlog,Smile42RU/Ghost,wangjun/Ghost,aroneiermann/GhostJade,virtuallyearthed/Ghost,ygbhf/Ghost,dbalders/Ghost,ddeveloperr/Ghost,BayPhillips/Ghost,greenboxindonesia/Ghost,Xibao-Lv/Ghost,makapen/Ghost,smedrano/Ghost,rafaelstz/Ghost,hyokosdeveloper/Ghost,veyo-care/Ghost,mhhf/ghost-latex,PDXIII/Ghost-FormMailer,lf2941270/Ghost,laispace/laiblog,qdk0901/Ghost,ygbhf/Ghost,kevinansfield/Ghost,nmukh/Ghost,tadityar/Ghost,Rovak/Ghost,ClarkGH/Ghost,letsjustfixit/Ghost,ericbenson/GhostAzureSetup,Netazoic/bad-gateway,cobbspur/Ghost,krahman/Ghost,daimaqiao/Ghost-Bridge,jacostag/Ghost,Bunk/Ghost,wallmarkets/Ghost,syaiful6/Ghost,atandon/Ghost,woodyrew/Ghost,Sebastian1011/Ghost,devleague/uber-hackathon,kmeurer/Ghost,NikolaiIvanov/Ghost,shrimpy/Ghost,mtvillwock/Ghost,ivantedja/ghost,andrewconnell/Ghost,leonli/ghost,PepijnSenders/whatsontheotherside,jin/Ghost,codeincarnate/Ghost,kevinansfield/Ghost,NovaDevelopGroup/Academy,janvt/Ghost,jaguerra/Ghost,Romdeau/Ghost,ngosinafrica/SiteForNGOs,ignasbernotas/nullifer,bsansouci/Ghost,vainglori0us/urban-fortnight,rafaelstz/Ghost,ericbenson/GhostAzureSetup,situkangsayur/Ghost,mlabieniec/ghost-env,syaiful6/Ghost,madole/diverse-learners,leonli/ghost,greenboxindonesia/Ghost,lowkeyfred/Ghost,mikecastro26/ghost-custom,carlyledavis/Ghost,ThorstenHans/Ghost,Jai-Chaudhary/Ghost,no1lov3sme/Ghost,sifatsultan/js-ghost | ---
+++
@@ -31,7 +31,9 @@
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
- self.notifications.removeObject(self.get('message'));
+ if (event.originalEvent.animationName === 'fade-out') {
+ self.notifications.removeObject(self.get('message'));
+ }
});
},
|
8fe37e614d9848352258d60339c7415bdee12a5c | tests/Resources/minify/expected/regexes.js | tests/Resources/minify/expected/regexes.js | function testIssue74(){return/'/;}
!function(s){return/^[£$€?.]/.test(s);}();typeof
/ ' /;x=/ [/] /;1/foo;(2)/foo;function(){return/foo/};function(){return typeof/foo/};
| function testIssue74(){return/'/;}
!function(s){return/^[£$€?.]/.test(s);}();typeof/ ' /;x=/ [/] /;1/foo;(2)/foo;function(){return/foo/};function(){return typeof/foo/};
| Remove line break between typedef and regexp to be consistent with the other code places. | Remove line break between typedef and regexp to be consistent with the other
code places.
| JavaScript | bsd-3-clause | mrclay/jsmin-php,mrclay/jsmin-php | ---
+++
@@ -1,3 +1,2 @@
function testIssue74(){return/'/;}
-!function(s){return/^[£$€?.]/.test(s);}();typeof
-/ ' /;x=/ [/] /;1/foo;(2)/foo;function(){return/foo/};function(){return typeof/foo/};
+!function(s){return/^[£$€?.]/.test(s);}();typeof/ ' /;x=/ [/] /;1/foo;(2)/foo;function(){return/foo/};function(){return typeof/foo/}; |
e5c1148583b076e9bdfb1c35e02c579ade240e3c | index.js | index.js | var doc = require('doc-js');
module.exports = function(hoverClass, selector){
var down = [],
selector = selector || 'button, a',
hoverClass = hoverClass || 'hover';
doc(document).on('touchstart mousedown', selector, function(event){
var target = doc(event.target).closest(selector);
doc(target).addClass(hoverClass);
down.push(target);
});
doc(document).on('touchend touchcancel mouseup mousemove', function(event){
while(down.length){
doc(down.pop()).removeClass(hoverClass);
}
});
}; | var doc = require('doc-js');
module.exports = function(hoverClass, selector){
var down = [],
selector = selector || 'button, a',
hoverClass = hoverClass || 'hover';
function setClasses(){
for(var i = 0; i < down.length; i++){
doc(down[i]).addClass(hoverClass);
}
}
doc(document).on('touchstart mousedown', selector, function(event){
var target = doc(event.target).closest(selector);
down.push(target);
setTimeout(setClasses, 50);
});
function cancelHover(event){
if(event.defaultPrevented){
return;
}
while(down.length){
doc(down.pop()).removeClass(hoverClass);
}
}
doc(document).on('touchend touchmove touchcancel mouseup mousemove', cancelHover);
}; | Allow hover to be canceled by a scroll | Allow hover to be canceled by a scroll
| JavaScript | mit | KoryNunn/hoverclass | ---
+++
@@ -5,14 +5,26 @@
selector = selector || 'button, a',
hoverClass = hoverClass || 'hover';
+ function setClasses(){
+ for(var i = 0; i < down.length; i++){
+ doc(down[i]).addClass(hoverClass);
+ }
+ }
+
doc(document).on('touchstart mousedown', selector, function(event){
var target = doc(event.target).closest(selector);
- doc(target).addClass(hoverClass);
down.push(target);
+ setTimeout(setClasses, 50);
});
- doc(document).on('touchend touchcancel mouseup mousemove', function(event){
+
+ function cancelHover(event){
+ if(event.defaultPrevented){
+ return;
+ }
while(down.length){
doc(down.pop()).removeClass(hoverClass);
}
- });
+ }
+
+ doc(document).on('touchend touchmove touchcancel mouseup mousemove', cancelHover);
}; |
acb81229c6f704e0962bf102eb17f8cc479b9862 | src/mmw/js/src/data_catalog/controllers.js | src/mmw/js/src/data_catalog/controllers.js | "use strict";
var App = require('../app'),
router = require('../router').router,
coreUtils = require('../core/utils'),
models = require('./models'),
views = require('./views');
var DataCatalogController = {
dataCatalogPrepare: function() {
if (!App.map.get('areaOfInterest')) {
router.navigate('', { trigger: true });
return false;
}
},
dataCatalog: function() {
App.map.setDataCatalogSize();
App.state.set({
'active_page': coreUtils.dataCatalogPageTitle,
});
var form = new models.SearchForm();
var catalogs = new models.Catalogs([
new models.Catalog({
id: 'cinergi',
name: 'CINERGI',
active: true,
results: new models.Results(null, { catalog: 'cinergi' }),
}),
new models.Catalog({
id: 'hydroshare',
name: 'HydroShare',
results: new models.Results(null, { catalog: 'hydroshare' }),
}),
new models.Catalog({
id: 'cuahsi',
name: 'WDC',
description: 'Optional catalog description here...',
results: new models.Results(null, { catalog: 'cuahsi' }),
})
]);
var view = new views.DataCatalogWindow({
model: form,
collection: catalogs
});
App.rootView.sidebarRegion.show(view);
}
};
module.exports = {
DataCatalogController: DataCatalogController,
};
| "use strict";
var App = require('../app'),
router = require('../router').router,
coreUtils = require('../core/utils'),
models = require('./models'),
views = require('./views');
var DataCatalogController = {
dataCatalogPrepare: function() {
if (!App.map.get('areaOfInterest')) {
router.navigate('', { trigger: true });
return false;
}
},
dataCatalog: function() {
App.map.setDataCatalogSize();
App.state.set({
'active_page': coreUtils.dataCatalogPageTitle,
});
var form = new models.SearchForm();
var catalogs = new models.Catalogs([
new models.Catalog({
id: 'cinergi',
name: 'CINERGI',
active: true,
results: new models.Results(null, { catalog: 'cinergi' }),
}),
new models.Catalog({
id: 'hydroshare',
name: 'HydroShare',
results: new models.Results(null, { catalog: 'hydroshare' }),
}),
new models.Catalog({
id: 'cuahsi',
name: 'WDC',
description: 'Optional catalog description here...',
results: new models.Results(null, { catalog: 'cuahsi' }),
})
]);
var view = new views.DataCatalogWindow({
model: form,
collection: catalogs
});
App.rootView.sidebarRegion.show(view);
},
dataCatalogCleanUp: function() {
App.map.set({
dataCatalogResults: null,
dataCatalogActiveResult: null,
});
}
};
module.exports = {
DataCatalogController: DataCatalogController,
};
| Clear results from map on datacatalog cleanup | BiGCZ: Clear results from map on datacatalog cleanup
| JavaScript | apache-2.0 | WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed | ---
+++
@@ -48,6 +48,13 @@
collection: catalogs
});
App.rootView.sidebarRegion.show(view);
+ },
+
+ dataCatalogCleanUp: function() {
+ App.map.set({
+ dataCatalogResults: null,
+ dataCatalogActiveResult: null,
+ });
}
};
|
a15fd27717ca924eac15cda65148b691d2dc5ed7 | index.js | index.js | exports.transform = require('./lib/transform')
exports.estimate = require('./lib/estimate')
exports.version = require('./lib/version')
exports.createFromArray = function (arr) {
// Create a nudged.Transform instance from an array that was
// previously created with nudged.Transform#toArray().
//
// Together with nudged.Transform#toArray(), this method makes an easy
// serialization and deserialization to and from JSON possible.
//
// Parameter:
// arr
// array with four elements
var s = arr[0]
var r = arr[1]
var tx = arr[2]
var ty = arr[3]
return new exports.Transform(s, r, tx, ty)
}
exports.estimate = function (type, domain, range, pivot) {
// Parameter
// type
// string. One of the following:
// 'I', 'L', 'X', 'Y', 'T', 'S', 'R', 'TS', 'TR', 'SR', 'TSR'
// domain
// array of 2d arrays
// range
// array of 2d arrays
// pivot
// An optional 2d array for 'S', 'R', and 'SR'. An angle for 'L'.
//
var name = 'estimate' + type.toUpperCase()
try {
return exports[name](domain, range, pivot)
} catch (e) {
if (typeof exports[name] !== 'function') {
throw new Error('Unknown estimator type: ' + type)
}
throw e
}
}
| exports.transform = require('./lib/transform')
exports.estimate = require('./lib/estimate')
exports.version = require('./lib/version')
exports.estimate = function (type, domain, range, pivot) {
// Parameter
// type
// string. One of the following:
// 'I', 'L', 'X', 'Y', 'T', 'S', 'R', 'TS', 'TR', 'SR', 'TSR'
// domain
// array of 2d arrays
// range
// array of 2d arrays
// pivot
// An optional 2d array for 'S', 'R', and 'SR'. An angle for 'L'.
//
var name = 'estimate' + type.toUpperCase()
try {
return exports[name](domain, range, pivot)
} catch (e) {
if (typeof exports[name] !== 'function') {
throw new Error('Unknown estimator type: ' + type)
}
throw e
}
}
| Remove nudged.createFromArray in favor of transform.createFromArray | Remove nudged.createFromArray in favor of transform.createFromArray
| JavaScript | mit | axelpale/nudged | ---
+++
@@ -1,24 +1,6 @@
exports.transform = require('./lib/transform')
exports.estimate = require('./lib/estimate')
exports.version = require('./lib/version')
-
-exports.createFromArray = function (arr) {
- // Create a nudged.Transform instance from an array that was
- // previously created with nudged.Transform#toArray().
- //
- // Together with nudged.Transform#toArray(), this method makes an easy
- // serialization and deserialization to and from JSON possible.
- //
- // Parameter:
- // arr
- // array with four elements
-
- var s = arr[0]
- var r = arr[1]
- var tx = arr[2]
- var ty = arr[3]
- return new exports.Transform(s, r, tx, ty)
-}
exports.estimate = function (type, domain, range, pivot) {
// Parameter |
eab61d3f8fc076b2672cb31cce5e11fc9e5f3381 | web_external/Datasets/selectDatasetView.js | web_external/Datasets/selectDatasetView.js | import View from '../view';
import SelectDatasetPageTemplate from './selectDatasetPage.pug';
// View for a collection of datasets in a select tag. When user selects a
// dataset, a 'changed' event is triggered with the selected dataset as a
// parameter.
const SelectDatasetView = View.extend({
events: {
'change': 'datasetChanged'
},
/**
* @param {DatasetCollection} settings.collection
*/
initialize: function (settings) {
this.listenTo(this.collection, 'reset', this.render);
this.render();
},
datasetChanged: function () {
const datasetId = this.$('select').val();
const dataset = this.collection.get(datasetId);
dataset.fetch()
.done(() => {
this.trigger('changed', dataset);
});
},
render: function () {
// Destroy previous select2
let select = this.$('#isic-select-dataset-select');
select.select2('destroy');
this.$el.html(SelectDatasetPageTemplate({
models: this.collection.toArray()
}));
// Set up select box
let placeholder = 'Select a dataset...';
if (!this.collection.isEmpty()) {
placeholder += ` (${this.collection.length} available)`;
}
select = this.$('#isic-select-dataset-select');
select.select2({
placeholder: placeholder,
dropdownParent: this.$el
});
select.focus();
return this;
}
});
export default SelectDatasetView;
| import View from '../view';
import SelectDatasetPageTemplate from './selectDatasetPage.pug';
// View for a collection of datasets in a select tag. When user selects a
// dataset, a 'changed' event is triggered with the selected dataset as a
// parameter.
const SelectDatasetView = View.extend({
events: {
'change #isic-select-dataset-select': 'datasetChanged'
},
/**
* @param {DatasetCollection} settings.collection
*/
initialize: function (settings) {
this.listenTo(this.collection, 'reset', this.render);
this.render();
},
datasetChanged: function () {
const datasetId = this.$('select').val();
const dataset = this.collection.get(datasetId);
dataset.fetch()
.done(() => {
this.trigger('changed', dataset);
});
},
render: function () {
// Destroy previous select2
let select = this.$('#isic-select-dataset-select');
select.select2('destroy');
this.$el.html(SelectDatasetPageTemplate({
models: this.collection.toArray()
}));
// Set up select box
let placeholder = 'Select a dataset...';
if (!this.collection.isEmpty()) {
placeholder += ` (${this.collection.length} available)`;
}
select = this.$('#isic-select-dataset-select');
select.select2({
placeholder: placeholder,
dropdownParent: this.$el
});
select.focus();
return this;
}
});
export default SelectDatasetView;
| Use a more specific event selector in SelectDatasetView | Use a more specific event selector in SelectDatasetView
| JavaScript | apache-2.0 | ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive | ---
+++
@@ -7,7 +7,7 @@
// parameter.
const SelectDatasetView = View.extend({
events: {
- 'change': 'datasetChanged'
+ 'change #isic-select-dataset-select': 'datasetChanged'
},
/** |
1d601875f9335bf59636cd6ecbef65c8f89d17c4 | index.js | index.js | // @flow
import { AppRegistry } from 'react-native';
import App from './app/App';
// import App from './app/playground/src/Navigation';
AppRegistry.registerComponent('reactNativeApp', () => App);
| // @flow
import { AppRegistry, YellowBox } from 'react-native';
// TODO: please check if it's still needed
YellowBox.ignoreWarnings([
'Warning: isMounted(...) is deprecated in plain JavaScript React classes.',
'Module R', // ... requires main queue setup since it overrides ...
]);
import App from './app/App';
// import App from './app/playground/src/Navigation';
AppRegistry.registerComponent('reactNativeApp', () => App);
| Hide warnings from the React core | Hide warnings from the React core
| JavaScript | mit | mrtnzlml/native,mrtnzlml/native | ---
+++
@@ -1,6 +1,12 @@
// @flow
-import { AppRegistry } from 'react-native';
+import { AppRegistry, YellowBox } from 'react-native';
+
+// TODO: please check if it's still needed
+YellowBox.ignoreWarnings([
+ 'Warning: isMounted(...) is deprecated in plain JavaScript React classes.',
+ 'Module R', // ... requires main queue setup since it overrides ...
+]);
import App from './app/App';
// import App from './app/playground/src/Navigation'; |
07efe8f7cdec6b9213668a0a9bd010beae6d689f | index.js | index.js | var bodyParser = require('body-parser')
var dataUriToBuffer = require('data-uri-to-buffer')
var express = require('express')
var app = express()
var transform = require("./transformer")
// Set up some Express settings
app.use(bodyParser.json({ limit: '2mb' }))
app.use(express.static(__dirname + '/public'))
/**
* Home route serves index.html file, and
* responds with 200 by default for revisit
*/
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html')
})
/**
* Service route is where the magic happens.
*/
app.post('/service', function(req, res) {
var imgBuff = dataUriToBuffer(req.body.content.data)
// Transform the image
var transformed = transform(imgBuff)
var dataUri = 'data:' + imgBuff.type + ';base64,' + transformed.toString('base64')
req.body.content.data = dataUri
req.body.content.type = imgBuff.type
res.json(req.body)
})
var port = 8000
app.listen(port)
console.log('server running on port: ', port)
| var bodyParser = require('body-parser')
var dataUriToBuffer = require('data-uri-to-buffer')
var express = require('express')
var app = express()
/**
* This is your custom transform function
* move it wherever, call it whatever
*/
var transform = require("./transformer")
// Set up some Express settings
app.use(bodyParser.json({ limit: '1mb' }))
app.use(express.static(__dirname + '/public'))
/**
* Home route serves index.html file, and
* responds with 200 by default for revisit
*/
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html')
})
/**
* Service route is where the magic happens.
*/
app.post('/service', function(req, res) {
var imgBuff = dataUriToBuffer(req.body.content.data)
// Transform the image
var transformed = transform(imgBuff)
var dataUri = 'data:' + imgBuff.type + ';base64,' + transformed.toString('base64')
req.body.content.data = dataUri
req.body.content.type = imgBuff.type
res.json(req.body)
})
var port = 8000
app.listen(port)
console.log('server running on port: ', port)
| Change image size limit down to 1mb per @ednapiranha | Change image size limit down to 1mb per @ednapiranha
| JavaScript | mit | jasonrhodes/revisit-gifplay,revisitors/revisit.link-quickstart,florida/put-a-bird-on-it-revisit-service,jasonrhodes/H4UNT3D-H4U5 | ---
+++
@@ -3,10 +3,14 @@
var express = require('express')
var app = express()
+/**
+ * This is your custom transform function
+ * move it wherever, call it whatever
+ */
var transform = require("./transformer")
// Set up some Express settings
-app.use(bodyParser.json({ limit: '2mb' }))
+app.use(bodyParser.json({ limit: '1mb' }))
app.use(express.static(__dirname + '/public'))
/** |
c78023ffd19f78cc9b753bcda96623323008ca08 | index.js | index.js | 'use strict';
var rework = require('broccoli-rework');
module.exports = {
name: 'ember-cli-rework',
included: function(app) {
this.app = app;
this.plugins = this.app.options.reworkPlugins;
},
postprocessTree: function(type, tree) {
if (type === 'all' || type === 'styles') {
tree = autoprefixer(tree, { use:function(css) {
this.plugins.forEach(function(plugin) {
css.use(plugin);
});
}});
}
}
};
| 'use strict';
var rework = require('broccoli-rework');
module.exports = {
name: 'ember-cli-rework',
included: function(app) {
this.app = app;
this.plugins = this.app.options.reworkPlugins;
},
postprocessTree: function(type, tree) {
if (type === 'all' || type === 'styles') {
tree = rework(tree, { use:function(css) {
this.plugins.forEach(function(plugin) {
css.use(plugin);
});
}});
}
return tree;
}
};
| Return the tree after postprocess | Return the tree after postprocess
| JavaScript | mit | johnotander/ember-cli-rework,johnotander/ember-cli-rework | ---
+++
@@ -12,11 +12,13 @@
postprocessTree: function(type, tree) {
if (type === 'all' || type === 'styles') {
- tree = autoprefixer(tree, { use:function(css) {
+ tree = rework(tree, { use:function(css) {
this.plugins.forEach(function(plugin) {
css.use(plugin);
});
}});
}
+
+ return tree;
}
}; |
e6b264d0e331489d7f713bc2e821ccc3c624158f | index.js | index.js | /*jslint node: true*/
function getCookie(req, cookieName) {
var cookies = {},
output;
if (req.headers.cookie) {
req.headers.cookie.split(';').forEach(function (cookie) {
var parts = cookie.split('=');
cookies[parts[0].trim()] = parts[1].trim();
});
output = cookies[cookieName];
}
return output;
}
function setCookie(res, cookie, val, expdays) {
var cookieVal = cookie + '=' + val,
expdate;
if (expdays) {
expdays = parseInt(expdays, 10);
if (!isNaN(expdays)) {
expdate = new Date();
expdate.setDate(expdate.getDate() + expdays);
cookieVal += '; expires=' + expdate.toUTCString();
}
}
res.setHeader('Set-Cookie', cookieVal);
}
function delCookie(res, cookie) {
setCookie(res, cookie, "", -1);
}
exports.getCookie = getCookie;
exports.setCookie = setCookie;
exports.delCookie = delCookie;
| /*jslint node: true*/
function getCookie(req, cookieName) {
var cookies = {},
cn,
output;
if (req.headers.cookie) {
req.headers.cookie.split(';').forEach(function (cookie) {
var parts = cookie.split('=');
if (parts.length > 1) {
cn = parts[0].trim();
cookies[cn] = parts[1].trim();
}
/* else { */
/* it may be secure, or http only */
/*
switch (parts[0].trim()) {
case 'HttpOnly':
httpOnly = true;
break;
case 'Secure':
secure = true;
break;
}
}*/
});
output = cookies[cookieName];
}
return output;
}
function setCookie(res, cookie, val, expdays, domain, secure, httpOnly) {
var cookieVal = cookie + '=' + val,
expdate,
cookies;
if (expdays) {
expdays = parseInt(expdays, 10);
if (!isNaN(expdays)) {
expdate = new Date();
expdate.setDate(expdate.getDate() + expdays);
cookieVal += '; expires=' + expdate.toUTCString();
}
}
if (domain) {
cookieVal += '; Domain=' + domain;
}
if (secure) {
cookieVal += '; Secure';
}
if (httpOnly) {
cookieVal += '; HttpOnly';
}
if (res.getHeader('Set-Cookie')) {
// current cookies must be kept
cookies = res.getHeader('Set-Cookie');
if (typeof cookies === 'string') {
cookies = [cookies];
}
cookies.push(cookieVal);
cookieVal = cookies;
}
res.setHeader('Set-Cookie', cookieVal);
}
function delCookie(res, cookie, domain, secure, httpOnly) {
setCookie(res, cookie, "", -1, domain, secure, httpOnly);
}
exports.getCookie = getCookie;
exports.setCookie = setCookie;
exports.delCookie = delCookie;
| Handle domain, secure and httpOnly flags | Handle domain, secure and httpOnly flags
| JavaScript | mit | Ajnasz/ajncookie | ---
+++
@@ -1,20 +1,37 @@
/*jslint node: true*/
function getCookie(req, cookieName) {
var cookies = {},
+ cn,
output;
if (req.headers.cookie) {
req.headers.cookie.split(';').forEach(function (cookie) {
var parts = cookie.split('=');
- cookies[parts[0].trim()] = parts[1].trim();
+ if (parts.length > 1) {
+ cn = parts[0].trim();
+ cookies[cn] = parts[1].trim();
+ }
+ /* else { */
+ /* it may be secure, or http only */
+ /*
+ switch (parts[0].trim()) {
+ case 'HttpOnly':
+ httpOnly = true;
+ break;
+ case 'Secure':
+ secure = true;
+ break;
+ }
+ }*/
});
output = cookies[cookieName];
}
return output;
}
-function setCookie(res, cookie, val, expdays) {
+function setCookie(res, cookie, val, expdays, domain, secure, httpOnly) {
var cookieVal = cookie + '=' + val,
- expdate;
+ expdate,
+ cookies;
if (expdays) {
expdays = parseInt(expdays, 10);
@@ -25,11 +42,33 @@
}
}
+ if (domain) {
+ cookieVal += '; Domain=' + domain;
+ }
+
+ if (secure) {
+ cookieVal += '; Secure';
+ }
+
+ if (httpOnly) {
+ cookieVal += '; HttpOnly';
+ }
+
+ if (res.getHeader('Set-Cookie')) {
+ // current cookies must be kept
+ cookies = res.getHeader('Set-Cookie');
+ if (typeof cookies === 'string') {
+ cookies = [cookies];
+ }
+ cookies.push(cookieVal);
+ cookieVal = cookies;
+ }
+
res.setHeader('Set-Cookie', cookieVal);
}
-function delCookie(res, cookie) {
- setCookie(res, cookie, "", -1);
+function delCookie(res, cookie, domain, secure, httpOnly) {
+ setCookie(res, cookie, "", -1, domain, secure, httpOnly);
}
exports.getCookie = getCookie; |
8c181f8385742ead72b4ebce3bdfd14786756162 | index.js | index.js | 'use strict';
const crypto = require('crypto');
// User ARN: arn:aws:iam::561178107736:user/prx-upload
// Access Key ID: AKIAJZ5C7KQPL34SQ63Q
const key = process.env.ACCESS_KEY;
exports.handler = (event, context, callback) => {
try {
if (!event.queryStringParameters || !event.queryStringParameters.to_sign) {
callback(null, { statusCode: 400, headers: {}, body: null });
} else {
const toSign = event.queryStringParameters.to_sign;
const signature = crypto.createHmac('sha1', key).update(toSign).digest('base64');
callback(null, {
statusCode: 200,
headers: {
'Content-Type': 'text/plain'
},
body: signature
});
}
} catch (e) {
callback(e);
}
};
| 'use strict';
const crypto = require('crypto');
// User ARN: arn:aws:iam::561178107736:user/prx-upload
// Access Key ID: AKIAJZ5C7KQPL34SQ63Q
const key = process.env.ACCESS_KEY;
exports.handler = (event, context, callback) => {
try {
if (!event.queryStringParameters || !event.queryStringParameters.to_sign) {
callback(null, { statusCode: 400, headers: {}, body: null });
} else {
const toSign = event.queryStringParameters.to_sign;
const signature = crypto.createHmac('sha1', key).update(toSign).digest('base64');
callback(null, {
statusCode: 200,
headers: {
'Content-Type': 'text/plain',
'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token',
'Access-Control-Allow-Methods': 'GET,OPTIONS',
'Access-Control-Allow-Origin': '*'
},
body: signature
});
}
} catch (e) {
callback(e);
}
};
| Add CORS headers to GET response | Add CORS headers to GET response
| JavaScript | agpl-3.0 | PRX/upload.prx.org,PRX/upload.prx.org | ---
+++
@@ -16,7 +16,10 @@
callback(null, {
statusCode: 200,
headers: {
- 'Content-Type': 'text/plain'
+ 'Content-Type': 'text/plain',
+ 'Access-Control-Allow-Headers': 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token',
+ 'Access-Control-Allow-Methods': 'GET,OPTIONS',
+ 'Access-Control-Allow-Origin': '*'
},
body: signature
}); |
dc5cf611c89c6bb4f9466f1afe0b0f81bd65ddf9 | src/resolve.js | src/resolve.js | function resolve({
columns,
method = () => rowData => rowData,
indexKey = '_index'
}) {
if (!columns) {
throw new Error('resolve - Missing columns!');
}
return (rows = []) => {
const methodsByColumnIndex = columns.map(column => method({ column }));
return rows.map((rowData, rowIndex) => {
let ret = {};
columns.forEach((column, columnIndex) => {
const result = methodsByColumnIndex[columnIndex](rowData);
delete result.undefined;
ret = {
[indexKey]: rowIndex,
...rowData,
...ret,
...result
};
});
return ret;
});
};
}
export default resolve;
| function resolve({
columns,
method = () => rowData => rowData,
indexKey = '_index'
}) {
if (!columns) {
throw new Error('resolve - Missing columns!');
}
return (rows = []) => {
const methodsByColumnIndex = columns.map(column => method({ column }));
return rows.map((rowData, rowIndex) => {
let ret = {
[indexKey]: rowIndex,
...rowData
};
columns.forEach((column, columnIndex) => {
const result = methodsByColumnIndex[columnIndex](rowData);
delete result.undefined;
ret = {
...ret,
...result
};
});
return ret;
});
};
}
export default resolve;
| Set indexKey once per row, not per column. | Set indexKey once per row, not per column.
The performance improvement depends on the number of columns, but on a
real data set of 5000 rows and 11 resolved columns this improves
performance by 8.7%.
This does not change the result since the order of keys in the spread is
unchanged.
| JavaScript | mit | reactabular/table-resolver | ---
+++
@@ -11,7 +11,10 @@
const methodsByColumnIndex = columns.map(column => method({ column }));
return rows.map((rowData, rowIndex) => {
- let ret = {};
+ let ret = {
+ [indexKey]: rowIndex,
+ ...rowData
+ };
columns.forEach((column, columnIndex) => {
const result = methodsByColumnIndex[columnIndex](rowData);
@@ -19,8 +22,6 @@
delete result.undefined;
ret = {
- [indexKey]: rowIndex,
- ...rowData,
...ret,
...result
}; |
90fc4c61301c9fd6270821e3b4af6150e8006bec | src/middleware/auth/processJWTIfExists.js | src/middleware/auth/processJWTIfExists.js | const
nJwt = require('njwt'),
config = require('config.js'),
errors = require('feathers-errors');
function processJWTIfExists (req, res, next) {
req.feathers = req.feathers || {};
let token = req.headers['authorization'];
if (token == null) {
let cookies = req.cookies;
token = cookies.idToken;
}
if (token == null) {
next();
return;
}
try {
const verifiedJwt = nJwt.verify(token, config.jwtSigningKey);
req.feathers.userId = verifiedJwt.body.sub;
} catch(e) {
next();
return;
}
next();
}
module.exports = {
processJWTIfExists
};
| const
nJwt = require('njwt'),
config = require('config.js'),
errors = require('feathers-errors');
function processJWTIfExists (req, res, next) {
req.feathers = req.feathers || {};
let token = req.headers['authorization'];
console.log('line-1 ', token);
if (token == null) {
let cookies = req.cookies;
token = cookies.idToken;
}
console.log('line-2', token);
if (token == null) {
next();
return;
}
console.log('line-3 ', token);
try {
console.log('config', config);
const verifiedJwt = nJwt.verify(token, config.jwtSigningKey);
req.feathers.userId = verifiedJwt.body.sub;
} catch(e) {
console.log(token);
console.log(e);
next();
return;
}
next();
}
module.exports = {
processJWTIfExists
};
| Add temporary console logs to help track down an auth bug sometimes found in mobile iOS Safari | Add temporary console logs to help track down an auth bug sometimes found in mobile iOS Safari
| JavaScript | agpl-3.0 | podverse/podverse-web,podverse/podverse-web,podverse/podverse-web,podverse/podverse-web | ---
+++
@@ -11,20 +11,29 @@
let token = req.headers['authorization'];
+ console.log('line-1 ', token);
+
if (token == null) {
let cookies = req.cookies;
token = cookies.idToken;
}
+
+ console.log('line-2', token);
if (token == null) {
next();
return;
}
+ console.log('line-3 ', token);
+
try {
+ console.log('config', config);
const verifiedJwt = nJwt.verify(token, config.jwtSigningKey);
req.feathers.userId = verifiedJwt.body.sub;
} catch(e) {
+ console.log(token);
+ console.log(e);
next();
return;
} |
3cec9422a0bdfccd16f22fa1424a1bdc5a644a30 | src/util/validators.js | src/util/validators.js | import validator from 'validator'
import Player from '../models/player'
const isValidIdForPlatform = (input, platform) => {
const platformId = Player.getPlatformIdFromString(platform)
return platformId !== -1 &&
((platformId === 0 && isValidSteamId(input)) ||
(platformId === 1 && isValidPSNId(input)) ||
(platformId === 2 && isValidXboxId(input)))
}
const isValidPlatform = (input) => Player.getPlatformIdFromString(input) !== -1
const isValidSteamId = (input) => validator.isNumeric(input) && input.length === 17
const isValidPSNId = (input) =>
validator.isAlpha(input[0])
&& input.length >= 3 && input.length <= 16
&& validator.isAlphanumeric(validator.blacklist(input, '_-'))
const isValidXboxId = (input) =>
validator.isAlphanumeric(input.trim()) && input.length >= 3 && input.length <= 15
const isValidName = (input) =>
validator.isLength(input, { min: 1, max: 30 })
export default { isValidIdForPlatform, isValidPlatform, isValidSteamId, isValidXboxId, isValidPSNId, isValidName }
| import validator from 'validator'
import Player from '../models/player'
const isValidIdForPlatform = (input, platform) => {
const platformId = Player.getPlatformIdFromString(platform)
return platformId !== -1 &&
((platformId === 0 && isValidSteamId(input)) ||
(platformId === 1 && isValidPSNId(input)) ||
(platformId === 2 && isValidXboxId(input)))
}
const isValidPlatform = (input) => Player.getPlatformIdFromString(input) !== -1
const isValidSteamId = (input) => validator.isNumeric(input) && input.length === 17
const isValidPSNId = (input) =>
validator.isAlpha(input[0])
&& input.length >= 3 && input.length <= 16
&& validator.isAlphanumeric(validator.blacklist(input, '_-'))
const isValidXboxId = (input) =>
validator.isAlphanumeric(input.trim()) && input.length >= 3 && input.length <= 15
const isValidName = (input) =>
validator.isLength(input, { min: 2, max: 32 })
export default { isValidIdForPlatform, isValidPlatform, isValidSteamId, isValidXboxId, isValidPSNId, isValidName }
| Update name validation to meet steam criteria: 2 <= length <= 32 | Update name validation to meet steam criteria: 2 <= length <= 32
| JavaScript | mit | hugogrochau/SAM-rank-api | ---
+++
@@ -22,6 +22,6 @@
validator.isAlphanumeric(input.trim()) && input.length >= 3 && input.length <= 15
const isValidName = (input) =>
-validator.isLength(input, { min: 1, max: 30 })
+validator.isLength(input, { min: 2, max: 32 })
export default { isValidIdForPlatform, isValidPlatform, isValidSteamId, isValidXboxId, isValidPSNId, isValidName } |
5970b784543cfedc8aa09dd405ab79d50e327bdb | index.js | index.js | 'use strict';
var commentMarker = require('mdast-comment-marker');
module.exports = commentconfig;
/* Modify `processor` to read configuration from comments. */
function commentconfig() {
var Parser = this.Parser;
var Compiler = this.Compiler;
var block = Parser && Parser.prototype.blockTokenizers;
var inline = Parser && Parser.prototype.inlineTokenizers;
var compiler = Compiler && Compiler.prototype.visitors;
if (block && block.html) {
block.html = factory(block.html);
}
if (inline && inline.html) {
inline.html = factory(inline.html);
}
if (compiler && compiler.html) {
compiler.html = factory(compiler.html);
}
}
/* 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 = commentMarker(result && result.type ? result : node);
if (marker && marker.name === 'remark') {
try {
self.setOptions(marker.parameters);
} catch (err) {
self.file.fail(err.message, marker.node);
}
}
return result;
}
}
| 'use strict';
var commentMarker = require('mdast-comment-marker');
module.exports = commentconfig;
/* Modify `processor` to read configuration from comments. */
function commentconfig() {
var proto = this.Parser && this.Parser.prototype;
var Compiler = this.Compiler;
var block = proto && proto.blockTokenizers;
var inline = proto && proto.inlineTokenizers;
var compiler = Compiler && Compiler.prototype && Compiler.prototype.visitors;
if (block && block.html) {
block.html = factory(block.html);
}
if (inline && inline.html) {
inline.html = factory(inline.html);
}
if (compiler && compiler.html) {
compiler.html = factory(compiler.html);
}
}
/* 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 = commentMarker(result && result.type ? result : node);
if (marker && marker.name === 'remark') {
try {
self.setOptions(marker.parameters);
} catch (err) {
self.file.fail(err.message, marker.node);
}
}
return result;
}
}
| Fix for non-remark parsers or compilers | Fix for non-remark parsers or compilers
| JavaScript | mit | wooorm/mdast-comment-config,wooorm/remark-comment-config | ---
+++
@@ -6,11 +6,11 @@
/* Modify `processor` to read configuration from comments. */
function commentconfig() {
- var Parser = this.Parser;
+ var proto = this.Parser && this.Parser.prototype;
var Compiler = this.Compiler;
- var block = Parser && Parser.prototype.blockTokenizers;
- var inline = Parser && Parser.prototype.inlineTokenizers;
- var compiler = Compiler && Compiler.prototype.visitors;
+ var block = proto && proto.blockTokenizers;
+ var inline = proto && proto.inlineTokenizers;
+ var compiler = Compiler && Compiler.prototype && Compiler.prototype.visitors;
if (block && block.html) {
block.html = factory(block.html); |
4ae6c11508a002c4adcf23f20af5e7c8f1eb7dc3 | index.js | index.js | // Constructor
var RegExpParser = module.exports = {};
/**
* parse
* Parses a string input
*
* @name parse
* @function
* @param {String} input the string input that should be parsed as regular
* expression
* @return {RegExp} The parsed regular expression
*/
RegExpParser.parse = function (input) {
// Validate input
if (typeof input !== "string") {
throw new Error("Invalid input. Input must be a string");
}
// e.g. "/something/gi"
if (input[0] === "/") {
// TODO This will fail for: e.g.: "/some/thing/gi"
var splits = input.split("/");
return new RegExp(splits[1], splits[2]);
}
return new RegExp(input);
};
| // Constructor
var RegExpParser = module.exports = {};
/**
* parse
* Parses a string input
*
* @name parse
* @function
* @param {String} input the string input that should be parsed as regular
* expression
* @return {RegExp} The parsed regular expression
*/
RegExpParser.parse = function(input) {
// Validate input
if (typeof input !== "string") {
throw new Error("Invalid input. Input must be a string");
}
var m = input.match(/(\/?)(.+)\1([a-z]*)/i);
return new RegExp(m[2], m[3]);
};
| Use a regular expression to parse regular expressions :smile: | Use a regular expression to parse regular expressions :smile:
| JavaScript | mit | IonicaBizau/regex-parser.js | ---
+++
@@ -11,19 +11,14 @@
* expression
* @return {RegExp} The parsed regular expression
*/
-RegExpParser.parse = function (input) {
+RegExpParser.parse = function(input) {
// Validate input
if (typeof input !== "string") {
throw new Error("Invalid input. Input must be a string");
}
- // e.g. "/something/gi"
- if (input[0] === "/") {
- // TODO This will fail for: e.g.: "/some/thing/gi"
- var splits = input.split("/");
- return new RegExp(splits[1], splits[2]);
- }
+ var m = input.match(/(\/?)(.+)\1([a-z]*)/i);
- return new RegExp(input);
+ return new RegExp(m[2], m[3]);
}; |
fee5fbe024705c8b2409b1c207f40d7bb3bc1fbe | src/js/graph/modules/focuser.js | src/js/graph/modules/focuser.js | webvowl.modules.focuser = function () {
var focuser = {},
focusedElement;
focuser.handle = function (clickedElement) {
if (focusedElement !== undefined) {
focusedElement.toggleFocus();
}
if (focusedElement !== clickedElement) {
clickedElement.toggleFocus();
focusedElement = clickedElement;
} else {
focusedElement = undefined;
}
};
return focuser;
}; | webvowl.modules.focuser = function () {
var focuser = {},
focusedElement;
focuser.handle = function (clickedElement) {
if (d3.event.defaultPrevented) {
return;
}
if (focusedElement !== undefined) {
focusedElement.toggleFocus();
}
if (focusedElement !== clickedElement) {
clickedElement.toggleFocus();
focusedElement = clickedElement;
} else {
focusedElement = undefined;
}
};
return focuser;
}; | Disable focusing on after dragging a node | Disable focusing on after dragging a node | JavaScript | mit | leshek-pawlak/WebVOWL,leshek-pawlak/WebVOWL,MissLoveWu/webvowl,VisualDataWeb/WebVOWL,VisualDataWeb/WebVOWL,MissLoveWu/webvowl | ---
+++
@@ -3,6 +3,10 @@
focusedElement;
focuser.handle = function (clickedElement) {
+ if (d3.event.defaultPrevented) {
+ return;
+ }
+
if (focusedElement !== undefined) {
focusedElement.toggleFocus();
} |
f0396b7679f471738e47b434543604b0ada00462 | index.js | index.js | var _ = require('lodash');
var map = require('map-stream');
var pp = require('preprocess');
var path = require('path');
module.exports = function (options) {
var opts = _.merge({}, options);
var context = _.merge({}, process.env, opts.context);
function ppStream(file, callback) {
var contents, extension;
// TODO: support streaming files
if (file.isNull()) return callback(null, file); // pass along
if (file.isStream()) return callback(new Error("gulp-preprocess: Streaming not supported"));
context.src = file.path;
context.srcDir = opts.includeBase || path.dirname(file.path);
context.NODE_ENV = context.NODE_ENV || 'development';
extension = _.isEmpty(opts.extension) ? getExtension(context.src) : opts.extension;
contents = file.contents.toString('utf8');
contents = pp.preprocess(contents, context, extension);
file.contents = new Buffer(contents);
callback(null, file);
}
return map(ppStream);
};
function getExtension(filename) {
var ext = path.extname(filename||'').split('.');
return ext[ext.length - 1];
}
| var _ = require('lodash');
var map = require('map-stream');
var pp = require('preprocess');
var path = require('path');
module.exports = function (context, options) {
function ppStream(file, callback) {
var contents, extension;
// TODO: support streaming files
if (file.isNull()) return callback(null, file); // pass along
if (file.isStream()) return callback(new Error("gulp-preprocess: Streaming not supported"));
context.NODE_ENV = context.NODE_ENV || 'development';
contents = file.contents.toString('utf8');
contents = pp.preprocess(contents, context, options);
file.contents = new Buffer(contents);
callback(null, file);
}
return map(ppStream);
};
| Upgrade to new preprocess API | Upgrade to new preprocess API
| JavaScript | mit | yesmeck/gulp-preprocess,patlux/gulp-preprocess,patlux/gulp-preprocess,yesmeck/gulp-preprocess | ---
+++
@@ -3,10 +3,7 @@
var pp = require('preprocess');
var path = require('path');
-module.exports = function (options) {
- var opts = _.merge({}, options);
- var context = _.merge({}, process.env, opts.context);
-
+module.exports = function (context, options) {
function ppStream(file, callback) {
var contents, extension;
@@ -14,14 +11,9 @@
if (file.isNull()) return callback(null, file); // pass along
if (file.isStream()) return callback(new Error("gulp-preprocess: Streaming not supported"));
- context.src = file.path;
- context.srcDir = opts.includeBase || path.dirname(file.path);
context.NODE_ENV = context.NODE_ENV || 'development';
-
- extension = _.isEmpty(opts.extension) ? getExtension(context.src) : opts.extension;
-
contents = file.contents.toString('utf8');
- contents = pp.preprocess(contents, context, extension);
+ contents = pp.preprocess(contents, context, options);
file.contents = new Buffer(contents);
callback(null, file);
@@ -29,8 +21,3 @@
return map(ppStream);
};
-
-function getExtension(filename) {
- var ext = path.extname(filename||'').split('.');
- return ext[ext.length - 1];
-} |
8d60c1b35b9b946915b67e9fa88107bdb22e13da | karma.conf.js | karma.conf.js | module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai-jquery', 'jquery-2.1.0', 'chai', 'sinon-chai', 'fixture'],
files: [
'public/javascripts/vendor/d3.v3.min.js',
'public/javascripts/vendor/raphael-min.js',
'public/javascripts/vendor/morris.min.js',
'public/javascripts/helpers/helper.js',
'public/javascripts/traffic.js',
'public/javascripts/sparkline.js',
'tests/**/*Spec.js',
'tests/fixtures/**/*'
],
exclude: [
'**/*.swp'
],
preprocessors: {
'public/javascripts/*.js': ['coverage'],
'tests/**/*.json' : ['json_fixtures']
},
jsonFixturesPreprocessor: {
variableName: '__json__'
},
reporters: ['progress', 'coverage', 'coveralls'],
coverageReporter: {
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'lcov-report' },
],
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false
});
};
| module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai-jquery', 'jquery-2.1.0', 'chai', 'sinon-chai', 'fixture'],
files: [
'public/javascripts/vendor/d3.v3.min.js',
'public/javascripts/vendor/raphael-min.js',
'public/javascripts/vendor/morris.min.js',
'public/javascripts/helpers/helper.js',
'public/javascripts/traffic.js',
'tests/**/*Spec.js',
'tests/fixtures/**/*'
],
exclude: [
'**/*.swp'
],
preprocessors: {
'public/javascripts/*.js': ['coverage'],
'tests/**/*.json' : ['json_fixtures']
},
jsonFixturesPreprocessor: {
variableName: '__json__'
},
reporters: ['progress', 'coverage', 'coveralls'],
coverageReporter: {
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'lcov-report' },
],
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false
});
};
| Remove sparkline from spec (not needed anymore) | Remove sparkline from spec (not needed anymore)
| JavaScript | mit | codeforamerica/city-analytics-dashboard,codeforamerica/city-analytics-dashboard,codeforamerica/city-analytics-dashboard | ---
+++
@@ -8,7 +8,6 @@
'public/javascripts/vendor/morris.min.js',
'public/javascripts/helpers/helper.js',
'public/javascripts/traffic.js',
- 'public/javascripts/sparkline.js',
'tests/**/*Spec.js',
'tests/fixtures/**/*'
], |
53d55efbe820f9e4e8469992e2b2f193bd4de345 | src/write-to-server.js | src/write-to-server.js | 'use strict';
var env = require('./env.json');
function httpPost(req, cb) {
var https = req.deps.https;
console.log('env:', env);
var postData = JSON.stringify({
metadata: req.data.s3Object.Metadata,
sizes: req.data.sizes
});
var options = {
hostname: 'plaaant.com',
port: 443,
path: '/api/image-complete?token=' + env.PLANT_IMAGE_COMPLETE,
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData)
}
};
console.log('About to PUT to server...');
var request = https.request(options, function() {});
request.write(postData);
request.end();
console.log('Completed PUT to server...');
cb(null, req);
}
module.exports = {
httpPost: httpPost
};
| 'use strict';
var env = require('./env.json');
function httpPost(req, cb) {
var https = req.deps.https;
console.log('env:', env);
var postData = JSON.stringify({
metadata: req.data.s3Object.Metadata,
sizes: req.data.sizes
});
var options = {
hostname: 'plaaant.com',
port: 443,
path: '/api/image-complete?token=' + env.PLANT_IMAGE_COMPLETE,
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData)
}
};
console.log('About to PUT to server...');
var request = https.request(options, function(res) {
console.log('response from https.request:', res);
});
request.write(postData);
request.end();
req.on('error', function(e) {
console.error('Error in https.request:', e);
});
console.log('Completed PUT to server...');
cb(null, req);
}
module.exports = {
httpPost: httpPost
};
| Add some logging to https.request | Add some logging to https.request
| JavaScript | mit | guyellis/plant-image-lambda,guyellis/plant-image-lambda | ---
+++
@@ -23,9 +23,16 @@
};
console.log('About to PUT to server...');
- var request = https.request(options, function() {});
+ var request = https.request(options, function(res) {
+ console.log('response from https.request:', res);
+ });
request.write(postData);
request.end();
+
+ req.on('error', function(e) {
+ console.error('Error in https.request:', e);
+ });
+
console.log('Completed PUT to server...');
cb(null, req); |
831714e2bf0c396c0adcb0fe069f4d998e340889 | index.js | index.js | /**
* index.js
* Client entry point.
*
* @author Francis Brito <fr.br94@gmail.com>
* @license MIT
*/
'use strict';
/**
* Client
* Provides methods to access PrintHouse's API.
*
* @param {String} apiKey API key identifying account owner.
* @param {Object} opts Contains options to be passed to the client
*/
var Client = function Client(apiKey, opts) {
if (!apiKey) {
throw new Error('No API key provided.');
}
};
module.exports = {
Client: Client
};
| /**
* index.js
* Client entry point.
*
* @author Francis Brito <fr.br94@gmail.com>
* @license MIT
*/
'use strict';
/**
* Client
* Provides methods to access PrintHouse's API.
*
* @param {String} apiKey API key identifying account owner.
* @param {Object} opts Contains options to be passed to the client
*/
var Client = function Client(apiKey, opts) {
if (!apiKey) {
throw new Error('No API key provided.');
}
};
/**
* Default API endpoint.
* Used if no API endpoint is passed in opts parameter when constructing a client.
*
* @type {String}
*/
Client.DEFAULT_API_URL = 'http://printhouse.io/api';
module.exports = {
Client: Client
};
| Add default API URL for client. | Add default API URL for client.
| JavaScript | mit | francisbrito/ph-node | ---
+++
@@ -20,6 +20,14 @@
}
};
+/**
+ * Default API endpoint.
+ * Used if no API endpoint is passed in opts parameter when constructing a client.
+ *
+ * @type {String}
+ */
+Client.DEFAULT_API_URL = 'http://printhouse.io/api';
+
module.exports = {
Client: Client
}; |
4e543c02c682320aa46e4a90fa8fd4183e6b2588 | index.js | index.js | module.exports = function() {
let subscribers = [], self
return self = {
// remove all subscribers
clear: (eventName) => {
subscribers = eventName != null
? subscribers.filter(subscriber => subscriber.eventName !== eventName)
: []
return self // return self to support chaining
},
// remove a subscriber
off: (eventName, callback) => {
const index = subscribers.findIndex(subscriber => subscriber.eventName === eventName && subscriber.callback === callback)
if (index >= 0) {
subscribers.splice(index, 1)
}
return self
},
// subscribe to an event
on: (eventName, callback) => {
subscribers.push({ eventName, callback })
return self
},
// trigger an event; all subscribers will be called
trigger: (eventName, data) => {
subscribers
.filter(subscriber => subscriber.eventName === eventName)
.forEach(subscriber => subscriber.callback(data))
return self
}
}
}
| module.exports = function() {
let subscribers = [], self
return self = {
// remove all subscribers
clear: (eventName) => {
subscribers = eventName != null
? subscribers.filter(subscriber => subscriber.eventName !== eventName)
: []
return self // return self to support chaining
},
// remove a subscriber
off: (eventName, callback) => {
const index = subscribers.findIndex(subscriber => subscriber.eventName === eventName && subscriber.callback === callback)
if (index >= 0) {
subscribers.splice(index, 1)
}
return self
},
// subscribe to an event
on: (eventName, callback) => {
subscribers.push({ eventName, callback })
return self
},
// trigger an event; all subscribers will be called
trigger: (eventName, data) => {
subscribers
.filter(subscriber => subscriber.eventName === eventName)
.forEach(subscriber => subscriber.callback(data))
return self
}
}
}
| Fix trigger not returning itself, but undefined | Fix trigger not returning itself, but undefined
`Array.prototype.forEach` returns `undefined`
| JavaScript | isc | metaraine/emitter20 | ---
+++
@@ -34,5 +34,6 @@
.forEach(subscriber => subscriber.callback(data))
return self
}
+
}
} |
8924f0f00493b836e81c09db2e161bf70a5fda48 | index.js | index.js | var VOWELS = /[aeiou]/gi;
var VOWELS_AND_SPACE = /[aeiou\s]/g;
exports.parse = function parse(string, join){
if(typeof string !== 'string'){
throw new TypeError('Expected a string as the first option');
}
var replacer = VOWELS;
if (join) {
replacer = VOWELS_AND_SPACE;
}
return string.replace(replacer, '');
};
| var VOWELS = /[aeiou]/gi;
var VOWELS_AND_SPACE = /[aeiou\s]/g;
exports.parse = function parse(string, join){
if(typeof string !== 'string'){
throw new TypeError('Expected a string as the first option');
}
return string.replace(join ? VOWELS_AND_SPACE : VOWELS, '');
};
| Move to more functional, expression-based conditionals | Move to more functional, expression-based conditionals
| JavaScript | mit | lestoni/unvowel | ---
+++
@@ -6,10 +6,5 @@
throw new TypeError('Expected a string as the first option');
}
- var replacer = VOWELS;
- if (join) {
- replacer = VOWELS_AND_SPACE;
- }
-
- return string.replace(replacer, '');
+ return string.replace(join ? VOWELS_AND_SPACE : VOWELS, '');
}; |
3ca40e5d48afa58abeb523ebf9e35b7c0e7c27a2 | index.js | index.js | var express = require('express');
var app = express();
var image_utils = require('./image_utils.js');
app.set('port', (process.env.PORT || 5001));
/*
Search latest images search
*/
app.get("/api/latest/imagesearch", function(req, res)
{
res.end("api/latest/imagesearch/");
});
app.get("/api/imagesearch/:searchQuery/:offset", function(req, res) {
var searchQuery = req.params.searchQuery;
var offset = req.params.offset;
image_utils.searchImage(searchQuery,offset,function (data){
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(data));
});
});
app.get("/", function(req, res) {
res.redirect(307,'/api/latest/imagesearch');
});
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
}); | var express = require('express');
var app = express();
var image_utils = require('./image_utils.js');
app.set('port', (process.env.PORT || 5001));
/*
Search latest images search
*/
app.get("/api/latest/imagesearch", function(req, res)
{
res.end("api/latest/imagesearch/");
});
app.get("/api/imagesearch/:searchQuery/:offset", function(req, res) {
var searchQuery = req.params.searchQuery;
var offset = req.params.offset;
image_utils.searchImage(searchQuery,offset,function (data){
console.log(data);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(data));
});
});
app.get("/", function(req, res) {
res.redirect(307,'/api/latest/imagesearch');
});
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
}); | Test google api on server | Test google api on server
| JavaScript | mit | diegoingaramo/img-search-al | ---
+++
@@ -18,7 +18,7 @@
var offset = req.params.offset;
image_utils.searchImage(searchQuery,offset,function (data){
-
+ console.log(data);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(data));
|
63a5bc853e2073ee7fecb3699d69ab6e6d19e5ad | index.js | index.js | 'use strict';
// Global init
global.Promise = require('babel-runtime/core-js/promise').default = require('bluebird');
// Exports
module.exports = require('./dist/index').default; | 'use strict';
// Global init
global.Promise = require('babel-runtime/core-js/promise').default = require('bluebird');
// Exports
module.exports = require('./dist/index').default; // eslint-disable-line import/no-unresolved | Fix failed linting during npm test on a clean directory | Fix failed linting during npm test on a clean directory
| JavaScript | mit | komapijs/komapi,komapijs/komapi | ---
+++
@@ -4,4 +4,4 @@
global.Promise = require('babel-runtime/core-js/promise').default = require('bluebird');
// Exports
-module.exports = require('./dist/index').default;
+module.exports = require('./dist/index').default; // eslint-disable-line import/no-unresolved |
e53519bbbbf593e9ec5e9ac2ce6386f12760020f | index.js | index.js | 'use strict';
var fileType = require('file-type');
var through = require('through2');
var uuid = require('uuid');
var Vinyl = require('vinyl');
module.exports.file = function (buf, name) {
var ext = fileType(buf) ? fileType(buf).ext : null;
return new Vinyl({
contents: buf,
path: (name || uuid.v4()) + (ext || '')
});
};
module.exports.stream = function (buf, name) {
var stream = through.obj();
stream.end(module.exports.file(buf, name));
return stream;
};
| 'use strict';
var fileType = require('file-type');
var through = require('through2');
var uuid = require('uuid');
var Vinyl = require('vinyl');
module.exports.file = function (buf, name) {
var ext = fileType(buf) ? '.' + fileType(buf).ext : null;
return new Vinyl({
contents: buf,
path: (name || uuid.v4()) + (ext || '')
});
};
module.exports.stream = function (buf, name) {
var stream = through.obj();
stream.end(module.exports.file(buf, name));
return stream;
};
| Fix missing dot before extension. | Fix missing dot before extension.
| JavaScript | mit | kevva/buffer-to-vinyl | ---
+++
@@ -6,7 +6,7 @@
var Vinyl = require('vinyl');
module.exports.file = function (buf, name) {
- var ext = fileType(buf) ? fileType(buf).ext : null;
+ var ext = fileType(buf) ? '.' + fileType(buf).ext : null;
return new Vinyl({
contents: buf, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.