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 |
|---|---|---|---|---|---|---|---|---|---|---|
4e723a8b1f997595373c04af130a15e0c18a07d5 | www/js/app.js | www/js/app.js | // We use an "Immediate Function" to initialize the application to avoid leaving anything behind in the global scope
(function () {
/* ---------------------------------- Local Variables ---------------------------------- */
var service = new EmployeeService();
var homeTpl = Handlebars.compile($("#home.tpl").html());
var employeeListTpl = Handlebars.compile($("#employee-list-tpl").html());
service.initialize().done(function () {
// console.log("Service initialized");
renderHomeView();
});
/* --------------------------------- Event Registration -------------------------------- */
// $('.search-key').on('keyup', findByName);
// $('.help-btn').on('click', function() {
// alert("Employee Directory v3.4");
// });
document.addEventListener('deviceready', function () {
if (navigator.notification) { // Override default HTML alert with native dialog
window.alert = function (message) {
navigator.notification.alert(
message, // message
null, // callback
"Workshop", // title
"OK" // buttonName
);
};
}
FastClick.attach(document.body);
}, false);
/* ---------------------------------- Local Functions ---------------------------------- */
function findByName() {
service.findByName($('.search-key').val()).done(function (employees) {
var l = employees.length;
var e;
$('.employee-list').empty();
for (var i = 0; i < l; i++) {
e = employees[i];
$('.employee-list').append('<li><a href="#employees/' + e.id + '">' + e.firstName + ' ' + e.lastName + '</a></li>');
}
});
}
function renderHomeView() {
$('body').html(homeTpl());
$('.search-key').on('keyup', findByName);
}
}()); | // We use an "Immediate Function" to initialize the application to avoid leaving anything behind in the global scope
(function () {
/* ---------------------------------- Local Variables ---------------------------------- */
var service = new EmployeeService();
var homeTpl = Handlebars.compile($("#home.tpl").html());
var employeeListTpl = Handlebars.compile($("#employee-list-tpl").html());
service.initialize().done(function () {
// console.log("Service initialized");
renderHomeView();
});
/* --------------------------------- Event Registration -------------------------------- */
// $('.search-key').on('keyup', findByName);
// $('.help-btn').on('click', function() {
// alert("Employee Directory v3.4");
// });
document.addEventListener('deviceready', function () {
if (navigator.notification) { // Override default HTML alert with native dialog
window.alert = function (message) {
navigator.notification.alert(
message, // message
null, // callback
"Workshop", // title
"OK" // buttonName
);
};
}
FastClick.attach(document.body);
}, false);
/* ---------------------------------- Local Functions ---------------------------------- */
function findByName() {
service.findByName($('.search-key').val()).done(function (employees) {
$('.content').html(employeeListTpl(employees));
});
}
function renderHomeView() {
$('body').html(homeTpl());
$('.search-key').on('keyup', findByName);
}
}()); | Modify findByName() to call employeeListTpl | Modify findByName() to call employeeListTpl
| JavaScript | mit | tlkiong/cordovaTutorial,tlkiong/cordovaTutorial,tlkiong/cordovaTutorial,tlkiong/cordovaTutorial,tlkiong/cordovaTutorial | ---
+++
@@ -35,13 +35,7 @@
/* ---------------------------------- Local Functions ---------------------------------- */
function findByName() {
service.findByName($('.search-key').val()).done(function (employees) {
- var l = employees.length;
- var e;
- $('.employee-list').empty();
- for (var i = 0; i < l; i++) {
- e = employees[i];
- $('.employee-list').append('<li><a href="#employees/' + e.id + '">' + e.firstName + ' ' + e.lastName + '</a></li>');
- }
+ $('.content').html(employeeListTpl(employees));
});
}
|
6a1abab752d4cef30e8433b518648893814754f5 | icons.js | icons.js | define(function () {
icons = {};
icons.load = function (iconInfo, callback) {
if ("uri" in iconInfo) {
source = iconInfo.uri;
}
else if ("name" in iconInfo) {
source = "lib/sugar-html-graphics/icons/" + iconInfo.name + ".svg";
}
fillColor = iconInfo.fillColor;
strokeColor = iconInfo.strokeColor;
client = new XMLHttpRequest();
client.onload = function () {
var iconData = this.responseText;
var re;
if (fillColor) {
re = /(<!ENTITY fill_color ")(.*)(">)/;
iconData = iconData.replace(re, "$1" + fillColor + "$3");
}
if (strokeColor) {
re = /(<!ENTITY stroke_color ")(.*)(">)/;
iconData = iconData.replace(re, "$1" + strokeColor + "$3");
}
callback("data:image/svg+xml," + escape(iconData));
};
client.open("GET", source);
client.send();
};
return icons;
});
| define(function () {
icons = {};
icons.load = function (iconInfo, callback) {
if ("uri" in iconInfo) {
source = iconInfo.uri;
}
else if ("name" in iconInfo) {
source = "lib/sugar-html-graphics/icons/" + iconInfo.name + ".svg";
}
fillColor = iconInfo.fillColor;
strokeColor = iconInfo.strokeColor;
client = new XMLHttpRequest();
client.onload = function () {
var iconData = this.responseText;
var re;
if (fillColor) {
re = /(<!ENTITY fill_color ")(.*)(">)/;
iconData = iconData.replace(re, "$1" + fillColor + "$3");
}
if (strokeColor) {
re = /(<!ENTITY stroke_color ")(.*)(">)/;
iconData = iconData.replace(re, "$1" + strokeColor + "$3");
}
callback("data:image/svg+xml," + escape(iconData));
};
client.open("GET", source);
client.send();
};
function getBackgroundURL(elem) {
var style = elem.currentStyle || window.getComputedStyle(elem, '');
// Remove prefix 'url(' and suffix ')' before return
return style.backgroundImage.slice(4, -1);
}
function setBackgroundURL(elem, url) {
elem.style.backgroundImage = "url('" + url + "')";
}
icons.colorize = function(elem, colors) {
var iconInfo = {
"uri": getBackgroundURL(elem),
"strokeColor": colors[0],
"fillColor": colors[1]
};
icons.load(iconInfo, function (url) {
setBackgroundURL(elem, url);
});
};
return icons;
});
| Improve API to colorize an icon | Improve API to colorize an icon
Move the details to this library. Usage example:
icons.colorize(myButton, ["#FF0000", "#00FF00"]);
| JavaScript | apache-2.0 | godiard/sugar-web,sugarlabs/sugar-web | ---
+++
@@ -35,5 +35,28 @@
client.send();
};
+ function getBackgroundURL(elem) {
+ var style = elem.currentStyle || window.getComputedStyle(elem, '');
+ // Remove prefix 'url(' and suffix ')' before return
+ return style.backgroundImage.slice(4, -1);
+ }
+
+ function setBackgroundURL(elem, url) {
+ elem.style.backgroundImage = "url('" + url + "')";
+ }
+
+ icons.colorize = function(elem, colors) {
+ var iconInfo = {
+ "uri": getBackgroundURL(elem),
+ "strokeColor": colors[0],
+ "fillColor": colors[1]
+ };
+
+ icons.load(iconInfo, function (url) {
+ setBackgroundURL(elem, url);
+ });
+
+ };
+
return icons;
}); |
8b38fbec1496431c650677b426662fd708db4b12 | src/main/resources/tools/build.js | src/main/resources/tools/build.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.
*/
{
mainConfigFile: '../web/app.js',
name: "app/app-main",
out: '../../../../target/classes/web/editor/js/app-main.js',
generateSourceMaps: true,
preserveLicenseComments: false,
optimizeCss: "standard",
exclude: ['commons/lib/enjoyhint/enjoyhint.min']
} | /*
* 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.
*/
{
// appDir: '../web',
// mainConfigFile: '../web/app.js',
// dir: '../../../../target/classes/web',
// generateSourceMaps: true,
// preserveLicenseComments: false,
// optimizeCss: "standard",
// "modules": [
// {
// // module names are relative to baseUrl
// name: "../editor/js/app-main",
// exclude: [
// 'commons/lib/enjoyhint/enjoyhint.min',
// 'commons/lib/ace-editor/mode/xquery/xqlint',
// "commons/lib/ace-editor/mode/coffee/coffee",
// "commons/lib/mCustomScrollbar_v3.1.5/js/jquery.mCustomScrollbar.concat.min",
// "commons/lib/jquery-mousewheel_v3.1.13/test/browserify/bundle"
// ]
// }
// ]
mainConfigFile: '../web/app.js',
name: "app/app-main",
out: '../../../../target/classes/web/editor/js/app-main.js',
generateSourceMaps: true,
preserveLicenseComments: false,
optimizeCss: "standard",
exclude: ['commons/lib/enjoyhint/enjoyhint.min']
} | Add full project optimization in comment for testing | Add full project optimization in comment for testing
| JavaScript | apache-2.0 | wso2/carbon-analytics,wso2/carbon-analytics,wso2/carbon-analytics,wso2/carbon-analytics,wso2/carbon-analytics | ---
+++
@@ -17,6 +17,27 @@
*/
{
+
+ // appDir: '../web',
+ // mainConfigFile: '../web/app.js',
+ // dir: '../../../../target/classes/web',
+ // generateSourceMaps: true,
+ // preserveLicenseComments: false,
+ // optimizeCss: "standard",
+ // "modules": [
+ // {
+ // // module names are relative to baseUrl
+ // name: "../editor/js/app-main",
+ // exclude: [
+ // 'commons/lib/enjoyhint/enjoyhint.min',
+ // 'commons/lib/ace-editor/mode/xquery/xqlint',
+ // "commons/lib/ace-editor/mode/coffee/coffee",
+ // "commons/lib/mCustomScrollbar_v3.1.5/js/jquery.mCustomScrollbar.concat.min",
+ // "commons/lib/jquery-mousewheel_v3.1.13/test/browserify/bundle"
+ // ]
+ // }
+ // ]
+
mainConfigFile: '../web/app.js',
name: "app/app-main",
out: '../../../../target/classes/web/editor/js/app-main.js', |
562e2b130db0ee402d0203189aeef65bd0d5ff09 | index.js | index.js | window.lovelyTabMessage = (function(){
var hearts = ['β€','π','π','π','π','π','π'];
var heart = hearts[Math.floor(Math.random() * (hearts.length))];
var lang = (window && window.navigator && window.navigator.language || 'en');
switch(lang){
case 'en':
return 'Come back, i miss you. '+heart;
case 'de':
return 'Komm zurΓΌck, ich vermisse dich. '+heart;
default:
return 'Come back, i miss you. '+heart;
}
})()
window.cachedTitle = document.title;
window.onblur = function () {
document.title= window.lovelyTabMessage;
}
window.onfocus = function () {
document.title= window.cachedTitle;
} | window.lovelyTabMessage = (function(){
var stringTree = {
comeBackIMissYou: {
de: 'Komm zurΓΌck, ich vermisse dich.',
en: 'Come back, i miss you.'
}
}
// Let's see what lovely options we have to build our very romantic string
var lovelyOptions = Object.keys(stringTree);
var lovelyHearts = ['β€','π','π','π','π','π','π'];
// Shuffle the dices of love and get our string base!
var lovelyOption = lovelyOptions[Math.floor(Math.random() * (lovelyOptions.length))];
var lovelyHeart = lovelyHearts[Math.floor(Math.random() * (lovelyHearts.length))];
// Maybe we can make our users REALLY happy by using their native language?
var lang = (window && window.navigator && window.navigator.userLanguage || window.navigator.language);;
// Now let's glue our lovely string together!
return ( stringTree[lovelyOption][lang] || stringTree[lovelyOption]['en'] ) + ' ' + lovelyHeart;
})()
window.cachedTitle = document.title;
window.onblur = function () {
document.title= window.lovelyTabMessage;
}
window.onfocus = function () {
document.title= window.cachedTitle;
} | Add some more spice to those lovely messages | Add some more spice to those lovely messages
| JavaScript | mit | tarekis/tab-lover | ---
+++
@@ -1,15 +1,20 @@
window.lovelyTabMessage = (function(){
- var hearts = ['β€','π','π','π','π','π','π'];
- var heart = hearts[Math.floor(Math.random() * (hearts.length))];
- var lang = (window && window.navigator && window.navigator.language || 'en');
- switch(lang){
- case 'en':
- return 'Come back, i miss you. '+heart;
- case 'de':
- return 'Komm zurΓΌck, ich vermisse dich. '+heart;
- default:
- return 'Come back, i miss you. '+heart;
+ var stringTree = {
+ comeBackIMissYou: {
+ de: 'Komm zurΓΌck, ich vermisse dich.',
+ en: 'Come back, i miss you.'
+ }
}
+ // Let's see what lovely options we have to build our very romantic string
+ var lovelyOptions = Object.keys(stringTree);
+ var lovelyHearts = ['β€','π','π','π','π','π','π'];
+ // Shuffle the dices of love and get our string base!
+ var lovelyOption = lovelyOptions[Math.floor(Math.random() * (lovelyOptions.length))];
+ var lovelyHeart = lovelyHearts[Math.floor(Math.random() * (lovelyHearts.length))];
+ // Maybe we can make our users REALLY happy by using their native language?
+ var lang = (window && window.navigator && window.navigator.userLanguage || window.navigator.language);;
+ // Now let's glue our lovely string together!
+ return ( stringTree[lovelyOption][lang] || stringTree[lovelyOption]['en'] ) + ' ' + lovelyHeart;
})()
window.cachedTitle = document.title;
window.onblur = function () { |
ad5e2272bc1d857fdec6e14f0e8232296fc1aa38 | models/raw_feed/model.js | models/raw_feed/model.js | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var config = require('../../config.js');
this.rawFeedModel = {
timestamp: {type: Date, default: Date.now},
text: String
};
var rawFeedSchema = new Schema(this.rawFeedModel);
this.rawFeed = mongoose.model('rawFeed', rawFeedSchema); | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var config = require('../../config.js');
this.rawFeedModel = {
timestamp: {type: Date, default: Date.now},
text: String,
feedSource: {type: String, enum: ['Twitter', 'Email']}
};
var rawFeedSchema = new Schema(this.rawFeedModel);
this.rawFeed = mongoose.model('rawFeed', rawFeedSchema);
| Add data source property to raw feed object | Add data source property to raw feed object
| JavaScript | mit | NextCenturyCorporation/EVEREST | ---
+++
@@ -4,7 +4,8 @@
this.rawFeedModel = {
timestamp: {type: Date, default: Date.now},
- text: String
+ text: String,
+ feedSource: {type: String, enum: ['Twitter', 'Email']}
};
var rawFeedSchema = new Schema(this.rawFeedModel); |
e986b22d01bdb50da6145610d962bc9663a5b9e4 | index.js | index.js | var isVowel = require('is-vowel');
var khaan = module.exports = {
splitAtVowels: function ( word ) {
var output = [];
var current = '';
for ( var i = 0; i < word.length; i++ ) {
var c = word[i];
if ( isVowel( c ) ) {
if ( current !== '' ) {
output.push( current );
}
current = '';
}
current += c;
}
output.push( current );
return output;
},
elongate: function ( word, number ) {
word = word ? word : 'khan';
number = number ? number: 2;
var arr = this.splitAtVowels( word );
if ( arr.length < 2 ) {
return word;
}
var ini = arr.shift();
var med = Array( number ).join( arr[0][0] );
var fin = arr.join( '' );
return ini + med + fin;
},
khan: function ( word, number ) {
word = word ? word : 'khan';
number = number ? number : 5;
return this.elongate( word, number).toUpperCase() + '!';
}
};
| var isVowel = require('is-vowel');
var khaan = module.exports = {
splitAtVowels: function ( word ) {
var output = [];
var current = '';
for ( var i = 0; i < word.length; i++ ) {
var c = word[i];
if ( isVowel( c ) ) {
if ( current !== '' ) {
output.push( current );
}
current = '';
}
current += c;
}
output.push( current );
return output;
},
elongate: function ( word, number ) {
word = word ? word : 'khan';
number = number ? number: 2;
var arr = this.splitAtVowels( word );
if ( arr.length < 2 ) {
return word;
}
var fin = arr.pop();
var ini = arr.join( '' );
var med = Array( number ).join( fin[0] );
return ini + med + fin;
},
khan: function ( word, number ) {
word = word ? word : 'khan';
number = number ? number : 5;
return this.elongate( word, number).toUpperCase() + '!';
}
};
| Use last vowel, instead of first | Use last vowel, instead of first
| JavaScript | isc | zuzak/node-khaan | ---
+++
@@ -24,9 +24,9 @@
if ( arr.length < 2 ) {
return word;
}
- var ini = arr.shift();
- var med = Array( number ).join( arr[0][0] );
- var fin = arr.join( '' );
+ var fin = arr.pop();
+ var ini = arr.join( '' );
+ var med = Array( number ).join( fin[0] );
return ini + med + fin;
},
khan: function ( word, number ) { |
026a8c0f001800c7e4304105af14cf1c1f56e933 | index.js | index.js | 'use strict';
var through = require('through')
var write = function write(chunk) {
var self = this
//read each line
var data = chunk.toString('utf8')
var lines = data.split('\n')
lines.forEach(function (line) {
if (!line) return
if (line.match(/^\s*#.*$/)) return
self.emit('data', line)
})
}
var end = function end () {
this.emit('end')
}
module.exports = through(write, end)
| 'use strict';
var through = require('through')
var write = function write(chunk) {
var self = this
//read each line
var data = chunk.toString('utf8')
var lines = data.split('\n')
lines.forEach(function (line) {
//generic catch all
if (!line) return
//skip empty lines
if (line.match(/^\s*$/)) return
//skip lines starting with comments
if (line.match(/^\s*#.*$/)) return
//skip lines that start with =
if (line.match(/^\s*=.*$/)) return
//skip lines that dont have an =
if (!line.match(/^.*=.*$/)) return
//trim spaces
line = line.replace(/\s*=\s*/, '=')
line = line.replace(/^\s*(.*)\s*=\s*(.*)$/, '$1=$2')
line = line.replace(/\s$/, '')
self.emit('data', line)
})
}
var end = function end () {
this.emit('end')
}
module.exports = function () {
return through(write, end)
}
| Update module to match tests | Update module to match tests
| JavaScript | mit | digitalsadhu/env-reader | ---
+++
@@ -11,8 +11,27 @@
var lines = data.split('\n')
lines.forEach(function (line) {
+
+ //generic catch all
if (!line) return
+
+ //skip empty lines
+ if (line.match(/^\s*$/)) return
+
+ //skip lines starting with comments
if (line.match(/^\s*#.*$/)) return
+
+ //skip lines that start with =
+ if (line.match(/^\s*=.*$/)) return
+
+ //skip lines that dont have an =
+ if (!line.match(/^.*=.*$/)) return
+
+ //trim spaces
+ line = line.replace(/\s*=\s*/, '=')
+ line = line.replace(/^\s*(.*)\s*=\s*(.*)$/, '$1=$2')
+ line = line.replace(/\s$/, '')
+
self.emit('data', line)
})
@@ -22,5 +41,7 @@
this.emit('end')
}
-module.exports = through(write, end)
+module.exports = function () {
+ return through(write, end)
+}
|
c897c1047356ba25fdc111b7a997a34e0fc4cc04 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-ui-sortable',
included: function(app) {
this._super.included(app);
//app.import(app.bowerDirectory + '/jquery-ui/ui/data.js');
//app.import(app.bowerDirectory + '/jquery-ui/ui/scroll-parent.js');
//app.import(app.bowerDirectory + '/jquery-ui/ui/widget.js');
//app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/mouse.js');
//app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/draggable.js');
//app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/sortable.js');
app.import(app.bowerDirectory + '/jquery-ui/jquery-ui.js');
}
};
| /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-ui-sortable',
included: function(app) {
this._super.included(app);
app.import(app.bowerDirectory + '/jquery-ui/ui/version.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/data.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/ie.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/safe-active-element.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/safe-blur.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/scroll-parent.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/plugin.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/widget.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/mouse.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/draggable.js');
app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/sortable.js');
}
};
| Update dependencies to be an exact copy of jquery-ui's custom download option | Update dependencies to be an exact copy of jquery-ui's custom download option
| JavaScript | mit | 12StarsMedia/ember-ui-sortable,12StarsMedia/ember-ui-sortable | ---
+++
@@ -7,12 +7,16 @@
included: function(app) {
this._super.included(app);
- //app.import(app.bowerDirectory + '/jquery-ui/ui/data.js');
- //app.import(app.bowerDirectory + '/jquery-ui/ui/scroll-parent.js');
- //app.import(app.bowerDirectory + '/jquery-ui/ui/widget.js');
- //app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/mouse.js');
- //app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/draggable.js');
- //app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/sortable.js');
- app.import(app.bowerDirectory + '/jquery-ui/jquery-ui.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/version.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/data.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/ie.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/safe-active-element.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/safe-blur.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/scroll-parent.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/plugin.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/widget.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/mouse.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/draggable.js');
+ app.import(app.bowerDirectory + '/jquery-ui/ui/widgets/sortable.js');
}
}; |
5de5b0c2b772ea307d2fb74828c85401b31f7ea1 | modules/finders/index.js | modules/finders/index.js | module.exports = {
Reddit: require( './reddit.js' ),
Steam: require( './steam.js' ),
MiggyRSS: require( './MiggyRSS.js' ),
};
| /* eslint-disable global-require */
module.exports = {
Reddit: require( './reddit.js' ),
Steam: require( './steam.js' ),
MiggyRSS: require( './MiggyRSS.js' ),
};
| Make sure the lint passes | Make sure the lint passes
| JavaScript | mit | post-tracker/finder | ---
+++
@@ -1,3 +1,5 @@
+/* eslint-disable global-require */
+
module.exports = {
Reddit: require( './reddit.js' ),
Steam: require( './steam.js' ), |
49c0174266ded14f48df30aad1d8f90a809f21cf | packages/@sanity/import/src/batchDocuments.js | packages/@sanity/import/src/batchDocuments.js | const MAX_PAYLOAD_SIZE = 1024 * 512 // 512KB
function batchDocuments(docs) {
let currentBatch = []
let currentBatchSize = 0
const batches = [currentBatch]
docs.forEach(doc => {
const docSize = JSON.stringify(doc).length
const newBatchSize = currentBatchSize + docSize
// If this document pushes us over the max payload size, start a new batch
if (currentBatchSize > 0 && newBatchSize > MAX_PAYLOAD_SIZE) {
currentBatch = [doc]
currentBatchSize = docSize
batches.push(currentBatch)
return
}
// If this document *alone* is over the max payload size, try to allow it
// on it's own. Server has slightly higher payload size than defined here
if (docSize > MAX_PAYLOAD_SIZE) {
if (currentBatchSize === 0) {
// We're alone in a new batch, so push this doc into it and start a new
// one for the next document in line
currentBatch.push(doc)
currentBatchSize = docSize
currentBatch = []
batches.push(currentBatch)
return
}
// Batch already has documents, so "close" that batch off and push this
// huge document into it's own batch
currentBatch = []
currentBatchSize = 0
batches.push([doc], currentBatch)
}
// Otherwise, we should be below the max size, so push this document into
// the batch and increase the size of it to match
currentBatch.push(doc)
currentBatchSize += docSize
})
return batches
}
module.exports = batchDocuments
| const MAX_PAYLOAD_SIZE = 1024 * 256 // 256KB
function batchDocuments(docs) {
let currentBatch = []
let currentBatchSize = 0
const batches = [currentBatch]
docs.forEach(doc => {
const docSize = JSON.stringify(doc).length
const newBatchSize = currentBatchSize + docSize
// If this document pushes us over the max payload size, start a new batch
if (currentBatchSize > 0 && newBatchSize > MAX_PAYLOAD_SIZE) {
currentBatch = [doc]
currentBatchSize = docSize
batches.push(currentBatch)
return
}
// If this document *alone* is over the max payload size, try to allow it
// on it's own. Server has slightly higher payload size than defined here
if (docSize > MAX_PAYLOAD_SIZE) {
if (currentBatchSize === 0) {
// We're alone in a new batch, so push this doc into it and start a new
// one for the next document in line
currentBatch.push(doc)
currentBatchSize = docSize
currentBatch = []
batches.push(currentBatch)
return
}
// Batch already has documents, so "close" that batch off and push this
// huge document into it's own batch
currentBatch = []
currentBatchSize = 0
batches.push([doc], currentBatch)
}
// Otherwise, we should be below the max size, so push this document into
// the batch and increase the size of it to match
currentBatch.push(doc)
currentBatchSize += docSize
})
return batches
}
module.exports = batchDocuments
| Reduce batch size to 128kb | [import] Reduce batch size to 128kb
| JavaScript | mit | sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity | ---
+++
@@ -1,4 +1,4 @@
-const MAX_PAYLOAD_SIZE = 1024 * 512 // 512KB
+const MAX_PAYLOAD_SIZE = 1024 * 256 // 256KB
function batchDocuments(docs) {
let currentBatch = [] |
473a265a16f9c51e0c006b3d49d695700770a9e4 | packages/core/upload/server/routes/content-api.js | packages/core/upload/server/routes/content-api.js | 'use strict';
module.exports = {
type: 'content-api',
routes: [
{
method: 'POST',
path: '/',
handler: 'content-api.upload',
},
{
method: 'GET',
path: '/files/count',
handler: 'content-api.count',
},
{
method: 'GET',
path: '/files',
handler: 'content-api.find',
},
{
method: 'GET',
path: '/files/:id',
handler: 'content-api.findOne',
},
{
method: 'DELETE',
path: '/files/:id',
handler: 'content-api.destroy',
},
],
};
| 'use strict';
module.exports = {
type: 'content-api',
routes: [
{
method: 'POST',
path: '/',
handler: 'content-api.upload',
},
{
method: 'GET',
path: '/files',
handler: 'content-api.find',
},
{
method: 'GET',
path: '/files/:id',
handler: 'content-api.findOne',
},
{
method: 'DELETE',
path: '/files/:id',
handler: 'content-api.destroy',
},
],
};
| REMOVE count route from upload plugin | REMOVE count route from upload plugin | JavaScript | mit | wistityhq/strapi,wistityhq/strapi | ---
+++
@@ -7,11 +7,6 @@
method: 'POST',
path: '/',
handler: 'content-api.upload',
- },
- {
- method: 'GET',
- path: '/files/count',
- handler: 'content-api.count',
},
{
method: 'GET', |
c8e3b4a5c321bfd6826e9fc9ea16157549850844 | app/initializers/blanket.js | app/initializers/blanket.js | export function initialize(application) {
const inject = (property, what) => {
application.inject('controller', property, what);
application.inject('component', property, what);
application.inject('route', property, what);
};
inject('config', 'service:config');
inject('session', 'service:session');
inject('authManager', 'service:auth-manager');
inject('store', 'service:store');
inject('metrics', 'service:metrics');
inject('loader', 'service:loader');
inject('l10n', 'service:l10n');
inject('device', 'service:device');
inject('notify', 'service:notify');
inject('confirm', 'service:confirm');
inject('sanitizer', 'service:sanitizer');
inject('settings', 'service:settings');
inject('fastboot', 'service:fastboot');
inject('routing', 'service:-routing');
inject('cookies', 'service:cookies');
application.inject('component', 'router', 'service:router');
}
export default {
name: 'blanket',
initialize
};
| export function initialize(application) {
const inject = (property, what) => {
application.inject('controller', property, what);
application.inject('component', property, what);
application.inject('route', property, what);
};
inject('config', 'service:config');
inject('session', 'service:session');
inject('authManager', 'service:auth-manager');
inject('store', 'service:store');
inject('metrics', 'service:metrics');
inject('loader', 'service:loader');
inject('l10n', 'service:l10n');
inject('device', 'service:device');
inject('notify', 'service:notify');
inject('confirm', 'service:confirm');
inject('sanitizer', 'service:sanitizer');
inject('settings', 'service:settings');
inject('fastboot', 'service:fastboot');
inject('routing', 'service:-routing');
inject('cookies', 'service:cookies');
inject('infinity', 'service:infinity');
application.inject('component', 'router', 'service:router');
}
export default {
name: 'blanket',
initialize
};
| Introduce ember-infinity as a service | Introduce ember-infinity as a service
| JavaScript | apache-2.0 | ritikamotwani/open-event-frontend,CosmicCoder96/open-event-frontend,CosmicCoder96/open-event-frontend,ritikamotwani/open-event-frontend,ritikamotwani/open-event-frontend,CosmicCoder96/open-event-frontend | ---
+++
@@ -21,6 +21,7 @@
inject('fastboot', 'service:fastboot');
inject('routing', 'service:-routing');
inject('cookies', 'service:cookies');
+ inject('infinity', 'service:infinity');
application.inject('component', 'router', 'service:router');
}
|
fe58a8feb7724c074fb37b62b4e180a254416e73 | coreplugins/slack/slack.js | coreplugins/slack/slack.js | var plugin;
var slack;
var config;
var events = {}
events.onLoad = function(plugin) {
// dependency injection, any better methods for Node?
this.plugin = plugin;
config = plugin.getConfig();
// https://www.npmjs.com/package/slack-node
var Slack = require('slack-node');
slack = new Slack();
slack.setWebhook(config.webhookuri);
}
events.onUnload = function() {
}
events.plug_join = function(user) {
}
events.plug_chat = function(message) {
var content = message.message;
var parts = content.split(" ");
if (parts[0] == "/me") {
parts.shift();
content = "_" + parts.join(" ") + "_";
}
slack.webhook({
channel : config.channel,
username : message.from.username,
text : content
}, function(err, response) {
if (response.status != "ok") {
console.log(response);
}
});
}
module.exports = {
"events" : events
};
| var plugin;
var slack;
var config;
var events = {}
events.onLoad = function(plugin) {
// dependency injection, any better methods for Node?
this.plugin = plugin;
config = plugin.getConfig();
// https://www.npmjs.com/package/slack-node
var Slack = require('slack-node');
slack = new Slack();
slack.setWebhook(config.webhookuri);
}
events.onUnload = function() {
}
events.plug_join = function(user) {
}
events.plug_chat = function(message) {
var content = message.message;
var parts = content.split(" ");
if (parts[0] == "/me") {
parts.shift();
content = "_" + parts.join(" ") + " _";
}
slack.webhook({
channel : config.channel,
username : message.from.username,
text : content
}, function(err, response) {
if (response.status != "ok") {
console.log(response);
}
});
}
module.exports = {
"events" : events
};
| Add a space onto the end of italic text (prevent merging the _ with links) | Slack: Add a space onto the end of italic text (prevent merging the _ with links)
| JavaScript | mit | ylt/BotPlug,WritheM/Wallace,WritheM/Wallace,ylt/Wallace,Reanmachine/Wallace,Reanmachine/Wallace,ylt/Wallace | ---
+++
@@ -29,7 +29,7 @@
if (parts[0] == "/me") {
parts.shift();
- content = "_" + parts.join(" ") + "_";
+ content = "_" + parts.join(" ") + " _";
}
slack.webhook({ |
683d418fd7bede0da8b5c1d7b1250c50a4b0eca9 | test/utils/testStorage.js | test/utils/testStorage.js | export default () => ({
persist: jest.fn(data => Promise.resolve(data)),
restore: jest.fn(() =>
Promise.resolve({ authenticated: { authenticator: 'test' } })
)
})
| export default () => ({
persist: jest.fn(),
restore: jest.fn(() => ({
authenticated: {
authenticator: 'test'
}
}))
})
| Update test storage to better mimic actual storage behavior | Update test storage to better mimic actual storage behavior
| JavaScript | mit | jerelmiller/redux-simple-auth | ---
+++
@@ -1,6 +1,8 @@
export default () => ({
- persist: jest.fn(data => Promise.resolve(data)),
- restore: jest.fn(() =>
- Promise.resolve({ authenticated: { authenticator: 'test' } })
- )
+ persist: jest.fn(),
+ restore: jest.fn(() => ({
+ authenticated: {
+ authenticator: 'test'
+ }
+ }))
}) |
c971b63c3cc2b070643f51675f262f518c86325f | src/files/navigation.js | src/files/navigation.js | var sidebarOpen = false;
var menuText = ["Menu", "Close"];
var menuElement = document.querySelector(".menu-link");
var sidebarElement = document.querySelector(".sidebar");
var headerElement = document.querySelector("header");
var rAF;
menuElement.addEventListener( "click", toggleSidebar, false );
window.addEventListener( "hashchange", toggleSidebar, false );
function toggleSidebar ( event ) {
// Don't toggle when there's nothing to hide.
if (event.type === "hashchange" && !sidebarOpen) return;
sidebarOpen = (!sidebarOpen);
cancelAnimationFrame(rAF);
rAF = requestAnimationFrame(function () {
sidebarElement.classList.toggle( "sidebar-open" );
headerElement.classList.toggle( "hidden" );
menuElement.textContent = menuText[(sidebarOpen ? 1 : 0)];
});
} | var sidebarOpen = false;
var menuText = ["Menu", "Close"];
var menuElement = document.querySelector(".menu-link");
var sidebarElement = document.querySelector(".sidebar");
var mainElement = document.querySelector("main");
var headerElement = document.querySelector("header");
var rAF;
mainElement.addEventListener( "click", toggleSidebar, true );
menuElement.addEventListener( "click", toggleSidebar, false );
window.addEventListener( "hashchange", toggleSidebar, false );
function toggleSidebar ( event ) {
// Don't toggle when there's nothing to hide.
if (event.type === "hashchange" && !sidebarOpen) return;
if (event.currentTarget === mainElement && !sidebarOpen) return;
sidebarOpen = (!sidebarOpen);
cancelAnimationFrame(rAF);
rAF = requestAnimationFrame(function () {
sidebarElement.classList.toggle( "sidebar-open" );
headerElement.classList.toggle( "hidden" );
menuElement.textContent = menuText[(sidebarOpen ? 1 : 0)];
});
} | Add ability to close sidebar by clicking outside | Add ability to close sidebar by clicking outside
| JavaScript | mit | sveltejs/svelte.technology,sveltejs/svelte.technology | ---
+++
@@ -2,15 +2,18 @@
var menuText = ["Menu", "Close"];
var menuElement = document.querySelector(".menu-link");
var sidebarElement = document.querySelector(".sidebar");
+var mainElement = document.querySelector("main");
var headerElement = document.querySelector("header");
var rAF;
+mainElement.addEventListener( "click", toggleSidebar, true );
menuElement.addEventListener( "click", toggleSidebar, false );
window.addEventListener( "hashchange", toggleSidebar, false );
function toggleSidebar ( event ) {
// Don't toggle when there's nothing to hide.
if (event.type === "hashchange" && !sidebarOpen) return;
+ if (event.currentTarget === mainElement && !sidebarOpen) return;
sidebarOpen = (!sidebarOpen);
|
2f3f141e1196eaa39ade102d3795cd189f57828f | src/IconMenu/IconMenu.js | src/IconMenu/IconMenu.js | import React from 'react'
import PropTypes from 'prop-types'
import {SimpleMenu, MenuAnchor, Icon} from '..'
class IconMenu extends React.PureComponent {
static displayName = 'IconMenu'
static propTypes = {
children: PropTypes.node,
name: PropTypes.string,
open: PropTypes.bool,
}
static defaultProps = {
open: false,
}
handleClick = this._handleClick.bind(this)
handleClose = this._handleClose.bind(this)
constructor(props) {
super(props)
this.state = {
open: props.open,
}
}
_handleClick() {
this.setState(state => ({
open: !state.open,
}))
}
_handleClose() {
this.setState({open: false})
}
render() {
return (
<MenuAnchor>
<Icon
href="javascript:void(0);"
name={this.props.name}
onClick={this.handleClick}
tagName="a"
/>
<SimpleMenu
onCancel={this.handleClose}
open={this.state.open}
>
{this.props.children}
</SimpleMenu>
</MenuAnchor>
)
}
}
export default IconMenu
| import React from 'react'
import PropTypes from 'prop-types'
import {SimpleMenu, MenuAnchor, Icon} from '..'
class IconMenu extends React.PureComponent {
static displayName = 'IconMenu'
static propTypes = {
children: PropTypes.node,
iconName: PropTypes.string,
open: PropTypes.bool,
}
static defaultProps = {
open: false,
}
handleClick = this._handleClick.bind(this)
handleClose = this._handleClose.bind(this)
constructor(props) {
super(props)
this.state = {
open: props.open,
}
}
_handleClick() {
this.setState(state => ({
open: !state.open,
}))
}
_handleClose() {
this.setState({open: false})
}
render() {
return (
<MenuAnchor>
<Icon
href="javascript:void(0);"
name={this.props.iconName}
onClick={this.handleClick}
tagName="a"
/>
<SimpleMenu
onCancel={this.handleClose}
open={this.state.open}
>
{this.props.children}
</SimpleMenu>
</MenuAnchor>
)
}
}
export default IconMenu
| Rename prop name => iconName | refactor(components): Rename prop name => iconName
| JavaScript | mit | dimik/react-material-web-components,dimik/react-material-web-components | ---
+++
@@ -7,7 +7,7 @@
static propTypes = {
children: PropTypes.node,
- name: PropTypes.string,
+ iconName: PropTypes.string,
open: PropTypes.bool,
}
@@ -41,7 +41,7 @@
<MenuAnchor>
<Icon
href="javascript:void(0);"
- name={this.props.name}
+ name={this.props.iconName}
onClick={this.handleClick}
tagName="a"
/> |
9542380f1530e9cbb680e04ac8694c649e5acab8 | scripts/ui.js | scripts/ui.js | 'use strict';
const $ = require('jquery'),
remote = require('remote');
let main = remote.getCurrentWindow();
$(function(){
$('.tools > div').on('click', (e) => main[e.target.className]());
});
| 'use strict';
const $ = require('jquery'),
remote = require('remote');
let main = remote.getCurrentWindow();
$(function(){
$('.tools > div').on('click', (e) => main[e.target.className]());
let toggleMax = () => $('.app').toggleClass('maximized');
main.on('maximize', toggleMax).on('unmaximize', toggleMax);
});
| Add maxmimize and unmaxmize class toggler. | Add maxmimize and unmaxmize class toggler.
| JavaScript | mit | JamenMarz/vint,JamenMarz/cluster | ---
+++
@@ -7,4 +7,7 @@
$(function(){
$('.tools > div').on('click', (e) => main[e.target.className]());
+
+ let toggleMax = () => $('.app').toggleClass('maximized');
+ main.on('maximize', toggleMax).on('unmaximize', toggleMax);
}); |
b12455b707f3e720173f0b74ce3f49921697db78 | app/src/Home.js | app/src/Home.js | import React from 'react';
import {Link} from 'react-router-dom'
class Home extends React.Component {
render() {
return (
<div>
<Link to="/add-words" className="button btn-large">Add new word</Link>
<Link to="#/translate" className="button btn-large">Translate</Link>
<Link to="#/dictionary" className="button btn-large">Dictionary</Link>
<Link to="#/flash-cards" className="button btn-large">Flash cards</Link>
<Link to="#/notes" className="button btn-large">Notes</Link>
</div>
);
}
}
export default Home;
| import React from 'react';
import {Link} from 'react-router-dom'
class Home extends React.Component {
render() {
return (
<div>
<Link to="/add-words" className="button btn-large">Add new word</Link>
<Link to="/translate" className="button btn-large">Translate</Link>
<Link to="/dictionary" className="button btn-large">Dictionary</Link>
<Link to="/flash-cards" className="button btn-large">Flash cards</Link>
<Link to="/notes" className="button btn-large">Notes</Link>
</div>
);
}
}
export default Home;
| Change remaining <a> tags into <Link> components | Change remaining <a> tags into <Link> components
| JavaScript | mit | dmatthew/my-secret-language,dmatthew/my-secret-language,dmatthew/my-secret-language | ---
+++
@@ -6,10 +6,10 @@
return (
<div>
<Link to="/add-words" className="button btn-large">Add new word</Link>
- <Link to="#/translate" className="button btn-large">Translate</Link>
- <Link to="#/dictionary" className="button btn-large">Dictionary</Link>
- <Link to="#/flash-cards" className="button btn-large">Flash cards</Link>
- <Link to="#/notes" className="button btn-large">Notes</Link>
+ <Link to="/translate" className="button btn-large">Translate</Link>
+ <Link to="/dictionary" className="button btn-large">Dictionary</Link>
+ <Link to="/flash-cards" className="button btn-large">Flash cards</Link>
+ <Link to="/notes" className="button btn-large">Notes</Link>
</div>
);
} |
7fff75c2c053e3b4084fddad486a3e03c2afe0fb | assets/js/controls/transport.js | assets/js/controls/transport.js | var Transport = can.Control.extend({
init: function(element, options) {
this.status = options.status;
element.html(can.view('views/transport.ejs'));
},
sendCommand: function(command) {
var self = this;
can.ajax({
url: '/api/control/' + command,
type: 'PUT',
success: function(status) {
self.status.attr(status);
}
});
},
'button click': function(element, event) {
var command = $(element).data('command');
this.sendCommand(command);
}
});
| var Transport = can.Control.extend({
init: function(element, options) {
this.status = options.status;
element.html(can.view('views/transport.ejs'));
},
updateStatus: function(status) {
this.status.attr(status);
},
sendCommand: function(command) {
var self = this;
can.ajax({
url: '/api/control/' + command,
type: 'PUT',
success: function(status) {
self.updateStatus(status);
}
});
},
'button click': function(element, event) {
var command = $(element).data('command');
this.sendCommand(command);
}
});
| Split out status update into its own function. | Split out status update into its own function.
| JavaScript | mit | danbee/mpd-client,danbee/mpd-client | ---
+++
@@ -3,6 +3,10 @@
init: function(element, options) {
this.status = options.status;
element.html(can.view('views/transport.ejs'));
+ },
+
+ updateStatus: function(status) {
+ this.status.attr(status);
},
sendCommand: function(command) {
@@ -11,7 +15,7 @@
url: '/api/control/' + command,
type: 'PUT',
success: function(status) {
- self.status.attr(status);
+ self.updateStatus(status);
}
});
}, |
20135db684aeb8d4f626d62f03c08b41ac8b5900 | cli/options.js | cli/options.js | const commander = require('commander')
class Options {
constructor(argv) {
const args = commander
.option('--electron-debug',
'Show the browser window and keep it open after running features')
.parse(argv)
this.electronDebug = args.electronDebug
this.cucumberArgv = argv.filter(a => a != '--electron-debug')
}
}
module.exports = Options
| const commander = require('commander')
class Options {
constructor(argv) {
const args = commander
.option('--electron-debug',
'Show the browser window and keep it open after running features')
.parse(argv)
this.electronDebug = Boolean(args.electronDebug)
this.cucumberArgv = argv.filter(a => a != '--electron-debug')
}
}
module.exports = Options
| Fix regression with hiding the window unless --electron-debug | Fix regression with hiding the window unless --electron-debug
| JavaScript | mit | featurist/cucumber-electron,featurist/cucumber-electron,cucumber/cucumber-electron,cucumber/cucumber-electron,cucumber/cucumber-electron,cucumber/cucumber-electron | ---
+++
@@ -7,7 +7,7 @@
'Show the browser window and keep it open after running features')
.parse(argv)
- this.electronDebug = args.electronDebug
+ this.electronDebug = Boolean(args.electronDebug)
this.cucumberArgv = argv.filter(a => a != '--electron-debug')
} |
4fd9b9584dd1d273274be5734f783d0d4a857a5a | index.js | index.js | 'use strict';
module.exports = {
fetch: function () {
},
update: function () {
},
merge: function () {
},
};
| 'use strict';
var options = {
repository: 'https://github.com/dorian-marchal/phonegap-boilerplate',
branch: 'master',
};
/**
* Check that the cli is used in a phonegap boilerplate project
* @return {bool} true if we are in a pb project, else otherwise
*/
var checkWorkingDirectory = function () {
};
/**
* Load the configuration from the config file.
* Prompt the user to fille the configuration file if it's missing.
*/
var loadConfig = function () {
};
module.exports = {
fetch: function () {
},
update: function () {
},
merge: function () {
},
};
| Add the base project structure | Add the base project structure
| JavaScript | mit | dorian-marchal/phonegap-boilerplate-cli | ---
+++
@@ -1,4 +1,25 @@
'use strict';
+
+var options = {
+ repository: 'https://github.com/dorian-marchal/phonegap-boilerplate',
+ branch: 'master',
+};
+
+/**
+ * Check that the cli is used in a phonegap boilerplate project
+ * @return {bool} true if we are in a pb project, else otherwise
+ */
+var checkWorkingDirectory = function () {
+
+};
+
+/**
+ * Load the configuration from the config file.
+ * Prompt the user to fille the configuration file if it's missing.
+ */
+var loadConfig = function () {
+
+};
module.exports = {
fetch: function () { |
7adfdc80661f56070acf94ee2e24e9ea42d1c96c | sauce/features/accounts/toggle-splits/settings.js | sauce/features/accounts/toggle-splits/settings.js | module.exports = {
name: 'ToggleSplits',
type: 'checkbox',
default: false,
section: 'accounts',
title: 'Add a Toggle Splits Button',
description: 'Clicking the toggle splits button shows or hides the sub-transactions within a split.'
};
| module.exports = {
name: 'ToggleSplits',
type: 'checkbox',
default: false,
section: 'accounts',
title: 'Add a Toggle Splits Button to the Account(s) toolbar',
description: 'Clicking the Toggle Splits button shows or hides all sub-transactions within all split transactions. *__Note__: you must toggle splits open before editing a split transaction!*'
};
| Add text regsarding the location of the button and that splits must be toggled open before editing a split txn. | Add text regsarding the location of the button
and that splits must be toggled open before editing a split txn.
| JavaScript | mit | dbaldon/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,falkencreative/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,blargity/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,falkencreative/toolkit-for-ynab,falkencreative/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,dbaldon/toolkit-for-ynab,blargity/toolkit-for-ynab,ahatzz11/toolkit-for-ynab,falkencreative/toolkit-for-ynab,dbaldon/toolkit-for-ynab,blargity/toolkit-for-ynab,dbaldon/toolkit-for-ynab,toolkit-for-ynab/toolkit-for-ynab,blargity/toolkit-for-ynab,ahatzz11/toolkit-for-ynab | ---
+++
@@ -3,6 +3,6 @@
type: 'checkbox',
default: false,
section: 'accounts',
- title: 'Add a Toggle Splits Button',
- description: 'Clicking the toggle splits button shows or hides the sub-transactions within a split.'
+ title: 'Add a Toggle Splits Button to the Account(s) toolbar',
+ description: 'Clicking the Toggle Splits button shows or hides all sub-transactions within all split transactions. *__Note__: you must toggle splits open before editing a split transaction!*'
}; |
4c0ead9c25c3062daa8204c007274758aecda144 | gulpfile.js | gulpfile.js | 'use strict';
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha');
var paths = {
scripts: ['./*.js', './test/*.js', '!./lib', '!./gulpfile.js']
};
gulp.task('lint', function() {
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('test', function() {
return gulp.src('./test/*.js')
.pipe(mocha({reporter: 'dot'}));
});
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['lint', 'test']);
});
gulp.task('default', ['lint', 'test', 'watch']); | 'use strict';
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha'),
qunit = require('./index');
var paths = {
scripts: ['./*.js', './test/*.js', '!./lib', '!./gulpfile.js']
};
gulp.task('lint', function() {
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('test', function() {
return gulp.src('./test/*.js')
.pipe(mocha({reporter: 'dot'}));
});
gulp.task('qunit', function() {
qunit('./test/fixture.html');
});
gulp.task('qunit-verbose', function() {
qunit('./test/fixture.html', { 'verbose': true });
});
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['lint', 'test']);
});
gulp.task('default', ['lint', 'test', 'watch']); | Add sample sample qunit gulp tasks for testing. | Add sample sample qunit gulp tasks for testing.
| JavaScript | mit | jonkemp/node-qunit-phantomjs | ---
+++
@@ -2,7 +2,8 @@
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
- mocha = require('gulp-mocha');
+ mocha = require('gulp-mocha'),
+ qunit = require('./index');
var paths = {
scripts: ['./*.js', './test/*.js', '!./lib', '!./gulpfile.js']
@@ -19,6 +20,14 @@
.pipe(mocha({reporter: 'dot'}));
});
+gulp.task('qunit', function() {
+ qunit('./test/fixture.html');
+});
+
+gulp.task('qunit-verbose', function() {
+ qunit('./test/fixture.html', { 'verbose': true });
+});
+
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['lint', 'test']);
}); |
cfa32de7fb24d29cd7fbf52e1d1822f61a6db8c5 | index.js | index.js | 'use strict';
var fs = require('fs');
var spawnSync = require('child_process').spawnSync;
var HttpResponse = require('http-response-object');
require('concat-stream');
require('then-request');
var JSON = require('./lib/json-buffer');
Function('', fs.readFileSync(require.resolve('./lib/worker.js'), 'utf8'));
module.exports = doRequest;
function doRequest(method, url, options) {
if (!spawnSync) {
throw new Error(
'Sync-request requires node version 0.12 or later. If you need to use it with an older version of node\n' +
'you can `npm install spawn-sync@2.2.0`, which was the last version to support older versions of node.'
);
}
var req = JSON.stringify({
method: method,
url: url,
options: options
});
var res = spawnSync(process.execPath, [require.resolve('./lib/worker.js')], {input: req});
if (res.status !== 0) {
throw new Error(res.stderr.toString());
}
if (res.error) {
if (typeof res.error === 'string') res.error = new Error(res.error);
throw res.error;
}
var response = JSON.parse(res.stdout);
if (response.success) {
return new HttpResponse(response.response.statusCode, response.response.headers, response.response.body, response.response.url);
} else {
throw new Error(response.error.message || response.error || response);
}
}
| 'use strict';
var fs = require('fs');
var spawnSync = require('child_process').spawnSync;
var HttpResponse = require('http-response-object');
require('concat-stream');
require('then-request');
var JSON = require('./lib/json-buffer');
Function('', fs.readFileSync(require.resolve('./lib/worker.js'), 'utf8'));
module.exports = doRequest;
function doRequest(method, url, options) {
if (!spawnSync) {
throw new Error(
'Sync-request requires node version 0.12 or later. If you need to use it with an older version of node\n' +
'you can `npm install sync-request@2.2.0`, which was the last version to support older versions of node.'
);
}
var req = JSON.stringify({
method: method,
url: url,
options: options
});
var res = spawnSync(process.execPath, [require.resolve('./lib/worker.js')], {input: req});
if (res.status !== 0) {
throw new Error(res.stderr.toString());
}
if (res.error) {
if (typeof res.error === 'string') res.error = new Error(res.error);
throw res.error;
}
var response = JSON.parse(res.stdout);
if (response.success) {
return new HttpResponse(response.response.statusCode, response.response.headers, response.response.body, response.response.url);
} else {
throw new Error(response.error.message || response.error || response);
}
}
| Fix suggested npm install command. | Fix suggested npm install command.
Instructions were pointing to the wrong project. | JavaScript | mit | ForbesLindesay/sync-request,ForbesLindesay/sync-request | ---
+++
@@ -14,7 +14,7 @@
if (!spawnSync) {
throw new Error(
'Sync-request requires node version 0.12 or later. If you need to use it with an older version of node\n' +
- 'you can `npm install spawn-sync@2.2.0`, which was the last version to support older versions of node.'
+ 'you can `npm install sync-request@2.2.0`, which was the last version to support older versions of node.'
);
}
var req = JSON.stringify({ |
0c263159c54f9a7cbc6617e02bb9fba762b7bf82 | src/scripts/app/play/proofreadings/controller.js | src/scripts/app/play/proofreadings/controller.js | 'use strict';
module.exports =
/*@ngInject*/
function ProofreadingPlayCtrl(
$scope, $state, ProofreadingService, RuleService
) {
$scope.id = $state.params.id;
function error(e) {
console.error(e);
$state.go('index');
}
function prepareProofReading(pf) {
pf.replace(/{+(.+)-(.+)\|(.+)}/g, function(a,b,c,d) {
console.log(a,b,c,d);
});
return pf;
}
ProofreadingService.getProofreading($scope.id).then(function(pf) {
pf.passage = prepareProofReading(pf.passage);
$scope.pf = pf;
}, error);
};
| 'use strict';
module.exports =
/*@ngInject*/
function ProofreadingPlayCtrl(
$scope, $state, ProofreadingService, RuleService
) {
$scope.id = $state.params.id;
function error(e) {
console.error(e);
$state.go('index');
}
function prepareProofReading(pf) {
pf.replace(/{\+(\w+)-(\w+)\|(\w+)}/g, function(key, plus, minus, ruleNumber) {
});
return pf;
}
ProofreadingService.getProofreading($scope.id).then(function(pf) {
pf.passage = prepareProofReading(pf.passage);
$scope.pf = pf;
}, error);
};
| Use a regex to parse the syntax | Use a regex to parse the syntax
into key, plus, minus, rule number
| JavaScript | agpl-3.0 | ddmck/Quill-Grammar,ddmck/Quill-Grammar,empirical-org/Quill-Grammar,empirical-org/Quill-Grammar,ddmck/Quill-Grammar,empirical-org/Quill-Grammar | ---
+++
@@ -14,8 +14,7 @@
}
function prepareProofReading(pf) {
- pf.replace(/{+(.+)-(.+)\|(.+)}/g, function(a,b,c,d) {
- console.log(a,b,c,d);
+ pf.replace(/{\+(\w+)-(\w+)\|(\w+)}/g, function(key, plus, minus, ruleNumber) {
});
return pf;
} |
006a8e25c02f800d4b36cc051c46f736fcc940b2 | site/src/main/resources/static/js/findpassword.js | site/src/main/resources/static/js/findpassword.js | jQuery(function ($) {
function d(event) {
event.keyCode === 13 && button.click();
}
function click() {
image.attr('src', src + (src.indexOf('?') < 0 ? '?' : '&') + '_=' + +new Date());
imgv.val('');
(user.val() ? imgv : user).focus();
}
function enable() {
button.removeAttr('disabled');
}
function disable() {
button.attr('disabled', true);
}
var div = $('#findpassword'), user = div.find('[name="username"]'), button = div.find('[type="button"]'),
image = div.find('img'), imgv = div.find('[name="imgVerify"]');
var src = image.attr('src');
image.click(click);
imgv.bind('keypress', d);
user.bind('keypress', d);
button.click(function () {
var uid = user.val(), vcode = imgv.val();
if (!uid) {
alert('θ―·θΎε
₯η¨ζ·ε');
user.focus();
} else if (!vcode) {
alert('θ―·θΎε
₯ιͺθ―η ');
imgv.focus();
} else {
disable();
$.post('resetPassword.json', {username: uid, verify: vcode})
.always(click, enable).fail(function (result) {
console.log(arguments);
alert(result.responseJSON && result.responseJSON.message || result.responseText || 'Error Occur');
}).success(function (result) {
alert(result.message);
});
}
});
});
| jQuery(function ($) {
function d(event) {
event.keyCode === 13 && button.click();
}
function click() {
image.attr('src', src + (src.indexOf('?') < 0 ? '?' : '&') + '_=' + +new Date());
imgv.val('');
(user.val() ? imgv : user).focus();
}
function enable() {
button.removeAttr('disabled');
}
function disable() {
button.attr('disabled', true);
}
var div = $('#findpassword'), user = div.find('[name="username"]'), button = div.find('[type="button"]'),
image = div.find('img'), imgv = div.find('[name="imgVerify"]');
var src = image.attr('src');
image.click(click);
imgv.bind('keypress', d);
user.bind('keypress', d);
button.click(function () {
var uid = user.val(), vcode = imgv.val();
if (!uid) {
alert('θ―·θΎε
₯η¨ζ·ε');
user.focus();
} else if (!vcode) {
alert('θ―·θΎε
₯ιͺθ―η ');
imgv.focus();
} else {
disable();
$.post('resetPassword.json', {username: uid, verify: vcode})
.always(click, enable).fail(function (result) {
alert(result.responseJSON && result.responseJSON.message || result.responseText || 'Error Occur');
}).success(function (result) {
alert(result.message);
});
}
});
});
| Fix console is undefined on IE 8 | Fix console is undefined on IE 8
| JavaScript | apache-2.0 | zjnu-acm/judge,zjnu-acm/judge,zjnu-acm/judge,zjnu-acm/judge,zjnu-acm/judge | ---
+++
@@ -35,7 +35,6 @@
disable();
$.post('resetPassword.json', {username: uid, verify: vcode})
.always(click, enable).fail(function (result) {
- console.log(arguments);
alert(result.responseJSON && result.responseJSON.message || result.responseText || 'Error Occur');
}).success(function (result) {
alert(result.message); |
72ca5876f553f595582993e800708b707b956b16 | EventTarget.js | EventTarget.js | /**
* @author mrdoob / http://mrdoob.com
* @author JesΓΊs LeganΓ©s Combarro "Piranna" <piranna@gmail.com>
*/
function EventTarget()
{
var listeners = {};
this.addEventListener = function(type, listener)
{
if(!listener) return
var listeners_type = listeners[type]
if(listeners_type === undefined)
listeners[type] = listeners_type = [];
if(listeners_type.indexOf(listener) === -1)
listeners_type.push(listener);
};
this.dispatchEvent = function(event)
{
var type = event.type
var listenerArray = (listeners[type] || []);
var dummyListener = this['on' + type];
if(typeof dummyListener == 'function')
listenerArray = listenerArray.concat(dummyListener);
for(var i=0,listener; listener=listenerArray[i]; i++)
listener.call(this, event);
};
this.removeEventListener = function(type, listener)
{
if(!listener) return
var listeners_type = listeners[type]
if(listeners_type === undefined) return
var index = listeners_type.indexOf(listener);
if(index !== -1)
listeners_type.splice(index, 1);
if(!listeners_type.length)
delete listeners[type]
};
};
if(typeof module !== 'undefined' && module.exports)
module.exports = EventTarget;
| /**
* @author mrdoob / http://mrdoob.com
* @author JesΓΊs LeganΓ©s Combarro "Piranna" <piranna@gmail.com>
*/
function EventTarget()
{
var listeners = {};
this.addEventListener = function(type, listener)
{
if(!listener) return
var listeners_type = listeners[type]
if(listeners_type === undefined)
listeners[type] = listeners_type = [];
for(var i=0,l; l=listeners_type[i]; i++)
if(l === listener) return;
listeners_type.push(listener);
};
this.dispatchEvent = function(event)
{
var type = event.type
var listenerArray = (listeners[type] || []);
var dummyListener = this['on' + type];
if(typeof dummyListener == 'function')
listenerArray = listenerArray.concat(dummyListener);
for(var i=0,listener; listener=listenerArray[i]; i++)
listener.call(this, event);
};
this.removeEventListener = function(type, listener)
{
if(!listener) return
var listeners_type = listeners[type]
if(listeners_type === undefined) return
for(var i=0,l; l=listeners_type[i]; i++)
if(l === listener)
{
listeners_type.splice(i, 1);
break;
}
if(!listeners_type.length)
delete listeners[type]
};
};
if(typeof module !== 'undefined' && module.exports)
module.exports = EventTarget;
| Support for Internet Explorer 8 | Support for Internet Explorer 8
| JavaScript | mit | ShareIt-project/EventTarget.js | ---
+++
@@ -2,6 +2,7 @@
* @author mrdoob / http://mrdoob.com
* @author JesΓΊs LeganΓ©s Combarro "Piranna" <piranna@gmail.com>
*/
+
function EventTarget()
{
@@ -9,45 +10,50 @@
this.addEventListener = function(type, listener)
{
- if(!listener) return
+ if(!listener) return
- var listeners_type = listeners[type]
+ var listeners_type = listeners[type]
if(listeners_type === undefined)
listeners[type] = listeners_type = [];
- if(listeners_type.indexOf(listener) === -1)
- listeners_type.push(listener);
+ for(var i=0,l; l=listeners_type[i]; i++)
+ if(l === listener) return;
+
+ listeners_type.push(listener);
};
this.dispatchEvent = function(event)
{
- var type = event.type
+ var type = event.type
var listenerArray = (listeners[type] || []);
var dummyListener = this['on' + type];
if(typeof dummyListener == 'function')
listenerArray = listenerArray.concat(dummyListener);
- for(var i=0,listener; listener=listenerArray[i]; i++)
+ for(var i=0,listener; listener=listenerArray[i]; i++)
listener.call(this, event);
};
this.removeEventListener = function(type, listener)
{
- if(!listener) return
+ if(!listener) return
- var listeners_type = listeners[type]
- if(listeners_type === undefined) return
+ var listeners_type = listeners[type]
+ if(listeners_type === undefined) return
- var index = listeners_type.indexOf(listener);
- if(index !== -1)
- listeners_type.splice(index, 1);
+ for(var i=0,l; l=listeners_type[i]; i++)
+ if(l === listener)
+ {
+ listeners_type.splice(i, 1);
+ break;
+ }
- if(!listeners_type.length)
- delete listeners[type]
+ if(!listeners_type.length)
+ delete listeners[type]
};
};
if(typeof module !== 'undefined' && module.exports)
- module.exports = EventTarget;
+ module.exports = EventTarget; |
d7c647971190893a30dd61068c1edcf266a32201 | Gruntfile.js | Gruntfile.js | var config = require('./Build/Config');
module.exports = function(grunt) {
'use strict';
// Display the execution time of grunt tasks
require('time-grunt')(grunt);
// Load all grunt-tasks in 'Build/Grunt-Options'.
var gruntOptionsObj = require('load-grunt-configs')(grunt, {
config : {
src: "Build/Grunt-Options/*.js"
}
});
grunt.initConfig(gruntOptionsObj);
// Load all grunt-plugins that are specified in the 'package.json' file.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
/**
* Default grunt task.
* Compiles all .scss/.sass files with ':dev' options and
* validates all js-files inside Resources/Private/Javascripts with JSHint.
*/
grunt.registerTask('default', ['compass:dev', 'jshint']);
/**
* Travis CI task
* Replaces all replace strings with the standard meta data stored in the package.json
* and tests all JS files with JSHint, this task is used by Travis CI.
*/
grunt.registerTask('travis', ['replace:init', 'jshint']);
/**
* Load custom tasks
* Load all Grunt-Tasks inside the 'Build/Grunt-Tasks' dir.
*/
grunt.loadTasks('Build/Grunt-Tasks');
};
| var config = require('./Build/Config');
module.exports = function(grunt) {
'use strict';
// Display the execution time of grunt tasks
require('time-grunt')(grunt);
// Load all grunt-tasks in 'Build/Grunt-Options'.
var gruntOptionsObj = require('load-grunt-configs')(grunt, {
config : {
src: "Build/Grunt-Options/*.js"
}
});
grunt.initConfig(gruntOptionsObj);
// Load all grunt-plugins that are specified in the 'package.json' file.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
/**
* Default grunt task.
* Compiles all .scss/.sass files with ':dev' options and
* validates all js-files inside Resources/Private/Javascripts with JSHint.
*/
grunt.registerTask('default', ['compass:dev', 'jshint']);
/**
* Travis CI task
* Test all specified grunt tasks.
*/
grunt.registerTask('travis', ['init', 'replace:init', 'jshint', 'deploy', 'undeploy']);
/**
* Load custom tasks
* Load all Grunt-Tasks inside the 'Build/Grunt-Tasks' dir.
*/
grunt.loadTasks('Build/Grunt-Tasks');
};
| Test all grunt tasks on Travis CI | [MISC] Test all grunt tasks on Travis CI
| JavaScript | mit | t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template | ---
+++
@@ -28,10 +28,9 @@
/**
* Travis CI task
- * Replaces all replace strings with the standard meta data stored in the package.json
- * and tests all JS files with JSHint, this task is used by Travis CI.
+ * Test all specified grunt tasks.
*/
- grunt.registerTask('travis', ['replace:init', 'jshint']);
+ grunt.registerTask('travis', ['init', 'replace:init', 'jshint', 'deploy', 'undeploy']);
/** |
1c9492dd27e6115c6bc0a8e8305a3165d55c313f | Gruntfile.js | Gruntfile.js | 'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configurable paths
config: {
lintFiles: [
'angular-bind-html-compile.js'
]
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'<%= config.lintFiles %>'
]
},
jscs: {
options: {
config: '.jscsrc'
},
src: '<%= config.lintFiles %>'
},
uglify: {
build: {
files: {
'angular-bind-html-compile.min.js': 'angular-bind-html-compile.js'
}
}
}
});
grunt.registerTask('lint', [
'jshint',
'jscs'
]);
grunt.registerTask('test', [
'lint'
]);
grunt.registerTask('build', [
'uglify'
]);
};
| 'use strict';
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configurable paths
config: {
lintFiles: [
'**/*.js',
'!*.min.js'
]
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'<%= config.lintFiles %>'
]
},
jscs: {
options: {
config: '.jscsrc'
},
src: '<%= config.lintFiles %>'
},
uglify: {
build: {
files: {
'angular-bind-html-compile.min.js': 'angular-bind-html-compile.js'
}
}
}
});
grunt.registerTask('lint', [
'jshint',
'jscs'
]);
grunt.registerTask('test', [
'lint'
]);
grunt.registerTask('build', [
'uglify'
]);
};
| Revert "Revert "Added support for multiple files (excluding minified scripts)"" | Revert "Revert "Added support for multiple files (excluding minified scripts)""
This reverts commit fde48e384ec241fef5d6c4c80a62e3f32f9cc7ab.
| JavaScript | mit | ivanslf/angular-bind-html-compile,incuna/angular-bind-html-compile | ---
+++
@@ -8,7 +8,8 @@
// Configurable paths
config: {
lintFiles: [
- 'angular-bind-html-compile.js'
+ '**/*.js',
+ '!*.min.js'
]
},
jshint: { |
903456c8c2203d3b86aab36fc70edb0780cf85f1 | index.js | index.js | var Prism = require('prismjs');
var cheerio = require('cheerio');
module.exports = {
book: {
assets: './node_modules/prismjs/themes',
css: [
'prism.css'
]
},
hooks: {
page: function (page) {
page.sections.forEach(function (section) {
var $ = cheerio.load(section.content);
$('code').each(function() {
var text = $(this).text();
var highlighted = Prism.highlight(text, Prism.languages.javascript);
$(this).html(highlighted);
});
section.content = $.html();
});
return page;
}
}
};
| var Prism = require('prismjs');
var cheerio = require('cheerio');
var path = require('path');
var cssFile = require.resolve('prismjs/themes/prism.css');
var cssDirectory = path.dirname(cssFile);
module.exports = {
book: {
assets: cssDirectory,
css: [path.basename(cssFile)]
},
hooks: {
page: function (page) {
page.sections.forEach(function (section) {
var $ = cheerio.load(section.content);
$('code').each(function() {
var text = $(this).text();
var highlighted = Prism.highlight(text, Prism.languages.javascript);
$(this).html(highlighted);
});
section.content = $.html();
});
return page;
}
}
};
| Use Node resolving mechanism to locate Prism CSS | Use Node resolving mechanism to locate Prism CSS
| JavaScript | apache-2.0 | gaearon/gitbook-plugin-prism | ---
+++
@@ -1,12 +1,14 @@
var Prism = require('prismjs');
var cheerio = require('cheerio');
+var path = require('path');
+
+var cssFile = require.resolve('prismjs/themes/prism.css');
+var cssDirectory = path.dirname(cssFile);
module.exports = {
book: {
- assets: './node_modules/prismjs/themes',
- css: [
- 'prism.css'
- ]
+ assets: cssDirectory,
+ css: [path.basename(cssFile)]
},
hooks: {
page: function (page) { |
e5636a64d0e737a63ca7f5e5762c098afbeca578 | spec/index.spec.js | spec/index.spec.js |
'use strict';
// eslint-disable-next-line no-console
console.log(`ββββββββββββββββββββββββββββββββ ${(new Date())} \n\n`);
describe('MarkTodoItem', () => {
const test_case_mocks = require('./test-case.mocks');
const MarkTodoItem = require('../');
const markTodoItem = MarkTodoItem();
test_case_mocks.forEach( (test_case_mock) => {
it(test_case_mock.it, () => {
expect(markTodoItem(test_case_mock.input))
.toBe(test_case_mock.output);
});
});
});
| /* global describe, it, expect */
'use strict';
// eslint-disable-next-line no-console
console.log(`ββββββββββββββββββββββββββββββββ ${(new Date())} \n\n`);
describe('MarkTodoItem', () => {
const test_case_mocks = require('./test-case.mocks');
const MarkTodoItem = require('../');
const markTodoItem = MarkTodoItem();
test_case_mocks.forEach( (test_case_mock) => {
it(test_case_mock.it, () => {
expect(markTodoItem(test_case_mock.input))
.toBe(test_case_mock.output);
});
});
});
| Add ESLint comment for globals: describe, it, expect | Add ESLint comment for globals: describe, it, expect
| JavaScript | mit | MelleWynia/mark-todo-item | ---
+++
@@ -1,3 +1,4 @@
+/* global describe, it, expect */
'use strict';
|
cff4ad9e8273d3560485b8e459d689088a629d9d | babel.config.js | babel.config.js | module.exports = {
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": [
"last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
]
},
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/preset-react"
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": false, decoratorsBeforeExport: true}],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-flow-comments",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime"
]
};
| module.exports = {
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
"targets": [
"last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
],
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/preset-react"
],
"plugins": [
["@babel/plugin-proposal-decorators", {decoratorsBeforeExport: true}],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-flow-comments",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime"
]
};
| Remove legacy and stop using deprecated things | Remove legacy and stop using deprecated things
| JavaScript | apache-2.0 | vector-im/riot-web,vector-im/riot-web,vector-im/riot-web,vector-im/riot-web,vector-im/vector-web,vector-im/riot-web,vector-im/riot-web,vector-im/vector-web,vector-im/vector-web,vector-im/vector-web,vector-im/vector-web | ---
+++
@@ -2,18 +2,16 @@
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
- "targets": {
- "browsers": [
- "last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
- ]
- },
+ "targets": [
+ "last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
+ ],
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/preset-react"
],
"plugins": [
- ["@babel/plugin-proposal-decorators", {"legacy": false, decoratorsBeforeExport: true}],
+ ["@babel/plugin-proposal-decorators", {decoratorsBeforeExport: true}],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties", |
bae1de8075c538aa67ee233d5bf7c6b808e275c6 | index.js | index.js | /* jshint node: true */
'use strict';
var replace = require('broccoli-replace');
var favicons = require('broccoli-favicon');
var htmlCache = null;
module.exports = {
name: 'ember-cli-favicon',
included: function(app) {
this.options = app.favicons || {};
this.options.htmlCallback = function(html) {
htmlCache = html;
};
},
postprocessTree: function(type, tree) {
if (type === 'all') {
return replace(tree, {
files: [ 'index.html' ],
patterns: [{
match: /<\/head>/i,
replacement: function() {
return htmlCache + '\n</head>';
}
}]
});
}
return tree;
},
treeForPublic: function(tree) {
if (this.options.persistCache !== false) {
this.options.persistentCacheDir = this.options.persistentCacheDir || 'tmp/.favicon-cache';
}
return favicons(tree || 'public', this.options);
}
};
| /* jshint node: true */
'use strict';
var replace = require('broccoli-replace');
var favicons = require('broccoli-favicon');
var htmlCache = null;
module.exports = {
name: 'ember-cli-favicon',
included: function(app) {
this.options = app.favicons || {};
this.options.callback = function(html) {
htmlCache = html;
};
},
postprocessTree: function(type, tree) {
if (type === 'all') {
return replace(tree, {
files: [ 'index.html' ],
patterns: [{
match: /<\/head>/i,
replacement: function() {
return htmlCache + '\n</head>';
}
}]
});
}
return tree;
},
treeForPublic: function(tree) {
if (this.options.persistCache !== false) {
this.options.persistentCacheDir = this.options.persistentCacheDir || 'tmp/.favicon-cache';
}
return favicons(tree || 'public', this.options);
}
};
| Use callback instead of htmlCallback | Use callback instead of htmlCallback | JavaScript | mit | davewasmer/ember-cli-favicon,davewasmer/ember-cli-favicon | ---
+++
@@ -12,7 +12,7 @@
included: function(app) {
this.options = app.favicons || {};
- this.options.htmlCallback = function(html) {
+ this.options.callback = function(html) {
htmlCache = html;
};
}, |
043adbd2ca8d5ba976f3520132e1743844c55abd | browser/react/components/App.js | browser/react/components/App.js | import React from 'react';
import '../../aframeComponents/scene-load';
import '../../aframeComponents/aframe-minecraft';
import AssetLoader from './AssetLoader';
import InitialLoading from './InitialLoading';
export default function App (props) {
console.log('props ', props);
return (
// AssetLoader is a stateless component containing the a-assets for all of the React components
// rendered via props.children. It must reside here because A-Frame requires a-assets to a
// direct child of a-scene.
<div style={{ width: '100%', height: '100%' }}>
{!props.isLoaded ? (
<div id="loadScreen" style={{ width: '100%', height: '100%', background: '#72C8F1', display: 'flex', alignItems: 'center', flexDirection: 'row', justifyContent: 'center' }}>
<InitialLoading/>
</div>
)
: null
}
<a-scene id="scene" scene-load>
<AssetLoader />
{props.children}
</a-scene>
</div>
);
}
| import React from 'react';
import '../../aframeComponents/scene-load';
import '../../aframeComponents/aframe-minecraft';
import AssetLoader from './AssetLoader';
import InitialLoading from './InitialLoading';
export default function App (props) {
console.log('props ', props);
return (
// AssetLoader is a stateless component containing the a-assets for all of the React components
// rendered via props.children. It must reside here because A-Frame requires a-assets to a
// direct child of a-scene.
<div style={{ width: '100%', height: '100%' }}>
{!props.isLoaded ? (
<div id="loadScreen" style={{ width: '100%', height: '100%', backgroundImage: 'url(/images/background.png)', display: 'flex', alignItems: 'center', flexDirection: 'row', justifyContent: 'center' }}>
<InitialLoading/>
</div>
)
: null
}
<a-scene id="scene" scene-load>
<AssetLoader />
{props.children}
</a-scene>
</div>
);
}
| Change background of spinner to match login | feat: Change background of spinner to match login
| JavaScript | mit | TranscendVR/transcend,TranscendVR/transcend | ---
+++
@@ -12,7 +12,7 @@
// direct child of a-scene.
<div style={{ width: '100%', height: '100%' }}>
{!props.isLoaded ? (
- <div id="loadScreen" style={{ width: '100%', height: '100%', background: '#72C8F1', display: 'flex', alignItems: 'center', flexDirection: 'row', justifyContent: 'center' }}>
+ <div id="loadScreen" style={{ width: '100%', height: '100%', backgroundImage: 'url(/images/background.png)', display: 'flex', alignItems: 'center', flexDirection: 'row', justifyContent: 'center' }}>
<InitialLoading/>
</div>
) |
29d581091804b1f6b4aa55e0b8cc8d96270ab575 | index.js | index.js | 'use strict';
var assign = require('object-assign');
var chalk = require('chalk');
var ProgressBar = require('progress');
/**
* Progress bar download plugin
*
* @param {Object} res
* @api public
*/
module.exports = function (opts) {
return function (res, file) {
opts = opts || { info: 'cyan' };
var msg = chalk[opts.info](' downloading') + ' : ' + file.url;
var info = chalk[opts.info](' progress') + ' : [:bar] :percent :etas';
var len = parseInt(res.headers['content-length'], 10);
var bar = new ProgressBar(info, assign({
complete: '=',
incomplete: ' ',
width: 20,
total: len
}, opts));
console.log(msg);
res.on('data', function (data) {
bar.tick(data.length);
});
res.on('end', function () {
console.log('\n');
});
};
};
| 'use strict';
var assign = require('object-assign');
var chalk = require('chalk');
var ProgressBar = require('progress');
/**
* Progress bar download plugin
*
* @param {Object} res
* @api public
*/
module.exports = function (opts) {
return function (res, file, cb) {
opts = opts || { info: 'cyan' };
var msg = chalk[opts.info](' downloading') + ' : ' + file.url;
var info = chalk[opts.info](' progress') + ' : [:bar] :percent :etas';
var len = parseInt(res.headers['content-length'], 10);
var bar = new ProgressBar(info, assign({
complete: '=',
incomplete: ' ',
width: 20,
total: len
}, opts));
console.log(msg);
res.on('data', function (data) {
bar.tick(data.length);
});
res.on('end', function () {
console.log('\n');
cb();
});
};
};
| Allow other middleware by calling `cb()` | Allow other middleware by calling `cb()`
| JavaScript | mit | kevva/download-status | ---
+++
@@ -12,7 +12,7 @@
*/
module.exports = function (opts) {
- return function (res, file) {
+ return function (res, file, cb) {
opts = opts || { info: 'cyan' };
var msg = chalk[opts.info](' downloading') + ' : ' + file.url;
@@ -34,6 +34,7 @@
res.on('end', function () {
console.log('\n');
+ cb();
});
};
}; |
79923a9af19fd1b6b7ecb2ee984736404d8f0504 | test/TestServer/UnitTestConfig.js | test/TestServer/UnitTestConfig.js | // Some user-accessible config for unit tests
// Format is: { platform:{ ...settings.. } }
// numDevices - The number of devices the server will start a test with
// Any other devices after that will just be ignored
var config = {
ios: {
numDevices:2
},
android: {
numDevices:0
}
}
module.exports = config;
| // Some user-accessible config for unit tests
// Format is: { platform:{ ...settings.. } }
// numDevices - The number of devices the server will start a test with (-1 == all devices)
// Any other devices after that will just be ignored
// Note: Unit tests are designed to require just two devices
var config = {
ios: {
numDevices:2
},
android: {
numDevices:2
}
}
module.exports = config;
| Add android devices back in | Add android devices back in
| JavaScript | mit | thaliproject/Thali_CordovaPlugin,thaliproject/Thali_CordovaPlugin,thaliproject/Thali_CordovaPlugin,thaliproject/Thali_CordovaPlugin,thaliproject/Thali_CordovaPlugin | ---
+++
@@ -1,15 +1,16 @@
// Some user-accessible config for unit tests
// Format is: { platform:{ ...settings.. } }
-// numDevices - The number of devices the server will start a test with
+// numDevices - The number of devices the server will start a test with (-1 == all devices)
// Any other devices after that will just be ignored
+// Note: Unit tests are designed to require just two devices
var config = {
ios: {
numDevices:2
},
android: {
- numDevices:0
+ numDevices:2
}
}
|
dc9375c8faa47f915d24aaf6ebc1e67a431fa1b9 | index.js | index.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function accesorString(value) {
var depths = value.split(".");
var length = depths.length;
var result = "";
for (var i = 0; i < length; i++) {
result += "[" + JSON.stringify(depths[i]) + "]";
}
return result;
}
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
if(!this.query) throw new Error("query parameter is missing");
return "module.exports = " +
"global" + accesorString(this.query.substr(1)) + " = " +
"require(" + JSON.stringify("-!" + remainingRequest) + ");";
}; | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function accesorString(value) {
var childProperties = value.split(".");
var length = childProperties.length;
var propertyString = "global";
var result = "";
for (var i = 0; i < length; i++) {
propertyString += "[" + JSON.stringify(childProperties[i]) + "]";
result += "if(!" + propertyString + ") " + propertyString + " = {};";
}
result += "module.exports = " + propertyString;
return result;
}
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
if(!this.query) throw new Error("query parameter is missing");
return accesorString(this.query.substr(1)) + " = " +
"require(" + JSON.stringify("-!" + remainingRequest) + ");";
}; | Check if child property exists prior to adding to property | Check if child property exists prior to adding to property
| JavaScript | mit | wuxiandiejia/expose-loader | ---
+++
@@ -4,14 +4,17 @@
*/
function accesorString(value) {
- var depths = value.split(".");
- var length = depths.length;
+ var childProperties = value.split(".");
+ var length = childProperties.length;
+ var propertyString = "global";
var result = "";
for (var i = 0; i < length; i++) {
- result += "[" + JSON.stringify(depths[i]) + "]";
+ propertyString += "[" + JSON.stringify(childProperties[i]) + "]";
+ result += "if(!" + propertyString + ") " + propertyString + " = {};";
}
+ result += "module.exports = " + propertyString;
return result;
}
@@ -19,7 +22,6 @@
module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
if(!this.query) throw new Error("query parameter is missing");
- return "module.exports = " +
- "global" + accesorString(this.query.substr(1)) + " = " +
+ return accesorString(this.query.substr(1)) + " = " +
"require(" + JSON.stringify("-!" + remainingRequest) + ");";
}; |
ecddfbde7f0a484e13b3118615d125796fb8e949 | test/api/routes/homeRoute.test.js | test/api/routes/homeRoute.test.js | /**
* Copyright (c) 2013-2015 Memba Sarl. All rights reserved.
* Sources at https://github.com/Memba
*/
/* jshint node: true, expr: true */
/* globals describe: false, before: false, it: false */
'use strict';
var request = require('supertest'),
//We cannot define app like this because the server is already running
//app = request('../../../webapp/server');
config = require('../../../webapp/config'),
app = config.get('uris:webapp:root');
describe('routes/homeRoute', function() {
it('it should return the home page', function(done) {
request(app)
.get('/')
.expect(200)
.expect('Content-Type', /html/)
.end(done);
});
});
| /**
* Copyright (c) 2013-2015 Memba Sarl. All rights reserved.
* Sources at https://github.com/Memba
*/
/* jshint node: true, expr: true */
/* globals describe: false, before: false, it: false */
'use strict';
var request = require('supertest'),
//We cannot define app like this because the server is already running
//app = request('../../../webapp/server');
config = require('../../../webapp/config'),
app = config.get('uris:webapp:root');
describe('routes/homeRoute', function() {
it('it should return the home page', function(done) {
request(app)
.get(config.get('uris:webapp:home'))
.expect(200)
.expect('Content-Type', /html/)
.end(done);
});
});
| Use config to build paths | Use config to build paths
| JavaScript | agpl-3.0 | Memba/Memba-Blog,Memba/Memba-Blog,Memba/Memba-Blog | ---
+++
@@ -21,7 +21,7 @@
it('it should return the home page', function(done) {
request(app)
- .get('/')
+ .get(config.get('uris:webapp:home'))
.expect(200)
.expect('Content-Type', /html/)
.end(done); |
ca08af4d5eb1c48698fa52f1b8b651fca4525b60 | migrations/20170515084345_taxonomy_term_data.js | migrations/20170515084345_taxonomy_term_data.js |
exports.up = function(knex, Promise) {
return knex.schema.createTable('taxonomy_term_data', function (table) {
table.increments('id').primary()
table.integer('id_vocabulary').unsigned()
table.foreign('id_vocabulary').references('taxonomy_vocabulary.id')
table.string('title')
table.text('description', 'mediumtext')
})
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('taxonomy')
};
|
exports.up = function (knex, Promise) {
return knex.schema.createTable('taxonomy_term_data', function (table) {
table.increments('id').primary()
table.integer('id_vocabulary').unsigned()
table.foreign('id_vocabulary').references('taxonomy_vocabulary.id')
table.string('title')
table.text('description', 'mediumtext')
})
}
exports.down = function (knex, Promise) {
return knex.schema.dropTable('taxonomy')
}
| Edit content structure to knex taxonomy_term_data migration file | Edit content structure to knex taxonomy_term_data migration file
| JavaScript | mit | smanongga/smanongga.github.io,smanongga/smanongga.github.io,smanongga/smanongga.github.io | ---
+++
@@ -1,5 +1,5 @@
-exports.up = function(knex, Promise) {
+exports.up = function (knex, Promise) {
return knex.schema.createTable('taxonomy_term_data', function (table) {
table.increments('id').primary()
table.integer('id_vocabulary').unsigned()
@@ -7,8 +7,8 @@
table.string('title')
table.text('description', 'mediumtext')
})
-};
+}
-exports.down = function(knex, Promise) {
+exports.down = function (knex, Promise) {
return knex.schema.dropTable('taxonomy')
-};
+} |
457a6fe779b4921c88d436a35cdf4fb9f0a9d02b | test/generators/root/indexTest.js | test/generators/root/indexTest.js | 'use strict';
let path = require('path');
let assert = require('yeoman-generator').assert;
let helpers = require('yeoman-generator').test
describe('react-webpack-redux:root', () => {
let generatorDispatcher = path.join(__dirname, '../../../generators/root');
/**
* Return a newly generated dispatcher with given name
* @param {String} name
* @param {Function} callback
*/
function createGeneratedDispatcher(name, callback) {
helpers.run(generatorDispatcher)
.withArguments([name])
.on('end', callback);
}
it('should create the root reducer and redux store when invoked', (done) => {
createGeneratedDispatcher('Dispatcher', () => {
assert.file([
'src/stores/index.js',
'src/reducers/index.js',
'src/constants/ActionTypes.js'
]);
done();
});
});
});
| 'use strict';
let path = require('path');
let assert = require('yeoman-generator').assert;
let helpers = require('yeoman-generator').test
describe('react-webpack-redux:root', () => {
let generatorDispatcher = path.join(__dirname, '../../../generators/root');
/**
* Return a newly generated dispatcher with given name
* @param {String} name
* @param {Function} callback
*/
function createGeneratedDispatcher(name, callback) {
helpers.run(generatorDispatcher)
.withArguments([name])
.on('end', callback);
}
it('should create the root reducer, redux store and custom run.js', (done) => {
createGeneratedDispatcher('Dispatcher', () => {
assert.file([
'src/stores/index.js',
'src/reducers/index.js',
'src/components/run.js'
]);
done();
});
});
});
| Check that the run script has been written | Check that the run script has been written
| JavaScript | mit | stylesuxx/generator-react-webpack-redux,stylesuxx/generator-react-webpack-redux | ---
+++
@@ -18,14 +18,14 @@
.on('end', callback);
}
- it('should create the root reducer and redux store when invoked', (done) => {
+ it('should create the root reducer, redux store and custom run.js', (done) => {
createGeneratedDispatcher('Dispatcher', () => {
assert.file([
'src/stores/index.js',
'src/reducers/index.js',
- 'src/constants/ActionTypes.js'
+ 'src/components/run.js'
]);
done(); |
e64e0e8cd275c108d9766d4062d4eab77984212f | spec/specs.js | spec/specs.js | describe('pingPong', function() {
it("is true for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal(true);
});
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
});
| describe('pingPong', function() {
it("is true for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal(true);
});
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
it("is false for a number that is not divisible by 3 or 5", function() {
expect(pingPong(8)).to.equal(false);
});
});
| Add a test for userNumbers not divisible by 3 or 5 | Add a test for userNumbers not divisible by 3 or 5
| JavaScript | mit | kcmdouglas/pingpong,kcmdouglas/pingpong | ---
+++
@@ -5,4 +5,7 @@
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
+ it("is false for a number that is not divisible by 3 or 5", function() {
+ expect(pingPong(8)).to.equal(false);
+ });
}); |
fff9513aa9d0590679875ed3c3c4c0b080305c89 | app/assets/javascripts/leap.js | app/assets/javascripts/leap.js | //document.observe("dom:loaded", function(){
// if ($('flash_notice')){
// Element.fade.delay(4,'flash_notice');
// }
// if ($('q')) {
// $('q').activate();
// if ($('search_extended')) {
// $('search_extended').observe("click", function(event){
// $('search_form').submit();
// })
// }
// }
//$('person_photo').down('img').observe("load", function(event){
// event.findElement('img').appear();
//)
// $('person_photo').down('img').observe("mouseover", function(event){
// event.findElement('img').shake({distance : 2});
// })
// $$('.timetable_event').each(function(e){
// e.observe('mouseover', function(event){
// event.findElement('.timetable_event').addClassName('extended')
// })
// e.observe('mouseout', function(event){
// event.findElement('.timetable_event').removeClassName('extended')
// })
// })
//})
$(document).ready(function(){
$('#person_photo').mouseenter(function(){
$('#person_photo img').fadeOut()
})
$('#person_photo').mouseenter(function(){
$('#person_photo img').fadeIn()
})
})
| //document.observe("dom:loaded", function(){
// if ($('flash_notice')){
// Element.fade.delay(4,'flash_notice');
// }
// if ($('q')) {
// $('q').activate();
// if ($('search_extended')) {
// $('search_extended').observe("click", function(event){
// $('search_form').submit();
// })
// }
// }
//$('person_photo').down('img').observe("load", function(event){
// event.findElement('img').appear();
//)
// $('person_photo').down('img').observe("mouseover", function(event){
// event.findElement('img').shake({distance : 2});
// })
// $$('.timetable_event').each(function(e){
// e.observe('mouseover', function(event){
// event.findElement('.timetable_event').addClassName('extended')
// })
// e.observe('mouseout', function(event){
// event.findElement('.timetable_event').removeClassName('extended')
// })
// })
//})
$(document).ready(function(){
$('#flash_notice').delay(4000).fadeOut()
})
| Put the notice fade back in | Put the notice fade back in
| JavaScript | agpl-3.0 | sdc/leap,sdc/leap,sdc-webteam-deploy/leap,sdc/leap,sdc-webteam-deploy/leap,sdc-webteam-deploy/leap,sdc-webteam-deploy/leap,sdc/leap | ---
+++
@@ -26,10 +26,5 @@
// })
//})
$(document).ready(function(){
- $('#person_photo').mouseenter(function(){
- $('#person_photo img').fadeOut()
- })
- $('#person_photo').mouseenter(function(){
- $('#person_photo img').fadeIn()
- })
+ $('#flash_notice').delay(4000).fadeOut()
}) |
e252bd17fbbb174182fb322de6138bc6fe53f599 | index.js | index.js | module.exports = (addDays = 0) => {
let date = new Date();
date.setDate(date.getDate() + addDays);
date.setUTCHours(0);
date.setUTCMinutes(0);
date.setUTCSeconds(0);
date.setUTCMilliseconds(0);
return date;
};
| module.exports = (addDays = 0, sinceDate = new Date()) => {
let date = new Date(sinceDate);
date.setDate(date.getDate() + addDays);
date.setUTCHours(0);
date.setUTCMinutes(0);
date.setUTCSeconds(0);
date.setUTCMilliseconds(0);
return date;
};
| Allow passing in initial date | Allow passing in initial date
| JavaScript | mit | MartinKolarik/relative-day-utc | ---
+++
@@ -1,5 +1,5 @@
-module.exports = (addDays = 0) => {
- let date = new Date();
+module.exports = (addDays = 0, sinceDate = new Date()) => {
+ let date = new Date(sinceDate);
date.setDate(date.getDate() + addDays);
date.setUTCHours(0);
date.setUTCMinutes(0); |
9d6ff0ae59a2314b457475706a4e6f2b5362ff33 | app/configurations/settings.js | app/configurations/settings.js | /* @flow */
'use strict';
export const settings = {
API_BASE_URL: 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/',
API_KEY: 'jVDiaXvfpsmshdrtFO7JHibo7Hrtp16UelPjsnBE4Bfzl0CV5u'
}; | /* @flow */
'use strict';
export const settings = {
API_BASE_URL: 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/',
API_KEY: 'jVDiaXvfpsmshdrtFO7JHibo7Hrtp16UelPjsnBE4Bfzl0CV5u'
}; | Add API base url and key | Add API base url and key
| JavaScript | bsd-3-clause | hippothesis/Recipezy,hippothesis/Recipezy,hippothesis/Recipezy | ---
+++
@@ -3,6 +3,6 @@
'use strict';
export const settings = {
- API_BASE_URL: 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/',
+ API_BASE_URL: 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/',
API_KEY: 'jVDiaXvfpsmshdrtFO7JHibo7Hrtp16UelPjsnBE4Bfzl0CV5u'
}; |
b316098cd7e6985bc17bbda872e9e4beefb2e479 | website/src/app/project/experiments/experiment/components/tasks/current-task.service.js | website/src/app/project/experiments/experiment/components/tasks/current-task.service.js | class CurrentTask {
constructor() {
this.currentTask = null;
}
get() {
return this.currentTask;
}
set(task) {
this.currentTask = task;
}
}
angular.module('materialscommons').service('currentTask', CurrentTask);
| class CurrentTask {
constructor() {
this.currentTask = null;
this.onChangeFN = null;
}
setOnChange(fn) {
this.onChangeFN = fn;
}
get() {
return this.currentTask;
}
set(task) {
this.currentTask = task;
if (this.onChangeFN) {
this.onChangeFN();
}
}
}
angular.module('materialscommons').service('currentTask', CurrentTask);
| Add setOnChange that allows a controller to set a function to call when the currentTask changes. | Add setOnChange that allows a controller to set a function to call when the currentTask changes.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -1,6 +1,11 @@
class CurrentTask {
constructor() {
this.currentTask = null;
+ this.onChangeFN = null;
+ }
+
+ setOnChange(fn) {
+ this.onChangeFN = fn;
}
get() {
@@ -9,6 +14,9 @@
set(task) {
this.currentTask = task;
+ if (this.onChangeFN) {
+ this.onChangeFN();
+ }
}
}
|
4db4e1b3f9e13c8faa2449a231669ca047b79572 | client/src/Account/index.js | client/src/Account/index.js | import React from 'react';
import { PasswordForgetForm } from '../PasswordForget';
import PasswordChangeForm from '../PasswordChange';
import { AuthUserContext, withAuthorization } from '../Session';
const AccountPage = () => (
<AuthUserContext.Consumer>
{authUser => (
<div>
<h1>Account: {authUser.email}</h1>
<PasswordForgetForm />
<PasswordChangeForm />
</div>
)}
</AuthUserContext.Consumer>
);
const condition = authUser => !!authUser;
export default withAuthorization(condition)(AccountPage);
| import React from 'react';
import PasswordChangeForm from '../PasswordChange';
import { AuthUserContext, withAuthorization } from '../Session';
const AccountPage = () => (
<AuthUserContext.Consumer>
{authUser => (
<div>
<h1>Account: {authUser.email}</h1>
<PasswordChangeForm />
</div>
)}
</AuthUserContext.Consumer>
);
const condition = authUser => !!authUser;
export default withAuthorization(condition)(AccountPage);
| Remove extra form from account page. | Remove extra form from account page.
| JavaScript | apache-2.0 | googleinterns/Pictophone,googleinterns/Pictophone,googleinterns/Pictophone,googleinterns/Pictophone | ---
+++
@@ -1,6 +1,5 @@
import React from 'react';
-import { PasswordForgetForm } from '../PasswordForget';
import PasswordChangeForm from '../PasswordChange';
import { AuthUserContext, withAuthorization } from '../Session';
@@ -9,7 +8,6 @@
{authUser => (
<div>
<h1>Account: {authUser.email}</h1>
- <PasswordForgetForm />
<PasswordChangeForm />
</div>
)} |
aff3ad78cd1e04e26f9618cdb58bf0e477768f95 | lib/polyfill/all.js | lib/polyfill/all.js | /** @license
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.polyfill');
goog.require('shaka.util.Iterables');
/**
* @summary A one-stop installer for all polyfills.
* @see http://enwp.org/polyfill
* @exportDoc
*/
shaka.polyfill = class {
/**
* Install all polyfills.
* @export
*/
static installAll() {
for (const polyfill of shaka.polyfill.polyfills_) {
polyfill.callback();
}
}
/**
* Registers a new polyfill to be installed.
*
* @param {function()} polyfill
* @param {number=} priority An optional number priority. Higher priorities
* will be executed before lower priority ones. Default is 0.
* @export
*/
static register(polyfill, priority) {
const newItem = {priority: priority || 0, callback: polyfill};
const enumerate = (it) => shaka.util.Iterables.enumerate(it);
for (const {i, item} of enumerate(shaka.polyfill.polyfills_)) {
if (item.priority < newItem.priority) {
shaka.polyfill.polyfills_.splice(i, 0, newItem);
return;
}
}
shaka.polyfill.polyfills_.push(newItem);
}
};
/**
* Contains the polyfills that will be installed.
* @private {!Array.<{priority: number, callback: function()}>}
*/
shaka.polyfill.polyfills_ = [];
| /** @license
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.polyfill');
goog.require('shaka.util.Iterables');
/**
* @summary A one-stop installer for all polyfills.
* @see http://enwp.org/polyfill
* @exportInterface
*/
shaka.polyfill = class {
/**
* Install all polyfills.
* @export
*/
static installAll() {
for (const polyfill of shaka.polyfill.polyfills_) {
polyfill.callback();
}
}
/**
* Registers a new polyfill to be installed.
*
* @param {function()} polyfill
* @param {number=} priority An optional number priority. Higher priorities
* will be executed before lower priority ones. Default is 0.
* @export
*/
static register(polyfill, priority) {
const newItem = {priority: priority || 0, callback: polyfill};
const enumerate = (it) => shaka.util.Iterables.enumerate(it);
for (const {i, item} of enumerate(shaka.polyfill.polyfills_)) {
if (item.priority < newItem.priority) {
shaka.polyfill.polyfills_.splice(i, 0, newItem);
return;
}
}
shaka.polyfill.polyfills_.push(newItem);
}
};
/**
* Contains the polyfills that will be installed.
* @private {!Array.<{priority: number, callback: function()}>}
*/
shaka.polyfill.polyfills_ = [];
| Fix shaka.polyfill missing in externs | Fix shaka.polyfill missing in externs
The generated externs did not include shaka.polyfill because we used
the wrong annotation on the class. This fixes it.
Raised in PR #1273
Change-Id: I348064a117a7e1878b439ad8bd1ce49df56bfd39
| JavaScript | apache-2.0 | shaka-project/shaka-player,tvoli/shaka-player,shaka-project/shaka-player,shaka-project/shaka-player,tvoli/shaka-player,tvoli/shaka-player,shaka-project/shaka-player,tvoli/shaka-player | ---
+++
@@ -11,7 +11,7 @@
/**
* @summary A one-stop installer for all polyfills.
* @see http://enwp.org/polyfill
- * @exportDoc
+ * @exportInterface
*/
shaka.polyfill = class {
/** |
8ca1ad8a0ca0644d114e509c7accadd3e1fa460d | lib/post_install.js | lib/post_install.js | #!/usr/bin/env node
// adapted based on rackt/history (MIT)
var execSync = require('child_process').execSync;
var stat = require('fs').stat;
function exec(command) {
execSync(command, {
stdio: [0, 1, 2]
});
}
stat('dist-modules', function(error, stat) {
if (error || !stat.isDirectory()) {
exec('npm run dist-modules');
}
});
| #!/usr/bin/env node
// adapted based on rackt/history (MIT)
var execSync = require('child_process').execSync;
var stat = require('fs').stat;
function exec(command) {
execSync(command, {
stdio: [0, 1, 2]
});
}
stat('dist-modules', function(error, stat) {
if (error || !stat.isDirectory()) {
exec('npm i babel');
exec('npm run dist-modules');
}
});
| Install Babel before generating `dist-modules` | Install Babel before generating `dist-modules`
Otherwise it will rely on globally installed Babel. Not good.
| JavaScript | mit | rdoh/reactabular,reactabular/reactabular,reactabular/reactabular | ---
+++
@@ -11,6 +11,7 @@
stat('dist-modules', function(error, stat) {
if (error || !stat.isDirectory()) {
+ exec('npm i babel');
exec('npm run dist-modules');
}
}); |
21e70737e4499c164b04095568ff748b6c0ff32a | app/services/scores.service.js | app/services/scores.service.js | (function(){
angular
.module("movieMash")
.factory("scoreService",scoreService);
scoreService.$inject=['localStorageService','$firebaseArray','firebaseDataService'];
function scoreService(localStorageService,$firebaseArray,firebaseDataService){
var scoresSyncArray = $firebaseArray(firebaseDataService.scores);
var service={
getAllScores:getAllScores,
addPointToMovie:addPointToMovie,
removePointToMovie:removePointToMovie
};
return service;
function getAllScores(){
return scoresSyncArray;
}
function addPointToMovie(movie){
var movieObj = scoresSyncArray.$getRecord(movie.id);
if(movieObj){
movieObj.points ++;
scoresSyncArray.$save({movieObj});
}else{
scoresSyncArray.$add({
$id:movie.id,
movie:movie,
points:1
});
}
}
function removePointToMovie(movie){
var points = localStorageService.get(movie.id) ? localStorageService.get(movie.id).points : 0;
points --;
localStorageService.set(movie.id,{movie:movie,points:points});
}
}
})(); | (function(){
angular
.module("movieMash")
.factory("scoreService",scoreService);
scoreService.$inject=['localStorageService','$firebaseArray','firebaseDataService'];
function scoreService(localStorageService,$firebaseArray,firebaseDataService){
var scoresSyncArray = $firebaseArray(firebaseDataService.scores);
var service={
getAllScores:getAllScores,
addPointToMovie:addPointToMovie,
removePointToMovie:removePointToMovie
};
return service;
function getAllScores(){
return scoresSyncArray;
}
function addPointToMovie(movie){
var movieObj = scoresSyncArray.$getRecord(movie.id);
if(movieObj){
movieObj.points ++;
scoresSyncArray.$save({movieObj});
}else{
scoresSyncArray.$ref().child(movie.id).set({
movie:movie,
points:1
});
}
}
function removePointToMovie(movie){
var points = localStorageService.get(movie.id) ? localStorageService.get(movie.id).points : 0;
points --;
localStorageService.set(movie.id,{movie:movie,points:points});
}
}
})(); | Fix an bug into the id generation for a score record. | Fix an bug into the id generation for a score record.
| JavaScript | mit | emyann/MovieMash,emyann/MovieMash | ---
+++
@@ -24,8 +24,7 @@
movieObj.points ++;
scoresSyncArray.$save({movieObj});
}else{
- scoresSyncArray.$add({
- $id:movie.id,
+ scoresSyncArray.$ref().child(movie.id).set({
movie:movie,
points:1
}); |
8a64a017121b4f5e0e32f7ffe3aae3519f3e4697 | routes/event.js | routes/event.js | var express = require('express');
var router = express.Router();
var endpoint = require('../app/endpoint');
router.get('/event/:name/:args(*)', function(req, res) {
var e = endpoint('http', 'get', req.params.name);
e({
args: req.params.args,
body: req.body
});
});
module.exports = router;
| var express = require('express');
var router = express.Router();
var endpoint = require('../app/endpoint');
router.get('/event/:name/:args(*)', function(req, res) {
var e = endpoint('http', 'get', req.params.name);
if (!e) return res.status(400).send('The requested endpoint has not been defined.');
e({
args: req.params.args,
body: req.body
});
});
module.exports = router;
| Check if endpoint handler exists. | Check if endpoint handler exists.
| JavaScript | agpl-3.0 | CamiloMM/Noumena,CamiloMM/Noumena,CamiloMM/Noumena | ---
+++
@@ -4,6 +4,7 @@
router.get('/event/:name/:args(*)', function(req, res) {
var e = endpoint('http', 'get', req.params.name);
+ if (!e) return res.status(400).send('The requested endpoint has not been defined.');
e({
args: req.params.args,
body: req.body |
bb29f0cdfce053b339802c3747fa4ee79bdec036 | src/utils/array/Each.js | src/utils/array/Each.js | /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Passes each element in the array to the given callback.
*
* @function Phaser.Utils.Array.Each
* @since 3.4.0
*
* @param {array} array - The array to search.
* @param {function} callback - A callback to be invoked for each item in the array.
* @param {object} context - The context in which the callback is invoked.
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
*
* @return {array} The input array.
*/
var Each = function (array, callback, context)
{
var i;
var args = [ null ];
for (i = 2; i < arguments.length; i++)
{
args.push(arguments[i]);
}
for (i = 0; i < array.length; i++)
{
args[0] = array[i];
callback.apply(context, args);
}
return array;
};
module.exports = Each;
| /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Passes each element in the array to the given callback.
*
* @function Phaser.Utils.Array.Each
* @since 3.4.0
*
* @param {array} array - The array to search.
* @param {function} callback - A callback to be invoked for each item in the array.
* @param {object} context - The context in which the callback is invoked.
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
*
* @return {array} The input array.
*/
var Each = function (array, callback, context)
{
var i;
var args = [ null ];
for (i = 3; i < arguments.length; i++)
{
args.push(arguments[i]);
}
for (i = 0; i < array.length; i++)
{
args[0] = array[i];
callback.apply(context, args);
}
return array;
};
module.exports = Each;
| Fix `context` argument wrongly passed to callback | Fix `context` argument wrongly passed to callback
| JavaScript | mit | spayton/phaser,BeanSeed/phaser,englercj/phaser,BeanSeed/phaser,TukekeSoft/phaser,pixelpicosean/phaser,TukekeSoft/phaser,mahill/phaser,photonstorm/phaser,photonstorm/phaser,mahill/phaser,spayton/phaser,TukekeSoft/phaser | ---
+++
@@ -22,7 +22,7 @@
var i;
var args = [ null ];
- for (i = 2; i < arguments.length; i++)
+ for (i = 3; i < arguments.length; i++)
{
args.push(arguments[i]);
} |
7cd44b68d733217e790766e7759e0d83deb623c3 | public/load-analytics.js | public/load-analytics.js | if (document.location.hostname === "josephduffy.co.uk") {
// Don't load analytics for noanalytics.josephduffy.co.uk or onion service
return;
}
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.josephduffy.co.uk/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
| (function() {
if (document.location.hostname === "josephduffy.co.uk") {
// Don't load analytics for noanalytics.josephduffy.co.uk or onion service
return;
}
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.josephduffy.co.uk/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
})();
| Fix error when no loading analytics | Fix error when no loading analytics
| JavaScript | mit | JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk | ---
+++
@@ -1,17 +1,19 @@
-if (document.location.hostname === "josephduffy.co.uk") {
- // Don't load analytics for noanalytics.josephduffy.co.uk or onion service
- return;
-}
+(function() {
+ if (document.location.hostname === "josephduffy.co.uk") {
+ // Don't load analytics for noanalytics.josephduffy.co.uk or onion service
+ return;
+ }
-var _paq = window._paq || [];
-/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
-_paq.push(["disableCookies"]);
-_paq.push(['trackPageView']);
-_paq.push(['enableLinkTracking']);
-(function() {
- var u="https://analytics.josephduffy.co.uk/";
- _paq.push(['setTrackerUrl', u+'matomo.php']);
- _paq.push(['setSiteId', '1']);
- var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
- g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+ var _paq = window._paq || [];
+ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
+ _paq.push(["disableCookies"]);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function() {
+ var u="https://analytics.josephduffy.co.uk/";
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
+ _paq.push(['setSiteId', '1']);
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+ })();
})(); |
55c0f4c0908ba79f9d54bb197340358398122548 | test/components/streams/DiscoverComponent_test.js | test/components/streams/DiscoverComponent_test.js | import { expect, getRenderedComponent, sinon } from '../../spec_helper'
import { routeActions } from 'react-router-redux'
// import * as MAPPING_TYPES from '../../../src/constants/mapping_types'
import Container, { Discover as Component } from '../../../src/containers/discover/Discover'
function createPropsForComponent(props = {}) {
const defaultProps = {
dispatch: sinon.spy(),
isLoggedIn: false,
params: {},
pathname: '/',
}
return { ...defaultProps, ...props }
}
describe('DiscoverComponent', () => {
describe('#componentWillMount', () => {
it("doesn't redirect logged out users", () => {
const props = createPropsForComponent()
const comp = getRenderedComponent(Component, props)
expect(props.dispatch.callCount).to.equal(0)
})
it('redirects logged in users to /following by default', () => {
const props = createPropsForComponent({
isLoggedIn: true,
})
getRenderedComponent(Component, props)
const routeAction = routeActions.replace('/following')
const routeDispatch = props.dispatch.firstCall
expect(routeDispatch.args[0]).to.eql(routeAction)
})
it('otherwise redirects users to their last active stream', () => {
const props = createPropsForComponent({
isLoggedIn: true,
currentStream: '/discover/trending',
})
getRenderedComponent(Component, props)
const routeAction = routeActions.replace('/discover/trending')
const routeDispatch = props.dispatch.firstCall
expect(routeDispatch.args[0]).to.eql(routeAction)
})
})
})
| import { expect, getRenderedComponent, sinon } from '../../spec_helper'
import { routeActions } from 'react-router-redux'
import { Discover as Component } from '../../../src/containers/discover/Discover'
function createPropsForComponent(props = {}) {
const defaultProps = {
dispatch: sinon.spy(),
isLoggedIn: false,
params: {},
pathname: '/',
}
return { ...defaultProps, ...props }
}
describe('DiscoverComponent', () => {
describe('#componentWillMount', () => {
it("doesn't redirect logged out users", () => {
const props = createPropsForComponent()
getRenderedComponent(Component, props)
expect(props.dispatch.callCount).to.equal(0)
})
expect(props.dispatch.callCount).to.equal(0)
})
it('redirects logged in users to /following by default', () => {
const props = createPropsForComponent({
isLoggedIn: true,
})
getRenderedComponent(Component, props)
const routeAction = routeActions.replace('/following')
const routeDispatch = props.dispatch.firstCall
expect(routeDispatch.args[0]).to.eql(routeAction)
})
it('otherwise redirects users to their last active stream', () => {
const props = createPropsForComponent({
isLoggedIn: true,
currentStream: '/discover/trending',
})
getRenderedComponent(Component, props)
const routeAction = routeActions.replace('/discover/trending')
const routeDispatch = props.dispatch.firstCall
expect(routeDispatch.args[0]).to.eql(routeAction)
})
})
})
| Clean up some code mess | Clean up some code mess
| JavaScript | mit | ello/webapp,ello/webapp,ello/webapp | ---
+++
@@ -1,7 +1,7 @@
import { expect, getRenderedComponent, sinon } from '../../spec_helper'
import { routeActions } from 'react-router-redux'
-// import * as MAPPING_TYPES from '../../../src/constants/mapping_types'
-import Container, { Discover as Component } from '../../../src/containers/discover/Discover'
+
+import { Discover as Component } from '../../../src/containers/discover/Discover'
function createPropsForComponent(props = {}) {
const defaultProps = {
@@ -18,7 +18,9 @@
describe('#componentWillMount', () => {
it("doesn't redirect logged out users", () => {
const props = createPropsForComponent()
- const comp = getRenderedComponent(Component, props)
+ getRenderedComponent(Component, props)
+ expect(props.dispatch.callCount).to.equal(0)
+ })
expect(props.dispatch.callCount).to.equal(0)
})
|
19a3015ebaf0d9d058eecff620cc38b7f4008a0d | assets/javascripts/resume.js | assets/javascripts/resume.js | ---
layout: null
---
jQuery(document).ready(function($) {
/* Method 2: */
/* var isFirefox = /^((?!chrome|android).)*firefox/i.test(navigator.userAgent); */
$("#btn-print").click(function() {
/* Method 1:*/
if (navigator.vendor == "" || navigator.vendor == undefined) {
alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
} else{
window.print();
return false;
}
/* Method 2: */
/*if (isFirefox == true) {
alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
} else {
window.print();
return false;
}*/
});
}); | ---
layout: null
---
jQuery(document).ready(function($) {
if (navigator.vendor == "" || navigator.vendor == undefined) {
function show_alert(){
alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
return false;
}
function verifyButtonCtrl(oEvent){
var oEvent = oEvent ? oEvent : window.event;
var tecla = (oEvent.keyCode) ? oEvent.keyCode : oEvent.which;
if(tecla == 17 || tecla == 44|| tecla == 106){
show_alert();
}
}
document.onkeypress = verifyButtonCtrl;
document.onkeydown = verifyButtonCtrl;
$("#btn-print").click(function() {
show_alert();
});
} else {
$("#btn-print").click(function() {
window.print();
return false;
});
}
/* Method 2: */
/* var isFirefox = /^((?!chrome|android).)*firefox/i.test(navigator.userAgent); */
/*if (isFirefox == true) {
alert("incompatible");
} */
}); | Update - sΓ‘b nov 11 19:54:37 -02 2017 | Update - sΓ‘b nov 11 19:54:37 -02 2017
| JavaScript | mit | williamcanin/williamcanin.github.io,williamcanin/williamcanin.github.io,williamcanin/williamcanin.github.io,williamcanin/williamcanin.github.io | ---
+++
@@ -3,22 +3,37 @@
---
jQuery(document).ready(function($) {
- /* Method 2: */
- /* var isFirefox = /^((?!chrome|android).)*firefox/i.test(navigator.userAgent); */
+
+
+ if (navigator.vendor == "" || navigator.vendor == undefined) {
+ function show_alert(){
+ alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
+ return false;
+ }
+ function verifyButtonCtrl(oEvent){
+ var oEvent = oEvent ? oEvent : window.event;
+ var tecla = (oEvent.keyCode) ? oEvent.keyCode : oEvent.which;
+ if(tecla == 17 || tecla == 44|| tecla == 106){
+ show_alert();
+ }
+ }
+ document.onkeypress = verifyButtonCtrl;
+ document.onkeydown = verifyButtonCtrl;
+
$("#btn-print").click(function() {
- /* Method 1:*/
- if (navigator.vendor == "" || navigator.vendor == undefined) {
- alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
- } else{
- window.print();
- return false;
- }
- /* Method 2: */
- /*if (isFirefox == true) {
- alert("This Browser is not printable with this page. If you print with Ctrl + P, errors will appear in the page structure. We recommend 'Google Chrome' or 'Safari'. \n\n(Este Navegador nΓ£o Γ© compΓ‘tivel com impressΓ£o desta pΓ‘gina. Caso imprima com Ctrl+P, aparecerΓ‘ erros na estrutura da pΓ‘gina. Recomendamos o 'Google Chrome' ou 'Safari'.)");
- } else {
- window.print();
- return false;
- }*/
- });
+ show_alert();
+ });
+ } else {
+ $("#btn-print").click(function() {
+ window.print();
+ return false;
+ });
+ }
+
+/* Method 2: */
+/* var isFirefox = /^((?!chrome|android).)*firefox/i.test(navigator.userAgent); */
+/*if (isFirefox == true) {
+ alert("incompatible");
+} */
+
}); |
c59f159f18f7a26d000e94e1fe5bd62687e886c5 | jest.config.js | jest.config.js | const path = require('path')
module.exports = {
globals: {
'ts-jest': {
tsConfig: '<rootDir>/src/tsconfig.test.json'
}
},
setupFiles: ['<rootDir>/src/bp/jest-before.ts'],
globalSetup: '<rootDir>/src/bp/jest-rewire.ts',
setupFilesAfterEnv: [],
collectCoverage: false,
resetModules: true,
verbose: true,
modulePaths: ['<rootDir>/src/bp/'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx'],
transform: {
'^.+\\.(ts|tsx|js)$': 'ts-jest'
},
resolver: '<rootDir>/src/bp/jest-resolver.js',
moduleNameMapper: {
'^botpress/sdk$': '<rootDir>/src/bp/core/sdk_impl'
},
testMatch: ['**/modules/nlu/(src|test)/**/*.test.(ts|js)'],
testPathIgnorePatterns: ['out', 'build', 'node_modules'],
testEnvironment: 'node',
rootDir: '.',
preset: 'ts-jest',
testResultsProcessor: './node_modules/jest-html-reporter'
}
| const path = require('path')
module.exports = {
globals: {
'ts-jest': {
tsConfig: '<rootDir>/src/tsconfig.test.json'
}
},
setupFiles: ['<rootDir>/src/bp/jest-before.ts'],
globalSetup: '<rootDir>/src/bp/jest-rewire.ts',
setupFilesAfterEnv: [],
collectCoverage: false,
resetModules: true,
verbose: true,
modulePaths: ['<rootDir>/src/bp/'],
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx'],
transform: {
'^.+\\.(ts|tsx|js)$': 'ts-jest'
},
resolver: '<rootDir>/src/bp/jest-resolver.js',
moduleNameMapper: {
'^botpress/sdk$': '<rootDir>/src/bp/core/sdk_impl'
},
testMatch: ['**/(src|test)/**/*.test.(ts|js)'],
testPathIgnorePatterns: ['out', 'build', 'node_modules'],
testEnvironment: 'node',
rootDir: '.',
preset: 'ts-jest',
testResultsProcessor: './node_modules/jest-html-reporter'
}
| Put proper path to project tests | Put proper path to project tests
| JavaScript | agpl-3.0 | botpress/botpress,botpress/botpress,botpress/botpress,botpress/botpress | ---
+++
@@ -21,7 +21,7 @@
moduleNameMapper: {
'^botpress/sdk$': '<rootDir>/src/bp/core/sdk_impl'
},
- testMatch: ['**/modules/nlu/(src|test)/**/*.test.(ts|js)'],
+ testMatch: ['**/(src|test)/**/*.test.(ts|js)'],
testPathIgnorePatterns: ['out', 'build', 'node_modules'],
testEnvironment: 'node',
rootDir: '.', |
a341760e3945404a64f597580df23dbcfe226a54 | app/app.js | app/app.js | 'use strict';
// Declare app level module which depends on views, and components
angular.module('myApp', [
'ngRoute',
'drupalService',
'myApp.node_add',
'myApp.node_nid',
'myApp.node',
'myApp.taxonomy_term'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/node'});
}]);
| 'use strict';
// Declare app level module which depends on views, and components
angular
.module('myApp', [
'ngRoute',
'drupalService',
'myApp.node_add',
'myApp.node_nid',
'myApp.node',
'myApp.taxonomy_term',
'myApp.node_lifecycle'
]).
config(['$routeProvider', function ($routeProvider) {
$routeProvider.otherwise({redirectTo: '/node'});
}])
// http://stackoverflow.com/questions/17893708/angularjs-textarea-bind-to-json-object-shows-object-object
.directive('jsonText', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attr, ngModel) {
function into(input) {
return JSON.parse(input);
}
function out(data) {
return JSON.stringify(data, null, 2);
}
ngModel.$parsers.push(into);
ngModel.$formatters.push(out);
scope.$watch(attr.ngModel, function (newValue) {
element[0].value = out(newValue);
}, true);
}
};
});
| Add two way textarea binding. | Add two way textarea binding.
| JavaScript | mit | clemens-tolboom/drupal-8-rest-angularjs,clemens-tolboom/drupal-8-rest-angularjs | ---
+++
@@ -1,14 +1,38 @@
'use strict';
// Declare app level module which depends on views, and components
-angular.module('myApp', [
- 'ngRoute',
- 'drupalService',
- 'myApp.node_add',
- 'myApp.node_nid',
- 'myApp.node',
- 'myApp.taxonomy_term'
-]).
-config(['$routeProvider', function($routeProvider) {
- $routeProvider.otherwise({redirectTo: '/node'});
-}]);
+angular
+ .module('myApp', [
+ 'ngRoute',
+ 'drupalService',
+ 'myApp.node_add',
+ 'myApp.node_nid',
+ 'myApp.node',
+ 'myApp.taxonomy_term',
+ 'myApp.node_lifecycle'
+ ]).
+ config(['$routeProvider', function ($routeProvider) {
+ $routeProvider.otherwise({redirectTo: '/node'});
+ }])
+ // http://stackoverflow.com/questions/17893708/angularjs-textarea-bind-to-json-object-shows-object-object
+ .directive('jsonText', function () {
+ return {
+ restrict: 'A',
+ require: 'ngModel',
+ link: function (scope, element, attr, ngModel) {
+ function into(input) {
+ return JSON.parse(input);
+ }
+
+ function out(data) {
+ return JSON.stringify(data, null, 2);
+ }
+
+ ngModel.$parsers.push(into);
+ ngModel.$formatters.push(out);
+ scope.$watch(attr.ngModel, function (newValue) {
+ element[0].value = out(newValue);
+ }, true);
+ }
+ };
+ }); |
88f86838b7f7f926e5df349edcd6461284fde181 | jest.config.js | jest.config.js | module.exports = {
testEnvironment: 'node',
preset: '@shelf/jest-mongodb'
}
| module.exports = {
testEnvironment: 'node',
preset: '@shelf/jest-mongodb',
roots: ['src']
}
| Add root to prevent infinite loop in watch | Add root to prevent infinite loop in watch
| JavaScript | mit | synzen/Discord.RSS,synzen/Discord.RSS | ---
+++
@@ -1,4 +1,5 @@
module.exports = {
testEnvironment: 'node',
- preset: '@shelf/jest-mongodb'
+ preset: '@shelf/jest-mongodb',
+ roots: ['src']
} |
debb0af80d5e3cde2d55b3076cc8a25a824d16c8 | scripts/models/graphs-model.js | scripts/models/graphs-model.js | // TODO: This is not a real model or controller
App.Graphs = Ember.Controller.extend({
graph: function(emberId, entityName, entityType, numSeries) {
entityName = entityName.replace(/\./g, '-');
var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName;
if (numSeries) url += '&numSeries=' + numSeries;
return Ember.$.ajax({
url: url,
type: 'GET',
dataType: 'json'
}).then(function (data) {
if (entityType == 'node') {
App.store.getById('node', emberId).set('graphs', App.associativeToNumericArray(data));
} else if (entityType == 'vm') {
App.store.getById('vm', emberId).set('graphs', App.associativeToNumericArray(data));
}
});
}
});
App.graphs = App.Graphs.create();
| // TODO: This is not a real model or controller
App.Graphs = Ember.Controller.extend({
graph: function(emberId, entityName, entityType, numSeries) {
entityName = entityName.replace(/\./g, '-');
var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName '&graphVars={"colorList":"yellow,green,orange,red,blue,pink"}';
if (numSeries) url += '&numSeries=' + numSeries;
return Ember.$.ajax({
url: url,
type: 'GET',
dataType: 'json'
}).then(function (data) {
if (entityType == 'node') {
App.store.getById('node', emberId).set('graphs', App.associativeToNumericArray(data));
} else if (entityType == 'vm') {
App.store.getById('vm', emberId).set('graphs', App.associativeToNumericArray(data));
}
});
}
});
App.graphs = App.Graphs.create();
| Use brighter colors in contextual Graphite graphs | Use brighter colors in contextual Graphite graphs
| JavaScript | apache-2.0 | vine77/saa-ui,vine77/saa-ui,vine77/saa-ui | ---
+++
@@ -2,7 +2,7 @@
App.Graphs = Ember.Controller.extend({
graph: function(emberId, entityName, entityType, numSeries) {
entityName = entityName.replace(/\./g, '-');
- var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName;
+ var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName '&graphVars={"colorList":"yellow,green,orange,red,blue,pink"}';
if (numSeries) url += '&numSeries=' + numSeries;
return Ember.$.ajax({
url: url, |
f12db5425cf5246b95fcae2c8b54fdf092fc4158 | core/modules/hubot/responder.js | core/modules/hubot/responder.js | ο»Ώvar http = require('scoped-http-client');
var Responder = function (api, event, match, message) {
this.api = api;
this.event = event;
this.match = match;
this.message = message;
};
Responder.prototype.random = function (arr) {
return arr[Math.floor(Math.random() * arr.length)];
};
Responder.prototype.send = function () {
for (var i = 0; i < arguments.length; i++) {
this.api.sendMessage(arguments[i], this.event.thread_id);
}
};
Responder.prototype.emote = Responder.prototype.send;
Responder.prototype.reply = Responder.prototype.send;
Responder.prototype.http = http.create;
module.exports = Responder;
| ο»Ώvar http = require('scoped-http-client'),
fs = require('fs'),
path = require('path'),
urlMatcher = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/,
imageExts = ['.jpg','.png','.gif','.gifv','.tif','.tiff','.jpeg'];
var getType = function(message) {
try {
fs.statSync(message);
return 'file';
}
catch(e){}
if (!urlMatcher.test(message)) {
return 'message';
}
var ext = path.extname(message);
if (imageExts.includes(ext)) {
return 'image';
}
return 'url';
};
var Responder = function (api, event, match, message) {
this.api = api;
this.event = event;
this.match = match;
this.message = message;
};
Responder.prototype.random = function (arr) {
return arr[Math.floor(Math.random() * arr.length)];
};
Responder.prototype.send = function () {
for (var i = 0; i < arguments.length; i++) {
switch(getType(arguments[i])) {
case 'message': {
this.api.sendMessage(arguments[i], this.event.thread_id);
break;
}
case 'url': {
this.api.sendUrl(arguments[i], this.event.thread_id);
break;
}
case 'image': {
this.api.sendImage('url', arguments[i], '', this.event.thread_id);
break;
}
case 'file': {
this.api.sendFile('file', arguments[i], '', this.event.thread_id);
break;
}
}
}
};
Responder.prototype.emote = Responder.prototype.send;
Responder.prototype.reply = Responder.prototype.send;
Responder.prototype.http = http.create;
module.exports = Responder;
| Enable image/file/url embedding with hubot scripts | Enable image/file/url embedding with hubot scripts
| JavaScript | mit | concierge/Concierge,faizaanmadhani/brianIsTenCarols,faizaanmadhani/brianIsTenCarols,concierge/Concierge | ---
+++
@@ -1,4 +1,26 @@
-ο»Ώvar http = require('scoped-http-client');
+ο»Ώvar http = require('scoped-http-client'),
+ fs = require('fs'),
+ path = require('path'),
+ urlMatcher = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/,
+ imageExts = ['.jpg','.png','.gif','.gifv','.tif','.tiff','.jpeg'];
+
+var getType = function(message) {
+ try {
+ fs.statSync(message);
+ return 'file';
+ }
+ catch(e){}
+
+ if (!urlMatcher.test(message)) {
+ return 'message';
+ }
+
+ var ext = path.extname(message);
+ if (imageExts.includes(ext)) {
+ return 'image';
+ }
+ return 'url';
+};
var Responder = function (api, event, match, message) {
this.api = api;
@@ -13,7 +35,24 @@
Responder.prototype.send = function () {
for (var i = 0; i < arguments.length; i++) {
- this.api.sendMessage(arguments[i], this.event.thread_id);
+ switch(getType(arguments[i])) {
+ case 'message': {
+ this.api.sendMessage(arguments[i], this.event.thread_id);
+ break;
+ }
+ case 'url': {
+ this.api.sendUrl(arguments[i], this.event.thread_id);
+ break;
+ }
+ case 'image': {
+ this.api.sendImage('url', arguments[i], '', this.event.thread_id);
+ break;
+ }
+ case 'file': {
+ this.api.sendFile('file', arguments[i], '', this.event.thread_id);
+ break;
+ }
+ }
}
};
|
0dabf910f31ed3b0fdacc742eae9555962462b57 | src/javascripts/asyncModules/Label.js | src/javascripts/asyncModules/Label.js | import Module from '../Module'
export default class Label extends Module {
constructor(el, name, options) {
const defaults = {
"once": false,
"activeClass": "is-active"
}
super(el, name, options, defaults)
}
init() {
const Input = this
console.log(Input);
let toggleLabel = function() {
let Label = this.previousElementSibling
if (this.value.length != 0) {
Label.classList.add('is-active')
} else {
Label.classList.remove('is-active')
}
}
this.el.classList.add('flabel')
this.el.addEventListener('input', toggleLabel)
}
} | import Module from '../Module'
export default class Label extends Module {
constructor(el, name, options) {
const defaults = {
"activeClass": "is-active"
}
super(el, name, options, defaults)
}
init() {
const Input = this
console.log(Input);
let toggleLabel = function() {
let Label = this.previousElementSibling
if (this.value.length != 0) {
Label.classList.add('is-active')
} else {
Label.classList.remove('is-active')
}
}
this.el.classList.add('flabel')
this.el.addEventListener('input', toggleLabel)
}
} | Refactor some of the form CSS | Refactor some of the form CSS
| JavaScript | mit | Jaywing/atomic,Jaywing/atomic | ---
+++
@@ -5,7 +5,6 @@
constructor(el, name, options) {
const defaults = {
- "once": false,
"activeClass": "is-active"
}
|
f17aea4fed7652378310b53630191e8a48461716 | bin/cli.js | bin/cli.js | #!/usr/bin/env node
var program = require('commander');
var prompt = require('inquirer');
var path = require('path');
var pkg = require(path.resolve(__dirname, '..', 'package.json'));
program.version(pkg.version)
program
.command('new')
.action(function() {
console.log('hits new command');
});
program.parse(process.argv); | #!/usr/bin/env node
var program = require('commander');
var prompt = require('inquirer');
var path = require('path');
var pkg = require(path.resolve(__dirname, '..', 'package.json'));
program.version(pkg.version)
program
.command('new <name>')
.description('Create a new project with the provided name')
.action(function(name) {
console.log('hits new command');
console.log('project name is ->', name);
});
program.parse(process.argv); | Add in required argument name for new command | feat: Add in required argument name for new command
| JavaScript | mit | code-computerlove/slate-cli,code-computerlove/quarry,cartridge/cartridge-cli | ---
+++
@@ -9,9 +9,11 @@
program.version(pkg.version)
program
- .command('new')
- .action(function() {
+ .command('new <name>')
+ .description('Create a new project with the provided name')
+ .action(function(name) {
console.log('hits new command');
+ console.log('project name is ->', name);
});
program.parse(process.argv); |
7f4cce36d7509feb926eed95a39f73c3dc28633d | scripts/main.js | scripts/main.js | /*
* site: codemelon2012
* file: scripts/main.js
* author: Marshall Farrier
* date: 8/24/2012
* description:
* main JavaScript for codemelon2012
* links:
* http://code.google.com/p/jquery-rotate/ (if needed)
*/
function codeMelonMain(activePage) {
if (!$.support.boxModel) {
window.location.replace("templates/no-boxmodel.html");
}
navigationMain(activePage);
logoMain(activePage);
/*
* This sometimes doesn't work properly in Chrome (overlap at the bottom is too big).
* This is presumably because the function is sometimes called asynchronously before
* the rest of the page is set up. The call on resize is working fine.
*/
backgroundMain();
$(window).resize(backgroundMain);
} | /*
* site: codemelon2012
* file: scripts/main.js
* author: Marshall Farrier
* date: 8/24/2012
* description:
* main JavaScript for codemelon2012
* links:
* http://code.google.com/p/jquery-rotate/ (if needed)
*/
function codeMelonMain(activePage) {
if (!$.support.boxModel) {
window.location.replace("templates/no-boxmodel.html");
}
navigationMain(activePage);
logoMain(activePage);
/*
* The top of the gray footer is sometimes about 32px too high up on the page in Chrome.
* This is presumably because the function is sometimes called asynchronously before
* the rest of the page is set up. The call on resize is working fine.
*/
backgroundMain();
$(window).resize(backgroundMain);
} | Edit comment to describe the difficulty more clearly. | Edit comment to describe the difficulty more clearly.
| JavaScript | mit | aisthesis/codemelon2012,aisthesis/codemelon2012,aisthesis/codemelon2012,aisthesis/codemelon2012 | ---
+++
@@ -16,7 +16,7 @@
navigationMain(activePage);
logoMain(activePage);
/*
- * This sometimes doesn't work properly in Chrome (overlap at the bottom is too big).
+ * The top of the gray footer is sometimes about 32px too high up on the page in Chrome.
* This is presumably because the function is sometimes called asynchronously before
* the rest of the page is set up. The call on resize is working fine.
*/ |
bcd7062615b4a4210529525e359ad9e91da457c1 | tasks/publish/concat.js | tasks/publish/concat.js | 'use strict';
var applicationConf = process.requirePublish('conf.json');
/**
* Gets the list of minified JavaScript files from the given list of files.
*
* It will just replace ".js" by ".min.js".
*
* @param Array files The list of files
* @return Array The list of minified files
*/
function getMinifiedJSFiles(files) {
var minifiedFiles = [];
files.forEach(function(path) {
minifiedFiles.push('<%= publish.uglify %>/' + path.replace('.js', '.min.js'));
});
return minifiedFiles;
}
module.exports = {
lib: {
// Concatenate back office JavaScript library files
src: getMinifiedJSFiles(applicationConf['backOffice']['scriptLibFiles']['dev']),
// Concatenate all files into libOpenveoPublish.js
dest: '<%= publish.beJSAssets %>/libOpenveoPublish.js'
},
publishjs: {
// Concatenate all back office JavaScript files
src: getMinifiedJSFiles(applicationConf['backOffice']['scriptFiles']['dev']),
// Concatenate all files into openveoPublish.js
dest: '<%= publish.beJSAssets %>/openveoPublish.js'
},
frontJS: {
// Concatenate all front JavaScript files
src: getMinifiedJSFiles(applicationConf['custom']['scriptFiles']['publishPlayer']['dev']),
// Concatenate all files into openveoPublishPlayer.js
dest: '<%= publish.playerJSAssets %>/openveoPublishPlayer.js'
}
};
| 'use strict';
var applicationConf = process.requirePublish('conf.json');
/**
* Gets the list of minified JavaScript files from the given list of files.
*
* It will just replace ".js" by ".min.js".
*
* @param Array files The list of files
* @return Array The list of minified files
*/
function getMinifiedJSFiles(files) {
var minifiedFiles = [];
files.forEach(function(path) {
minifiedFiles.push('<%= publish.uglify %>/' + path.replace('.js', '.min.js').replace('/publish/', ''));
});
return minifiedFiles;
}
module.exports = {
lib: {
// Concatenate back office JavaScript library files
src: getMinifiedJSFiles(applicationConf['backOffice']['scriptLibFiles']['dev']),
// Concatenate all files into libOpenveoPublish.js
dest: '<%= publish.beJSAssets %>/libOpenveoPublish.js'
},
publishjs: {
// Concatenate all back office JavaScript files
src: getMinifiedJSFiles(applicationConf['backOffice']['scriptFiles']['dev']),
// Concatenate all files into openveoPublish.js
dest: '<%= publish.beJSAssets %>/openveoPublish.js'
},
frontJS: {
// Concatenate all front JavaScript files
src: getMinifiedJSFiles(applicationConf['custom']['scriptFiles']['publishPlayer']['dev']),
// Concatenate all files into openveoPublishPlayer.js
dest: '<%= publish.playerJSAssets %>/openveoPublishPlayer.js'
}
};
| Correct bug when compiling JavaScript sources | Correct bug when compiling JavaScript sources
Compiled JavaScript files were empty due to previous modifications on routes architecture. Configuration of grunt concat task wasn't conform to this new architecture.
| JavaScript | agpl-3.0 | veo-labs/openveo-publish,veo-labs/openveo-publish,veo-labs/openveo-publish | ---
+++
@@ -13,7 +13,7 @@
function getMinifiedJSFiles(files) {
var minifiedFiles = [];
files.forEach(function(path) {
- minifiedFiles.push('<%= publish.uglify %>/' + path.replace('.js', '.min.js'));
+ minifiedFiles.push('<%= publish.uglify %>/' + path.replace('.js', '.min.js').replace('/publish/', ''));
});
return minifiedFiles;
} |
07ce413ce8dbb1476de5d34c2d1b8816d6aaf88c | ui/app/mixins/window-resizable.js | ui/app/mixins/window-resizable.js | import Mixin from '@ember/object/mixin';
import { run } from '@ember/runloop';
import { assert } from '@ember/debug';
import { on } from '@ember/object/evented';
import $ from 'jquery';
export default Mixin.create({
windowResizeHandler() {
assert('windowResizeHandler needs to be overridden in the Component', false);
},
setupWindowResize: on('didInsertElement', function() {
run.scheduleOnce('afterRender', this, () => {
this.set('_windowResizeHandler', this.windowResizeHandler.bind(this));
$(window).on('resize', this._windowResizeHandler);
});
}),
removeWindowResize: on('willDestroyElement', function() {
$(window).off('resize', this._windowResizeHandler);
}),
});
| import Mixin from '@ember/object/mixin';
import { run } from '@ember/runloop';
import { assert } from '@ember/debug';
import { on } from '@ember/object/evented';
export default Mixin.create({
windowResizeHandler() {
assert('windowResizeHandler needs to be overridden in the Component', false);
},
setupWindowResize: on('didInsertElement', function() {
run.scheduleOnce('afterRender', this, () => {
this.set('_windowResizeHandler', this.windowResizeHandler.bind(this));
window.addEventListener('resize', this._windowResizeHandler);
});
}),
removeWindowResize: on('willDestroyElement', function() {
window.removeEventListener('resize', this._windowResizeHandler);
}),
});
| Remove jquery from the window resize helper | Remove jquery from the window resize helper
| JavaScript | mpl-2.0 | burdandrei/nomad,dvusboy/nomad,hashicorp/nomad,dvusboy/nomad,hashicorp/nomad,burdandrei/nomad,dvusboy/nomad,dvusboy/nomad,burdandrei/nomad,dvusboy/nomad,burdandrei/nomad,dvusboy/nomad,hashicorp/nomad,burdandrei/nomad,hashicorp/nomad,hashicorp/nomad,burdandrei/nomad,hashicorp/nomad,burdandrei/nomad,dvusboy/nomad | ---
+++
@@ -2,7 +2,6 @@
import { run } from '@ember/runloop';
import { assert } from '@ember/debug';
import { on } from '@ember/object/evented';
-import $ from 'jquery';
export default Mixin.create({
windowResizeHandler() {
@@ -12,11 +11,11 @@
setupWindowResize: on('didInsertElement', function() {
run.scheduleOnce('afterRender', this, () => {
this.set('_windowResizeHandler', this.windowResizeHandler.bind(this));
- $(window).on('resize', this._windowResizeHandler);
+ window.addEventListener('resize', this._windowResizeHandler);
});
}),
removeWindowResize: on('willDestroyElement', function() {
- $(window).off('resize', this._windowResizeHandler);
+ window.removeEventListener('resize', this._windowResizeHandler);
}),
}); |
7683a9a714d86a223fb89e9e7126aa7bcb8ac57d | public/javascripts/ga.js | public/javascripts/ga.js | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-10687369-8', 'c9.io');
ga('send', 'pageview'); | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-10687369-9', 'cloudcv.io');
ga('send', 'pageview'); | Update google analytics tracking code | Update google analytics tracking code
| JavaScript | bsd-3-clause | BloodAxe/CloudCV,BloodAxe/CloudCV | ---
+++
@@ -1,7 +1,7 @@
-(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-ga('create', 'UA-10687369-8', 'c9.io');
-ga('send', 'pageview');
+ ga('create', 'UA-10687369-9', 'cloudcv.io');
+ ga('send', 'pageview'); |
fe7059841567191c87c61e0e51f11d634db5d138 | src/app/middleware/malformedPushEventError.js | src/app/middleware/malformedPushEventError.js | (function() {
var csError = require('./csError');
var MalformedPushEventError = csError.createCustomError('MalformedPushEventError', function() {
var message = 'There are no translators that understand the payload you are sending.';
var errors = [message];
MalformedPushEventError.prototype.constructor.call(this, errors, 400);
});
module.exports = MalformedPushEventError;
})() | (function() {
var csError = require('./csError');
var MalformedPushEventError = csError.createCustomError('MalformedPushEventError', function() {
var message = 'Push event could not be processed.';
var errors = [message];
MalformedPushEventError.prototype.constructor.call(this, errors, 400);
});
module.exports = MalformedPushEventError;
})() | Change the error message to not be so implementy in lingo | S-53159: Change the error message to not be so implementy in lingo
| JavaScript | bsd-3-clause | openAgile/CommitStream.Web,JogoShugh/CommitStream.Web,openAgile/CommitStream.Web,JogoShugh/CommitStream.Web,JogoShugh/CommitStream.Web,openAgile/CommitStream.Web,openAgile/CommitStream.Web,JogoShugh/CommitStream.Web | ---
+++
@@ -2,7 +2,7 @@
var csError = require('./csError');
var MalformedPushEventError = csError.createCustomError('MalformedPushEventError', function() {
- var message = 'There are no translators that understand the payload you are sending.';
+ var message = 'Push event could not be processed.';
var errors = [message];
MalformedPushEventError.prototype.constructor.call(this, errors, 400);
}); |
24f71bb57f77debde99101c4d03839b0e5792748 | src/main/webapp/js/account/account-controller.js | src/main/webapp/js/account/account-controller.js | 'use strict';
function AccountCtrl($scope, $http, $cookieStore, flash, AccountService, LoginService, ServerErrorResponse, Base64) {
$scope.currentAccount = angular.copy(AccountService.getAccount());
$scope.changePassword = function() {
LoginService.changePassword($scope.password.oldPassword, $scope.password.newPassword)
.then(function(response) {
$('#modalChangePassword').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').slideUp();
$('.modal-scrollable').slideUp();
flash.success = response.data.message;
}, function(response) {
$('#modalChangePassword').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').slideUp();
$('.modal-scrollable').slideUp();
flash.error = ServerErrorResponse.getMessage(response.status);
});
};
$scope.$watch( function() { return AccountService.getAccount(); }, function() {
$scope.currentAccount = angular.copy(AccountService.getAccount());
}, true);
} | 'use strict';
function AccountCtrl($scope, $http, $cookieStore, flash, AccountService, LoginService, ServerErrorResponse, Base64) {
$scope.currentAccount = angular.copy(AccountService.getAccount());
$scope.changePassword = function() {
LoginService.changePassword($scope.password.oldPassword, $scope.password.newPassword)
.then(function(response) {
$('#modalChangePassword').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').slideUp();
$('.modal-scrollable').slideUp();
flash.success = response.data.message;
//Reset cookie
var encodedUser = Base64.encode(AccountService.getUsername());
var encodedPass = Base64.encode($scope.password.newPassword);
$http.defaults.headers.common.Authorization = 'User ' + encodedUser + ' Pass ' + encodedPass;
$cookieStore.put('User', encodedUser);
$cookieStore.put('Pass', encodedPass);
}, function(response) {
$('#modalChangePassword').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').slideUp();
$('.modal-scrollable').slideUp();
flash.error = ServerErrorResponse.getMessage(response.status);
});
};
$scope.$watch( function() { return AccountService.getAccount(); }, function() {
$scope.currentAccount = angular.copy(AccountService.getAccount());
}, true);
} | Update cookie when user changes password. | Update cookie when user changes password. | JavaScript | apache-2.0 | GeoKnow/GeoKnowGeneratorUI,GeoKnow/GeoKnowGeneratorUI,GeoKnow/GeoKnowGeneratorUI | ---
+++
@@ -11,6 +11,13 @@
$('.modal-backdrop').slideUp();
$('.modal-scrollable').slideUp();
flash.success = response.data.message;
+ //Reset cookie
+ var encodedUser = Base64.encode(AccountService.getUsername());
+ var encodedPass = Base64.encode($scope.password.newPassword);
+ $http.defaults.headers.common.Authorization = 'User ' + encodedUser + ' Pass ' + encodedPass;
+ $cookieStore.put('User', encodedUser);
+ $cookieStore.put('Pass', encodedPass);
+
}, function(response) {
$('#modalChangePassword').modal('hide');
$('body').removeClass('modal-open'); |
b3eae251fac261eb3d903c056ebf4e6da531f174 | addon/components/google-maps-addon.js | addon/components/google-maps-addon.js | import Ember from 'ember';
import Map from '../map';
export default Ember.Component.extend({
setupMap: Ember.on('init', function() {
this.map = new Map();
this.map.set('owner', this);
}),
setupMapElement: Ember.on('willInsertElement', function() {
this.map.initializeOptions();
// Checking for the availability of Google Maps JavaScript SDK, the hero
if (window.google) {
this.set('mapElement', this.map.createMapElement());
this.updateMapOptions();
this.updateShapes();
} else {
console.error('Please include the Google Maps JavaScript SDK.');
}
}),
updateMapOptionsObserver: Ember.observer('mapOptions', function() {
this.updateMapOptions();
}),
updateShapesObserver: Ember.observer('markers', 'circles', 'rectangles', 'polygons', function() {
Ember.run.once(this, "updateShapes");
}),
updateMapOptions() {
if (this.get('mapElement')) {
this.map.initializeMouseEventCallbacks();
}
},
updateShapes() {
if (this.get('mapElement')) {
this.map.drawAllShapes();
}
}
});
| import Ember from 'ember';
import Map from '../map';
export default Ember.Component.extend({
setupMap: Ember.on('init', function() {
this.map = new Map();
this.map.set('owner', this);
}),
setupMapElement: Ember.on('didInsertElement', function() {
this.map.initializeOptions();
// Checking for the availability of Google Maps JavaScript SDK, the hero
Ember.run.later(() => {
if (window.google) {
this.set('mapElement', this.map.createMapElement());
this.updateMapOptions();
this.updateShapes();
} else {
console.error('Please include the Google Maps JavaScript SDK.');
}
});
}),
updateMapOptionsObserver: Ember.observer('mapOptions', function() {
this.updateMapOptions();
}),
updateShapesObserver: Ember.observer('markers', 'circles', 'rectangles', 'polygons', function() {
Ember.run.once(this, "updateShapes");
}),
updateMapOptions() {
if (this.get('mapElement')) {
this.map.initializeMouseEventCallbacks();
}
},
updateShapes() {
if (this.get('mapElement')) {
this.map.drawAllShapes();
}
}
});
| Fix an issue with the map being empty on a page transition | Fix an issue with the map being empty on a page transition
| JavaScript | mit | SamvelRaja/google-maps-addon,SamvelRaja/google-maps-addon | ---
+++
@@ -7,18 +7,20 @@
this.map.set('owner', this);
}),
- setupMapElement: Ember.on('willInsertElement', function() {
+ setupMapElement: Ember.on('didInsertElement', function() {
this.map.initializeOptions();
// Checking for the availability of Google Maps JavaScript SDK, the hero
- if (window.google) {
- this.set('mapElement', this.map.createMapElement());
+ Ember.run.later(() => {
+ if (window.google) {
+ this.set('mapElement', this.map.createMapElement());
- this.updateMapOptions();
- this.updateShapes();
- } else {
- console.error('Please include the Google Maps JavaScript SDK.');
- }
+ this.updateMapOptions();
+ this.updateShapes();
+ } else {
+ console.error('Please include the Google Maps JavaScript SDK.');
+ }
+ });
}),
updateMapOptionsObserver: Ember.observer('mapOptions', function() { |
cd8e0a15daa5ef8feaedc43808fc498b746bb133 | decls/redux.js | decls/redux.js | // @flow
declare module 'redux' {
declare type Enhancer<Action, State> = mixed;
declare type ReduxStore<Action, State> = {
dispatch: (action: Action) => void | Promise<void>,
getState: () => State,
};
declare type ReduxMiddleware<Action, State> =
(store: ReduxStore<Action, State>) =>
(next: (action: Action) => any) =>
(action: Action) =>
any;
declare function applyMiddleware<Action, State>(
...middlewares: ReduxMiddleware<Action, State>[]
): Enhancer<Action, State>;
declare function createStore<Action, State>(
reduce: (state: State, action: Action) => State,
initialState: State,
enhancer: Enhancer<Action, State>
): ReduxStore<Action, State>;
}
| // @flow
declare module 'redux' {
declare var createStore: Function;
declare var applyMiddleware: Function;
}
| Simplify the Flow declarations for Redux | Simplify the Flow declarations for Redux
| JavaScript | mit | clarus/redux-ship | ---
+++
@@ -1,26 +1,6 @@
// @flow
declare module 'redux' {
- declare type Enhancer<Action, State> = mixed;
-
- declare type ReduxStore<Action, State> = {
- dispatch: (action: Action) => void | Promise<void>,
- getState: () => State,
- };
-
- declare type ReduxMiddleware<Action, State> =
- (store: ReduxStore<Action, State>) =>
- (next: (action: Action) => any) =>
- (action: Action) =>
- any;
-
- declare function applyMiddleware<Action, State>(
- ...middlewares: ReduxMiddleware<Action, State>[]
- ): Enhancer<Action, State>;
-
- declare function createStore<Action, State>(
- reduce: (state: State, action: Action) => State,
- initialState: State,
- enhancer: Enhancer<Action, State>
- ): ReduxStore<Action, State>;
+ declare var createStore: Function;
+ declare var applyMiddleware: Function;
} |
3516155c660223e394986d8d2c2e4282dcf062d1 | app/assets/javascripts/app_core.js | app/assets/javascripts/app_core.js | require([ "jquery" ], function($) {
"use strict";
require([
"lib/core/base",
"lib/page/scroll_perf",
"flamsteed",
"trackjs",
"polyfills/function_bind",
"polyfills/xdr"
], function(Base, ScrollPerf, Flamsteed) {
$(function() {
var secure = window.location.protocol === "https:";
new Base();
new ScrollPerf;
// Currently we can"t serve Flamsteed over https because of f.staticlp.com
// https://trello.com/c/2RCd59vk/201-move-f-staticlp-com-off-cloudfront-and-on-to-fastly-so-we-can-serve-over-https
if (!secure) {
if (window.lp.getCookie) {
window.lp.fs = new Flamsteed({
events: window.lp.fs.buffer,
u: window.lp.getCookie("lpUid")
});
}
require([ "sailthru" ], function() {
window.Sailthru.setup({ domain: "horizon.lonelyplanet.com" });
});
}
});
});
});
| require([ "jquery" ], function($) {
"use strict";
require([
"lib/core/base",
"lib/page/scroll_perf",
"flamsteed",
"trackjs",
"polyfills/function_bind",
"polyfills/xdr"
], function(Base, ScrollPerf, Flamsteed) {
$(function() {
var secure = window.location.protocol === "https:";
new Base();
new ScrollPerf;
// Currently we can"t serve Flamsteed over https because of f.staticlp.com
// https://trello.com/c/2RCd59vk/201-move-f-staticlp-com-off-cloudfront-and-on-to-fastly-so-we-can-serve-over-https
if (!secure) {
if (window.lp.getCookie) {
window.lp.fs = new Flamsteed({
events: window.lp.fs.buffer,
u: window.lp.getCookie("lpUid"),
schema: "0.2"
});
}
require([ "sailthru" ], function() {
window.Sailthru.setup({ domain: "horizon.lonelyplanet.com" });
});
}
});
});
});
| Set Flamsteed `schema` to `Flamsteed` instance | Set Flamsteed `schema` to `Flamsteed` instance | JavaScript | mit | lonelyplanet/rizzo,Lostmyname/rizzo,Lostmyname/rizzo,Lostmyname/rizzo,lonelyplanet/rizzo,Lostmyname/rizzo,Lostmyname/rizzo,lonelyplanet/rizzo,lonelyplanet/rizzo,lonelyplanet/rizzo | ---
+++
@@ -24,7 +24,8 @@
if (window.lp.getCookie) {
window.lp.fs = new Flamsteed({
events: window.lp.fs.buffer,
- u: window.lp.getCookie("lpUid")
+ u: window.lp.getCookie("lpUid"),
+ schema: "0.2"
});
}
|
5f7fc53336aeb6b88a24761da99ca3d93c22e40c | src/helper.spec.js | src/helper.spec.js | var expect = require('chai').expect;
var helper = require('./helper');
describe('helper', function () {
it('should camelCase text', function () {
expect(helper.camelCase('snake_case')).to.be.equal('snakeCase');
expect(helper.camelCase('very-dash')).to.be.equal('veryDash');
expect(helper.camelCase('soNothing')).to.be.equal('soNothing');
expect(helper.camelCase('NotCamel')).to.be.equal('notCamel');
});
});
| var expect = require('chai').expect;
var helper = require('./helper');
describe('helper', function () {
it('should camelCase text', function () {
expect(helper.camelCase('snake_case')).to.be.equal('snakeCase');
expect(helper.camelCase('very-dash')).to.be.equal('veryDash');
expect(helper.camelCase('soNothing')).to.be.equal('soNothing');
expect(helper.camelCase('NotCamel')).to.be.equal('notCamel');
});
it('should get method name from the path');
});
| Add a missing test case | Add a missing test case
| JavaScript | mit | RisingStack/swaggity,RisingStack/swaggity | ---
+++
@@ -8,4 +8,6 @@
expect(helper.camelCase('soNothing')).to.be.equal('soNothing');
expect(helper.camelCase('NotCamel')).to.be.equal('notCamel');
});
+
+ it('should get method name from the path');
}); |
942e1fb57ab588294badf3934f4280a15b550556 | app/index.js | app/index.js | const generators = require('yeoman-generator')
const fs = require('fs')
module.exports = generators.Base.extend({
constructor: function () {
generators.Base.apply(this, arguments)
this.sourceRoot(__dirname + '/../kit')
},
prompting: function () {
var done = this.async();
const prompts = [
{
type: 'input',
name: 'name',
message: 'Project name',
default: this.appname
},
{
type: 'input',
name: 'author',
message: 'Author'
}
]
this.prompt(prompts, function (answers) {
Object.assign(this, answers);
done();
}.bind(this));
},
writing: function () {
const details = {
name: this.name.toLowerCase(),
author: this.author,
year: new Date().getFullYear()
}
fs.readdir(this.templatePath(), function (err, files) {
if (err) {
throw err
}
for (file of files) {
var source = this.templatePath(file)
this.fs.copyTpl(source, this.destinationPath(file), details)
}
}.bind(this))
}
})
| const generators = require('yeoman-generator')
const fs = require('fs')
module.exports = generators.Base.extend({
constructor: function () {
generators.Base.apply(this, arguments)
this.sourceRoot(__dirname + '/../kit')
},
prompting: function () {
var done = this.async();
const prompts = [
{
type: 'input',
name: 'name',
message: 'Project name',
default: this.appname
},
{
type: 'input',
name: 'author',
message: 'Author'
}
]
this.prompt(prompts, function (answers) {
this.fields = {
year: new Date().getFullYear()
}
Object.assign(this.fields, answers);
done();
}.bind(this));
},
writing: function () {
const details = this.fields
fs.readdir(this.templatePath(), function (err, files) {
if (err) {
throw err
}
for (file of files) {
var source = this.templatePath(file)
this.fs.copyTpl(source, this.destinationPath(file), details)
}
}.bind(this))
}
})
| Read from the same object | Read from the same object
| JavaScript | mit | muffin/cli,muffinjs/cli | ---
+++
@@ -25,18 +25,20 @@
]
this.prompt(prompts, function (answers) {
- Object.assign(this, answers);
+
+ this.fields = {
+ year: new Date().getFullYear()
+ }
+
+ Object.assign(this.fields, answers);
done();
+
}.bind(this));
},
writing: function () {
- const details = {
- name: this.name.toLowerCase(),
- author: this.author,
- year: new Date().getFullYear()
- }
+ const details = this.fields
fs.readdir(this.templatePath(), function (err, files) {
|
be3e40877f72374110b1b27b4c2912c3826dd073 | lib/get_all.js | lib/get_all.js | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
}).filter(fp.id).length === zq.length;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
| var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b, {
matchBase: true
});
}).filter(fp.id).length === zq.length;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
| Allow minimatch match slashes too | Allow minimatch match slashes too
| JavaScript | mit | MartinKolarik/api-sync,MartinKolarik/api,jsdelivr/api-sync,2947721120/jsdelivr-api,jsdelivr/api,jsdelivr/api-sync,MartinKolarik/api-sync | ---
+++
@@ -25,7 +25,9 @@
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
- return minimatch(a, b);
+ return minimatch(a, b, {
+ matchBase: true
+ });
}).filter(fp.id).length === zq.length;
});
} |
4eaa3f4ca5001f92b4b773c539ca54914a2436f8 | app/constants/DatabaseConstants.js | app/constants/DatabaseConstants.js | /**
* A list of database constants.
*
* @type {Object}
*/
const DATABASE_CONSTANTS = Object.freeze({
GUILD_TABLE_NAME: 'guilds',
PLAYLIST_TABLE_NAME: 'playllists',
BLACKLIST_TABLE_NAME: 'blacklists'
});
module.exports = DATABASE_CONSTANTS;
| /**
* A list of database constants.
*
* @type {Object}
*/
const DATABASE_CONSTANTS = Object.freeze({
GUILD_TABLE_NAME: 'guilds',
PLAYLIST_TABLE_NAME: 'playlists',
BLACKLIST_TABLE_NAME: 'blacklists'
});
module.exports = DATABASE_CONSTANTS;
| Fix playlist table name spelling mistake | Fix playlist table name spelling mistake
| JavaScript | mit | Senither/AvaIre | ---
+++
@@ -5,7 +5,7 @@
*/
const DATABASE_CONSTANTS = Object.freeze({
GUILD_TABLE_NAME: 'guilds',
- PLAYLIST_TABLE_NAME: 'playllists',
+ PLAYLIST_TABLE_NAME: 'playlists',
BLACKLIST_TABLE_NAME: 'blacklists'
});
|
1b4cd822a398eda824c0ea4223e665977abf50e6 | app/containers/SignupPage/index.js | app/containers/SignupPage/index.js | import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import Header from 'components/Header';
import SignupCard from 'components/SignupCard';
export class SignupPage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div>
<Helmet
title="Signup Page"
meta={[
{ name: 'description', content: 'Signup Page of Book Trader application' },
]}
/>
<Header location={this.props.location.pathname} />
<div className="container">
<SignupCard signup={() => { console.log('signup'); }} />
</div>
</div>
);
}
}
SignupPage.propTypes = {
dispatch: PropTypes.func.isRequired,
location: PropTypes.object,
};
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(null, mapDispatchToProps)(SignupPage);
| import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { createStructuredSelector } from 'reselect';
import { signupRequest } from 'containers/App/actions';
import { makeSelectError } from 'containers/App/selectors';
import Header from 'components/Header';
import SignupCard from 'components/SignupCard';
export class SignupPage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div>
<Helmet
title="Signup Page"
meta={[
{ name: 'description', content: 'Signup Page of Book Trader application' },
]}
/>
<Header location={this.props.location.pathname} />
<div className="container">
<SignupCard signup={this.props.signup} error={this.props.error} />
</div>
</div>
);
}
}
SignupPage.propTypes = {
signup: PropTypes.func.isRequired,
location: PropTypes.object,
error: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
]),
};
const mapStateToProps = createStructuredSelector({
error: makeSelectError(),
});
function mapDispatchToProps(dispatch) {
return {
signup: (payload) => dispatch(signupRequest(payload)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SignupPage);
| Connect error state adn signupRequest action | Connect error state adn signupRequest action
| JavaScript | mit | kevinnorris/bookTrading,kevinnorris/bookTrading | ---
+++
@@ -1,7 +1,10 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
+import { createStructuredSelector } from 'reselect';
+import { signupRequest } from 'containers/App/actions';
+import { makeSelectError } from 'containers/App/selectors';
import Header from 'components/Header';
import SignupCard from 'components/SignupCard';
@@ -17,7 +20,7 @@
/>
<Header location={this.props.location.pathname} />
<div className="container">
- <SignupCard signup={() => { console.log('signup'); }} />
+ <SignupCard signup={this.props.signup} error={this.props.error} />
</div>
</div>
);
@@ -25,15 +28,22 @@
}
SignupPage.propTypes = {
- dispatch: PropTypes.func.isRequired,
+ signup: PropTypes.func.isRequired,
location: PropTypes.object,
+ error: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.bool,
+ ]),
};
+const mapStateToProps = createStructuredSelector({
+ error: makeSelectError(),
+});
function mapDispatchToProps(dispatch) {
return {
- dispatch,
+ signup: (payload) => dispatch(signupRequest(payload)),
};
}
-export default connect(null, mapDispatchToProps)(SignupPage);
+export default connect(mapStateToProps, mapDispatchToProps)(SignupPage); |
d3cca9554d31b7e20dd9b76eae463b532a2b7767 | src/lang/kindOf.js | src/lang/kindOf.js | define(function () {
var _toString = Object.prototype.toString;
/**
* Gets the "kind" of value. (e.g. "String", "Number", etc)
*/
function kindOf(val) {
return _toString.call(val).slice(8, -1);
}
return kindOf;
});
| define(function () {
/**
* Gets the "kind" of value. (e.g. "String", "Number", etc)
*/
function kindOf(val) {
return Object.prototype.toString.call(val).slice(8, -1);
}
return kindOf;
});
| Address comment about closure variable lookup. | Address comment about closure variable lookup. | JavaScript | mit | mout/mout,mout/mout | ---
+++
@@ -1,12 +1,9 @@
define(function () {
-
- var _toString = Object.prototype.toString;
-
/**
* Gets the "kind" of value. (e.g. "String", "Number", etc)
*/
function kindOf(val) {
- return _toString.call(val).slice(8, -1);
+ return Object.prototype.toString.call(val).slice(8, -1);
}
return kindOf;
}); |
e24150cab1aac5a0a4b1c4cd72b20ad529114052 | tools/static-assets/skel-pack/~fs-name~-tests.js | tools/static-assets/skel-pack/~fs-name~-tests.js | // Import Tinytest from the tinytest Meteor package.
import { Tinytest } from "meteor/tinytest";
// Import and rename a variable exported by ~fs-name~.js.
import { name as packageName } from "meteor/~fs-name~";
// Write your tests here!
// Here is an example.
Tinytest.add('~fs-name~ - example', function (test) {
test.equal(packageName, "~fs-name~");
});
| // Import Tinytest from the tinytest Meteor package.
import { Tinytest } from "meteor/tinytest";
// Import and rename a variable exported by ~fs-name~.js.
import { name as packageName } from "meteor/~name~";
// Write your tests here!
// Here is an example.
Tinytest.add('~fs-name~ - example', function (test) {
test.equal(packageName, "~fs-name~");
});
| Change package creation skeleton to import properly | Change package creation skeleton to import properly
The package skeleton test example was omitting the first part of the package name and thus failing to find it within the test package.
Fixes meteor/meteor#6653
| JavaScript | mit | jdivy/meteor,Hansoft/meteor,chasertech/meteor,Hansoft/meteor,mjmasn/meteor,4commerce-technologies-AG/meteor,mjmasn/meteor,chasertech/meteor,chasertech/meteor,mjmasn/meteor,Hansoft/meteor,chasertech/meteor,Hansoft/meteor,mjmasn/meteor,jdivy/meteor,mjmasn/meteor,jdivy/meteor,jdivy/meteor,4commerce-technologies-AG/meteor,4commerce-technologies-AG/meteor,jdivy/meteor,4commerce-technologies-AG/meteor,chasertech/meteor,mjmasn/meteor,chasertech/meteor,chasertech/meteor,jdivy/meteor,4commerce-technologies-AG/meteor,mjmasn/meteor,Hansoft/meteor,4commerce-technologies-AG/meteor,4commerce-technologies-AG/meteor,Hansoft/meteor,jdivy/meteor,Hansoft/meteor | ---
+++
@@ -2,7 +2,7 @@
import { Tinytest } from "meteor/tinytest";
// Import and rename a variable exported by ~fs-name~.js.
-import { name as packageName } from "meteor/~fs-name~";
+import { name as packageName } from "meteor/~name~";
// Write your tests here!
// Here is an example. |
d5a0e4a1d63cffd6e3a9f24a4ed9a110a53a0623 | src/plugins/Multipart.js | src/plugins/Multipart.js | import Plugin from './Plugin';
export default class Multipart extends Plugin {
constructor(core, opts) {
super(core, opts);
this.type = 'uploader';
}
run(results) {
console.log({
class : 'Multipart',
method : 'run',
results: results
});
const files = this.extractFiles(results);
this.core.setProgress(this, 0);
var uploaded = [];
var uploaders = [];
for (var i in files) {
var file = files[i];
uploaders.push(this.upload(file, i, files.length));
}
return Promise.all(uploaders);
}
upload(file, current, total) {
var formPost = new FormData();
formPost.append('file', file);
var xhr = new XMLHttpRequest();
xhr.open('POST', this.opts.endpoint, true);
xhr.addEventListener('progress', (e) => {
var percentage = (e.loaded / e.total * 100).toFixed(2);
this.setProgress(percentage, current, total);
});
xhr.addEventListener('load', () => {
return Promise.resolve(upload);
});
xhr.addEventListener('error', () => {
return Promise.reject('fucking error!');
});
xhr.send(formPost);
}
}
| import Plugin from './Plugin';
export default class Multipart extends Plugin {
constructor(core, opts) {
super(core, opts);
this.type = 'uploader';
}
run(results) {
console.log({
class : 'Multipart',
method : 'run',
results: results
});
const files = this.extractFiles(results);
this.core.setProgress(this, 0);
var uploaded = [];
var uploaders = [];
for (var i in files) {
var file = files[i];
uploaders.push(this.upload(file, i, files.length));
}
return Promise.all(uploaders);
}
upload(file, current, total) {
var formPost = new FormData();
formPost.append('file', file);
var xhr = new XMLHttpRequest();
xhr.open('POST', this.opts.endpoint, true);
xhr.addEventListener('progress', (e) => {
var percentage = (e.loaded / e.total * 100).toFixed(2);
this.setProgress(percentage, current, total);
});
xhr.addEventListener('load', () => {
var upload = {file: file};
return Promise.resolve(upload);
});
xhr.addEventListener('error', () => {
return Promise.reject('fucking error!');
});
xhr.send(formPost);
}
}
| Return file as part of upload | Return file as part of upload
| JavaScript | mit | transloadit/uppy,varung-optimus/uppy,transloadit/uppy,varung-optimus/uppy,transloadit/uppy,transloadit/uppy,varung-optimus/uppy | ---
+++
@@ -39,6 +39,7 @@
});
xhr.addEventListener('load', () => {
+ var upload = {file: file};
return Promise.resolve(upload);
});
|
5cbb7846f152cd61080d7b956a3a8c673b55345a | app/preload.js | app/preload.js | global.IPC = require('ipc')
var events = ['unread-changed'];
events.forEach(function(e) {
window.addEventListener(e, function(event) {
IPC.send(e, event.detail);
});
});
require('./menus');
var shell = require('shell');
var supportExternalLinks = function (e) {
var href;
var isExternal = false;
var checkDomElement = function (element) {
if (element.nodeName === 'A') {
href = element.getAttribute('href') || '';
}
if (/^https?:\/\/.+/.test(href) === true /*&& RegExp('^https?:\/\/'+location.host).test(href) === false*/) {
isExternal = true;
}
if (href && isExternal) {
shell.openExternal(href);
e.preventDefault();
} else if (element.parentElement) {
checkDomElement(element.parentElement);
}
}
checkDomElement(e.target);
}
document.addEventListener('click', supportExternalLinks, false); | global.IPC = require('ipc')
var events = ['unread-changed'];
events.forEach(function(e) {
window.addEventListener(e, function(event) {
IPC.send(e, event.detail);
});
});
require('./menus');
var shell = require('shell');
var supportExternalLinks = function (e) {
var href;
var isExternal = false;
var checkDomElement = function (element) {
if (element.nodeName === 'A') {
href = element.getAttribute('href') || '';
}
if (/^https?:\/\/.+/.test(href) === true /*&& RegExp('^https?:\/\/'+location.host).test(href) === false*/) {
isExternal = true;
}
if (href && isExternal) {
shell.openExternal(href);
e.preventDefault();
} else if (element.parentElement) {
checkDomElement(element.parentElement);
}
}
checkDomElement(e.target);
}
document.addEventListener('click', supportExternalLinks, false);
windowOpen = window.open;
window.open = function() {
result = windowOpen.apply(this, arguments);
result.closed = false;
return result;
} | Fix login with oauth services | Fix login with oauth services
| JavaScript | mit | RocketChat/Rocket.Chat.Electron,RocketChat/Rocket.Chat.Electron,ZedTheYeti/Rocket.Chat.Electron,RocketChat/Rocket.Chat.Electron,ZedTheYeti/Rocket.Chat.Electron,ZedTheYeti/Rocket.Chat.Electron | ---
+++
@@ -37,3 +37,10 @@
}
document.addEventListener('click', supportExternalLinks, false);
+
+windowOpen = window.open;
+window.open = function() {
+ result = windowOpen.apply(this, arguments);
+ result.closed = false;
+ return result;
+} |
adca715e97d97fc7247ca966b55848076d00c6b3 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
$(function(){
$(document).foundation();
});
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
$(function(){
$(document).foundation();
});
jQuery.easing.def = "easeInOutCubic";
$(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html, body').animate({scrollTop:$(this.hash).offset().top}, 1000);
});
});
| Add JavaScript function for scrollable sections after clicking navbar links. | Add JavaScript function for scrollable sections after clicking navbar links.
| JavaScript | mit | barreyro/steph.rocks,barreyro/steph.rocks,barreyro/steph.rocks | ---
+++
@@ -19,3 +19,16 @@
$(function(){
$(document).foundation();
});
+
+
+jQuery.easing.def = "easeInOutCubic";
+
+$(document).ready(function($) {
+
+ $(".scroll").click(function(event){
+ event.preventDefault();
+ $('html, body').animate({scrollTop:$(this.hash).offset().top}, 1000);
+ });
+});
+
+ |
fdf4f520c31b0e5f8b666b02c5a9650929abfdbe | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require ./phaser.min.js
//= require ./chat.js
//= require ./board.js
//= require ./game.js
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require ./phaser.min.js
//= require ./chat.js
//= require ./board.js
//= require ./characters.js
//= require ./hotkeys.js
//= require ./game.js
| Refactor out character creation scripts. | Refactor out character creation scripts.
| JavaScript | mit | red-spotted-newts-2014/haunted,red-spotted-newts-2014/haunted | ---
+++
@@ -16,4 +16,6 @@
//= require ./phaser.min.js
//= require ./chat.js
//= require ./board.js
+//= require ./characters.js
+//= require ./hotkeys.js
//= require ./game.js |
496f5e28920513750c5b4e3e5c06523c8162a238 | troposphere/static/js/components/page_header.js | troposphere/static/js/components/page_header.js | define(['react', 'components/common/glyphicon'], function(React, Glyphicon) {
var PageHeader = React.createClass({
render: function() {
var help_button = [];
var help_text = [];
if (this.props.helpText) {
help_button = React.DOM.button({
type: 'button',
id: 'help-text-toggle-button',
className: 'btn btn-default',
'data-toggle': 'collapse',
'data-target': '#help-text'},
Glyphicon({name: 'question-sign'}));
help_text = React.DOM.div({
id: 'help-text',
className: 'collapse'},
React.DOM.div({className: 'well'}, this.props.helpText()));
}
return React.DOM.div({className: 'main-page-header'},
React.DOM.h1({}, this.props.title),
help_button,
help_text);
}
});
return PageHeader;
});
| define(['react', 'components/common/glyphicon'], function(React, Glyphicon) {
var PageHeader = React.createClass({
getInitialState: function() {
return {showHelpText: false};
},
render: function() {
var help_button = [];
var help_text = [];
if (this.props.helpText) {
help_button = React.DOM.button({
type: 'button',
id: 'help-text-toggle-button',
className: 'btn btn-default',
onClick: this.showHelpText},
Glyphicon({name: 'question-sign'}));
help_text = React.DOM.div({
id: 'help-text',
style: {display: this.state.showHelpText ? 'block' : 'none'}},
React.DOM.div({className: 'well'}, this.props.helpText()));
}
return React.DOM.div({className: 'main-page-header'},
React.DOM.h1({}, this.props.title),
help_button,
help_text);
},
showHelpText: function() {
this.setState({showHelpText: !this.state.showHelpText});
}
});
return PageHeader;
});
| Modify help text on page header component to not use bootstrap js | Modify help text on page header component to not use bootstrap js
| JavaScript | apache-2.0 | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | ---
+++
@@ -1,6 +1,9 @@
define(['react', 'components/common/glyphicon'], function(React, Glyphicon) {
var PageHeader = React.createClass({
+ getInitialState: function() {
+ return {showHelpText: false};
+ },
render: function() {
var help_button = [];
var help_text = [];
@@ -9,13 +12,12 @@
type: 'button',
id: 'help-text-toggle-button',
className: 'btn btn-default',
- 'data-toggle': 'collapse',
- 'data-target': '#help-text'},
+ onClick: this.showHelpText},
Glyphicon({name: 'question-sign'}));
help_text = React.DOM.div({
- id: 'help-text',
- className: 'collapse'},
+ id: 'help-text',
+ style: {display: this.state.showHelpText ? 'block' : 'none'}},
React.DOM.div({className: 'well'}, this.props.helpText()));
}
@@ -23,6 +25,9 @@
React.DOM.h1({}, this.props.title),
help_button,
help_text);
+ },
+ showHelpText: function() {
+ this.setState({showHelpText: !this.state.showHelpText});
}
});
|
a2f91c3f13e0440ac8e52f94aff98bdeb96872e0 | app/components/github-team-notices.js | app/components/github-team-notices.js | import DashboardWidgetComponent from 'appkit/components/dashboard-widget';
var GithubTeamNotices = DashboardWidgetComponent.extend({
init: function() {
this._super();
this.set("contents", []);
},
actions: {
receiveEvent: function(data) {
var items = Ember.A(JSON.parse(data));
this.updatePullRequests(items.pull_requests);
// eventually Issues too
}
},
updatePullRequests: function(items) {
var contents = this.get("contents");
if (!Ember.isEmpty(items)) {
// Remove items that have disappeared.
var itemsToRemove = [];
contents.forEach(function(existingItem) {
var isNotPresent = !items.findBy("id", existingItem.get("id"));
if (isNotPresent) {
itemsToRemove.pushObject(existingItem);
}
});
contents.removeObjects(itemsToRemove);
// Process current items.
items.forEach(function(item) {
var existingItem = contents.findBy("url", item.id);
if (Ember.isEmpty(existingItem)) {
// Add new items.
var newItem = contents.pushObject(Ember.Object.create(item));
newItem.set("dashEventType", "Pull Request");
} else {
// Update existing items.
existingItem.setProperties(item);
}
});
}
}
});
export default GithubTeamNotices;
| import DashboardWidgetComponent from 'appkit/components/dashboard-widget';
var GithubTeamNotices = DashboardWidgetComponent.extend({
init: function() {
this._super();
this.set("contents", []);
},
actions: {
receiveEvent: function(data) {
var items = Ember.A(JSON.parse(data));
this.updatePullRequests(items.pull_requests);
// eventually Issues too
}
},
updatePullRequests: function(items) {
var contents = this.get("contents");
if (!Ember.isEmpty(items)) {
// Remove items that have disappeared.
var itemsToRemove = [];
contents.forEach(function(existingItem) {
var isNotPresent = !items.findBy("id", existingItem.get("id"));
if (isNotPresent) {
itemsToRemove.pushObject(existingItem);
}
});
contents.removeObjects(itemsToRemove);
// Process current items.
items.forEach(function(item) {
var existingItem = contents.findBy("id", item.id);
if (Ember.isEmpty(existingItem)) {
// Add new items.
var newItem = contents.pushObject(Ember.Object.create(item));
newItem.set("dashEventType", "Pull Request");
} else {
// Update existing items.
existingItem.setProperties(item);
}
});
}
}
});
export default GithubTeamNotices;
| Fix repeated inserts of "Code" team notices. | Fix repeated inserts of "Code" team notices.
| JavaScript | mit | substantial/substantial-dash-client | ---
+++
@@ -31,7 +31,7 @@
// Process current items.
items.forEach(function(item) {
- var existingItem = contents.findBy("url", item.id);
+ var existingItem = contents.findBy("id", item.id);
if (Ember.isEmpty(existingItem)) {
// Add new items.
var newItem = contents.pushObject(Ember.Object.create(item)); |
ac658b3bdcd2262b7db7d6b8bebadb05e31a07d4 | src/selectors/tactics.js | src/selectors/tactics.js | import { createSelector } from 'reselect';
const getTactics = state => state.entities.tactics;
export const tacticsSelector = createSelector(
[getTactics], tactics => tactics.items.map(id => tactics.byId[id]),
);
| import { denormalize } from 'normalizr';
import { createSelector } from 'reselect';
import { tacticSchema } from '../constants/Schemas';
const getTactics = state => state.entities.tactics;
const getTeams = state => state.entities.teams;
export const tacticsSelector = createSelector(
[getTactics], tactics => tactics.items.map(id => tactics.byId[id]),
);
export const tacticsDetailsSelector = createSelector(
[getTactics, getTeams],
(tactics, teams) => denormalize(
tactics.items, [tacticSchema],
{ tactics: tactics.byId, teams: teams.byId },
),
);
| Add tacticDetailsSelector that returns denormalized data | Add tacticDetailsSelector that returns denormalized data
| JavaScript | mit | m-mik/tactic-editor,m-mik/tactic-editor | ---
+++
@@ -1,7 +1,18 @@
+import { denormalize } from 'normalizr';
import { createSelector } from 'reselect';
+import { tacticSchema } from '../constants/Schemas';
const getTactics = state => state.entities.tactics;
+const getTeams = state => state.entities.teams;
export const tacticsSelector = createSelector(
[getTactics], tactics => tactics.items.map(id => tactics.byId[id]),
);
+
+export const tacticsDetailsSelector = createSelector(
+ [getTactics, getTeams],
+ (tactics, teams) => denormalize(
+ tactics.items, [tacticSchema],
+ { tactics: tactics.byId, teams: teams.byId },
+ ),
+); |
77b56eb68780c1b5d650ff6ecec65de606d540fd | src/objectifier.js | src/objectifier.js | // objectifier
"use strict"
// readObject :: [String] -> [String] -> Object String a
const readObject = keys => values => {
var i, obj, value
obj = {}
for (i = 0; i < keys.length; i++) {
value = readValue(values[i])
if (value !== undefined) obj[keys[i]] = value
}
return obj
}
// readValue :: String -> a
const readValue = s => {
// n :: Number, t :: String
var n, t
if (!s) return // test for truthy string
t = s.trim().toLowerCase()
if (!t) return
if (t === "false") {
return false
} else if (t === "true") {
return true
}
n = t ? Number(t) : NaN
if (!isNaN(n)) return n
return s.trim()
}
// Exports.
module.exports = {
readObject: readObject
}
| // objectifier
"use strict"
// readObject :: [String] -> [String] -> Object String a
const readObject = keys => values => {
var i, obj, value
obj = {}
for (i = 0; i < keys.length; i++) {
value = readValue(values[i])
obj[keys[i]] = value
}
return obj
}
// readValue :: String -> a
const readValue = s => {
// n :: Number, t :: String
var n, t
if (!s) return // test for truthy string
t = s.trim().toLowerCase()
if (!t) return
if (t === "false") {
return false
} else if (t === "true") {
return true
}
n = t ? Number(t) : NaN
if (!isNaN(n)) return n
return s.trim()
}
// Exports.
module.exports = {
readObject: readObject
}
| Read empty csv cells as undefined | Read empty csv cells as undefined | JavaScript | mit | OrgVue/csv-parser | ---
+++
@@ -9,7 +9,7 @@
obj = {}
for (i = 0; i < keys.length; i++) {
value = readValue(values[i])
- if (value !== undefined) obj[keys[i]] = value
+ obj[keys[i]] = value
}
return obj |
0f66ff21eca76d202572e2b2c804292b98f97fa2 | tests/dummy/config/environment.js | tests/dummy/config/environment.js | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'auto';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};
| /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
//'ember-htmlbars': true
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'auto';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};
| Add placeholder htmlbars flag in dummy app for packaging to toggle | Add placeholder htmlbars flag in dummy app for packaging to toggle | JavaScript | mit | minutebase/ember-dynamic-component,minutebase/ember-dynamic-component | ---
+++
@@ -8,6 +8,7 @@
locationType: 'auto',
EmberENV: {
FEATURES: {
+ //'ember-htmlbars': true
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
} |
e6817928854023b15842f9fb575e2e2202b2f1fe | src/routes.js | src/routes.js | import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import config from './config';
import routeConstants from './constants/routeConstants';
import Dashboard from './components/Dashboard';
import Header from './components/commons/Header';
import Footer from './components/commons/Footer';
const baseHref = process.env.BASE_HREF || '/';
const Router = () => (
<BrowserRouter basename={baseHref}>
<div>
<Header logoUrl={config.app.logoUrl} style={{ height: config.app.logoHeight }} />
<Switch>
<Route exact path={routeConstants.DASHBOARD} component={Dashboard} />
</Switch>
<Footer />
</div>
</BrowserRouter>
);
export default Router;
| import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { app } from './config';
import routeConstants from './constants/routeConstants';
import Dashboard from './components/Dashboard';
import Header from './components/commons/Header';
import Footer from './components/commons/Footer';
const baseHref = process.env.BASE_HREF || '/';
const { logoUrl, logoHeight } = app;
const Router = () => (
<BrowserRouter basename={baseHref}>
<div>
<Header logoUrl={logoUrl} style={{ height: logoHeight }} />
<Switch>
<Route exact path={routeConstants.DASHBOARD} component={Dashboard} />
</Switch>
<Footer />
</div>
</BrowserRouter>
);
export default Router;
| Use destructuring while using config | Use destructuring while using config
| JavaScript | mit | leapfrogtechnology/chill-dashboard,leapfrogtechnology/chill-dashboard | ---
+++
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
-import config from './config';
+import { app } from './config';
import routeConstants from './constants/routeConstants';
import Dashboard from './components/Dashboard';
@@ -10,10 +10,12 @@
const baseHref = process.env.BASE_HREF || '/';
+const { logoUrl, logoHeight } = app;
+
const Router = () => (
<BrowserRouter basename={baseHref}>
<div>
- <Header logoUrl={config.app.logoUrl} style={{ height: config.app.logoHeight }} />
+ <Header logoUrl={logoUrl} style={{ height: logoHeight }} />
<Switch>
<Route exact path={routeConstants.DASHBOARD} component={Dashboard} />
</Switch> |
0f890d943964aad281488ed29b39d08e4b784e4f | app/utils/helmet.js | app/utils/helmet.js | // @flow
import * as React from 'react';
import { Helmet } from 'react-helmet';
import config from 'app/config';
import { type ComponentType, createElement } from 'react';
/**
* A higher order component that wraps the given component in
* LoadingIndicator while `props[loadingProp]` is being fetched.
*/
type PropertyGenerator = (
props: Object,
config?: Object
) => Array<{
property?: string,
content?: string,
element?: string,
children?: string,
rel?: string,
href?: string
}>;
export default function helmet<T>(propertyGenerator: PropertyGenerator) {
return (Component: ComponentType<T>) => ({
PropertyGenerator,
...props
}: T & {
propertyGenerator: PropertyGenerator
}) => [
<Helmet key="helmet">
{propertyGenerator(props, config).map(
({ element, children, ...props }, index) =>
createElement(element || 'meta', { key: index, ...props }, children)
)}
</Helmet>,
<Component key="component" {...props} />
];
}
| // @flow
import * as React from 'react';
import { Helmet } from 'react-helmet';
import config from 'app/config';
import { type ComponentType, createElement } from 'react';
/**
* A higher order component that wraps the given component in
* LoadingIndicator while `props[loadingProp]` is being fetched.
*/
type PropertyGenerator = (
props: Object,
config?: Object
) => Array<{
property?: string,
content?: string,
element?: string,
children?: string,
rel?: string,
href?: string
}>;
export default function helmet<T>(propertyGenerator: ?PropertyGenerator) {
return (Component: ComponentType<T>) => ({
PropertyGenerator,
...props
}: T & {
propertyGenerator: PropertyGenerator
}) => [
<Helmet key="helmet">
{!!propertyGenerator &&
propertyGenerator(props, config).map(
({ element, children, ...props }, index) =>
createElement(element || 'meta', { key: index, ...props }, children)
)}
</Helmet>,
<Component key="component" {...props} />
];
}
| Add null check to property generator | Add null check to property generator
| JavaScript | mit | webkom/lego-webapp,webkom/lego-webapp,webkom/lego-webapp | ---
+++
@@ -22,7 +22,7 @@
href?: string
}>;
-export default function helmet<T>(propertyGenerator: PropertyGenerator) {
+export default function helmet<T>(propertyGenerator: ?PropertyGenerator) {
return (Component: ComponentType<T>) => ({
PropertyGenerator,
...props
@@ -30,10 +30,11 @@
propertyGenerator: PropertyGenerator
}) => [
<Helmet key="helmet">
- {propertyGenerator(props, config).map(
- ({ element, children, ...props }, index) =>
- createElement(element || 'meta', { key: index, ...props }, children)
- )}
+ {!!propertyGenerator &&
+ propertyGenerator(props, config).map(
+ ({ element, children, ...props }, index) =>
+ createElement(element || 'meta', { key: index, ...props }, children)
+ )}
</Helmet>,
<Component key="component" {...props} />
]; |
0e1918abc188791976b57e0ff58e49382920950e | src/bin/pfmt.js | src/bin/pfmt.js | #!/usr/bin/env node
import "babel-polyfill";
import yargs from "yargs";
import * as analyse from "../commands/analyse";
import * as measure from "../commands/measure";
yargs
.help("help")
.wrap(100)
.usage("Usage: $0 <command> [options]")
.command("analyse", "Analyse measurements", analyse)
.command("measure", "Run measurement scenarios", measure)
.command("stress", "Run stress scenarios", measure)
.parse(process.argv);
| #!/usr/bin/env node
import "babel-polyfill";
import yargs from "yargs";
import * as analyse from "../commands/analyse";
import * as measure from "../commands/measure";
import * as stress from "../commands/stress";
yargs
.help("help")
.wrap(100)
.usage("Usage: $0 <command> [options]")
.command("analyse", "Analyse measurements", analyse)
.command("measure", "Run measurement scenarios", measure)
.command("stress", "Run stress scenarios", stress)
.parse(process.argv);
| Use correct module for stress command | Use correct module for stress command
| JavaScript | apache-2.0 | performeter/pfmt | ---
+++
@@ -5,6 +5,7 @@
import * as analyse from "../commands/analyse";
import * as measure from "../commands/measure";
+import * as stress from "../commands/stress";
yargs
.help("help")
@@ -12,5 +13,5 @@
.usage("Usage: $0 <command> [options]")
.command("analyse", "Analyse measurements", analyse)
.command("measure", "Run measurement scenarios", measure)
- .command("stress", "Run stress scenarios", measure)
+ .command("stress", "Run stress scenarios", stress)
.parse(process.argv); |
027d53e264619b5839e73cea53f4b7d25b24b9eb | src/templates/default.js | src/templates/default.js | JSONEditor.defaults.templates["default"] = function() {
return {
compile: function(template) {
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g);
var l = matches.length;
// Shortcut if the template contains no variables
if(!l) return function() { return template; };
// Pre-compute the search/replace functions
// This drastically speeds up template execution
var replacements = [];
var get_replacement = function(i) {
var p = matches[i].replace(/[{}\s]+/g,'').split('.');
var n = p.length;
var func;
if(n > 1) {
var cur;
func = function(vars) {
cur = vars;
for(i=0; i<n; i++) {
cur = cur[p[i]];
if(!cur) break;
}
return cur;
};
}
else {
p = p[0];
func = function(vars) {
return vars[p];
};
}
replacements.push({
s: matches[i],
r: func
});
};
for(var i=0; i<l; i++) {
get_replacement(i);
}
// The compiled function
return function(vars) {
var ret = template+"";
var r;
for(i=0; i<l; i++) {
r = replacements[i];
ret = ret.replace(r.s, r.r(vars));
}
return ret;
};
}
};
};
| JSONEditor.defaults.templates["default"] = function() {
return {
compile: function(template) {
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g);
var l = matches && matches.length;
// Shortcut if the template contains no variables
if(!l) return function() { return template; };
// Pre-compute the search/replace functions
// This drastically speeds up template execution
var replacements = [];
var get_replacement = function(i) {
var p = matches[i].replace(/[{}\s]+/g,'').split('.');
var n = p.length;
var func;
if(n > 1) {
var cur;
func = function(vars) {
cur = vars;
for(i=0; i<n; i++) {
cur = cur[p[i]];
if(!cur) break;
}
return cur;
};
}
else {
p = p[0];
func = function(vars) {
return vars[p];
};
}
replacements.push({
s: matches[i],
r: func
});
};
for(var i=0; i<l; i++) {
get_replacement(i);
}
// The compiled function
return function(vars) {
var ret = template+"";
var r;
for(i=0; i<l; i++) {
r = replacements[i];
ret = ret.replace(r.s, r.r(vars));
}
return ret;
};
}
};
};
| Check that regex matching template vars is not null | Check that regex matching template vars is not null
| JavaScript | mit | LACabeza/json-editor,jdorn/json-editor,JJediny/json-editor,flibbertigibbet/json-editor,cunneen/json-editor,YousefED/json-editor,azavea/json-editor,flibbertigibbet/json-editor,ZECTBynmo/json-editor,ashwinrayaprolu1984/json-editor,timelyportfolio/json-editor,Tmeister/json-editor,grokify/json-editor,azavea/json-editor,abop/json-editor,juazugas/json-editor,dbirchak/json-editor,ivan4th/json-editor,juazugas/json-editor,grokify/json-editor,jdorn/json-editor,niebert/json-editor,cunneen/json-editor,rmulder/json-editor,niebert/json-editor,ZECTBynmo/json-editor,YousefED/json-editor,JJediny/json-editor,abop/json-editor,abe1001/json-editor,Tmeister/json-editor,timelyportfolio/json-editor,JJediny/json-editor,dbirchak/json-editor,cjc343/json-editor,abe1001/json-editor,LACabeza/json-editor,mrlong/json-editor,mrlong/json-editor,cjc343/json-editor,rmulder/json-editor,ivan4th/json-editor,ashwinrayaprolu1984/json-editor | ---
+++
@@ -2,7 +2,7 @@
return {
compile: function(template) {
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g);
- var l = matches.length;
+ var l = matches && matches.length;
// Shortcut if the template contains no variables
if(!l) return function() { return template; }; |
81df543d5c85579952727d19d2d0b8599899584e | src/actions/index.js | src/actions/index.js | let todoId = 0;
export const addTodo = (text) => (
{
type: 'ADD_TODO',
id: todoId++,
text
}
);
export const toggleTodo = (id) => (
{
type: 'TOGGLE_TODO',
id
}
);
| Add ADD_TODO and TOGGLE_TODO actions | Add ADD_TODO and TOGGLE_TODO actions
| JavaScript | mit | divyanshu013/impulse-tabs,divyanshu013/impulse-tabs | ---
+++
@@ -0,0 +1,16 @@
+let todoId = 0;
+
+export const addTodo = (text) => (
+ {
+ type: 'ADD_TODO',
+ id: todoId++,
+ text
+ }
+);
+
+export const toggleTodo = (id) => (
+ {
+ type: 'TOGGLE_TODO',
+ id
+ }
+); | |
fe0d3891b553b7080b5e9e0f22d1e4ed325e925d | build-tools/template/store/{name_cc}/{name_cc}.js | build-tools/template/store/{name_cc}/{name_cc}.js | {{#if mutations}}
{{#each mutations}}
export const {{this}} = '{{camelcase this}}';
{{/each}}
{{/if}}
export default {
namespaced: true,
state: {
},
getters: {
},
mutations: {
{{#if mutations}}
{{#each mutations}}
[{{this}}]: (state, payload) => {
},
{{/each}}
{{/if}}
},
actions: {
},
};
| {{#if mutations}}
{{#each mutations}}
export const {{this}} = '{{camelcase this}}';
{{/each}}
{{/if}}
export default {
namespaced: true,
state: {},
getters: {},
mutations: {
{{#if mutations}}
{{#each mutations}}
[{{this}}]: (state, payload) => {
},
{{/each}}
{{/if}}
},
actions: {},
};
| Update store template to match the rules of Prettier | Update store template to match the rules of Prettier | JavaScript | mit | hjeti/vue-skeleton,hjeti/vue-skeleton,hjeti/vue-skeleton | ---
+++
@@ -6,10 +6,8 @@
export default {
namespaced: true,
- state: {
- },
- getters: {
- },
+ state: {},
+ getters: {},
mutations: {
{{#if mutations}}
{{#each mutations}}
@@ -18,6 +16,5 @@
{{/each}}
{{/if}}
},
- actions: {
- },
+ actions: {},
}; |
c5a9d228885d03370e854b706508938390a16b8c | src/rules/extend-require-placeholder/index.js | src/rules/extend-require-placeholder/index.js | import { utils } from "stylelint"
export const ruleName = "extend-require-placeholder"
export const messages = utils.ruleMessages(ruleName, {
rejected: "Use a placeholder selector (e.g. %some-placeholder) with @extend",
})
export default function (actual) {
return function (root, result) {
const validOptions = utils.validateOptions(result, ruleName, { actual })
if (!validOptions) { return }
root.walkAtRules("extend", atrule => {
const isPlaceholder = (/^%/).test(atrule.params.trim())
const isInterpolation = (/^#{.+}/).test(atrule.params.trim())
if (!isPlaceholder && !isInterpolation) {
utils.report({
ruleName,
result,
node: atrule,
message: messages.rejected,
})
}
})
}
}
| import { utils } from "stylelint"
export const ruleName = "extend-require-placeholder"
export const messages = utils.ruleMessages(ruleName, {
rejected: "Use a placeholder selector (e.g. %some-placeholder) with @extend",
})
export default function (actual) {
return function (root, result) {
const validOptions = utils.validateOptions(result, ruleName, { actual })
if (!validOptions) { return }
root.walkAtRules("extend", atrule => {
const isPlaceholder = atrule.params.trim()[0] === "%"
const isInterpolation = (/^#{.+}/).test(atrule.params.trim())
if (!isPlaceholder && !isInterpolation) {
utils.report({
ruleName,
result,
node: atrule,
message: messages.rejected,
})
}
})
}
}
| Replace regex with faster check | Replace regex with faster check
| JavaScript | mit | kristerkari/stylelint-scss,dryoma/stylelint-scss | ---
+++
@@ -12,7 +12,7 @@
if (!validOptions) { return }
root.walkAtRules("extend", atrule => {
- const isPlaceholder = (/^%/).test(atrule.params.trim())
+ const isPlaceholder = atrule.params.trim()[0] === "%"
const isInterpolation = (/^#{.+}/).test(atrule.params.trim())
if (!isPlaceholder && !isInterpolation) { |
7645a663bab5266ca1d89b6a07ebc756719760e0 | client/src/js/home/components/Welcome.js | client/src/js/home/components/Welcome.js | import { get } from "lodash-es";
import React from "react";
import { connect } from "react-redux";
import { Icon, Panel } from "../../base";
const Welcome = props => {
let version;
if (props.version) {
version = <small className="text-muted">{props.version}</small>;
}
return (
<div className="container">
<Panel>
<Panel.Body>
<h3>Virtool {version}</h3>
<p>Viral infection diagnostics using next-generation sequencing</p>
<a
className="btn btn-default"
href="http://www.virtool.ca/"
target="_blank"
rel="noopener noreferrer"
>
<Icon name="globe" /> Website
</a>
</Panel.Body>
</Panel>
</div>
);
};
const mapStateToProps = state => ({
version: get(state.updates, "version")
});
export default connect(
mapStateToProps,
null
)(Welcome);
| import { get } from "lodash-es";
import React from "react";
import { connect } from "react-redux";
import { Box, Container, Icon } from "../../base";
const Welcome = props => {
let version;
if (props.version) {
version = <small className="text-muted">{props.version}</small>;
}
return (
<Container>
<Box>
<h3>Virtool {version}</h3>
<p>Viral infection diagnostics using next-generation sequencing</p>
<a className="btn btn-default" href="http://www.virtool.ca/" target="_blank" rel="noopener noreferrer">
<Icon name="globe" /> Website
</a>
</Box>
</Container>
);
};
const mapStateToProps = state => ({
version: get(state.updates, "version")
});
export default connect(
mapStateToProps,
null
)(Welcome);
| Replace Panel in home component | Replace Panel in home component
| JavaScript | mit | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool | ---
+++
@@ -1,7 +1,7 @@
import { get } from "lodash-es";
import React from "react";
import { connect } from "react-redux";
-import { Icon, Panel } from "../../base";
+import { Box, Container, Icon } from "../../base";
const Welcome = props => {
let version;
@@ -10,23 +10,16 @@
version = <small className="text-muted">{props.version}</small>;
}
return (
- <div className="container">
- <Panel>
- <Panel.Body>
- <h3>Virtool {version}</h3>
- <p>Viral infection diagnostics using next-generation sequencing</p>
+ <Container>
+ <Box>
+ <h3>Virtool {version}</h3>
+ <p>Viral infection diagnostics using next-generation sequencing</p>
- <a
- className="btn btn-default"
- href="http://www.virtool.ca/"
- target="_blank"
- rel="noopener noreferrer"
- >
- <Icon name="globe" /> Website
- </a>
- </Panel.Body>
- </Panel>
- </div>
+ <a className="btn btn-default" href="http://www.virtool.ca/" target="_blank" rel="noopener noreferrer">
+ <Icon name="globe" /> Website
+ </a>
+ </Box>
+ </Container>
);
};
|
f12eca2ec1ed8c5deeb2c27cb9f4dc47b02641d6 | static/javascript/map.js | static/javascript/map.js | requirejs.config({
paths: {
jquery: "/vendor/jquery",
}
});
define(['jquery'], function ($) {
var _ = window._,
Map = function(svg) {
this.svg = $(svg);
};
var _mpro = Map.prototype;
_mpro.paint = function(specifier) {
/* Paint the regions with the colours specified. */
var self = this;
_.each(_.keys(specifier), function(key) {
/* For each of the states specified, update the color */
$(self.svg).find('#' + key).css('fill', specifier[key]);
});
};
return Map;
});
| requirejs.config({
paths: {
jquery: "vendor/jquery",
}
});
define(['jquery'], function ($) {
var _ = window._,
Map = function(svg) {
this.svg = $(svg);
};
var _mpro = Map.prototype;
_mpro.paint = function(specifier) {
/* Paint the regions with the colours specified. */
var self = this;
_.each(_.keys(specifier), function(key) {
/* For each of the states specified, update the color */
$(self.svg).find('#' + key).css('fill', specifier[key]);
});
};
return Map;
});
| Use relative URL for jQuery | v0.1.2: Use relative URL for jQuery
| JavaScript | mit | schatten/cartos,schatten/cartos | ---
+++
@@ -1,6 +1,6 @@
requirejs.config({
paths: {
- jquery: "/vendor/jquery",
+ jquery: "vendor/jquery",
}
});
|
001c075f06c49ec3507328a0d0c936d26e1426ab | browser.js | browser.js | var browsers = [
[ 'chrome', /Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ ],
[ 'firefox', /Firefox\/([0-9\.]+)(?:\s|$)/ ],
[ 'opera', /Opera\/([0-9\.]+)(?:\s|$)/ ],
[ 'ie', /Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/ ],
[ 'ie', /MSIE\s([0-9\.]+);.*Trident\/[4-6].0/ ],
[ 'bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/ ]
];
var match = browsers.map(match).filter(isMatch)[0];
var parts = match && match[3].split('.').slice(0,3);
while (parts.length < 3) {
parts.push('0');
}
// set the name and version
exports.name = match && match[0];
exports.version = parts.join('.');
function match(pair) {
return pair.concat(pair[1].exec(navigator.userAgent));
}
function isMatch(pair) {
return !!pair[2];
}
| var browsers = [
[ 'chrome', /Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ ],
[ 'firefox', /Firefox\/([0-9\.]+)(?:\s|$)/ ],
[ 'opera', /Opera\/([0-9\.]+)(?:\s|$)/ ],
[ 'ie', /Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/ ],
[ 'ie', /MSIE\s([0-9\.]+);.*Trident\/[4-6].0/ ],
[ 'bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/ ]
];
var match = browsers.map(match).filter(isMatch)[0];
var parts = match && match[3].split('.').slice(0,3);
while (parts && parts.length < 3) {
parts.push('0');
}
// set the name and version
exports.name = match && match[0];
exports.version = parts && parts.join('.');
function match(pair) {
return pair.concat(pair[1].exec(navigator.userAgent));
}
function isMatch(pair) {
return !!pair[2];
}
| Fix access error when detection fails | Fix access error when detection fails
| JavaScript | mit | DamonOehlman/detect-browser,baribadamshin/detect-browser,DamonOehlman/detect-browser | ---
+++
@@ -10,13 +10,13 @@
var match = browsers.map(match).filter(isMatch)[0];
var parts = match && match[3].split('.').slice(0,3);
-while (parts.length < 3) {
+while (parts && parts.length < 3) {
parts.push('0');
}
// set the name and version
exports.name = match && match[0];
-exports.version = parts.join('.');
+exports.version = parts && parts.join('.');
function match(pair) {
return pair.concat(pair[1].exec(navigator.userAgent)); |
a178efa101fa6b716e03dbc1a86fe9db68904a6d | Test/Siv3DTest.js | Test/Siv3DTest.js | Module.preRun = [
function ()
{
FS.mkdir('/test');
FS.mount(NODEFS, { root: '../../Test/test' }, '/test');
FS.mkdir('/resources');
FS.mount(NODEFS, { root: './resources' }, '/resources');
}
] | Module.preRun = [
function ()
{
FS.mkdir('/test');
FS.mount(NODEFS, { root: '../../Test/test' }, '/test');
FS.mkdir('/resources');
FS.mount(NODEFS, { root: './resources' }, '/resources');
//
// Mock Implementations
//
global.navigator = {
getGamepads: function() {
return [];
}
}
}
] | Add mock function implementations (navigator.getGamepads()) | [Web][CI] Add mock function implementations (navigator.getGamepads())
| JavaScript | mit | Siv3D/OpenSiv3D,Siv3D/OpenSiv3D,Siv3D/OpenSiv3D,Siv3D/OpenSiv3D,Siv3D/OpenSiv3D,Siv3D/OpenSiv3D | ---
+++
@@ -6,5 +6,14 @@
FS.mkdir('/resources');
FS.mount(NODEFS, { root: './resources' }, '/resources');
+
+ //
+ // Mock Implementations
+ //
+ global.navigator = {
+ getGamepads: function() {
+ return [];
+ }
+ }
}
] |
677cbf4b30eaed2ccb9621879ec42b3078e6446a | test/testIntegration.js | test/testIntegration.js | /**
* Run each test under ./integration, one at a time.
* Each one will likely need to pollute global namespace, and thus will need to be run in a forked process.
*/
var fs = require('fs');
var files = fs.readdirSync(fs.realpathSync('./test/integration'));
var shell = require('shelljs');
var pattern = /^(test)\w*\.js$/;
for (var i in files) {
if (files.hasOwnProperty(i)) {
pattern.lastIndex = 0;
if (pattern.test(files[i])) {
exports[files[i]] = function(file, assert) {
file = './test/integration/' + file;
console.log(file);
shell.exec('node ' + file, function(code, output) {
console.log(output);
assert.equal(code, 0, "Integration run must exit with 0 status");
});
}.bind(this, files[i])
}
}
}
| /**
* Run each test under ./integration, one at a time.
* Each one will likely need to pollute global namespace, and thus will need to be run in a forked process.
*/
var fs = require('fs');
var files = fs.readdirSync(fs.realpathSync('./test/integration'));
var shell = require('shelljs');
var pattern = /^(test)\w*\.js$/;
for (var i in files) {
if (files.hasOwnProperty(i)) {
pattern.lastIndex = 0;
if (pattern.test(files[i])) {
exports[files[i]] = function(file, assert, done) {
file = './test/integration/' + file;
console.log(file);
shell.exec('node ' + file, function(code, output) {
assert.equal(code, 0, "Integration run must exit with 0 status");
done();
});
}.bind(this, files[i])
}
}
}
| Fix async logic in integration test runner | Fix async logic in integration test runner
| JavaScript | mit | jay-depot/turnpike,jay-depot/turnpike | ---
+++
@@ -12,12 +12,12 @@
if (files.hasOwnProperty(i)) {
pattern.lastIndex = 0;
if (pattern.test(files[i])) {
- exports[files[i]] = function(file, assert) {
+ exports[files[i]] = function(file, assert, done) {
file = './test/integration/' + file;
console.log(file);
shell.exec('node ' + file, function(code, output) {
- console.log(output);
assert.equal(code, 0, "Integration run must exit with 0 status");
+ done();
});
}.bind(this, files[i])
} |
4ca81eb3e33a007f18a9aa59051d9bea4a34cd4b | packages/fs/src/index.js | packages/fs/src/index.js | 'use strict'
/* @flow */
import FS from 'fs'
import Path from 'path'
import promisify from 'sb-promisify'
export const readFile = promisify(FS.readFile)
export const writeFile = promisify(FS.writeFile)
export async function readJSON(filePath: string, encoding: string = 'utf8'): Promise {
const contents = await readFile(filePath)
return JSON.parse(contents.toString(encoding))
}
export function exists(filePath: string): Promise<boolean> {
return new Promise(function(resolve) {
FS.access(filePath, FS.R_OK, function(error) {
resolve(error === null)
})
})
}
| 'use strict'
/* @flow */
import FS from 'fs'
import Path from 'path'
import promisify from 'sb-promisify'
export const readFile = promisify(FS.readFile)
export const writeFile = promisify(FS.writeFile)
export async function readJSON(filePath: string, encoding: string = 'utf8'): Promise {
const contents = await readFile(filePath)
return JSON.parse(contents.toString(encoding))
}
export async function writeJSON(filePath: string, contents: Object): Promise {
await writeFile(filePath, JSON.stringify(contents))
}
export function exists(filePath: string): Promise<boolean> {
return new Promise(function(resolve) {
FS.access(filePath, FS.R_OK, function(error) {
resolve(error === null)
})
})
}
| Add writeJSON method in motion-fs | :new: Add writeJSON method in motion-fs
| JavaScript | mpl-2.0 | flintjs/flint,flintjs/flint,motion/motion,motion/motion,flintjs/flint | ---
+++
@@ -12,6 +12,9 @@
const contents = await readFile(filePath)
return JSON.parse(contents.toString(encoding))
}
+export async function writeJSON(filePath: string, contents: Object): Promise {
+ await writeFile(filePath, JSON.stringify(contents))
+}
export function exists(filePath: string): Promise<boolean> {
return new Promise(function(resolve) {
FS.access(filePath, FS.R_OK, function(error) { |
c35ffdfa5adfa42ac7db1e6475fae2687794aea7 | db/models/index.js | db/models/index.js | // This file makes all join table relationships
const database = process.env.DB_DATABASE;
const dbHost = process.env.DB_HOST;
const dbUser = process.env.DB_USER;
const dbPassword = process.env.DB_PASS;
const Sequelize = require('sequelize');
const sequelize = new Sequelize(database, dbUser, dbPassword, {
dialect: 'mariadb',
host: dbHost
});
// Any vairable that starts with a capital letter is a model
const User = require('./users.js')(sequelize, Sequelize);
const Bookmark = require('./bookmarks.js')(sequelize, Sequelize);
const BookmarkUsers = require('./bookmarkUsers')(sequelize, Sequelize);
// BookmarkUsers join table:
User.belongsToMany(Bookmark, {
through: 'bookmark_users',
foreignKey: 'user_id'
});
Bookmark.belongsToMany(User, {
through: 'bookmark_users',
foreignKey: 'bookmark_id'
});
//Create missing tables, if any
// sequelize.sync({force: true});
sequelize.sync();
exports.User = User;
exports.Bookmark = Bookmark;
exports.BookmarkUsers = BookmarkUsers; | // This file makes all join table relationships
const db = process.env.DB_DATABASE;
const dbHost = process.env.DB_HOST;
const dbUser = process.env.DB_USER;
const dbPassword = process.env.DB_PASS;
const Sequelize = require('sequelize');
const sequelize = new Sequelize(db, dbUser, dbPassword, {
dialect: 'mariadb',
host: dbHost
});
// Any vairable that starts with a capital letter is a model
const User = require('./users.js')(sequelize, Sequelize);
const Bookmark = require('./bookmarks.js')(sequelize, Sequelize);
const BookmarkUsers = require('./bookmarkUsers')(sequelize, Sequelize);
// BookmarkUsers join table:
User.belongsToMany(Bookmark, {
through: 'bookmark_users',
foreignKey: 'user_id'
});
Bookmark.belongsToMany(User, {
through: 'bookmark_users',
foreignKey: 'bookmark_id'
});
//Create missing tables, if any
// sequelize.sync({force: true});
sequelize.sync();
exports.User = User;
exports.Bookmark = Bookmark;
exports.BookmarkUsers = BookmarkUsers; | Make variable name more consistent | Make variable name more consistent
| JavaScript | mit | francoabaroa/escape-reality,francoabaroa/escape-reality,lowtalkers/escape-reality,lowtalkers/escape-reality | ---
+++
@@ -1,10 +1,10 @@
// This file makes all join table relationships
-const database = process.env.DB_DATABASE;
+const db = process.env.DB_DATABASE;
const dbHost = process.env.DB_HOST;
const dbUser = process.env.DB_USER;
const dbPassword = process.env.DB_PASS;
const Sequelize = require('sequelize');
-const sequelize = new Sequelize(database, dbUser, dbPassword, {
+const sequelize = new Sequelize(db, dbUser, dbPassword, {
dialect: 'mariadb',
host: dbHost
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.