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 |
|---|---|---|---|---|---|---|---|---|---|---|
c4343b696f36d188fed5e3a3a82c44b38042ef02 | Proyectos/Atari/Asteroids/main.js | Proyectos/Atari/Asteroids/main.js | function setup(){
// Defining Initial Configuration
var DIFF_INIT = 4;
createCanvas(windowWidth - DIFF_INIT, windowHeight - DIFF_INIT);
}
function draw(){
background(0);
}
| var height = windowHeight;
var width = windowWidth;
function setup(){
// Defining Initial Configuration
var DIFF_INIT = 4;
createCanvas(windowWidth - DIFF_INIT, windowHeight - DIFF_INIT);
}
function draw(){
background(0);
ship = new Ship();
ship.render();
}
function Ship(){
this.pos = createVector(width/2, height/2)
this.r = 20; // Radius
this.heading = 0; // Heading of the Ship
// RENDER SHIP
this.render = function(){
noFill();
stroke(255);
translate(this.pos.x, this.pos.y);
triangle(-this.r, this.r, this.r, this.r, 0, -this.r);
}
}
| Create ship structure. Render function | Create ship structure. Render function
| JavaScript | mit | mora200217/Projects-Young-Engineers-,mora200217/Projects-Young-Engineers- | ---
+++
@@ -1,3 +1,6 @@
+var height = windowHeight;
+var width = windowWidth;
+
function setup(){
// Defining Initial Configuration
var DIFF_INIT = 4;
@@ -6,4 +9,20 @@
function draw(){
background(0);
+ ship = new Ship();
+ ship.render();
}
+
+function Ship(){
+ this.pos = createVector(width/2, height/2)
+ this.r = 20; // Radius
+ this.heading = 0; // Heading of the Ship
+ // RENDER SHIP
+ this.render = function(){
+ noFill();
+ stroke(255);
+ translate(this.pos.x, this.pos.y);
+ triangle(-this.r, this.r, this.r, this.r, 0, -this.r);
+ }
+
+} |
c769a19905f31c28bf51024030f8b59fe3ec2682 | lib/access_filter.js | lib/access_filter.js | var FESTAPP_REALM = 'Basic realm="festapp-server"';
function validateBasicAuth(accounts, req, res, next) {
if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
if (accounts.indexOf(new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString()) !== -1) {
next();
} else {
res.header('WWW-Authenticate', FESTAPP_REALM);
res.send('Wrong username or password', 401);
}
} else {
res.header('WWW-Authenticate', FESTAPP_REALM);
res.send(401);
}
}
module.exports = {
authAPI: function(accounts, apiVersion) {
// Only allow GET, OPTIONS and HEAD-requests to /api-calls without
// HTTP Basic authentication
return function accessFilter(req, res, next) {
var matchStar = new RegExp(apiVersion+'/events/\\w+/star.*').test(req.path);
if (req.method === 'GET' || req.method === 'OPTIONS' || req.method === 'HEAD' || matchStar) {
next();
} else {
validateBasicAuth(accounts, req, res, next);
}
};
},
authAdminUI: function(accounts) {
return function(req, res, next) {
validateBasicAuth(accounts, req, res, next);
};
}
};
| var FESTAPP_REALM = 'Basic realm="conference-server"';
function validateBasicAuth(accounts, req, res, next) {
if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
if (accounts.indexOf(new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString()) !== -1) {
next();
} else {
res.header('WWW-Authenticate', FESTAPP_REALM);
res.send('Wrong username or password', 401);
}
} else {
res.header('WWW-Authenticate', FESTAPP_REALM);
res.send(401);
}
}
module.exports = {
authAPI: function(accounts, apiVersion) {
// Only allow GET, OPTIONS and HEAD-requests to /api-calls without
// HTTP Basic authentication
return function accessFilter(req, res, next) {
var matchStar = new RegExp(apiVersion+'/events/\\w+/star.*').test(req.path);
if (req.method === 'GET' || req.method === 'OPTIONS' || req.method === 'HEAD' || matchStar) {
next();
} else {
validateBasicAuth(accounts, req, res, next);
}
};
},
authAdminUI: function(accounts) {
return function(req, res, next) {
validateBasicAuth(accounts, req, res, next);
};
}
};
| Update basic auth realm from festapp-server to conference-server | Update basic auth realm from festapp-server to conference-server
| JavaScript | mit | futurice/sec-conference-server,futurice/sec-conference-server | ---
+++
@@ -1,4 +1,4 @@
-var FESTAPP_REALM = 'Basic realm="festapp-server"';
+var FESTAPP_REALM = 'Basic realm="conference-server"';
function validateBasicAuth(accounts, req, res, next) {
if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) { |
fb370cf64b78a8438128ba6a6e40ee155049570c | themes/mytheme/assetManager/mytheme.js | themes/mytheme/assetManager/mytheme.js |
module.exports = {
__module: {
provides: {
use_scripts: {},
use_stylesheets: {},
register_assets_dir: {after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']},
register_views_dir: {after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']}
}
},
register_assets_dir: function() {
return __dirname + "/../assets";
},
register_views_dir: function() {
return __dirname + "/../views";
},
use_scripts: function() {
return {};
},
use_stylesheets: function() {
return {};
}
}; |
module.exports = {
__module: {
provides: {
"assetManager/use_scripts": {},
"assetManager/use_stylesheets": {},
"assetManager/register_assets_dir": {
after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']
},
"assetManager/register_views_dir": {
after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']
}
}
},
register_assets_dir: function() {
return __dirname + "/../assets";
},
register_views_dir: function() {
return __dirname + "/../views";
},
use_scripts: function() {
return {};
},
use_stylesheets: function() {
return {};
}
}; | Update services to use full namespace (Scatter 0.7) | Update services to use full namespace (Scatter 0.7)
| JavaScript | mit | hadronjs/hadron-seed,VenturaStudios/Blog | ---
+++
@@ -3,10 +3,14 @@
module.exports = {
__module: {
provides: {
- use_scripts: {},
- use_stylesheets: {},
- register_assets_dir: {after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']},
- register_views_dir: {after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']}
+ "assetManager/use_scripts": {},
+ "assetManager/use_stylesheets": {},
+ "assetManager/register_assets_dir": {
+ after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']
+ },
+ "assetManager/register_views_dir": {
+ after: ['assetManager/bootstrap', 'assetManager/hadron', 'assetManager/hadron-theme-nodus']
+ }
}
},
|
54bc7736bc5d3381a48eebba476f0933884899c6 | lib/errorMessages.js | lib/errorMessages.js | "use strict";
module.exports = {
loadUninitialized: "You must first call store.load",
undefinedValue: "Value must not be undefined.",
invalidNamespace: "namespace can not contain a hash character (#)",
nonexistentKey: "Key does not exist",
invalidKey: "Key must be a string."
};
| "use strict";
module.exports = {
loadUninitialized: "You must first call store.load or store.clear.",
undefinedValue: "Value must not be undefined.",
invalidNamespace: "namespace can not contain a hash character (#).",
nonexistentKey: "Key does not exist.",
invalidKey: "Key must be a string."
};
| Clean up some error message. | Clean up some error message.
| JavaScript | mit | YuzuJS/storeit | ---
+++
@@ -1,9 +1,9 @@
"use strict";
module.exports = {
- loadUninitialized: "You must first call store.load",
+ loadUninitialized: "You must first call store.load or store.clear.",
undefinedValue: "Value must not be undefined.",
- invalidNamespace: "namespace can not contain a hash character (#)",
- nonexistentKey: "Key does not exist",
+ invalidNamespace: "namespace can not contain a hash character (#).",
+ nonexistentKey: "Key does not exist.",
invalidKey: "Key must be a string."
}; |
d05779f3239db1964d19cf9daf393b0addc4d722 | stylist/gulpfile.js | stylist/gulpfile.js | 'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
//var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
gulp.task('default', function() {
// place code for your default task here
console.log("default task (does nothing!)");
});
gulp.task('js', function () {
// call from command line as 'gulp js'
// set up the browserify instance on a task basis
var b = browserify({
entries: './stylist.js',
//entries: './vg.data.stash.js',
debug: true
});
return b.bundle()
.pipe(source('stylist-bundle.js'))
.pipe(buffer())
/*
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
*/
.pipe(gulp.dest('./'));
});
| 'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
//var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
gulp.task('default', function() {
// place code for your default task here
console.log("default task (does nothing!)");
});
gulp.task('js', function () {
// call from command line as 'gulp js'
// set up the browserify instance on a task basis
var b = browserify({
entries: './stylist.js',
//entries: './vg.data.stash.js',
debug: true // enables sourcemaps
});
return b.bundle()
.pipe(source('stylist-bundle.js'))
.pipe(buffer())
/*
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
*/
.pipe(gulp.dest('./'));
});
| Clarify use of 'debug' option | Clarify use of 'debug' option
| JavaScript | bsd-2-clause | OpenTreeOfLife/tree-illustrator,OpenTreeOfLife/tree-illustrator | ---
+++
@@ -19,7 +19,7 @@
var b = browserify({
entries: './stylist.js',
//entries: './vg.data.stash.js',
- debug: true
+ debug: true // enables sourcemaps
});
return b.bundle() |
09f77b61290b4a2010ba94fcf9c23ef7ba877291 | lib/loggly/config.js | lib/loggly/config.js | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default values
//
exports.createConfig = function (defaults) {
return new Config(defaults);
};
//
// Config (defaults)
// Constructor for the Config object
//
var Config = exports.Config = function (defaults) {
if (!defaults.subdomain) {
throw new Error('Subdomain is required to create an instance of Config');
}
this.subdomain = defaults.subdomain;
this.json = defaults.json || null;
this.auth = defaults.auth || null;
};
Config.prototype = {
get subdomain () {
return this._subdomain;
},
set subdomain (value) {
this._subdomain = value;
},
get logglyUrl () {
return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
},
get inputUrl () {
return 'https://logs.loggly.com/inputs/';
}
}; | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default values
//
exports.createConfig = function (defaults) {
return new Config(defaults);
};
//
// Config (defaults)
// Constructor for the Config object
//
var Config = exports.Config = function (defaults) {
if (!defaults.subdomain) {
throw new Error('Subdomain is required to create an instance of Config');
}
this.subdomain = defaults.subdomain;
this.json = defaults.json || null;
this.auth = defaults.auth || null;
};
Config.prototype = {
get subdomain () {
return this._subdomain;
},
set subdomain (value) {
this._subdomain = value;
},
get logglyUrl () {
return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
},
get inputUrl () {
return 'https://logs.loggly.com/inputs/';
}
};
| Replace Unicode space (U+00A0) with ASCII space | [fix] Replace Unicode space (U+00A0) with ASCII space
| JavaScript | mit | rosskukulinski/node-loggly,dtudury/node-loggly,freeall/node-loggly,nodejitsu/node-loggly,moonshadowmobile/node-loggly,mafintosh/node-loggly,mavrick/node-loggly | ---
+++
@@ -26,7 +26,7 @@
}
this.subdomain = defaults.subdomain;
- this.json = defaults.json || null;
+ this.json = defaults.json || null;
this.auth = defaults.auth || null;
};
|
dd361a06ea0f02173559b96ba96ec5d05ce1ac09 | lib/responseCache.js | lib/responseCache.js | var ResponseCache = function() {
this.cache = {};
};
ResponseCache.prototype.buildCacheKey = function(request) {
return request.files.join(',') + (request.minify ? '|min' : '');
};
ResponseCache.prototype.get = function(request) {
var cacheKey = this.buildCacheKey(request);
return this.cache[cacheKey];
};
ResponseCache.prototype.put = function(request, response) {
var self = this,
cacheKey = this.buildCacheKey(request);
this.cache[cacheKey] = response;
/*
for (i = 0; i < request.fileDataList.length; i++) {
if (!self.cacheFileDependencies[request.fileDataList[i].filePath]) {
self.cacheFileDependencies[request.fileDataList[i].filePath] = [];
(function(filePath) {
fs.watchFile(filePath, function(curr, prev) {
var cacheKey = self.cacheFileDependencies[filePath];
//delete self.cache[cacheKey];
});
})(request.fileDataList[i].filePath);
}
self.cacheFileDependencies[request.fileDataList[i].filePath].push(cacheKey);
}
*/
};
module.exports.ResponseCache = ResponseCache;
| var ResponseCache = function() {
this.cache = {};
};
ResponseCache.prototype.buildCacheKey = function(request) {
var i, filePaths = [];
for (i = 0; i < request.files.length; i++) {
filePaths.push(request.files[i].path);
}
return filePaths.sort().join(',') + (request.minify ? '|min' : '');
};
ResponseCache.prototype.get = function(request) {
var cacheKey = this.buildCacheKey(request);
return this.cache[cacheKey];
};
ResponseCache.prototype.put = function(request, response) {
var self = this,
cacheKey = this.buildCacheKey(request);
this.cache[cacheKey] = response;
/*
for (i = 0; i < request.fileDataList.length; i++) {
if (!self.cacheFileDependencies[request.fileDataList[i].filePath]) {
self.cacheFileDependencies[request.fileDataList[i].filePath] = [];
(function(filePath) {
fs.watchFile(filePath, function(curr, prev) {
var cacheKey = self.cacheFileDependencies[filePath];
//delete self.cache[cacheKey];
});
})(request.fileDataList[i].filePath);
}
self.cacheFileDependencies[request.fileDataList[i].filePath].push(cacheKey);
}
*/
};
module.exports.ResponseCache = ResponseCache;
| Fix bug in buildCacheKey function causing caching to miss every time. | Fix bug in buildCacheKey function causing caching to miss every time.
| JavaScript | mit | dmcquay/gracie | ---
+++
@@ -3,7 +3,11 @@
};
ResponseCache.prototype.buildCacheKey = function(request) {
- return request.files.join(',') + (request.minify ? '|min' : '');
+ var i, filePaths = [];
+ for (i = 0; i < request.files.length; i++) {
+ filePaths.push(request.files[i].path);
+ }
+ return filePaths.sort().join(',') + (request.minify ? '|min' : '');
};
ResponseCache.prototype.get = function(request) { |
f62fc49132f13b5a06c958dd0dd35276b2cfbc1a | lib/task-data/tasks/bootstrap-ubuntu.js | lib/task-data/tasks/bootstrap-ubuntu.js | // Copyright 2015, EMC, Inc.
'use strict';
module.exports = {
friendlyName: 'Bootstrap Ubuntu',
injectableName: 'Task.Linux.Bootstrap.Ubuntu',
implementsTask: 'Task.Base.Linux.Bootstrap',
options: {
kernelFile: 'vmlinuz-3.13.0-32-generic',
initrdFile: 'initrd.img-3.13.0-32-generic',
kernelUri: '{{ api.server }}/common/{{ options.kernelFile }}',
initrdUri: '{{ api.server }}/common/{{ options.initrdFile }}',
basefs: 'common/base.trusty.3.13.0-32-generic.squashfs.img',
overlayfs: 'common/discovery.overlay.cpio.gz',
profile: 'linux.ipxe',
comport: 'ttyS0'
},
properties: {
os: {
linux: {
distribution: 'ubuntu',
release: 'trusty',
kernel: '3.13.0-32-generic'
}
}
}
};
| // Copyright 2015, EMC, Inc.
'use strict';
module.exports = {
friendlyName: 'Bootstrap Ubuntu',
injectableName: 'Task.Linux.Bootstrap.Ubuntu',
implementsTask: 'Task.Base.Linux.Bootstrap',
options: {
kernelFile: 'vmlinuz-3.16.0-25-generic',
initrdFile: 'initrd.img-3.16.0-25-generic',
kernelUri: '{{ api.server }}/common/{{ options.kernelFile }}',
initrdUri: '{{ api.server }}/common/{{ options.initrdFile }}',
basefs: 'common/base.trusty.3.16.0-25-generic.squashfs.img',
overlayfs: 'common/discovery.overlay.cpio.gz',
profile: 'linux.ipxe',
comport: 'ttyS0'
},
properties: {
os: {
linux: {
distribution: 'ubuntu',
release: 'trusty',
kernel: '3.16.0-25-generic'
}
}
}
};
| Update kernel version of ubuntu microkernel to 3.16.0-25-generic. | Update kernel version of ubuntu microkernel to 3.16.0-25-generic.
| JavaScript | apache-2.0 | AlaricChan/on-tasks,AlaricChan/on-tasks,nortonluo/on-tasks,bbcyyb/on-tasks,bbcyyb/on-tasks,nortonluo/on-tasks | ---
+++
@@ -7,11 +7,11 @@
injectableName: 'Task.Linux.Bootstrap.Ubuntu',
implementsTask: 'Task.Base.Linux.Bootstrap',
options: {
- kernelFile: 'vmlinuz-3.13.0-32-generic',
- initrdFile: 'initrd.img-3.13.0-32-generic',
+ kernelFile: 'vmlinuz-3.16.0-25-generic',
+ initrdFile: 'initrd.img-3.16.0-25-generic',
kernelUri: '{{ api.server }}/common/{{ options.kernelFile }}',
initrdUri: '{{ api.server }}/common/{{ options.initrdFile }}',
- basefs: 'common/base.trusty.3.13.0-32-generic.squashfs.img',
+ basefs: 'common/base.trusty.3.16.0-25-generic.squashfs.img',
overlayfs: 'common/discovery.overlay.cpio.gz',
profile: 'linux.ipxe',
comport: 'ttyS0'
@@ -21,7 +21,7 @@
linux: {
distribution: 'ubuntu',
release: 'trusty',
- kernel: '3.13.0-32-generic'
+ kernel: '3.16.0-25-generic'
}
}
} |
90e45eb173b917a396e321033303ff4e0fe3c6a2 | discord/addon/bpm.js | discord/addon/bpm.js | // BetterDiscord pls.
try {
window.localStorage = bdPluginStorage;
} catch (e) {
// Non-BD localStorage shim
if(window.localStorage === undefined) {
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
window.localStorage = iframe.contentWindow.localStorage;
}
}
require('./updates/updates.js');
//require('./settings/settings.js');
require('./core/core.js');
require('./search/search.js');
| // BetterDiscord pls.
try {
window.localStorage = bdPluginStorage;
} catch (e) {
// Non-BD localStorage shim
if(window.localStorage === undefined) {
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
window.localStorage = iframe.contentWindow.localStorage;
}
}
// require('./updates/updates.js');
//require('./settings/settings.js');
require('./core/core.js');
require('./search/search.js');
| Remove update notifications, broken due to new CSP header | Remove update notifications, broken due to new CSP header
| JavaScript | agpl-3.0 | ByzantineFailure/BPM-for-Discord,ByzantineFailure/BPM-for-Discord,ByzantineFailure/BPM-for-Discord,ByzantineFailure/BPM-for-Discord | ---
+++
@@ -11,7 +11,7 @@
}
}
-require('./updates/updates.js');
+// require('./updates/updates.js');
//require('./settings/settings.js');
require('./core/core.js');
require('./search/search.js'); |
3684fa4da12fe4f08f5242a0dc9b6f7a63e90aa9 | test/get-profile.js | test/get-profile.js | 'use strict'
const tap = require('tap')
const nock = require('nock')
const Bot = require('../')
tap.test('bot.getProfile() - successful request', (t) => {
let bot = new Bot({
token: 'foo'
})
let response = {
first_name: 'Cool',
last_name: 'Kid',
profile_pic: 'url'
}
nock('https://graph.facebook.com').get('/v2.6/1').query({
fields: 'first_name,last_name,profile_pic',
access_token: 'foo'
}).reply(200, response)
bot.getProfile(1, (err, profile) => {
t.error(err, 'response should not be error')
t.deepEquals(profile, response, 'response is correct')
t.end()
})
})
| 'use strict'
const tap = require('tap')
const nock = require('nock')
const Bot = require('../')
tap.test('bot.getProfile() - successful request', (t) => {
let bot = new Bot({
token: 'foo'
})
let response = {
first_name: 'Cool',
last_name: 'Kid',
profile_pic: 'url',
locale: 'en',
timezone: 'PST',
gender: 'M'
}
nock('https://graph.facebook.com').get('/v2.6/1').query({
fields: 'first_name,last_name,profile_pic',
access_token: 'foo'
}).reply(200, response)
bot.getProfile(1, (err, profile) => {
t.error(err, 'response should not be error')
t.deepEquals(profile, response, 'response is correct')
t.end()
})
})
| Update test for getProfile with new profile fields | Update test for getProfile with new profile fields | JavaScript | mit | remixz/messenger-bot | ---
+++
@@ -11,7 +11,10 @@
let response = {
first_name: 'Cool',
last_name: 'Kid',
- profile_pic: 'url'
+ profile_pic: 'url',
+ locale: 'en',
+ timezone: 'PST',
+ gender: 'M'
}
nock('https://graph.facebook.com').get('/v2.6/1').query({ |
c09dc7c800e6930f6d1ed6ca8fcaf3dce0b89ae8 | examples/Maps/source/CurrentLocation.js | examples/Maps/source/CurrentLocation.js | enyo.kind({
name: "CurrentLocation",
kind: "Component",
events: {
onSuccess: "",
onFailure: ""
},
destroy: function() {
this.stopTracking();
this.inherited(arguments);
},
stopTracking: function() {
if (this._watchId) {
navigator.geolocation.clearWatch(this._watchId);
}
},
go: function() {
this._watchId = navigator.geolocation.watchPosition(
enyo.bind(this, "doSuccess"),
enyo.bind(this, "doFailure"),
{maximumAge: 600, timeout: 10000});
}
});
| enyo.kind({
name: "CurrentLocation",
kind: "Component",
events: {
onSuccess: "",
onFailure: "doFailure"
},
doFailure: function(error) {
console.log("Geolocation error #" + error.code + ": " + error.message);
},
destroy: function() {
this.stopTracking();
this.inherited(arguments);
},
stopTracking: function() {
if (this._watchId) {
navigator.geolocation.clearWatch(this._watchId);
}
},
go: function() {
if(!!navigator.geolocation) {
this._watchId = navigator.geolocation.watchPosition(
enyo.bind(this, "doSuccess"),
enyo.bind(this, "doFailure"),
{maximumAge: 600, timeout: 10000});
} else {
console.log("Geolocation error: Browser does not support navigator.geolocation!");
}
}
});
| Add logging for geolocation failure cases | Add logging for geolocation failure cases
Might help people figure out why it's failing, like when trying to run
this on a desktop browser (with no wifi) or a laptop with wifi
disabled, and no IP-based geolocation available (e.g. behind corporate
firewall).
| JavaScript | apache-2.0 | onecrayon/onyx,mcanthony/onyx,enyojs/onyx,onecrayon/onyx,enyojs/onyx,mcanthony/onyx | ---
+++
@@ -3,9 +3,12 @@
kind: "Component",
events: {
onSuccess: "",
- onFailure: ""
- },
- destroy: function() {
+ onFailure: "doFailure"
+ },
+ doFailure: function(error) {
+ console.log("Geolocation error #" + error.code + ": " + error.message);
+ },
+ destroy: function() {
this.stopTracking();
this.inherited(arguments);
},
@@ -15,9 +18,13 @@
}
},
go: function() {
- this._watchId = navigator.geolocation.watchPosition(
- enyo.bind(this, "doSuccess"),
- enyo.bind(this, "doFailure"),
- {maximumAge: 600, timeout: 10000});
- }
+ if(!!navigator.geolocation) {
+ this._watchId = navigator.geolocation.watchPosition(
+ enyo.bind(this, "doSuccess"),
+ enyo.bind(this, "doFailure"),
+ {maximumAge: 600, timeout: 10000});
+ } else {
+ console.log("Geolocation error: Browser does not support navigator.geolocation!");
+ }
+ }
}); |
595d211f6c2f6bbb2d95b1a54083c3aa36f0e275 | lib/mixins/streamable.js | lib/mixins/streamable.js | /*global Promise:true*/
'use strict';
var EventSource = global.EventSource || require('eventsource')
, Promise = require('rsvp').Promise
;
var _source;
var Streamable = {
listen: {
value: function () {
return new Promise(function (resolve, reject) {
var source
, url = this.url;
if (this.token) {
url = url + '?x-auth-token=' + this.token.token;
}
try {
source = _source = this.cacheStream && _source || new EventSource(url);
} catch (e) {
return reject(e);
}
return resolve(source);
}.bind(this));
}
}
};
module.exports = Streamable;
| /*global Promise:true*/
'use strict';
var EventSource = global.EventSource || require('eventsource')
, Promise = require('rsvp').Promise
;
var _source;
var Streamable = {
listen: {
value: function () {
return new Promise(function (resolve, reject) {
var source
, url = this.url;
if (this.token && this.token.token) {
url = url + '?x-auth-token=' + this.token.token;
}
try {
source = _source = this.cacheStream && _source || new EventSource(url);
} catch (e) {
return reject(e);
}
return resolve(source);
}.bind(this));
}
}
};
module.exports = Streamable;
| Fix stream sending undefined as an x-auth-token | Fix stream sending undefined as an x-auth-token
| JavaScript | apache-2.0 | StackStorm/st2client.js,StackStorm/st2client.js | ---
+++
@@ -14,7 +14,7 @@
var source
, url = this.url;
- if (this.token) {
+ if (this.token && this.token.token) {
url = url + '?x-auth-token=' + this.token.token;
}
|
864404605affba4e647fdf016080c4685aa56604 | examples/server-rendering/components.js | examples/server-rendering/components.js | import React, { Component, PropTypes } from 'react';
import {connect} from 'react-redux';
import {Link} from 'react-router';
@connect(state => ({ routerState: state.router }))
export const App = class App extends Component {
static propTypes = {
children: PropTypes.node
}
render() {
const links = [
'/',
'/parent?foo=bar',
'/parent/child?bar=baz',
'/parent/child/123?baz=foo'
].map((l, i) =>
<p key={i}>
<Link to={l}>{l}</Link>
</p>
);
return (
<div>
<h1>App Container</h1>
{links}
{this.props.children}
</div>
);
}
};
export const Parent = class Parent extends Component {
static propTypes = {
children: PropTypes.node
}
render() {
return (
<div>
<h2>Parent</h2>
{this.props.children}
</div>
);
}
};
export const Child = class Child extends Component {
render() {
return (
<div>
<h2>Child</h2>
</div>
);
}
};
| import React, { Component, PropTypes } from 'react';
import {connect} from 'react-redux';
import {Link} from 'react-router';
@connect(state => ({ routerState: state.router }))
export const App = class App extends Component {
static propTypes = {
children: PropTypes.node
}
render() {
const links = [
'/',
'/parent?foo=bar',
'/parent/child?bar=baz',
'/parent/child/123?baz=foo'
].map((l, i) =>
<p key={i}>
<Link to={l}>{l}</Link>
</p>
);
return (
<div>
<h1>App Container</h1>
{links}
{this.props.children}
</div>
);
}
};
export const Parent = class Parent extends Component {
static propTypes = {
children: PropTypes.node
}
render() {
return (
<div>
<h2>Parent</h2>
{this.props.children}
</div>
);
}
};
export const Child = class Child extends Component {
render() {
const { params: { id }} = this.props;
return (
<div>
<h2>Child</h2>
{id && <p>{id}</p>}
</div>
);
}
};
| Update server example to match client example | Update server example to match client example
| JavaScript | mit | mjrussell/redux-router,acdlite/redux-router,rackt/redux-router | ---
+++
@@ -47,10 +47,13 @@
export const Child = class Child extends Component {
render() {
+ const { params: { id }} = this.props;
+
return (
- <div>
- <h2>Child</h2>
- </div>
+ <div>
+ <h2>Child</h2>
+ {id && <p>{id}</p>}
+ </div>
);
}
}; |
f49bba2ba6a6eedf7679af1bfd5936572a4a147c | lib/app/private/exposeGlobals.js | lib/app/private/exposeGlobals.js | /**
* Module dependencies.
*/
var _ = require('lodash');
var async = require('async');
/**
* exposeGlobals()
*
* Expose certain global variables
* (if config says so)
*
* @api private
*/
module.exports = function exposeGlobals() {
var sails = this;
sails.log.verbose('Exposing global variables... (you can disable this by modifying the properties in `sails.config.globals`)');
// Globals explicitly disabled
if (sails.config.globals === false) {
return;
}
sails.config.globals = sails.config.globals || {};
// Provide global access (if allowed in config)
if (sails.config.globals._) {
global['_'] = _;
}
if (sails.config.globals.async !== false) {
global['async'] = async;
}
if (sails.config.globals.sails !== false) {
global['sails'] = sails;
}
// `services` hook takes care of globalizing services (if enabled)
// `orm` hook takes care of globalizing models and adapters (if enabled)
};
| /**
* Module dependencies.
*/
var _ = require('lodash');
var async = require('async');
/**
* exposeGlobals()
*
* Expose certain global variables
* (if config says so)
*
* @api private
*/
module.exports = function exposeGlobals() {
var sails = this;
sails.log.verbose('Exposing global variables... (you can disable this by modifying the properties in `sails.config.globals`)');
// Globals explicitly disabled
if (sails.config.globals === false) {
return;
}
sails.config.globals = sails.config.globals || {};
// Provide global access (if allowed in config)
if (sails.config.globals._ !== false) {
global['_'] = _;
}
if (sails.config.globals.async !== false) {
global['async'] = async;
}
if (sails.config.globals.sails !== false) {
global['sails'] = sails;
}
// `services` hook takes care of globalizing services (if enabled)
// `orm` hook takes care of globalizing models and adapters (if enabled)
};
| Fix expose Lodash global by default. | Fix expose Lodash global by default.
| JavaScript | mit | corbanb/sails,tjwebb/sails,konstantinzolotarev/sails,harrissoerja/sails,taogb/sails,shaunstanislaus/sails,sunnycmf/sails,krishnaglick/sails,janladaking/sails,dylannnn/sails,ctartist621/sails,hellowin/sails,Karnith/sails-for-gulp,yinhe007/sails,rlugojr/sails,saronwei/sails,Benew/sails,alexferreira/sails,tempbottle/sails,saniko/soundcloud_mithril,mauricionr/sails,togusafish/logikinc-_-sails,youprofit/sails,winlolo/sails,zand3rs/sails,alex-zhang/sails,hokkoo/sails,jianpingw/sails,listepo/sails,cazulu/sails,metidia/sails,mphasize/sails,leobudima/sails,jenalgit/sails,dbuentello/sails,haavardw/sails,balderdashy/sails,AnyPresence/sails,justsml/sails,mnaughto/sails,rlugojr/sails,EdisonSu768/sails,antodoms/sails,apowers313/sails,t2013anurag/sails,Josebaseba/sails,jakutis/sails,vip-git/sails,JumpLink/sails,jianpingw/sails,antoniopol06/sails,scippio/sails,erkstruwe/sails,boarderdav/sails,Hanifb/sails,anweiss/sails,wsaccaco/sails,marnusw/sails,vip-git/sails,Shyp/sails,kevinburke/sails,pmq20/sails,xjpro/sails-windows-associations,curphey/sails,yangchuoxian/sails,calling/sails,jsisaev1/sails,prssn/sails,saniko/soundcloud_mithril,artBrown/sails,adrianha/sails,hokkoo/sails | ---
+++
@@ -28,7 +28,7 @@
sails.config.globals = sails.config.globals || {};
// Provide global access (if allowed in config)
- if (sails.config.globals._) {
+ if (sails.config.globals._ !== false) {
global['_'] = _;
}
if (sails.config.globals.async !== false) { |
9863d3e7462c4cc6fff020f2da1fe414e849f104 | app/static/js/ui.js | app/static/js/ui.js | (function($) {
$(document).ready(function() {
$('.datepicker').datepicker();
});
})(jQuery);
| (function($) {
$(document).ready(function() {
$('.datepicker').datepicker({
dateFormat: 'yy-mm-dd'
});
});
})(jQuery);
| Use correct date format for datepicker | Use correct date format for datepicker
| JavaScript | mit | saltastro/salt-data-quality-site,saltastro/salt-data-quality-site,saltastro/salt-data-quality-site,saltastro/salt-data-quality-site | ---
+++
@@ -1,5 +1,7 @@
(function($) {
$(document).ready(function() {
- $('.datepicker').datepicker();
+ $('.datepicker').datepicker({
+ dateFormat: 'yy-mm-dd'
+ });
});
})(jQuery); |
08910bf1f8afe84e481b6b04599af55306ec22a8 | app/scripts/factories/debounce.js | app/scripts/factories/debounce.js | // https://gist.github.com/adamalbrecht/7226278
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
angular.module('ngDebounce', []).factory('$debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if(!immediate) {
deferred.resolve(func.apply(context, args));
deferred = $q.defer();
}
};
var callNow = immediate && !timeout;
if ( timeout ) {
$timeout.cancel(timeout);
}
timeout = $timeout(later, wait);
if (callNow) {
deferred.resolve(func.apply(context,args));
deferred = $q.defer();
}
return deferred.promise;
};
};
});/**
* Created by jsansbury on 1/24/14.
*/
| // https://gist.github.com/adamalbrecht/7226278
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
angular.module('ngDebounce', []).factory('$debounce', function($timeout, $q) {
return function(func, wait, immediate) {
var timeout;
var deferred = $q.defer();
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if(!immediate) {
deferred.resolve(func.apply(context, args));
deferred = $q.defer();
}
};
var callNow = immediate && !timeout;
if ( timeout ) {
$timeout.cancel(timeout);
}
timeout = $timeout(later, wait);
if (callNow) {
deferred.resolve(func.apply(context,args));
deferred = $q.defer();
}
return deferred.promise;
};
};
});
| Remove junk from bottom of file. | Remove junk from bottom of file.
| JavaScript | mit | Lullabot/fivefifteen,Lullabot/fivefifteen | ---
+++
@@ -29,6 +29,4 @@
return deferred.promise;
};
};
-});/**
- * Created by jsansbury on 1/24/14.
- */
+}); |
4a396a8db07f41e98a674c8d02221bcb5fac53b5 | django/publicmapping/redistricting/static/js/utils.js | django/publicmapping/redistricting/static/js/utils.js |
/* DistrictBuilder Javascript Utilities */
/* DistrictBuilder Javascript Utilities used in multiple
* Javascript files in the DistrictBuilder codebase.
*
* Instantiate db_util object to protect global namespace
*/
var db_util = {};
/* Checks whether a string starts with a substring
*
* Parameters:
* s -- string to compare
* substring -- characters to check if s starts with
*/
db_util.startsWith = function(s, substring) {
return (s.indexOf(substring) == 0);
}
/* Checks whether a string contains a given substring
*
* Parameters:
* s -- string to compare
* substring -- characters to check if s contains
*/
db_util.contains = function(s, substring) {
return (s.indexOf(substring) != -1);
};
|
/* DistrictBuilder Javascript Utilities */
/* DistrictBuilder Javascript Utilities used in multiple
* Javascript files in the DistrictBuilder codebase.
*
* Instantiate DB object to protect global namespace
*/
var DB = {};
DB.util = {};
/* Checks whether a string starts with a substring
*
* Parameters:
* s -- string to compare
* substring -- characters to check if s starts with
*/
DB.util.startsWith = function(s, substring) {
return (s.indexOf(substring) == 0);
}
/* Checks whether a string contains a given substring
*
* Parameters:
* s -- string to compare
* substring -- characters to check if s contains
*/
DB.util.contains = function(s, substring) {
return (s.indexOf(substring) != -1);
};
| Rename db_util javascript object to DB.util | Rename db_util javascript object to DB.util
| JavaScript | apache-2.0 | JimCallahanOrlando/DistrictBuilder,JimCallahanOrlando/DistrictBuilder,JimCallahanOrlando/DistrictBuilder,JimCallahanOrlando/DistrictBuilder | ---
+++
@@ -4,10 +4,11 @@
/* DistrictBuilder Javascript Utilities used in multiple
* Javascript files in the DistrictBuilder codebase.
*
- * Instantiate db_util object to protect global namespace
+ * Instantiate DB object to protect global namespace
*/
-var db_util = {};
+var DB = {};
+DB.util = {};
/* Checks whether a string starts with a substring
*
@@ -16,7 +17,7 @@
* substring -- characters to check if s starts with
*/
-db_util.startsWith = function(s, substring) {
+DB.util.startsWith = function(s, substring) {
return (s.indexOf(substring) == 0);
}
@@ -27,6 +28,6 @@
* substring -- characters to check if s contains
*/
-db_util.contains = function(s, substring) {
+DB.util.contains = function(s, substring) {
return (s.indexOf(substring) != -1);
}; |
de0a8438a9389a8e12ad7c825db8e0565c5a7afe | src/components/Thumbnail/Thumbnail.js | src/components/Thumbnail/Thumbnail.js | import React from 'react';
import classnames from 'classnames';
function Thumbnail({ src, label, circle }) {
const className = classnames('ui-thumbnail', {
'ui-thumbnail-circle': circle,
});
return (
<div className={className}>
{label && <div className="ui-thumbnail-label">{label}</div>}
<img src={src} role="presentation" />
</div>
);
}
Thumbnail.propTypes = {
src: React.PropTypes.string.isRequired,
label: React.PropTypes.string,
circle: React.PropTypes.bool,
};
export default Thumbnail;
| import React from 'react';
import classnames from 'classnames';
function Thumbnail({ src, label, circle, width }) {
const className = classnames('ui-thumbnail', {
'ui-thumbnail-circle': circle,
});
const style = {};
if (width) {
style.width = `${width}px`;
}
return (
<div className={className}>
{label && <div className="ui-thumbnail-label">{label}</div>}
<img src={src} role="presentation" style={style} />
</div>
);
}
Thumbnail.propTypes = {
src: React.PropTypes.string.isRequired,
label: React.PropTypes.string,
circle: React.PropTypes.bool,
width: React.PropTypes.number,
};
export default Thumbnail;
| Add a width prop to thumbnails | Add a width prop to thumbnails
| JavaScript | mit | wundery/wundery-ui-react,wundery/wundery-ui-react | ---
+++
@@ -1,15 +1,21 @@
import React from 'react';
import classnames from 'classnames';
-function Thumbnail({ src, label, circle }) {
+function Thumbnail({ src, label, circle, width }) {
const className = classnames('ui-thumbnail', {
'ui-thumbnail-circle': circle,
});
+ const style = {};
+
+ if (width) {
+ style.width = `${width}px`;
+ }
+
return (
<div className={className}>
{label && <div className="ui-thumbnail-label">{label}</div>}
- <img src={src} role="presentation" />
+ <img src={src} role="presentation" style={style} />
</div>
);
}
@@ -18,6 +24,7 @@
src: React.PropTypes.string.isRequired,
label: React.PropTypes.string,
circle: React.PropTypes.bool,
+ width: React.PropTypes.number,
};
export default Thumbnail; |
d02a4ae2d6f09530e7e5767591e5ef34a984f787 | routes/routes-index.js | routes/routes-index.js | /**
* GET home page
*/
module.exports = function (app, options) {
"use strict";
var underscore = require('underscore');
var userGroupsFetcher = options.userGroupsFetcher;
var restProxy = options.restProxy;
/**
* GET list of routes (index page)
*/
var getRoutesIndex = function (req, res) {
var userGroups = req.userGroups || [];
var userDefaultRouteFetchQuery = (!!req.signedCookies) ? req.signedCookies['userDefaultRouteFetchQuery_' + req.session.userId] : undefined;
var onCompleteOmraderRequest = function (data) {
var areas = data.documents;
var renderOptions = {
title: 'Mine turer',
areas: JSON.stringify(areas),
userData: JSON.stringify(req.session.user),
userGroups: JSON.stringify(userGroups),
userDefaultRouteFetchQuery: JSON.stringify(userDefaultRouteFetchQuery),
authType: req.session.authType,
itemType: 'tur'
};
res.render('routes/index', renderOptions);
};
restProxy.makeApiRequest('/områder/?limit=100&fields=navn,_id&sort=navn', req, undefined, onCompleteOmraderRequest);
};
app.get('/turer', userGroupsFetcher);
app.get('/turer', getRoutesIndex);
};
| /**
* GET home page
*/
module.exports = function (app, options) {
"use strict";
var underscore = require('underscore');
var userGroupsFetcher = options.userGroupsFetcher;
var restProxy = options.restProxy;
/**
* GET list of routes (index page)
*/
var getRoutesIndex = function (req, res) {
var userGroups = req.userGroups || [];
var userDefaultRouteFetchQuery = (!!req.signedCookies) ? req.signedCookies['userDefaultRouteFetchQuery_' + req.session.userId] : undefined;
var onCompleteOmraderRequest = function (data) {
var areas = data.documents;
var renderOptions = {
title: 'Mine turer',
areas: JSON.stringify(areas),
userData: JSON.stringify(req.session.user),
userGroups: JSON.stringify(userGroups),
userDefaultRouteFetchQuery: JSON.stringify(userDefaultRouteFetchQuery),
authType: req.session.authType,
itemType: 'tur'
};
res.render('routes/index', renderOptions);
};
restProxy.makeApiRequest('/områder/?limit=100&fields=navn,_id&sort=navn&tilbyder=DNT&status=Offentlig', req, undefined, onCompleteOmraderRequest);
};
app.get('/turer', userGroupsFetcher);
app.get('/turer', getRoutesIndex);
};
| Adjust områder request query params to only get published and DNT official områder | Adjust områder request query params to only get published and DNT official områder
| JavaScript | mit | Turistforeningen/Turadmin,Turistforeningen/Turadmin,Turistforeningen/Turadmin,Turistforeningen/Turadmin | ---
+++
@@ -32,7 +32,7 @@
res.render('routes/index', renderOptions);
};
- restProxy.makeApiRequest('/områder/?limit=100&fields=navn,_id&sort=navn', req, undefined, onCompleteOmraderRequest);
+ restProxy.makeApiRequest('/områder/?limit=100&fields=navn,_id&sort=navn&tilbyder=DNT&status=Offentlig', req, undefined, onCompleteOmraderRequest);
};
app.get('/turer', userGroupsFetcher); |
ed09d3518d437dbb8ad67d6078ea2300c4dcd9a2 | aws/lib/build.js | aws/lib/build.js | 'use strict';
var exec = require('child_process').exec;
exports.buildProduction = function (buildTool, err) {
var buildCmd = 'mvn package -Pprod -DskipTests=true';
if (buildTool === 'gradle') {
buildCmd = './gradlew -Pprod bootRepackage -x test';
}
var child = exec(buildCmd, err);
return child.stdout;
};
| 'use strict';
var exec = require('child_process').exec;
exports.buildProduction = function (buildTool, err) {
var buildCmd = 'mvn package -Pprod -DskipTests=true -B';
if (buildTool === 'gradle') {
buildCmd = './gradlew -Pprod bootRepackage -x test';
}
var child = exec(buildCmd, err);
return child.stdout;
};
| Fix 'stdout maxBuffer exceeded' error when deploy to AWS | Fix 'stdout maxBuffer exceeded' error when deploy to AWS
| JavaScript | apache-2.0 | mraible/generator-jhipster,liseri/generator-jhipster,ruddell/generator-jhipster,gmarziou/generator-jhipster,JulienMrgrd/generator-jhipster,liseri/generator-jhipster,gmarziou/generator-jhipster,gzsombor/generator-jhipster,dalbelap/generator-jhipster,ramzimaalej/generator-jhipster,vivekmore/generator-jhipster,erikkemperman/generator-jhipster,pascalgrimaud/generator-jhipster,Tcharl/generator-jhipster,ruddell/generator-jhipster,deepu105/generator-jhipster,gmarziou/generator-jhipster,ctamisier/generator-jhipster,deepu105/generator-jhipster,maniacneron/generator-jhipster,baskeboler/generator-jhipster,nkolosnjaji/generator-jhipster,mraible/generator-jhipster,xetys/generator-jhipster,eosimosu/generator-jhipster,dynamicguy/generator-jhipster,liseri/generator-jhipster,robertmilowski/generator-jhipster,nkolosnjaji/generator-jhipster,ruddell/generator-jhipster,eosimosu/generator-jhipster,siliconharborlabs/generator-jhipster,xetys/generator-jhipster,deepu105/generator-jhipster,deepu105/generator-jhipster,baskeboler/generator-jhipster,stevehouel/generator-jhipster,vivekmore/generator-jhipster,siliconharborlabs/generator-jhipster,ctamisier/generator-jhipster,mraible/generator-jhipster,gzsombor/generator-jhipster,gzsombor/generator-jhipster,dynamicguy/generator-jhipster,lrkwz/generator-jhipster,jkutner/generator-jhipster,duderoot/generator-jhipster,mosoft521/generator-jhipster,jhipster/generator-jhipster,sohibegit/generator-jhipster,erikkemperman/generator-jhipster,robertmilowski/generator-jhipster,pascalgrimaud/generator-jhipster,yongli82/generator-jhipster,danielpetisme/generator-jhipster,baskeboler/generator-jhipster,atomfrede/generator-jhipster,atomfrede/generator-jhipster,mosoft521/generator-jhipster,sendilkumarn/generator-jhipster,rkohel/generator-jhipster,JulienMrgrd/generator-jhipster,jhipster/generator-jhipster,Tcharl/generator-jhipster,JulienMrgrd/generator-jhipster,ziogiugno/generator-jhipster,duderoot/generator-jhipster,hdurix/generator-jhipster,atomfrede/generator-jhipster,Tcharl/generator-jhipster,maniacneron/generator-jhipster,nkolosnjaji/generator-jhipster,rifatdover/generator-jhipster,wmarques/generator-jhipster,dalbelap/generator-jhipster,stevehouel/generator-jhipster,hdurix/generator-jhipster,dalbelap/generator-jhipster,jhipster/generator-jhipster,nkolosnjaji/generator-jhipster,gzsombor/generator-jhipster,dimeros/generator-jhipster,jkutner/generator-jhipster,mosoft521/generator-jhipster,PierreBesson/generator-jhipster,sendilkumarn/generator-jhipster,sohibegit/generator-jhipster,duderoot/generator-jhipster,cbornet/generator-jhipster,hdurix/generator-jhipster,mosoft521/generator-jhipster,jkutner/generator-jhipster,deepu105/generator-jhipster,sendilkumarn/generator-jhipster,yongli82/generator-jhipster,ruddell/generator-jhipster,jkutner/generator-jhipster,stevehouel/generator-jhipster,siliconharborlabs/generator-jhipster,vivekmore/generator-jhipster,Tcharl/generator-jhipster,ziogiugno/generator-jhipster,sendilkumarn/generator-jhipster,robertmilowski/generator-jhipster,rifatdover/generator-jhipster,cbornet/generator-jhipster,eosimosu/generator-jhipster,PierreBesson/generator-jhipster,JulienMrgrd/generator-jhipster,hdurix/generator-jhipster,erikkemperman/generator-jhipster,rkohel/generator-jhipster,ziogiugno/generator-jhipster,rkohel/generator-jhipster,sendilkumarn/generator-jhipster,liseri/generator-jhipster,cbornet/generator-jhipster,dimeros/generator-jhipster,gzsombor/generator-jhipster,rifatdover/generator-jhipster,Tcharl/generator-jhipster,atomfrede/generator-jhipster,eosimosu/generator-jhipster,maniacneron/generator-jhipster,ctamisier/generator-jhipster,jhipster/generator-jhipster,dalbelap/generator-jhipster,xetys/generator-jhipster,ziogiugno/generator-jhipster,pascalgrimaud/generator-jhipster,erikkemperman/generator-jhipster,jkutner/generator-jhipster,mraible/generator-jhipster,mraible/generator-jhipster,duderoot/generator-jhipster,sohibegit/generator-jhipster,gmarziou/generator-jhipster,danielpetisme/generator-jhipster,JulienMrgrd/generator-jhipster,mosoft521/generator-jhipster,dynamicguy/generator-jhipster,wmarques/generator-jhipster,maniacneron/generator-jhipster,jhipster/generator-jhipster,danielpetisme/generator-jhipster,wmarques/generator-jhipster,ramzimaalej/generator-jhipster,dynamicguy/generator-jhipster,hdurix/generator-jhipster,danielpetisme/generator-jhipster,stevehouel/generator-jhipster,robertmilowski/generator-jhipster,ziogiugno/generator-jhipster,liseri/generator-jhipster,siliconharborlabs/generator-jhipster,ctamisier/generator-jhipster,rkohel/generator-jhipster,eosimosu/generator-jhipster,xetys/generator-jhipster,cbornet/generator-jhipster,baskeboler/generator-jhipster,ramzimaalej/generator-jhipster,maniacneron/generator-jhipster,lrkwz/generator-jhipster,PierreBesson/generator-jhipster,cbornet/generator-jhipster,dalbelap/generator-jhipster,atomfrede/generator-jhipster,lrkwz/generator-jhipster,yongli82/generator-jhipster,erikkemperman/generator-jhipster,lrkwz/generator-jhipster,robertmilowski/generator-jhipster,stevehouel/generator-jhipster,dimeros/generator-jhipster,ruddell/generator-jhipster,yongli82/generator-jhipster,lrkwz/generator-jhipster,wmarques/generator-jhipster,yongli82/generator-jhipster,dimeros/generator-jhipster,vivekmore/generator-jhipster,duderoot/generator-jhipster,wmarques/generator-jhipster,ctamisier/generator-jhipster,sohibegit/generator-jhipster,siliconharborlabs/generator-jhipster,baskeboler/generator-jhipster,gmarziou/generator-jhipster,danielpetisme/generator-jhipster,dimeros/generator-jhipster,rkohel/generator-jhipster,nkolosnjaji/generator-jhipster,vivekmore/generator-jhipster,pascalgrimaud/generator-jhipster,PierreBesson/generator-jhipster,PierreBesson/generator-jhipster,sohibegit/generator-jhipster,pascalgrimaud/generator-jhipster | ---
+++
@@ -2,7 +2,7 @@
var exec = require('child_process').exec;
exports.buildProduction = function (buildTool, err) {
- var buildCmd = 'mvn package -Pprod -DskipTests=true';
+ var buildCmd = 'mvn package -Pprod -DskipTests=true -B';
if (buildTool === 'gradle') {
buildCmd = './gradlew -Pprod bootRepackage -x test'; |
81ed365961411c9f39ef189e29a486f3fd4aa329 | src/utils/get-date-from-short-string.js | src/utils/get-date-from-short-string.js | import moment from "moment";
export const dateFormat = 'MMM D, YYYY';
export const datetimeFormat = 'MMM D, YYYY HH:MM';
function getDateParamsFromString(dateString) {
return {
year: dateString.substring(0, 4),
month: dateString.substring(4, 6),
date: dateString.substring(6, 8),
};
}
export function getDateForMemoriesRequest(dateString) {
const { year, month, date } = getDateParamsFromString(dateString);
return new Date(year, Number(month) - 1, Number(date) + 1);
}
export function formatDateFromShortString(dateString) {
const { year, month, date } = getDateParamsFromString(dateString);
const fullDate = new Date(year, Number(month) - 1, date);
return moment(fullDate).format(dateFormat);
}
| import moment from "moment";
export const dateFormat = 'MMM D, YYYY';
export const datetimeFormat = 'MMM D, YYYY HH:mm';
function getDateParamsFromString(dateString) {
return {
year: dateString.substring(0, 4),
month: dateString.substring(4, 6),
date: dateString.substring(6, 8),
};
}
export function getDateForMemoriesRequest(dateString) {
const { year, month, date } = getDateParamsFromString(dateString);
return new Date(year, Number(month) - 1, Number(date) + 1);
}
export function formatDateFromShortString(dateString) {
const { year, month, date } = getDateParamsFromString(dateString);
const fullDate = new Date(year, Number(month) - 1, date);
return moment(fullDate).format(dateFormat);
}
| Fix datetime format string (use minutes instead of months) | Fix datetime format string (use minutes instead of months)
| JavaScript | mit | davidmz/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client | ---
+++
@@ -2,7 +2,7 @@
export const dateFormat = 'MMM D, YYYY';
-export const datetimeFormat = 'MMM D, YYYY HH:MM';
+export const datetimeFormat = 'MMM D, YYYY HH:mm';
function getDateParamsFromString(dateString) {
return { |
f750efdc3b088b8748d6ba3ff1d8e6e8a0510139 | common/DbConst.js | common/DbConst.js | class DbConst {
// no support for static contants, declare then after the class definition
}
DbConst.DB_NAME = "FormHistoryControl";
DbConst.DB_VERSION = 1;
DbConst.DB_STORE_TEXT = 'text_history';
DbConst.DB_STORE_ELEM = 'elem_history';
DbConst.DB_TEXT_IDX_FIELD = 'by_fieldkey';
DbConst.DB_TEXT_IDX_NAME = 'by_name';
DbConst.DB_TEXT_IDX_LAST = 'by_last';
DbConst.DB_TEXT_IDX_HOST = 'by_host';
DbConst.DB_ELEM_IDX_FIELD = 'by_fieldkey';
DbConst.DB_ELEM_IDX_SAVED = 'by_saved'; | class DbConst {
// no support for static contants, declare then after the class definition
}
DbConst.DB_NAME = "FormHistoryControl";
DbConst.DB_VERSION = 1;
DbConst.DB_STORE_TEXT = 'text_history';
DbConst.DB_STORE_ELEM = 'elem_history';
DbConst.DB_TEXT_IDX_FIELD = 'by_fieldkey';
DbConst.DB_TEXT_IDX_NAME = 'by_name';
DbConst.DB_TEXT_IDX_LAST = 'by_last';
DbConst.DB_TEXT_IDX_HOST = 'by_host';
DbConst.DB_TEXT_IDX_HOST_NAME = "by_host_plus_name";
DbConst.DB_ELEM_IDX_FIELD = 'by_fieldkey';
DbConst.DB_ELEM_IDX_SAVED = 'by_saved'; | Enable storing multiple versions for the same multiline field | Enable storing multiple versions for the same multiline field
| JavaScript | mit | stephanmahieu/formhistorycontrol-2,stephanmahieu/formhistorycontrol-2,stephanmahieu/formhistorycontrol-2 | ---
+++
@@ -10,6 +10,7 @@
DbConst.DB_TEXT_IDX_NAME = 'by_name';
DbConst.DB_TEXT_IDX_LAST = 'by_last';
DbConst.DB_TEXT_IDX_HOST = 'by_host';
+DbConst.DB_TEXT_IDX_HOST_NAME = "by_host_plus_name";
DbConst.DB_ELEM_IDX_FIELD = 'by_fieldkey';
DbConst.DB_ELEM_IDX_SAVED = 'by_saved'; |
42b2e8cf63c303d6b96e5d75d90ac77dc0897419 | migrations/20170806154824_user_prefs.js | migrations/20170806154824_user_prefs.js | export async function up(knex) {
await knex.schema.table('users', (table) => {
table.jsonb('preferences').defaultTo('{}').notNullable();
});
// Migrate from the 'frontend_preferences'
await knex.raw(`
update users set preferences = jsonb_set(
preferences,
'{hideCommentsOfTypes}',
coalesce((frontend_preferences::jsonb) #> '{net.freefeed,comments,hiddenTypes}', '[]'),
true
)
`);
}
export async function down(knex) {
await knex.schema.table('users', (table) => {
table.dropColumn('preferences');
});
}
| export async function up(knex) {
await knex.schema.table('users', (table) => {
table.jsonb('preferences').defaultTo('{}').notNullable();
});
// Migrate from the 'frontend_preferences'
await knex.raw(`
update users set
preferences = jsonb_set(
preferences, '{hideCommentsOfTypes}',
coalesce(frontend_preferences::jsonb #> '{net.freefeed,comments,hiddenTypes}', '[]'),
true
),
frontend_preferences = (
frontend_preferences::jsonb #- '{net.freefeed,comments,hiddenTypes}'
)::text
`);
}
export async function down(knex) {
// Migrate back to the 'frontend_preferences'
await knex.raw(`
update users set
frontend_preferences = jsonb_set(
frontend_preferences::jsonb, '{net.freefeed,comments,hiddenTypes}',
coalesce(preferences #> '{hideCommentsOfTypes}', '[]'),
true
)::text
`);
await knex.schema.table('users', (table) => {
table.dropColumn('preferences');
});
}
| Move data from frontend_prefs to prefs and back during migration | Move data from frontend_prefs to prefs and back during migration
| JavaScript | mit | FreeFeed/freefeed-server,FreeFeed/freefeed-server | ---
+++
@@ -4,16 +4,28 @@
});
// Migrate from the 'frontend_preferences'
await knex.raw(`
- update users set preferences = jsonb_set(
- preferences,
- '{hideCommentsOfTypes}',
- coalesce((frontend_preferences::jsonb) #> '{net.freefeed,comments,hiddenTypes}', '[]'),
- true
- )
+ update users set
+ preferences = jsonb_set(
+ preferences, '{hideCommentsOfTypes}',
+ coalesce(frontend_preferences::jsonb #> '{net.freefeed,comments,hiddenTypes}', '[]'),
+ true
+ ),
+ frontend_preferences = (
+ frontend_preferences::jsonb #- '{net.freefeed,comments,hiddenTypes}'
+ )::text
`);
}
export async function down(knex) {
+ // Migrate back to the 'frontend_preferences'
+ await knex.raw(`
+ update users set
+ frontend_preferences = jsonb_set(
+ frontend_preferences::jsonb, '{net.freefeed,comments,hiddenTypes}',
+ coalesce(preferences #> '{hideCommentsOfTypes}', '[]'),
+ true
+ )::text
+ `);
await knex.schema.table('users', (table) => {
table.dropColumn('preferences');
}); |
d32bd4eee4a169921ed091829849cd789f274be1 | client/views/activity/new/newActivity.js | client/views/activity/new/newActivity.js | Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.newActivity.helpers({
select2Options () {
return {
multiple: true
}
}
});
| Template.newActivity.created = function () {
this.subscribe('allCurrentResidents');
this.subscribe('allHomes');
this.subscribe('allActivityTypes');
this.subscribe('allRolesExceptAdmin');
};
Template.autoForm.onRendered(function () {
const instance = this;
// Make sure the new activity form is being rendered
if (instance.data.id === "newActivityForm") {
// Get the user agent type
var deviceAgent = navigator.userAgent.toLowerCase();
// Check if the device is iOS
var iOS = deviceAgent.match(/(iPad|iPhone|iPod)/i);
// If the device is not iOS, render the chosen select widget
if (!iOS) {
// Get a reference to the resident select field
const residentSelect = $('[name=residentIds]');
// Activate the improved multi-select widget
residentSelect.chosen();
};
}
});
| Remove select2Options; render Chosen when AutoForm renders | Remove select2Options; render Chosen when AutoForm renders
| JavaScript | agpl-3.0 | brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing | ---
+++
@@ -5,10 +5,25 @@
this.subscribe('allRolesExceptAdmin');
};
-Template.newActivity.helpers({
- select2Options () {
- return {
- multiple: true
- }
+
+Template.autoForm.onRendered(function () {
+ const instance = this;
+
+ // Make sure the new activity form is being rendered
+ if (instance.data.id === "newActivityForm") {
+ // Get the user agent type
+ var deviceAgent = navigator.userAgent.toLowerCase();
+
+ // Check if the device is iOS
+ var iOS = deviceAgent.match(/(iPad|iPhone|iPod)/i);
+
+ // If the device is not iOS, render the chosen select widget
+ if (!iOS) {
+ // Get a reference to the resident select field
+ const residentSelect = $('[name=residentIds]');
+
+ // Activate the improved multi-select widget
+ residentSelect.chosen();
+ };
}
}); |
e72fb558b41b009fd2d8ec124ef2a0a06d1f0f5c | lib/dropbox/index.js | lib/dropbox/index.js | 'use strict';
var cp = require('child_process');
var child = cp.fork(__dirname + '/child.js');
var passport = require('passport');
var DropboxOAuth2Strategy = require('passport-dropbox-oauth2').Strategy;
var active = false;
module.exports = function (options) {
child.send({
options: options.dropbox
});
return {
initialize: function () {
active = true;
passport.use(new DropboxOAuth2Strategy({
clientID: options.dropbox.id,
clientSecret: options.dropbox.secret,
callbackURL: 'https://jsbin.dev/auth/dropbox/callback'
}, function (accessToken, refreshToken, profile, done) {
done(null, profile);
}
));
}
};
};
module.exports.saveBin = function (bin, user) {
if (!active) {
return;
}
child.send({
bin: bin,
user: user
});
};
| 'use strict';
var cp = require('child_process');
var child = cp.fork(__dirname + '/child.js');
var passport = require('passport');
var DropboxOAuth2Strategy = require('passport-dropbox-oauth2').Strategy;
var active = false;
module.exports = function (options) {
child.send({
options: options.dropbox
});
return {
initialize: function () {
active = true;
passport.use(new DropboxOAuth2Strategy({
clientID: options.dropbox.id,
clientSecret: options.dropbox.secret,
callbackURL: 'https://jsbin.dev/auth/dropbox/callback'
}, function (accessToken, refreshToken, profile, done) {
done(null, profile);
}
));
}
};
};
module.exports.saveBin = function (file, fileName, user) {
if (!active) {
return;
}
child.send({
file: file,
fileName: fileName,
user: user
});
};
| Update dropbox module api to take file, fileNAme & user consider taking oauth_token rather than user? | Update dropbox module api to take file, fileNAme & user
consider taking oauth_token rather than user?
| JavaScript | mit | peterblazejewicz/jsbin,dhval/jsbin,fgrillo21/NPA-Exam,digideskio/jsbin,saikota/jsbin,peterblazejewicz/jsbin,pandoraui/jsbin,svacha/jsbin,francoisp/jsbin,juliankrispel/jsbin,filamentgroup/jsbin,IveWong/jsbin,dedalik/jsbin,ilyes14/jsbin,kirjs/jsbin,mdo/jsbin,jamez14/jsbin,Hamcha/jsbin,KenPowers/jsbin,yize/jsbin,mcanthony/jsbin,KenPowers/jsbin,Hamcha/jsbin,simonThiele/jsbin,nitaku/jervis,blesh/jsbin,jsbin/jsbin,KenPowers/jsbin,dhval/jsbin,jwdallas/jsbin,vipulnsward/jsbin,late-warrior/jsbin,francoisp/jsbin,jsbin/jsbin,vipulnsward/jsbin,filamentgroup/jsbin,pandoraui/jsbin,Freeformers/jsbin,yohanboniface/jsbin,IvanSanchez/jsbin,HeroicEric/jsbin,jasonsanjose/jsbin-app,yize/jsbin,saikota/jsbin,mlucool/jsbin,HeroicEric/jsbin,minwe/jsbin,johnmichel/jsbin,AverageMarcus/jsbin,IvanSanchez/jsbin,juliankrispel/jsbin,roman01la/jsbin,arcseldon/jsbin,dedalik/jsbin,mingzeke/jsbin,jamez14/jsbin,Freeformers/jsbin,svacha/jsbin,martinvd/jsbin,arcseldon/jsbin,martinvd/jsbin,dennishu001/jsbin,jasonsanjose/jsbin-app,thsunmy/jsbin,late-warrior/jsbin,thsunmy/jsbin,kentcdodds/jsbin,y3sh/jsbin-fork,mlucool/jsbin,simonThiele/jsbin,remotty/jsbin,y3sh/jsbin-fork,fend-classroom/jsbin,minwe/jsbin,mcanthony/jsbin,fend-classroom/jsbin,kirjs/jsbin,carolineartz/jsbin,eggheadio/jsbin,ctide/jsbin,IveWong/jsbin,ilyes14/jsbin,kentcdodds/jsbin,knpwrs/jsbin,digideskio/jsbin,eggheadio/jsbin,carolineartz/jsbin,roman01la/jsbin,knpwrs/jsbin,knpwrs/jsbin,ctide/jsbin,AverageMarcus/jsbin,johnmichel/jsbin,fgrillo21/NPA-Exam,dennishu001/jsbin,yohanboniface/jsbin,mingzeke/jsbin,jwdallas/jsbin | ---
+++
@@ -24,12 +24,13 @@
};
};
-module.exports.saveBin = function (bin, user) {
+module.exports.saveBin = function (file, fileName, user) {
if (!active) {
return;
}
child.send({
- bin: bin,
+ file: file,
+ fileName: fileName,
user: user
});
}; |
d6be547b7c92809ce123e41aba590def54c1a5af | conf.js | conf.js | exports.conf = {
nick: 'treslek',
host: 'irc.freenode.net',
ircOptions: {
port: 6667,
channels: ['##bullpeen'],
userName: 'treslek',
realName: 'treslek',
autoConnect: false,
floodProtection: true,
floodProtectionDelay: 100
},
ignored: ['doslek'],
redis: {
host: 'localhost',
port: '6379',
prefix: 'treslek'
},
admins: ['jirwin'],
plugins_dir: "/home/jirwin/projects/treslek/plugins/"
}
| exports.conf = {
nick: 'treslek',
host: 'irc.freenode.net',
ircOptions: {
port: 6667,
channels: ['##bullpeen'],
userName: 'treslek',
realName: 'treslek',
autoConnect: false,
floodProtection: true,
floodProtectionDelay: 100
},
ignored: ['doslek'],
redis: {
host: '127.0.0.1',
port: '6379',
prefix: 'treslek'
},
admins: ['jirwin'],
plugins_dir: "/home/jirwin/projects/treslek/plugins/"
}
| Use 127.0.0.1 for redis instead of localhost. | Use 127.0.0.1 for redis instead of localhost.
| JavaScript | mit | jirwin/treslek,rackerlabs/treslek | ---
+++
@@ -12,7 +12,7 @@
},
ignored: ['doslek'],
redis: {
- host: 'localhost',
+ host: '127.0.0.1',
port: '6379',
prefix: 'treslek'
}, |
20029c6e5908db6e57be103211e7de8b066dac34 | test/settings/CallingSettings.spec.js | test/settings/CallingSettings.spec.js | import { getWrapper } from '../shared';
import NavigationBar from '../../src/components/NavigationBar';
import SettingsPanel from '../../src/components/SettingsPanel';
import CallingSettings from '../../src/components/CallingSettingsPanel';
import LinkLine from '../../src/components/LinkLine';
import Button from '../../src/components/Button';
let wrapper = null;
let panel = null;
let callingSettings = null;
beforeEach(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 32000;
wrapper = await getWrapper();
const navigationBar = wrapper.find(NavigationBar).first();
await navigationBar.props().goTo('/settings');
panel = wrapper.find(SettingsPanel).first();
const callingLinkLine = panel.find(LinkLine).at(0);
await callingLinkLine.props().onClick();
callingSettings = wrapper.find(CallingSettings).first();
});
describe('calling settings', () => {
test('initial state', async () => {
expect(callingSettings.find('div.label').first().props().children).toEqual('Calling');
});
test('button state', () => {
const saveButton = callingSettings.find(Button).first();
expect(saveButton.props().disabled).toEqual(true);
});
});
| import { getWrapper } from '../shared';
import NavigationBar from '../../src/components/NavigationBar';
import SettingsPanel from '../../src/components/SettingsPanel';
import CallingSettings from '../../src/components/CallingSettingsPanel';
import LinkLine from '../../src/components/LinkLine';
import Button from '../../src/components/Button';
let wrapper = null;
let panel = null;
let callingSettings = null;
beforeEach(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 32000;
wrapper = await getWrapper();
const navigationBar = wrapper.find(NavigationBar).first();
await navigationBar.props().goTo('/settings');
panel = wrapper.find(SettingsPanel).first();
const callingLinkLine = panel.find(LinkLine).at(0);
await callingLinkLine.props().onClick();
callingSettings = wrapper.find(CallingSettings).first();
});
describe('calling settings', () => {
test('initial state', async () => {
expect(callingSettings.find('div.label').first().props().children).toEqual('Calling');
});
test('button state', async () => {
const saveButton = callingSettings.find(Button).first();
expect(saveButton.props().disabled).toEqual(true);
const items = callingSettings.find('.dropdownItem');
const lastItem = items.at(items.length - 1);
await lastItem.simulate('click');
expect(saveButton.props().disabled).toEqual(false);
});
});
| Test calling settings button state | Test calling settings button state
| JavaScript | mit | u9520107/ringcentral-js-widget,ringcentral/ringcentral-js-widget,ringcentral/ringcentral-js-widget,ringcentral/ringcentral-js-widget,u9520107/ringcentral-js-widget,u9520107/ringcentral-js-widget | ---
+++
@@ -24,8 +24,13 @@
expect(callingSettings.find('div.label').first().props().children).toEqual('Calling');
});
- test('button state', () => {
+ test('button state', async () => {
const saveButton = callingSettings.find(Button).first();
expect(saveButton.props().disabled).toEqual(true);
+
+ const items = callingSettings.find('.dropdownItem');
+ const lastItem = items.at(items.length - 1);
+ await lastItem.simulate('click');
+ expect(saveButton.props().disabled).toEqual(false);
});
}); |
6ddb8f21ade3d9b18ab8979a9d74aa1bb36ad43c | src/main/resources/public/js/app.js | src/main/resources/public/js/app.js |
(function(){
var app = angular.module('runnersNotes',[]);
app.controller('NoteController',['$http',function($http){
var rn = this;
rn.success = false;
rn.errors = [];
rn.notes = [];
rn.note = {};
$http.get('http://localhost:8080/notes').success(function(data){
rn.notes = data.items;
});
this.addNote = function() {
rn.note.created = new Date(rn.note.date).getTime();
$http.post('http://localhost:8080/notes',rn.note).
then(function(response){
//if (response.status === 201) {
rn.notes.push(rn.note);
rn.note = {};
rn.success = true;
rn.errors = [];
$("#addForm").collapse('hide');
//}
}, function(response) {
rn.success = false;
for (var i=0; i < response.data.length; i++) {
rn.errors.push(response.data[i]);
}
console.log(response);
});
};
}]);
})(); |
(function(){
var app = angular.module('runnersNotes',[]);
app.controller('NoteController',['$http',function($http){
var rn = this;
rn.success = false;
rn.errors = [];
rn.notes = [];
rn.note = {};
$http.get('http://localhost:8080/notes').success(function(data){
rn.notes = data.items;
});
this.clearAlerts = function() {
rn.errors = [];
rn.success = false;
};
this.addNote = function() {
rn.note.created = new Date(rn.note.date).getTime();
$http.post('http://localhost:8080/notes',rn.note).
then(function(response){
rn.notes.push(rn.note);
rn.note = {};
rn.success = true;
rn.errors = [];
$("#addForm").collapse('hide');
}, function(response) {
rn.success = false;
for (var i=0; i < response.data.length; i++) {
rn.errors.push(response.data[i]);
}
});
};
}]);
})(); | Remove alerts when clicking link or button | Remove alerts when clicking link or button
| JavaScript | mit | marsojm/runnersnotes.rest-api,marsojm/runnersnotes.rest-api,marsojm/runnersnotes.rest-api | ---
+++
@@ -12,23 +12,25 @@
rn.notes = data.items;
});
+ this.clearAlerts = function() {
+ rn.errors = [];
+ rn.success = false;
+ };
+
this.addNote = function() {
rn.note.created = new Date(rn.note.date).getTime();
$http.post('http://localhost:8080/notes',rn.note).
then(function(response){
- //if (response.status === 201) {
- rn.notes.push(rn.note);
- rn.note = {};
- rn.success = true;
- rn.errors = [];
- $("#addForm").collapse('hide');
- //}
+ rn.notes.push(rn.note);
+ rn.note = {};
+ rn.success = true;
+ rn.errors = [];
+ $("#addForm").collapse('hide');
}, function(response) {
rn.success = false;
for (var i=0; i < response.data.length; i++) {
rn.errors.push(response.data[i]);
}
- console.log(response);
});
};
}]); |
c443f63cab871f1758a8c2cbc06cd5aca5966e5e | html.js | html.js | import React from 'react';
import Helmet from 'react-helmet';
import { prefixLink } from 'gatsby-helpers';
const BUILD_TIME = new Date().getTime();
module.exports = React.createClass({
displayName: 'HTML',
propTypes: {
body: React.PropTypes.string,
},
render() {
const { body } = this.props;
const { title } = Helmet.rewind();
const font = <link href="https://fonts.googleapis.com/css?family=Roboto:400,400italic,500,700&subset=latin,cyrillic" rel="stylesheet" type="text/css" />;
let css;
if (process.env.NODE_ENV === 'production') {
// eslint-disable-next-line import/no-webpack-loader-syntax
css = <style dangerouslySetInnerHTML={{ __html: require('!raw!./public/styles.css') }} />;
}
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=5.0" />
{ title.toComponent() }
{ font }
{ css }
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<script src={prefixLink(`/bundle.js?t=${BUILD_TIME}`)} />
</body>
</html>
);
},
});
| import React from 'react';
import Helmet from 'react-helmet';
import { prefixLink } from 'gatsby-helpers';
const BUILD_TIME = new Date().getTime();
module.exports = React.createClass({
displayName: 'HTML',
propTypes: {
body: React.PropTypes.string,
},
render() {
const { body } = this.props;
const { title } = Helmet.rewind();
const font = <link href="https://fonts.googleapis.com/css?family=Roboto:400,400italic,500,700&subset=latin,cyrillic" rel="stylesheet" type="text/css" />;
let css;
if (process.env.NODE_ENV === 'production') {
// eslint-disable-next-line import/no-webpack-loader-syntax
css = <link rel="stylesheet" type="text/css" href="/styles.css" />;
}
return (
<html lang="zh">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=5.0" />
{ title.toComponent() }
{ font }
{ css }
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<script src={prefixLink(`/bundle.js?t=${BUILD_TIME}`)} />
</body>
</html>
);
},
});
| Change inline css to href | Change inline css to href | JavaScript | mit | lilac/lilac.github.io,lilac/lilac.github.io | ---
+++
@@ -16,11 +16,11 @@
let css;
if (process.env.NODE_ENV === 'production') {
// eslint-disable-next-line import/no-webpack-loader-syntax
- css = <style dangerouslySetInnerHTML={{ __html: require('!raw!./public/styles.css') }} />;
+ css = <link rel="stylesheet" type="text/css" href="/styles.css" />;
}
return (
- <html lang="en">
+ <html lang="zh">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" /> |
0848fe3d6e413c379f24e0a1d865e1794bf3a3a3 | main.js | main.js | var app = require('app'); // Module controlling application life cyle.
var BrowserWindow = require('browser-window'); // Creating native browser windows.
// Report crashes to the server (local node process?).
require('crash-reporter').start();
// Keep a global reference to the main window; otherwise, when JavaScript garbage collects the instance,
// it will destroy the window referred to by the instance. :) (How difficult would that be to debug?)
var mainWindow = null;
// Quit when the user closes all windows.
app.on('window-all-closed', function() {
// On OS X, it is common for applications and their menu bar to remain active until the user explicitly
// closes the application using Cmd-Q.
if (process.platform != 'darwin') {
app.quit();
}
})
// When electron has finished initialization and is ready to create browser windows, we call the following:
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600});
// Load the index page for the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');
// Open the development tools. (What is the result of this call?)
// When main window closed
mainWindow.on('closed', function() {
// Deference the window object. If you app supports multiple windows, you would typically store them
// in an array. In this situation, you would delete the corresponding element of the array.
mainWindow = null;
})
})
| var app = require('app'); // Module controlling application life cyle.
var BrowserWindow = require('browser-window'); // Creating native browser windows.
// Report crashes to the server (local node process?).
require('crash-reporter').start();
// Keep a global reference to the main window; otherwise, when JavaScript garbage collects the instance,
// it will destroy the window referred to by the instance. :) (How difficult would that be to debug?)
var mainWindow = null;
// Quit when the user closes all windows.
app.on('window-all-closed', function() {
// On OS X, it is common for applications and their menu bar to remain active until the user explicitly
// closes the application using Cmd-Q.
if (process.platform != 'darwin') {
app.quit();
}
})
// When electron has finished initialization and is ready to create browser windows, we call the following:
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600});
// Load the index page for the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');
// Open the development tools.
mainWindow.openDevTools();
// When main window closed
mainWindow.on('closed', function() {
// Deference the window object. If you app supports multiple windows, you would typically store them
// in an array. In this situation, you would delete the corresponding element of the array.
mainWindow = null;
})
})
| Add call to open development tools. | Add call to open development tools.
The Electron Quick Start made a call to open the development tools
window. In my original implementation, I forgot this call.
This change reverses that omission.
| JavaScript | mit | mrwizard82d1/electron-qs,mrwizard82d1/electron-qs | ---
+++
@@ -25,7 +25,8 @@
// Load the index page for the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');
- // Open the development tools. (What is the result of this call?)
+ // Open the development tools.
+ mainWindow.openDevTools();
// When main window closed
mainWindow.on('closed', function() { |
874fcf957f39687b917688a5ec50c50b38ee4438 | imports/api/database-controller/AcademicCohort/acadCohort.js | imports/api/database-controller/AcademicCohort/acadCohort.js | import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
class AcadCohortCollection extends Mongo.Collection{
insert(acadCohortData, callBack){
const cohortDocument = acadCohortData;
let result;
//validate document
return super.insert( cohortDocument, callBack);
};
update(selector, modifier){
const result = super.update(selector, modifier);
return result;
};
remove(selector){
const result = super.remove(selector);
return result;
};
}
const acadCohortSchema ={
cohortName:{
type: String,
regEx: /AY\s\d\d\d\d\/\d\d\d\d/
},
cohortFocusAreaID:{
type: [String],
optional: true
}
}
export const AcademicCohort = new AcadCohortCollection("AcademicCohort");
AcademicCohort.attachSchema(acadCohortSchema);
| import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
class AcadCohortCollection extends Mongo.Collection{
insert(acadCohortData, callBack){
const cohortDocument = acadCohortData;
let result;
//validate document
return super.insert( cohortDocument, callBack);
};
update(selector, modifier){
const result = super.update(selector, modifier);
return result;
};
remove(selector){
const result = super.remove(selector);
return result;
};
}
const acadCohortSchema ={
cohortName:{
type: String,
regEx: /AY\s\d\d\d\d\/\d\d\d\d/
},
cohortFocusAreaID:{
type: [String],
optional: true
},
cohortGradRequirementID: {
type: [String],
optional: true
}
}
export const AcademicCohort = new AcadCohortCollection("AcademicCohort");
AcademicCohort.attachSchema(acadCohortSchema);
| MODIFY academic cohort method and schema to include acad year | MODIFY academic cohort method and schema to include acad year
| JavaScript | mit | nus-mtp/nus-oracle,nus-mtp/nus-oracle | ---
+++
@@ -30,6 +30,10 @@
cohortFocusAreaID:{
type: [String],
optional: true
+ },
+ cohortGradRequirementID: {
+ type: [String],
+ optional: true
}
}
|
db18ad92def8726c909d3767e71173c0dd67f1ff | src/actions/signOut.js | src/actions/signOut.js | import fetch from 'utils/fetch';
import { getSettings } from 'models/settings';
import parseResponse from 'utils/parseResponse';
import { updateHeaders } from 'actions/headers';
export const SIGN_OUT = 'SIGN_OUT';
export const SIGN_OUT_COMPLETE = 'SIGN_OUT_COMPLETE';
export const SIGN_OUT_ERROR = 'SIGN_OUT_ERROR';
function signOutStart() {
return { type: SIGN_OUT };
}
function signOutComplete() {
return { type: SIGN_OUT_COMPLETE };
}
function signOutError(errors) {
return { type: SIGN_OUT_ERROR, errors };
}
export function signOut() {
return (dispatch, getState) => {
const { backend } = getSettings(getState());
dispatch(signOutStart());
dispatch(updateHeaders());
if (!backend.signOutPath) {
dispatch(signOutComplete());
return Promise.resolve();
}
return dispatch(fetch(backend.signOutPath, { method: 'delete' }))
.then(parseResponse)
.then(() => {
dispatch(signOutComplete());
return Promise.resolve();
})
.catch((er) => {
dispatch(signOutError(er));
return Promise.reject(er);
});
};
}
| import fetch from 'utils/fetch';
import { getSettings } from 'models/settings';
import parseResponse from 'utils/parseResponse';
import { updateHeaders } from 'actions/headers';
export const SIGN_OUT = 'SIGN_OUT';
export const SIGN_OUT_COMPLETE = 'SIGN_OUT_COMPLETE';
export const SIGN_OUT_ERROR = 'SIGN_OUT_ERROR';
function signOutStart() {
return { type: SIGN_OUT };
}
function signOutComplete() {
return { type: SIGN_OUT_COMPLETE };
}
function signOutError(errors) {
return { type: SIGN_OUT_ERROR, errors };
}
export function signOut() {
return (dispatch, getState) => {
const { backend } = getSettings(getState());
dispatch(signOutStart());
if (!backend.signOutPath) {
dispatch(updateHeaders());
dispatch(signOutComplete());
return Promise.resolve();
}
return dispatch(fetch(backend.signOutPath, { method: 'delete' }))
.then(parseResponse)
.then(() => {
dispatch(updateHeaders());
dispatch(signOutComplete());
return Promise.resolve();
})
.catch((er) => {
dispatch(updateHeaders());
dispatch(signOutError(er));
return Promise.reject(er);
});
};
}
| Update headers after sign_out response | Update headers after sign_out response
| JavaScript | mit | yury-dymov/redux-oauth | ---
+++
@@ -25,9 +25,9 @@
const { backend } = getSettings(getState());
dispatch(signOutStart());
- dispatch(updateHeaders());
if (!backend.signOutPath) {
+ dispatch(updateHeaders());
dispatch(signOutComplete());
return Promise.resolve();
@@ -36,11 +36,13 @@
return dispatch(fetch(backend.signOutPath, { method: 'delete' }))
.then(parseResponse)
.then(() => {
+ dispatch(updateHeaders());
dispatch(signOutComplete());
return Promise.resolve();
})
.catch((er) => {
+ dispatch(updateHeaders());
dispatch(signOutError(er));
return Promise.reject(er); |
2e2bee985bae458848a6991676b5b5ef7d4f2207 | demo.js | demo.js | var browserify = require('browserify');
var brfs = require('brfs');
var through = require('through');
require('browserify/lib/builtins').fs = 'create-webfs.js'; // TODO: find a better way to replace this module
var b = browserify();
// directly include rfile TODO: use brfs, but it replaces fs.readFileSync
b.transform(function(s) {
var data = '';
return through(write, end);
function write(buf) { data += buf; }
function end() {
var fs = require('fs');
var s = data;
var includedFile = fs.readFileSync('node_modules//browserify/node_modules/umd/template.js'); // TODO: encoding? string?
s = s.replace(/rfile\('.\/template.js'\)/, JSON.stringify(includedFile));
this.queue(s);
this.queue(null);
};
}, { global: true });
b.add('./demo.js');
b.bundle().pipe(process.stdout);
| var browserify = require('browserify');
var brfs = require('brfs');
var through = require('through');
require('browserify/lib/builtins').fs = 'create-webfs.js'; // TODO: find a better way to replace this module
var b = browserify();
// directly include rfile TODO: use brfs, but it replaces fs.readFileSync
b.transform(function(s) {
var data = '';
return through(write, end);
function write(buf) { data += buf; }
function end() {
var fs = require('fs');
var s = data;
var includedFile = fs.readFileSync('node_modules//browserify/node_modules/umd/template.js', 'utf8');
s = s.replace(/rfile\('.\/template.js'\)/, JSON.stringify(includedFile));
this.queue(s);
this.queue(null);
};
}, { global: true });
b.add('./demo.js');
b.bundle().pipe(process.stdout);
| Read template str as UTF-8 string | Read template str as UTF-8 string
| JavaScript | mit | deathcap/webnpm,deathcap/webnpm | ---
+++
@@ -15,7 +15,7 @@
function end() {
var fs = require('fs');
var s = data;
- var includedFile = fs.readFileSync('node_modules//browserify/node_modules/umd/template.js'); // TODO: encoding? string?
+ var includedFile = fs.readFileSync('node_modules//browserify/node_modules/umd/template.js', 'utf8');
s = s.replace(/rfile\('.\/template.js'\)/, JSON.stringify(includedFile));
this.queue(s);
this.queue(null); |
2623a35dd844d9c25710aacb450319027e7af4fd | src/components/main.js | src/components/main.js | 'use strict';
var ClocketteApp = require('./ClocketteApp');
var React = require('react');
var Router = require('react-router');
var Route = Router.Route;
var Routes = (
<Route handler={ClocketteApp}>
<Route name="/" handler={ClocketteApp}/>
</Route>
);
Router.run(Routes, function (Handler) {
React.render(<Handler/>, document.getElementById('ClocketteApp'));
});
| 'use strict';
var ClocketteApp = require('./ClocketteApp');
var React = require('react');
var Router = require('react-router');
var Route = Router.Route;
var Routes = (
<Route handler={ClocketteApp}>
<Route name="/" handler={ClocketteApp}/>
</Route>
);
Router.run(Routes, function(Handler) {
React.render(<Handler/>, document.getElementById('ClocketteApp'));
});
| Make code more homogeneous. Follow styleguide like AirBnb's one | Make code more homogeneous. Follow styleguide like AirBnb's one
| JavaScript | mit | rhumlover/clockette,rhumlover/clockette | ---
+++
@@ -11,6 +11,6 @@
</Route>
);
-Router.run(Routes, function (Handler) {
+Router.run(Routes, function(Handler) {
React.render(<Handler/>, document.getElementById('ClocketteApp'));
}); |
9dca9597770da3651c9cd08c8c226ca58a3c3d8e | main.js | main.js | var $soloModal = null // Used when allowMultiple = false.
// The public API.
Modal = {
allowMultiple: false,
show: function(templateName, data, options){
if($soloModal == null || this.allowMultiple){
var parentNode = document.body
var view = Blaze.renderWithData(Template[templateName], data, parentNode)
var domRange = view._domrange // TODO: Don't violate against the public API.
var $modal = domRange.$('.modal')
$modal.on('shown.bs.modal', function(event){
$modal.find('[autofocus]').focus()
})
$modal.on('hidden.bs.modal', function(event){
Blaze.remove(view)
$soloModal = null
})
$soloModal = $modal
$modal.modal(options)
}
},
hide: function(/* optional */ template){
if(template instanceof Blaze.TemplateInstance){
template.$('.modal').modal('hide')
}else if($soloModal != null){
$soloModal.modal('hide')
}
}
}
| var $soloModal = null // Used when allowMultiple = false.
// The public API.
Modal = {
allowMultiple: false,
show: function(templateName, data, options){
if($soloModal == null || this.allowMultiple){
var parentNode = document.body
var view = Blaze.renderWithData(Template[templateName], data, parentNode)
var domRange = view._domrange // TODO: Don't violate against the public API.
var $modal = domRange.$('.modal')
$modal.on('shown.bs.modal', function(event){
$modal.find('[autofocus]').focus()
})
$modal.on('hidden.bs.modal', function(event){
Blaze.remove(view)
$soloModal = null
})
if (options && options.events) {
Object.keys(options.events).forEach(function(eventName) {
$modal.on(eventName, options.events[eventName]);
});
}
$soloModal = $modal
$modal.modal(options)
}
},
hide: function(/* optional */ template){
if(template instanceof Blaze.TemplateInstance){
template.$('.modal').modal('hide')
}else if($soloModal != null){
$soloModal.modal('hide')
}
}
}
| Allow event handlers to be passed in | Allow event handlers to be passed in
| JavaScript | mit | Opstarts/bootstrap-3-modal,Opstarts/bootstrap-3-modal | ---
+++
@@ -2,50 +2,56 @@
// The public API.
Modal = {
-
+
allowMultiple: false,
-
+
show: function(templateName, data, options){
-
+
if($soloModal == null || this.allowMultiple){
-
+
var parentNode = document.body
-
+
var view = Blaze.renderWithData(Template[templateName], data, parentNode)
-
+
var domRange = view._domrange // TODO: Don't violate against the public API.
-
+
var $modal = domRange.$('.modal')
-
+
$modal.on('shown.bs.modal', function(event){
$modal.find('[autofocus]').focus()
})
-
+
$modal.on('hidden.bs.modal', function(event){
Blaze.remove(view)
$soloModal = null
})
-
+
+ if (options && options.events) {
+ Object.keys(options.events).forEach(function(eventName) {
+ $modal.on(eventName, options.events[eventName]);
+ });
+ }
+
$soloModal = $modal
-
+
$modal.modal(options)
-
+
}
-
+
},
-
+
hide: function(/* optional */ template){
-
+
if(template instanceof Blaze.TemplateInstance){
-
+
template.$('.modal').modal('hide')
-
+
}else if($soloModal != null){
-
+
$soloModal.modal('hide')
-
+
}
-
+
}
-
+
} |
b8568f397cc088c5695ee0c743ac791a815e4072 | react/components/Onboarding/components/AnimatedPage/index.js | react/components/Onboarding/components/AnimatedPage/index.js | import React from 'react';
import styled from 'styled-components';
const ANIMATION_PERIOD = 500;
const AnimatedPageWrapper = styled.div`
align-items: center;
bottom: 0;
display: flex;
justify-content: center;
left: 0;
opacity: ${({ opacity }) => opacity};
padding: 1em;
position: fixed;
right: 0;
text-align: center;
top: 0;
transition: opacity ${ ANIMATION_PERIOD }ms ease-in-out;
width: 100%;
`;
class AnimatedPage extends React.Component {
constructor(props) {
super(props);
this.state = {
show: false
};
}
componentWillAppear(callback) {
// Called on fresh load.
this.animateIn(callback);
}
componentWillEnter(callback) {
// Called during transition between routes.
this.animateIn(callback);
}
componentWillLeave(callback) {
this.animateOut(callback);
}
animateIn(callback) {
setTimeout(() => {
this.setState({ show: true }, callback);
}, ANIMATION_PERIOD);
}
animateOut(callback) {
this.setState({ show: false }, () => {
setTimeout(callback, ANIMATION_PERIOD)
});
}
render() {
return (
<AnimatedPageWrapper
opacity={this.state.show ? 1 : 0}
>
{this.props.children}
</AnimatedPageWrapper>
);
}
};
export default AnimatedPage;
| import React from 'react';
import styled from 'styled-components';
const ANIMATION_PERIOD = 500;
const AnimatedPageWrapper = styled.div`
align-items: center;
bottom: 0;
display: flex;
justify-content: center;
left: 0;
opacity: ${({ opacity }) => opacity};
padding: 2em;
position: fixed;
right: 0;
text-align: center;
top: 0;
transition: opacity ${ ANIMATION_PERIOD }ms ease-in-out;
width: 100%;
`;
class AnimatedPage extends React.Component {
constructor(props) {
super(props);
this.state = {
show: false
};
}
componentWillAppear(callback) {
// Called on fresh load.
this.animateIn(callback);
}
componentWillEnter(callback) {
// Called during transition between routes.
this.animateIn(callback);
}
componentWillLeave(callback) {
this.animateOut(callback);
}
animateIn(callback) {
setTimeout(() => {
this.setState({ show: true }, callback);
}, ANIMATION_PERIOD);
}
animateOut(callback) {
this.setState({ show: false }, () => {
setTimeout(callback, ANIMATION_PERIOD)
});
}
render() {
return (
<AnimatedPageWrapper
opacity={this.state.show ? 1 : 0}
>
{this.props.children}
</AnimatedPageWrapper>
);
}
};
export default AnimatedPage;
| Adjust padding on animated page wrapper | Adjust padding on animated page wrapper
| JavaScript | mit | aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell | ---
+++
@@ -10,7 +10,7 @@
justify-content: center;
left: 0;
opacity: ${({ opacity }) => opacity};
- padding: 1em;
+ padding: 2em;
position: fixed;
right: 0;
text-align: center; |
36e046833f631fc8070ebf0c4ef2a186a2c1f7b0 | packages/wdio-dot-reporter/src/index.js | packages/wdio-dot-reporter/src/index.js | import chalk from 'chalk'
import WDIOReporter from 'wdio-reporter'
/**
* Initialize a new `Dot` matrix test reporter.
*/
export default class DotReporter extends WDIOReporter {
constructor (options) {
/**
* make dot reporter to write to output stream by default
*/
options = Object.assign(options, { stdout: true })
super(options)
}
/**
* pending tests
*/
onTestSkip () {
this.write(chalk.cyanBright('.'))
}
/**
* passing tests
*/
onTestPass () {
this.write(chalk.greenBright('.'))
}
/**
* failing tests
*/
onTestFail () {
this.write(chalk.redBright('F'))
}
}
| import chalk from 'chalk'
import WDIOReporter from 'wdio-reporter'
/**
* Initialize a new `Dot` matrix test reporter.
*/
export default class DotReporter extends WDIOReporter {
constructor (options) {
/**
* make dot reporter to write to output stream by default
*/
options = Object.assign({ stdout: true }, options)
super(options)
}
/**
* pending tests
*/
onTestSkip () {
this.write(chalk.cyanBright('.'))
}
/**
* passing tests
*/
onTestPass () {
this.write(chalk.greenBright('.'))
}
/**
* failing tests
*/
onTestFail () {
this.write(chalk.redBright('F'))
}
}
| Allow stdout to be overwritten from config | wdip-dot-reporter: Allow stdout to be overwritten from config
| JavaScript | mit | webdriverio/webdriverio,klamping/webdriverio,klamping/webdriverio,webdriverio/webdriverio,klamping/webdriverio,webdriverio/webdriverio | ---
+++
@@ -9,7 +9,7 @@
/**
* make dot reporter to write to output stream by default
*/
- options = Object.assign(options, { stdout: true })
+ options = Object.assign({ stdout: true }, options)
super(options)
}
|
bf6285ecfa0994dd08c89d4791a2981b32a4e188 | features/step_definitions/shout_steps.js | features/step_definitions/shout_steps.js | const assert = require('assert')
const { Before, Given, When, Then } = require('@cucumber/cucumber')
const Shouty = require('../../lib/shouty')
const Coordinate = require('../../lib/coordinate')
const ARBITARY_MESSAGE = 'Hello, world'
let shouty
Before(function() {
shouty = new Shouty()
})
Given('Lucy is at {int}, {int}', function (x, y) {
shouty.setLocation('Lucy', new Coordinate(x, y))
})
Given('Sean is at {int}, {int}', function (x, y) {
shouty.setLocation('Sean', new Coordinate(x, y))
})
When('Sean shouts', function () {
shouty.shout('Sean', ARBITARY_MESSAGE)
})
Then('Lucy should hear Sean', function () {
assert.strictEqual(shouty.getShoutsHeardBy('Lucy').size, 1)
})
Then('Lucy should hear nothing', function () {
assert.strictEqual(shouty.getShoutsHeardBy('Lucy').size, 0)
})
| const assert = require('assert')
const { Given, When, Then } = require('@cucumber/cucumber')
const Shouty = require('../../lib/shouty')
const Coordinate = require('../../lib/coordinate')
const ARBITARY_MESSAGE = 'Hello, world'
let shouty = new Shouty()
Given('Lucy is at {int}, {int}', function (x, y) {
shouty.setLocation('Lucy', new Coordinate(x, y))
})
Given('Sean is at {int}, {int}', function (x, y) {
shouty.setLocation('Sean', new Coordinate(x, y))
})
When('Sean shouts', function () {
shouty.shout('Sean', ARBITARY_MESSAGE)
})
Then('Lucy should hear Sean', function () {
assert.strictEqual(shouty.getShoutsHeardBy('Lucy').size, 1)
})
Then('Lucy should hear nothing', function () {
assert.strictEqual(shouty.getShoutsHeardBy('Lucy').size, 0)
})
| Remove Before hook from startpoint | Remove Before hook from startpoint
| JavaScript | mit | cucumber-ltd/shouty.js,cucumber-ltd/shouty.js | ---
+++
@@ -1,14 +1,10 @@
const assert = require('assert')
-const { Before, Given, When, Then } = require('@cucumber/cucumber')
+const { Given, When, Then } = require('@cucumber/cucumber')
const Shouty = require('../../lib/shouty')
const Coordinate = require('../../lib/coordinate')
const ARBITARY_MESSAGE = 'Hello, world'
-let shouty
-
-Before(function() {
- shouty = new Shouty()
-})
+let shouty = new Shouty()
Given('Lucy is at {int}, {int}', function (x, y) {
shouty.setLocation('Lucy', new Coordinate(x, y)) |
7f53b117e55cb03f2d1befd04bff1ff4dbbbf2b8 | client/router.js | client/router.js | import { MeetingSeries } from '/imports/meetingseries'
Router.configure({
// set default application template for all routes
layoutTemplate: 'appLayout'
});
Router.route('/', {name: 'home'});
Router.route('/meetingseries/:_id', function () {
var meetingSeriesID = this.params._id;
this.render('meetingSeriesDetails', {data: meetingSeriesID});
});
Router.route('/minutesadd/:_id', function () {
let meetingSeriesID = this.params._id;
ms = new MeetingSeries(meetingSeriesID);
let id = '';
ms.addNewMinutes(newMinutesID => {
id = newMinutesID;
});
this.redirect('/minutesedit/' + id);
});
Router.route('/minutesedit/:_id', function () {
var minutesID = this.params._id;
this.render('minutesedit', {data: minutesID});
});
| import { MeetingSeries } from '/imports/meetingseries'
Router.configure({
// set default application template for all routes
layoutTemplate: 'appLayout'
});
Router.route('/', {name: 'home'});
Router.route('/meetingseries/:_id', function () {
var meetingSeriesID = this.params._id;
this.render('meetingSeriesDetails', {data: meetingSeriesID});
});
Router.route('/minutesadd/:_id', function () {
let meetingSeriesID = this.params._id;
ms = new MeetingSeries(meetingSeriesID);
let id;
ms.addNewMinutes(newMinutesID => {
id = newMinutesID;
});
// callback should have been called by now
if (id) {
this.redirect('/minutesedit/' + id);
} else {
// todo: use error page
this.redirect('/meetingseries/' + meetingSeriesID);
}
});
Router.route('/minutesedit/:_id', function () {
var minutesID = this.params._id;
this.render('minutesedit', {data: minutesID});
});
| Add a fallback redirect in case an error occurs | Add a fallback redirect in case an error occurs
In case something goes wrong while adding new minutes,
the user is now redirected to something that most
likely exists. Should be extended to redirect the
user to an error page that explains what happened.
Or the meetingseries/:_id page with a flash message/
modal box, that explains what happened.
Important: Really redirect the user, otherwise the
minutesadd/:_id page will be re-rendered because
minutesAdd changes the meeting series document.
Re-rendering potentially causes re-adding of new
minutes which might trap the user in an endless loop,
creating numerous new minutes.
| JavaScript | mit | 4minitz/4minitz,RobNeXX/4minitz,4minitz/4minitz,RobNeXX/4minitz,RobNeXX/4minitz,Huggle77/4minitz,4minitz/4minitz,Huggle77/4minitz,Huggle77/4minitz | ---
+++
@@ -17,12 +17,18 @@
let meetingSeriesID = this.params._id;
ms = new MeetingSeries(meetingSeriesID);
- let id = '';
+ let id;
ms.addNewMinutes(newMinutesID => {
id = newMinutesID;
});
- this.redirect('/minutesedit/' + id);
+ // callback should have been called by now
+ if (id) {
+ this.redirect('/minutesedit/' + id);
+ } else {
+ // todo: use error page
+ this.redirect('/meetingseries/' + meetingSeriesID);
+ }
});
Router.route('/minutesedit/:_id', function () { |
276f822879fa36e3e39c51e59022784522a9e945 | public/javascripts/application.js | public/javascripts/application.js | $(function() {
$('#applicant_character_server').change(populateArmory);
$('#applicant_character_name').change(populateArmory);
});
function populateArmory() {
// if ($('#applicant_armory_link').val() != '') {
// return false;
// }
cserver = $('#applicant_character_server').val();
cname = $('#applicant_character_name').val();
$('#applicant_armory_link').val("http://www.wowarmory.com/character-sheet.xml?r=" + cserver + "&n=" + cname);
$('#applicant_armory_link').effect('highlight', {}, 1500);
} | $(function() {
$('#applicant_character_server').change(populateArmory);
$('#applicant_character_name').change(populateArmory);
});
function populateArmory() {
// if ($('#applicant_armory_link').val() != '') {
// return false;
// }
cserver = escape($('#applicant_character_server').val());
cname = escape($('#applicant_character_name').val());
$('#applicant_armory_link').val("http://www.wowarmory.com/character-sheet.xml?r=" + cserver + "&n=" + cname);
$('#applicant_armory_link').effect('highlight', {}, 1500);
} | Use escape() on the values before we add them to the Armory link field. | Use escape() on the values before we add them to the Armory link field.
| JavaScript | mit | tsigo/juggapp,tsigo/juggapp | ---
+++
@@ -7,10 +7,10 @@
// if ($('#applicant_armory_link').val() != '') {
// return false;
// }
-
- cserver = $('#applicant_character_server').val();
- cname = $('#applicant_character_name').val();
-
+
+ cserver = escape($('#applicant_character_server').val());
+ cname = escape($('#applicant_character_name').val());
+
$('#applicant_armory_link').val("http://www.wowarmory.com/character-sheet.xml?r=" + cserver + "&n=" + cname);
$('#applicant_armory_link').effect('highlight', {}, 1500);
} |
4f97b7c3896c42abe4d3f120149b27119ba28252 | graphql/database/experiments/features.js | graphql/database/experiments/features.js | import {
YAHOO_SEARCH_EXISTING_USERS,
YAHOO_SEARCH_NEW_USERS,
} from './experimentConstants'
const features = {
'money-raised-exclamation-point': {
defaultValue: false,
rules: [
{
variations: [false, true],
coverage: 0.4,
condition: {
v4BetaEnabled: true,
},
},
],
},
}
features[YAHOO_SEARCH_EXISTING_USERS] = {
defaultValue: false,
// Enable when SFAC search engine is enabled.
// rules: [
// {
// condition: {
// isTabTeamMember: true,
// env: 'local',
// },
// force: true,
// },
// ],
}
features[YAHOO_SEARCH_NEW_USERS] = {
defaultValue: 'Google',
// Enable when SFAC search engine is enabled.
// rules: [
// {
// condition: {
// isTabTeamMember: true,
// env: 'local',
// },
// force: 'SearchForACause',
// },
// ],
}
export default features
| import {
YAHOO_SEARCH_EXISTING_USERS,
YAHOO_SEARCH_NEW_USERS,
} from './experimentConstants'
const features = {
'money-raised-exclamation-point': {
defaultValue: false,
rules: [
{
condition: {
isTabTeamMember: true,
env: 'local',
},
// Modify this for local testing.
force: true,
},
{
variations: [false, true],
coverage: 0.4,
condition: {
v4BetaEnabled: true,
},
},
],
},
}
features[YAHOO_SEARCH_EXISTING_USERS] = {
defaultValue: false,
// Enable when SFAC search engine is enabled.
// rules: [
// {
// condition: {
// isTabTeamMember: true,
// env: 'local',
// },
// force: true,
// },
// ],
}
features[YAHOO_SEARCH_NEW_USERS] = {
defaultValue: 'Google',
// Enable when SFAC search engine is enabled.
// rules: [
// {
// condition: {
// isTabTeamMember: true,
// env: 'local',
// },
// force: 'SearchForACause',
// },
// ],
}
export default features
| Create local rule for experiment | Create local rule for experiment
| JavaScript | mpl-2.0 | gladly-team/tab,gladly-team/tab,gladly-team/tab | ---
+++
@@ -7,6 +7,14 @@
'money-raised-exclamation-point': {
defaultValue: false,
rules: [
+ {
+ condition: {
+ isTabTeamMember: true,
+ env: 'local',
+ },
+ // Modify this for local testing.
+ force: true,
+ },
{
variations: [false, true],
coverage: 0.4, |
519a9e6b98846750c2ced4557f61a5a93b597645 | client/ng-lodash/ng-lodash.js | client/ng-lodash/ng-lodash.js | angular.module('ng.lodash', []).
factory('_', function($window){
$window._.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
return $window._;
}); | angular.module('ng.lodash', []).
factory('_', function($window){
$window._.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
/**
* Fast UUID generator, RFC4122 version 4 compliant.
* @author Jeff Ward (jcward.com).
* @license MIT license
* @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
**/
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
_.uniqueId = function() {
var d0 = Math.random()*0xffffffff|0;
var d1 = Math.random()*0xffffffff|0;
var d2 = Math.random()*0xffffffff|0;
var d3 = Math.random()*0xffffffff|0;
return lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+'-'+
lut[d1&0xff]+lut[d1>>8&0xff]+'-'+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+'-'+
lut[d2&0x3f|0x80]+lut[d2>>8&0xff]+'-'+lut[d2>>16&0xff]+lut[d2>>24&0xff]+
lut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];
};
return $window._;
}); | Change lodash to use guid generator (MIT licensed, Jeff Ward @ stackoverflow) | Change lodash to use guid generator (MIT licensed, Jeff Ward @ stackoverflow)
| JavaScript | mit | dustyrockpyle/ipyng,dustyrockpyle/ipyng,dustyrockpyle/ipyng | ---
+++
@@ -1,5 +1,23 @@
angular.module('ng.lodash', []).
- factory('_', function($window){
- $window._.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
- return $window._;
- });
+ factory('_', function($window){
+ $window._.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
+ /**
+ * Fast UUID generator, RFC4122 version 4 compliant.
+ * @author Jeff Ward (jcward.com).
+ * @license MIT license
+ * @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
+ **/
+
+ var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
+ _.uniqueId = function() {
+ var d0 = Math.random()*0xffffffff|0;
+ var d1 = Math.random()*0xffffffff|0;
+ var d2 = Math.random()*0xffffffff|0;
+ var d3 = Math.random()*0xffffffff|0;
+ return lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+'-'+
+ lut[d1&0xff]+lut[d1>>8&0xff]+'-'+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+'-'+
+ lut[d2&0x3f|0x80]+lut[d2>>8&0xff]+'-'+lut[d2>>16&0xff]+lut[d2>>24&0xff]+
+ lut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];
+ };
+ return $window._;
+ }); |
4be2f161407679850c0f6fd25ccb91dc9698aa87 | config/params.js | config/params.js | /**
* Created by ar on 7/16/15.
*/
var dbuser = "root";
var dbpass = "root";
var dbName="idservice";
var host="localhost";
process.argv.forEach(function (val, index, array) {
var parts = val.split("=");
if (parts[0] == "dbuser") {
dbuser = parts[1];
} else if (parts[0] == "dbpass") {
dbpass = parts[1];
}
});
var database={
host:host,
user:dbuser,
pass:dbpass,
dbname:dbName,
connectionURL:"mysql://" + dbuser + ":" + dbpass + "@" + host + "/" + dbName
};
module.exports.database=database;
| /**
* Created by ar on 7/16/15.
*/
var dbuser = "root";
var dbpass = "root";
var dbName="idservice";
var host="localhost";
process.argv.forEach(function (val, index, array) {
var parts = val.split("=");
if (parts[0] == "dbuser") {
dbuser = parts[1];
} else if (parts[0] == "dbpass") {
dbpass = parts[1];
} else if (parts[0] == "host") {
host = parts[1];
} else if (parts[0] == "dbName") {
dbName = parts[1];
}
});
var database={
host:host,
user:dbuser,
pass:dbpass,
dbname:dbName,
connectionURL:"mysql://" + dbuser + ":" + dbpass + "@" + host + "/" + dbName
};
module.exports.database=database;
| Allow mysql host and database name to be configurable | Allow mysql host and database name to be configurable
| JavaScript | apache-2.0 | IHTSDO/component-identifier-service,IHTSDO/component-identifier-service,IHTSDO/component-identifier-service | ---
+++
@@ -13,6 +13,10 @@
dbuser = parts[1];
} else if (parts[0] == "dbpass") {
dbpass = parts[1];
+ } else if (parts[0] == "host") {
+ host = parts[1];
+ } else if (parts[0] == "dbName") {
+ dbName = parts[1];
}
});
|
ecacaa22b13d4fc69c6230b845d6c42a6b9cd7cb | core/app/assets/javascripts/frontend.js | core/app/assets/javascripts/frontend.js | //= require jquery.prevent_scroll_propagation
//= require bubble
//= require_tree ./frontend
//= require factlink.backbone
//= require tour
| //= require bubble
//= require_tree ./frontend
//= require factlink.backbone
//= require tour
| Remove useless require, as bubble also requires this lib | Remove useless require, as bubble also requires this lib
| JavaScript | mit | Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core,daukantas/factlink-core,Factlink/factlink-core | ---
+++
@@ -1,4 +1,3 @@
-//= require jquery.prevent_scroll_propagation
//= require bubble
//= require_tree ./frontend
//= require factlink.backbone |
6c8f21c21315e70b17532916b1b78e72bdf0e4b9 | src/javascript/binary/common_functions/currency_to_symbol.js | src/javascript/binary/common_functions/currency_to_symbol.js | function format_money(currency, amount) {
var symbol = format_money.map[currency];
if (symbol === undefined) {
return currency + ' ' + amount;
}
return symbol + amount;
}
// Taken with modifications from:
// https://github.com/bengourley/currency-symbol-map/blob/master/map.js
// When we need to handle more currencies please look there.
format_money.map = {
"USD": "$",
"GBP": "£",
"AUD": "A$",
"EUR": "€",
"JPY": "¥",
};
if (typeof module !== 'undefined') {
module.exports = {
format_money: format_money,
};
}
| function format_money(currency, amount) {
if(currency === 'JPY') { // remove decimal points for JPY
amount = amount.replace(/\.\d+$/, '');
}
var symbol = format_money.map[currency];
if (symbol === undefined) {
return currency + ' ' + amount;
}
return symbol + amount;
}
// Taken with modifications from:
// https://github.com/bengourley/currency-symbol-map/blob/master/map.js
// When we need to handle more currencies please look there.
format_money.map = {
"USD": "$",
"GBP": "£",
"AUD": "A$",
"EUR": "€",
"JPY": "¥",
};
if (typeof module !== 'undefined') {
module.exports = {
format_money: format_money,
};
}
| Add if for JPY amount | Add if for JPY amount
| JavaScript | apache-2.0 | ashkanx/binary-static,teo-binary/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,raunakkathuria/binary-static,negar-binary/binary-static,4p00rv/binary-static,binary-com/binary-static,teo-binary/binary-static,binary-com/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,fayland/binary-static,raunakkathuria/binary-static,4p00rv/binary-static,teo-binary/binary-static,fayland/binary-static,fayland/binary-static,4p00rv/binary-static,ashkanx/binary-static,raunakkathuria/binary-static,fayland/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,negar-binary/binary-static,negar-binary/binary-static,teo-binary/binary-static,binary-com/binary-static | ---
+++
@@ -1,4 +1,8 @@
function format_money(currency, amount) {
+ if(currency === 'JPY') { // remove decimal points for JPY
+ amount = amount.replace(/\.\d+$/, '');
+ }
+
var symbol = format_money.map[currency];
if (symbol === undefined) {
return currency + ' ' + amount; |
6ceaee707f65af5d44520ccdfcedae6c8c5b409d | test/e2e/specs/generate-palette.spec.js | test/e2e/specs/generate-palette.spec.js | module.exports = {
'palette is generated when random-palette button is clicked': function test(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#random-generate', 10000)
.assert.elementCount('.palette--main .swatch', 0)
.click('#random-generate')
.waitForElementVisible('.swatch', 10000)
.assert.elementCount('.palette--main .swatch', 4)
.end();
},
'palette is generated when valid hex is typed in input': function test(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#app', 10000)
.assert.elementPresent('#generate-palette')
.assert.elementCount('.palette--main .swatch', 0)
.setValue('#generate-palette', '#fff')
.click('#generate-palette-submit')
.waitForElementVisible('.swatch', 10000)
.assert.elementCount('.palette--main .swatch', 4)
.end();
},
};
| module.exports = {
'palette is generated when random-palette button is clicked': function test(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#random-generate', 10000)
.assert.elementCount('.palette--main .swatch', 0)
.click('#random-generate')
.waitForElementVisible('.swatch', 10000)
.assert.elementCount('.palette--main .swatch', 4)
.end();
},
'palette is generated when valid hex is typed in input': function test(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#app', 10000)
.assert.elementPresent('#generate-palette')
.assert.elementCount('.palette--main .swatch', 0)
.setValue('#generate-palette', '#fff')
.click('#generate-palette-submit')
.waitForElementVisible('.swatch', 10000)
.assert.elementCount('.palette--main .swatch', 4)
.end();
},
'history list is created when new palette added that can be clicked on to regenerate palette': function test(browser) {
const devServer = `${browser.globals.devServerURL}/555444`;
browser
.url(devServer)
.waitForElementVisible('.swatch', 10000)
.assert.elementCount('.palette--main .swatch', 4)
.assert.elementCount('.palette--history-list .swatch', 4)
.click('#random-generate')
.assert.elementCount('.palette--history-list .swatch', 8)
.click('.palette--history-list__container:nth-of-type(2) .palette--history-list')
.assert.cssProperty('.palette--main .swatch:first-of-type', 'background-color', 'rgba(85, 84, 68, 1)')
.end();
},
};
| Add e2e test for history-list | [Tests] Add e2e test for history-list
| JavaScript | isc | eddyerburgh/palette-generator,eddyerburgh/palette-generator | ---
+++
@@ -11,6 +11,7 @@
.assert.elementCount('.palette--main .swatch', 4)
.end();
},
+
'palette is generated when valid hex is typed in input': function test(browser) {
const devServer = browser.globals.devServerURL;
@@ -26,4 +27,18 @@
.end();
},
+ 'history list is created when new palette added that can be clicked on to regenerate palette': function test(browser) {
+ const devServer = `${browser.globals.devServerURL}/555444`;
+
+ browser
+ .url(devServer)
+ .waitForElementVisible('.swatch', 10000)
+ .assert.elementCount('.palette--main .swatch', 4)
+ .assert.elementCount('.palette--history-list .swatch', 4)
+ .click('#random-generate')
+ .assert.elementCount('.palette--history-list .swatch', 8)
+ .click('.palette--history-list__container:nth-of-type(2) .palette--history-list')
+ .assert.cssProperty('.palette--main .swatch:first-of-type', 'background-color', 'rgba(85, 84, 68, 1)')
+ .end();
+ },
}; |
ae772ec9a87f9f151b4bb8204692cafd09b1c7ed | src/components/Tile.js | src/components/Tile.js | import React, { Component, PropTypes } from 'react'
import { COLS } from '../constants/Board'
const TILE_SIZE = 60
const basicStyles = {
position: 'absolute',
//flexGrow: 1,
border: '1px solid',
width: TILE_SIZE,
height: TILE_SIZE
}
export default class Tile extends Component {
static propTypes = {
idx: PropTypes.number.isRequired,
type: PropTypes.number.isRequired
}
getStyles(idx) {
return {
...basicStyles,
left: (idx % COLS) * TILE_SIZE,
top: (Math.ceil((idx + 1) / COLS) - 1) * TILE_SIZE
}
}
render() {
const {type, idx} = this.props
const styles = this.getStyles(idx)
return (
<div style={styles}>{type}</div>
)
}
}
| import React, { Component, PropTypes } from 'react'
import {Spring} from 'react-motion'
import { COLS } from '../constants/Board'
const TILE_SIZE = 60
const basicStyles = {
position: 'absolute',
//flexGrow: 1,
border: '1px solid',
width: TILE_SIZE,
height: TILE_SIZE
}
export default class Tile extends Component {
static propTypes = {
position: PropTypes.number.isRequired,
type: PropTypes.number.isRequired
}
getLeftValue(position) {
return (position % COLS) * TILE_SIZE
}
getTopValue(position) {
return (Math.ceil((position + 1) / COLS) - 1) * TILE_SIZE
}
render() {
const {type, position} = this.props
return (
<Spring
endValue={{val: {left: this.getLeftValue(position), top: this.getTopValue(position)}}}
>
{interpolated =>
<div style={{
...basicStyles,
top: interpolated.val.top,
left: interpolated.val.left
}}>{type}</div>
}
</Spring>
)
}
}
| Use springs to animate tiles | Use springs to animate tiles
| JavaScript | mit | okonet/fifteens-trix,okonet/fifteens-trix | ---
+++
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'
+import {Spring} from 'react-motion'
import { COLS } from '../constants/Board'
const TILE_SIZE = 60
@@ -13,23 +14,32 @@
export default class Tile extends Component {
static propTypes = {
- idx: PropTypes.number.isRequired,
+ position: PropTypes.number.isRequired,
type: PropTypes.number.isRequired
}
- getStyles(idx) {
- return {
- ...basicStyles,
- left: (idx % COLS) * TILE_SIZE,
- top: (Math.ceil((idx + 1) / COLS) - 1) * TILE_SIZE
- }
+ getLeftValue(position) {
+ return (position % COLS) * TILE_SIZE
+ }
+
+ getTopValue(position) {
+ return (Math.ceil((position + 1) / COLS) - 1) * TILE_SIZE
}
render() {
- const {type, idx} = this.props
- const styles = this.getStyles(idx)
+ const {type, position} = this.props
return (
- <div style={styles}>{type}</div>
+ <Spring
+ endValue={{val: {left: this.getLeftValue(position), top: this.getTopValue(position)}}}
+ >
+ {interpolated =>
+ <div style={{
+ ...basicStyles,
+ top: interpolated.val.top,
+ left: interpolated.val.left
+ }}>{type}</div>
+ }
+ </Spring>
)
}
} |
1efaaf78b7c405506b0a0bbcc335487bfc666fc3 | src/Attributes/test/Attributes.js | src/Attributes/test/Attributes.js | import { assert } from 'chai';
import cloneDeep from 'lodash/cloneDeep';
import Attributes from '../Attributes';
import defaultTheme from '../../theme';
describe('Attributes', () => {
describe('#processProps', () => {
describe('It doesn\'t mutate the default theme', () => {
let expectedDefaultTheme;
before(() => {
expectedDefaultTheme = cloneDeep(defaultTheme);
Attributes.prototype.processProps.apply(
Attributes.prototype,
[
{
theme: {
KEY_COLOR: 'red',
},
element: {
element: 'object',
meta: {},
content: [],
},
},
]
);
});
it('Default theme has not been mutated', () => {
assert.deepEqual(defaultTheme, expectedDefaultTheme);
});
});
});
});
| import { assert } from 'chai';
import cloneDeep from 'lodash/cloneDeep';
import Attributes from '../Attributes';
import defaultTheme from '../../theme';
describe('Attributes', () => {
describe('#processProps', () => {
describe('It doesn\'t mutate the default theme', () => {
let expectedDefaultTheme;
before(() => {
expectedDefaultTheme = cloneDeep(defaultTheme);
Attributes.prototype.transformPropsIntoState.apply(
Attributes.prototype,
[
{
theme: {
KEY_COLOR: 'red',
},
element: {
element: 'object',
meta: {},
content: [],
},
},
]
);
});
it('Default theme has not been mutated', () => {
assert.deepEqual(defaultTheme, expectedDefaultTheme);
});
});
});
});
| Use ‘transformPropsIntoState’, the method was renamed. | Use ‘transformPropsIntoState’, the method was renamed.
| JavaScript | mit | apiaryio/attributes-kit,apiaryio/attributes-kit,apiaryio/attributes-kit | ---
+++
@@ -12,7 +12,7 @@
before(() => {
expectedDefaultTheme = cloneDeep(defaultTheme);
- Attributes.prototype.processProps.apply(
+ Attributes.prototype.transformPropsIntoState.apply(
Attributes.prototype,
[
{ |
c078fa8329bcf7c3cdc25c2ce68d0fd1b0fdac02 | app/webserver-extensions/extra-routes.js | app/webserver-extensions/extra-routes.js | module.exports = (slackapp) => {
slackapp.webserver.post('/incoming-webhooks/:teamId', (req, res) => {
const events = req.body.events;
if (!events) {
slackapp.log('Bad incoming webhook request', req);
res.sendStatus(400);
} else {
events.filter((e) => {
return e.eventName === 'service-review-created';
}).forEach((e) => {
e.eventData.consumer.displayName = e.eventData.consumer.name; // Massaging into expected format
slackapp.log('Posting new review for team', req.params.teamId);
slackapp.trigger('trustpilot_review_received', [e.eventData, req.params.teamId]);
});
res.sendStatus(200);
}
});
};
| module.exports = (slackapp) => {
slackapp.webserver.post('/incoming-webhooks/:teamId', (req, res) => {
const events = req.body.events;
if (!events) {
slackapp.log('Bad incoming webhook request', req);
res.sendStatus(400);
} else {
const { params: { teamId }, query: { businessUnitId } } = req;
events.filter((e) => {
return e.eventName === 'service-review-created';
}).forEach((e) => {
e.eventData.consumer.displayName = e.eventData.consumer.name; // Massaging into expected format
slackapp.log(`Posting new review for team ${teamId}, business unit ${businessUnitId}`);
slackapp.trigger('trustpilot_review_received', [e.eventData, teamId, businessUnitId]);
});
res.sendStatus(200);
}
});
};
| Handle businessUnitId parameter in webhook | Handle businessUnitId parameter in webhook
| JavaScript | mit | trustpilot/slack-trustpilot | ---
+++
@@ -5,12 +5,13 @@
slackapp.log('Bad incoming webhook request', req);
res.sendStatus(400);
} else {
+ const { params: { teamId }, query: { businessUnitId } } = req;
events.filter((e) => {
return e.eventName === 'service-review-created';
}).forEach((e) => {
e.eventData.consumer.displayName = e.eventData.consumer.name; // Massaging into expected format
- slackapp.log('Posting new review for team', req.params.teamId);
- slackapp.trigger('trustpilot_review_received', [e.eventData, req.params.teamId]);
+ slackapp.log(`Posting new review for team ${teamId}, business unit ${businessUnitId}`);
+ slackapp.trigger('trustpilot_review_received', [e.eventData, teamId, businessUnitId]);
});
res.sendStatus(200);
} |
06601d20b6aab392053b6307955311cce1ded4cf | src/core/area/index.js | src/core/area/index.js | import Area from './templete'
import {
getRangeAncestorElem,
getRange,
isSelectionInArea,
createSelectionBaseNode,
createRange
} from 'utils/selection'
const sciprt = ({ options, widget, el, __S_ }) => {
$(document).on('selectionchange', () => {
const isInArea = isSelectionInArea(el.$area)
if (isInArea && el.$area.html() === '') {
const p = '<p><br /></p>'
el.$area.append(p)
createRange(p, 0, p, 0)
}
})
const insertEmptyP = $elem => {
const $p = $('<p><br></p>')
$p.insertBefore($elem)
$elem.remove()
createSelectionBaseNode($p.get(0), true)
}
// 将回车之后生成的非 <p> 的顶级标签,改为 <p>
const pHandle = e => {
const range = getRange()
const elem = getRangeAncestorElem(range)
const $elem = $(elem)
const $parentElem = $elem.parent()
const nodeName = elem.nodeName
if (!$parentElem.is(el.$area)) return
if (nodeName === 'P') return
if ($elem.text()) return
insertEmptyP($elem)
}
el.$area.on('keyup', e => {
if (e.keyCode !== 13) return
pHandle(e)
})
}
const area = {
Tpl: Area,
run: sciprt
}
export default area
| import Area from './templete'
import {
getRangeAncestorElem,
getRange,
isSelectionInArea,
createSelectionBaseNode,
createRange
} from 'utils/selection'
const sciprt = ({ options, widget, el, __S_ }) => {
$(document).on('selectionchange', () => {
const isInArea = isSelectionInArea(el.$area)
if (isInArea && el.$area.html() === '') {
const $p = $('<p><br /></p>')
el.$area.append($p)
createRange($p.get(0), 0, $p.get(0), 0)
}
})
const insertEmptyP = $elem => {
const $p = $('<p><br></p>')
$p.insertBefore($elem)
$elem.remove()
createSelectionBaseNode($p.get(0), true)
}
// 将回车之后生成的非 <p> 的顶级标签,改为 <p>
const pHandle = e => {
const range = getRange()
const elem = getRangeAncestorElem(range)
const $elem = $(elem)
const $parentElem = $elem.parent()
const nodeName = elem.nodeName
if (!$parentElem.is(el.$area)) return
if (nodeName === 'P') return
if ($elem.text()) return
insertEmptyP($elem)
}
el.$area.on('keyup', e => {
if (e.keyCode !== 13) return
pHandle(e)
})
}
const area = {
Tpl: Area,
run: sciprt
}
export default area
| Fix bug - not node | Fix bug - not node
| JavaScript | mit | Cedcn/holy-editor,Cedcn/holy-editor | ---
+++
@@ -12,9 +12,9 @@
const isInArea = isSelectionInArea(el.$area)
if (isInArea && el.$area.html() === '') {
- const p = '<p><br /></p>'
- el.$area.append(p)
- createRange(p, 0, p, 0)
+ const $p = $('<p><br /></p>')
+ el.$area.append($p)
+ createRange($p.get(0), 0, $p.get(0), 0)
}
})
|
ba8b9e01204a9cd68bd8b2aaf7769a6a092ffcdb | src/enhancers/index.js | src/enhancers/index.js | import pipe from '../pipe';
export const transformIn =
transformer =>
pipeline =>
(stream, close) =>
pipeline(transformer(stream), close);
export const transformOut =
transformer =>
pipeline =>
(stream, close) =>
pipe(stream, pipeline).then(transformer);
export const transformError =
transformer =>
pipeline =>
stream =>
new Pipeline()
.main(pipeline)
.catch(errorStream => transformer(errorStream, stream))
.pipe(stream);
export const disconnect =
pipeline =>
stream =>
noop(pipeline({ ...stream }, () => {}));
/**
* Change given stream prop to the transformer return value.
* @param prop
* @param transformer
*/
export const transformProp =
(prop, transformer) =>
pipeline =>
stream =>
noop(_.set(stream, prop, transformer(stream)));
| import pipe from '../pipe';
import _ from 'lodash';
import { noop } from '../helpers';
export const transformIn =
transformer =>
pipeline =>
(stream, close) =>
pipeline(transformer(stream), close);
export const transformOut =
transformer =>
pipeline =>
(stream, close) =>
pipe(stream, pipeline).then(transformer);
export const transformError =
transformer =>
pipeline =>
stream =>
new Pipeline()
.main(pipeline)
.catch(errorStream => transformer(errorStream, stream))
.pipe(stream);
export const disconnect =
pipeline =>
stream =>
noop(pipeline({ ...stream }, () => {}));
/**
* Change given stream prop to the transformer return value.
* @param prop
* @param transformer
*/
export const transformProp =
(prop, transformer) =>
pipeline =>
stream =>
noop(_.set(stream, prop, transformer(stream)));
| Add missing imports for enhancers | Add missing imports for enhancers
| JavaScript | mit | MrBr/pipelinejs | ---
+++
@@ -1,4 +1,6 @@
import pipe from '../pipe';
+import _ from 'lodash';
+import { noop } from '../helpers';
export const transformIn =
transformer => |
2e890cca49509a2a9536e373d09854e8e77ab51f | src/pages/dataTableUtilities/constants.js | src/pages/dataTableUtilities/constants.js | /* eslint-disable import/prefer-default-export */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export const ACTIONS = {
// tableAction constants
SORT_DATA: 'sortData',
FILTER_DATA: 'filterData',
REFRESH_DATA: 'refreshData',
ADD_ITEM: 'addItem',
ADD_RECORD: 'addRecord',
HIDE_OVER_STOCKED: 'hideOverStocked',
HIDE_STOCK_OUT: 'hideStockOut',
// pageAction constants
OPEN_MODAL: 'openModal',
CLOSE_MODAL: 'closeModal',
// rowAction constants
REFRESH_ROW: 'refreshRow',
EDIT_TOTAL_QUANTITY: 'editTotalQuantity',
EDIT_COUNTED_QUANTITY: 'editCountedTotalQuantity',
EDIT_REQUIRED_QUANTITY: 'editRequiredQuantity',
EDIT_EXPIRY_DATE: 'editExpiryDate',
ENFORCE_REASON: 'enforceReasonChoice',
// cellAction constants
FOCUS_CELL: 'focusCell',
FOCUS_NEXT: 'focusNext',
SELECT_ROW: 'selectRow',
SELECT_ALL: 'selectAll',
SELECT_ITEMS: 'selectItems',
DESELECT_ROW: 'deselectRow',
DESELECT_ALL: 'deselectAll',
DELETE_RECORDS: 'deleteSelectedItems',
};
| /* eslint-disable import/prefer-default-export */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
export const ACTIONS = {
// tableAction constants
SORT_DATA: 'sortData',
FILTER_DATA: 'filterData',
REFRESH_DATA: 'refreshData',
ADD_ITEM: 'addItem',
ADD_RECORD: 'addRecord',
HIDE_OVER_STOCKED: 'hideOverStocked',
HIDE_STOCK_OUT: 'hideStockOut',
// pageAction constants
OPEN_MODAL: 'openModal',
CLOSE_MODAL: 'closeModal',
// rowAction constants
REFRESH_ROW: 'refreshRow',
EDIT_TOTAL_QUANTITY: 'editTotalQuantity',
EDIT_COUNTED_QUANTITY: 'editCountedQuantity',
EDIT_REQUIRED_QUANTITY: 'editRequiredQuantity',
EDIT_EXPIRY_DATE: 'editExpiryDate',
ENFORCE_REASON: 'enforceReasonChoice',
// cellAction constants
FOCUS_CELL: 'focusCell',
FOCUS_NEXT: 'focusNext',
SELECT_ROW: 'selectRow',
SELECT_ALL: 'selectAll',
SELECT_ITEMS: 'selectItems',
DESELECT_ROW: 'deselectRow',
DESELECT_ALL: 'deselectAll',
DELETE_RECORDS: 'deleteSelectedItems',
};
| Add correct edit counted quantity key value | Add correct edit counted quantity key value
| JavaScript | mit | sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile | ---
+++
@@ -21,7 +21,7 @@
// rowAction constants
REFRESH_ROW: 'refreshRow',
EDIT_TOTAL_QUANTITY: 'editTotalQuantity',
- EDIT_COUNTED_QUANTITY: 'editCountedTotalQuantity',
+ EDIT_COUNTED_QUANTITY: 'editCountedQuantity',
EDIT_REQUIRED_QUANTITY: 'editRequiredQuantity',
EDIT_EXPIRY_DATE: 'editExpiryDate',
ENFORCE_REASON: 'enforceReasonChoice', |
695ab5108b65509299bed35ebaace2e8ff4dc74b | src/Menu/MenuList.js | src/Menu/MenuList.js | import PropTypes from 'prop-types';
import React from 'react';
import List from '../List/List';
import ScaledComponent from './ScaledComponent';
import DelayedItems from './DelayedItems';
const propTypes = {
children: PropTypes.node,
};
const MenuList = ({ children, ...otherProps }) =>
<List
className="mdc-simple-menu__items"
role="menu"
{...otherProps}
>
{children}
</List>
;
MenuList.propTypes = propTypes;
export default ScaledComponent(DelayedItems(MenuList));
| import PropTypes from 'prop-types';
import React from 'react';
import List from '../List/List';
import ScaledComponent from './ScaledComponent';
import DelayedItems from './DelayedItems';
const propTypes = {
children: PropTypes.node,
};
const MenuList = ({ children, ...otherProps }) =>
<List
className="mdc-menu__items"
role="menu"
{...otherProps}
>
{children}
</List>
;
MenuList.propTypes = propTypes;
export default ScaledComponent(DelayedItems(MenuList));
| Remove simple menu from menu list | Remove simple menu from menu list | JavaScript | mit | kradio3/react-mdc-web | ---
+++
@@ -10,7 +10,7 @@
const MenuList = ({ children, ...otherProps }) =>
<List
- className="mdc-simple-menu__items"
+ className="mdc-menu__items"
role="menu"
{...otherProps}
> |
f3b4def6e989a7739947d3e5b39fe9b3751a4aa1 | static/assets/js/hc_scoreboard.js | static/assets/js/hc_scoreboard.js | $(function () {
var hc_scoreboard_series = {
name: 'Points',
id: ':scores',
data: [],
dataLabels: {
enabled: true,
color: '#FFFFFF',
align: 'center',
y: 10, // 10 pixels down from the top
}
};
// Get initial chart data, set up columns for teams
$.get( '/team/scores' )
.done(function(data) {
$.each(data, function(index, result) {
hc_scoreboard_series.data.push([
result.teamname, result.points
]);
});
$('#hc_scoreboard').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Team Scores'
},
subtitle: {
text: '(Updates automatically)'
},
xAxis: {
type: 'category',
labels: {
rotation: -45,
},
crosshair: false
},
yAxis: {
min: 0,
title: {
text: 'Points'
}
},
legend: {
enabled: false
},
plotOptions: {
column: {
pointPadding: 0,
groupPadding: 0.1,
borderWidth: 0,
colorByPoint: true,
shadow: true
}
},
series: [hc_scoreboard_series]
});
});
});
| $(function () {
var hc_scoreboard_series = {
name: 'Points',
id: ':scores',
data: [],
dataLabels: {
enabled: true,
color: '#FFFFFF',
align: 'center',
y: 25, // 25 pixels down from the top
style: {
fontSize: '3.2vw'
}
}
};
// Get initial chart data, set up columns for teams
$.get( '/team/scores' )
.done(function(data) {
$.each(data, function(index, result) {
hc_scoreboard_series.data.push([
result.teamname, result.points
]);
});
$('#hc_scoreboard').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Team Scores'
},
subtitle: {
text: '(Updates automatically)'
},
xAxis: {
type: 'category',
labels: {
rotation: -45,
},
crosshair: false
},
yAxis: {
min: 0,
title: {
text: 'Points'
}
},
legend: {
enabled: false
},
plotOptions: {
column: {
pointPadding: 0,
groupPadding: 0.1,
borderWidth: 0,
colorByPoint: true,
shadow: true
}
},
series: [hc_scoreboard_series]
});
});
});
| Increase font size on scoreboard point labels | Increase font size on scoreboard point labels
Makes it much easier to read from further away
Signed-off-by: Tyler Butters <51880522bf24185c8b28348ae172827853c5d662@gmail.com>
| JavaScript | bsd-3-clause | pereztr5/cyboard,pereztr5/cyboard,pereztr5/cyboard,pereztr5/cyboard | ---
+++
@@ -8,7 +8,10 @@
enabled: true,
color: '#FFFFFF',
align: 'center',
- y: 10, // 10 pixels down from the top
+ y: 25, // 25 pixels down from the top
+ style: {
+ fontSize: '3.2vw'
+ }
}
};
|
407d2b01afb95f389daaab81f600b27ada87d5d1 | static/js/directives/open-file.js | static/js/directives/open-file.js | /* global angular: true, FileReader: true */
angular.module('webPGQ.directives')
.directive('openFile', function()
{
function link(scope, element)//, attrs)
{
var input = element.find('input');
input.change(function()
{
var file = this.files[0];
console.log("Loading file:", file);
scope.$apply(function() { scope.loading = true; });
var reader = new FileReader();
reader.onload = function(ev)
{
scope.$apply(function()
{
console.log("Loaded file " + file.name + ".");
scope.onOpen({file: file, content: ev.target.result});
scope.loading = false;
});
}; // end reader.onload
reader.readAsText(file);
});
element.click(function() { input.click(); });
} // end link
return {
restrict: 'E',
scope: {
onOpen: '&',
class: '@'
},
replace: true,
link: link,
templateUrl: '/js/directives/open-file.html'
};
});
| /* global angular: true, FileReader: true */
angular.module('webPGQ.directives')
.directive('openFile', function()
{
function link(scope, element)//, attrs)
{
var input = element.find('input');
input.click(function(event)
{
event.stopPropagation();
});
input.change(function()
{
var file = this.files[0];
console.log("Loading file:", file);
scope.$apply(function() { scope.loading = true; });
var reader = new FileReader();
reader.onload = function(ev)
{
scope.$apply(function()
{
console.log("Loaded file " + file.name + ".");
scope.onOpen({file: file, content: ev.target.result});
scope.loading = false;
});
}; // end reader.onload
reader.readAsText(file);
});
element.click(function() { input.click(); });
} // end link
return {
restrict: 'E',
scope: {
onOpen: '&',
class: '@'
},
replace: true,
link: link,
templateUrl: '/js/directives/open-file.html'
};
});
| Stop propagation on file input click events, so we don't infinitely loop. | Stop propagation on file input click events, so we don't infinitely loop.
| JavaScript | mit | HydroLogic/web-pgq,whitelynx/web-pgq,HydroLogic/web-pgq,whitelynx/web-pgq | ---
+++
@@ -6,6 +6,11 @@
function link(scope, element)//, attrs)
{
var input = element.find('input');
+
+ input.click(function(event)
+ {
+ event.stopPropagation();
+ });
input.change(function()
{ |
93ebb422aeb299902cfdcbfc69718a65d3906016 | defaults/preferences/customizable-ldap-autocomplete.js | defaults/preferences/customizable-ldap-autocomplete.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("extensions.customizable-ldap-autocomplete@clear-code.com.directoryServers", "*");
| /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// you can specify two styles:
// 1. use all LDAP servers: "*"
// 2. use specific LDAP servers: "ldap_2.servers.key1,ldap_2.servers.key2,..."
pref("extensions.customizable-ldap-autocomplete@clear-code.com.directoryServers", "*");
| Add examples of preference value | Add examples of preference value
| JavaScript | mpl-2.0 | clear-code/tb-customizable-ldap-autocomplete,clear-code/tb-customizable-ldap-autocomplete | ---
+++
@@ -2,4 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+// you can specify two styles:
+// 1. use all LDAP servers: "*"
+// 2. use specific LDAP servers: "ldap_2.servers.key1,ldap_2.servers.key2,..."
pref("extensions.customizable-ldap-autocomplete@clear-code.com.directoryServers", "*"); |
03c2c87415fd506c4049805d2f2dd6ea69e26b7d | src/plugin/notifier.js | src/plugin/notifier.js | import {remote} from 'electron'
const Notifier = {
send(options) {
const {title, body} = options
const icon = 'resource/img/icon.png'
const notification = new Notification(title, {body, icon})
notification.onclick = () => {
const frame = remote.getCurrentWindow()
if (frame.isMinimized()) {
frame.restore()
}
frame.focus()
}
return notification
}
}
export default {
install(Vue, options) {
Vue.prototype.$notifier = Notifier
}
}
| import {remote} from 'electron'
const Notifier = {
send(options) {
const {title, body} = options
const icon = 'resource/img/icon.png'
const frame = remote.getCurrentWindow()
frame.flashFrame(true)
const notification = new Notification(title, {body, icon})
notification.onclick = () => {
if (frame.isMinimized()) {
frame.restore()
}
frame.focus()
}
return notification
}
}
export default {
install(Vue, options) {
Vue.prototype.$notifier = Notifier
}
}
| Add frame flash on notification | Add frame flash on notification
| JavaScript | mit | CyanSalt/todu,CyanSalt/todu | ---
+++
@@ -4,9 +4,10 @@
send(options) {
const {title, body} = options
const icon = 'resource/img/icon.png'
+ const frame = remote.getCurrentWindow()
+ frame.flashFrame(true)
const notification = new Notification(title, {body, icon})
notification.onclick = () => {
- const frame = remote.getCurrentWindow()
if (frame.isMinimized()) {
frame.restore()
} |
ea372c04f07090b55c88421ec1d64996d499cd3b | src/selectors/index.js | src/selectors/index.js | /*
This file is a part of libertysoil.org website
Copyright (C) 2015 Loki Education (Social Enterprise)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export function defaultSelector(state) {
let data = state.toJS();
data.is_logged_in = !!data.current_user.id;
if (data.is_logged_in) {
let current_user_id = data.current_user.id;
data.current_user_tags = data.current_user.tags;
data.current_user = data.users[current_user_id];
data.current_user.likes = data.likes[current_user_id];
data.current_user.favourites = data.favourites[current_user_id];
data.i_am_following = data.following[current_user_id];
} else {
data.current_user = null;
}
return data;
}
| /*
This file is a part of libertysoil.org website
Copyright (C) 2015 Loki Education (Social Enterprise)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export function defaultSelector(state) {
let data = state.toJS();
data.is_logged_in = !!data.current_user.id;
if (data.is_logged_in) {
let current_user_id = data.current_user.id;
data.current_user_tags = data.current_user.tags;
data.current_user = data.users[current_user_id];
data.current_user.likes = data.likes[current_user_id] || [];
data.current_user.favourites = data.favourites[current_user_id] || [];
data.i_am_following = data.following[current_user_id];
} else {
data.current_user = null;
}
return data;
}
| Change selector to ensure likes and favourites are not null | Change selector to ensure likes and favourites are not null
| JavaScript | agpl-3.0 | Lokiedu/libertysoil-site,voidxnull/libertysoil-site,voidxnull/libertysoil-site,Lokiedu/libertysoil-site | ---
+++
@@ -26,8 +26,8 @@
data.current_user_tags = data.current_user.tags;
data.current_user = data.users[current_user_id];
- data.current_user.likes = data.likes[current_user_id];
- data.current_user.favourites = data.favourites[current_user_id];
+ data.current_user.likes = data.likes[current_user_id] || [];
+ data.current_user.favourites = data.favourites[current_user_id] || [];
data.i_am_following = data.following[current_user_id];
} else { |
198966c565e54a9e754e7e409126985af7bbcf87 | js/actionCreators.js | js/actionCreators.js | import { SET_SEARCH_TERM } from './actions'
export function setSearchTerm (searchTerm) {
return { type: SET_SEARCH_TERM, searchTerm }
}
| import { SET_SEARCH_TERM, ADD_OMDB_DATA } from './actions'
import axios from 'axios'
export function setSearchTerm (searchTerm) {
return { type: SET_SEARCH_TERM, searchTerm }
}
export function addOMDBData (imdbID, omdbData) {
return { type: ADD_OMDB_DATA, imdbID, omdbData }
}
// thunk creator - thunks are different from actions because they return functions
export function getOMDBDetails (imdbID) {
return function (dispatch, getState) {
axios.get(`http://www.omdbapi.com/?i=${imdbID}`)
.then((response) => {
console.log('response', response)
dispatch(addOMDBData(imdbID, response.data))
})
.catch((error) => {
console.error('axios error', error)
})
}
}
| Add omdb action creator and thunk async action | Add omdb action creator and thunk async action
| JavaScript | mit | galaxode/ubiquitous-eureka,galaxode/ubiquitous-eureka | ---
+++
@@ -1,5 +1,23 @@
-import { SET_SEARCH_TERM } from './actions'
+import { SET_SEARCH_TERM, ADD_OMDB_DATA } from './actions'
+import axios from 'axios'
export function setSearchTerm (searchTerm) {
return { type: SET_SEARCH_TERM, searchTerm }
}
+
+export function addOMDBData (imdbID, omdbData) {
+ return { type: ADD_OMDB_DATA, imdbID, omdbData }
+}
+// thunk creator - thunks are different from actions because they return functions
+export function getOMDBDetails (imdbID) {
+ return function (dispatch, getState) {
+ axios.get(`http://www.omdbapi.com/?i=${imdbID}`)
+ .then((response) => {
+ console.log('response', response)
+ dispatch(addOMDBData(imdbID, response.data))
+ })
+ .catch((error) => {
+ console.error('axios error', error)
+ })
+ }
+} |
bde13b98e0718bdcd0e74d78cba190472a8202cd | erpnext/stock/doctype/stock_settings/stock_settings.js | erpnext/stock/doctype/stock_settings/stock_settings.js | // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Stock Settings', {
refresh: function(frm) {
}
});
| // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Stock Settings', {
refresh: function(frm) {
let filters = function() {
return {
filters : {
is_group : 0
}
};
}
frm.set_query("default_warehouse", filters);
frm.set_query("sample_retention_warehouse", filters);
}
});
| Set Query on warehouse fields in Stock Settings | fix: Set Query on warehouse fields in Stock Settings
| JavaScript | agpl-3.0 | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | ---
+++
@@ -3,6 +3,15 @@
frappe.ui.form.on('Stock Settings', {
refresh: function(frm) {
+ let filters = function() {
+ return {
+ filters : {
+ is_group : 0
+ }
+ };
+ }
+ frm.set_query("default_warehouse", filters);
+ frm.set_query("sample_retention_warehouse", filters);
}
}); |
bdb0fc2ac58a60983857af7b70094ce55d0626a8 | blog-posts/projects/socket4/js/game.js | blog-posts/projects/socket4/js/game.js | var Game = function (options) {
this.stage = options.stage;
this.grid = options.grid;
this.player = 0;
}
Game.prototype = {
start: function(){
this.addCurrentPlayerCoin();
},
coinDropped: function(e){
var column = this.stage.getColumnFromX(e.target.x());
var row = 5 - this.grid.update(column, this.player)
this.stage.animateFall(e, row);
if( this.winner(6 - row, column) )
alert("player "+(this.player+1)+" won!");
else
this.changeTurns();
},
changeTurns: function(){
this.player ^= 1
this.addCurrentPlayerCoin();
},
addCurrentPlayerCoin: function(){
var coin = this.stage.addCoin(this.player);
coin.on("click", this.coinDropped.bind(this));
},
winner: function(row, column){
regex = /([1]{4}|[2]{4})/
return this.grid.getRow(row).match(regex) ||
this.grid.getColumn(column).match(regex) ||
this.diagonalCheck(row, column);
},
diagonalCheck: function(row, column){
return this.grid.getDiagonal(row, column, "slash").match(regex) ||
this.grid.getDiagonal(row, column, "backslash").match(regex);
}
}
socket4 = new Game({stage: new Stage(), grid: new Grid()});
socket4.start();
| var Game = function (options) {
this.stage = options.stage;
this.grid = options.grid;
this.player = 0;
}
Game.prototype = {
start: function(){
this.addCurrentPlayerCoin();
},
coinDropped: function(e){
var column = this.stage.getColumnFromX(e.target.x());
if (column) {;
var row = 5 - this.grid.update(column, this.player)
this.stage.animateFall(e, row);
if( this.winner(6 - row, column) )
alert("player "+(this.player+1)+" won!");
else
this.changeTurns();
} else{
this.stage.animateFall(e, 0);
}
},
changeTurns: function(){
this.player ^= 1
this.addCurrentPlayerCoin();
},
addCurrentPlayerCoin: function(){
var coin = this.stage.addCoin(this.player);
coin.on("click", this.coinDropped.bind(this));
},
winner: function(row, column){
regex = /([1]{4}|[2]{4})/
return this.grid.getRow(row).match(regex) ||
this.grid.getColumn(column).match(regex) ||
this.diagonalCheck(row, column);
},
diagonalCheck: function(row, column){
return this.grid.getDiagonal(row, column, "slash").match(regex) ||
this.grid.getDiagonal(row, column, "backslash").match(regex);
}
}
socket4 = new Game({stage: new Stage(), grid: new Grid()});
socket4.start();
| Fix turn change when coin doesn't fall on grid | Fix turn change when coin doesn't fall on grid
| JavaScript | mit | Gunga/Gunga.github.io,Gunga/Gunga.github.io | ---
+++
@@ -10,12 +10,16 @@
},
coinDropped: function(e){
var column = this.stage.getColumnFromX(e.target.x());
- var row = 5 - this.grid.update(column, this.player)
- this.stage.animateFall(e, row);
- if( this.winner(6 - row, column) )
- alert("player "+(this.player+1)+" won!");
- else
- this.changeTurns();
+ if (column) {;
+ var row = 5 - this.grid.update(column, this.player)
+ this.stage.animateFall(e, row);
+ if( this.winner(6 - row, column) )
+ alert("player "+(this.player+1)+" won!");
+ else
+ this.changeTurns();
+ } else{
+ this.stage.animateFall(e, 0);
+ }
},
changeTurns: function(){
this.player ^= 1 |
c3e6fe94c474856c2487be6a90a4ce50b522e526 | src/javascript/functions/FileUploader.js | src/javascript/functions/FileUploader.js | import BenchmarkRun from 'models/BenchmarkRun.js';
import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx';
//A non-ui class which cares about upload file, converting them to json and passing them on to the AppState
export default class FileUploader {
constructor(uploadBenchmarksFunction) {
this.uploadBenchmarksFunction = uploadBenchmarksFunction;
}
upload(files) {
if (files.length > 2) {
alert(`Maximum 2 files allowed to upload, but not ${files.length}!`)
return
}
DoingWorkSpinner.show();
const benchmarkRuns = [];
const uploadFunction = this.uploadBenchmarksFunction;
files.forEach((file, i) => {
const reader = new FileReader();
reader.onload = function(evt) {
try {
var parsedBenchmarks = JSON.parse(evt.target.result);
const benchmarkRun = new BenchmarkRun({
name: file.name,
benchmarks: parsedBenchmarks
});
benchmarkRuns.push(benchmarkRun);
if (i == files.length - 1) {
benchmarkRuns.sort((a, b) => a.name.localeCompare(b.name));
uploadFunction(benchmarkRuns);
}
} catch ( e ) {
alert(e); //error in the above string(in this case,yes)!
DoingWorkSpinner.hide();
}
};
reader.readAsText(file);
});
}
} | import BenchmarkRun from 'models/BenchmarkRun.js';
import DoingWorkSpinner from 'components/DoingWorkSpinner.jsx';
//A non-ui class which cares about upload file, converting them to json and passing them on to the AppState
export default class FileUploader {
constructor(uploadBenchmarksFunction) {
this.uploadBenchmarksFunction = uploadBenchmarksFunction;
}
upload(files) {
if (files.length > 2) {
alert(`Maximum 2 files allowed to upload, but not ${files.length}!`)
return
}
DoingWorkSpinner.show();
const benchmarkRuns = [];
const uploadFunction = this.uploadBenchmarksFunction;
files.forEach((file, i) => {
const reader = new FileReader();
const runName = file.name.replace('.json', '');
reader.onload = function(evt) {
try {
var parsedBenchmarks = JSON.parse(evt.target.result);
const benchmarkRun = new BenchmarkRun({
name: runName,
benchmarks: parsedBenchmarks
});
benchmarkRuns.push(benchmarkRun);
if (i == files.length - 1) {
benchmarkRuns.sort((a, b) => a.name.localeCompare(b.name));
uploadFunction(benchmarkRuns);
}
} catch ( e ) {
alert(e); //error in the above string(in this case,yes)!
DoingWorkSpinner.hide();
}
};
reader.readAsText(file);
});
}
} | Remove .json suffix from run names | Remove .json suffix from run names | JavaScript | agpl-3.0 | jzillmann/jmh-visualizer,jzillmann/jmh-visualizer | ---
+++
@@ -20,11 +20,12 @@
const uploadFunction = this.uploadBenchmarksFunction;
files.forEach((file, i) => {
const reader = new FileReader();
+ const runName = file.name.replace('.json', '');
reader.onload = function(evt) {
try {
var parsedBenchmarks = JSON.parse(evt.target.result);
const benchmarkRun = new BenchmarkRun({
- name: file.name,
+ name: runName,
benchmarks: parsedBenchmarks
});
benchmarkRuns.push(benchmarkRun); |
6ab46c00d530fd95d1947e80aa6fa6208d2a8f0e | src/main/webapp/components/Navigation.js | src/main/webapp/components/Navigation.js | import * as React from 'react';
/**
* Main List Element to be displayed on the Navigation.
*
* @param {Object} props
* @param {string} props.href hyperlink for the href attribute.
* @param {string} props.innerText rendered text content of node.
*/
const NavigationItem = (props) => {
return (
<li>
<a href = {props.href}>{props.innerText}</a>
</li>
);
}
/**
* Main Navigation List.
* Instance will be embedded in ./Header component.
*
* @param {Object} props
* @param {Object} props.options an array of navigation options.
* @param {string} props.options[].link an external URL attached to option.
* @param {string} props.options[].text the displayed text for the option.
*/
export const Navigation = (props) => {
return (
<ul className="navigation">
{props.options.map (option =>
<NavigationItem href={option.link} innerText={option.text}/>
)}
</ul>
);
}
| import * as React from 'react';
/**
* Main List Element to be displayed on the Navigation.
*
* @param {Object} props
* @param {string} props.href hyperlink for the href attribute.
* @param {string} props.innerText rendered text content of node.
*/
const NavigationItem = (props) => {
return (
<li>
<a href = {props.href}>{props.innerText}</a>
</li>
);
}
/**
* Main Navigation List.
* Instance will be embedded in ./Header component.
*
* @param {Object} props
* @param {Object} props.options an array of navigation options.
* @param {string} props.options[].link an external URL attached to option.
* @param {string} props.options[].text the displayed text for the option.
*/
export const Navigation = (props) => {
const options = getField(props, 'options', []);
return (
<ul className="navigation">
{props.options.map (option =>
<NavigationItem href={option.link} innerText={option.text}/>
)}
</ul>
);
}
| Use nav options with getField | Use nav options with getField
| JavaScript | apache-2.0 | googleinterns/step240-2020,googleinterns/step240-2020,googleinterns/step240-2020,googleinterns/step240-2020 | ---
+++
@@ -25,6 +25,8 @@
* @param {string} props.options[].text the displayed text for the option.
*/
export const Navigation = (props) => {
+ const options = getField(props, 'options', []);
+
return (
<ul className="navigation">
{props.options.map (option => |
897738ebfffa12542efcf567bd895fb3b05c6f40 | src/services/user/hooks/index.js | src/services/user/hooks/index.js | 'use strict';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
exports.before = {
all: [
globalHooks.isAdmin()
],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
create: [
auth.hashPassword()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
patch: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
remove: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
]
};
exports.after = {
all: [hooks.remove('password')],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
};
| 'use strict';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
create: [
auth.hashPassword()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
patch: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
remove: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
]
};
exports.after = {
all: [hooks.remove('password')],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
};
| Remove auth hook from user | Remove auth hook from user
| JavaScript | mit | davejtoews/cfl-power-rankings,davejtoews/cfl-power-rankings | ---
+++
@@ -5,9 +5,7 @@
const auth = require('feathers-authentication').hooks;
exports.before = {
- all: [
- globalHooks.isAdmin()
- ],
+ all: [],
find: [
auth.verifyToken(),
auth.populateUser(), |
a0afdd3bc1af26bc2597ef417b51a417c7f79f53 | crosscompute/templates/stringOutput.js | crosscompute/templates/stringOutput.js | async registerElement('$variable_id', function () {
try {
await refreshString('$element_id', 'textContent', '$data_uri');
} catch {
}
});
| registerElement('$variable_id', async function () {
try {
await refreshString('$element_id', 'textContent', '$data_uri');
} catch {
}
});
| Put async in right place | Put async in right place
| JavaScript | mit | crosscompute/crosscompute,crosscompute/crosscompute,crosscompute/crosscompute,crosscompute/crosscompute | ---
+++
@@ -1,4 +1,4 @@
-async registerElement('$variable_id', function () {
+registerElement('$variable_id', async function () {
try {
await refreshString('$element_id', 'textContent', '$data_uri');
} catch { |
ef49f46f340058167ffe68db44d067524096a7ac | src/browser/fermenter/Commander.react.js | src/browser/fermenter/Commander.react.js | import Component from 'react-pure-render/component';
import R from 'ramda';
import React, { PropTypes } from 'react';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import { IconButton, Menu } from 'react-mdl/lib';
import { MenuItem } from 'react-mdl/lib/Menu';
class FermenterCommander extends Component {
static propTypes = {
fermenterRts: PropTypes.object.isRequired,
fermenterStart: PropTypes.func.isRequired,
fermenterStop: PropTypes.func.isRequired,
intl: intlShape.isRequired,
};
render() {
const { fermenterRts: rts, fermenterStart, fermenterStop } = this.props;
if (R.empty(status)) {
return (<div>No status yet...</div>);
}
return (
<div style={{ position: 'relative' }}>
<IconButton name="more_vert" id="fermenter_menu_upper_left" />
<Menu target="fermenter_menu_upper_left" >
<MenuItem onClick={fermenterStart}>Switch fermenter on</MenuItem>
<MenuItem onClick={fermenterStop}>Switch fermenter off</MenuItem>
<MenuItem disabled>Emergency off</MenuItem>
</Menu>
<p style={{ display: 'inline' }}>Current status: [{rts.status}]</p>
</div>
);
}
}
export default injectIntl(FermenterCommander);
| import Component from 'react-pure-render/component';
import R from 'ramda';
import React, { PropTypes } from 'react';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import { IconButton, Menu } from 'react-mdl/lib';
import { MenuItem } from 'react-mdl/lib/Menu';
class FermenterCommander extends Component {
static propTypes = {
fermenterRts: PropTypes.object.isRequired,
fermenterStart: PropTypes.func.isRequired,
fermenterStop: PropTypes.func.isRequired,
intl: intlShape.isRequired,
};
render() {
const { fermenterRts: rts, fermenterStart, fermenterStop } = this.props;
const maybeShowCurrentCmd = R.defaultTo(' -- ');
if (R.isEmpty(rts.status)) {
return (<div>No status yet...</div>);
}
return (
<div style={{ position: 'relative' }}>
<IconButton name="more_vert" id="fermenter_menu_upper_left" />
<Menu target="fermenter_menu_upper_left" >
<MenuItem onClick={fermenterStart}>Switch fermenter on</MenuItem>
<MenuItem onClick={fermenterStop}>Switch fermenter off</MenuItem>
<MenuItem disabled>Emergency off</MenuItem>
</Menu>
<p style={{ display: 'inline' }}>Current status: [{rts.status}]</p>
<p style={{ display: 'inline' }}>| Last command: [{maybeShowCurrentCmd(rts.currentCmd)}]</p>
</div>
);
}
}
export default injectIntl(FermenterCommander);
| Add last fermenter-command in status-display. | Add last fermenter-command in status-display.
| JavaScript | mit | cjk/smart-home-app | ---
+++
@@ -16,8 +16,9 @@
render() {
const { fermenterRts: rts, fermenterStart, fermenterStop } = this.props;
+ const maybeShowCurrentCmd = R.defaultTo(' -- ');
- if (R.empty(status)) {
+ if (R.isEmpty(rts.status)) {
return (<div>No status yet...</div>);
}
@@ -30,6 +31,7 @@
<MenuItem disabled>Emergency off</MenuItem>
</Menu>
<p style={{ display: 'inline' }}>Current status: [{rts.status}]</p>
+ <p style={{ display: 'inline' }}>| Last command: [{maybeShowCurrentCmd(rts.currentCmd)}]</p>
</div>
);
} |
333f67a4ef7bd4085257fb5078a6a86e581c952b | test.js | test.js | var λ = require('./lambada');
describe('lambada', function () {
it('should return a function', function () {
expect(typeof λ).toBe('function');
});
});
| var λ = require('./lambada');
describe('lambada', function () {
it('should return a function', function () {
expect(typeof λ).toBe('function');
});
it('creates a unary function for a simple expression', function () {
var f = λ('3 + x');
expect(typeof f).toBe('function');
expect(f(-10)).toBe(-7);
expect(f(0)).toBe(3);
expect(f(10)).toBe(13);
});
it('creates a binary function for a simple expression', function () {
var f = λ('x + 2 * y');
expect(typeof f).toBe('function');
expect(f(3, 4)).toBe(11);
expect(f(4, 3)).toBe(10);
expect(f(2, 7)).toBe(16);
});
it('creates a function for a binary operator', function () {
var f = λ('+');
expect(typeof f).toBe('function');
expect(f(3, 2)).toBe(5);
expect(f(-3, 4)).toBe(1);
expect(f(8, 8)).toBe(16);
});
it('creates a function for a partially applied binary operator', function () {
var f = λ('+3');
expect(typeof f).toBe('function');
expect(f(-10)).toBe(-7);
expect(f(0)).toBe(3);
expect(f(10)).toBe(13);
});
});
| Test for simple arithmetic functions | Test for simple arithmetic functions
| JavaScript | mit | rbonvall/lambada | ---
+++
@@ -4,4 +4,36 @@
it('should return a function', function () {
expect(typeof λ).toBe('function');
});
+
+ it('creates a unary function for a simple expression', function () {
+ var f = λ('3 + x');
+ expect(typeof f).toBe('function');
+ expect(f(-10)).toBe(-7);
+ expect(f(0)).toBe(3);
+ expect(f(10)).toBe(13);
+ });
+
+ it('creates a binary function for a simple expression', function () {
+ var f = λ('x + 2 * y');
+ expect(typeof f).toBe('function');
+ expect(f(3, 4)).toBe(11);
+ expect(f(4, 3)).toBe(10);
+ expect(f(2, 7)).toBe(16);
+ });
+
+ it('creates a function for a binary operator', function () {
+ var f = λ('+');
+ expect(typeof f).toBe('function');
+ expect(f(3, 2)).toBe(5);
+ expect(f(-3, 4)).toBe(1);
+ expect(f(8, 8)).toBe(16);
+ });
+
+ it('creates a function for a partially applied binary operator', function () {
+ var f = λ('+3');
+ expect(typeof f).toBe('function');
+ expect(f(-10)).toBe(-7);
+ expect(f(0)).toBe(3);
+ expect(f(10)).toBe(13);
+ });
}); |
36a265a63fcc2f6a1bef897996f03f44d3d5640f | apps/my_system/tests/views/add_button.js | apps/my_system/tests/views/add_button.js | // ==========================================================================
// Project: MySystem Unit Test
// Copyright: ©2010 Concord Consortium
// ==========================================================================
/*globals MySystem module test ok equals same stop start */
module("MySystem.AddButtonView");
var addButton = MySystem.AddButtonView.create();
test("add button was created", function() {
expect(5);
ok(addButton !== null, "addButton should not be null");
ok(addButton.kindOf(MySystem.AddButtonView), "addButton should be an AddButtonView.");
equals(addButton.get('childViews').length, 2, "addButton should have two children.");
ok(addButton.get('icon').kindOf(SC.ImageView), "icon should be a SproutCore ImageView");
ok(addButton.get('label').kindOf(SC.LabelView), "label should be a SproutCore LabelView");
});
| // ==========================================================================
// Project: MySystem Unit Test
// Copyright: ©2010 Concord Consortium
// ==========================================================================
/*globals MySystem module test ok equals same stop start */
module("MySystem.AddButtonView");
var addButton = MySystem.AddButtonView.create();
test("add button was created", function() {
expect(5);
ok(addButton !== null, "addButton should not be null");
ok(addButton.kindOf(MySystem.AddButtonView), "addButton should be an AddButtonView.");
equals(addButton.get('childViews').length, 3, "addButton should have three children.");
ok(addButton.get('icon').kindOf(SC.ImageView), "icon should be a SproutCore ImageView");
ok(addButton.get('label').kindOf(SC.LabelView), "label should be a SproutCore LabelView");
});
| Update view unit test to reflect new view | Update view unit test to reflect new view | JavaScript | mit | concord-consortium/mysystem_sc,concord-consortium/mysystem_sc,concord-consortium/mysystem_sc | ---
+++
@@ -12,7 +12,7 @@
expect(5);
ok(addButton !== null, "addButton should not be null");
ok(addButton.kindOf(MySystem.AddButtonView), "addButton should be an AddButtonView.");
- equals(addButton.get('childViews').length, 2, "addButton should have two children.");
+ equals(addButton.get('childViews').length, 3, "addButton should have three children.");
ok(addButton.get('icon').kindOf(SC.ImageView), "icon should be a SproutCore ImageView");
ok(addButton.get('label').kindOf(SC.LabelView), "label should be a SproutCore LabelView");
}); |
844d4d4410b9fd73cb49a01ab1c975c3bb84d017 | public/scripts/realtime-set-interval.js | public/scripts/realtime-set-interval.js | // Based on http://www.html5rocks.com/en/tutorials/workers/basics/
define(function() {
var URL = window.URL || window.webkitURL
if (URL && Worker && Blob) {
var blobUrl = URL.createObjectURL(new Blob(
['self.onmessage = function(event) { setInterval(function() { self.postMessage({}) }, event.data.interval) }'],
{type: 'text/javascript'}
))
return function(callback, interval) {
var worker = new Worker(blobUrl)
worker.addEventListener('message', callback)
worker.postMessage({interval: interval})
}
}
console.log("Worker or Blob not available, falling back to setInterval()")
return setInterval
})
| // Based on http://www.html5rocks.com/en/tutorials/workers/basics/
define(function() {
var URL = window.URL || window.webkitURL
// BlobBuilder is deprecated but Chrome for Android fails with an "Illegal constructor"
// instantiating the Blob directly
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder
if (URL && Worker && Blob && BlobBuilder) {
var blobBuilder = new BlobBuilder
blobBuilder.append('self.onmessage = function(event) { setInterval(function() { self.postMessage({}) }, event.data.interval) }')
var blob = blobBuilder.getBlob('text/javascript')
var blobUrl = URL.createObjectURL(blob)
return function(callback, interval) {
var worker = new Worker(blobUrl)
worker.addEventListener('message', callback)
worker.postMessage({interval: interval})
}
}
console.log("Worker or Blob not available, falling back to setInterval()")
return setInterval
})
| Use BlobBuilder (supported by Chrome for Android) | Use BlobBuilder (supported by Chrome for Android)
| JavaScript | mit | frosas/lag,frosas/lag,frosas/lag | ---
+++
@@ -1,11 +1,14 @@
// Based on http://www.html5rocks.com/en/tutorials/workers/basics/
define(function() {
var URL = window.URL || window.webkitURL
- if (URL && Worker && Blob) {
- var blobUrl = URL.createObjectURL(new Blob(
- ['self.onmessage = function(event) { setInterval(function() { self.postMessage({}) }, event.data.interval) }'],
- {type: 'text/javascript'}
- ))
+ // BlobBuilder is deprecated but Chrome for Android fails with an "Illegal constructor"
+ // instantiating the Blob directly
+ var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder
+ if (URL && Worker && Blob && BlobBuilder) {
+ var blobBuilder = new BlobBuilder
+ blobBuilder.append('self.onmessage = function(event) { setInterval(function() { self.postMessage({}) }, event.data.interval) }')
+ var blob = blobBuilder.getBlob('text/javascript')
+ var blobUrl = URL.createObjectURL(blob)
return function(callback, interval) {
var worker = new Worker(blobUrl)
worker.addEventListener('message', callback) |
dc71fbaeb988e60454630db72e1a09f74799ee13 | src/changeThreadEmoji.js | src/changeThreadEmoji.js | "use strict";
var utils = require("../utils");
var log = require("npmlog");
module.exports = function(defaultFuncs, api, ctx) {
return function changeThreadEmoji(emoji, threadID, callback) {
var form = {
'emoji_choice' : emoji,
'thread_or_other_fbid' : threadID
};
defaultFuncs
.post("https://www.messenger.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
.then(function(resData) {
if (resData.error === 1357031) {
throw {error: "Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."};
}
if (resData.error) {
throw resData;
}
return callback();
})
.catch(function(err) {
log.error("Error in changeThreadEmoji", err);
return callback(err);
});
};
};
| "use strict";
var utils = require("../utils");
var log = require("npmlog");
module.exports = function(defaultFuncs, api, ctx) {
return function changeThreadEmoji(emoji, threadID, callback) {
if(!callback) {
callback = function() {};
}
var form = {
'emoji_choice' : emoji,
'thread_or_other_fbid' : threadID
};
defaultFuncs
.post("https://www.messenger.com/messaging/save_thread_emoji/?source=thread_settings&__pc=EXP1%3Amessengerdotcom_pkg", ctx.jar, form)
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
.then(function(resData) {
if (resData.error === 1357031) {
throw {error: "Trying to change emoji of a chat that doesn't exist. Have at least one message in the thread before trying to change the emoji."};
}
if (resData.error) {
throw resData;
}
return callback();
})
.catch(function(err) {
log.error("Error in changeThreadEmoji", err);
return callback(err);
});
};
};
| Fix callback parameter as optional | Fix callback parameter as optional | JavaScript | mit | GAMELASTER/facebook-chat-api,Schmavery/facebook-chat-api,ravkr/facebook-chat-api | ---
+++
@@ -5,6 +5,9 @@
module.exports = function(defaultFuncs, api, ctx) {
return function changeThreadEmoji(emoji, threadID, callback) {
+ if(!callback) {
+ callback = function() {};
+ }
var form = {
'emoji_choice' : emoji,
'thread_or_other_fbid' : threadID |
3ca517197395f5c8470bd5a84dfba4f326b8018e | src/command-arguments.js | src/command-arguments.js | export const cardName = {
key: 'cardName',
prompt: 'what card are you searching for?\n',
type: 'string'
}
export const soundKind = {
key: 'soundKind',
prompt: '',
type: 'string',
default: 'play'
}
export const bnetServer = {
key: 'bnetServer',
prompt: 'which battle.net server do you play on?\n',
type: 'string',
parse: value => { return value.toLowerCase() },
validate: value => {
if (['americas', 'europe', 'asia'].includes(value.toLowerCase())) { return true }
return 'please choose a server from `americas`, `europe`, `asia`.\n'
}
}
export const bnetId = {
key: 'bnetId',
prompt: 'what is your battle.net id?\n',
type: 'string'
}
| export const cardName = {
key: 'cardName',
prompt: 'what card are you searching for?\n',
type: 'string'
}
export const soundKind = {
key: 'soundKind',
prompt: '',
type: 'string',
default: 'play'
}
const bnetServerChoices = ['americas', 'na', 'europe', 'eu', 'asia']
export const bnetServer = {
key: 'bnetServer',
prompt: 'which battle.net server do you play on?\n',
type: 'string',
parse: value => {
value = value.toLowerCase()
if (value === 'na') { return 'americas' }
if (value === 'eu') { return 'europe'}
return value
},
validate: value => {
if (bnetServerChoices.includes(value.toLowerCase())) { return true }
return `please choose a server from \`${bnetServerChoices.join('`, `')}\`.\n`
}
}
export const bnetId = {
key: 'bnetId',
prompt: 'what is your battle.net id?\n',
type: 'string'
}
| Update bnetServer argument to accept some shorthand | Update bnetServer argument to accept some shorthand
| JavaScript | mit | tinnvec/stonebot,tinnvec/stonebot | ---
+++
@@ -11,14 +11,20 @@
default: 'play'
}
+const bnetServerChoices = ['americas', 'na', 'europe', 'eu', 'asia']
export const bnetServer = {
key: 'bnetServer',
prompt: 'which battle.net server do you play on?\n',
type: 'string',
- parse: value => { return value.toLowerCase() },
+ parse: value => {
+ value = value.toLowerCase()
+ if (value === 'na') { return 'americas' }
+ if (value === 'eu') { return 'europe'}
+ return value
+ },
validate: value => {
- if (['americas', 'europe', 'asia'].includes(value.toLowerCase())) { return true }
- return 'please choose a server from `americas`, `europe`, `asia`.\n'
+ if (bnetServerChoices.includes(value.toLowerCase())) { return true }
+ return `please choose a server from \`${bnetServerChoices.join('`, `')}\`.\n`
}
}
|
63941d646d01e78bbea58f9a686f5aa173313e5c | src/components/Footer.js | src/components/Footer.js | import React from 'react';
import styled from '@emotion/styled';
const Content = styled.footer`
text-align: center;
color: rgba(0, 0, 0, 0.25);
`;
const Paragraph = styled.p`
margin-bottom: 8px;
font-size: 12px;
&:first-of-type {
font-size: 14px;
}
`;
export default () => (
<Content>
<Paragraph>
We hope these lines of code will be useful to you and help you build great
products.
</Paragraph>
<Paragraph>
Built with ♥ by the team @ <a href="https://www.mirego.com">Mirego</a>.
</Paragraph>
</Content>
);
| import React from 'react';
import styled from '@emotion/styled';
const Content = styled.footer`
text-align: center;
color: rgba(0, 0, 0, 0.25);
`;
const Paragraph = styled.p`
margin-bottom: 8px;
font-size: 12px;
&:first-of-type {
font-size: 14px;
}
`;
export default () => (
<Content>
<Paragraph>
We hope these lines of code will be useful to you and help you build great
products.
</Paragraph>
<Paragraph>
<a
href="https://github.com/mirego/mirego-open-web"
target="_blank"
rel="noopener noreferrer"
>
Built
</a>{' '}
with ♥ (and{' '}
<a
href="https://www.gatsbyjs.org"
target="_blank"
rel="noopener noreferrer"
>
Gatsby.js
</a>
) by the team @ <a href="https://www.mirego.com">Mirego</a>.
</Paragraph>
</Content>
);
| Add more links in footer | Add more links in footer
| JavaScript | bsd-3-clause | mirego/mirego-open-web,mirego/mirego-open-web | ---
+++
@@ -22,7 +22,22 @@
products.
</Paragraph>
<Paragraph>
- Built with ♥ by the team @ <a href="https://www.mirego.com">Mirego</a>.
+ <a
+ href="https://github.com/mirego/mirego-open-web"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Built
+ </a>{' '}
+ with ♥ (and{' '}
+ <a
+ href="https://www.gatsbyjs.org"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Gatsby.js
+ </a>
+ ) by the team @ <a href="https://www.mirego.com">Mirego</a>.
</Paragraph>
</Content>
); |
79e9832b50545baa4cb2920c10c17f499c3a1b8d | static/js/project.js | static/js/project.js | $(document).ready(function() {
$("#search-lots").autocomplete({
minLength: 2,
source: "/lots/search-ajax/",
focus: function( event, ui ) {
$("#search-lots").val( ui.item.name );
return false;
},
select: function( event, ui ) {
window.location.href = "/revenue/receipt/add/" + ui.item.name;
return false;
}
}).autocomplete("instance")._renderItem = function(ul, item) {
return $( "<li>" )
.append( "<div>" + item.name + " <small>" + item.address + "</small><br>" + item.owner__name + "</div>" )
.appendTo( ul );
};
});
function parse_decimal(str) {
return new BigNumber(str.replace(/[^0-9\.]+/g,""))
}
| $(document).ready(function() {
$("#search-lots").autocomplete({
minLength: 2,
source: "/lots/search-ajax/",
focus: function( event, ui ) {
$("#search-lots").val( ui.item.name );
return false;
},
select: function( event, ui ) {
window.location.href = "/revenue/receipt/add/" + ui.item.name;
return false;
}
}).autocomplete("instance")._renderItem = function(ul, item) {
return $( "<li>" )
.append( "<div>" + item.name + " <small>" + item.address + "</small><br>" + item.owner__name + "</div>" )
.appendTo( ul );
};
});
function parse_decimal(str) {
return str !== '' ? new BigNumber(str.replace(/[^0-9\.]+/g,"")) : new BigNumber('0.00');
}
| Fix error when empty string | Fix error when empty string
| JavaScript | mpl-2.0 | jackbravo/condorest-django,jackbravo/condorest-django,jackbravo/condorest-django | ---
+++
@@ -18,5 +18,5 @@
});
function parse_decimal(str) {
- return new BigNumber(str.replace(/[^0-9\.]+/g,""))
+ return str !== '' ? new BigNumber(str.replace(/[^0-9\.]+/g,"")) : new BigNumber('0.00');
} |
eb830c544c0a51bd8b6b82f07376a9a59fc0e266 | app/src/constants.js | app/src/constants.js |
import RNFS from 'react-native-fs';
const Constants = {
API_PATH: 'http://localhost:3000',
IMAGE_DIR: RNFS.DocumentDirectoryPath + '/images/',
}
export default Constants;
|
import RNFS from 'react-native-fs';
const Constants = {
API_PATH: 'http://ec2-52-87-152-32.compute-1.amazonaws.com/',
IMAGE_DIR: RNFS.DocumentDirectoryPath + '/images/',
}
export default Constants;
| Change to targeting a public server | Change to targeting a public server
| JavaScript | mit | buzzfeed-openlab/shit-vcs-say,buzzfeed-openlab/shit-vcs-say,buzzfeed-openlab/shit-vcs-say,buzzfeed-openlab/shit-vcs-say | ---
+++
@@ -3,7 +3,7 @@
const Constants = {
- API_PATH: 'http://localhost:3000',
+ API_PATH: 'http://ec2-52-87-152-32.compute-1.amazonaws.com/',
IMAGE_DIR: RNFS.DocumentDirectoryPath + '/images/',
}
|
8044de70c2949c0e79f74d78f8bc8a0facdd3e02 | src/parsers/index.js | src/parsers/index.js | module.exports = {
keys: ['FEEDPARSER', 'RSS_PARSER', 'FEEDME'],
RSS_PARSER: require('./rss-parser'),
FEEDPARSER: require('./feedparser'),
FEEDME: require('./feedme'),
}
| module.exports = {
keys: ['FEEDPARSER', 'RSS_PARSER'],
RSS_PARSER: require('./rss-parser'),
FEEDPARSER: require('./feedparser'),
FEEDME: require('./feedme'),
}
| Remove feedme from list of parsers | fix: Remove feedme from list of parsers
Specifiying feedme will still work, however the it will not be tried in
the loop of parsers.
| JavaScript | mit | relekang/micro-rss-parser | ---
+++
@@ -1,5 +1,5 @@
module.exports = {
- keys: ['FEEDPARSER', 'RSS_PARSER', 'FEEDME'],
+ keys: ['FEEDPARSER', 'RSS_PARSER'],
RSS_PARSER: require('./rss-parser'),
FEEDPARSER: require('./feedparser'),
FEEDME: require('./feedme'), |
ba44156fe8d5057c4b164ade61b76e0d6654d607 | app/renderer/containers/PlayerContainer.js | app/renderer/containers/PlayerContainer.js | import { connect } from 'react-redux';
import Player from '../presentational/audio-player/Player';
import { togglePlay, changeCurrentSeconds, seekToSeconds, setDuration } from './../actions/player';
export const mapStateToProps = (state) => ({
...state
});
const mapDispatchToProps = (dispatch) => ({
onPlayClick: () => dispatch(togglePlay),
onTimeUpdate: (e) => dispatch(changeCurrentSeconds(e.target.currentTime)),
onSlide: (e) => dispatch(seekToSeconds(e.target.value)),
onDurationSet: (dur) => dispatch(setDuration(dur))
});
const PlayerContainer = connect(
mapStateToProps,
mapDispatchToProps
)(Player);
export default PlayerContainer;
| import { connect } from 'react-redux';
import Player from '../presentational/audio-player/Player';
import { togglePlay, changeCurrentSeconds, seekToSeconds, setDuration, changeVolume } from './../actions/player';
export const mapStateToProps = (state) => ({
...state
});
const mapDispatchToProps = (dispatch) => ({
onPlayClick: () => dispatch(togglePlay),
onTimeUpdate: (e) => dispatch(changeCurrentSeconds(e.target.currentTime)),
onSeekerChange: (e) => dispatch(seekToSeconds(e.target.value)),
onDurationSet: (dur) => dispatch(setDuration(dur)),
onVolumeChange: (e) => dispatch(changeVolume(e.target.value / 100))
});
const PlayerContainer = connect(
mapStateToProps,
mapDispatchToProps
)(Player);
export default PlayerContainer;
| Add new action volume change | Add new action volume change
| JavaScript | mit | AbsoluteZero273/Deezic | ---
+++
@@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import Player from '../presentational/audio-player/Player';
-import { togglePlay, changeCurrentSeconds, seekToSeconds, setDuration } from './../actions/player';
+import { togglePlay, changeCurrentSeconds, seekToSeconds, setDuration, changeVolume } from './../actions/player';
export const mapStateToProps = (state) => ({
...state
@@ -9,8 +9,9 @@
const mapDispatchToProps = (dispatch) => ({
onPlayClick: () => dispatch(togglePlay),
onTimeUpdate: (e) => dispatch(changeCurrentSeconds(e.target.currentTime)),
- onSlide: (e) => dispatch(seekToSeconds(e.target.value)),
- onDurationSet: (dur) => dispatch(setDuration(dur))
+ onSeekerChange: (e) => dispatch(seekToSeconds(e.target.value)),
+ onDurationSet: (dur) => dispatch(setDuration(dur)),
+ onVolumeChange: (e) => dispatch(changeVolume(e.target.value / 100))
});
const PlayerContainer = connect( |
2d5cf2c181ba9c5f6f5cd020ad4727eb5a2a053f | vendor/assets/javascripts/scrollinity.js | vendor/assets/javascripts/scrollinity.js | $(document).ready(function(){
function load_new_items(){
sign = load_path.indexOf('?') >= 0 ? '&' : '?'
$.get(load_path + sign + 'page=' + (++page_num), function(data, e) {
if(data.length < 5) {
page_num = 0;
return false;
}
data_container.append(data);
}).complete(function() {
loading_pic.hide();
});
}
function loading_hidden(){
return !loading_pic.is(':visible');
}
function near_bottom(){
return $(window).scrollTop() > $(document).height() - $(window).height() - bottom_px_limit;
}
if($('*[data-scrollinity-path]').length > 0) {
var page_num = 1
load_path = $('*[data-scrollinity-path]').data('scrollinity-path');
loading_pic = $('*[data-scrollinity-loading-pic]');
data_container = $('#' + $('*[data-scrollinity-data-container]').data('scrollinity-data-container'));
bottom_px_limit = $('*[data-scrollinity-bottom-px-limit]').data('scrollinity-bottom-px-limit');
$(window).on('scroll', function(){
if(loading_hidden() && near_bottom()) {
if(page_num > 0) {
loading_pic.show();
load_new_items();
}
}
});
}
}); | $(document).ready(function(){
function load_new_items(){
var sign = load_path.indexOf('?') >= 0 ? '&' : '?'
$.get(load_path + sign + 'page=' + (++page_num), function(data, e) {
if(data.length < 5) {
var page_num = 0;
return false;
}
data_container.append(data);
}).complete(function() {
loading_pic.hide();
});
}
function loading_hidden(){
return !loading_pic.is(':visible');
}
function near_bottom(){
return $(window).scrollTop() > $(document).height() - $(window).height() - bottom_px_limit;
}
if($('*[data-scrollinity-path]').length > 0) {
var page_num = 1
var load_path = $('*[data-scrollinity-path]').data('scrollinity-path');
var loading_pic = $('*[data-scrollinity-loading-pic]');
var data_container = $('#' + $('*[data-scrollinity-data-container]').data('scrollinity-data-container'));
var bottom_px_limit = $('*[data-scrollinity-bottom-px-limit]').data('scrollinity-bottom-px-limit');
$(window).on('scroll', function(){
if(loading_hidden() && near_bottom()) {
if(page_num > 0) {
loading_pic.show();
load_new_items();
}
}
});
}
}); | Fix var declaration for strict mode. | Fix var declaration for strict mode. | JavaScript | mit | HeeL/scrollinity | ---
+++
@@ -1,10 +1,10 @@
$(document).ready(function(){
function load_new_items(){
- sign = load_path.indexOf('?') >= 0 ? '&' : '?'
+ var sign = load_path.indexOf('?') >= 0 ? '&' : '?'
$.get(load_path + sign + 'page=' + (++page_num), function(data, e) {
if(data.length < 5) {
- page_num = 0;
+ var page_num = 0;
return false;
}
data_container.append(data);
@@ -22,11 +22,11 @@
}
if($('*[data-scrollinity-path]').length > 0) {
- var page_num = 1
- load_path = $('*[data-scrollinity-path]').data('scrollinity-path');
- loading_pic = $('*[data-scrollinity-loading-pic]');
- data_container = $('#' + $('*[data-scrollinity-data-container]').data('scrollinity-data-container'));
- bottom_px_limit = $('*[data-scrollinity-bottom-px-limit]').data('scrollinity-bottom-px-limit');
+ var page_num = 1
+ var load_path = $('*[data-scrollinity-path]').data('scrollinity-path');
+ var loading_pic = $('*[data-scrollinity-loading-pic]');
+ var data_container = $('#' + $('*[data-scrollinity-data-container]').data('scrollinity-data-container'));
+ var bottom_px_limit = $('*[data-scrollinity-bottom-px-limit]').data('scrollinity-bottom-px-limit');
$(window).on('scroll', function(){
if(loading_hidden() && near_bottom()) { |
8e87fb8ba6599f90a4646816daf7a36ab08b6784 | addons/storyshots/src/test-bodies.js | addons/storyshots/src/test-bodies.js | import path from 'path';
import renderer from 'react-test-renderer';
import shallow from 'react-test-renderer/shallow';
import 'jest-specific-snapshot';
function getRenderedTree(story, context, options) {
const storyElement = story.render(context);
return renderer.create(storyElement, options).toJSON();
}
function getSnapshotFileName(context) {
const fileName = context.fileName;
if (!fileName) {
return null;
}
const { dir, name } = path.parse(fileName);
return path.format({ dir, name, ext: '.storyshot' });
}
export const snapshotWithOptions = options => ({ story, context }) => {
const tree = getRenderedTree(story, context, options);
expect(tree).toMatchSnapshot();
};
export const multiSnapshotWithOptions = options => ({ story, context }) => {
const tree = getRenderedTree(story, context, options);
const snapshotFileName = getSnapshotFileName(context);
if (!snapshotFileName) {
expect(tree).toMatchSnapshot();
return;
}
expect(tree).toMatchSpecificSnapshot(snapshotFileName);
};
export const snapshot = snapshotWithOptions({});
export function shallowSnapshot({ story, context }) {
const shallowRenderer = shallow.createRenderer();
const result = shallowRenderer.render(story.render(context));
expect(result).toMatchSnapshot();
}
export function renderOnly({ story, context }) {
const storyElement = story.render(context);
renderer.create(storyElement);
}
| import path from 'path';
import renderer from 'react-test-renderer';
import shallow from 'react-test-renderer/shallow';
import 'jest-specific-snapshot';
function getRenderedTree(story, context, options) {
const storyElement = story.render(context);
return renderer.create(storyElement, options).toJSON();
}
function getSnapshotFileName(context) {
const fileName = context.fileName;
if (!fileName) {
return null;
}
const { dir, name } = path.parse(fileName);
return path.format({ dir: path.join(dir, '__snapshots__'), name, ext: '.storyshot' });
}
export const snapshotWithOptions = options => ({ story, context }) => {
const tree = getRenderedTree(story, context, options);
expect(tree).toMatchSnapshot();
};
export const multiSnapshotWithOptions = options => ({ story, context }) => {
const tree = getRenderedTree(story, context, options);
const snapshotFileName = getSnapshotFileName(context);
if (!snapshotFileName) {
expect(tree).toMatchSnapshot();
return;
}
expect(tree).toMatchSpecificSnapshot(snapshotFileName);
};
export const snapshot = snapshotWithOptions({});
export function shallowSnapshot({ story, context }) {
const shallowRenderer = shallow.createRenderer();
const result = shallowRenderer.render(story.render(context));
expect(result).toMatchSnapshot();
}
export function renderOnly({ story, context }) {
const storyElement = story.render(context);
renderer.create(storyElement);
}
| CHANGE path of the snapshots files into the regular `__snapshots__` folder | CHANGE path of the snapshots files into the regular `__snapshots__` folder
| JavaScript | mit | rhalff/storybook,rhalff/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,rhalff/storybook,storybooks/storybook,rhalff/storybook,storybooks/storybook,storybooks/storybook,rhalff/storybook,storybooks/storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/react-storybook,rhalff/storybook,storybooks/react-storybook,storybooks/storybook | ---
+++
@@ -16,7 +16,7 @@
}
const { dir, name } = path.parse(fileName);
- return path.format({ dir, name, ext: '.storyshot' });
+ return path.format({ dir: path.join(dir, '__snapshots__'), name, ext: '.storyshot' });
}
export const snapshotWithOptions = options => ({ story, context }) => { |
8358bd83692c5731a4817f841845e2104526b804 | test/pull-request.js | test/pull-request.js | const assert = require('assert');
const Account = require('../Contents/Scripts/account.js').Account;
const PullRequest = require('../Contents/Scripts/pull-request.js').PullRequest;
const Repository = require('../Contents/Scripts/repository.js').Repository;
describe('PullRequest', function() {
let number = '42';
let title = 'Fix off by one bug';
let owner = new Account('obama');
let repo = new Repository(owner, 'whitehouse.gov', 'My blog.');
let pullRequest = new PullRequest(number, repo, title);
describe('#url', function() {
it('returns the URL of the pull request', function() {
assert.equal('https://github.com/obama/whitehouse.gov/pull/42', pullRequest.url);
});
});
describe('#shortURL', function() {
it('returns the short URL of the pull request', function() {
assert.equal('obama/whitehouse.gov#42', pullRequest.shortURL);
});
});
describe('#toMenuItem()', function() {
it('returns a JSON formatted menu item for LaunchBar', function() {
assert.deepEqual({
title: 'Fix off by one bug',
subtitle: 'obama/whitehouse.gov#42',
alwaysShowsSubtitle: true,
icon: 'pull-request.png',
url: 'https://github.com/obama/whitehouse.gov/pull/42',
}, pullRequest.toMenuItem());
});
});
});
| const assert = require('assert');
const Account = require('../Contents/Scripts/account.js').Account;
const PullRequest = require('../Contents/Scripts/pull-request.js').PullRequest;
const Repository = require('../Contents/Scripts/repository.js').Repository;
describe('PullRequest', function() {
let number = '42';
let title = 'Fix off by one bug';
let owner = new Account('obama');
let repo = new Repository(owner, 'whitehouse.gov', 'My blog.');
let pullRequest = new PullRequest(number, repo, title);
describe('#url', function() {
it('returns the URL of the pull request', function() {
assert.equal('https://github.com/obama/whitehouse.gov/pull/42', pullRequest.url);
});
});
describe('#shortURL', function() {
it('returns the short URL of the pull request', function() {
assert.equal('obama/whitehouse.gov#42', pullRequest.shortURL);
});
});
describe('#toMenuItem()', function() {
it('returns a JSON formatted menu item for LaunchBar', function() {
assert.deepEqual({
title: 'Fix off by one bug',
subtitle: 'obama/whitehouse.gov#42',
alwaysShowsSubtitle: true,
icon: 'pullRequestTemplate.png',
url: 'https://github.com/obama/whitehouse.gov/pull/42',
}, pullRequest.toMenuItem());
});
});
});
| Update expected icon name in tests | Update expected icon name in tests
| JavaScript | mit | bswinnerton/launchbar-github,bswinnerton/launchbar-github | ---
+++
@@ -30,7 +30,7 @@
title: 'Fix off by one bug',
subtitle: 'obama/whitehouse.gov#42',
alwaysShowsSubtitle: true,
- icon: 'pull-request.png',
+ icon: 'pullRequestTemplate.png',
url: 'https://github.com/obama/whitehouse.gov/pull/42',
}, pullRequest.toMenuItem());
}); |
ccfce1c8bba0c9b1cc9d5e66fcb046a0c5bb3fd9 | templates/_router.js | templates/_router.js | define([
'views/root',
'backbone'
], function (RootView, Backbone) {
return new (Backbone.Router.extend({
routes: {
}
}));
});
| define([
'views/root',
'backbone'
], function (RootView, Backbone) {
return Backbone.Router.extend({
routes: {
}
});
});
| Return router class, instead of instance | Return router class, instead of instance
| JavaScript | mit | FormidableLabs/generator-handlebones,walmartlabs/generator-thorax,walmartlabs/generator-thorax | ---
+++
@@ -2,9 +2,9 @@
'views/root',
'backbone'
], function (RootView, Backbone) {
- return new (Backbone.Router.extend({
+ return Backbone.Router.extend({
routes: {
}
- }));
+ });
}); |
cf7bcbdeb6890a817095392ea85127658f9082ee | vendor/assets/javascripts/active_admin_associations.js | vendor/assets/javascripts/active_admin_associations.js | //= require jquery.tokeninput
$(document).ready(function(){
$('input.token-input').tokenInput(function($input){
var modelName = $input.data("model-name");
return "/admin/autocomplete/"+modelName;
}, {
minChars: 3,
propertyToSearch: "value",
theme: "facebook",
tokenLimit: 1,
preventDuplicates: true
});
});
| //= require jquery.tokeninput
$(document).ready(function(){
function enableTokenizer() {
$('input.token-input').tokenInput(function($input){
var modelName = $input.data("model-name");
return "/admin/autocomplete/"+modelName;
}, {
minChars: 3,
propertyToSearch: "value",
theme: "facebook",
tokenLimit: 1,
preventDuplicates: true
});
}
function enablePagination() {
$('.resource-table-footer a').on('ajax:success', function(e, data, status, xhr) {
$('.relationship-table').replaceWith(data);
enablePagination();
enableTokenizer();
});
}
enablePagination();
enableTokenizer();
});
| Allow pagination on edit pages. | Allow pagination on edit pages.
| JavaScript | mit | BookBub/active_admin_associations,BookBub/active_admin_associations,BookBub/active_admin_associations | ---
+++
@@ -1,14 +1,29 @@
//= require jquery.tokeninput
$(document).ready(function(){
- $('input.token-input').tokenInput(function($input){
- var modelName = $input.data("model-name");
- return "/admin/autocomplete/"+modelName;
- }, {
- minChars: 3,
- propertyToSearch: "value",
- theme: "facebook",
- tokenLimit: 1,
- preventDuplicates: true
- });
+
+ function enableTokenizer() {
+ $('input.token-input').tokenInput(function($input){
+ var modelName = $input.data("model-name");
+ return "/admin/autocomplete/"+modelName;
+ }, {
+ minChars: 3,
+ propertyToSearch: "value",
+ theme: "facebook",
+ tokenLimit: 1,
+ preventDuplicates: true
+ });
+ }
+
+ function enablePagination() {
+ $('.resource-table-footer a').on('ajax:success', function(e, data, status, xhr) {
+ $('.relationship-table').replaceWith(data);
+ enablePagination();
+ enableTokenizer();
+ });
+ }
+
+
+ enablePagination();
+ enableTokenizer();
}); |
1a259cdf59ac11d0d93d51200c712ae68bdcde19 | index.js | index.js | var configFilePath = process.argv[2];
var config = {};
if (configFilePath) {
try {
config = require(configFilePath);
} catch(e) {
console.log('Cannot load '+configFilePath);
process.exit(1);
}
}
var utils = require('./lib')(config);
| var path = require('path');
var configFilePath = process.argv[2];
var config = {};
if (configFilePath) {
configFilePath = path.resolve(configFilePath);
try {
config = require(configFilePath);
} catch(e) {
console.log('Cannot load '+configFilePath);
process.exit(1);
}
}
var utils = require('./lib')(config);
| Resolve configuration file to absolute path before loading | Resolve configuration file to absolute path before loading
| JavaScript | mit | parse-server-modules/parse-files-utils | ---
+++
@@ -1,7 +1,10 @@
+var path = require('path');
var configFilePath = process.argv[2];
var config = {};
if (configFilePath) {
+ configFilePath = path.resolve(configFilePath);
+
try {
config = require(configFilePath);
} catch(e) { |
d6cfb91652099ad880409caab6d8ec78e6568a01 | frontend/src/components/AddTrip/index.js | frontend/src/components/AddTrip/index.js | import React from 'react';
import Button from 'react-bootstrap/Button';
import '../../styles/add-trip.css'
/**
* Component corresponding to add trips modal.
*/
const AddTrip = (props) => {
const showHideClass = props.show ? "modal-container show" :
"modal-container hide";
/**
* Creates a new Trip document, adds it to Firestore, and closes the modal.
*/
function submitNewTrip() {
// TODO(Issue #43): Create doc and add to firestore here
props.handleClose();
}
return (
<div className={showHideClass}>
<div className="surrounding-modal" onClick={props.handleClose}></div>
<div className="modal-main">
{/* TODO(Issue #43): Add trips functionality */}
<p>Enter the stuff for a new trip: ...</p>
<p>Enter the stuff for a new trip: ...</p>
<p>Enter the stuff for a new trip: ...</p>
<p>Enter the stuff for a new trip: ...</p>
<p>Enter the stuff for a new trip: ...</p>
<p>Enter the stuff for a new trip: ...</p>
<Button type='button' onClick={submitNewTrip}>
Submit New Trip
</Button>
<Button type='button' onClick={props.handleClose}>
Close
</Button>
</div>
</div>
);
};
export default AddTrip;
| import React from 'react';
import Button from 'react-bootstrap/Button';
import '../../styles/add-trip.css'
/**
* Component corresponding to add trips modal.
*/
const AddTrip = (props) => {
const showHideClass = props.show ? "modal-container show" :
"modal-container hide";
/**
* Creates a new Trip document, adds it to Firestore, and closes the modal.
*/
function submitNewTrip() {
// TODO(Issue #43): Create doc and add to firestore here
props.handleClose();
}
return (
<div className={showHideClass}>
<div className="surrounding-modal" onClick={props.handleClose}></div>
<div className="modal-main">
{/* TODO(Issue #43): Add trips functionality */}
<p>Enter the stuff for a new trip: ...</p>
<Button type='button' onClick={submitNewTrip}>
Submit New Trip
</Button>
<Button type='button' onClick={props.handleClose}>
Close
</Button>
</div>
</div>
);
};
export default AddTrip;
| Delete duplicate filler text in modal. | Delete duplicate filler text in modal.
| JavaScript | apache-2.0 | googleinterns/SLURP,googleinterns/SLURP,googleinterns/SLURP | ---
+++
@@ -26,11 +26,6 @@
<div className="modal-main">
{/* TODO(Issue #43): Add trips functionality */}
<p>Enter the stuff for a new trip: ...</p>
- <p>Enter the stuff for a new trip: ...</p>
- <p>Enter the stuff for a new trip: ...</p>
- <p>Enter the stuff for a new trip: ...</p>
- <p>Enter the stuff for a new trip: ...</p>
- <p>Enter the stuff for a new trip: ...</p>
<Button type='button' onClick={submitNewTrip}>
Submit New Trip
</Button> |
130ad593fd457f88ec390b69cd13479525ee5eba | index.js | index.js | 'use strict'
module.exports = new AsyncState()
function AsyncState () {
var tracing
var state = this
try {
tracing = require('tracing')
} catch (e) {
tracing = require('./lib/tracing_polyfill.js')
}
tracing.addAsyncListener({
'create': asyncFunctionInitialized,
'before': asyncCallbackBefore,
'error': function () {},
'after': asyncCallbackAfter
})
function asyncFunctionInitialized () {
var data = {}
for (var key in state) {
data[key] = state[key]
}
return data
}
function asyncCallbackBefore (context, data) {
for (var key in data) {
state[key] = data[key]
}
}
function asyncCallbackAfter (context, data) {
for (var key in state) {
delete state[key]
}
}
}
| 'use strict'
module.exports = new AsyncState()
function AsyncState () {
var tracing
var state = this
try {
tracing = require('tracing')
} catch (e) {
tracing = require('./lib/tracing_polyfill.js')
}
tracing.addAsyncListener({
'create': asyncFunctionInitialized,
'before': asyncCallbackBefore,
'error': function () {},
'after': asyncCallbackAfter
})
function asyncFunctionInitialized () {
// Record the state currently set on on the async-state object and return a
// snapshot of it. The returned object will later be passed as the `data`
// arg in the functions below.
var data = {}
for (var key in state) {
data[key] = state[key]
}
return data
}
function asyncCallbackBefore (context, data) {
// We just returned from the event-loop: We'll now restore the state
// previously saved by `asyncFunctionInitialized`.
for (var key in data) {
state[key] = data[key]
}
}
function asyncCallbackAfter (context, data) {
// Clear the state so that it doesn't leak between isolated async stacks.
for (var key in state) {
delete state[key]
}
}
}
| Improve code comments for undocumented API | Improve code comments for undocumented API
| JavaScript | mit | watson/async-state | ---
+++
@@ -20,6 +20,10 @@
})
function asyncFunctionInitialized () {
+ // Record the state currently set on on the async-state object and return a
+ // snapshot of it. The returned object will later be passed as the `data`
+ // arg in the functions below.
+
var data = {}
for (var key in state) {
data[key] = state[key]
@@ -28,12 +32,17 @@
}
function asyncCallbackBefore (context, data) {
+ // We just returned from the event-loop: We'll now restore the state
+ // previously saved by `asyncFunctionInitialized`.
+
for (var key in data) {
state[key] = data[key]
}
}
function asyncCallbackAfter (context, data) {
+ // Clear the state so that it doesn't leak between isolated async stacks.
+
for (var key in state) {
delete state[key]
} |
2ce35ba39d73d180a0c10a83245d231d29be676b | test/test-changes.js | test/test-changes.js | require('./common');
var
DB_NAME = 'node-couchdb-test',
callbacks = {
A: false,
B1: false,
B2: false,
C: false,
},
db = client.db(DB_NAME);
// Init fresh db
db.remove();
db
.create(function(er) {
if (er) throw er;
var stream = db.changesStream();
stream
.addListener('change', function(change) {
callbacks['B'+change.seq] = true;
if (change.seq == 2) {
stream.close();
}
})
.addListener('end', function() {
callbacks.C = true;
});
});
db.saveDoc({test: 1});
db.saveDoc({test: 2});
db.changes({since: 1}, function(er, r) {
if (er) throw er;
callbacks.A = true;
assert.equal(2, r.results[0].seq);
assert.equal(1, r.results.length);
});
process.addListener('exit', function() {
checkCallbacks(callbacks);
}); | require('./common');
var
DB_NAME = 'node-couchdb-test',
callbacks = {
A: false,
B1: false,
B2: false,
C: false,
},
db = client.db(DB_NAME);
// Init fresh db
db.remove();
db
.create(function(er) {
if (er) throw er;
var stream = db.changesStream();
stream
.addListener('data', function(change) {
callbacks['B'+change.seq] = true;
if (change.seq == 2) {
stream.close();
}
})
.addListener('end', function() {
callbacks.C = true;
});
});
db.saveDoc({test: 1});
db.saveDoc({test: 2});
db.changes({since: 1}, function(er, r) {
if (er) throw er;
callbacks.A = true;
assert.equal(2, r.results[0].seq);
assert.equal(1, r.results.length);
});
process.addListener('exit', function() {
checkCallbacks(callbacks);
}); | Update the event name in the test, too. | Update the event name in the test, too.
| JavaScript | mit | medic/node-couchdb,isaacs/node-couchdb,felixge/node-couchdb | ---
+++
@@ -20,7 +20,7 @@
var stream = db.changesStream();
stream
- .addListener('change', function(change) {
+ .addListener('data', function(change) {
callbacks['B'+change.seq] = true;
if (change.seq == 2) {
stream.close(); |
8145fb45a41f200e47aabd222fb93439168eee0c | index.js | index.js | var yaml = require('js-yaml');
module.exports = function (source) {
this.cacheable && this.cacheable();
var res = yaml.safeLoad(source);
return JSON.stringify(res, undefined, '\t');
};
| var yaml = require('js-yaml');
module.exports = function (source) {
this.cacheable && this.cacheable();
var res = yaml.safeLoad(source);
return 'module.exports = ' + JSON.stringify(res, undefined, '\t');
};
| Revert "Return JSON as string. yaml-loader should be chained with json-loader." | Revert "Return JSON as string. yaml-loader should be chained with json-loader."
This reverts commit b05cba0dc659e1c60283224cdf558bc085061db7.
| JavaScript | mit | okonet/yaml-loader | ---
+++
@@ -3,5 +3,5 @@
module.exports = function (source) {
this.cacheable && this.cacheable();
var res = yaml.safeLoad(source);
- return JSON.stringify(res, undefined, '\t');
+ return 'module.exports = ' + JSON.stringify(res, undefined, '\t');
}; |
92e3bd9cff930295d05b84b4f31ab69fd2964fb3 | index.js | index.js | 'use strict';
var exec = require('child_process').exec;
var plist = require('simple-plist');
module.exports = function(path, callback){
exec('codesign -d --entitlements :- ' + path, function(error, output){
if(error){
return callback(error);
}
callback(null, plist.parse(output));
});
};
| 'use strict';
var plist = require('simple-plist');
var os = require('os').platform();
module.exports = function(path, callback){
if(os === 'darwin') {
var exec = require('child_process').exec;
exec('codesign -d --entitlements :- ' + path, function(error, output){
if(error){
return callback(error);
}
console.log(output);
callback(null, plist.parse(output));
});
} else {
console.log('nothing');
callback(null, {});
}
};
| Check if node is running on darwin before running a darwin only command | Check if node is running on darwin before running a darwin only command
| JavaScript | mit | matiassingers/entitlements | ---
+++
@@ -1,14 +1,20 @@
'use strict';
-var exec = require('child_process').exec;
var plist = require('simple-plist');
+var os = require('os').platform();
module.exports = function(path, callback){
- exec('codesign -d --entitlements :- ' + path, function(error, output){
- if(error){
- return callback(error);
- }
-
- callback(null, plist.parse(output));
- });
+ if(os === 'darwin') {
+ var exec = require('child_process').exec;
+ exec('codesign -d --entitlements :- ' + path, function(error, output){
+ if(error){
+ return callback(error);
+ }
+ console.log(output);
+ callback(null, plist.parse(output));
+ });
+ } else {
+ console.log('nothing');
+ callback(null, {});
+ }
}; |
8ab6e6072d05867f30d0361d0a8f8ae041b4680c | index.js | index.js | var Transform = require( 'stream' ).Transform;
var MyactStreamTransform = module.exports = function( keyProperty ) {
Transform.call( this, { objectMode: true });
this.keyProperty = keyProperty;
};
MyactStreamTransform.prototype = Object.create( Transform.prototype );
MyactStreamTransform.prototype._transform = function( chunk, encoding, done ) {
this.push({
key: chunk[ this.keyProperty ],
data: chunk
});
done();
}; | var Transform = require( 'stream' ).Transform;
var MyactStreamTransform = module.exports = function( key ) {
Transform.call( this, { objectMode: true });
if ( 'undefined' === typeof key ) key = 'id';
this.keyProperty = key;
};
MyactStreamTransform.prototype = Object.create( Transform.prototype );
MyactStreamTransform.prototype._transform = function( chunk, encoding, done ) {
this.push({
key: chunk[ this.keyProperty ],
data: chunk
});
done();
}; | Use "id" as default key if none provided | Use "id" as default key if none provided
| JavaScript | mit | myact/myact-stream-transform | ---
+++
@@ -1,9 +1,10 @@
var Transform = require( 'stream' ).Transform;
-var MyactStreamTransform = module.exports = function( keyProperty ) {
+var MyactStreamTransform = module.exports = function( key ) {
Transform.call( this, { objectMode: true });
- this.keyProperty = keyProperty;
+ if ( 'undefined' === typeof key ) key = 'id';
+ this.keyProperty = key;
};
MyactStreamTransform.prototype = Object.create( Transform.prototype ); |
04926d8ed4cd2d842dfde75ba58c0ddf2175fe83 | test/utils/header.js | test/utils/header.js | const test = require("ava")
const header = require("../../lib/utils/")
const themes = require("../../lib/themes")
const pkg = require("../../package.json")
let darkThemeHeader = null
test.before(() => {
darkThemeHeader = header.header(themes[0])
})
test("license comment", t => {
t.regex(darkThemeHeader, /\/\*!/, "Header is missing the license special comment /*!")
})
test("theme name", t => {
t.regex(darkThemeHeader, /GitHub Dark/)
})
test("the current package version", t => {
t.regex(darkThemeHeader, new RegExp(pkg.version))
})
test("correct year", t => {
t.regex(darkThemeHeader, /2016/)
})
test("package author", t => {
t.regex(darkThemeHeader, new RegExp(pkg.author))
})
test("mentions the license", t => {
t.regex(darkThemeHeader, /Licensed under MIT/)
})
| const test = require("ava")
const header = require("../../lib/utils/")
const themes = require("../../lib/themes")
const pkg = require("../../package.json")
let darkThemeHeader = null
test.before(() => {
darkThemeHeader = header.header(themes[0])
})
test("license comment", t => {
t.regex(darkThemeHeader, /\/\*!/, "Header is missing the license special comment /*!")
})
test("theme name", t => {
t.regex(darkThemeHeader, /GitHub Dark/)
})
test("the current package version", t => {
t.regex(darkThemeHeader, new RegExp(pkg.version))
})
test("correct year", t => {
t.regex(darkThemeHeader, /2017/)
})
test("package author", t => {
t.regex(darkThemeHeader, new RegExp(pkg.author))
})
test("mentions the license", t => {
t.regex(darkThemeHeader, /Licensed under MIT/)
})
| Update copyright year to make tests pass | Update copyright year to make tests pass
| JavaScript | mit | primer/github-syntax-theme-generator | ---
+++
@@ -22,7 +22,7 @@
})
test("correct year", t => {
- t.regex(darkThemeHeader, /2016/)
+ t.regex(darkThemeHeader, /2017/)
})
test("package author", t => { |
835a3c665d9ab0b9f23df73bbd59368c904815f8 | index.js | index.js | 'use strict';
var EventEmitter = require('events').EventEmitter;
var inherits = require('util').inherits;
var NanoTimer = require('nanotimer');
function StepSequencer(tempo, division, sequence) {
this.tempo = tempo;
this.division = division;
this.sequence = sequence;
this.step = 0;
this.timer = new NanoTimer();
this.timeout = Math.floor((60 / (tempo * division)) * 10e8) + 'n';
EventEmitter.call(this);
}
inherits(StepSequencer, EventEmitter);
StepSequencer.prototype._advance = function () {
this.emit('' + this.step, this.sequence[this.step]);
this.step = (this.step + 1);
if (this.step === this.sequence.length) this.step = 0;
}
StepSequencer.prototype.play = function () {
var self = this;
self.step = 0;
self.timer.setInterval(function () {
self._advance.call(self);
}, '', self.timeout);
};
StepSequencer.prototype.resume = function () {
var self = this;
self.timer.setInterval(function () {
self._advance.call(self);
}, '', self.timeout);
};
StepSequencer.prototype.stop = function () {
this.timer.clearInterval();
};
module.exports = StepSequencer;
| 'use strict';
var EventEmitter = require('events').EventEmitter;
var inherits = require('util').inherits;
var NanoTimer = require('nanotimer');
function StepSequencer(tempo, division, sequence) {
this.tempo = tempo || 120;
this.division = division || 4;
this.sequence = sequence || [];
this.step = 0;
this.timer = new NanoTimer();
this.timeout = Math.floor((60 / (tempo * division)) * 10e8) + 'n';
EventEmitter.call(this);
}
inherits(StepSequencer, EventEmitter);
StepSequencer.prototype._advance = function () {
this.emit('' + this.step, this.sequence[this.step]);
this.step = (this.step + 1);
if (this.step === this.sequence.length) this.step = 0;
}
StepSequencer.prototype.play = function () {
var self = this;
self.step = 0;
self.timer.setInterval(function () {
self._advance.call(self);
}, '', self.timeout);
};
StepSequencer.prototype.resume = function () {
var self = this;
self.timer.setInterval(function () {
self._advance.call(self);
}, '', self.timeout);
};
StepSequencer.prototype.stop = function () {
this.timer.clearInterval();
};
module.exports = StepSequencer;
| Set defaults for tempo, division, sequence | Set defaults for tempo, division, sequence
| JavaScript | mit | freitagbr/step-sequencer | ---
+++
@@ -5,9 +5,9 @@
var NanoTimer = require('nanotimer');
function StepSequencer(tempo, division, sequence) {
- this.tempo = tempo;
- this.division = division;
- this.sequence = sequence;
+ this.tempo = tempo || 120;
+ this.division = division || 4;
+ this.sequence = sequence || [];
this.step = 0;
this.timer = new NanoTimer();
this.timeout = Math.floor((60 / (tempo * division)) * 10e8) + 'n'; |
bd6eb49a77eee89572b9cb08edc8e276f2b1c178 | Kwc/Statistics/OptBox/Component.js | Kwc/Statistics/OptBox/Component.js | Kwf.onElementReady('.kwcStatisticsOptBox', function(el, config) {
if (Kwf.Statistics.getDefaultOptValue() == 'out' && !Kwf.Statistics.issetUserOptValue()) {
el.slideIn('t', { duration: 2 });
}
}); | Kwf.onElementReady('.kwcStatisticsOptBox', function(el, config) {
if (Kwf.Statistics.getDefaultOptValue() == 'out' && !Kwf.Statistics.issetUserOptValue()) {
// el.slideIn('t', { easing: 'linear', duration: 1.25 });
el.show(true);
}
}); | Disable Animation on OptBox because of not so smooth movement | Disable Animation on OptBox because of not so smooth movement
| JavaScript | bsd-2-clause | Ben-Ho/koala-framework,nsams/koala-framework,nsams/koala-framework,koala-framework/koala-framework,kaufmo/koala-framework,yacon/koala-framework,yacon/koala-framework,Sogl/koala-framework,darimpulso/koala-framework,yacon/koala-framework,Ben-Ho/koala-framework,koala-framework/koala-framework,nsams/koala-framework,Sogl/koala-framework,kaufmo/koala-framework,kaufmo/koala-framework,darimpulso/koala-framework | ---
+++
@@ -1,5 +1,6 @@
Kwf.onElementReady('.kwcStatisticsOptBox', function(el, config) {
if (Kwf.Statistics.getDefaultOptValue() == 'out' && !Kwf.Statistics.issetUserOptValue()) {
- el.slideIn('t', { duration: 2 });
+// el.slideIn('t', { easing: 'linear', duration: 1.25 });
+ el.show(true);
}
}); |
4511d003dcd808d7cf066428cd22116d597715e4 | index.js | index.js | const {app, BrowserWindow, protocol} = require('electron')
require('electron-debug')({ showDevTools: true, enable: true })
var path = require('path')
var main = null
app.on('ready', function () {
main = new BrowserWindow({
height: 720,
resizable: true,
title: 'sciencefair',
width: 1050,
titleBarStyle: 'hidden',
fullscreen: false,
icon: './icon/logo.png',
show: false
})
main.setMenu(null)
main.maximize()
main.loadURL(path.join('file://', __dirname, '/app/index.html'))
// hack to avoid a blank white window showing briefly at startup
// hide the window until content is loaded
main.webContents.on('did-finish-load', () => {
setTimeout(() => main.show(), 40)
})
main.on('close', event => {
main.webContents.send('quitting')
})
main.on('closed', function () {
main = null
})
protocol.registerFileProtocol('sciencefair', (request, callback) => {
console.log(request.url)
callback()
}, error => {
if (error) console.error('Failed to register protocol')
})
})
| const {app, BrowserWindow, protocol} = require('electron')
require('electron-debug')({ showDevTools: true, enable: true })
var path = require('path')
var main = null
app.on('ready', function () {
main = new BrowserWindow({
height: 720,
resizable: true,
title: 'sciencefair',
width: 1050,
titleBarStyle: 'hidden',
fullscreen: false,
icon: './icon/logo.png',
show: false
})
main.setMenu(null)
main.maximize()
main.loadURL(path.join('file://', __dirname, '/app/index.html'))
// hack to avoid a blank white window showing briefly at startup
// hide the window until content is loaded
main.webContents.on('did-finish-load', () => {
setTimeout(() => main.show(), 40)
})
main.on('close', event => {
main.webContents.send('quitting')
})
main.on('closed', function () {
main = null
})
protocol.registerFileProtocol('sciencefair', (request, callback) => {
console.log(request.url)
callback()
}, error => {
if (error) console.error('Failed to register protocol')
})
})
app.on('window-all-closed', () => app.quit())
| Quit app on window close | Quit app on window close
| JavaScript | mit | codeforscience/sciencefair,codeforscience/sciencefair,greggraf/sciencefair,codeforscience/sciencefair,greggraf/sciencefair,greggraf/sciencefair | ---
+++
@@ -45,3 +45,5 @@
if (error) console.error('Failed to register protocol')
})
})
+
+app.on('window-all-closed', () => app.quit()) |
0c50ab262801f30034834712c65fb0a437d83a62 | tests/test_helper.js | tests/test_helper.js | document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
Ember.testing = true;
var App = requireModule('appkit/app');
App.rootElement = '#ember-testing';
App.setupForTesting();
App.injectTestHelpers();
function exists(selector) {
return !!find(selector).length;
}
window.exists = exists;
Ember.Container.prototype.stub = function(fullName, instance) {
instance.destroy = instance.destroy || function() {};
this.cache.dict[fullName] = instance;
};
| document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
Ember.testing = true;
var App = requireModule('appkit/app');
App.rootElement = '#ember-testing';
App.setupForTesting();
App.injectTestHelpers();
function exists(selector) {
return !!find(selector).length;
}
function equal(actual, expected, message) {
message = message || QUnit.jsDump.parse(expected) + " expected but was " + QUnit.jsDump.parse(actual);
QUnit.equal.call(this, expected, actual, message);
}
window.exists = exists;
window.equal = equal;
Ember.Container.prototype.stub = function(fullName, instance) {
instance.destroy = instance.destroy || function() {};
this.cache.dict[fullName] = instance;
};
| Fix QUnit output for equal assertions | Fix QUnit output for equal assertions
Display a friendlier message than 'undefined' when an equal assertion fails. | JavaScript | mit | arjand/weddingapp,ghempton/ember-libs-example,aboveproperty/ember-app-kit-karma,ClockworkNet/ember-boilerplate,shin1ohno/EmberAppKit,cevn/tasky-web,grese/miner-app-OLD,stefanpenner/ember-app-kit,ebryn/ember-github-issues,jwlms/ember-weather-legacy,mharris717/eak_base_app,teddyzeenny/assistant,grese/miner-app-OLD,Anshdesire/ember-app-kit,achambers/appkit-hanging-test-example,duvillierA/try_ember,Anshdesire/ember-app-kit,lucaspottersky/ember-lab-eak,digitalplaywright/eak-simple-auth-blog-client,trombom/ember-weather-traininig,tobobo/vice-frontend,tobobo/thyme-frontend,stefanpenner/ember-app-kit,kiwiupover/seattle-auckland-weather,michaelorionmcmanus/eak-bootstrap,kiwiupover/ember-weather,tomclose/minimal_eak_test_stub_problem,mtian/ember-app-kit-azure,ClockworkNet/ember-boilerplate,thaume/emberjs-es6-modules,mtian/ember-app-kit-azure,digitalplaywright/eak-simple-auth,kiwiupover/ember-weather,sajt/ember-weather,grese/btcArbitrage,tobobo/thyme-frontend,sajt/ember-weather,eriktrom/ember-weather-traininig,tobobo/shibe_io_frontend,joliss/broccoli-todo,tomclose/test_loading_problem,shin1ohno/want-js,mixonic/ember-app-kit,lucaspottersky/ember-lab-eak,tucsonlabs/ember-weather-legacy,daevid/broccoli-todo | ---
+++
@@ -12,7 +12,13 @@
return !!find(selector).length;
}
+function equal(actual, expected, message) {
+ message = message || QUnit.jsDump.parse(expected) + " expected but was " + QUnit.jsDump.parse(actual);
+ QUnit.equal.call(this, expected, actual, message);
+}
+
window.exists = exists;
+window.equal = equal;
Ember.Container.prototype.stub = function(fullName, instance) {
instance.destroy = instance.destroy || function() {}; |
e22f74c0351322c6a3036f7d62b7eac50e6baad7 | index.js | index.js | var GLOBAL_DAILY_LIMIT = 50000;
var GLOBAL_HOURLY_LIMIT = 10000;
var USER_DAILY_LIMIT = 500;
var USER_HOURLY_LIMIT = 3;
var RateLimiter = require('./ratelimiter');
| var GLOBAL_DAILY_LIMIT = 50000;
var GLOBAL_HOURLY_LIMIT = 10000;
var USER_DAILY_LIMIT = 500;
var USER_HOURLY_LIMIT = 3;
var RateLimiter = require('./ratelimiter');
var rl = new RateLimiter("fitbit", GLOBAL_DAILY_LIMIT, GLOBAL_HOURLY_LIMIT, USER_DAILY_LIMIT, USER_HOURLY_LIMIT);
var blocked = function(limits) {
// Add the request to retry scheduler or something
console.log("LIMIT REACHED! Type: " + limits);
};
var allowed = function(uid) {
// Let the request go through
console.log("REQUEST ALLOWED for user: " + uid);
};
rl.call('123456', allowed, blocked);
| Add callbacks for allow and block functions with a test call | Add callbacks for allow and block functions with a test call
| JavaScript | mit | emiraydin/ratelimiter | ---
+++
@@ -5,3 +5,16 @@
var RateLimiter = require('./ratelimiter');
+var rl = new RateLimiter("fitbit", GLOBAL_DAILY_LIMIT, GLOBAL_HOURLY_LIMIT, USER_DAILY_LIMIT, USER_HOURLY_LIMIT);
+
+var blocked = function(limits) {
+ // Add the request to retry scheduler or something
+ console.log("LIMIT REACHED! Type: " + limits);
+};
+
+var allowed = function(uid) {
+ // Let the request go through
+ console.log("REQUEST ALLOWED for user: " + uid);
+};
+
+rl.call('123456', allowed, blocked); |
1c80c173a8e651d9a4426787ca7e499eb14a65e0 | example/index.js | example/index.js | var lib = require('phosphide/index');
lib.listPlugins().then((plugins) => {
console.log(plugins);
lib.loadPlugin('foo').then(() => {
console.log('foo finished loading');
lib.loadPlugin('bar').then(() => {
console.log('bar finished loading');
lib.unloadPlugin('bar');
lib.unloadPlugin('foo');
});
});
});
| var lib = require('phosphide/index');
lib.listPlugins().then((plugins) => {
console.log(plugins);
lib.loadPlugin('foo').then(() => {
console.log('foo finished loading');
lib.loadPlugin('bar').then(() => {
console.log('bar finished loading');
lib.unloadPlugin('bar');
lib.unloadPlugin('foo');
console.log('all plugins unloaded');
});
});
});
| Add another log statement to example | Add another log statement to example
| JavaScript | bsd-3-clause | blink1073/phosphor-plugins,blink1073/phosphor-plugins,blink1073/phosphor-plugins | ---
+++
@@ -9,6 +9,7 @@
console.log('bar finished loading');
lib.unloadPlugin('bar');
lib.unloadPlugin('foo');
+ console.log('all plugins unloaded');
});
});
}); |
5844ddc45b725140edd858ed276b92a337f6b5ea | index.js | index.js | const Gitter = require('./gitter');
const Lexicon = require('./lexicon');
const client = new Gitter();
function listenAndReply(roomId) {
client.readChatMessages(roomId, (message) => {
if (message.operation === 'create') {
if (message.model.fromUser.id === process.env.GITTER_LEXICON_USER_ID) return;
let prefix = '';
if (roomId === process.env.GITTER_ESOUI_ROOM_ID) {
if (!/^@?lex(icon)?/.test(message.model.text)) return;
prefix += `@${message.model.fromUser.username} `;
}
Lexicon.parse(message.model.text, (text) => {
client.sendChatMessage(roomId, `${prefix}${text}`);
});
}
});
}
const rooms = [];
client.watchRoomUpdates(process.env.GITTER_LEXICON_USER_ID, (message) => {
const roomId = message.model.id;
if (message.operation === 'create' || message.operation === 'patch') {
if (message.operation === 'create') {
Lexicon.parse('', (text) => {
client.sendChatMessage(roomId, text);
});
}
if (rooms.indexOf(roomId) < 0) {
listenAndReply(roomId);
rooms.push(roomId);
}
}
});
listenAndReply(process.env.GITTER_ESOUI_ROOM_ID);
| const Gitter = require('./gitter');
const Lexicon = require('./lexicon');
const client = new Gitter();
function listenAndReply(roomId) {
client.readChatMessages(roomId, (data) => {
if (data.operation === 'create') {
if (data.model.fromUser.id === process.env.GITTER_LEXICON_USER_ID) return;
let prefix = '';
let message = data.model.text;
if (roomId === process.env.GITTER_ESOUI_ROOM_ID) {
const match = message.match(/^@?lex(icon)?(\s(.+)|$)/);
if (!match) return;
prefix += `@${data.model.fromUser.username} `;
message = match[3];
}
Lexicon.parse(message, (text) => {
client.sendChatMessage(roomId, `${prefix}${text}`);
});
}
});
}
const rooms = [];
client.watchRoomUpdates(process.env.GITTER_LEXICON_USER_ID, (message) => {
const roomId = message.model.id;
if (message.operation === 'create' || message.operation === 'patch') {
if (message.operation === 'create') {
Lexicon.parse('', (text) => {
client.sendChatMessage(roomId, text);
});
}
if (rooms.indexOf(roomId) < 0) {
listenAndReply(roomId);
rooms.push(roomId);
}
}
});
listenAndReply(process.env.GITTER_ESOUI_ROOM_ID);
| Fix bot trying to parse message with lexicon prefix | Fix bot trying to parse message with lexicon prefix
| JavaScript | mit | esoui/lexicon,esoui/lexicon | ---
+++
@@ -4,18 +4,21 @@
const client = new Gitter();
function listenAndReply(roomId) {
- client.readChatMessages(roomId, (message) => {
- if (message.operation === 'create') {
- if (message.model.fromUser.id === process.env.GITTER_LEXICON_USER_ID) return;
+ client.readChatMessages(roomId, (data) => {
+ if (data.operation === 'create') {
+ if (data.model.fromUser.id === process.env.GITTER_LEXICON_USER_ID) return;
let prefix = '';
+ let message = data.model.text;
if (roomId === process.env.GITTER_ESOUI_ROOM_ID) {
- if (!/^@?lex(icon)?/.test(message.model.text)) return;
- prefix += `@${message.model.fromUser.username} `;
+ const match = message.match(/^@?lex(icon)?(\s(.+)|$)/);
+ if (!match) return;
+ prefix += `@${data.model.fromUser.username} `;
+ message = match[3];
}
- Lexicon.parse(message.model.text, (text) => {
+ Lexicon.parse(message, (text) => {
client.sendChatMessage(roomId, `${prefix}${text}`);
});
} |
d9617855bd112b523333c1c4cdfb8e725f52b1e9 | index.js | index.js | export * from './lib/index.js'
| /**
* @typedef {import('./lib/index.js').StringifyEntitiesLightOptions} StringifyEntitiesLightOptions
* @typedef {import('./lib/index.js').StringifyEntitiesOptions} StringifyEntitiesOptions
*/
export * from './lib/index.js'
| Add options to exported types | Add options to exported types
| JavaScript | mit | wooorm/stringify-entities | ---
+++
@@ -1 +1,6 @@
+/**
+ * @typedef {import('./lib/index.js').StringifyEntitiesLightOptions} StringifyEntitiesLightOptions
+ * @typedef {import('./lib/index.js').StringifyEntitiesOptions} StringifyEntitiesOptions
+ */
+
export * from './lib/index.js' |
b767f184caf17277501f13b063cbc26c1378068e | generators/app/templates/skill/states.js | generators/app/templates/skill/states.js | 'use strict';
exports.register = function register(skill) {
skill.onIntent('LaunchIntent', () => ({ reply: 'Intent.Launch', to: 'entry' }));
skill.onIntent('AMAZON.HelpIntent', () => ({ reply: 'Intent.Help', to: 'die' }));
};
| 'use strict';
const Reply = require('voxa').Reply;
exports.register = function register(skill) {
// This event is triggered after new session has started
skill.onSessionStarted((alexaEvent) => {});
// This event is triggered before the current session has ended
skill.onSessionEnded((alexaEvent) => {});
// This can be used to plug new information in the request
skill.onRequestStated((alexaEvent) => {});
// This handler will catch all errors generated when trying to make transitions in the stateMachine, this could include errors in the state machine controllers
skill.onStateMachineError((alexaEvent, reply, error) =>
// it gets the current reply, which could be incomplete due to an error.
new Reply(alexaEvent, { tell: 'An error in the controllers code' }).write(),
);
// This is the more general handler and will catch all unhandled errors in the framework
skill.onError((alexaEvent, error) =>
new Reply(alexaEvent, { tell: 'An unrecoverable error occurred.' }).write(),
);
// This event is triggered before every time the user response to an Alexa event...
// and it have two parameters, alexaEvent and the reply controller.
skill.onBeforeReplySent((alexaEvent, reply) => { });
// Launch intent example
skill.onIntent('LaunchIntent', () => ({ reply: 'Intent.Launch', to: 'entry' }));
// AMAMAZON Build-in Help Intent example
skill.onIntent('AMAZON.HelpIntent', () => ({ reply: 'Intent.Help', to: 'die' }));
};
| Use onSessionHandlers, also onError, onStateMachineError and onBeforeReplySent | Use onSessionHandlers, also onError, onStateMachineError and onBeforeReplySent
| JavaScript | mit | mediarain/generator-voxa-skill | ---
+++
@@ -1,6 +1,31 @@
'use strict';
+const Reply = require('voxa').Reply;
+
exports.register = function register(skill) {
+ // This event is triggered after new session has started
+ skill.onSessionStarted((alexaEvent) => {});
+ // This event is triggered before the current session has ended
+ skill.onSessionEnded((alexaEvent) => {});
+ // This can be used to plug new information in the request
+ skill.onRequestStated((alexaEvent) => {});
+
+ // This handler will catch all errors generated when trying to make transitions in the stateMachine, this could include errors in the state machine controllers
+ skill.onStateMachineError((alexaEvent, reply, error) =>
+ // it gets the current reply, which could be incomplete due to an error.
+ new Reply(alexaEvent, { tell: 'An error in the controllers code' }).write(),
+ );
+
+ // This is the more general handler and will catch all unhandled errors in the framework
+ skill.onError((alexaEvent, error) =>
+ new Reply(alexaEvent, { tell: 'An unrecoverable error occurred.' }).write(),
+ );
+
+ // This event is triggered before every time the user response to an Alexa event...
+ // and it have two parameters, alexaEvent and the reply controller.
+ skill.onBeforeReplySent((alexaEvent, reply) => { });
+ // Launch intent example
skill.onIntent('LaunchIntent', () => ({ reply: 'Intent.Launch', to: 'entry' }));
+ // AMAMAZON Build-in Help Intent example
skill.onIntent('AMAZON.HelpIntent', () => ({ reply: 'Intent.Help', to: 'die' }));
}; |
1f7058de156dd4b6997a88b43f8c909950cba2bf | client/src/components/Breadcrumbs.js | client/src/components/Breadcrumbs.js | import React from 'react'
import {Breadcrumb} from 'react-bootstrap'
import {IndexLinkContainer as Link} from 'react-router-bootstrap'
export default class Breadcrumbs extends React.Component {
makeItem(item) {
return (
<Link key={item[0]} to={item[1]}>
<Breadcrumb.Item>{item[0]}</Breadcrumb.Item>
</Link>
)
}
render() {
let {items, ...props} = this.props
return (
<Breadcrumb {...props}>
{this.makeItem(['ANET', '/'])}
{items.map(this.makeItem)}
</Breadcrumb>
)
}
}
Breadcrumbs.defaultProps = {items: []}
| import React from 'react'
import {Breadcrumb} from 'react-bootstrap'
import {IndexLinkContainer as Link} from 'react-router-bootstrap'
export default class Breadcrumbs extends React.Component {
makeItem(item) {
return (
<Link key={item[1]} to={item[1]}>
<Breadcrumb.Item>{item[0]}</Breadcrumb.Item>
</Link>
)
}
render() {
let {items, ...props} = this.props
return (
<Breadcrumb {...props}>
{this.makeItem(['ANET', '/'])}
{items.map(this.makeItem)}
</Breadcrumb>
)
}
}
Breadcrumbs.defaultProps = {items: []}
| Use URL as unique key for breadcrumb items | Use URL as unique key for breadcrumb items
| JavaScript | mit | NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet | ---
+++
@@ -5,7 +5,7 @@
export default class Breadcrumbs extends React.Component {
makeItem(item) {
return (
- <Link key={item[0]} to={item[1]}>
+ <Link key={item[1]} to={item[1]}>
<Breadcrumb.Item>{item[0]}</Breadcrumb.Item>
</Link>
) |
683d10ab341a3b6a6767557f0496fb1e0e2f8cff | bluebottle/slides/static/js/bluebottle/slides/models.js | bluebottle/slides/static/js/bluebottle/slides/models.js | App.Slide = DS.Model.extend({
url: 'banners',
title: DS.attr('string'),
body: DS.attr('string'),
image: DS.attr('string'),
imageBackground: DS.attr('string'),
video: DS.attr('string'),
language: DS.attr('string'),
sequence: DS.attr('number'),
style: DS.attr('string'),
tab_text: DS.attr('string'),
link_text: DS.attr('string'),
link_url: DS.attr('string'),
isFirst: function() {
var lowestValue = null;
App.Slide.find().forEach(function(slide) {
var sequence = slide.get("sequence");
if(lowestValue == null || sequence < lowestValue)
lowestValue = sequence;
});
return (this.get('sequence') === lowestValue);
}.property('@each.sequence')
});
| App.Slide = DS.Model.extend({
url: 'banners',
title: DS.attr('string'),
body: DS.attr('string'),
image: DS.attr('string'),
imageBackground: DS.attr('string'),
video: DS.attr('string'),
language: DS.attr('string'),
sequence: DS.attr('number'),
style: DS.attr('string'),
tab_text: DS.attr('string'),
link_text: DS.attr('string'),
link_url: DS.attr('string'),
isFirst: function() {
return (this.get('sequence') == 1);
}.property('sequence')
});
| Simplify how to determine if it's first slide | Simplify how to determine if it's first slide
| JavaScript | bsd-3-clause | onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -15,12 +15,6 @@
link_text: DS.attr('string'),
link_url: DS.attr('string'),
isFirst: function() {
- var lowestValue = null;
- App.Slide.find().forEach(function(slide) {
- var sequence = slide.get("sequence");
- if(lowestValue == null || sequence < lowestValue)
- lowestValue = sequence;
- });
- return (this.get('sequence') === lowestValue);
- }.property('@each.sequence')
+ return (this.get('sequence') == 1);
+ }.property('sequence')
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.