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 |
|---|---|---|---|---|---|---|---|---|---|---|
301bb85927c6a8829766ec2d3deeac70443aab4e | index.js | index.js | exports.fixed = function(x, y, ratio) {
var orient = ratio.split('!')[1];
var ratio = ratio.split('!')[0].split(':').sort();
var vertical = y > x;
var rotate = y > x && orient === 'h' || x > y && orient === 'v';
if ((vertical || rotate) && !(vertical && rotate)) {
x = x + y;
y = x - y;
x = x - y;
}
var xʹ = x;
var yʹ = x * (ratio[1] / ratio[0]);
if (yʹ > y || rotate && yʹ > x) {
yʹ = y;
xʹ = y * (ratio[1] / ratio[0]);
if (xʹ > x) {
xʹ = x;
yʹ = x * (ratio[0] / ratio[1]);
}
}
var Δx = Math.floor((x - xʹ) / 2);
var Δy = Math.floor((y - yʹ) / 2);
if ((vertical || rotate) && !(vertical && rotate)) {
return [
Δy, // crop top left x
Δx, // crop top left y
y - Δy * 2, // crop width
x - Δx * 2 // crop height
];
} else {
return [
Δx, // crop top left x
Δy, // crop top left y
x - Δx * 2, // crop width
y - Δy * 2 // crop height
];
}
};
| exports.fixed = function(x, y, r) {
var orient = r.split('!')[1];
var ratio = r.split('!')[0].split(':').sort();
var vertical = y > x;
var rotate = y > x && orient === 'h' || x > y && orient === 'v';
if ((vertical || rotate) && !(vertical && rotate)) {
x = x + y;
y = x - y;
x = x - y;
}
var xʹ = x;
var yʹ = x * (ratio[1] / ratio[0]);
if (yʹ > y || rotate && yʹ > x) {
yʹ = y;
xʹ = y * (ratio[1] / ratio[0]);
if (xʹ > x) {
xʹ = x;
yʹ = x * (ratio[0] / ratio[1]);
}
}
var Δx = Math.floor((x - xʹ) / 2);
var Δy = Math.floor((y - yʹ) / 2);
if ((vertical || rotate) && !(vertical && rotate)) {
return [
Δy, // crop top left x
Δx, // crop top left y
y - Δy * 2, // crop width
x - Δx * 2 // crop height
];
} else {
return [
Δx, // crop top left x
Δy, // crop top left y
x - Δx * 2, // crop width
y - Δy * 2 // crop height
];
}
};
| Fix variable already defined JSHint error | Fix variable already defined JSHint error
| JavaScript | mit | Turistforeningen/node-aspectratio | ---
+++
@@ -1,6 +1,6 @@
-exports.fixed = function(x, y, ratio) {
- var orient = ratio.split('!')[1];
- var ratio = ratio.split('!')[0].split(':').sort();
+exports.fixed = function(x, y, r) {
+ var orient = r.split('!')[1];
+ var ratio = r.split('!')[0].split(':').sort();
var vertical = y > x;
var rotate = y > x && orient === 'h' || x > y && orient === 'v'; |
4cfc3fde1df540f3f2369b7b6f360364515dfb05 | index.js | index.js | 'use strict'
var isPresent = require('is-present')
var githubRepos = require('github-repositories')
var Promise = require('pinkie-promise')
var reposToIgnore = [
'tachyons',
'tachyons-cli',
'tachyons-docs',
'tachyons-cms',
'tachyons-modules',
'tachyons-css.github.io',
'tachyons-sass',
'tachyons-styles',
'tachyons-queries',
'tachyons-webpack'
]
module.exports = function tachyonsModules () {
return githubRepos('tachyons-css').then(function (repos) {
if (isPresent(repos)) {
return repos.filter(isCssModule)
} else {
return Promise.reject(new Error('No results found for tachyons-css'))
}
})
}
function isCssModule (repo) {
return reposToIgnore.indexOf(repo.name) === -1
}
| 'use strict'
var isPresent = require('is-present')
var githubRepos = require('github-repositories')
var Promise = require('pinkie-promise')
var reposToIgnore = [
'tachyons',
'tachyons-cli',
'tachyons-docs',
'tachyons-cms',
'tachyons-modules',
'tachyons-css.github.io',
'tachyons-sass',
'tachyons-styles',
'tachyons-queries',
'tachyons-z-index',
'tachyons-webpack'
]
module.exports = function tachyonsModules () {
return githubRepos('tachyons-css').then(function (repos) {
if (isPresent(repos)) {
return repos.filter(isCssModule)
} else {
return Promise.reject(new Error('No results found for tachyons-css'))
}
})
}
function isCssModule (repo) {
return reposToIgnore.indexOf(repo.name) === -1
}
| Update listed modules to ignore | Update listed modules to ignore
| JavaScript | mit | tachyons-css/tachyons-modules | ---
+++
@@ -14,6 +14,7 @@
'tachyons-sass',
'tachyons-styles',
'tachyons-queries',
+ 'tachyons-z-index',
'tachyons-webpack'
]
|
8a399ced8e4e39f0fbb9adad5cd560ff16f3e85d | scripts/patch-project-json.js | scripts/patch-project-json.js | var jsonfile = require('jsonfile');
// Read in the file to be patched
var file = process.argv[2]; // e.g. '../src/MyProject/project.json'
if (!file)
console.log("No filename provided");
console.log("File: " + file);
// Read in the build version (this is provided by the CI server)
var version = process.argv[3]; // e.g. '1.0.0-master-10'
var tag = process.argv[4]; // e.g. '', or '1.0.0-rc1'
if (!version)
console.log("No version provided");
var lastDash = version.lastIndexOf("-");
var buildNumber = version.substring(lastDash + 1, version.length);
var num = "00000000" + parseInt(buildNumber);
buildNumber = num.substr(num.length-5);
if (tag) {
// Turn version into tag + '-' + buildnumber
version = tag + '-' + buildNumber;
} else {
version = version.substring(0, lastDash) + '-' + buildNumber;
}
jsonfile.readFile(file, function (err, project) {
console.log("Version: " + version);
// Patch the project.version
project.version = version;
jsonfile.writeFile(file, project, {spaces: 2}, function(err) {
if (err)
console.error(err);
});
})
| var jsonfile = require('jsonfile');
// Read in the file to be patched
var file = process.argv[2]; // e.g. '../src/MyProject/project.json'
if (!file)
console.log("No filename provided");
console.log("File: " + file);
// Read in the build version (this is provided by the CI server)
var version = process.argv[3]; // e.g. '1.0.0-master-10'
var tag = process.argv[4]; // e.g. '', or '1.0.0-rc1'
if (!version)
console.log("No version provided");
var lastDash = version.lastIndexOf("-");
var buildNumber = version.substring(lastDash + 1, version.length);
var num = "00000000" + parseInt(buildNumber);
buildNumber = num.substr(num.length-5);
if (tag) {
// Turn version into tag
version = tag;
} else {
version = version.substring(0, lastDash) + '-' + buildNumber;
}
jsonfile.readFile(file, function (err, project) {
console.log("Version: " + version);
// Patch the project.version
project.version = version;
jsonfile.writeFile(file, project, {spaces: 2}, function(err) {
if (err)
console.error(err);
});
})
| Remove buildnumber from version when tag | Remove buildnumber from version when tag
| JavaScript | apache-2.0 | SteelToeOSS/Discovery,SteelToeOSS/Discovery,SteelToeOSS/Discovery | ---
+++
@@ -19,8 +19,8 @@
buildNumber = num.substr(num.length-5);
if (tag) {
- // Turn version into tag + '-' + buildnumber
- version = tag + '-' + buildNumber;
+ // Turn version into tag
+ version = tag;
} else {
version = version.substring(0, lastDash) + '-' + buildNumber;
} |
43bf3700d21f37e36b787f0bfefd331399e24e2f | imgur.js | imgur.js | var http = require("https");
var querystring = require("querystring");
var ImgurProto = {
gallery: function(params, callback) {
var qs = querystring.stringify(params);
var options = {
hostname: "api.imgur.com",
path: ["/3/gallery.json", qs].join("?"),
headers: {
"Authorization": ["Client-ID", this.clientId].join(" "),
"Content-Type": "application/json"
}
};
http.get(options, function(res) {
var body = "";
res.on("data", function(chunk) {
body += chunk;
});
res.on("end", function() {
try {
var payload = JSON.parse(body);
if (payload.success) {
callback(null, payload.data || []);
} else {
callback(payload.data.error);
}
} catch (error) {
callback(error);
}
});
}).on("error", function(error) {
callback(error);
});
}
};
module.exports = function(clientId) {
return Object.create(ImgurProto, {
clientId: {
writable: false,
configurable: false,
enumerable: false,
value: clientId
}
});
};
| var http = require("https");
var querystring = require("querystring");
var ImgurProto = {
gallery: function(params, callback) {
var qs = querystring.stringify(params);
var options = {
hostname: "api.imgur.com",
path: ["/3/gallery.json", qs].join("?"),
headers: {
"Authorization": ["Client-ID", this.clientId].join(" "),
"Content-Type": "application/json"
}
};
http.get(options, function(res) {
var body = "";
res.on("data", function(chunk) {
body += chunk;
});
res.on("end", function() {
try {
var payload = JSON.parse(body);
if (payload.success) {
callback(null, payload.data || []);
} else {
callback(payload.data.error);
}
} catch (error) {
callback(error);
}
});
}).on("error", function(error) {
callback(error);
});
}
};
module.exports = function(clientId) {
if (!clientId) {
throw "You must provide an Imgur Client-ID";
}
return Object.create(ImgurProto, {
clientId: {
writable: false,
configurable: false,
enumerable: false,
value: clientId
}
});
};
| Throw an error if no Client-ID is given | Throw an error if no Client-ID is given
| JavaScript | mit | evilmarty/imgur-rss,evilmarty/imgur-rss | ---
+++
@@ -39,6 +39,10 @@
};
module.exports = function(clientId) {
+ if (!clientId) {
+ throw "You must provide an Imgur Client-ID";
+ }
+
return Object.create(ImgurProto, {
clientId: {
writable: false, |
b91a2d062e41eb2c8710467603f25dac14279495 | index.js | index.js | #!/usr/bin/env/node
var cheerio = require('cheerio'),
fs = require('fs'),
md = require('marked'),
mkdirp = require('mkdirp'),
path = require('path');
function slurp(fpath) {
return fs.readFileSync(fpath, {encoding: 'utf8'});
}
function spit(fpath, contents) {
fs.writeFileSync(fpath, contents);
}
function readPost(fpath) {
var markdown = slurp('posts/' + fpath);
return {
name: path.basename(fpath, ".md"),
markdown: markdown,
html: md(markdown)
};
}
function renderPost($, post) {
$('body').html(post.html);
return $.html();
}
function main() {
console.log('Rendering static site...\n');
var template = cheerio.load(slurp('template.html'));
var posts = fs.readdirSync('posts').map(readPost);
for (var i in posts) {
var post = posts[i];
var inPath = 'posts/' + post.name + '.md';
var outPath = 'site/' + post.name + '/index.html';
console.log(' ' + inPath + ' → ' + outPath);
mkdirp.sync(path.dirname(outPath));
spit(outPath, renderPost(template, post));
}
console.log('\nRendering complete.');
}
main();
| #!/usr/bin/env/node
var cheerio = require('cheerio'),
fm = require('front-matter'),
fs = require('fs'),
md = require('marked'),
mkdirp = require('mkdirp'),
path = require('path');
function slurp(fpath) {
return fs.readFileSync(fpath, {encoding: 'utf8'});
}
function spit(fpath, contents) {
fs.writeFileSync(fpath, contents);
}
function readPost(fpath) {
var content = fm(slurp('posts/' + fpath));
return {
name: path.basename(fpath, '.md'),
attrs: content.attributes,
markdown: content.body,
html: md(content.body)
};
}
function renderPost($, post) {
$('body').html(post.html);
return $.html();
}
function main() {
console.log('Rendering static site...\n');
var template = cheerio.load(slurp('template.html'));
var posts = fs.readdirSync('posts').map(readPost);
for (var i in posts) {
var post = posts[i];
var inPath = 'posts/' + post.name + '.md';
var outPath = 'site/' + post.name + '/index.html';
console.log(' ' + inPath + ' → ' + outPath);
mkdirp.sync(path.dirname(outPath));
spit(outPath, renderPost(template, post));
}
console.log('\nRendering complete.');
}
main();
| Use front-matter to parse YAML front matter from posts | Use front-matter to parse YAML front matter from posts
| JavaScript | mit | mkremins/stasis | ---
+++
@@ -1,6 +1,7 @@
#!/usr/bin/env/node
var cheerio = require('cheerio'),
+ fm = require('front-matter'),
fs = require('fs'),
md = require('marked'),
mkdirp = require('mkdirp'),
@@ -15,11 +16,12 @@
}
function readPost(fpath) {
- var markdown = slurp('posts/' + fpath);
+ var content = fm(slurp('posts/' + fpath));
return {
- name: path.basename(fpath, ".md"),
- markdown: markdown,
- html: md(markdown)
+ name: path.basename(fpath, '.md'),
+ attrs: content.attributes,
+ markdown: content.body,
+ html: md(content.body)
};
}
|
7d7b852e1e9e8c3f13066db58391dc15bff77d29 | index.js | index.js | 'use strict';
module.exports = function (str, opts) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
opts = opts || {};
return str + ' & ' + (opts.postfix || 'rainbows');
};
| 'use strict';
module.exports = function (input, opts) {
var clc = require('cli-color');
var expense_object = {
reason: input[2],
category: opts.c,
credit: '',
debit: ''
};
if (input[0] === 'credit' || input[0] === 'debit') {
if (input.length < 3 || typeof input[1] !== 'number') {
console.log(clc.red('Given input not enough cannot be parsed.'));
console.log('Use commands of the form: ' + clc.green('wallet debit 10 "Coffee"'));
process.exit(1);
}
}
switch (input[0]) {
case 'debit':
expense_object.debit = input[1];
require('./file-module.js').writeExpense(expense_object);
break;
case 'credit':
expense_object.credit = input[1];
require('./file-module.js').writeExpense(expense_object);
break;
case 'stats':
break;
case 'balance':
break;
case 'export':
require('./export-module.js')();
break;
default:
console.log(clc.red('Not a valid option!'));
process.exit(1);
}
};
| Prepare the entry script with appropriate switch-case | Prepare the entry script with appropriate switch-case
- Check the number and type of arguments before writing an expense.
Signed-off-by: Siddharth Kannan <805f056820c7a1cecc4ab591b8a0a604b501a0b7@gmail.com> | JavaScript | mit | icyflame/terminal-wallet,icyflame/terminal-wallet | ---
+++
@@ -1,10 +1,40 @@
'use strict';
-module.exports = function (str, opts) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
+module.exports = function (input, opts) {
+ var clc = require('cli-color');
+
+ var expense_object = {
+ reason: input[2],
+ category: opts.c,
+ credit: '',
+ debit: ''
+ };
+
+ if (input[0] === 'credit' || input[0] === 'debit') {
+ if (input.length < 3 || typeof input[1] !== 'number') {
+ console.log(clc.red('Given input not enough cannot be parsed.'));
+ console.log('Use commands of the form: ' + clc.green('wallet debit 10 "Coffee"'));
+ process.exit(1);
+ }
}
- opts = opts || {};
-
- return str + ' & ' + (opts.postfix || 'rainbows');
+ switch (input[0]) {
+ case 'debit':
+ expense_object.debit = input[1];
+ require('./file-module.js').writeExpense(expense_object);
+ break;
+ case 'credit':
+ expense_object.credit = input[1];
+ require('./file-module.js').writeExpense(expense_object);
+ break;
+ case 'stats':
+ break;
+ case 'balance':
+ break;
+ case 'export':
+ require('./export-module.js')();
+ break;
+ default:
+ console.log(clc.red('Not a valid option!'));
+ process.exit(1);
+ }
}; |
457968ce2fb77e9e626ad0a85ec75151a08a31e8 | index.js | index.js | var _param = require('./param.json');
var _du = require('diskspace');
var pollInterval = _param.pollInterval || 3000;
var c;
var smallestDev;
var smallest;
function checkFnc(dev)
{
return function(total, free, status)
{
var perc = 1.0 - (free / total);
if (!smallest || smallest < perc)
{
smallest = perc;
smallestDev = dev;
}
if (!--c)
{
console.log('DISKUSE_SUMMARY %d', smallest);
}
}
}
function poll()
{
c = process.argv.length - 3;
smallestDev = null;
smallest = null;
for (var i = 3; i < process.argv.length; i++)
{
_du.check(process.argv[i], checkFnc(process.argv[i]));
}
}
setInterval(poll, pollInterval);
| var _param = require('./param.json');
var _du = require('diskspace');
var pollInterval = _param.pollInterval || 3000;
var c;
var smallestDev;
var smallest;
function checkFnc(dev)
{
return function(error, total, free, status)
{
if (!error) {
var perc = 1.0 - (free / total);
if (!smallest || smallest < perc)
{
smallest = perc;
smallestDev = dev;
}
if (!--c)
{
console.log('DISKUSE_SUMMARY %d', smallest);
}
} else {
--c;
}
}
}
function poll()
{
c = process.argv.length - 3;
smallestDev = null;
smallest = null;
for (var i = 3; i < process.argv.length; i++)
{
_du.check(process.argv[i], checkFnc(process.argv[i]));
}
}
setInterval(poll, pollInterval);
| Add error param to diskspace callback. | Add error param to diskspace callback.
diskspace 0.1.7 expects an error parameter as the first parameter of the callback (this is different from diskspace 0.1.5, which this plugi
n had been using previously).
https://github.com/keverw/diskspace.js/commit/d690faad01fdf76f001d85e92fb8a5e67eebaadc
| JavaScript | apache-2.0 | graphdat/plugin-diskuse_summary,GabrielNicolasAvellaneda/boundary-plugin-diskuse-summary,boundary/boundary-plugin-diskuse-summary | ---
+++
@@ -9,18 +9,22 @@
function checkFnc(dev)
{
- return function(total, free, status)
+ return function(error, total, free, status)
{
- var perc = 1.0 - (free / total);
- if (!smallest || smallest < perc)
- {
- smallest = perc;
- smallestDev = dev;
- }
+ if (!error) {
+ var perc = 1.0 - (free / total);
+ if (!smallest || smallest < perc)
+ {
+ smallest = perc;
+ smallestDev = dev;
+ }
- if (!--c)
- {
- console.log('DISKUSE_SUMMARY %d', smallest);
+ if (!--c)
+ {
+ console.log('DISKUSE_SUMMARY %d', smallest);
+ }
+ } else {
+ --c;
}
}
} |
a78aa48a7f663f0f17836a2950d529f14aeaeea4 | index.js | index.js | var rabbit = require('./rabbit');
var config = require('./rabbit.json');
var commandLineArgs = require('command-line-args');
var args = commandLineArgs([{ name: 'port', alias: 'p' }]).parse();
var socketConfig = require('./socket');
var socketInst = null;
var queue = require('./queue');
rabbit.connect().then(function(connection) {
queue(connection).then(function(queue) {
console.log('- queue is listening for messages -');
queue.subscribe(function(message, headers) {
push(headers.channel, message.data.toString());
});
});
});
socketInst = socketConfig.connect(args.port);
function push(channel, message) {
if (socketInst) {
socketInst.send(channel, message);
}
} | var rabbit = require('./rabbit');
var commandLineArgs = require('command-line-args');
var args = commandLineArgs([{ name: 'port', alias: 'p' }]).parse();
var socketConfig = require('./socket');
var socketInst = null;
socketInst = socketConfig.connect(args.port);
rabbit.connect().subscribe(function(message) {
if (socketInst) {
socketInst.send(message.channel, message.body);
}
}, function() {
console.error('- failed to connect to the queue -');
});
| Update rabbit consumption code to use the new simplified stream of messages from the queue. | Update rabbit consumption code to use the new simplified stream of messages from the queue.
| JavaScript | mit | RenovoSolutions/socket-server | ---
+++
@@ -1,5 +1,4 @@
var rabbit = require('./rabbit');
-var config = require('./rabbit.json');
var commandLineArgs = require('command-line-args');
var args = commandLineArgs([{ name: 'port', alias: 'p' }]).parse();
@@ -7,21 +6,12 @@
var socketConfig = require('./socket');
var socketInst = null;
-var queue = require('./queue');
-
-rabbit.connect().then(function(connection) {
- queue(connection).then(function(queue) {
- console.log('- queue is listening for messages -');
- queue.subscribe(function(message, headers) {
- push(headers.channel, message.data.toString());
- });
- });
-});
-
socketInst = socketConfig.connect(args.port);
-function push(channel, message) {
+rabbit.connect().subscribe(function(message) {
if (socketInst) {
- socketInst.send(channel, message);
+ socketInst.send(message.channel, message.body);
}
-}
+}, function() {
+ console.error('- failed to connect to the queue -');
+}); |
7583c6e1c33629944bb36b3364b4b93f39bc8cb3 | index.js | index.js | 'use strict';
const express = require('express');
const app = express();
const cookieParser = require('cookie-parser')
const config = require('./config/config');
const sqlClient = require('knex')(config.database);
const analyticsRepository = require('./lib/repository/sqlAnalyticsRepository')(sqlClient);
const uniqueId = require('./lib/domain/uniqueId')();
app.use(express.static('public'));
app.use(cookieParser(config.cookieSecret));
app.get('/status', function(req, res) {
res.status(200).send('OK');
});
app.use(require('./lib/tracker')(config, uniqueId, analyticsRepository));
const server = app.listen(config.port, function () {
const host = server.address().address;
const port = server.address().port;
console.log('Analytics listening at http://%s:%s', host, port);
}); | 'use strict';
const express = require('express');
const app = express();
const cookieParser = require('cookie-parser')
const config = require('./config/config');
const sqlClient = require('knex')(config.database);
const analyticsRepository = require('./lib/repository/sqlAnalyticsRepository')(sqlClient);
const uniqueId = require('./lib/domain/uniqueId')();
app.use(cookieParser(config.cookieSecret));
app.get('/status', (req, res) => {
res.status(200).send('OK');
});
app.get('/a.js', (req, res) => {
res.status(200).sendFile(__dirname + '/public/a.js');
});
app.use(require('./lib/tracker')(config, uniqueId, analyticsRepository));
const server = app.listen(config.port, function () {
const host = server.address().address;
const port = server.address().port;
console.log('Analytics listening at http://%s:%s', host, port);
}); | Fix tracking script not found | Fix tracking script not found
| JavaScript | mit | kdelemme/analytics | ---
+++
@@ -7,11 +7,15 @@
const analyticsRepository = require('./lib/repository/sqlAnalyticsRepository')(sqlClient);
const uniqueId = require('./lib/domain/uniqueId')();
-app.use(express.static('public'));
+
app.use(cookieParser(config.cookieSecret));
-app.get('/status', function(req, res) {
+app.get('/status', (req, res) => {
res.status(200).send('OK');
+});
+
+app.get('/a.js', (req, res) => {
+ res.status(200).sendFile(__dirname + '/public/a.js');
});
app.use(require('./lib/tracker')(config, uniqueId, analyticsRepository)); |
9e33466ee630670b0e1d0b4ec96cabf07f36000c | .imdone/actions/board.js | .imdone/actions/board.js | const release = require('./lib/release')
module.exports = function () {
const project = this.project
const { getChangeLog, newRelease } = release(project)
return [
{
title: 'Start minor release',
action: async function () {
await newRelease('main', 'minor')
},
},
{
title: 'Copy changelog',
action: function () {
project.copyToClipboard(
getChangeLog(true).join('\n'),
'Changelog copied'
)
},
},
]
}
| const release = require('./lib/release')
module.exports = function () {
const project = this.project
const { getChangeLog, newRelease } = release(project)
return [
{
title: 'Start minor release',
action: async function () {
await newRelease('main', 'minor')
project.toast({ message: 'Minor release created' })
},
},
{
title: 'Copy changelog',
action: function () {
project.copyToClipboard(
getChangeLog(true).join('\n'),
'Changelog copied'
)
},
},
]
}
| Add toast after creating release | Add toast after creating release
| JavaScript | mit | imdone/imdone-core,imdone/imdone-core | ---
+++
@@ -9,6 +9,7 @@
title: 'Start minor release',
action: async function () {
await newRelease('main', 'minor')
+ project.toast({ message: 'Minor release created' })
},
},
{ |
49da4756ac25c32e3f183c0c31a9f97d7e5dd610 | index.js | index.js | var fs = require('fs');
function SuperSimpleDB(path) {
if (!fs.existsSync(path)) {
write({});
}
this.get = get;
this.set = set;
function get(key) {
return read()[key];
}
function set(key, value) {
var json = read();
json[key] = value;
write(json);
}
function read() {
return JSON.parse(fs.readFileSync(path, 'utf-8'));
}
function write(json) {
fs.writeFileSync(path, JSON.stringify(json));
}
}
module.exports = SuperSimpleDB; | var fs = require('fs');
function SuperSimpleDB(path) {
if (!fs.existsSync(path)) {
write({});
}
this.get = get;
this.set = set;
function get(key) {
var json = read();
if (!key) {
return json;
}
return json[key];
}
function set(key, value) {
var json = read();
json[key] = value;
write(json);
}
function read() {
return JSON.parse(fs.readFileSync(path, 'utf-8'));
}
function write(json) {
fs.writeFileSync(path, JSON.stringify(json));
}
}
module.exports = SuperSimpleDB; | Allow you to get the whole db | Allow you to get the whole db
| JavaScript | mit | jhollingworth/super-simple-db | ---
+++
@@ -9,7 +9,13 @@
this.set = set;
function get(key) {
- return read()[key];
+ var json = read();
+
+ if (!key) {
+ return json;
+ }
+
+ return json[key];
}
function set(key, value) { |
bc4c0b029def9462ac31f3e579dffa20e2750cec | index.js | index.js | var fs = require('fs')
module.exports = {
getPageStrategyElement: function(pageStrategy, element) {
if (!fs.existsSync(__dirname + '/' + pageStrategy + '/' + element)) {
return {
noSuchStrategy: "file does not exist: " + __dirname + '/' + pageStrategy + '/' + element
}
}
var pageStrategyPath = __dirname + '/' + pageStrategy + '/' + element;
return {
data: fs.readFileSync(pageStrategyPath).toString()
}
}
} | var fs = require('fs')
function getPageStrategyElement: function(pageStrategy, element) {
if (!fs.existsSync(__dirname + '/' + pageStrategy + '/' + element)) {
return {
noSuchStrategy: "file does not exist: " + __dirname + '/' + pageStrategy + '/' + element
}
}
var pageStrategyPath = __dirname + '/' + pageStrategy + '/' + element;
return {
data: fs.readFileSync(pageStrategyPath).toString()
}
}
function getOrDefault (strategyName, element) {
var strategy = getPageStrategyElement(strategyName, element)
if (strategy.noSuchStrategy) {
return talPageStrategies.getPageStrategyElement('default', element)
}
return strategy
}
module.exports = {
getPageStrategyElement,
getOrDefault
}
| Add default getter for page strategies | Add default getter for page strategies
| JavaScript | apache-2.0 | fmtvp/tal-page-strategies | ---
+++
@@ -1,15 +1,27 @@
var fs = require('fs')
-module.exports = {
- getPageStrategyElement: function(pageStrategy, element) {
- if (!fs.existsSync(__dirname + '/' + pageStrategy + '/' + element)) {
- return {
- noSuchStrategy: "file does not exist: " + __dirname + '/' + pageStrategy + '/' + element
- }
- }
- var pageStrategyPath = __dirname + '/' + pageStrategy + '/' + element;
+function getPageStrategyElement: function(pageStrategy, element) {
+ if (!fs.existsSync(__dirname + '/' + pageStrategy + '/' + element)) {
return {
- data: fs.readFileSync(pageStrategyPath).toString()
+ noSuchStrategy: "file does not exist: " + __dirname + '/' + pageStrategy + '/' + element
}
}
+ var pageStrategyPath = __dirname + '/' + pageStrategy + '/' + element;
+ return {
+ data: fs.readFileSync(pageStrategyPath).toString()
+ }
}
+
+function getOrDefault (strategyName, element) {
+ var strategy = getPageStrategyElement(strategyName, element)
+
+ if (strategy.noSuchStrategy) {
+ return talPageStrategies.getPageStrategyElement('default', element)
+ }
+ return strategy
+}
+
+module.exports = {
+ getPageStrategyElement,
+ getOrDefault
+} |
c5d64f61247ffd21d11c8cea2b5dc8b4c41f3cd3 | index.js | index.js |
'use strict';
var helpers = require('./lib/test-helpers');
module.exports = {
setFirebaseData: helpers.setFirebaseData,
setFirebaseRules: helpers.setFirebaseRules,
setDebug: helpers.setDebug,
users: helpers.users,
utils: helpers,
chai: require('./lib/chai'),
jasmine: require('./lib/jasmine'),
};
|
'use strict';
const helpers = require('./util');
const util = require('util');
exports.util = helpers;
// Deprecate direct access to plugin helpers
Object.defineProperties(exports, [
'setFirebaseData',
'setFirebaseRules',
'setDebug',
'users'
].reduce((props, key) => {
props[key] = {
get: util.deprecate(
() => helpers[key],
`Deprecated: use "chai.${key}" or "jasmine.${key}" directly.`
),
enumerable: true,
configurable: true
};
return props;
}, {}));
// Deprecate direct access to plugins
Object.defineProperties(exports, [
'chai',
'jasmine'
].reduce((props, key) => {
const path = `./plugins/${key}`;
props[key] = {
get: util.deprecate(
() => require(path),
`Deprecated: use "const ${key} = require('targaryen/plugins/${key}');"`
),
enumerable: true,
configurable: true
};
return props;
}, {}));
| Disable direct access to plugins or plugin helpers | Disable direct access to plugins or plugin helpers
| JavaScript | isc | dinoboff/targaryen,goldibex/targaryen,goldibex/targaryen,dinoboff/targaryen | ---
+++
@@ -1,14 +1,45 @@
'use strict';
-var helpers = require('./lib/test-helpers');
+const helpers = require('./util');
+const util = require('util');
-module.exports = {
- setFirebaseData: helpers.setFirebaseData,
- setFirebaseRules: helpers.setFirebaseRules,
- setDebug: helpers.setDebug,
- users: helpers.users,
- utils: helpers,
- chai: require('./lib/chai'),
- jasmine: require('./lib/jasmine'),
-};
+exports.util = helpers;
+
+// Deprecate direct access to plugin helpers
+Object.defineProperties(exports, [
+ 'setFirebaseData',
+ 'setFirebaseRules',
+ 'setDebug',
+ 'users'
+].reduce((props, key) => {
+ props[key] = {
+ get: util.deprecate(
+ () => helpers[key],
+ `Deprecated: use "chai.${key}" or "jasmine.${key}" directly.`
+ ),
+ enumerable: true,
+ configurable: true
+ };
+
+ return props;
+}, {}));
+
+// Deprecate direct access to plugins
+Object.defineProperties(exports, [
+ 'chai',
+ 'jasmine'
+].reduce((props, key) => {
+ const path = `./plugins/${key}`;
+
+ props[key] = {
+ get: util.deprecate(
+ () => require(path),
+ `Deprecated: use "const ${key} = require('targaryen/plugins/${key}');"`
+ ),
+ enumerable: true,
+ configurable: true
+ };
+
+ return props;
+}, {})); |
f8554c6ae9ed9d2e73e683749948cbb1fe679bea | playground.js | playground.js | var elegantStatus = require('./');
var done = elegantStatus('Perform assessment');
setTimeout(function () {
done(true);
done = elegantStatus('Set defense systems');
setTimeout(function () {
done(false);
}, 4000);
}, 3000);
| var elegantStatus = require('./');
var done = elegantStatus('Perform assessment');
setTimeout(function () {
done.updateText('2 seconds left');
}, 1000);
setTimeout(function () {
done.updateText('1 second left');
}, 2000);
setTimeout(function () {
done(true);
done = elegantStatus('Set defense systems');
setTimeout(function () {
done(false);
}, 4000);
}, 3000);
| Test update of spinner text | Test update of spinner text
| JavaScript | mit | inikulin/elegant-status | ---
+++
@@ -1,6 +1,14 @@
var elegantStatus = require('./');
var done = elegantStatus('Perform assessment');
+
+setTimeout(function () {
+ done.updateText('2 seconds left');
+}, 1000);
+
+setTimeout(function () {
+ done.updateText('1 second left');
+}, 2000);
setTimeout(function () {
done(true); |
e49071dffa40ab6712fefa5ea99597e51e68fa4b | gulp/eslint.js | gulp/eslint.js | const gulp = require('gulp');
const config = require('./config');
const eslint = require('gulp-eslint');
gulp.task('eslint', () => {
return gulp.src(config.lib)
.pipe(eslint(config.root + '.eslint.json'))
.pipe(eslint.format('node_modules/eslint-codeframe-formatter'))
.pipe(eslint.failAfterError());
});
| const gulp = require('gulp');
const config = require('./config');
const eslint = require('gulp-eslint');
gulp.task('eslint', function() {
return gulp.src(config.lib)
.pipe(eslint(config.root + '.eslint.json'))
.pipe(eslint.format('node_modules/eslint-codeframe-formatter'))
.pipe(eslint.failAfterError());
});
| Remove new function style usage | Remove new function style usage
| JavaScript | mit | tandrewnichols/is-io-version | ---
+++
@@ -2,7 +2,7 @@
const config = require('./config');
const eslint = require('gulp-eslint');
-gulp.task('eslint', () => {
+gulp.task('eslint', function() {
return gulp.src(config.lib)
.pipe(eslint(config.root + '.eslint.json'))
.pipe(eslint.format('node_modules/eslint-codeframe-formatter')) |
a3b50a4f17fe21ed2c90ccafe1f1a088780de9a6 | src/core/stores/ApiStore.js | src/core/stores/ApiStore.js | var Reflux = require('reflux');
var config = require('./../../../config');
var ApiActions = require('./../actions/ApiActions');
var buffer = [];
var ws;
var ApiStore = Reflux.createStore({
init: function () {
ws = new WebSocket('ws://' + config.host + ':' + config.port);
ws.onmessage = function (event) {
console.log(JSON.parse(event.data));
ApiStore.trigger(JSON.parse(event.data));
};
ws.onopen = function () {
buffer.forEach(function (request) {
ws.send(JSON.stringify(request));
});
};
this.listenTo(ApiActions.get, this.get);
},
get: function (id, params) {
if (ws.readyState !== WebSocket.OPEN) {
buffer.push({
id: id,
params: params || {}
});
return;
}
ws.send(JSON.stringify({
id: id,
params: params || {}
}));
}
});
module.exports = ApiStore; | var Reflux = require('reflux');
var config = require('./../../../config');
var ApiActions = require('./../actions/ApiActions');
var buffer = [];
var ws;
var ApiStore = Reflux.createStore({
init: function () {
ws = new WebSocket('ws://' + window.document.location.host);
ws.onmessage = function (event) {
console.log(JSON.parse(event.data));
ApiStore.trigger(JSON.parse(event.data));
};
ws.onopen = function () {
buffer.forEach(function (request) {
ws.send(JSON.stringify(request));
});
};
this.listenTo(ApiActions.get, this.get);
},
get: function (id, params) {
if (ws.readyState !== WebSocket.OPEN) {
buffer.push({
id: id,
params: params || {}
});
return;
}
ws.send(JSON.stringify({
id: id,
params: params || {}
}));
}
});
module.exports = ApiStore; | Fix problem with ws host:port mismatch on heroku | Fix problem with ws host:port mismatch on heroku
| JavaScript | mit | plouc/mozaik,backjo/mozaikdummyfork,danielw92/mozaik,beni55/mozaik,codeaudit/mozaik,tlenclos/mozaik,juhamust/mozaik,michaelchiche/mozaik,danielw92/mozaik,plouc/mozaik,juhamust/mozaik,beni55/mozaik,backjo/mozaikdummyfork,michaelchiche/mozaik,tlenclos/mozaik,codeaudit/mozaik | ---
+++
@@ -7,7 +7,7 @@
var ApiStore = Reflux.createStore({
init: function () {
- ws = new WebSocket('ws://' + config.host + ':' + config.port);
+ ws = new WebSocket('ws://' + window.document.location.host);
ws.onmessage = function (event) {
console.log(JSON.parse(event.data));
ApiStore.trigger(JSON.parse(event.data)); |
0506736f4e0b6db7667445f414ec52d081d6c2a9 | app/core/models/MoxieModel.js | app/core/models/MoxieModel.js | define(['backbone'], function(Backbone) {
var MoxieModel = Backbone.Model.extend({
fetch: function(options) {
options = options || {};
// Set a default error handler
if (!options.error) {
options.error = _.bind(function() {
// Pass all the error arguments through
// These are [model, response, options]
this.trigger("errorFetching", arguments);
}, this);
}
return Backbone.Model.prototype.fetch.apply(this, [options]);
},
});
return MoxieModel;
});
| define(['backbone'], function(Backbone) {
var MoxieModel = Backbone.Model.extend({
registeredFetch: false,
// By default the fetch method will set an attr
// "midFetch" to true whilst the request to the API
// is in flight. This attr is removed once done.
fetch: function(options) {
this.set('midFetch', true);
if (!this.registeredFetch) {
// Careful to only listen on sync/error once
this.registeredFetch = true;
this.on('sync error', function(model, response, options) {
// We've either got the model successfully or it has failed
// either way we unset the midFetch attr
model.unset('midFetch');
});
}
return Backbone.Model.prototype.fetch.apply(this, [options]);
},
});
return MoxieModel;
});
| Set an attr on the model whilst a request is mid-flight | Set an attr on the model whilst a request is mid-flight
Done by overriding fetch and listening for sync/error which
are triggered on success/error respectively
| JavaScript | apache-2.0 | ox-it/moxie-js-client,ox-it/moxie-js-client,ox-it/moxie-js-client,ox-it/moxie-js-client | ---
+++
@@ -1,14 +1,19 @@
define(['backbone'], function(Backbone) {
var MoxieModel = Backbone.Model.extend({
+ registeredFetch: false,
+ // By default the fetch method will set an attr
+ // "midFetch" to true whilst the request to the API
+ // is in flight. This attr is removed once done.
fetch: function(options) {
- options = options || {};
- // Set a default error handler
- if (!options.error) {
- options.error = _.bind(function() {
- // Pass all the error arguments through
- // These are [model, response, options]
- this.trigger("errorFetching", arguments);
- }, this);
+ this.set('midFetch', true);
+ if (!this.registeredFetch) {
+ // Careful to only listen on sync/error once
+ this.registeredFetch = true;
+ this.on('sync error', function(model, response, options) {
+ // We've either got the model successfully or it has failed
+ // either way we unset the midFetch attr
+ model.unset('midFetch');
+ });
}
return Backbone.Model.prototype.fetch.apply(this, [options]);
}, |
0e10dee4f75fafe6c543b5f3afa266e0f1f93046 | index.js | index.js | 'use strict';
var Cleaner = require('clean-css');
var defaultCleaner = new Cleaner();
var Promise = require('promise');
exports.name = 'clean-css';
exports.inputFormats = ['clean-css', 'css', 'cssmin'];
exports.outputFormat = 'css';
function getCleaner (options) {
if (!options ||
(typeof options === 'object' && Object.keys(options).length === 0)) {
return defaultCleaner;
} else {
return new Cleaner(options);
}
}
exports.render = function (str, options) {
return getCleaner(options).minify(str).styles;
};
exports.renderAsync = function (str, options) {
return new Promise(function (fulfill, reject) {
getCleaner(options).minify(str, function (err, minified) {
if (err) {
reject(err);
}
else {
fulfill(minified.styles);
}
});
});
};
| 'use strict';
var Cleaner = require('clean-css');
var defaultCleaner = new Cleaner();
var Promise = require('promise');
exports.name = 'clean-css';
exports.inputFormats = ['clean-css', 'cssmin'];
exports.outputFormat = 'css';
function getCleaner (options) {
if (!options ||
(typeof options === 'object' && Object.keys(options).length === 0)) {
return defaultCleaner;
} else {
return new Cleaner(options);
}
}
exports.render = function (str, options) {
return getCleaner(options).minify(str).styles;
};
exports.renderAsync = function (str, options) {
return new Promise(function (fulfill, reject) {
getCleaner(options).minify(str, function (err, minified) {
if (err) {
reject(err);
}
else {
fulfill(minified.styles);
}
});
});
};
| Remove "css" from input format | Remove "css" from input format | JavaScript | mit | jstransformers/jstransformer-clean-css | ---
+++
@@ -5,7 +5,7 @@
var Promise = require('promise');
exports.name = 'clean-css';
-exports.inputFormats = ['clean-css', 'css', 'cssmin'];
+exports.inputFormats = ['clean-css', 'cssmin'];
exports.outputFormat = 'css';
function getCleaner (options) { |
1f42ce2a525e67c57c5fd9ab7d223fe533501590 | index.js | index.js | var globals = {};
// Stash old global.
if ("tree-node" in global) globals.tree-node = global.tree-node;
module.exports = require("./dist/tree-node");
// Restore old global.
if ("tree-node" in globals) global.tree-node = globals.tree-node; else delete global.tree-node; | var globals = {};
// Stash old global.
if ("tree-node" in global) globals['tree-node'] = global['tree-node'];
module.exports = require("./dist/tree-node");
// Restore old global.
if ("tree-node" in globals) global['tree-node'] = globals['tree-node']; else delete global['tree-node']; | Add main script for npm | Add main script for npm
| JavaScript | mit | deztopia/treenode | ---
+++
@@ -1,9 +1,9 @@
var globals = {};
// Stash old global.
-if ("tree-node" in global) globals.tree-node = global.tree-node;
+if ("tree-node" in global) globals['tree-node'] = global['tree-node'];
module.exports = require("./dist/tree-node");
// Restore old global.
-if ("tree-node" in globals) global.tree-node = globals.tree-node; else delete global.tree-node;
+if ("tree-node" in globals) global['tree-node'] = globals['tree-node']; else delete global['tree-node']; |
1dd495608ac245827734b7ea74403f10c69089ec | index.js | index.js | var path = require('path'),
cmd = require('./lib/utils/cmd'),
fs = require('fs'),
Q = require('q'),
osenv = require('osenv'),
extractUser = require('./lib/utils/extractUser'),
extractPassword = require('./lib/utils/extractPassword'),
parseString = require('xml2js').parseString;
var fetch = exports.fetch = function() {
var deferred = Q.defer();
var m2Path = path.join(osenv.home(), '.m2');
var settingsXmlPath = path.join(m2Path, 'settings.xml');
var settingsSecurityXmlPath = path.join(m2Path, 'settings-security.xml');
cmd('./lib/settings-decoder/bin/settings-decoder', ['-f', settingsXmlPath, '-s', settingsSecurityXmlPath])
.then(function (stdout){
var username = extractUser(stdout[0]);
var password = extractPassword(stdout[0]);
deferred.resolve({
username: username,
password: password
});
})
.fail(deferred.reject);
return deferred.promise;
};
| var path = require('path'),
cmd = require('./lib/utils/cmd'),
fs = require('fs'),
Q = require('q'),
osenv = require('osenv'),
extractUser = require('./lib/utils/extractUser'),
extractPassword = require('./lib/utils/extractPassword'),
parseString = require('xml2js').parseString;
var fetch = exports.fetch = function() {
var deferred = Q.defer();
var m2Path = path.join(osenv.home(), '.m2');
var settingsXmlPath = path.join(m2Path, 'settings.xml');
var settingsSecurityXmlPath = path.join(m2Path, 'settings-security.xml');
cmd(__dirname + '/lib/settings-decoder/bin/settings-decoder', ['-f', settingsXmlPath, '-s', settingsSecurityXmlPath])
.then(function (stdout){
var username = extractUser(stdout[0]);
var password = extractPassword(stdout[0]);
deferred.resolve({
username: username,
password: password
});
})
.fail(deferred.reject);
return deferred.promise;
};
| Fix path to the executable to work in most of the cases. | Fix path to the executable to work in most of the cases.
| JavaScript | mit | mistermark/mvn-credentials,mistermark/mvn-credentials | ---
+++
@@ -13,7 +13,7 @@
var settingsXmlPath = path.join(m2Path, 'settings.xml');
var settingsSecurityXmlPath = path.join(m2Path, 'settings-security.xml');
- cmd('./lib/settings-decoder/bin/settings-decoder', ['-f', settingsXmlPath, '-s', settingsSecurityXmlPath])
+ cmd(__dirname + '/lib/settings-decoder/bin/settings-decoder', ['-f', settingsXmlPath, '-s', settingsSecurityXmlPath])
.then(function (stdout){
var username = extractUser(stdout[0]);
var password = extractPassword(stdout[0]); |
fdbe99bee4de0e5fd1ac6e31a77c6ce609db6d19 | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-cli-gravatar',
included: function included(app) {
this.app = app;
this._super.included(app);
app.import(app.bowerDirectory + '/blueimp-md5/js/md5.js');
app.import('vendor/ember-cli-gravatar/md5-shim.js', {
type: 'vendor',
exports: { 'md5': ['md5'] }
});
}
};
| /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-cli-gravatar',
included: function included(app) {
// workaround for https://github.com/ember-cli/ember-cli/issues/3718
if (typeof app.import !== 'function' && app.app) {
app = app.app;
}
this.app = app;
this._super.included(app);
app.import(app.bowerDirectory + '/blueimp-md5/js/md5.js');
app.import('vendor/ember-cli-gravatar/md5-shim.js', {
type: 'vendor',
exports: { 'md5': ['md5'] }
});
}
};
| Fix import for nested add-on. | Fix import for nested add-on.
| JavaScript | mit | johnotander/ember-cli-gravatar,johnotander/ember-cli-gravatar | ---
+++
@@ -5,6 +5,10 @@
name: 'ember-cli-gravatar',
included: function included(app) {
+ // workaround for https://github.com/ember-cli/ember-cli/issues/3718
+ if (typeof app.import !== 'function' && app.app) {
+ app = app.app;
+ }
this.app = app;
this._super.included(app);
|
e169b25cf5d2f459ab3c8844fbbbd86603233137 | index.js | index.js | var DtsCreator = require('typed-css-modules');
var loaderUtils = require('loader-utils');
module.exports = function(source, map) {
this.cacheable && this.cacheable();
var callback = this.async();
// Pass on query parameters as an options object to the DtsCreator. This lets
// you change the default options of the DtsCreator and e.g. use a different
// output folder.
var queryOptions = loaderUtils.parseQuery(this.query);
var options;
if (queryOptions) {
options = Object.assign({}, queryOptions);
}
var creator = new DtsCreator(options);
// creator.create(..., source) tells the module to operate on the
// source variable. Check API for more details.
creator.create(this.resourcePath, source).then(content => {
// Emit the created content as well
this.emitFile(content.outputFilePath, content.contents || [''], map);
content.writeFile().then(_ => {
callback(null, source, map);
});
});
};
| var DtsCreator = require('typed-css-modules');
var loaderUtils = require('loader-utils');
module.exports = function(source, map) {
this.cacheable && this.cacheable();
this.addDependency(this.resourcePath);
var callback = this.async();
// Pass on query parameters as an options object to the DtsCreator. This lets
// you change the default options of the DtsCreator and e.g. use a different
// output folder.
var queryOptions = loaderUtils.parseQuery(this.query);
var options;
if (queryOptions) {
options = Object.assign({}, queryOptions);
}
var creator = new DtsCreator(options);
// creator.create(..., source) tells the module to operate on the
// source variable. Check API for more details.
creator.create(this.resourcePath, source).then(content => {
// Emit the created content as well
this.emitFile(content.outputFilePath, content.contents || [''], map);
content.writeFile().then(_ => {
callback(null, source, map);
});
});
};
| Add css resource as dependency to trigger rebuilds | Add css resource as dependency to trigger rebuilds
| JavaScript | mit | olegstepura/typed-css-modules-loader | ---
+++
@@ -3,6 +3,7 @@
module.exports = function(source, map) {
this.cacheable && this.cacheable();
+ this.addDependency(this.resourcePath);
var callback = this.async();
// Pass on query parameters as an options object to the DtsCreator. This lets |
52262e47cb866ef010bd40e98e8bbe22ba54bcb9 | yeoman/app/scripts/controllers/editZone.js | yeoman/app/scripts/controllers/editZone.js | 'use strict';
yeomanApp.controller('EditZoneCtrl'
, ['$scope', '$rootScope', 'UIEvents', 'ZoneFactory', 'ZoneService', 'EditZoneService', 'EditTriggerService', 'TriggerFactory'
, function($scope, $rootScope, UIEvents, ZoneFactory, ZoneService, EditZoneService, EditTriggerService, TriggerFactory) {
$scope.Zone = EditZoneService.Zone;
/**
* Saves the zone to the backend
*/
$scope.Save = function() {
// Detect if this is a new Zone
if ($scope.Zone.id) {
// Existing Zone;
$scope.Zone.Save();
$scope.setRoute('/');
} else {
$scope.Zone.Save();
$scope.AddNewTrigger();
}
};
/**
* Deletes this zone
*/
$scope.Delete = function() {
$scope.Zone.Delete();
$scope.setRoute('/');
};
/**
* Add a new trigger to the zone
*/
$scope.AddNewTrigger = function() {
var newTrigger = new TriggerFactory({
zone: $scope.Zone,
name: 'My Trigger',
type: 'PIR'
});
EditTriggerService.Trigger = newTrigger;
$scope.setRoute('/configureTrigger');
};
/**
* Edits the specified trigger
* Redirect user to /configureTrigger
* @param {Trigger} trigger Trigger to edit
*/
$scope.EditTrigger = function(trigger) {
EditTriggerService.Trigger = trigger;
$scope.setRoute('/configureTrigger');
};
}]);
| 'use strict';
yeomanApp.controller('EditZoneCtrl'
, ['$scope', '$rootScope', 'UIEvents', 'ZoneFactory', 'ZoneService', 'EditZoneService', 'EditTriggerService', 'TriggerFactory'
, function($scope, $rootScope, UIEvents, ZoneFactory, ZoneService, EditZoneService, EditTriggerService, TriggerFactory) {
$scope.Zone = EditZoneService.Zone;
/**
* Saves the zone to the backend
*/
$scope.Save = function() {
// Detect if this is a new Zone
if ($scope.Zone.id) {
// Existing Zone;
$scope.Zone.Save();
$scope.setRoute('/');
} else {
$scope.Zone.Save(function() {
EditZoneService.Zone = $scope.Zone;
$scope.AddNewTrigger();
});
}
};
/**
* Deletes this zone
*/
$scope.Delete = function() {
$scope.Zone.Delete();
$scope.setRoute('/');
};
/**
* Add a new trigger to the zone
*/
$scope.AddNewTrigger = function() {
var newTrigger = new TriggerFactory({
zone: $scope.Zone,
name: 'My Trigger',
type: 'PIR'
});
EditTriggerService.Trigger = newTrigger;
$scope.setRoute('/configureTrigger');
};
/**
* Edits the specified trigger
* Redirect user to /configureTrigger
* @param {Trigger} trigger Trigger to edit
*/
$scope.EditTrigger = function(trigger) {
EditTriggerService.Trigger = trigger;
$scope.setRoute('/configureTrigger');
};
}]);
| Fix Edit Trigger bug flowing from creating a zone | Fix Edit Trigger bug flowing from creating a zone
| JavaScript | mit | ninjablocks/ninja-sentinel,ninjablocks/ninja-sentinel,ninjablocks/ninja-sentinel | ---
+++
@@ -17,8 +17,11 @@
$scope.Zone.Save();
$scope.setRoute('/');
} else {
- $scope.Zone.Save();
- $scope.AddNewTrigger();
+ $scope.Zone.Save(function() {
+ EditZoneService.Zone = $scope.Zone;
+ $scope.AddNewTrigger();
+ });
+
}
}; |
fa33cb73def69835288eccad70ffc6b20961f24e | index.js | index.js | // Imports
// -------------------------------------------------------------------------------------------------
var UMDFormatter = require('6to5/lib/6to5/transformation/modules/umd');
var util = require('./lib/util');
// Main
// -------------------------------------------------------------------------------------------------
var self = function WebUMDFormatter () {
UMDFormatter.apply(this, arguments);
};
util.inherits(self, UMDFormatter);
// Export
// -------------------------------------------------------------------------------------------------
module.exports = self;
| // Imports
// -------------------------------------------------------------------------------------------------
var AMDFormatter = require('6to5/lib/6to5/transformation/modules/amd');
var util = require('./lib/util');
// Main
// -------------------------------------------------------------------------------------------------
// Extend AMDFormatter.
var self = function WebUMDFormatter () {
AMDFormatter.apply(this, arguments);
};
util.inherits(self, AMDFormatter);
// Override the method transform. This is mostly the code of the original UMDFormatter.
self.prototype.transform = function (ast) {
var program = ast.program;
var body = program.body;
// build an array of module names
var names = [];
_.each(this.ids, function (id, name) {
names.push(t.literal(name));
});
// factory
var ids = _.values(this.ids);
var args = [t.identifier("exports")].concat(ids);
var factory = t.functionExpression(null, args, t.blockStatement(body));
// runner
var defineArgs = [t.arrayExpression([t.literal("exports")].concat(names))];
var moduleName = this.getModuleName();
if (moduleName) defineArgs.unshift(t.literal(moduleName));
var runner = util.template("umd-runner-body", {
AMD_ARGUMENTS: defineArgs,
COMMON_ARGUMENTS: names.map(function (name) {
return t.callExpression(t.identifier("require"), [name]);
})
});
//
var call = t.callExpression(runner, [factory]);
program.body = [t.expressionStatement(call)];
};
// Export
// -------------------------------------------------------------------------------------------------
module.exports = self;
| Copy transform method over from UMDFormatter | Copy transform method over from UMDFormatter
| JavaScript | mit | tomekwi/6-to-library | ---
+++
@@ -1,17 +1,58 @@
// Imports
// -------------------------------------------------------------------------------------------------
-var UMDFormatter = require('6to5/lib/6to5/transformation/modules/umd');
+var AMDFormatter = require('6to5/lib/6to5/transformation/modules/amd');
var util = require('./lib/util');
// Main
// -------------------------------------------------------------------------------------------------
+// Extend AMDFormatter.
var self = function WebUMDFormatter () {
- UMDFormatter.apply(this, arguments);
+ AMDFormatter.apply(this, arguments);
};
-util.inherits(self, UMDFormatter);
+util.inherits(self, AMDFormatter);
+
+// Override the method transform. This is mostly the code of the original UMDFormatter.
+self.prototype.transform = function (ast) {
+ var program = ast.program;
+ var body = program.body;
+
+ // build an array of module names
+
+ var names = [];
+ _.each(this.ids, function (id, name) {
+ names.push(t.literal(name));
+ });
+
+ // factory
+
+ var ids = _.values(this.ids);
+ var args = [t.identifier("exports")].concat(ids);
+
+ var factory = t.functionExpression(null, args, t.blockStatement(body));
+
+ // runner
+
+ var defineArgs = [t.arrayExpression([t.literal("exports")].concat(names))];
+ var moduleName = this.getModuleName();
+ if (moduleName) defineArgs.unshift(t.literal(moduleName));
+
+ var runner = util.template("umd-runner-body", {
+ AMD_ARGUMENTS: defineArgs,
+
+ COMMON_ARGUMENTS: names.map(function (name) {
+ return t.callExpression(t.identifier("require"), [name]);
+ })
+ });
+
+ //
+
+ var call = t.callExpression(runner, [factory]);
+ program.body = [t.expressionStatement(call)];
+};
+
// Export |
673b054d240328b1cd2e7b7bd5ab7ea71f8edd52 | index.js | index.js | /* jshint node: true */
'use strict';
var fs = require('fs');
var path = require('path');
function readSnippet() {
try {
return fs.readFileSync(path.join(process.cwd(), 'vendor/newrelic-snippet.html'), {
encoding: 'UTF-8'
});
} catch(error) {
if (error.code === 'ENOENT') {
return '';
} else {
throw error;
}
}
}
module.exports = {
name: 'ember-newrelic',
contentFor: function(type, config) {
var content = '';
if (config.environment !== 'test' && type === 'head') {
var content = readSnippet();
if (!content) {
console.warn('New Relic disabled: no snippet found, run `ember generate newrelic-license <app-name> <api-key>`');
}
}
return content;
}
};
| /* jshint node: true */
'use strict';
var fs = require('fs');
var path = require('path');
function readSnippet() {
try {
return fs.readFileSync(path.join(process.cwd(), 'vendor/newrelic-snippet.html'), {
encoding: 'UTF-8'
});
} catch(error) {
if (error.code === 'ENOENT') {
return '';
} else {
throw error;
}
}
}
module.exports = {
name: 'ember-newrelic',
contentFor: function(type, config) {
var content = '';
var enabled = config.newrelicEnabled || config.environment === 'production';
// Warn when no snippet found in development regardless of whether new relic
// is enabled.
if (config.environment === 'development' && !readSnippet()) {
console.warn('No New Relic snippet found, run `ember generate newrelic-license <app-name> <api-key>`');
}
if (enabled && type === 'head') {
content = readSnippet();
}
return content;
}
};
| Add configuration flag to enable addon | Add configuration flag to enable addon | JavaScript | mit | AltSchool/ember-newrelic,AltSchool/ember-newrelic | ---
+++
@@ -25,13 +25,16 @@
contentFor: function(type, config) {
var content = '';
+ var enabled = config.newrelicEnabled || config.environment === 'production';
- if (config.environment !== 'test' && type === 'head') {
- var content = readSnippet();
+ // Warn when no snippet found in development regardless of whether new relic
+ // is enabled.
+ if (config.environment === 'development' && !readSnippet()) {
+ console.warn('No New Relic snippet found, run `ember generate newrelic-license <app-name> <api-key>`');
+ }
- if (!content) {
- console.warn('New Relic disabled: no snippet found, run `ember generate newrelic-license <app-name> <api-key>`');
- }
+ if (enabled && type === 'head') {
+ content = readSnippet();
}
return content; |
b302e7fab835955de490cf2813be58c7483d6a72 | web/js/reducers/Api.js | web/js/reducers/Api.js | import * as ActionTypes from '../constants/ActionTypes';
let defaultState = {
loading: false,
data: [], // array of comics
last_error: undefined
}
export default function(state = defaultState, action) {
switch (action.type) {
case ActionTypes.COMIC_FETCHED:
return { ...state, loading: true}
case ActionTypes.COMIC_SUCCEDED:
return { ...state, data: action.data}
case ActionTypes.COMIC_FAILED:
return { ...state, err: action.err}
default:
return state;
}
}
| import * as ActionTypes from '../constants/ActionTypes';
let defaultState = {
loading: false,
data: [], // array of comics
last_error: undefined
}
export default function(state = defaultState, action) {
switch (action.type) {
case ActionTypes.COMIC_ON_LODING:
return { ...state, loading: true}
case ActionTypes.COMIC_SUCCEDED:
return { ...state, data: action.data, loading: false}
case ActionTypes.COMIC_FAILED:
return { ...state, err: action.err}
default:
return state;
}
}
| FIX loading was not being updated on the reduce | FIX loading was not being updated on the reduce
| JavaScript | mit | kozko2001/existentialcomics,kozko2001/existentialcomics | ---
+++
@@ -8,10 +8,10 @@
export default function(state = defaultState, action) {
switch (action.type) {
- case ActionTypes.COMIC_FETCHED:
+ case ActionTypes.COMIC_ON_LODING:
return { ...state, loading: true}
case ActionTypes.COMIC_SUCCEDED:
- return { ...state, data: action.data}
+ return { ...state, data: action.data, loading: false}
case ActionTypes.COMIC_FAILED:
return { ...state, err: action.err}
default: |
984b2e8d0de6a7f2900b6d5311684c1b20409afc | index.js | index.js |
/**
* Module dependencies.
*/
var AssertionError = require('assert').AssertionError
, callsite = require('callsite')
, fs = require('fs')
/**
* Expose `assert`.
*/
module.exports = process.env.NO_ASSERT
? function(){}
: assert;
/**
* Assert the given `expr`.
*/
function assert(expr) {
if (expr) return;
var stack = __stack;
var call = stack[1];
var file = call.getFileName();
var lineno = call.getLineNumber();
var src = fs.readFileSync(file, 'utf8');
var line = src.split('\n')[lineno-1];
var src = line.match(/assert\((.*)\)/)[1];
var err = new AssertionError({
message: src,
stackStartFunction: stack[0].fun
});
throw err;
}
| /**
* Module dependencies.
*/
var AssertionError = require('assert').AssertionError
, callsite = require('callsite')
, fs = require('fs')
/**
* Expose `assert`.
*/
module.exports = process.env.NO_ASSERT
? function(){}
: assert;
/**
* Assert the given `expr`.
*/
function assert(expr) {
if (expr) return;
var stack = callsite();
var call = stack[1];
var file = call.getFileName();
var lineno = call.getLineNumber();
var src = fs.readFileSync(file, 'utf8');
var line = src.split('\n')[lineno-1];
var src = line.match(/assert\((.*)\)/)[1];
var err = new AssertionError({
message: src,
stackStartFunction: stack[0].fun
});
throw err;
}
| Stop using the removed magic __stack global getter | Stop using the removed magic __stack global getter | JavaScript | mit | tj/better-assert,CantemoInternal/better-assert | ---
+++
@@ -1,4 +1,3 @@
-
/**
* Module dependencies.
*/
@@ -22,7 +21,7 @@
function assert(expr) {
if (expr) return;
- var stack = __stack;
+ var stack = callsite();
var call = stack[1];
var file = call.getFileName();
var lineno = call.getLineNumber(); |
0e36ee3da481a8cd2391720711ea8d25c17da21f | index.js | index.js | 'use strict';
const schedule = require('node-schedule');
const jenkins = require('./lib/jenkins');
const redis = require('./lib/redis');
const gitter = require('./lib/gitter');
const sendgrid = require('./lib/sendgrid');
const pkg = require('./package.json');
console.log(new Date(), `Staring ${pkg.name} v${pkg.version}`);
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
console.log(new Date(), 'Running Cron Job...');
console.log(new Date(), 'Fetching Jenkins nodes...');
jenkins.getComputers(function(err, nodes) {
if (err) { throw err; }
console.log(new Date(), `Found ${nodes.length} Jenkins nodes.`);
console.log(new Date(), 'Checking changed Jenkins nodes...');
redis.jenkinsChanged(nodes, function(err, changed) {
if (err) { throw err; }
console.log(new Date(), `${changed.length} node(s) changed.`);
if (changed.length > 0) {
console.log(new Date(), 'Posting to Gitter...');
gitter.post(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Gitter: Ok!');
});
console.log(new Date(), 'Notifying via Sendgrid...');
sendgrid.notify(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Sendgrid: Ok!');
});
}
});
});
});
| 'use strict';
const schedule = require('node-schedule');
const jenkins = require('./lib/jenkins');
const redis = require('./lib/redis');
const gitter = require('./lib/gitter');
const sendgrid = require('./lib/sendgrid');
const pkg = require('./package.json');
console.log(new Date(), `Staring ${pkg.name} v${pkg.version}`);
console.log(new Date(), process.env.SENDGRID_RECIPIENTS.split(','));
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
console.log(new Date(), 'Running Cron Job...');
console.log(new Date(), 'Fetching Jenkins nodes...');
jenkins.getComputers(function(err, nodes) {
if (err) { throw err; }
console.log(new Date(), `Found ${nodes.length} Jenkins nodes.`);
console.log(new Date(), 'Checking changed Jenkins nodes...');
redis.jenkinsChanged(nodes, function(err, changed) {
if (err) { throw err; }
console.log(new Date(), `${changed.length} node(s) changed.`);
if (changed.length > 0) {
console.log(new Date(), 'Posting to Gitter...');
gitter.post(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Gitter: Ok!');
});
console.log(new Date(), 'Notifying via Sendgrid...');
sendgrid.notify(changed, function(err) {
if (err) { throw err; }
console.log(new Date(), 'Sendgrid: Ok!');
});
}
});
});
});
| Print email recipients on startup | Print email recipients on startup
| JavaScript | mit | Starefossen/jenkins-monitor | ---
+++
@@ -10,6 +10,7 @@
const pkg = require('./package.json');
console.log(new Date(), `Staring ${pkg.name} v${pkg.version}`);
+console.log(new Date(), process.env.SENDGRID_RECIPIENTS.split(','));
schedule.scheduleJob(process.env.CRON_INTERVAL, function() {
console.log(new Date(), 'Running Cron Job...'); |
142a9cb38331f87429579aa8de83df6f581c13f4 | index.js | index.js | var boombox = require('boombox');
var test = boombox(require('tape'));
var signaller = require('rtc-signaller');
var WebSocket = require('ws');
var reTrailingSlash = /\/$/;
module.exports = function(opts) {
// initialise the server
var server = (opts || {}).server || 'http://rtc.io/switchboard';
// initialise the ws endpoint
var endpoint = (opts || {}).endpoint || '/primus';
var socket;
test('create the socket connection', function(t) {
t.plan(1);
// create a websocket connection to the target server
socket = new WebSocket(server.replace(reTrailingSlash, '') + endpoint);
t.ok(socket instanceof WebSocket, 'websocket instance created');
});
test('socket opened', function(t) {
t.plan(1);
socket.once('open', t.pass.bind(t, 'socket open'));
});
test('close connection', function(t) {
t.plan(1);
socket.close();
t.pass('closed');
});
}; | var boombox = require('boombox');
var test = boombox(require('tape'));
var signaller = require('rtc-signaller');
var reTrailingSlash = /\/$/;
module.exports = function(opts) {
// initialise the server
var server = (opts || {}).server || 'http://rtc.io/switchboard';
// determine the WebSocket constructor
var WS = (opts || {}).WebSocket ||
(typeof WebSocket != 'undefined' ? WebSocket : require('ws'));
// initialise the ws endpoint
var endpoint = (opts || {}).endpoint || '/primus';
var socket;
test('create the socket connection', function(t) {
t.plan(1);
// create a websocket connection to the target server
socket = new WS(server.replace(reTrailingSlash, '') + endpoint);
t.ok(socket instanceof WS, 'websocket instance created');
});
test('socket opened', function(t) {
t.plan(1);
socket.once('open', t.pass.bind(t, 'socket open'));
});
test('close connection', function(t) {
t.plan(1);
socket.close();
t.pass('closed');
});
}; | Allow configuration of the WebSocket constructor | Allow configuration of the WebSocket constructor
| JavaScript | apache-2.0 | rtc-io/rtc-signallercheck | ---
+++
@@ -1,12 +1,15 @@
var boombox = require('boombox');
var test = boombox(require('tape'));
var signaller = require('rtc-signaller');
-var WebSocket = require('ws');
var reTrailingSlash = /\/$/;
module.exports = function(opts) {
// initialise the server
var server = (opts || {}).server || 'http://rtc.io/switchboard';
+
+ // determine the WebSocket constructor
+ var WS = (opts || {}).WebSocket ||
+ (typeof WebSocket != 'undefined' ? WebSocket : require('ws'));
// initialise the ws endpoint
var endpoint = (opts || {}).endpoint || '/primus';
@@ -16,8 +19,8 @@
t.plan(1);
// create a websocket connection to the target server
- socket = new WebSocket(server.replace(reTrailingSlash, '') + endpoint);
- t.ok(socket instanceof WebSocket, 'websocket instance created');
+ socket = new WS(server.replace(reTrailingSlash, '') + endpoint);
+ t.ok(socket instanceof WS, 'websocket instance created');
});
test('socket opened', function(t) { |
11cf53b47d132fd936d4d4ceb21017a69139c2fa | index.js | index.js | var app = require("app"); // Module to control application life.
var BrowserWindow = require("browser-window"); // Module to create native browser window.
// Keep a global reference of the window object, if you don"t, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
// Quit when all windows are closed.
app.on("window-all-closed", function() {
app.quit();
});
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on("ready", function() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false,
"auto-hide-menu-bar": true,
icon: __dirname + "/static/images/icon.png"
});
// and load the index.html of the app.
mainWindow.loadUrl("file://" + __dirname + "/static/index.html");
// Emitted when the window is closed.
mainWindow.on("closed", function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
| var app = require("app"); // Module to control application life.
var BrowserWindow = require("browser-window"); // Module to create native browser window.
// Keep a global reference of the window object, if you don"t, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
// Prevent multiple instances of Down Quark
if (app.makeSingleInstance(function (commandLine, workingDirectory) {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
return true;
})) {
app.quit();
return;
}
// Quit when all windows are closed.
app.on("window-all-closed", function() {
app.quit();
});
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on("ready", function() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false,
"auto-hide-menu-bar": true,
icon: __dirname + "/static/images/icon.png"
});
// and load the index.html of the app.
mainWindow.loadUrl("file://" + __dirname + "/static/index.html");
// Emitted when the window is closed.
mainWindow.on("closed", function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
| Make it a single instance app | Make it a single instance app
| JavaScript | mit | doryphores/down-quark,doryphores/down-quark | ---
+++
@@ -4,6 +4,18 @@
// Keep a global reference of the window object, if you don"t, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
+
+// Prevent multiple instances of Down Quark
+if (app.makeSingleInstance(function (commandLine, workingDirectory) {
+ if (mainWindow) {
+ if (mainWindow.isMinimized()) mainWindow.restore();
+ mainWindow.focus();
+ }
+ return true;
+})) {
+ app.quit();
+ return;
+}
// Quit when all windows are closed.
app.on("window-all-closed", function() { |
46f0ac7f218c9daa002042bd1a4220cf1f985d1c | index.js | index.js | var postcss = require('postcss');
module.exports = postcss.plugin('postcss-prefixer-keyframes', function (opts) {
opts = opts || {};
var prefix = opts.prefix || '';
var usedKeyframes = [];
return function (css, result) {
/* Keyframes */
css.walkAtRules(/keyframes$/, function (keyframes) {
usedKeyframes.push(keyframes.params);
keyframes.params = String(prefix+keyframes.params);
});
css.walkDecls(/animation/, function (decl) {
var animationName = decl.value.split(' ');
if (usedKeyframes.indexOf(animationName[0]) > -1) {
animationName[0] = String(prefix + animationName[0]);
decl.value = animationName.join(' ');
}
});
};
});
| var postcss = require('postcss');
module.exports = postcss.plugin('postcss-prefixer-keyframes', function (opts) {
opts = opts || {};
var prefix = opts.prefix || '';
var usedKeyframes = [];
return function (css, result) {
/* Keyframes */
css.walkAtRules(/keyframes$/, function (keyframes) {
usedKeyframes.push(keyframes.params);
keyframes.params = String(prefix+keyframes.params);
});
css.walkDecls(/animation/, function (decl) {
var animations = decl.value.split(',');
for (var i=0; i<animations.length; i++) {
var animationName = animations[i].trim().split(' ');
console.log(animationName[0]);
if (usedKeyframes.indexOf(animationName[0]) > -1) {
animationName[0] = String(prefix + animationName[0]);
}
animations[i] = animationName.join(' ');
}
decl.value = animations.join(',');
});
};
});
| Fix animation prefix to work with multiple keyframes in one animation | Fix animation prefix to work with multiple keyframes in one animation
| JavaScript | bsd-2-clause | koala-framework/postcss-prefixer-keyframes | ---
+++
@@ -16,11 +16,17 @@
});
css.walkDecls(/animation/, function (decl) {
- var animationName = decl.value.split(' ');
- if (usedKeyframes.indexOf(animationName[0]) > -1) {
- animationName[0] = String(prefix + animationName[0]);
- decl.value = animationName.join(' ');
+ var animations = decl.value.split(',');
+
+ for (var i=0; i<animations.length; i++) {
+ var animationName = animations[i].trim().split(' ');
+ console.log(animationName[0]);
+ if (usedKeyframes.indexOf(animationName[0]) > -1) {
+ animationName[0] = String(prefix + animationName[0]);
+ }
+ animations[i] = animationName.join(' ');
}
+ decl.value = animations.join(',');
});
};
}); |
2f64cb13cf6cbcb42fa1fc26265209bd4d1ee7cc | webpack.config.base.js | webpack.config.base.js | 'use strict';
module.exports = {
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
output: {
library: 'Redux',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
};
| 'use strict';
module.exports = {
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
output: {
library: 'Stateful',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
};
| Fix typo from copying over configs. | Fix typo from copying over configs. | JavaScript | mit | TannerRogalsky/make-stateful | ---
+++
@@ -7,7 +7,7 @@
]
},
output: {
- library: 'Redux',
+ library: 'Stateful',
libraryTarget: 'umd'
},
resolve: { |
4e55c93cad255389acbf2c242ad34afcfd2c2df8 | internal/e2e/node/data_resolution.spec.js | internal/e2e/node/data_resolution.spec.js | const fs = require('fs');
const path = require('path');
describe('node data resolution', () => {
const relativeDataPath = './data/data.json';
it('should be able to resolve data files through relative paths', () => {
const resolvedRelativeDataPath = require.resolve(relativeDataPath);
const dataContent = fs.readFileSync(resolvedRelativeDataPath);
expect(JSON.parse(dataContent)).toEqual({ "value": 42 });
});
it('should be able to resolve data files through absolute paths', () => {
const resolvedAbsoluteDataPath = require.resolve(path.join(__dirname, relativeDataPath));
const dataContent = fs.readFileSync(resolvedAbsoluteDataPath);
expect(JSON.parse(dataContent)).toEqual({ "value": 42 });
});
it('should throw when resolving files that are outside the sandbox', () => {
if (process.platform.startsWith('win')) {
// On Windows, file location is the original one and not sandboxed.
// This means we cannot correctly exclude relative paths that aren't part of the runfiles.
return;
}
// This file exists in the source folder but is not in the data array.
expect(() => require.resolve('./data/missing-data.json')).toThrow();
});
}); | const fs = require('fs');
const path = require('path');
describe('node data resolution', () => {
const relativeDataPath = './data/data.json';
it('should be able to resolve data files through relative paths', () => {
const resolvedRelativeDataPath = require.resolve(relativeDataPath);
const dataContent = fs.readFileSync(resolvedRelativeDataPath);
expect(JSON.parse(dataContent)).toEqual({ "value": 42 });
});
it('should be able to resolve data files through absolute paths', () => {
const resolvedAbsoluteDataPath = require.resolve(path.join(__dirname, relativeDataPath));
const dataContent = fs.readFileSync(resolvedAbsoluteDataPath);
expect(JSON.parse(dataContent)).toEqual({ "value": 42 });
});
it('should throw when resolving files that are outside the sandbox', () => {
if (process.platform.startsWith('win')) {
// On Windows, file location is the original one and not sandboxed.
// This means we cannot correctly exclude relative paths that aren't part of the runfiles.
return;
}
// This file exists in the source folder but is not in the data array.
expect(() => require.resolve('./data/missing-data.json')).toThrow();
});
it('should be able to resolve paths relative to data files', () => {
if (process.platform.startsWith('win')) {
// On Windows, file location is the original one and not sandboxed.
// This means we cannot resolve paths relative to data files back to built files.
return;
}
const resolvedRelativeDataPath = require.resolve(relativeDataPath);
const thisFilePath = __filename;
const relativePathFromDataToThisFile = path.join('../', path.basename(thisFilePath));
const resolvedPathFromDataToThisFile = require.resolve(path.join(
path.dirname(resolvedRelativeDataPath), relativePathFromDataToThisFile));
expect(resolvedPathFromDataToThisFile).toEqual(thisFilePath);
});
}); | Add test for relative resolution from data files | Add test for relative resolution from data files
| JavaScript | apache-2.0 | bazelbuild/rules_nodejs,alexeagle/rules_nodejs,alexeagle/rules_nodejs,alexeagle/rules_nodejs,bazelbuild/rules_nodejs,alexeagle/rules_nodejs,bazelbuild/rules_nodejs,bazelbuild/rules_nodejs,bazelbuild/rules_nodejs | ---
+++
@@ -23,4 +23,19 @@
// This file exists in the source folder but is not in the data array.
expect(() => require.resolve('./data/missing-data.json')).toThrow();
});
+ it('should be able to resolve paths relative to data files', () => {
+ if (process.platform.startsWith('win')) {
+ // On Windows, file location is the original one and not sandboxed.
+ // This means we cannot resolve paths relative to data files back to built files.
+ return;
+ }
+
+ const resolvedRelativeDataPath = require.resolve(relativeDataPath);
+ const thisFilePath = __filename;
+ const relativePathFromDataToThisFile = path.join('../', path.basename(thisFilePath));
+ const resolvedPathFromDataToThisFile = require.resolve(path.join(
+ path.dirname(resolvedRelativeDataPath), relativePathFromDataToThisFile));
+
+ expect(resolvedPathFromDataToThisFile).toEqual(thisFilePath);
+ });
}); |
9c21763204b0cac5756a7c4168a1ccdf782fea54 | index.js | index.js | var grunt = require('grunt');
var makeOptions = function (options) {
var baseOptions = {
base: null,
prefix: 'grunt-',
verbose: false
};
if (options) {
for (var key in options) {
if (options.hasOwnProperty(key)) {
baseOptions[key] = options[key];
}
}
}
return baseOptions;
};
module.exports = function (gulp, options) {
var tasks = getTasks(options);
for (var name in tasks) {
if (tasks.hasOwnProperty(name)) {
var fn = tasks[name];
gulp.task(name, fn);
}
}
};
var getTasks = module.exports.tasks = function (options) {
var opt = makeOptions(options);
if (opt.base) {
grunt.file.setBase(opt.base);
}
grunt.task.init([]);
var gruntTasks = grunt.task._tasks,
finalTasks = {};
for (var name in gruntTasks) {
if (gruntTasks.hasOwnProperty(name)) {
(function (name) {
finalTasks[opt.prefix + name] = function (cb) {
if (opt.verbose) {
console.log('[grunt-gulp] Running Grunt "' + name + '" task...');
}
grunt.tasks([name], { force: true }, function () {
if (opt.verbose) {
grunt.log.ok('[grunt-gulp] Done running Grunt "' + name + '" task.');
}
cb();
});
};
})(name);
}
}
return finalTasks;
};
| var grunt = require('grunt');
var makeOptions = function (options) {
var baseOptions = {
base: null,
prefix: 'grunt-',
verbose: false
};
if (options) {
for (var key in options) {
if (options.hasOwnProperty(key)) {
baseOptions[key] = options[key];
}
}
}
return baseOptions;
};
module.exports = function (gulp, options) {
var tasks = getTasks(options);
for (var name in tasks) {
if (tasks.hasOwnProperty(name)) {
var fn = tasks[name];
gulp.task(name, fn);
}
}
};
var getTasks = module.exports.tasks = function (options) {
var opt = makeOptions(options);
if (opt.base) {
grunt.file.setBase(opt.base);
}
grunt.task.init([]);
var gruntTasks = grunt.task._tasks,
finalTasks = {};
for (var name in gruntTasks) {
if (gruntTasks.hasOwnProperty(name)) {
(function (name) {
finalTasks[opt.prefix + name] = function (cb) {
if (opt.verbose) {
console.log('[grunt-gulp] Running Grunt "' + name + '" task...');
}
grunt.util.spawn({
cmd: 'grunt',
args: [name, '--force']
}, function() {
if (opt.verbose) {
grunt.log.ok('[grunt-gulp] Done running Grunt "' + name + '" task.');
}
cb();
});
};
})(name);
}
}
return finalTasks;
};
| Use grunt.util.spawn to execute the grunt task. This makes sure grunt configuration set via grunt.option is properly read again | Use grunt.util.spawn to execute the grunt task. This makes sure grunt configuration set via grunt.option is properly read again
| JavaScript | mit | gratimax/gulp-grunt | ---
+++
@@ -50,13 +50,16 @@
if (opt.verbose) {
console.log('[grunt-gulp] Running Grunt "' + name + '" task...');
}
- grunt.tasks([name], { force: true }, function () {
+ grunt.util.spawn({
+ cmd: 'grunt',
+ args: [name, '--force']
+ }, function() {
if (opt.verbose) {
grunt.log.ok('[grunt-gulp] Done running Grunt "' + name + '" task.');
}
cb();
});
- };
+ };
})(name);
}
} |
30f3c76a882793a5bc2e4c0654e19af0ed540795 | index.js | index.js | 'use strict';
var asyncDone = require('async-done');
function settle(fn, done){
asyncDone(fn, function(error, result){
var settled = {};
if(error != null){
settled.state = 'error';
settled.value = error;
} else {
settled.state = 'success';
settled.value = result;
}
done(undefined, settled);
});
}
module.exports = settle;
| 'use strict';
var asyncDone = require('async-done');
function settle(fn, done){
asyncDone(fn, function(error, result){
var settled = {};
if(error != null){
settled.state = 'error';
settled.value = error;
} else {
settled.state = 'success';
settled.value = result;
}
done(null, settled);
});
}
module.exports = settle;
| Use null instead of undefined for errors | Update: Use null instead of undefined for errors
| JavaScript | mit | phated/async-settle,gulpjs/async-settle | ---
+++
@@ -14,7 +14,7 @@
settled.value = result;
}
- done(undefined, settled);
+ done(null, settled);
});
}
|
b89de7edfbcc8a1303b10173f26fc02640e2e68f | src/components/ProgressBar.js | src/components/ProgressBar.js | import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { TYPE } from './../utils/constant';
function ProgressBar({
delay,
isRunning,
closeToast,
type,
hide,
className,
rtl
}) {
const style = {
animationDuration: `${delay}ms`,
animationPlayState: isRunning ? 'running' : 'paused',
opacity: hide ? 0 : 1
};
style.WebkitAnimationPlayState = style.animationPlayState;
const classNames = cx(
'Toastify__progress-bar',
`Toastify__progress-bar--${type}`,
className,
{
'Toastify__progress-bar--rtl': rtl
}
);
return (
<div className={classNames} style={style} onAnimationEnd={closeToast} />
);
}
ProgressBar.propTypes = {
/**
* The animation delay which determine when to close the toast
*/
delay: PropTypes.number.isRequired,
/**
* Whether or not the animation is running or paused
*/
isRunning: PropTypes.bool.isRequired,
/**
* Func to close the current toast
*/
closeToast: PropTypes.func.isRequired,
/**
* Support rtl content
*/
rtl: PropTypes.bool.isRequired,
/**
* Optional type : info, success ...
*/
type: PropTypes.string,
/**
* Hide or not the progress bar
*/
hide: PropTypes.bool,
/**
* Optionnal className
*/
className: PropTypes.string
};
ProgressBar.defaultProps = {
type: TYPE.DEFAULT,
hide: false
};
export default ProgressBar;
| import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { TYPE } from './../utils/constant';
function ProgressBar({
delay,
isRunning,
closeToast,
type,
hide,
className,
rtl
}) {
const style = {
animationDuration: `${delay}ms`,
animationPlayState: isRunning ? 'running' : 'paused',
opacity: hide ? 0 : 1
};
const classNames = cx(
'Toastify__progress-bar',
`Toastify__progress-bar--${type}`,
className,
{
'Toastify__progress-bar--rtl': rtl
}
);
return (
<div className={classNames} style={style} onAnimationEnd={closeToast} />
);
}
ProgressBar.propTypes = {
/**
* The animation delay which determine when to close the toast
*/
delay: PropTypes.number.isRequired,
/**
* Whether or not the animation is running or paused
*/
isRunning: PropTypes.bool.isRequired,
/**
* Func to close the current toast
*/
closeToast: PropTypes.func.isRequired,
/**
* Support rtl content
*/
rtl: PropTypes.bool.isRequired,
/**
* Optional type : info, success ...
*/
type: PropTypes.string,
/**
* Hide or not the progress bar
*/
hide: PropTypes.bool,
/**
* Optionnal className
*/
className: PropTypes.string
};
ProgressBar.defaultProps = {
type: TYPE.DEFAULT,
hide: false
};
export default ProgressBar;
| Remove webkit prefix, not needed anymore | Remove webkit prefix, not needed anymore
| JavaScript | mit | fkhadra/react-toastify,sniphpet/react-toastify,fkhadra/react-toastify,fkhadra/react-toastify,fkhadra/react-toastify,sniphpet/react-toastify | ---
+++
@@ -18,7 +18,6 @@
animationPlayState: isRunning ? 'running' : 'paused',
opacity: hide ? 0 : 1
};
- style.WebkitAnimationPlayState = style.animationPlayState;
const classNames = cx(
'Toastify__progress-bar', |
8673625754c127e6edbdddf71fd4043d0d94fedc | index.js | index.js | 'use strict';
module.exports = function (str, opts) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
opts = opts || {};
return str + ' & ' + (opts.postfix || 'rainbows');
};
| 'use strict';
var empty = require('is-empty');
var trim = require('trim');
module.exports = function (id, lang) {
// Check if id is string and not empty.
if (typeof id !== 'string') {
throw new TypeError('Expected a string for id.');
}
if ( empty(id) ) {
throw new TypeError('The application id mustn\'t be empty.');
} else {
// Remove leading/trailing white space.
id = 'id=' + trim(id);
}
// Check if lang is string and not empty.
if (typeof lang !== 'string') {
lang = '';
}
if ( ! empty(lang) ) {
lang = '&hl=' + trim(lang);
}
return 'https://play.google.com/store/apps/details?' + id + lang;
};
| Return google play store links with or without language specification. | Return google play store links with or without language specification.
| JavaScript | mit | xipasduarte/google-store-link | ---
+++
@@ -1,10 +1,27 @@
'use strict';
-module.exports = function (str, opts) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
+var empty = require('is-empty');
+var trim = require('trim');
+
+module.exports = function (id, lang) {
+
+ // Check if id is string and not empty.
+ if (typeof id !== 'string') {
+ throw new TypeError('Expected a string for id.');
+ }
+ if ( empty(id) ) {
+ throw new TypeError('The application id mustn\'t be empty.');
+ } else {
+ // Remove leading/trailing white space.
+ id = 'id=' + trim(id);
}
- opts = opts || {};
+ // Check if lang is string and not empty.
+ if (typeof lang !== 'string') {
+ lang = '';
+ }
+ if ( ! empty(lang) ) {
+ lang = '&hl=' + trim(lang);
+ }
- return str + ' & ' + (opts.postfix || 'rainbows');
+ return 'https://play.google.com/store/apps/details?' + id + lang;
}; |
028069d0a5ef3564d6f0c7cbcf5bec9000c3324b | src/demoFolderStructure.js | src/demoFolderStructure.js | import { ItemTypes } from './constants';
const demoFolderStructure = {
0: {
type: ItemTypes.ROOT,
content: [1, 7]
},
1: {
type: ItemTypes.FOLDER,
name: 'Answers',
content: [2, 3, 6]
},
2: {
type: ItemTypes.FOLDER,
name: 'Read',
content: []
},
3: {
type: ItemTypes.FOLDER,
name: 'Unread',
content: [4, 8, 9, 5, 10, 11]
},
4: {
type: ItemTypes.FOLDER,
name: 'Empty Folder',
content: []
},
5: {
type: ItemTypes.FILE,
name: 'From Baleog.msg'
},
6: {
type: ItemTypes.FILE,
name: 'From Olaf.msg'
},
7: {
type: ItemTypes.FILE,
name: 'From Erik.msg'
},
8: {
type: ItemTypes.FILE,
name: 'From Balrog.msg'
},
9: {
type: ItemTypes.FOLDER,
name: 'Another Folder',
content: []
},
10: {
type: ItemTypes.FILE,
name: 'Gandalf'
},
11: {
type: ItemTypes.FILE,
name: 'Frodo'
}
};
export default demoFolderStructure;
| import { ItemTypes } from './constants';
const demoFolderStructure = {
0: {
type: ItemTypes.ROOT,
content: [1, 7]
},
1: {
type: ItemTypes.FOLDER,
name: 'Folder 1',
content: [2, 3, 6]
},
2: {
type: ItemTypes.FOLDER,
name: 'Folder 2',
content: []
},
3: {
type: ItemTypes.FOLDER,
name: 'Folder 3',
content: [4, 8, 9, 5, 10, 11]
},
4: {
type: ItemTypes.FOLDER,
name: 'Folder 4',
content: []
},
5: {
type: ItemTypes.FILE,
name: 'File 5'
},
6: {
type: ItemTypes.FILE,
name: 'File 6'
},
7: {
type: ItemTypes.FILE,
name: 'File 7'
},
8: {
type: ItemTypes.FILE,
name: 'File 8'
},
9: {
type: ItemTypes.FOLDER,
name: 'Folder 9',
content: []
},
10: {
type: ItemTypes.FILE,
name: 'File 10'
},
11: {
type: ItemTypes.FILE,
name: 'File 11'
}
};
export default demoFolderStructure;
| Rename items in demo folder structure | Rename items in demo folder structure
| JavaScript | mit | zhukov-maxim/tree-dnd,zhukov-maxim/tree-dnd | ---
+++
@@ -7,52 +7,52 @@
},
1: {
type: ItemTypes.FOLDER,
- name: 'Answers',
+ name: 'Folder 1',
content: [2, 3, 6]
},
2: {
type: ItemTypes.FOLDER,
- name: 'Read',
+ name: 'Folder 2',
content: []
},
3: {
type: ItemTypes.FOLDER,
- name: 'Unread',
+ name: 'Folder 3',
content: [4, 8, 9, 5, 10, 11]
},
4: {
type: ItemTypes.FOLDER,
- name: 'Empty Folder',
+ name: 'Folder 4',
content: []
},
5: {
type: ItemTypes.FILE,
- name: 'From Baleog.msg'
+ name: 'File 5'
},
6: {
type: ItemTypes.FILE,
- name: 'From Olaf.msg'
+ name: 'File 6'
},
7: {
type: ItemTypes.FILE,
- name: 'From Erik.msg'
+ name: 'File 7'
},
8: {
type: ItemTypes.FILE,
- name: 'From Balrog.msg'
+ name: 'File 8'
},
9: {
type: ItemTypes.FOLDER,
- name: 'Another Folder',
+ name: 'Folder 9',
content: []
},
10: {
type: ItemTypes.FILE,
- name: 'Gandalf'
+ name: 'File 10'
},
11: {
type: ItemTypes.FILE,
- name: 'Frodo'
+ name: 'File 11'
}
};
|
814a78288bdcf41f17c0de0ef2ef466288bdd1bd | index.js | index.js | 'use strict'
var svg = require('virtual-dom/virtual-hyperscript/svg')
var bezier = require('bezier-easing')
var Size = require('create-svg-size')
var Circle = require('./circle')
var Mask = require('./mask')
module.exports = Circles
function Circles (data) {
return function render (time) {
var mask = Mask(renderInner(data.radius, time))
var outer = renderOuter(data.radius, time, data.fill, mask.id)
var options = Size({x: data.radius * 2, y: data.radius * 2})
return svg('svg', options, [
mask.vtree,
outer
])
}
}
function renderInner (radius, time) {
var coefficient = 0.95 * curve(time < 0.5 ? time : 1 - time)
return Circle({
radius: radius * coefficient,
center: radius
})
}
function renderOuter (radius, time, fill, mask) {
var coefficent = curve(time < 0.5 ? 1 - time : time)
return Circle({
id: 'circle-bounce-circle',
radius: radius * coefficent,
center: radius,
fill: fill,
mask: mask
})
}
function curve (value) {
return bezier(0.10, 0.45, 0.9, 0.45).get(value)
}
| 'use strict'
var svg = require('virtual-dom/virtual-hyperscript/svg')
var bezier = require('bezier-easing')
var Size = require('create-svg-size')
var Circle = require('./circle')
var Mask = require('./mask')
module.exports = Circles
function Circles (data) {
return function render (time) {
var mask = Mask(renderInner(data.radius, time))
var outer = renderOuter(data.radius, time, data.fill, mask.id)
var options = Size({x: data.radius * 2, y: data.radius * 2})
return svg('svg', options, [
mask.vtree,
outer
])
}
}
function renderInner (radius, time) {
var coefficient = 0.95 * curve(time < 0.5 ? time : 1 - time)
return Circle({
radius: radius * coefficient,
center: radius
})
}
function renderOuter (radius, time, fill, mask) {
var coefficent = curve(time < 0.5 ? 1 - time : time)
return Circle({
id: 'circle-bounce-circle',
radius: radius * coefficent,
center: radius,
fill: fill,
mask: mask
})
}
function curve (value) {
return bezier(0, 0.5, 1, 0.5).get(value)
}
| Use a symmetric eazing curve with flat center | Use a symmetric eazing curve with flat center
| JavaScript | mit | bendrucker/circle-bounce | ---
+++
@@ -44,5 +44,5 @@
}
function curve (value) {
- return bezier(0.10, 0.45, 0.9, 0.45).get(value)
+ return bezier(0, 0.5, 1, 0.5).get(value)
} |
26d316fd8a5e431f7ef5d2a19eae86e6cc0f919c | index.js | index.js | wrapAsync = (Meteor.wrapAsync)? Meteor.wrapAsync : Meteor._wrapAsync;
Mongo.Collection.prototype.aggregate = function(pipelines) {
var coll = MongoInternals.defaultRemoteCollectionDriver().mongo.db.collection(this._name);
return wrapAsync(coll.aggregate.bind(coll))(pipelines);
}
| wrapAsync = (Meteor.wrapAsync)? Meteor.wrapAsync : Meteor._wrapAsync;
Mongo.Collection.prototype.aggregate = function(pipelines) {
var coll;
if (undefined !== this.rawCollection) {
// >= Meteor 1.0.4
coll = this.rawCollection();
} else {
// < Meteor 1.0.4
coll = this._getCollection();
}
return wrapAsync(coll.aggregate.bind(coll))(pipelines);
}
| Use exposed method not a hack, and make backwards compatable | Use exposed method not a hack, and make backwards compatable
| JavaScript | mit | meteorhacks/meteor-aggregate,Philip-Nunoo/meteor-aggregate | ---
+++
@@ -1,5 +1,12 @@
wrapAsync = (Meteor.wrapAsync)? Meteor.wrapAsync : Meteor._wrapAsync;
Mongo.Collection.prototype.aggregate = function(pipelines) {
- var coll = MongoInternals.defaultRemoteCollectionDriver().mongo.db.collection(this._name);
+ var coll;
+ if (undefined !== this.rawCollection) {
+ // >= Meteor 1.0.4
+ coll = this.rawCollection();
+ } else {
+ // < Meteor 1.0.4
+ coll = this._getCollection();
+ }
return wrapAsync(coll.aggregate.bind(coll))(pipelines);
} |
e6cdb4e94a8e9ac108da2a10a5e1dfd14c10dee1 | _config/task.svgs.js | _config/task.svgs.js | /* jshint node: true */
'use strict';
function getTaskConfig(projectConfig) {
var taskConfig = {
svgSrc: projectConfig.paths.src.svgs + '**/*.svg',
outDir: '',
settings: {
"dest": "",
"mode": {
"css": {
"dest": projectConfig.paths.src.sass + "/_objects",
"sprite": process.cwd() + '/' + projectConfig.paths.dest.svgs + '/svgsprite.svg',
"render": {
"scss": {
'dest': "_objects.svgsprite.scss"
}
},
"layout": "packed",
"prefix": ".svgsprite--%s",
"dimensions": "__dimensions",
"bust": true
}
}
}
}
return taskConfig;
}
module.exports = getTaskConfig; | /* jshint node: true */
'use strict';
var path = require('path');
function getTaskConfig(projectConfig) {
var taskConfig = {
svgSrc: projectConfig.paths.src.svgs + '**/*.svg',
outDir: '',
settings: {
dest: '', // If using modes, leave this empty and configure on a mode level - determines where to put the SVG symbol/css sprite/def
mode: {
css: {
dest: projectConfig.paths.src.sass + '/_tools', // where it specifically puts the css file (not where it'd put the def / symbol etc)
sprite: path.join(process.cwd(), projectConfig.paths.dest.images, '/sprite.svg'), // where it puts the svg file and what it names it
layout: 'packed', // default - layout of svg in the sprite
prefix: '.svgsprite--%s', // custom - prefix for svg classes
dimensions: '__dimensions', // custom - suffix for dimensions class e.g. .svg--hamburger__dimensions
bust: false, // default - cache busting,
render: {
scss: { // make it render scss and not css
dest: '_tools.svg-sprite.scss', // scss file name
template: path.join(process.cwd(), projectConfig.paths.src.images, '/svg-sprite-sass.tpl')
}
}
}
},
shape: {
spacing: { // Spacing related options
padding: 4, // Padding around all shapes
box: 'content' // Padding strategy (similar to CSS `box-sizing`)
}
}
}
}
return taskConfig;
}
module.exports = getTaskConfig; | Update default svg config to include scss render, template file | feat: Update default svg config to include scss render, template file
| JavaScript | mit | jtuds/cartridge-svgs,cartridge/cartridge-svgs | ---
+++
@@ -1,29 +1,37 @@
/* jshint node: true */
'use strict';
+
+var path = require('path');
function getTaskConfig(projectConfig) {
var taskConfig = {
svgSrc: projectConfig.paths.src.svgs + '**/*.svg',
outDir: '',
-
settings: {
- "dest": "",
- "mode": {
- "css": {
- "dest": projectConfig.paths.src.sass + "/_objects",
- "sprite": process.cwd() + '/' + projectConfig.paths.dest.svgs + '/svgsprite.svg',
- "render": {
- "scss": {
- 'dest': "_objects.svgsprite.scss"
- }
- },
- "layout": "packed",
- "prefix": ".svgsprite--%s",
- "dimensions": "__dimensions",
- "bust": true
- }
- }
+ dest: '', // If using modes, leave this empty and configure on a mode level - determines where to put the SVG symbol/css sprite/def
+ mode: {
+ css: {
+ dest: projectConfig.paths.src.sass + '/_tools', // where it specifically puts the css file (not where it'd put the def / symbol etc)
+ sprite: path.join(process.cwd(), projectConfig.paths.dest.images, '/sprite.svg'), // where it puts the svg file and what it names it
+ layout: 'packed', // default - layout of svg in the sprite
+ prefix: '.svgsprite--%s', // custom - prefix for svg classes
+ dimensions: '__dimensions', // custom - suffix for dimensions class e.g. .svg--hamburger__dimensions
+ bust: false, // default - cache busting,
+ render: {
+ scss: { // make it render scss and not css
+ dest: '_tools.svg-sprite.scss', // scss file name
+ template: path.join(process.cwd(), projectConfig.paths.src.images, '/svg-sprite-sass.tpl')
+ }
+ }
+ }
+ },
+ shape: {
+ spacing: { // Spacing related options
+ padding: 4, // Padding around all shapes
+ box: 'content' // Padding strategy (similar to CSS `box-sizing`)
+ }
+ }
}
} |
2d1c5f5e42690117bc49ba2efa2d00ce55eda89a | app/components/em-modal.js | app/components/em-modal.js | import Ember from 'ember';
import $ from 'jquery';
export default Ember.Component.extend({
attributeBindings: ['role'],
didInsertElement () {
const $emEl = this.$();
const $modalBtn = $('[em-modal-open]');
$emEl.attr('role', 'dialog');
$modalBtn.click(() => {
$emEl.fadeIn(100);
});
$emEl.click(event => {
if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
$emEl.fadeOut(100);
}
});
}
});
| import Ember from 'ember';
import $ from 'jquery';
export default Ember.Component.extend({
attributeBindings: ['role'],
didInsertElement () {
const $Element = this.$();
const $modalBtn = $('[em-modal-open]');
$Element.attr('role', 'dialog');
$modalBtn.click(() => {
$Element.fadeIn(100);
this.lockBackground($Element);
});
$Element.click(event => {
if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
$Element.fadeOut(100);
}
});
},
lockBackground (el) {
const focusableElementQuery = 'select:not([disabled]), button:not([disabled]), [tabindex="0"], input:not([disabled]), a[href]';
const backgroundActiveEl = document.activeElement;
const focusableElements = el.find(focusableElementQuery);
const firstEl = focusableElements[0];
const lastEl = focusableElements[focusableElements.length - 1];
// Focus first element in modal
firstEl.focus();
el.keydown(event => {
// If Esc pressed
if (event.keyCode === 27) {
el.fadeOut(100);
return backgroundActiveEl.focus();
}
// Trap Tab key while modal open
this.trapTabKey(event, firstEl, lastEl);
});
},
trapTabKey (event, ...params) {
const [ firstEl, lastEl ] = params;
if (event.keyCode === 9) {
if (event.shiftKey) {
if (document.activeElement === firstEl) {
event.preventDefault();
return lastEl.focus();
}
} else {
if (document.activeElement === lastEl) {
event.preventDefault();
return firstEl.focus();
}
}
}
}
});
| Add trap tab key functionality to modal | feat: Add trap tab key functionality to modal
| JavaScript | mit | pe1te3son/spendings-tracker,pe1te3son/spendings-tracker | ---
+++
@@ -4,18 +4,58 @@
export default Ember.Component.extend({
attributeBindings: ['role'],
didInsertElement () {
- const $emEl = this.$();
+ const $Element = this.$();
const $modalBtn = $('[em-modal-open]');
- $emEl.attr('role', 'dialog');
+ $Element.attr('role', 'dialog');
$modalBtn.click(() => {
- $emEl.fadeIn(100);
+ $Element.fadeIn(100);
+ this.lockBackground($Element);
});
- $emEl.click(event => {
+ $Element.click(event => {
if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
- $emEl.fadeOut(100);
+ $Element.fadeOut(100);
}
});
+ },
+
+ lockBackground (el) {
+ const focusableElementQuery = 'select:not([disabled]), button:not([disabled]), [tabindex="0"], input:not([disabled]), a[href]';
+ const backgroundActiveEl = document.activeElement;
+ const focusableElements = el.find(focusableElementQuery);
+ const firstEl = focusableElements[0];
+ const lastEl = focusableElements[focusableElements.length - 1];
+
+ // Focus first element in modal
+ firstEl.focus();
+ el.keydown(event => {
+ // If Esc pressed
+ if (event.keyCode === 27) {
+ el.fadeOut(100);
+ return backgroundActiveEl.focus();
+ }
+
+ // Trap Tab key while modal open
+ this.trapTabKey(event, firstEl, lastEl);
+ });
+ },
+
+ trapTabKey (event, ...params) {
+ const [ firstEl, lastEl ] = params;
+
+ if (event.keyCode === 9) {
+ if (event.shiftKey) {
+ if (document.activeElement === firstEl) {
+ event.preventDefault();
+ return lastEl.focus();
+ }
+ } else {
+ if (document.activeElement === lastEl) {
+ event.preventDefault();
+ return firstEl.focus();
+ }
+ }
+ }
}
}); |
c7626a6c9a44387d736d6b3cea78941d7c170927 | test/e2e/_sharedSpec.js | test/e2e/_sharedSpec.js | protractor.expect = {
challengeSolved: function (context) {
describe('(shared)', () => {
beforeEach(() => {
browser.get('/#/score-board')
})
it("challenge '" + context.challenge + "' should be solved on score board", () => {
expect(element(by.id(context.challenge + '.solved')).getAttribute('hidden')).toBeFalsy()
expect(element(by.id(context.challenge + '.notSolved')).getAttribute('hidden')).toBeTruthy()
})
})
}
}
protractor.beforeEach = {
login: function (context) {
let oldToken
describe('(shared)', () => {
beforeEach(() => {
oldToken = localStorage.getItem('token')
browser.get('/#/login')
element(by.id('email')).sendKeys(context.email)
element(by.id('password')).sendKeys(context.password)
element(by.id('loginButton')).click()
})
it('should have logged in user "' + context.email + '" with password "' + context.password + '"', () => {
expect(localStorage.getItem('token')).not.toMatch(oldToken)
})
})
}
}
| protractor.expect = {
challengeSolved: function (context) {
describe('(shared)', () => {
beforeEach(() => {
browser.get('/#/score-board')
})
it("challenge '" + context.challenge + "' should be solved on score board", () => {
expect(element(by.id(context.challenge + '.solved')).getAttribute('hidden')).toBeFalsy()
expect(element(by.id(context.challenge + '.notSolved')).getAttribute('hidden')).toBeTruthy()
})
})
}
}
protractor.beforeEach = {
login: function (context) {
describe('(shared)', () => {
beforeEach(() => {
browser.get('/#/login')
element(by.id('email')).sendKeys(context.email)
element(by.id('password')).sendKeys(context.password)
element(by.id('loginButton')).click()
})
it('should have logged in user "' + context.email + '" with password "' + context.password + '"', () => {
expect(browser.getCurrentUrl()).toMatch(/\/search/) // TODO Instead check for uib-tooltip of <i> with fa-user-circle
})
})
}
}
| Switch back to login check via location compare | Switch back to login check via location compare
(where staying on login means failed login and success
resulted in forward to search results)
| JavaScript | mit | bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop | ---
+++
@@ -15,10 +15,8 @@
protractor.beforeEach = {
login: function (context) {
- let oldToken
describe('(shared)', () => {
beforeEach(() => {
- oldToken = localStorage.getItem('token')
browser.get('/#/login')
element(by.id('email')).sendKeys(context.email)
element(by.id('password')).sendKeys(context.password)
@@ -26,7 +24,7 @@
})
it('should have logged in user "' + context.email + '" with password "' + context.password + '"', () => {
- expect(localStorage.getItem('token')).not.toMatch(oldToken)
+ expect(browser.getCurrentUrl()).toMatch(/\/search/) // TODO Instead check for uib-tooltip of <i> with fa-user-circle
})
})
} |
d6f090b2214b5c05b4d85899f3ecf38e89d4eab3 | lib/grunt/task/lint.js | lib/grunt/task/lint.js | 'use strict';
var helper = require('../helper');
/**
* Defines all linting task.
*
* @function
* @memberof! GruntLint
* @private
* @param {Object} grunt - The grunt instance
* @returns {Object} Grunt config object
*/
module.exports = function (grunt) {
grunt.registerTask('lint', 'Linting tasks.', [
'concurrent:lint'
]);
var lintTasks = [
'markdownlint:full',
'htmlhint:full',
'htmllint:full',
'csslint:full',
'jsonlint:full',
'jshint:full',
'jshint:test',
'jscs:full',
'jscs:test',
'filenames:full'
];
/*istanbul ignore next*/
if (global.build.options.buildConfig.es6Support) {
lintTasks = lintTasks.concat([
'stylelint:full',
'yaml_validator:full'
]);
}
/*istanbul ignore next*/
if (global.build.options.buildConfig.jslintEnabled) {
lintTasks = lintTasks.concat([
'jslint:full',
'jslint:test'
]);
}
/*istanbul ignore else*/
if (helper.isESlintSupported(global.build.options.buildConfig)) {
lintTasks = lintTasks.concat([
'eslint:full',
'eslint:test'
]);
}
return {
tasks: {
concurrent: {
lint: {
target: lintTasks
}
}
}
};
};
| 'use strict';
var helper = require('../helper');
/**
* Defines all linting task.
*
* @function
* @memberof! GruntLint
* @private
* @param {Object} grunt - The grunt instance
* @returns {Object} Grunt config object
*/
module.exports = function (grunt) {
grunt.registerTask('lint', 'Linting tasks.', [
'concurrent:lint'
]);
var lintTasks = [
'markdownlint:full',
'htmlhint:full',
'htmllint:full',
'csslint:full',
'jsonlint:full',
'jshint:full',
'jshint:test',
'jscs:full',
'jscs:test',
'filenames:full'
];
/*istanbul ignore next*/
if (global.build.options.buildConfig.es6Support) {
lintTasks.push('yaml_validator:full');
if (global.build.options.buildConfig.nodeMajorVersion >= 6) {
lintTasks.push('stylelint:full');
}
}
/*istanbul ignore next*/
if (global.build.options.buildConfig.jslintEnabled) {
lintTasks = lintTasks.concat([
'jslint:full',
'jslint:test'
]);
}
/*istanbul ignore else*/
if (helper.isESlintSupported(global.build.options.buildConfig)) {
lintTasks = lintTasks.concat([
'eslint:full',
'eslint:test'
]);
}
return {
tasks: {
concurrent: {
lint: {
target: lintTasks
}
}
}
};
};
| Add support of node >=6 grunt tasks | Add support of node >=6 grunt tasks
| JavaScript | apache-2.0 | sagiegurari/js-project-commons | ---
+++
@@ -31,10 +31,11 @@
/*istanbul ignore next*/
if (global.build.options.buildConfig.es6Support) {
- lintTasks = lintTasks.concat([
- 'stylelint:full',
- 'yaml_validator:full'
- ]);
+ lintTasks.push('yaml_validator:full');
+
+ if (global.build.options.buildConfig.nodeMajorVersion >= 6) {
+ lintTasks.push('stylelint:full');
+ }
}
/*istanbul ignore next*/ |
6b19a1cb7d20baebc8351a1348e9c3ad2d4142cc | apps/demoApp.js | apps/demoApp.js | var DemoApp = function(desktop) {
this.demoWindow = desktop.createWindow({
x: 50,
y: 50,
title: "Demo App!"
});
this.demoWindow.body.innerHTML = "<span class='posDisplay'>0, 0</span>";
this.on("tick", function() {
var posElement = this.demoWindow.body.querySelector(".posDisplay");
posElement.textContent = this.demoWindow.x + ", " + this.demoWindow.y;
});
};
DemoApp.shortname = "demoapp";
DemoApp.fullname = "Demo Application";
DemoApp.description = "Provides a demonstration of basic application functions";
module.exports = DemoApp;
| var DemoApp = function(desktop) {
this.demoWindow = desktop.createWindow(this, {
x: 50,
y: 50,
title: "Demo App!"
});
this.demoWindow.body.innerHTML = "<span class='posDisplay'>0, 0</span>";
this.on("tick", function() {
var posElement = this.demoWindow.body.querySelector(".posDisplay");
posElement.textContent = this.demoWindow.x + ", " + this.demoWindow.y;
});
};
DemoApp.shortname = "demoapp";
DemoApp.fullname = "Demo Application";
DemoApp.description = "Provides a demonstration of basic application functions";
module.exports = DemoApp;
| Fix createWindow call to reference app | Fix createWindow call to reference app
| JavaScript | mit | Thristhart/demotopical,Thristhart/demotopical | ---
+++
@@ -1,5 +1,5 @@
var DemoApp = function(desktop) {
- this.demoWindow = desktop.createWindow({
+ this.demoWindow = desktop.createWindow(this, {
x: 50,
y: 50,
title: "Demo App!" |
b003316b731566c6e9900f2dd966e2c8315c0eb2 | lib/gulp-notify-growl.js | lib/gulp-notify-growl.js | 'use strict';
var
growler = require('growler')
;
module.exports = function(applicationOptions) {
applicationOptions = applicationOptions || {};
var growl = new growler.GrowlApplication('Gulp', applicationOptions);
growl.setNotifications({
Gulp: {}
});
function notify(notificationOptions, callback) {
growl.register(function(success, err) {
if (!success) {
throw callback(err);
}
notificationOptions.text = notificationOptions.message;
delete notificationOptions.message;
growl.sendNotification('Gulp', notificationOptions, function(success, err) {
return callback(err, success);
});
});
}
return notify;
};
| 'use strict';
var
fs = require('fs'),
util = require('util'),
growler = require('growler')
;
module.exports = function(applicationOptions) {
applicationOptions = util._extend({
icon: fs.readFileSync(__dirname + '/gulp.png')
}, applicationOptions || {});
var growl = new growler.GrowlApplication('Gulp', applicationOptions);
growl.setNotifications({
Gulp: {}
});
function notify(notificationOptions, callback) {
growl.register(function(success, err) {
if (!success) {
throw callback(err);
}
// Rename 'message' property to 'text'
notificationOptions.text = notificationOptions.message;
delete notificationOptions.message;
growl.sendNotification('Gulp', notificationOptions, function(success, err) {
return callback(err, success);
});
});
}
return notify;
};
| Set gulp icon as default | Set gulp icon as default
| JavaScript | mit | yannickcr/gulp-notify-growl | ---
+++
@@ -1,12 +1,16 @@
'use strict';
var
+ fs = require('fs'),
+ util = require('util'),
growler = require('growler')
;
module.exports = function(applicationOptions) {
- applicationOptions = applicationOptions || {};
+ applicationOptions = util._extend({
+ icon: fs.readFileSync(__dirname + '/gulp.png')
+ }, applicationOptions || {});
var growl = new growler.GrowlApplication('Gulp', applicationOptions);
@@ -21,6 +25,7 @@
throw callback(err);
}
+ // Rename 'message' property to 'text'
notificationOptions.text = notificationOptions.message;
delete notificationOptions.message;
|
c300c2de2e2cbd9ccb91ac1fd9c5b3307751cf4a | lib/install/void-step.js | lib/install/void-step.js | 'use strict';
const BaseStep = require('./base-step');
module.exports = class VoidStep extends BaseStep {
start() {}
};
| 'use strict';
const BaseStep = require('./base-step');
module.exports = class VoidStep extends BaseStep {
start() { return new Promise(() => {}); }
};
| Return a promise from void step | Return a promise from void step
| JavaScript | bsd-3-clause | kiteco/kite-installer | ---
+++
@@ -3,5 +3,5 @@
const BaseStep = require('./base-step');
module.exports = class VoidStep extends BaseStep {
- start() {}
+ start() { return new Promise(() => {}); }
}; |
212e7e7c7996473269d89887fa156c33f89356ef | tools/isSdkDirectory.js | tools/isSdkDirectory.js | var fs = require('fs');
function isSdkDirectory() {
var cwd = process.cwd();
var data = fs.readdirSync(cwd);
data = data.map(item => item.toLowerCase());
if (data.indexOf('scripts') > -1 &&
data.indexOf('plugintester') &&
data.indexOf('plugins') > -1 &&
data.indexOf('package.json') > -1) {
return true;
}
return false;
}
module.exports = isSdkDirectory;
| var fs = require('fs');
function isSdkDirectory() {
var cwd = process.cwd();
var data = fs.readdirSync(cwd);
data = data.map(item => item.toLowerCase());
if (data.indexOf('scripts') > -1 &&
data.indexOf('plugintester') > -1 &&
data.indexOf('plugins') > -1 &&
data.indexOf('package.json') > -1) {
return true;
}
return false;
}
module.exports = isSdkDirectory;
| Resolve SDK directory check issue | Resolve SDK directory check issue
| JavaScript | mit | BuildFire/sdk-cli | ---
+++
@@ -8,7 +8,7 @@
data = data.map(item => item.toLowerCase());
if (data.indexOf('scripts') > -1 &&
- data.indexOf('plugintester') &&
+ data.indexOf('plugintester') > -1 &&
data.indexOf('plugins') > -1 &&
data.indexOf('package.json') > -1) {
return true; |
ac612a9cdcf81c713b4a2fadb3201980197a26ca | website/data/subnav.js | website/data/subnav.js | export default [
{
text: 'Use Cases',
submenu: [
{ text: 'Service Discovery', url: '/discovery' },
{ text: 'Service Mesh', url: '/mesh' },
],
},
{
text: 'Intro',
url: '/intro',
type: 'inbound',
},
{
text: 'Learn',
url: 'https://learn.hashicorp.com/consul',
type: 'outbound',
},
{
text: 'Docs',
url: '/docs',
type: 'inbound',
},
{
text: 'API',
url: '/api-docs',
type: 'inbound',
},
{
text: 'Community',
url: '/community',
type: 'inbound',
},
{
text: 'Enterprise',
url:
'https://www.hashicorp.com/products/consul/?utm_source=oss&utm_medium=header-nav&utm_campaign=consul',
type: 'outbound',
},
]
| export default [
{ text: 'Overview', url: '/', type: 'inbound' },
{
text: 'Use Cases',
submenu: [
{ text: 'Service Discovery', url: '/discovery' },
{ text: 'Service Mesh', url: '/mesh' },
],
},
{
text: 'Enterprise',
url:
'https://www.hashicorp.com/products/consul/?utm_source=oss&utm_medium=header-nav&utm_campaign=consul',
type: 'outbound',
},
'divider',
{
text: 'Learn',
url: 'https://learn.hashicorp.com/consul',
type: 'outbound',
},
{
text: 'Docs',
url: '/docs',
type: 'inbound',
},
{
text: 'API',
url: '/api-docs',
type: 'inbound',
},
{
text: 'Community',
url: '/community',
type: 'inbound',
},
]
| Adjust nav to new recommended layout. | Adjust nav to new recommended layout.
This removes "Intro", which is actually no longer the recommended
get-started place (Learn takes that spot).
Additionally, there is now a separator between the high level business
value stuff, and the low level developer stuff.
| JavaScript | mpl-2.0 | hashicorp/consul,hashicorp/consul,hashicorp/consul,hashicorp/consul | ---
+++
@@ -1,4 +1,5 @@
export default [
+ { text: 'Overview', url: '/', type: 'inbound' },
{
text: 'Use Cases',
submenu: [
@@ -7,10 +8,12 @@
],
},
{
- text: 'Intro',
- url: '/intro',
- type: 'inbound',
+ text: 'Enterprise',
+ url:
+ 'https://www.hashicorp.com/products/consul/?utm_source=oss&utm_medium=header-nav&utm_campaign=consul',
+ type: 'outbound',
},
+ 'divider',
{
text: 'Learn',
url: 'https://learn.hashicorp.com/consul',
@@ -31,10 +34,4 @@
url: '/community',
type: 'inbound',
},
- {
- text: 'Enterprise',
- url:
- 'https://www.hashicorp.com/products/consul/?utm_source=oss&utm_medium=header-nav&utm_campaign=consul',
- type: 'outbound',
- },
] |
cbf0ecfd75b096d0c3866c6e38c3465f2fcdd4ee | examples/vector-tile-info.js | examples/vector-tile-info.js | import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import MVT from '../src/ol/format/MVT.js';
import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import VectorTileSource from '../src/ol/source/VectorTile.js';
const map = new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
}),
layers: [new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
})
})]
});
map.on('pointermove', showInfo);
const info = document.getElementById('info');
function showInfo(event) {
const features = map.getFeaturesAtPixel(event.pixel);
if (!features) {
info.innerText = '';
info.style.opacity = 0;
return;
}
const properties = features[0].getProperties();
info.innerText = JSON.stringify(properties, null, 2);
info.style.opacity = 1;
}
| import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import MVT from '../src/ol/format/MVT.js';
import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import VectorTileSource from '../src/ol/source/VectorTile.js';
const map = new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
}),
layers: [new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
})
})]
});
map.on('pointermove', showInfo);
const info = document.getElementById('info');
function showInfo(event) {
const features = map.getFeaturesAtPixel(event.pixel);
if (features.length == 0) {
info.innerText = '';
info.style.opacity = 0;
return;
}
const properties = features[0].getProperties();
info.innerText = JSON.stringify(properties, null, 2);
info.style.opacity = 1;
}
| Update test for no features | Update test for no features | JavaScript | bsd-2-clause | geekdenz/openlayers,stweil/ol3,stweil/openlayers,oterral/ol3,stweil/openlayers,geekdenz/ol3,openlayers/openlayers,openlayers/openlayers,adube/ol3,oterral/ol3,geekdenz/ol3,geekdenz/openlayers,geekdenz/ol3,geekdenz/openlayers,stweil/ol3,bjornharrtell/ol3,stweil/ol3,adube/ol3,bjornharrtell/ol3,oterral/ol3,stweil/openlayers,ahocevar/openlayers,geekdenz/ol3,ahocevar/ol3,ahocevar/openlayers,ahocevar/openlayers,adube/ol3,stweil/ol3,bjornharrtell/ol3,ahocevar/ol3,ahocevar/ol3,openlayers/openlayers,ahocevar/ol3 | ---
+++
@@ -23,7 +23,7 @@
const info = document.getElementById('info');
function showInfo(event) {
const features = map.getFeaturesAtPixel(event.pixel);
- if (!features) {
+ if (features.length == 0) {
info.innerText = '';
info.style.opacity = 0;
return; |
d8e74ca29436e1efbf04124d893e1c0d8e542ec2 | Resources/js/settings-window.js | Resources/js/settings-window.js | 'use strict';
var app = angular.module('settingsWindow', ['schemaForm']);
app.run(function($rootScope) {
$rootScope.GUI = require('nw.gui');
$rootScope.AppName = $rootScope.GUI.App.manifest.name;
$rootScope.Version = $rootScope.GUI.App.manifest.version;
$rootScope.Window = $rootScope.GUI.Window.get();
$rootScope.Pussh = global.Pussh;
$rootScope.Window.focus();
});
app.controller('settings', function($scope, $rootScope) {
var Pussh = $rootScope.Pussh;
$scope.services = Pussh.services.list();
$scope.settings = Pussh.settings.get();
$scope.selectedService = Pussh.services.get($scope.settings.selectedService);
$scope.serviceSettings = $scope.selectedService.getSettings();
$scope.$watch('selectedService', function(service) {
$scope.settings.selectedService = service._name;
$scope.serviceSettings = $scope.selectedService.settings;
Pussh.settings.save();
});
$scope.$watch('settings', function() {
Pussh.settings.save();
}, true);
$scope.$watch('serviceSettings', function() {
$scope.selectedService.saveSettings();
}, true);
});
| 'use strict';
var app = angular.module('settingsWindow', []);
app.run(function($rootScope) {
$rootScope.GUI = require('nw.gui');
$rootScope.AppName = $rootScope.GUI.App.manifest.name;
$rootScope.Version = $rootScope.GUI.App.manifest.version;
$rootScope.Window = $rootScope.GUI.Window.get();
$rootScope.Pussh = global.Pussh;
$rootScope.Window.focus();
});
app.controller('settings', function($scope, $rootScope) {
var Pussh = $rootScope.Pussh;
$scope.services = Pussh.services.list();
$scope.settings = Pussh.settings.get();
$scope.selectedService = Pussh.services.get($scope.settings.selectedService);
$scope.serviceSettings = $scope.selectedService.getSettings();
$scope.$watch('selectedService', function(service) {
$scope.settings.selectedService = service._name;
$scope.serviceSettings = $scope.selectedService.settings;
Pussh.settings.save();
});
$scope.$watch('settings', function() {
Pussh.settings.save();
}, true);
$scope.$watch('serviceSettings', function() {
$scope.selectedService.saveSettings();
}, true);
});
| Remove loaded module which was removed | Remove loaded module which was removed
| JavaScript | mit | teak/Pussh,teak/Pussh,lukasmcd14/Pussh,lukasmcd14/Pussh,lukasmcd14/Pussh | ---
+++
@@ -1,6 +1,6 @@
'use strict';
-var app = angular.module('settingsWindow', ['schemaForm']);
+var app = angular.module('settingsWindow', []);
app.run(function($rootScope) {
$rootScope.GUI = require('nw.gui'); |
1b12dee6fb16fd27686f91ebad9dcf5a3c07b610 | backend/app/assets/javascripts/spree/backend/user_picker.js | backend/app/assets/javascripts/spree/backend/user_picker.js | $.fn.userAutocomplete = function () {
'use strict';
function formatUser(user) {
return Select2.util.escapeMarkup(user.email);
}
this.select2({
minimumInputLength: 1,
multiple: true,
initSelection: function (element, callback) {
Spree.ajax({
url: Spree.routes.users_api,
data: {
ids: element.val()
},
success: function(data) {
callback(data.users);
}
});
},
ajax: {
url: Spree.routes.users_api,
datatype: 'json',
params: { "headers": { "X-Spree-Token": Spree.api_key } },
data: function (term) {
return {
m: 'or',
email_start: term,
addresses_firstname_start: term,
addresses_lastname_start: term
};
},
results: function (data) {
return {
results: data.users,
more: data.current_page < data.pages
};
}
},
formatResult: formatUser,
formatSelection: formatUser
});
};
$(document).ready(function () {
$('.user_picker').userAutocomplete();
});
| $.fn.userAutocomplete = function () {
'use strict';
function formatUser(user) {
return Select2.util.escapeMarkup(user.email);
}
this.select2({
minimumInputLength: 1,
multiple: true,
initSelection: function (element, callback) {
Spree.ajax({
url: Spree.routes.users_api,
data: {
ids: element.val()
},
success: function(data) {
callback(data.users);
}
});
},
ajax: {
url: Spree.routes.users_api,
datatype: 'json',
params: { "headers": { "X-Spree-Token": Spree.api_key } },
data: function (term) {
return {
q: {
m: 'or',
email_start: term,
addresses_firstname_start: term,
addresses_lastname_start: term
}
};
},
results: function (data) {
return {
results: data.users,
more: data.current_page < data.pages
};
}
},
formatResult: formatUser,
formatSelection: formatUser
});
};
$(document).ready(function () {
$('.user_picker').userAutocomplete();
});
| Fix user picker search request | Fix user picker search request
The users API controller expects the search params to be contains in a
`q` node. | JavaScript | bsd-3-clause | jordan-brough/solidus,jordan-brough/solidus,jordan-brough/solidus,Arpsara/solidus,Arpsara/solidus,Arpsara/solidus,pervino/solidus,pervino/solidus,jordan-brough/solidus,pervino/solidus,pervino/solidus,Arpsara/solidus | ---
+++
@@ -25,10 +25,12 @@
params: { "headers": { "X-Spree-Token": Spree.api_key } },
data: function (term) {
return {
- m: 'or',
- email_start: term,
- addresses_firstname_start: term,
- addresses_lastname_start: term
+ q: {
+ m: 'or',
+ email_start: term,
+ addresses_firstname_start: term,
+ addresses_lastname_start: term
+ }
};
},
results: function (data) { |
0ae5aeb2d2fcfa9d443f70a30cb61ca90887e0fb | app/components/routes.js | app/components/routes.js | import React from 'react'
import { Router, Route, hashHistory } from 'react-router'
import App from './App'
import Home from './Home'
import Overview from './Overview'
import MatchReportContainer from './containers/MatchReportContainer'
import NewGameContainer from './containers/NewGameContainer'
import ScoreGameContainer from './containers/ScoreGameContainer'
import NewTeamContainer from './containers/NewTeamContainer'
import EditTeamContainer from './containers/EditTeamContainer'
import DashboardContainer from './containers/DashboardContainer'
export default (
<Router history={hashHistory}>
<Route path='/game/:id/score' component={ScoreGameContainer} />
<Route path='/' component={Home} />
<Route path='/' component={App}>
<Route path='/game/new' component={NewGameContainer} />
<Route path='/game' component={Overview} />
<Route path='/game/:id' component={Home} />
<Route path='/game/:id/report' component={MatchReportContainer} />
<Route path='/dashboard' component={DashboardContainer} />
<Route path='/team/new' component={NewTeamContainer} />
<Route path='/team/:id/edit' component={EditTeamContainer} />
</Route>
</Router>
)
| import React from 'react'
import { Router, Route, hashHistory } from 'react-router'
import App from './App'
import Home from './Home'
import Overview from './Overview'
import MatchReportContainer from './containers/MatchReportContainer'
import NewGameContainer from './containers/NewGameContainer'
import EditGameContainer from './containers/EditGameContainer'
import ScoreGameContainer from './containers/ScoreGameContainer'
import NewTeamContainer from './containers/NewTeamContainer'
import EditTeamContainer from './containers/EditTeamContainer'
import DashboardContainer from './containers/DashboardContainer'
export default (
<Router history={hashHistory}>
<Route path='/game/:id/score' component={ScoreGameContainer} />
<Route path='/' component={Home} />
<Route path='/' component={App}>
<Route path='/game' component={Overview} />
<Route path='/game/new' component={NewGameContainer} />
<Route path='/game/:id' component={Home} />
<Route path='/game/:id/report' component={MatchReportContainer} />
<Route path='/game/:id/edit' component={EditGameContainer} />
<Route path='/dashboard' component={DashboardContainer} />
<Route path='/team/new' component={NewTeamContainer} />
<Route path='/team/:id/edit' component={EditTeamContainer} />
</Route>
</Router>
)
| Make route to /game/:id/edit link to EditGame | Make route to /game/:id/edit link to EditGame
| JavaScript | mit | georgeF105/handball-scoring,georgeF105/handball-scoring | ---
+++
@@ -6,6 +6,7 @@
import Overview from './Overview'
import MatchReportContainer from './containers/MatchReportContainer'
import NewGameContainer from './containers/NewGameContainer'
+import EditGameContainer from './containers/EditGameContainer'
import ScoreGameContainer from './containers/ScoreGameContainer'
import NewTeamContainer from './containers/NewTeamContainer'
import EditTeamContainer from './containers/EditTeamContainer'
@@ -16,10 +17,11 @@
<Route path='/game/:id/score' component={ScoreGameContainer} />
<Route path='/' component={Home} />
<Route path='/' component={App}>
+ <Route path='/game' component={Overview} />
<Route path='/game/new' component={NewGameContainer} />
- <Route path='/game' component={Overview} />
<Route path='/game/:id' component={Home} />
<Route path='/game/:id/report' component={MatchReportContainer} />
+ <Route path='/game/:id/edit' component={EditGameContainer} />
<Route path='/dashboard' component={DashboardContainer} />
<Route path='/team/new' component={NewTeamContainer} />
<Route path='/team/:id/edit' component={EditTeamContainer} /> |
6a18f6e67ee4f43d841d7951c3466cbef5d20133 | app/config/styles.js | app/config/styles.js | import { StyleSheet } from 'react-native';
const theme = {
colours: {
primary: '#fbb632',
secondary: '#2c2c2c',
dark: '#212121',
light: '#bebebe',
}
}
const navigatorStyle = {
navBarTextColor: 'white',
navBarBackgroundColor: theme.colours.dark
}
const appStyles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#141414',
},
card: {
flex: 1,
margin: 10,
backgroundColor: theme.colours.secondary,
borderColor: theme.colours.secondary,
borderWidth: 0,
borderRadius: 4,
shadowOffset: { width: 0, height: 2 },
shadowRadius: 1.5,
shadowOpacity: 0.5,
shadowColor: '#666666'
}
});
export default appStyles;
export { theme, navigatorStyle }; | import { StyleSheet } from 'react-native';
const theme = {
colours: {
primary: '#fbb632',
secondary: '#2c2c2c',
dark: '#212121',
light: '#bebebe',
}
}
const navigatorStyle = {
navBarTextColor: 'white',
navBarBackgroundColor: theme.colours.dark
}
const appStyles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#141414',
},
card: {
flex: 1,
margin: 10,
backgroundColor: theme.colours.secondary,
borderColor: '#414141',
borderWidth: 0,
borderBottomWidth: 2,
borderRadius: 3
}
});
export default appStyles;
export { theme, navigatorStyle }; | Use borderBottom instead of shadow for cards | Use borderBottom instead of shadow for cards
| JavaScript | mit | akilb/rukatuk-mobile,akilb/rukatuk-mobile,akilb/rukatuk-mobile,akilb/rukatuk-mobile,akilb/rukatuk-mobile | ---
+++
@@ -24,13 +24,10 @@
flex: 1,
margin: 10,
backgroundColor: theme.colours.secondary,
- borderColor: theme.colours.secondary,
+ borderColor: '#414141',
borderWidth: 0,
- borderRadius: 4,
- shadowOffset: { width: 0, height: 2 },
- shadowRadius: 1.5,
- shadowOpacity: 0.5,
- shadowColor: '#666666'
+ borderBottomWidth: 2,
+ borderRadius: 3
}
});
|
db86bf349127f51f7199ff12edf72d9483d9fbe4 | packages/lesswrong/lib/modules/alignment-forum/comments/custom_fields.js | packages/lesswrong/lib/modules/alignment-forum/comments/custom_fields.js | import { Comments } from "meteor/example-forum";
Comments.addField([
// This commment will appear in alignment forum view
{
fieldName: 'af',
fieldSchema: {
type: Boolean,
optional: true,
label: "Alignment Forum",
defaultValue: false,
viewableBy: ['guests'],
editableBy: ['alignmentForum'],
insertableBy: ['alignmentForum'],
control: 'AlignmentCheckbox'
}
},
{
fieldName: 'afBaseScore',
fieldSchema: {
type: Number,
optional: true,
label: "Alignment Base Score",
viewableBy: ['guests'],
}
},
])
| import { Comments } from "meteor/example-forum";
Comments.addField([
// This commment will appear in alignment forum view
{
fieldName: 'af',
fieldSchema: {
type: Boolean,
optional: true,
label: "Alignment Forum",
defaultValue: false,
viewableBy: ['guests'],
editableBy: ['alignmentVoters'],
insertableBy: ['alignmentVoters'],
control: 'AlignmentCheckbox'
}
},
{
fieldName: 'afBaseScore',
fieldSchema: {
type: Number,
optional: true,
label: "Alignment Base Score",
viewableBy: ['guests'],
}
},
])
| Comment UI appears on AF for users if they own the post and have at least 1 AF Karma, but not if they don't. | Comment UI appears on AF for users if they own the post and have at least 1 AF Karma, but not if they don't.
| JavaScript | mit | Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope | ---
+++
@@ -10,8 +10,8 @@
label: "Alignment Forum",
defaultValue: false,
viewableBy: ['guests'],
- editableBy: ['alignmentForum'],
- insertableBy: ['alignmentForum'],
+ editableBy: ['alignmentVoters'],
+ insertableBy: ['alignmentVoters'],
control: 'AlignmentCheckbox'
}
}, |
c56f979acc1fb4dc262d61c418f9513c778aeaa4 | route-urls.js | route-urls.js | var m = angular.module("routeUrls", []);
m.factory("urls", function($route) {
var pathsByName = {};
angular.forEach($route.routes, function (route, path) {
if (route.name) {
pathsByName[route.name] = path;
}
});
var path = function (name, params) {
var url = pathsByName[name] || "/";
angular.forEach(params || {}, function (value, key) {
url = url.replace(new RegExp(":" + key + "(?=/|$)"), value);
});
return url;
};
return {
path: path,
href: function (name, params) {
return "#" + path(name, params);
}
};
});
| var m = angular.module("routeUrls", []);
m.factory("urls", function($route) {
var pathsByName = {};
angular.forEach($route.routes, function (route, path) {
if (route.name) {
pathsByName[route.name] = path;
}
});
var regexs = {};
var path = function (name, params) {
var url = pathsByName[name] || "/";
angular.forEach(params || {}, function (value, key) {
var regex = regexs[key];
if (regex === undefined) {
regex = regexs[key] = new RegExp(":" + key + "(/|$)");
}
url = url.replace(regex, value);
});
return url;
};
return {
path: path,
href: function (name, params) {
return "#" + path(name, params);
}
};
});
| Improve ui responsiveness if urls.path is databound | Improve ui responsiveness if urls.path is databound | JavaScript | mit | emgee/angular-route-urls,emgee/angular-route-urls | ---
+++
@@ -9,10 +9,17 @@
}
});
+ var regexs = {};
+
var path = function (name, params) {
var url = pathsByName[name] || "/";
angular.forEach(params || {}, function (value, key) {
- url = url.replace(new RegExp(":" + key + "(?=/|$)"), value);
+ var regex = regexs[key];
+
+ if (regex === undefined) {
+ regex = regexs[key] = new RegExp(":" + key + "(/|$)");
+ }
+ url = url.replace(regex, value);
});
return url;
}; |
a8f02f769f095556a82f954e30b89ba22d31769f | ode/public/js/ode.js | ode/public/js/ode.js | $(document).ready(function() {
$("#new-feature").hide();
$(".edit-feature").hide();
$("#new-feature-button").on("click", function(event) {
event.preventDefault();
$(this).hide();
$("#interaction-block").html($("#new-feature").html());
});
$(".feature-item").on("click", function(event) {
event.preventDefault();
$("#interaction-block").html($("#"+$(this).text()).html());
$("#new-feature-button").show();
});
$("#feature-filter").on("keyup", function(event) {
// ...
});
$("#value-filter").on("keyup", function(event) {
// ...
});
});
| $(document).ready(function() {
$("#new-feature").hide();
$(".edit-feature").hide();
$("#new-feature-button").on("click", function(event) {
event.preventDefault();
$(this).hide();
$(".alert").hide();
$("#interaction-block").html($("#new-feature").html());
});
$(".feature-item").on("click", function(event) {
event.preventDefault();
$(".alert").hide();
$("#interaction-block").html($("#"+$(this).text()).html());
$("#new-feature-button").show();
});
$("#feature-filter").on("keyup", function(event) {
// ...
});
$("#value-filter").on("keyup", function(event) {
// ...
});
});
| Hide any alerts when user starts to interact with "Features" page again after completing an action. | Hide any alerts when user starts to interact with "Features" page again
after completing an action.
| JavaScript | agpl-3.0 | itsjeyd/ODE,itsjeyd/ODE,itsjeyd/ODE,itsjeyd/ODE | ---
+++
@@ -6,11 +6,13 @@
$("#new-feature-button").on("click", function(event) {
event.preventDefault();
$(this).hide();
+ $(".alert").hide();
$("#interaction-block").html($("#new-feature").html());
});
$(".feature-item").on("click", function(event) {
event.preventDefault();
+ $(".alert").hide();
$("#interaction-block").html($("#"+$(this).text()).html());
$("#new-feature-button").show();
}); |
2d5b22f05271bf73dccbfb3c093ae9b45fa604cc | public/main.js | public/main.js | // Set the RequireJS configuration
require.config({
paths : {
"use" : "libs/use",
"text" : "libs/text",
"jquery" : "libs/jquery",
"underscore" : "libs/underscore",
"backbone" : "libs/backbone",
"handlebars" : "libs/handlebars-1.0.0.beta.6"
},
use : {
"underscore" : {
attach : "_"
},
"backbone" : {
deps : ["use!underscore", "jquery"],
attach : function(_, $) {
return Backbone;
}
},
"handlebars" : {
attach: "Handlebars"
}
}
});
// Initialization
require([
"dashboard/DashboardView",
"dashboard/DashboardRouter",
"datum/DatumCollection"
], function(DashboardView, DashboardRouter, DatumCollection) {
// Initialize the DashboardView
window.dashboard = new DashboardView();
// Initialize the DashboardRouter and start listening for URL changes
window.router = new DashboardRouter();
Backbone.history.start();
// Initialize our list of Datum
window.datumList = new DatumCollection();
});
| // Set the RequireJS configuration
require.config({
paths : {
"use" : "libs/use",
"text" : "libs/text",
"jquery" : "libs/jquery",
"underscore" : "libs/underscore",
"backbone" : "libs/backbone",
"handlebars" : "libs/handlebars-1.0.0.beta.6"
},
use : {
"underscore" : {
attach : "_"
},
"backbone" : {
deps : ["use!underscore", "jquery"],
attach : function(_, $) {
return Backbone;
}
},
"handlebars" : {
attach: "Handlebars"
}
}
});
// Initialization
require([
"dashboard/DashboardView",
"dashboard/DashboardRouter",
"datum/DatumCollection"
], function(DashboardView, DashboardRouter, DatumCollection) {
// Initialize the DashboardView
window.dashboard = new DashboardView();
// Initialize the DashboardRouter and start listening for URL changes
window.router = new DashboardRouter();
// Initialize our list of Datum
window.datumList = new DatumCollection();
});
| Remove line that tries to sync the DatumCollection. | Remove line that tries to sync the DatumCollection.
Former-commit-id: 769c0335d1ad8f066c66f902272c5f7d786f0955 | JavaScript | apache-2.0 | iLanguage/iLanguage,cesine/iLanguage,vronvali/iLanguage,vronvali/iLanguage,cesine/iLanguage,iLanguage/iLanguage,cesine/iLanguage,iLanguage/iLanguage,iLanguage/iLanguage,vronvali/iLanguage,cesine/iLanguage,vronvali/iLanguage,vronvali/iLanguage,cesine/iLanguage,iLanguage/iLanguage,vronvali/iLanguage | ---
+++
@@ -37,7 +37,6 @@
// Initialize the DashboardRouter and start listening for URL changes
window.router = new DashboardRouter();
- Backbone.history.start();
// Initialize our list of Datum
window.datumList = new DatumCollection(); |
4444a847382b5983a991613d1d546e861a5a4720 | packages/jsonmvc/src/fns/bundleModules.js | packages/jsonmvc/src/fns/bundleModules.js |
import reduce from 'lodash-es/reduce'
import merge from 'lodash-es/merge'
function bundleModules (modules) {
let bundle = reduce(modules, (acc, v1, k1) => {
reduce(v1, (acc2, v2, k2) => {
if (k2 !== 'data') {
v2 = reduce(v2, (acc3, v3, k3) => {
acc3[k1 + '/' + k3] = v3
return acc3
}, {})
}
acc[k2] = merge(acc[k2], v2)
return acc
}, {})
return acc
}, {})
return bundle
}
export default bundleModules
|
import reduce from 'lodash-es/reduce'
import merge from 'lodash-es/merge'
function bundleModules (modules) {
let bundle = reduce(modules, (acc, v1) => {
reduce(v1, (acc2, v2, k2) => {
if (k2 !== 'data') {
v2 = reduce(v2, (acc3, v3, k3) => {
acc3[k3] = v3
return acc3
}, {})
}
acc[k2] = merge(acc[k2], v2)
return acc
}, {})
return acc
}, {})
return bundle
}
export default bundleModules
| Remove extra param for module indexing. | fix(jsonmvc): Remove extra param for module indexing.
| JavaScript | mit | jsonmvc/jsonmvc,jsonmvc/jsonmvc | ---
+++
@@ -3,11 +3,11 @@
import merge from 'lodash-es/merge'
function bundleModules (modules) {
- let bundle = reduce(modules, (acc, v1, k1) => {
+ let bundle = reduce(modules, (acc, v1) => {
reduce(v1, (acc2, v2, k2) => {
if (k2 !== 'data') {
v2 = reduce(v2, (acc3, v3, k3) => {
- acc3[k1 + '/' + k3] = v3
+ acc3[k3] = v3
return acc3
}, {})
} |
3d246e03375d09f8f070d56a7e9ce3a6c3a0b821 | packages/react-app-rewire-eslint/index.js | packages/react-app-rewire-eslint/index.js | const path = require('path');
const { getLoader } = require('react-app-rewired');
// this is the path of eslint-loader `index.js`
const ESLINT_PATH = `eslint-loader${path.sep}index.js`;
function getEslintOptions(rules) {
const matcher = (rule) => rule.loader
&& typeof rule.loader === 'string'
&& rule.loader.endsWith(ESLINT_PATH);
return getLoader(rules, matcher).options;
}
function rewireEslint(config, env) {
// if `react-scripts` version < 1.0.0
// **eslint options** is in `config`
const oldOptions = config.eslint;
// else `react-scripts` >= 1.0.0
// **eslint options** is in `config.module.rules`
const newOptions = getEslintOptions(config.module.rules);
// Thx @Guria, with no break change.
const options = oldOptions || newOptions;
options.useEslintrc = true;
options.ignore = true;
return config;
}
module.exports = rewireEslint;
| const path = require('path');
const { getLoader } = require('react-app-rewired');
// this is the path of eslint-loader `index.js`
const ESLINT_PATH = `eslint-loader${path.sep}index.js`;
function getEslintOptions(rules) {
const matcher = (rule) => rule.loader
&& typeof rule.loader === 'string'
&& rule.loader.endsWith(ESLINT_PATH);
return getLoader(rules, matcher).options;
}
function rewireEslint(config, env, override = f => f) {
// if `react-scripts` version < 1.0.0
// **eslint options** is in `config`
const oldOptions = config.eslint;
// else `react-scripts` >= 1.0.0
// **eslint options** is in `config.module.rules`
const newOptions = getEslintOptions(config.module.rules);
// Thx @Guria, with no break change.
const options = oldOptions || newOptions;
options.useEslintrc = true;
options.ignore = true;
override(options);
return config;
}
module.exports = rewireEslint;
| Allow eslint config options overrides | Allow eslint config options overrides
| JavaScript | mit | timarney/react-app-rewired,timarney/react-app-rewired | ---
+++
@@ -11,7 +11,7 @@
return getLoader(rules, matcher).options;
}
-function rewireEslint(config, env) {
+function rewireEslint(config, env, override = f => f) {
// if `react-scripts` version < 1.0.0
// **eslint options** is in `config`
const oldOptions = config.eslint;
@@ -23,6 +23,9 @@
const options = oldOptions || newOptions;
options.useEslintrc = true;
options.ignore = true;
+
+ override(options);
+
return config;
}
|
e0a63f538942dc54837617afb41ef469925f667d | src/modules/unit/actions.js | src/modules/unit/actions.js | import {createAction} from 'redux-actions';
import values from 'lodash/values';
import {UnitActions} from './constants';
import {Action} from '../common/constants';
import {ApiResponse, UnitServices} from './constants';
export const fetchUnits = (/*params: Object*/): Action =>
createAction(UnitActions.FETCH)({params: {
service: `${values(UnitServices).join(',')}`,
only: 'id,name,location',
include: 'observations,services',
page_size: 1000
}});
export const receiveUnits = (data: ApiResponse): Action =>
createAction(UnitActions.RECEIVE)(data);
export const clearSearch = () =>
createAction(UnitActions.SEARCH_CLEAR)();
export const searchUnits = (input: string, params: Object): Action => {
const init = {
input,
service: `${values(UnitServices).join(',')}`
};
params = Object.assign({}, init, params);
return createAction(UnitActions.SEARCH_REQUEST)({params});
};
export const fetchSearchSuggestions = (input: string): Action =>
createAction(UnitActions.FETCH_SEARCH_SUGGESTIONS)({params: {
input,
service: `${values(UnitServices).join(',')}`,
page_size: 5
}});
export const receiveSearchResults = (results: Array<Object>) =>
createAction(UnitActions.SEARCH_RECEIVE)(results);
export const receiveSearchSuggestions = (results: Array<Object>) =>
createAction(UnitActions.RECEIVE_SEARCH_SUGGESTIONS)(results);
| import {createAction} from 'redux-actions';
import values from 'lodash/values';
import {UnitActions} from './constants';
import {Action} from '../common/constants';
import {ApiResponse, UnitServices} from './constants';
export const fetchUnits = (/*params: Object*/): Action =>
createAction(UnitActions.FETCH)({params: {
service: `${values(UnitServices).join(',')}`,
only: 'id,name,location,street_address,address_zip',
include: 'observations,services',
page_size: 1000
}});
export const receiveUnits = (data: ApiResponse): Action =>
createAction(UnitActions.RECEIVE)(data);
export const clearSearch = () =>
createAction(UnitActions.SEARCH_CLEAR)();
export const searchUnits = (input: string, params: Object): Action => {
const init = {
input,
service: `${values(UnitServices).join(',')}`
};
params = Object.assign({}, init, params);
return createAction(UnitActions.SEARCH_REQUEST)({params});
};
export const fetchSearchSuggestions = (input: string): Action =>
createAction(UnitActions.FETCH_SEARCH_SUGGESTIONS)({params: {
input,
service: `${values(UnitServices).join(',')}`,
page_size: 5
}});
export const receiveSearchResults = (results: Array<Object>) =>
createAction(UnitActions.SEARCH_RECEIVE)(results);
export const receiveSearchSuggestions = (results: Array<Object>) =>
createAction(UnitActions.RECEIVE_SEARCH_SUGGESTIONS)(results);
| Include address information in unit fetch | Include address information in unit fetch
| JavaScript | mit | nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map | ---
+++
@@ -7,7 +7,7 @@
export const fetchUnits = (/*params: Object*/): Action =>
createAction(UnitActions.FETCH)({params: {
service: `${values(UnitServices).join(',')}`,
- only: 'id,name,location',
+ only: 'id,name,location,street_address,address_zip',
include: 'observations,services',
page_size: 1000
}}); |
90602ae76e8a1e207479d1a9c18513d727a56f52 | lib/convert.js | lib/convert.js | /**
* # Convert Release.json to Changes.md
*
* @param {Array} data The releases from Github's API
* @param {String} out Changelog filename
* @return {Stream} The file write stream
*/
var fs = require('fs');
module.exports = function (data, out) {
var output = fs.createWriteStream(out);
output.on('open', function () {
data.forEach(function (release) {
output.write('# '+ release.name + '\n\n');
output.write( (new Date(release.published_at)).toDateString() + '\n\n');
output.write(release.body.replace('\r\n', '\n') + '\n\n');
});
output.end();
});
return output;
}; | /**
* # Convert Release.json to Changes.md
*
* @param {Array} data The releases from Github's API
* @param {String} out Changelog filename
* @return {Stream} The file write stream
*/
var fs = require('fs');
module.exports = function (data, out) {
var output = fs.createWriteStream(out);
output.on('open', function () {
output.write('# Changelog' + '\n\n');
data.forEach(function (release) {
output.write('## '+ release.name + '\n\n');
output.write( (new Date(release.published_at)).toDateString() + '\n\n');
output.write(release.body.replace('\r\n', '\n') + '\n\n');
});
output.end();
});
return output;
}; | Make 'Changelog' h1, Versions h2 | Make 'Changelog' h1, Versions h2 | JavaScript | mit | killercup/ghReleases2Changelog | ---
+++
@@ -12,8 +12,9 @@
var output = fs.createWriteStream(out);
output.on('open', function () {
+ output.write('# Changelog' + '\n\n');
data.forEach(function (release) {
- output.write('# '+ release.name + '\n\n');
+ output.write('## '+ release.name + '\n\n');
output.write( (new Date(release.published_at)).toDateString() + '\n\n');
output.write(release.body.replace('\r\n', '\n') + '\n\n');
}); |
077bcbb17e8fdda2915e62dd56fc4e7e3be37428 | src/js/components/charts/AnimationCircle.js | src/js/components/charts/AnimationCircle.js | var d3 = require('d3');
var React = require('react');
var ReactDOM = require('react-dom');
var AnitmationCircle = React.createClass({
displayName: 'AnitmationCircle',
propTypes: {
className: React.PropTypes.string,
transitionTime: React.PropTypes.number.isRequired,
position: React.PropTypes.array.isRequired,
radius: React.PropTypes.number,
cx: React.PropTypes.number,
cy: React.PropTypes.number
},
getDefaultProps: function () {
return {
radius: 4,
cx: 0,
cy: 0
};
},
componentDidMount: function () {
d3.select(ReactDOM.findDOMNode(this))
.attr('transform', 'translate(' + this.props.position + ')');
},
componentWillReceiveProps: function (props) {
d3.select(ReactDOM.findDOMNode(this))
.transition()
.duration(props.transitionTime)
.ease('linear')
.attr('transform', 'translate(' + props.position + ')');
},
render: function () {
var props = this.props;
var radius = props.radius;
var className = props.className;
return (
<circle className={className} r={radius} cx={props.cx} cy={props.cy} />
);
}
});
module.exports = AnitmationCircle;
| var d3 = require('d3');
var React = require('react');
var ReactDOM = require('react-dom');
var AnitmationCircle = React.createClass({
displayName: 'AnitmationCircle',
propTypes: {
className: React.PropTypes.string,
transitionTime: React.PropTypes.number.isRequired,
position: React.PropTypes.array.isRequired,
radius: React.PropTypes.number,
cx: React.PropTypes.number,
cy: React.PropTypes.number
},
getInitialState: function () {
return {
didRenderBefore: false
};
},
getDefaultProps: function () {
return {
radius: 4,
cx: 0,
cy: 0
};
},
componentDidMount: function () {
d3.select(ReactDOM.findDOMNode(this))
.attr('transform', 'translate(' + this.props.position + ')');
},
componentWillReceiveProps: function (nextProps) {
let node = ReactDOM.findDOMNode(this);
// Handle first position to not animate into position
// We need this because we get 0-data for graphs on the first render
if (!this.state.didRenderBefore) {
d3.select(node)
.attr('transform', 'translate(' + nextProps.position + ')');
this.setState({didRenderBefore: true});
return;
}
d3.select(node)
.transition()
.duration(nextProps.transitionTime)
.ease('linear')
.attr('transform', 'translate(' + nextProps.position + ')');
},
render: function () {
var props = this.props;
var radius = props.radius;
var className = props.className;
return (
<circle className={className} r={radius} cx={props.cx} cy={props.cy} />
);
}
});
module.exports = AnitmationCircle;
| Make sure not to animate into position on first render | Make sure not to animate into position on first render
| JavaScript | apache-2.0 | dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui | ---
+++
@@ -15,6 +15,11 @@
cy: React.PropTypes.number
},
+ getInitialState: function () {
+ return {
+ didRenderBefore: false
+ };
+ },
getDefaultProps: function () {
return {
radius: 4,
@@ -28,12 +33,25 @@
.attr('transform', 'translate(' + this.props.position + ')');
},
- componentWillReceiveProps: function (props) {
- d3.select(ReactDOM.findDOMNode(this))
+ componentWillReceiveProps: function (nextProps) {
+ let node = ReactDOM.findDOMNode(this);
+
+ // Handle first position to not animate into position
+ // We need this because we get 0-data for graphs on the first render
+ if (!this.state.didRenderBefore) {
+ d3.select(node)
+ .attr('transform', 'translate(' + nextProps.position + ')');
+
+ this.setState({didRenderBefore: true});
+
+ return;
+ }
+
+ d3.select(node)
.transition()
- .duration(props.transitionTime)
+ .duration(nextProps.transitionTime)
.ease('linear')
- .attr('transform', 'translate(' + props.position + ')');
+ .attr('transform', 'translate(' + nextProps.position + ')');
},
render: function () { |
be2c05a6e5f3e3adfc99a4424f6f181a45a53863 | server/app.js | server/app.js | require('dotenv').load();
var express = require('express');
var notelyServerApp = express();
var Note = require('./models/note');
var bodyParser = require('body-parser');
// Allow ourselves to use `req.body` to work with form data
notelyServerApp.use(bodyParser.json());
// Cross-Origin Resource Sharing (CORS) middleware
notelyServerApp.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
next();
});
notelyServerApp.get('/notes', function(req, res) {
Note.find().then(function(notes) {
res.json(notes);
});
});
notelyServerApp.post('/notes', function(req, res) {
var note = new Note({
title: req.body.note.title,
body_html: req.body.note.body_html
});
note.save().then(function(noteData) {
res.json({
message: 'Saved!',
note: noteData
});
});
});
notelyServerApp.listen(3030, function() {
console.log('Listening on http://localhost:3030');
});
| require('dotenv').load();
var express = require('express');
var notelyServerApp = express();
var Note = require('./models/note');
var bodyParser = require('body-parser');
// Allow ourselves to use `req.body` to work with form data
notelyServerApp.use(bodyParser.json());
// Cross-Origin Resource Sharing (CORS) middleware
notelyServerApp.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
next();
});
notelyServerApp.get('/notes', function(req, res) {
Note.find().sort({ updated_at: 'desc' }).then(function(notes) {
res.json(notes);
});
});
notelyServerApp.post('/notes', function(req, res) {
var note = new Note({
title: req.body.note.title,
body_html: req.body.note.body_html
});
note.save().then(function(noteData) {
res.json({
message: 'Saved!',
note: noteData
});
});
});
notelyServerApp.listen(3030, function() {
console.log('Listening on http://localhost:3030');
});
| Order notes on the server (API) side. | Order notes on the server (API) side.
| JavaScript | mit | FretlessJS-2016-03/notely,FretlessJS-2016-03/notely | ---
+++
@@ -15,7 +15,7 @@
});
notelyServerApp.get('/notes', function(req, res) {
- Note.find().then(function(notes) {
+ Note.find().sort({ updated_at: 'desc' }).then(function(notes) {
res.json(notes);
});
}); |
864ae3ad51eb93313f0e415545ac4adffa2a2a6a | static/js/feature_flags.js | static/js/feature_flags.js | var feature_flags = (function () {
var exports = {};
exports.mark_read_at_bottom = page_params.staging ||
_.contains(['mit.edu'], page_params.domain);
exports.summarize_read_while_narrowed = page_params.staging;
exports.twenty_four_hour_time = _.contains([],
page_params.email);
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
exports.email_forwarding = page_params.staging;
exports.edit_appears_on_hover = true;
exports.mandatory_topics = _.contains([
'customer7.invalid'
],
page_params.domain
);
exports.collapsible = page_params.staging;
return exports;
}());
| var feature_flags = (function () {
var exports = {};
exports.mark_read_at_bottom = page_params.staging ||
_.contains(['mit.edu'], page_params.domain);
exports.summarize_read_while_narrowed = page_params.staging;
exports.twenty_four_hour_time = _.contains([],
page_params.email);
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
exports.email_forwarding = page_params.staging ||
_.contains(['customer6.invalid'], page_params.domain);
exports.edit_appears_on_hover = true;
exports.mandatory_topics = _.contains([
'customer7.invalid'
],
page_params.domain
);
exports.collapsible = page_params.staging;
return exports;
}());
| Enable the email forwarding UI for CUSTOMER6. | Enable the email forwarding UI for CUSTOMER6.
(imported from commit 587159412ad208d1f5e44479f50ca2f25a98f70a)
| JavaScript | apache-2.0 | jimmy54/zulip,glovebx/zulip,m1ssou/zulip,adnanh/zulip,joshisa/zulip,atomic-labs/zulip,bitemyapp/zulip,Suninus/zulip,swinghu/zulip,Juanvulcano/zulip,xuanhan863/zulip,moria/zulip,zhaoweigg/zulip,jessedhillon/zulip,j831/zulip,samatdav/zulip,suxinde2009/zulip,jimmy54/zulip,eastlhu/zulip,huangkebo/zulip,fw1121/zulip,moria/zulip,moria/zulip,amyliu345/zulip,ericzhou2008/zulip,jainayush975/zulip,TigorC/zulip,krtkmj/zulip,SmartPeople/zulip,seapasulli/zulip,JanzTam/zulip,hafeez3000/zulip,adnanh/zulip,karamcnair/zulip,kokoar/zulip,guiquanz/zulip,hafeez3000/zulip,punchagan/zulip,yocome/zulip,JPJPJPOPOP/zulip,ufosky-server/zulip,zorojean/zulip,aps-sids/zulip,suxinde2009/zulip,dnmfarrell/zulip,shrikrishnaholla/zulip,rishig/zulip,dotcool/zulip,gigawhitlocks/zulip,Diptanshu8/zulip,hj3938/zulip,shubhamdhama/zulip,jerryge/zulip,MayB/zulip,deer-hope/zulip,seapasulli/zulip,developerfm/zulip,rishig/zulip,bssrdf/zulip,umkay/zulip,wdaher/zulip,joyhchen/zulip,zorojean/zulip,kokoar/zulip,noroot/zulip,joyhchen/zulip,pradiptad/zulip,blaze225/zulip,jessedhillon/zulip,avastu/zulip,glovebx/zulip,johnnygaddarr/zulip,vakila/zulip,lfranchi/zulip,jeffcao/zulip,pradiptad/zulip,MariaFaBella85/zulip,vabs22/zulip,noroot/zulip,susansls/zulip,dnmfarrell/zulip,EasonYi/zulip,showell/zulip,susansls/zulip,LAndreas/zulip,ufosky-server/zulip,amallia/zulip,mohsenSy/zulip,nicholasbs/zulip,arpitpanwar/zulip,j831/zulip,bssrdf/zulip,saitodisse/zulip,aliceriot/zulip,pradiptad/zulip,zhaoweigg/zulip,shrikrishnaholla/zulip,hj3938/zulip,vabs22/zulip,jeffcao/zulip,dotcool/zulip,firstblade/zulip,mdavid/zulip,joshisa/zulip,arpitpanwar/zulip,m1ssou/zulip,tiansiyuan/zulip,fw1121/zulip,brainwane/zulip,swinghu/zulip,SmartPeople/zulip,zulip/zulip,zofuthan/zulip,amallia/zulip,Suninus/zulip,hackerkid/zulip,willingc/zulip,esander91/zulip,dotcool/zulip,AZtheAsian/zulip,eastlhu/zulip,kokoar/zulip,dxq-git/zulip,shaunstanislaus/zulip,AZtheAsian/zulip,sup95/zulip,jackrzhang/zulip,niftynei/zulip,shubhamdhama/zulip,glovebx/zulip,littledogboy/zulip,MariaFaBella85/zulip,tommyip/zulip,PaulPetring/zulip,bowlofstew/zulip,avastu/zulip,blaze225/zulip,zhaoweigg/zulip,karamcnair/zulip,arpith/zulip,krtkmj/zulip,ashwinirudrappa/zulip,ufosky-server/zulip,amallia/zulip,rht/zulip,amallia/zulip,seapasulli/zulip,jrowan/zulip,mohsenSy/zulip,Batterfii/zulip,andersk/zulip,RobotCaleb/zulip,jeffcao/zulip,mdavid/zulip,hackerkid/zulip,avastu/zulip,cosmicAsymmetry/zulip,zorojean/zulip,zacps/zulip,dwrpayne/zulip,peguin40/zulip,pradiptad/zulip,dhcrzf/zulip,tiansiyuan/zulip,tdr130/zulip,levixie/zulip,mansilladev/zulip,dawran6/zulip,deer-hope/zulip,timabbott/zulip,seapasulli/zulip,mdavid/zulip,xuanhan863/zulip,gigawhitlocks/zulip,natanovia/zulip,glovebx/zulip,arpith/zulip,deer-hope/zulip,voidException/zulip,xuxiao/zulip,qq1012803704/zulip,calvinleenyc/zulip,arpitpanwar/zulip,sup95/zulip,kokoar/zulip,adnanh/zulip,dwrpayne/zulip,EasonYi/zulip,seapasulli/zulip,JPJPJPOPOP/zulip,tommyip/zulip,LeeRisk/zulip,technicalpickles/zulip,willingc/zulip,umkay/zulip,hackerkid/zulip,peguin40/zulip,thomasboyt/zulip,swinghu/zulip,Vallher/zulip,voidException/zulip,KingxBanana/zulip,rishig/zulip,alliejones/zulip,itnihao/zulip,jessedhillon/zulip,sup95/zulip,bitemyapp/zulip,ryanbackman/zulip,luyifan/zulip,ipernet/zulip,ericzhou2008/zulip,xuxiao/zulip,ufosky-server/zulip,yocome/zulip,verma-varsha/zulip,arpitpanwar/zulip,sonali0901/zulip,Batterfii/zulip,wdaher/zulip,natanovia/zulip,bastianh/zulip,Cheppers/zulip,sharmaeklavya2/zulip,ApsOps/zulip,guiquanz/zulip,m1ssou/zulip,bitemyapp/zulip,wangdeshui/zulip,technicalpickles/zulip,jphilipsen05/zulip,stamhe/zulip,yocome/zulip,LAndreas/zulip,zulip/zulip,sonali0901/zulip,ikasumiwt/zulip,Batterfii/zulip,schatt/zulip,dwrpayne/zulip,tommyip/zulip,LAndreas/zulip,thomasboyt/zulip,noroot/zulip,synicalsyntax/zulip,Diptanshu8/zulip,mohsenSy/zulip,PaulPetring/zulip,esander91/zulip,zachallaun/zulip,susansls/zulip,dhcrzf/zulip,aps-sids/zulip,noroot/zulip,suxinde2009/zulip,jrowan/zulip,gigawhitlocks/zulip,karamcnair/zulip,hafeez3000/zulip,udxxabp/zulip,littledogboy/zulip,ashwinirudrappa/zulip,MayB/zulip,ufosky-server/zulip,sharmaeklavya2/zulip,fw1121/zulip,rht/zulip,ryansnowboarder/zulip,Frouk/zulip,sharmaeklavya2/zulip,LeeRisk/zulip,jackrzhang/zulip,armooo/zulip,zorojean/zulip,firstblade/zulip,cosmicAsymmetry/zulip,LAndreas/zulip,jackrzhang/zulip,DazWorrall/zulip,cosmicAsymmetry/zulip,dotcool/zulip,jimmy54/zulip,jainayush975/zulip,Galexrt/zulip,ryanbackman/zulip,gigawhitlocks/zulip,zofuthan/zulip,vaidap/zulip,johnny9/zulip,zwily/zulip,willingc/zulip,easyfmxu/zulip,alliejones/zulip,PaulPetring/zulip,bastianh/zulip,yocome/zulip,showell/zulip,jimmy54/zulip,amallia/zulip,babbage/zulip,tbutter/zulip,johnnygaddarr/zulip,kou/zulip,AZtheAsian/zulip,Qgap/zulip,praveenaki/zulip,bssrdf/zulip,littledogboy/zulip,atomic-labs/zulip,hj3938/zulip,tbutter/zulip,Qgap/zulip,zachallaun/zulip,arpith/zulip,natanovia/zulip,vikas-parashar/zulip,shaunstanislaus/zulip,johnny9/zulip,ikasumiwt/zulip,developerfm/zulip,easyfmxu/zulip,verma-varsha/zulip,Galexrt/zulip,calvinleenyc/zulip,AZtheAsian/zulip,vikas-parashar/zulip,verma-varsha/zulip,dhcrzf/zulip,brockwhittaker/zulip,blaze225/zulip,littledogboy/zulip,xuanhan863/zulip,tbutter/zulip,AZtheAsian/zulip,mdavid/zulip,christi3k/zulip,jackrzhang/zulip,lfranchi/zulip,esander91/zulip,shubhamdhama/zulip,Suninus/zulip,PaulPetring/zulip,Frouk/zulip,jeffcao/zulip,aliceriot/zulip,Drooids/zulip,mahim97/zulip,LeeRisk/zulip,brainwane/zulip,karamcnair/zulip,udxxabp/zulip,SmartPeople/zulip,wweiradio/zulip,TigorC/zulip,itnihao/zulip,ipernet/zulip,johnny9/zulip,hustlzp/zulip,zulip/zulip,eastlhu/zulip,ikasumiwt/zulip,shubhamdhama/zulip,udxxabp/zulip,natanovia/zulip,proliming/zulip,so0k/zulip,kaiyuanheshang/zulip,nicholasbs/zulip,shaunstanislaus/zulip,xuxiao/zulip,he15his/zulip,bowlofstew/zulip,vikas-parashar/zulip,armooo/zulip,brainwane/zulip,RobotCaleb/zulip,amyliu345/zulip,wangdeshui/zulip,zorojean/zulip,suxinde2009/zulip,LAndreas/zulip,amyliu345/zulip,TigorC/zulip,firstblade/zulip,moria/zulip,rht/zulip,Frouk/zulip,praveenaki/zulip,firstblade/zulip,punchagan/zulip,shrikrishnaholla/zulip,Cheppers/zulip,suxinde2009/zulip,jonesgithub/zulip,ashwinirudrappa/zulip,dwrpayne/zulip,JPJPJPOPOP/zulip,Frouk/zulip,souravbadami/zulip,LeeRisk/zulip,wavelets/zulip,susansls/zulip,dwrpayne/zulip,andersk/zulip,xuanhan863/zulip,technicalpickles/zulip,technicalpickles/zulip,gkotian/zulip,krtkmj/zulip,dxq-git/zulip,shaunstanislaus/zulip,dattatreya303/zulip,akuseru/zulip,Frouk/zulip,joshisa/zulip,nicholasbs/zulip,mahim97/zulip,levixie/zulip,vaidap/zulip,praveenaki/zulip,qq1012803704/zulip,he15his/zulip,MariaFaBella85/zulip,KJin99/zulip,isht3/zulip,jainayush975/zulip,eeshangarg/zulip,Jianchun1/zulip,joyhchen/zulip,karamcnair/zulip,fw1121/zulip,sup95/zulip,easyfmxu/zulip,rishig/zulip,yuvipanda/zulip,nicholasbs/zulip,jonesgithub/zulip,pradiptad/zulip,vabs22/zulip,voidException/zulip,rht/zulip,themass/zulip,natanovia/zulip,gigawhitlocks/zulip,firstblade/zulip,themass/zulip,proliming/zulip,tdr130/zulip,noroot/zulip,mohsenSy/zulip,Juanvulcano/zulip,dnmfarrell/zulip,atomic-labs/zulip,natanovia/zulip,TigorC/zulip,esander91/zulip,swinghu/zulip,thomasboyt/zulip,itnihao/zulip,zacps/zulip,dhcrzf/zulip,moria/zulip,joshisa/zulip,peiwei/zulip,jackrzhang/zulip,zhaoweigg/zulip,themass/zulip,avastu/zulip,Jianchun1/zulip,Vallher/zulip,suxinde2009/zulip,bowlofstew/zulip,amanharitsh123/zulip,esander91/zulip,proliming/zulip,Batterfii/zulip,zacps/zulip,akuseru/zulip,umkay/zulip,amanharitsh123/zulip,schatt/zulip,EasonYi/zulip,umkay/zulip,johnny9/zulip,akuseru/zulip,wavelets/zulip,vakila/zulip,vabs22/zulip,wdaher/zulip,hayderimran7/zulip,KJin99/zulip,bluesea/zulip,samatdav/zulip,gkotian/zulip,samatdav/zulip,Gabriel0402/zulip,arpitpanwar/zulip,dnmfarrell/zulip,wweiradio/zulip,willingc/zulip,themass/zulip,luyifan/zulip,niftynei/zulip,Vallher/zulip,pradiptad/zulip,jimmy54/zulip,vikas-parashar/zulip,Vallher/zulip,avastu/zulip,rht/zulip,LeeRisk/zulip,Gabriel0402/zulip,jackrzhang/zulip,yocome/zulip,punchagan/zulip,bluesea/zulip,shaunstanislaus/zulip,Drooids/zulip,udxxabp/zulip,TigorC/zulip,ryansnowboarder/zulip,kou/zulip,gkotian/zulip,PaulPetring/zulip,andersk/zulip,PaulPetring/zulip,ryansnowboarder/zulip,levixie/zulip,bluesea/zulip,stamhe/zulip,voidException/zulip,JPJPJPOPOP/zulip,schatt/zulip,aliceriot/zulip,rht/zulip,he15his/zulip,showell/zulip,Cheppers/zulip,synicalsyntax/zulip,wavelets/zulip,mansilladev/zulip,dxq-git/zulip,karamcnair/zulip,vikas-parashar/zulip,Galexrt/zulip,peiwei/zulip,hayderimran7/zulip,tdr130/zulip,hayderimran7/zulip,atomic-labs/zulip,MariaFaBella85/zulip,jonesgithub/zulip,hustlzp/zulip,hj3938/zulip,armooo/zulip,zachallaun/zulip,stamhe/zulip,umkay/zulip,yuvipanda/zulip,ericzhou2008/zulip,DazWorrall/zulip,atomic-labs/zulip,samatdav/zulip,shrikrishnaholla/zulip,Drooids/zulip,sharmaeklavya2/zulip,brockwhittaker/zulip,hj3938/zulip,brockwhittaker/zulip,zacps/zulip,aps-sids/zulip,ericzhou2008/zulip,krtkmj/zulip,Gabriel0402/zulip,easyfmxu/zulip,ipernet/zulip,noroot/zulip,johnny9/zulip,RobotCaleb/zulip,willingc/zulip,aakash-cr7/zulip,tdr130/zulip,vakila/zulip,aakash-cr7/zulip,bluesea/zulip,ApsOps/zulip,huangkebo/zulip,RobotCaleb/zulip,dattatreya303/zulip,xuanhan863/zulip,atomic-labs/zulip,punchagan/zulip,jphilipsen05/zulip,ericzhou2008/zulip,akuseru/zulip,kokoar/zulip,dawran6/zulip,levixie/zulip,umkay/zulip,MayB/zulip,ahmadassaf/zulip,themass/zulip,aps-sids/zulip,tbutter/zulip,calvinleenyc/zulip,TigorC/zulip,ApsOps/zulip,amyliu345/zulip,dxq-git/zulip,peiwei/zulip,kou/zulip,DazWorrall/zulip,tdr130/zulip,grave-w-grave/zulip,zofuthan/zulip,dnmfarrell/zulip,gkotian/zulip,ApsOps/zulip,jessedhillon/zulip,paxapy/zulip,DazWorrall/zulip,eastlhu/zulip,hayderimran7/zulip,wdaher/zulip,pradiptad/zulip,he15his/zulip,bastianh/zulip,so0k/zulip,dxq-git/zulip,he15his/zulip,jimmy54/zulip,christi3k/zulip,eastlhu/zulip,jrowan/zulip,m1ssou/zulip,hackerkid/zulip,joshisa/zulip,bssrdf/zulip,ikasumiwt/zulip,sonali0901/zulip,ApsOps/zulip,proliming/zulip,PhilSk/zulip,PhilSk/zulip,hafeez3000/zulip,wangdeshui/zulip,peguin40/zulip,JanzTam/zulip,dotcool/zulip,verma-varsha/zulip,kou/zulip,dnmfarrell/zulip,arpitpanwar/zulip,zulip/zulip,noroot/zulip,KJin99/zulip,aliceriot/zulip,vakila/zulip,schatt/zulip,mansilladev/zulip,sharmaeklavya2/zulip,Juanvulcano/zulip,Vallher/zulip,ufosky-server/zulip,joshisa/zulip,guiquanz/zulip,codeKonami/zulip,ipernet/zulip,willingc/zulip,easyfmxu/zulip,moria/zulip,thomasboyt/zulip,bitemyapp/zulip,lfranchi/zulip,zhaoweigg/zulip,esander91/zulip,jeffcao/zulip,grave-w-grave/zulip,itnihao/zulip,hackerkid/zulip,akuseru/zulip,jerryge/zulip,huangkebo/zulip,mahim97/zulip,praveenaki/zulip,Diptanshu8/zulip,hustlzp/zulip,hustlzp/zulip,JanzTam/zulip,arpitpanwar/zulip,armooo/zulip,alliejones/zulip,johnnygaddarr/zulip,LAndreas/zulip,jimmy54/zulip,codeKonami/zulip,kaiyuanheshang/zulip,hackerkid/zulip,aliceriot/zulip,brainwane/zulip,praveenaki/zulip,lfranchi/zulip,swinghu/zulip,xuxiao/zulip,kokoar/zulip,xuxiao/zulip,kaiyuanheshang/zulip,praveenaki/zulip,wweiradio/zulip,zulip/zulip,souravbadami/zulip,qq1012803704/zulip,ashwinirudrappa/zulip,KJin99/zulip,ikasumiwt/zulip,itnihao/zulip,guiquanz/zulip,ericzhou2008/zulip,gkotian/zulip,Cheppers/zulip,timabbott/zulip,showell/zulip,amanharitsh123/zulip,seapasulli/zulip,amanharitsh123/zulip,yuvipanda/zulip,xuxiao/zulip,firstblade/zulip,AZtheAsian/zulip,eeshangarg/zulip,dwrpayne/zulip,JanzTam/zulip,amyliu345/zulip,johnny9/zulip,Frouk/zulip,MariaFaBella85/zulip,hafeez3000/zulip,SmartPeople/zulip,tiansiyuan/zulip,johnnygaddarr/zulip,mahim97/zulip,ryanbackman/zulip,Drooids/zulip,bluesea/zulip,PhilSk/zulip,akuseru/zulip,luyifan/zulip,adnanh/zulip,reyha/zulip,ahmadassaf/zulip,Vallher/zulip,Batterfii/zulip,avastu/zulip,qq1012803704/zulip,KingxBanana/zulip,lfranchi/zulip,sup95/zulip,dwrpayne/zulip,ryansnowboarder/zulip,aakash-cr7/zulip,calvinleenyc/zulip,udxxabp/zulip,Juanvulcano/zulip,zorojean/zulip,Suninus/zulip,jessedhillon/zulip,deer-hope/zulip,LeeRisk/zulip,isht3/zulip,so0k/zulip,amyliu345/zulip,shaunstanislaus/zulip,mdavid/zulip,hengqujushi/zulip,dattatreya303/zulip,esander91/zulip,babbage/zulip,cosmicAsymmetry/zulip,ahmadassaf/zulip,tiansiyuan/zulip,RobotCaleb/zulip,Gabriel0402/zulip,he15his/zulip,qq1012803704/zulip,jerryge/zulip,vakila/zulip,arpith/zulip,udxxabp/zulip,MayB/zulip,voidException/zulip,itnihao/zulip,zachallaun/zulip,stamhe/zulip,deer-hope/zulip,hustlzp/zulip,wavelets/zulip,brainwane/zulip,wweiradio/zulip,bowlofstew/zulip,hengqujushi/zulip,saitodisse/zulip,wavelets/zulip,brainwane/zulip,seapasulli/zulip,vakila/zulip,qq1012803704/zulip,brockwhittaker/zulip,dhcrzf/zulip,kaiyuanheshang/zulip,vaidap/zulip,Suninus/zulip,littledogboy/zulip,glovebx/zulip,lfranchi/zulip,jrowan/zulip,zulip/zulip,luyifan/zulip,grave-w-grave/zulip,RobotCaleb/zulip,synicalsyntax/zulip,krtkmj/zulip,Jianchun1/zulip,easyfmxu/zulip,peiwei/zulip,zwily/zulip,susansls/zulip,so0k/zulip,nicholasbs/zulip,peguin40/zulip,dotcool/zulip,shubhamdhama/zulip,Galexrt/zulip,dxq-git/zulip,tbutter/zulip,christi3k/zulip,schatt/zulip,wweiradio/zulip,timabbott/zulip,nicholasbs/zulip,wdaher/zulip,wdaher/zulip,sup95/zulip,hj3938/zulip,natanovia/zulip,jainayush975/zulip,tbutter/zulip,tiansiyuan/zulip,punchagan/zulip,ipernet/zulip,eastlhu/zulip,jrowan/zulip,proliming/zulip,peiwei/zulip,paxapy/zulip,dattatreya303/zulip,reyha/zulip,m1ssou/zulip,deer-hope/zulip,andersk/zulip,hengqujushi/zulip,eeshangarg/zulip,bastianh/zulip,ryanbackman/zulip,isht3/zulip,niftynei/zulip,shrikrishnaholla/zulip,jphilipsen05/zulip,peguin40/zulip,mansilladev/zulip,amanharitsh123/zulip,tiansiyuan/zulip,so0k/zulip,ApsOps/zulip,Frouk/zulip,nicholasbs/zulip,EasonYi/zulip,peguin40/zulip,krtkmj/zulip,KJin99/zulip,codeKonami/zulip,shrikrishnaholla/zulip,thomasboyt/zulip,hayderimran7/zulip,aakash-cr7/zulip,DazWorrall/zulip,Suninus/zulip,ashwinirudrappa/zulip,souravbadami/zulip,jerryge/zulip,stamhe/zulip,gigawhitlocks/zulip,aps-sids/zulip,rishig/zulip,kaiyuanheshang/zulip,punchagan/zulip,Qgap/zulip,zulip/zulip,guiquanz/zulip,ryanbackman/zulip,deer-hope/zulip,jerryge/zulip,mdavid/zulip,MayB/zulip,bssrdf/zulip,wangdeshui/zulip,zacps/zulip,guiquanz/zulip,arpith/zulip,tdr130/zulip,rht/zulip,kaiyuanheshang/zulip,blaze225/zulip,joyhchen/zulip,isht3/zulip,dattatreya303/zulip,codeKonami/zulip,shrikrishnaholla/zulip,bowlofstew/zulip,PhilSk/zulip,fw1121/zulip,brockwhittaker/zulip,gigawhitlocks/zulip,hustlzp/zulip,saitodisse/zulip,susansls/zulip,adnanh/zulip,stamhe/zulip,glovebx/zulip,easyfmxu/zulip,wweiradio/zulip,umkay/zulip,zwily/zulip,jphilipsen05/zulip,aps-sids/zulip,tommyip/zulip,niftynei/zulip,synicalsyntax/zulip,ryansnowboarder/zulip,aakash-cr7/zulip,armooo/zulip,bastianh/zulip,paxapy/zulip,ahmadassaf/zulip,SmartPeople/zulip,mdavid/zulip,christi3k/zulip,vaidap/zulip,dattatreya303/zulip,codeKonami/zulip,joshisa/zulip,aliceriot/zulip,hayderimran7/zulip,amallia/zulip,PhilSk/zulip,Galexrt/zulip,hafeez3000/zulip,paxapy/zulip,adnanh/zulip,ahmadassaf/zulip,wweiradio/zulip,vikas-parashar/zulip,yuvipanda/zulip,LeeRisk/zulip,Drooids/zulip,saitodisse/zulip,jonesgithub/zulip,mahim97/zulip,huangkebo/zulip,babbage/zulip,itnihao/zulip,timabbott/zulip,paxapy/zulip,hengqujushi/zulip,Suninus/zulip,zorojean/zulip,dawran6/zulip,luyifan/zulip,voidException/zulip,jessedhillon/zulip,ahmadassaf/zulip,kokoar/zulip,codeKonami/zulip,alliejones/zulip,zofuthan/zulip,ApsOps/zulip,qq1012803704/zulip,ahmadassaf/zulip,timabbott/zulip,synicalsyntax/zulip,MariaFaBella85/zulip,sonali0901/zulip,mansilladev/zulip,MayB/zulip,tiansiyuan/zulip,gkotian/zulip,Qgap/zulip,babbage/zulip,thomasboyt/zulip,adnanh/zulip,synicalsyntax/zulip,jrowan/zulip,yuvipanda/zulip,timabbott/zulip,aakash-cr7/zulip,bastianh/zulip,eeshangarg/zulip,j831/zulip,vaidap/zulip,m1ssou/zulip,huangkebo/zulip,j831/zulip,christi3k/zulip,udxxabp/zulip,mohsenSy/zulip,shubhamdhama/zulip,johnnygaddarr/zulip,DazWorrall/zulip,jphilipsen05/zulip,joyhchen/zulip,jphilipsen05/zulip,eeshangarg/zulip,ashwinirudrappa/zulip,shaunstanislaus/zulip,reyha/zulip,joyhchen/zulip,samatdav/zulip,peiwei/zulip,jonesgithub/zulip,atomic-labs/zulip,dawran6/zulip,bluesea/zulip,lfranchi/zulip,verma-varsha/zulip,tommyip/zulip,wangdeshui/zulip,JPJPJPOPOP/zulip,swinghu/zulip,KingxBanana/zulip,ashwinirudrappa/zulip,mahim97/zulip,LAndreas/zulip,tbutter/zulip,akuseru/zulip,dhcrzf/zulip,developerfm/zulip,wangdeshui/zulip,PhilSk/zulip,showell/zulip,JanzTam/zulip,amallia/zulip,souravbadami/zulip,technicalpickles/zulip,Diptanshu8/zulip,fw1121/zulip,bssrdf/zulip,calvinleenyc/zulip,zofuthan/zulip,rishig/zulip,dotcool/zulip,xuanhan863/zulip,andersk/zulip,mansilladev/zulip,firstblade/zulip,swinghu/zulip,hafeez3000/zulip,zwily/zulip,eastlhu/zulip,Qgap/zulip,calvinleenyc/zulip,saitodisse/zulip,isht3/zulip,Juanvulcano/zulip,bitemyapp/zulip,brockwhittaker/zulip,bowlofstew/zulip,arpith/zulip,hj3938/zulip,MayB/zulip,Jianchun1/zulip,Cheppers/zulip,Juanvulcano/zulip,rishig/zulip,hayderimran7/zulip,JanzTam/zulip,dnmfarrell/zulip,reyha/zulip,EasonYi/zulip,ikasumiwt/zulip,saitodisse/zulip,yuvipanda/zulip,tommyip/zulip,sonali0901/zulip,cosmicAsymmetry/zulip,guiquanz/zulip,m1ssou/zulip,bowlofstew/zulip,jainayush975/zulip,grave-w-grave/zulip,kou/zulip,souravbadami/zulip,Vallher/zulip,themass/zulip,KJin99/zulip,ryanbackman/zulip,wangdeshui/zulip,mansilladev/zulip,synicalsyntax/zulip,zachallaun/zulip,KJin99/zulip,armooo/zulip,praveenaki/zulip,MariaFaBella85/zulip,bitemyapp/zulip,Qgap/zulip,suxinde2009/zulip,gkotian/zulip,Jianchun1/zulip,tdr130/zulip,huangkebo/zulip,niftynei/zulip,cosmicAsymmetry/zulip,Galexrt/zulip,isht3/zulip,levixie/zulip,so0k/zulip,johnny9/zulip,wavelets/zulip,yocome/zulip,andersk/zulip,themass/zulip,wavelets/zulip,babbage/zulip,developerfm/zulip,samatdav/zulip,proliming/zulip,Drooids/zulip,ikasumiwt/zulip,Batterfii/zulip,paxapy/zulip,aps-sids/zulip,xuxiao/zulip,hackerkid/zulip,verma-varsha/zulip,dawran6/zulip,vabs22/zulip,DazWorrall/zulip,KingxBanana/zulip,proliming/zulip,thomasboyt/zulip,karamcnair/zulip,stamhe/zulip,developerfm/zulip,dhcrzf/zulip,bssrdf/zulip,ipernet/zulip,zhaoweigg/zulip,showell/zulip,babbage/zulip,bitemyapp/zulip,littledogboy/zulip,grave-w-grave/zulip,vabs22/zulip,alliejones/zulip,alliejones/zulip,jainayush975/zulip,ipernet/zulip,peiwei/zulip,brainwane/zulip,saitodisse/zulip,littledogboy/zulip,jeffcao/zulip,xuanhan863/zulip,schatt/zulip,christi3k/zulip,kou/zulip,zofuthan/zulip,zachallaun/zulip,JanzTam/zulip,schatt/zulip,kaiyuanheshang/zulip,ryansnowboarder/zulip,avastu/zulip,zofuthan/zulip,alliejones/zulip,showell/zulip,hustlzp/zulip,codeKonami/zulip,andersk/zulip,ryansnowboarder/zulip,punchagan/zulip,Diptanshu8/zulip,so0k/zulip,hengqujushi/zulip,amanharitsh123/zulip,krtkmj/zulip,JPJPJPOPOP/zulip,moria/zulip,zwily/zulip,armooo/zulip,shubhamdhama/zulip,yuvipanda/zulip,Gabriel0402/zulip,levixie/zulip,sonali0901/zulip,yocome/zulip,jerryge/zulip,bastianh/zulip,PaulPetring/zulip,voidException/zulip,KingxBanana/zulip,Cheppers/zulip,Batterfii/zulip,timabbott/zulip,luyifan/zulip,willingc/zulip,technicalpickles/zulip,he15his/zulip,reyha/zulip,sharmaeklavya2/zulip,EasonYi/zulip,RobotCaleb/zulip,Cheppers/zulip,tommyip/zulip,bluesea/zulip,vaidap/zulip,Qgap/zulip,zwily/zulip,zwily/zulip,j831/zulip,SmartPeople/zulip,levixie/zulip,fw1121/zulip,Gabriel0402/zulip,zhaoweigg/zulip,johnnygaddarr/zulip,mohsenSy/zulip,eeshangarg/zulip,EasonYi/zulip,glovebx/zulip,wdaher/zulip,blaze225/zulip,ufosky-server/zulip,jerryge/zulip,babbage/zulip,Galexrt/zulip,zachallaun/zulip,dawran6/zulip,niftynei/zulip,hengqujushi/zulip,zacps/zulip,developerfm/zulip,blaze225/zulip,Diptanshu8/zulip,aliceriot/zulip,Drooids/zulip,dxq-git/zulip,vakila/zulip,jeffcao/zulip,johnnygaddarr/zulip,kou/zulip,technicalpickles/zulip,hengqujushi/zulip,j831/zulip,KingxBanana/zulip,developerfm/zulip,grave-w-grave/zulip,reyha/zulip,eeshangarg/zulip,jonesgithub/zulip,huangkebo/zulip,jonesgithub/zulip,souravbadami/zulip,ericzhou2008/zulip,Gabriel0402/zulip,jessedhillon/zulip,Jianchun1/zulip,jackrzhang/zulip,luyifan/zulip | ---
+++
@@ -8,7 +8,8 @@
exports.twenty_four_hour_time = _.contains([],
page_params.email);
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
-exports.email_forwarding = page_params.staging;
+exports.email_forwarding = page_params.staging ||
+ _.contains(['customer6.invalid'], page_params.domain);
exports.edit_appears_on_hover = true;
|
b533ebe00bafbe82258190d1345d180dc5640edf | app/pages/browser-warning/BrowserWarning.js | app/pages/browser-warning/BrowserWarning.js | import React from 'react';
function BrowserWarning() {
return (
<div>
<p className="alert alert-warning">
Currently, Varaamo does not support IE11.
We are investigating this issue and finding a solution.
Meanwhile, use another browser (such as
<a href="https://www.google.com/chrome/"> Chrome</a>
,
<a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
or
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
<p className="alert alert-warning">
Varaamo ei tue IE11 selainta tällä hetkellä.
Selvitämme ongelmaa sen ratkaisemiseksi.
Sillä välin, käytä toista selainta (kuten
<a href="https://www.google.com/chrome/"> Chrome</a>
,
<a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
tai
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
</div>
);
}
export default BrowserWarning;
| import React from 'react';
function BrowserWarning() {
return (
<div>
<p className="alert alert-warning">
Currently, Varaamo does not support IE11.
We are investigating this issue and finding a solution.
Meanwhile, use another browser (such as
<a href="https://www.google.com/chrome/"> Chrome</a>
,
<a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
or
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
<p className="alert alert-warning">
Varaamo ei tue IE11 selainta tällä hetkellä.
Selvitämme ongelmaa sen ratkaisemiseksi.
Sillä välin, käytä toista selainta (kuten
<a href="https://www.google.com/chrome/"> Chrome</a>
,
<a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
tai
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
<p className="alert alert-warning">
Varaamo fungerar inte längre med Internet Explorer 11.
Vi arbetar med att lösa problemet.
Under tiden så var vänlig och använd någon annan browser (t.ex
<a href="https://www.google.com/chrome/"> Chrome</a>
,
<a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
eller
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
</div>
);
}
export default BrowserWarning;
| Add swedish translation in browser warning message | Add swedish translation in browser warning message
| JavaScript | mit | fastmonkeys/respa-ui | ---
+++
@@ -25,6 +25,17 @@
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
).
</p>
+ <p className="alert alert-warning">
+ Varaamo fungerar inte längre med Internet Explorer 11.
+ Vi arbetar med att lösa problemet.
+ Under tiden så var vänlig och använd någon annan browser (t.ex
+ <a href="https://www.google.com/chrome/"> Chrome</a>
+ ,
+ <a href="https://www.mozilla.org/en-US/firefox/new/"> Firefox </a>
+ eller
+ <a href="https://www.microsoft.com/en-us/windows/microsoft-edge"> Edge</a>
+ ).
+ </p>
</div>
);
} |
a9e4fd9eea5f4f1edcf8dedf38b10f80d877fa92 | src/native/utils/game-loop.js | src/native/utils/game-loop.js | export default class GameLoop {
loop = () => {
this.subscribers.forEach((callback) => {
callback.call();
});
this.loopID = window.requestAnimationFrame(this.loop);
}
constructor() {
this.subscribers = [];
this.loopID = null;
}
start() {
if (!this.loopID) {
this.loop();
}
}
stop() {
window.cancelAnimationFrame(this.loop);
}
subscribe(callback) {
return this.subscribers.push(callback);
}
unsubscribe(id) {
this.subscribers.splice((id - 1), 1);
}
}
| export default class GameLoop {
loop = () => {
this.subscribers.forEach((callback) => {
callback.call();
});
this.loopID = window.requestAnimationFrame(this.loop);
}
constructor() {
this.subscribers = [];
this.loopID = null;
}
start() {
if (!this.loopID) {
this.loop();
}
}
stop() {
window.cancelAnimationFrame(this.loop);
}
subscribe(callback) {
return this.subscribers.push(callback);
}
unsubscribe(id) {
this.subscribers.splice(this.subscribers.indexOf(id), 1);
}
}
| Fix native splicing as well | Fix native splicing as well
| JavaScript | mit | havster09/react-aliens | ---
+++
@@ -22,6 +22,6 @@
return this.subscribers.push(callback);
}
unsubscribe(id) {
- this.subscribers.splice((id - 1), 1);
+ this.subscribers.splice(this.subscribers.indexOf(id), 1);
}
} |
4525ca92cdb39a69070a5657c4859a5949b49965 | benchmark/load.js | benchmark/load.js | #!/usr/bin/env node
var Locket = require('../')
var cadence = require('cadence')
var path = require('path')
var crypto = require('crypto')
var seedrandom = require('seedrandom')
function pseudo (max) {
var random = seedrandom()()
while (random > max) {
random = seedrandom()()
}
return random
}
cadence(function (step) {
var locket = new Locket(path.join(path.join(__dirname, '../tmp'), 'put'))
step(function () {
locket.open({ createIfMissing: true }, step())
}, function () {
var entries = []
var max = 10000
var type, sha, entry, val = seedrandom(0)()
for (var i = 0; i < 1024; i++) {
type = (pseudo(2) % 2 == 0)
sha = crypto.createHash('sha1')
entry = new Buffer(4)
entry.writeFloatLE(val, 0)
sha.update(entry)
entries.push({
type: type,
key: sha.digest('binary'),
value: val
})
val = pseudo(max)
}
locket.batch(entries, step())
}, function () {
sha = crypto.createHash('sha1')
first_key = new Buffer(4)
first_key.writeFloatLE(seedrandom(0)(), 0)
sha.update(first_key)
locket.get(sha.digest('binary'), function (_, value) {
console.log(value)
})
// ^^^ no idea what's going on here.
})
})(function (error) {
if (error) throw error
})
| #!/usr/bin/env node
var Locket = require('../')
var cadence = require('cadence')
var path = require('path')
var crypto = require('crypto')
var seedrandom = require('seedrandom')
var random = (function () {
var random = seedrandom(0)
return function (max) {
return Math.floor(random() * max)
}
})()
cadence(function (step) {
var locket = new Locket(path.join(path.join(__dirname, '../tmp'), 'put'))
step(function () {
locket.open({ createIfMissing: true }, step())
}, function () {
var entries = []
var type, sha, buffer, value
for (var i = 0; i < 1024; i++) {
var value = random(10000)
sha = crypto.createHash('sha1')
buffer = new Buffer(4)
buffer.writeUInt32BE(value, 0)
sha.update(buffer)
entries.push({
key: sha.digest('binary'),
value: value,
type: !! random(1)
})
}
console.log('here', entries.length)
locket.batch(entries, step())
})(7)
})(function (error) {
if (error) throw error
})
| Implement a write test for Locket. | Implement a write test for Locket.
| JavaScript | mit | bigeasy/locket,bigeasy/locket | ---
+++
@@ -7,13 +7,12 @@
var seedrandom = require('seedrandom')
-function pseudo (max) {
- var random = seedrandom()()
- while (random > max) {
- random = seedrandom()()
+var random = (function () {
+ var random = seedrandom(0)
+ return function (max) {
+ return Math.floor(random() * max)
}
- return random
-}
+})()
cadence(function (step) {
var locket = new Locket(path.join(path.join(__dirname, '../tmp'), 'put'))
@@ -21,34 +20,22 @@
locket.open({ createIfMissing: true }, step())
}, function () {
var entries = []
- var max = 10000
- var type, sha, entry, val = seedrandom(0)()
+ var type, sha, buffer, value
for (var i = 0; i < 1024; i++) {
- type = (pseudo(2) % 2 == 0)
+ var value = random(10000)
sha = crypto.createHash('sha1')
- entry = new Buffer(4)
- entry.writeFloatLE(val, 0)
- sha.update(entry)
-
+ buffer = new Buffer(4)
+ buffer.writeUInt32BE(value, 0)
+ sha.update(buffer)
entries.push({
- type: type,
key: sha.digest('binary'),
- value: val
+ value: value,
+ type: !! random(1)
})
-
- val = pseudo(max)
}
+ console.log('here', entries.length)
locket.batch(entries, step())
- }, function () {
- sha = crypto.createHash('sha1')
- first_key = new Buffer(4)
- first_key.writeFloatLE(seedrandom(0)(), 0)
- sha.update(first_key)
- locket.get(sha.digest('binary'), function (_, value) {
- console.log(value)
- })
- // ^^^ no idea what's going on here.
- })
+ })(7)
})(function (error) {
if (error) throw error
}) |
d12a2d766f9719e5440d20d1badbcd96cdcf178d | site/index.js | site/index.js | "use strict";
var http = require('http');
var path = require('path');
var fs = require('fs');
var mime = require('mime');
function send404 (response) {
response.writeHead(404, {"Content-type" : "text/plain"});
response.write("Error 404: Resource not found");
response.end();
}
function sendPage (response, filePath, fileContents) {
response.writeHead(200, { "Content-type": mime.lookup(path.basename(filePath)) });
response.end(fileContents);
}
function serverWorking (response, absPath) {
fs.exists(absPath, function (exists) {
if (exists) {
fs.readFile(absPath, function (e, data) {
if (e) send404(response);
else sendPage(response, absPath, data);
});
} else send404(response);
});
}
var server = http.createServer(function (request, response) {
var filePath;
if (request.url === '/') filePath = 'index.html';
else if (request.url === '/bus-tracker' || request.url === '/bus-tracker/') filePath = 'bus-tracker.html';
else filePath = request.url;
serverWorking(response, "./" + filePath);
});
server.listen(process.env.PORT || 8080);
console.log("Please go to http://127.0.0.1:8080");
| "use strict";
var http = require('http');
var path = require('path');
var fs = require('fs');
var mime = require('mime');
function send404 (response) {
response.writeHead(404, {"Content-type" : "text/plain"});
response.write("Error 404: Resource not found");
response.end();
}
function sendPage (response, filePath, fileContents) {
response.writeHead(200, { "Content-type": mime.lookup(path.basename(filePath)) });
response.end(fileContents);
}
function serverWorking (response, absPath) {
fs.exists(absPath, function (exists) {
if (exists) {
fs.readFile(absPath, function (e, data) {
if (e) send404(response);
else sendPage(response, absPath, data);
});
} else send404(response);
});
}
var server = http.createServer(function (request, response) {
var filePath;
if (request.url === '/') filePath = 'bus-tracker.html';
else filePath = request.url;
serverWorking(response, "./" + filePath);
});
server.listen(process.env.PORT || 8080);
console.log("Please go to http://127.0.0.1:8080");
| Put bus-tracker as default page | Put bus-tracker as default page
| JavaScript | bsd-3-clause | MXProgrammingClub/bus-tracker-frontend,MXProgrammingClub/bus-tracker-frontend,MXProgrammingClub/bus-tracker-frontend | ---
+++
@@ -29,8 +29,7 @@
var server = http.createServer(function (request, response) {
var filePath;
- if (request.url === '/') filePath = 'index.html';
- else if (request.url === '/bus-tracker' || request.url === '/bus-tracker/') filePath = 'bus-tracker.html';
+ if (request.url === '/') filePath = 'bus-tracker.html';
else filePath = request.url;
serverWorking(response, "./" + filePath); |
1dbc20c1010fbd65e1d0f2ada053923ef672c43c | app/query-editor.js | app/query-editor.js | import React from 'react';
import CodeMirror from 'codemirror';
import './qwery-mode';
import Hint from './hint';
import Completion from './completion';
import QueryRunner from './query-runner';
export default class QueryEditor extends React.Component {
constructor () {
super();
this.state = {};
}
componentDidMount () {
var cm = CodeMirror(this._container, {
lineNumbers: true,
lineSeperator: '\n',
value: '?Person "position held":P39 "President of Amerika":Q11696 ',
mode: 'qwery',
theme: 'qwery'
});
this.setState({cm: cm});
}
render () {
var {cm} = this.state
var hint, queryRunner;
if (cm) {
hint = (
<Hint cm={cm}>
<Completion cm={cm} />
</Hint>
);
queryRunner = (
<QueryRunner cm={cm}/>
);
}
return (
<div className="query-editor">
<div className="query-input">
<div className="query-input-container" ref={(el) => this._container = el}></div>
{hint}
</div>
<div className="query-result">
{queryRunner}
</div>
</div>
)
}
}
| import React from 'react';
import CodeMirror from 'codemirror';
import './qwery-mode';
import Hint from './hint';
import Completion from './completion';
import QueryRunner from './query-runner';
export default class QueryEditor extends React.Component {
constructor () {
super();
this.state = {};
}
componentDidMount () {
var cm = CodeMirror(this._container, {
lineNumbers: true,
lineSeperator: '\n',
value: '?Person "position held":P39 "President of Amerika":Q11696 ',
mode: 'qwery',
theme: 'qwery'
});
var inloop = false;
cm.on('change', function (cm, change) {
var range;
if (!inloop && change.text.length === 1 && change.text[0] === '"') {
inloop = true;
cm.replaceRange('"', cm.getCursor(), cm.getCursor());
cm.setCursor({
line: cm.getCursor().line,
ch: cm.getCursor().ch - 1
})
} else {
inloop = false;
}
});
this.setState({cm: cm});
}
render () {
var {cm} = this.state
var hint, queryRunner;
if (cm) {
hint = (
<Hint cm={cm}>
<Completion cm={cm} />
</Hint>
);
queryRunner = (
<QueryRunner cm={cm}/>
);
}
return (
<div className="query-editor">
<div className="query-input">
<div className="query-input-container" ref={(el) => this._container = el}></div>
{hint}
</div>
<div className="query-result">
{queryRunner}
</div>
</div>
)
}
}
| Add simple closing quotation marks | Add simple closing quotation marks
| JavaScript | mit | paulsonnentag/qwery-me,BrackCurly/qwery-me,BrackCurly/qwery-me,BrackCurly/qwery-me,paulsonnentag/qwery-me,paulsonnentag/qwery-me | ---
+++
@@ -19,6 +19,25 @@
value: '?Person "position held":P39 "President of Amerika":Q11696 ',
mode: 'qwery',
theme: 'qwery'
+ });
+
+ var inloop = false;
+
+ cm.on('change', function (cm, change) {
+ var range;
+
+ if (!inloop && change.text.length === 1 && change.text[0] === '"') {
+ inloop = true;
+
+ cm.replaceRange('"', cm.getCursor(), cm.getCursor());
+ cm.setCursor({
+ line: cm.getCursor().line,
+ ch: cm.getCursor().ch - 1
+ })
+
+ } else {
+ inloop = false;
+ }
});
this.setState({cm: cm}); |
f41645773553db918ea1041e5ddb7ccdf7476b73 | app/scripts/main.js | app/scripts/main.js | require.config({
// alias libraries paths
paths: {
'domReady': '../bower_components/requirejs-domready/domReady',
'angular': '../bower_components/angular/angular',
'jquery': '../bower_components/jquery/jquery',
'ui.bootstrap': '../bower_components/angular-bootstrap/ui-bootstrap-tpls',
'store': '../bower_components/store/store'
},
// angular does not support AMD out of the box, put it in a shim
shim: {
'angular': {
exports: 'angular'
},
'ui.bootstrap': {
deps: ['angular']
}
},
// kick start application
deps: ['./bootstrap']
}); | require.config({
// alias libraries paths
paths: {
'domReady': '../bower_components/requirejs-domready/domReady',
'angular': '../bower_components/angular/angular',
'jquery': '../bower_components/jquery/jquery',
'masonry': '../bower_components/masonry/masonry',
'lodash': '../bower_components/lodash/dist/lodash',
'doc-ready/doc-ready': '../bower_components/doc-ready/doc-ready',
'get-style-property/get-style-property': '../bower_components/get-style-property/get-style-property',
'matches-selector/matches-selector': '../bower_components/matches-selector/matches-selector',
'outlayer/item': '../bower_components/outlayer/item',
'outlayer/outlayer': '../bower_components/outlayer/outlayer',
'get-size/get-size': '../bower_components/get-size/get-size',
'eventie/eventie': '../bower_components/eventie/eventie',
'eventEmitter/EventEmitter': '../bower_components/eventEmitter/EventEmitter',
'imagesLoaded': '../bower_components/imagesloaded/imagesloaded',
'ui.bootstrap': '../bower_components/angular-bootstrap/ui-bootstrap-tpls',
'store': '../bower_components/store/store'
},
// angular does not support AMD out of the box, put it in a shim
shim: {
'angular': {
exports: 'angular'
},
'ui.bootstrap': {
deps: ['angular']
}
},
// kick start application
deps: ['./bootstrap']
}); | Add new dependencies paths to requirejs config | Add new dependencies paths to requirejs config
| JavaScript | mit | loginwashere/pixel-clicker | ---
+++
@@ -5,6 +5,17 @@
'domReady': '../bower_components/requirejs-domready/domReady',
'angular': '../bower_components/angular/angular',
'jquery': '../bower_components/jquery/jquery',
+ 'masonry': '../bower_components/masonry/masonry',
+ 'lodash': '../bower_components/lodash/dist/lodash',
+ 'doc-ready/doc-ready': '../bower_components/doc-ready/doc-ready',
+ 'get-style-property/get-style-property': '../bower_components/get-style-property/get-style-property',
+ 'matches-selector/matches-selector': '../bower_components/matches-selector/matches-selector',
+ 'outlayer/item': '../bower_components/outlayer/item',
+ 'outlayer/outlayer': '../bower_components/outlayer/outlayer',
+ 'get-size/get-size': '../bower_components/get-size/get-size',
+ 'eventie/eventie': '../bower_components/eventie/eventie',
+ 'eventEmitter/EventEmitter': '../bower_components/eventEmitter/EventEmitter',
+ 'imagesLoaded': '../bower_components/imagesloaded/imagesloaded',
'ui.bootstrap': '../bower_components/angular-bootstrap/ui-bootstrap-tpls',
'store': '../bower_components/store/store'
}, |
7b14ccbb14cb28c3a1fbf2499114858125d808a2 | app/components/shared/Button.js | app/components/shared/Button.js | import React, { Component, PropTypes } from 'react';
import {
Text,
TouchableHighlight
} from 'react-native';
class Button extends Component {
constructor(props) {
super(props);
}
render() {
const {theme, disabled} = this.props;
const {styles} = theme;
const btnStyles = [styles.button];
if (disabled) {
btnStyles.push(styles.buttonDisabled);
}
return (
<TouchableHighlight
onPress={this.props.onPress}
style={btnStyles}
underlayColor="#a30000"
activeOpacity={1}>
<Text style={styles.buttonText}>{this.props.children}</Text>
</TouchableHighlight>
);
}
}
Button.propTypes = {
styles: PropTypes.object,
onPress: PropTypes.func
};
export default Button;
| import React, { PropTypes } from 'react';
import {
Text,
TouchableHighlight
} from 'react-native';
const Button = ({theme, disabled}) => {
const {styles} = theme;
const btnStyles = [styles.button];
if (disabled) {
btnStyles.push(styles.buttonDisabled);
}
return (
<TouchableHighlight
onPress={this.props.onPress}
style={btnStyles}
underlayColor="#a30000"
activeOpacity={1}>
<Text style={styles.buttonText}>{this.props.children}</Text>
</TouchableHighlight>
);
};
Button.propTypes = {
styles: PropTypes.object,
onPress: PropTypes.func
};
export default Button;
| Make button a stateless component | Make button a stateless component
| JavaScript | mit | uiheros/react-native-redux-todo-list,uiheros/react-native-redux-todo-list,uiheros/react-native-redux-todo-list | ---
+++
@@ -1,34 +1,26 @@
-import React, { Component, PropTypes } from 'react';
+import React, { PropTypes } from 'react';
import {
Text,
TouchableHighlight
} from 'react-native';
-class Button extends Component {
- constructor(props) {
- super(props);
+const Button = ({theme, disabled}) => {
+ const {styles} = theme;
+ const btnStyles = [styles.button];
+ if (disabled) {
+ btnStyles.push(styles.buttonDisabled);
}
- render() {
- const {theme, disabled} = this.props;
- const {styles} = theme;
-
- const btnStyles = [styles.button];
- if (disabled) {
- btnStyles.push(styles.buttonDisabled);
- }
-
- return (
- <TouchableHighlight
- onPress={this.props.onPress}
- style={btnStyles}
- underlayColor="#a30000"
- activeOpacity={1}>
- <Text style={styles.buttonText}>{this.props.children}</Text>
- </TouchableHighlight>
- );
- }
-}
+ return (
+ <TouchableHighlight
+ onPress={this.props.onPress}
+ style={btnStyles}
+ underlayColor="#a30000"
+ activeOpacity={1}>
+ <Text style={styles.buttonText}>{this.props.children}</Text>
+ </TouchableHighlight>
+ );
+};
Button.propTypes = {
styles: PropTypes.object, |
b460ef197fbc662e7689369142ddab3a0971a33b | app/directives/SelectOnClick.js | app/directives/SelectOnClick.js | angular.module('app')
.directive('selectOnClick', function () {
return {
restrict: 'A',
link: function (scope, element) {
var focusedElement;
element.on('click', function () {
if (focusedElement != this) {
this.select();
focusedElement = this;
}
});
element.on('blur', function () {
focusedElement = null;
});
}
};
}) | angular.module('app')
.directive('selectOnClick', function () {
return {
restrict: 'A',
link: function (scope, element) {
var focusedElement;
element.on('click', function () {
if (focusedElement != this) {
this.setSelectionRange(0, this.value.length);
focusedElement = this;
}
});
element.on('blur', function () {
focusedElement = null;
});
}
};
}) | Fix issue with selecting text input on iOS | Fix issue with selecting text input on iOS
| JavaScript | mit | olyckne/FO,olyckne/FO | ---
+++
@@ -6,7 +6,7 @@
var focusedElement;
element.on('click', function () {
if (focusedElement != this) {
- this.select();
+ this.setSelectionRange(0, this.value.length);
focusedElement = this;
}
}); |
ea34be8eed7fda0ed90dbb3d10fbb84ebf600ac9 | react.js | react.js | module.exports = {
'extends': './index.js',
'plugins': [
'react'
],
'ecmaFeatures': {
'jsx': true
},
'rules': {
'react/display-name': 0,
'react/jsx-boolean-value': 2,
'react/jsx-no-undef': 2,
'react/jsx-quotes': [2, 'single', 'avoid-escape'],
'react/jsx-uses-react': 1,
'react/jsx-uses-vars': 1,
'react/no-did-mount-set-state': 1,
'react/no-did-update-set-state': 1,
'react/no-multi-comp': 1,
'react/no-unknown-property': 2,
'react/prop-types': 2,
'react/react-in-jsx-scope': 1,
'react/self-closing-comp': 2,
'react/sort-comp': 2,
'react/wrap-multilines': 2,
}
};
| module.exports = {
'extends': './index.js',
'plugins': [
'react'
],
'ecmaFeatures': {
'jsx': true
},
'rules': {
'react/display-name': 0,
'react/jsx-boolean-value': 2,
'react/jsx-no-undef': 2,
'react/jsx-quotes': [2, 'single', 'avoid-escape'],
'react/jsx-uses-react': 1,
'react/jsx-uses-vars': 1,
'react/no-did-mount-set-state': [1, 'allow-in-func'],
'react/no-did-update-set-state': 1,
'react/no-multi-comp': 1,
'react/no-unknown-property': 2,
'react/prop-types': 2,
'react/react-in-jsx-scope': 1,
'react/self-closing-comp': 2,
'react/sort-comp': 2,
'react/wrap-multilines': 2,
}
};
| Allow calling `setState` nested in a function in `componentDidMount` | Allow calling `setState` nested in a function in `componentDidMount`
For motivation see
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md#allow-in-func-mode | JavaScript | mit | brigade/eslint-config-brigade | ---
+++
@@ -16,7 +16,7 @@
'react/jsx-quotes': [2, 'single', 'avoid-escape'],
'react/jsx-uses-react': 1,
'react/jsx-uses-vars': 1,
- 'react/no-did-mount-set-state': 1,
+ 'react/no-did-mount-set-state': [1, 'allow-in-func'],
'react/no-did-update-set-state': 1,
'react/no-multi-comp': 1,
'react/no-unknown-property': 2, |
e17bb98bcc5c188308b57b8e5eb462b77f9092b2 | src/String.js | src/String.js | /**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
String.prototype.toUpper = function() {
return "";
}; | /**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
/**
* To Upper
*
* toUpper converts its calling string to all uppercase characters
*
* @param {void}
* @return {String} returns an upperCase version of the calling string
*/
String.prototype.toUpper = function() {
var inputString = this;
var lowerCasePattern = /[a-z]/g;
return inputString.replace(lowerCasePattern, function(item, position, string) {
return String.fromCharCode(string.charCodeAt(position)-32);
});
}; | Modify toUpper to return uppercase of its calling string | Modify toUpper to return uppercase of its calling string
| JavaScript | mit | andela-oolutola/string-class,andela-oolutola/string-class | ---
+++
@@ -12,6 +12,19 @@
return /[aeiou]/gi.test(inputString);
};
+/**
+ * To Upper
+ *
+ * toUpper converts its calling string to all uppercase characters
+ *
+ * @param {void}
+ * @return {String} returns an upperCase version of the calling string
+ */
String.prototype.toUpper = function() {
- return "";
+ var inputString = this;
+ var lowerCasePattern = /[a-z]/g;
+
+ return inputString.replace(lowerCasePattern, function(item, position, string) {
+ return String.fromCharCode(string.charCodeAt(position)-32);
+ });
}; |
f6511c1f514f7a3fe52f355dba9de371b141a890 | src/carousel.js | src/carousel.js | import Vue from "vue";
import VueResource from "vue-resource";
import Carousel from "./components/Carousel.vue";
import styles from './carousel.css';
Vue.use(VueResource);
Vue.config.debug = true;
const carousel = new Vue({
el: "#your-application-id",
components: { Carousel },
mounted() {
// Debug purpose
if(Vue.config.debug)
{
console.log("Debug is on");
}
}
});
| import Vue from "vue";
import VueResource from "vue-resource";
import Carousel from "./components/Carousel.vue";
import styles from './carousel.css';
Vue.use(VueResource);
Vue.config.debug = true;
const carousel = new Vue({
el: "#your-application-id",
components: { Carousel },
mounted() {
// Debug purpose
if(Vue.config.debug) {
console.log("Debug is on");
}
}
});
| Remove new line from the if | Remove new line from the if | JavaScript | mit | ludo237/photo-gallery,ludo237/vuejs-carousel,ludo237/vuejs-carousel,ludo237/photo-gallery | ---
+++
@@ -12,8 +12,7 @@
mounted() {
// Debug purpose
- if(Vue.config.debug)
- {
+ if(Vue.config.debug) {
console.log("Debug is on");
}
} |
a4493c011466778fae7375e84a9aa278671a3e8e | src/sources/youtube/Player.js | src/sources/youtube/Player.js | import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import YouTubePlayerEmbed from './PlayerEmbed';
const YouTubePlayer = ({
active,
className,
enabled,
mode,
media,
seek,
volume,
}) => {
const modeClass = `src-youtube-Player--${mode}`;
// Wrapper span so the backdrop can be full-size…
return (
<span hidden={!active}>
<div className={cx('src-youtube-Player', modeClass, className)}>
{enabled && (
<YouTubePlayerEmbed
media={media}
active={active}
seek={Math.round(seek)}
volume={volume}
controllable={mode === 'preview'}
/>
)}
</div>
</span>
);
};
YouTubePlayer.propTypes = {
className: PropTypes.string,
mode: PropTypes.oneOf(['small', 'large', 'preview']),
active: PropTypes.bool.isRequired,
enabled: PropTypes.bool,
media: PropTypes.object,
seek: PropTypes.number,
volume: PropTypes.number,
};
export default YouTubePlayer;
| import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import YouTubePlayerEmbed from './PlayerEmbed';
const YouTubePlayer = ({
active,
className,
enabled,
mode,
media,
seek,
volume,
}) => {
const modeClass = `src-youtube-Player--${mode}`;
return (
<div className={cx('src-youtube-Player', modeClass, className)} hidden={!active}>
{enabled && (
<YouTubePlayerEmbed
media={media}
active={active}
seek={Math.round(seek)}
volume={volume}
controllable={mode === 'preview'}
/>
)}
</div>
);
};
YouTubePlayer.propTypes = {
className: PropTypes.string,
mode: PropTypes.oneOf(['small', 'large', 'preview']),
active: PropTypes.bool.isRequired,
enabled: PropTypes.bool,
media: PropTypes.object,
seek: PropTypes.number,
volume: PropTypes.number,
};
export default YouTubePlayer;
| Remove unnecessary wrapper span from YouTube player. | Remove unnecessary wrapper span from YouTube player.
| JavaScript | mit | u-wave/web,welovekpop/uwave-web-welovekpop.club,u-wave/web,welovekpop/uwave-web-welovekpop.club | ---
+++
@@ -14,21 +14,18 @@
}) => {
const modeClass = `src-youtube-Player--${mode}`;
- // Wrapper span so the backdrop can be full-size…
return (
- <span hidden={!active}>
- <div className={cx('src-youtube-Player', modeClass, className)}>
- {enabled && (
- <YouTubePlayerEmbed
- media={media}
- active={active}
- seek={Math.round(seek)}
- volume={volume}
- controllable={mode === 'preview'}
- />
- )}
- </div>
- </span>
+ <div className={cx('src-youtube-Player', modeClass, className)} hidden={!active}>
+ {enabled && (
+ <YouTubePlayerEmbed
+ media={media}
+ active={active}
+ seek={Math.round(seek)}
+ volume={volume}
+ controllable={mode === 'preview'}
+ />
+ )}
+ </div>
);
};
|
5e0759e56e01bd6e0b4a6f6e55c624ebb881f736 | ng-justgage.js | ng-justgage.js | angular.module("ngJustGage", [])
.directive('justGage', ['$timeout', function ($timeout) {
return {
restrict: 'EA',
scope: {
id: '@',
class: '@',
min: '=',
max: '=',
title: '@',
value: '='
},
template: '<div id="{{id}}-justgage" class="{{class}}"></div>',
link: function (scope) {
$timeout(function () {
var graph = new JustGage({
id: scope.id + '-justgage',
min: scope.min,
max: scope.max,
title: scope.title,
value: scope.value
});
scope.$watch('max', function (updatedMax) {
if (updatedMax) {
graph.refresh(scope.value, updatedMax);
}
}, true);
scope.$watch('value', function (updatedValue) {
if (updatedValue) {
graph.refresh(updatedValue);
}
}, true);
});
}
};
}]);
| angular.module("ngJustGage", [])
.directive('justGage', ['$timeout', function ($timeout) {
return {
restrict: 'EA',
scope: {
id: '@',
class: '@',
min: '=',
max: '=',
title: '@',
value: '=',
options: '='
},
template: '<div id="{{id}}-justgage" class="{{class}}"></div>',
link: function (scope,element,attrs) {
$timeout(function () {
var options = {
id: scope.id + '-justgage',
min: scope.min,
max: scope.max,
title: scope.title,
value: scope.value
}
if ( scope.options ) {
for (var key in scope.options) {
options[key]=scope.options[key];
}
}
var graph = new JustGage(options);
scope.$watch('max', function (updatedMax) {
if (updatedMax) {
graph.refresh(scope.value, updatedMax);
}
}, true);
scope.$watch('value', function (updatedValue) {
if (updatedValue) {
graph.refresh(updatedValue);
}
}, true);
});
}
};
}]);
| Add options attribute to pass a complete options list to directive | Add options attribute to pass a complete options list to directive
The option attribute must contains an object with the additional options
you want to pass to the justgage object. Normal option are still use but
will be overload by object if declared twice.
Here's a sample to use levelColors and levelGradiant.
All justgage option are now available for the directive.
<just-gage
id="demo"
class=""
min=0 max=100 value="92"
title="Demo"
options="{
levelColors: ['#CE1B21', '#D0532A', '#FFC414', '#85A137']
,levelGradiant: false
}
">
</just-gage>
| JavaScript | mit | mattlaver/angular-justgage,mattlaver/angular-justgage | ---
+++
@@ -8,18 +8,25 @@
min: '=',
max: '=',
title: '@',
- value: '='
+ value: '=',
+ options: '='
},
template: '<div id="{{id}}-justgage" class="{{class}}"></div>',
- link: function (scope) {
+ link: function (scope,element,attrs) {
$timeout(function () {
- var graph = new JustGage({
+ var options = {
id: scope.id + '-justgage',
min: scope.min,
max: scope.max,
title: scope.title,
value: scope.value
- });
+ }
+ if ( scope.options ) {
+ for (var key in scope.options) {
+ options[key]=scope.options[key];
+ }
+ }
+ var graph = new JustGage(options);
scope.$watch('max', function (updatedMax) {
if (updatedMax) { |
8b985cc16bda9cf1efe2841b8e29a6a0ca01a7da | pages/index.js | pages/index.js | import React from 'react'
import {withReduxSaga} from 'configureStore'
import Layout from 'components/Layout'
import HomeHero from 'components/HomeHero'
import ProgramsList from 'containers/ProgramsList'
import SearchBar from 'containers/SearchBar'
class HomePage extends React.Component {
render () {
return (
<Layout>
<div id='home-page'>
<HomeHero />
<section className='section'>
<SearchBar />
<ProgramsList />
</section>
</div>
</Layout>
)
}
}
export default withReduxSaga(HomePage)
| import React from 'react'
import {withReduxSaga} from 'configureStore'
import Layout from 'components/Layout'
import HomeHero from 'components/HomeHero'
import ProgramsList from 'containers/ProgramsList'
import SearchBar from 'containers/SearchBar'
class HomePage extends React.Component {
render () {
return (
<Layout>
<div id='home-page'>
<HomeHero />
<section className='section'>
<div className='notification is-warning content has-text-centered'>
Ce site en version Alpha est actuellement en développement actif. Merci de ne pas tenir compte des disfonctionnements pour le moment.
</div>
<SearchBar />
<ProgramsList />
</section>
</div>
</Layout>
)
}
}
export default withReduxSaga(HomePage)
| Add warning message on site alpha version | Add warning message on site alpha version
| JavaScript | mit | bmagic/acdh-client | ---
+++
@@ -13,6 +13,9 @@
<div id='home-page'>
<HomeHero />
<section className='section'>
+ <div className='notification is-warning content has-text-centered'>
+ Ce site en version Alpha est actuellement en développement actif. Merci de ne pas tenir compte des disfonctionnements pour le moment.
+ </div>
<SearchBar />
<ProgramsList />
</section> |
5ca507223decf01768fbb245afa6df55800c7ed8 | src/js/popup.js | src/js/popup.js | /**
* Popup script
*/
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app-component';
ReactDOM.render(<App/>, document.getElementById('styleme-app'));
| /**
* Popup script
*/
'use strict';
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app-component';
ReactDOM.render(<App/>, document.getElementById('styleme-app'));
| Include babel-polyfill for using Promises | Include babel-polyfill for using Promises
| JavaScript | mit | dashukin/StyleMe,dashukin/StyleMe | ---
+++
@@ -4,6 +4,7 @@
'use strict';
+import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app-component'; |
8d1b0b79cd530e66cd0181dd44a8a9d69bf1652e | public/script/project.js | public/script/project.js | function sortProject(changeEvent) {
var data = {};
// Get old and new index from event
data.oldIndex = changeEvent.oldIndex;
data.newIndex = changeEvent.newIndex;
// Get filters
data.filters = {};
data.filters = getCurrentFilters();
// Get project id from event item
data.projectId = $(changeEvent.item).children('input.cb-completed').val();
console.log(data);
// Make AJAX call to sort
// TODO: Function to match index with task
// TODO: Function to update sequences on update
// TODO: make this queue-able
}
| function sortProject(changeEvent) {
var data = {};
// Get old and new index from event
data.oldIndex = changeEvent.oldIndex;
data.newIndex = changeEvent.newIndex;
// Get filters
data.filters = {};
data.filters = getCurrentFilters();
// Get project id from event item
data.projectId = $(changeEvent.item).children('input.cb-completed').val();
console.log(data);
// Make AJAX call to sort
// TODO: Function to match index with task
// TODO: Function to update sequences on update
// TODO: make this queue-able
}
| Clean up unfinished work + conflict | Clean up unfinished work + conflict
| JavaScript | mit | BBBThunda/projectify,BBBThunda/projectify,BBBThunda/projectify | ---
+++
@@ -21,5 +21,5 @@
// TODO: Function to update sequences on update
// TODO: make this queue-able
+
}
- |
b2d3cce4cbfdf6514b892cd530553eeaca9e61ef | postcss.config.js | postcss.config.js | /*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
module.exports = {
plugins: {
autoprefixer: {
browsers: [
"Android 2.3",
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
]
}
},
}
| /*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
module.exports = {
plugins: {
autoprefixer: {}
},
}
| Remove browsers from PostCSS Config | Remove browsers from PostCSS Config
Specifying browsers via this config is not recommended. The best way to provide browsers is a .browserslistrc file in your project root, or by adding a browserslist key to your package.json. (see: https://github.com/postcss/autoprefixer). However, if you don't define the supported browsers the default browsers option will be used (which is a great setup).
REF: https://github.com/browserslist/browserslist#full-list | JavaScript | apache-2.0 | google/docsy,grpc/grpc.io-docsy,grpc/grpc.io-docsy,google/docsy | ---
+++
@@ -16,17 +16,6 @@
module.exports = {
plugins: {
- autoprefixer: {
- browsers: [
- "Android 2.3",
- "Android >= 4",
- "Chrome >= 20",
- "Firefox >= 24",
- "Explorer >= 8",
- "iOS >= 6",
- "Opera >= 12",
- "Safari >= 6"
- ]
- }
+ autoprefixer: {}
},
} |
d2a960c8e0f5d219a59377c3230033720e91683f | components/prism-python.js | components/prism-python.js | Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,
'boolean' : /\b(True|False)\b/g,
'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
'ignore' : /&(lt|gt|amp);/gi,
'punctuation' : /[{}[\];(),.:]/g
};
| Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,
'boolean' : /\b(True|False)\b/g,
'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi,
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
'ignore' : /&(lt|gt|amp);/gi,
'punctuation' : /[{}[\];(),.:]/g
};
| Fix numbers in Python (octal, binary, imaginary) | Fix numbers in Python (octal, binary, imaginary)
| JavaScript | mit | JustinBeckwith/prism,CupOfTea696/prism,chaosshen/prism,danielberkompas/prism,mcanthony/prism,MakeNowJust/prism,manfer/prism,PrismJS/prism,iwatakeshi/prism,mcanthony/prism,nauzilus/prism,MakeNowJust/prism,desertjim/prism,mooreInteractive/prism,danielberkompas/prism,aviaryan/prism,RobLoach/prism,nauzilus/prism,valorkin/prism,EpicTimoZz/prism,mcanthony/prism,valorkin/prism,chaosshen/prism,codedogfish/prism,codedogfish/prism,kwangkim/prism,Golmote/prism,JustinBeckwith/prism,aviaryan/prism,iwatakeshi/prism,zeitgeist87/prism,nauzilus/prism,desertjim/prism,markcarver/prism,1st1/prism,mAAdhaTTah/prism,MakeNowJust/prism,iamsowmyan/prism,MakeNowJust/prism,Golmote/prism,gibsjose/prism,PrismJS/prism,EpicTimoZz/prism,valorkin/prism,aviaryan/prism,aviaryan/prism,Golmote/prism,markcarver/prism,CupOfTea696/prism,markcarver/prism,UnityTech/prism,PrismJS/prism,EpicTimoZz/prism,iwatakeshi/prism,danielberkompas/prism,zeitgeist87/prism,RobLoach/prism,chaosshen/prism,byverdu/prism,mAAdhaTTah/prism,iamsowmyan/prism,codedogfish/prism,zeitgeist87/prism,PrismJS/prism,lgiraudel/prism,markcarver/prism,alex-zhang/prism,codedogfish/prism,1st1/prism,iwatakeshi/prism,alex-zhang/prism,byverdu/prism,desertjim/prism,westonganger/prism,jcsesecuneta/prism,iamsowmyan/prism,desertjim/prism,UnityTech/prism,codedogfish/prism,Golmote/prism,byverdu/prism,zeitgeist87/prism,mcanthony/prism,Conaclos/prism,murtaugh/prism,alex-zhang/prism,gibsjose/prism,UnityTech/prism,mAAdhaTTah/prism,lgiraudel/prism,mAAdhaTTah/prism,westonganger/prism,danielberkompas/prism,jcsesecuneta/prism,CupOfTea696/prism,nauzilus/prism,jalleyne/prism,mAAdhaTTah/prism,iamsowmyan/prism,iamsowmyan/prism,CupOfTea696/prism,aviaryan/prism,jalleyne/prism,mooreInteractive/prism,byverdu/prism,MakeNowJust/prism,murtaugh/prism,chaosshen/prism,nauzilus/prism,Golmote/prism,iwatakeshi/prism,markcarver/prism,jalleyne/prism,zeitgeist87/prism,jalleyne/prism,alex-zhang/prism,CupOfTea696/prism,kwangkim/prism,desertjim/prism,danielberkompas/prism,chaosshen/prism,alex-zhang/prism,manfer/prism,mcanthony/prism,PrismJS/prism,byverdu/prism,jalleyne/prism | ---
+++
@@ -6,7 +6,7 @@
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,
'boolean' : /\b(True|False)\b/g,
- 'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
+ 'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi,
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
'ignore' : /&(lt|gt|amp);/gi,
'punctuation' : /[{}[\];(),.:]/g |
9dd1456038eafb0735bb1790cc8de029e58dd039 | src/js/app.js | src/js/app.js | 'use strict';
angular.module('sk.backgammon', [])
.controller('MainCtrl', ['$scope', function ($scope) {
}]);
| 'use strict';
angular.module('sk.backgammon', [])
.controller('MainCtrl', ['$scope', function ($scope) {
$scope.stones = Array.apply(null, new Array(30)).map(function(e, i, arr) {
return {
player: (i % 2 ) ? 'black' : 'white',
position: i
}
});
}]);
| Initialize array with 30 black and white stones/checkers. | Initialize array with 30 black and white stones/checkers.
| JavaScript | mit | stamkracht/backgammon,stamkracht/backgammon | ---
+++
@@ -2,5 +2,11 @@
angular.module('sk.backgammon', [])
.controller('MainCtrl', ['$scope', function ($scope) {
+ $scope.stones = Array.apply(null, new Array(30)).map(function(e, i, arr) {
+ return {
+ player: (i % 2 ) ? 'black' : 'white',
+ position: i
+ }
+ });
}]);
|
ddca8c7660b6010aa21c0a6993eaff79985601b0 | src/steemAPI.js | src/steemAPI.js | import { api } from 'steem';
module.exports = api;
| import { api } from 'steem';
api.setWebSocket('ws://138.201.198.167:8090');
module.exports = api;
| Change WebSocket to @faddat one | Change WebSocket to @faddat one
| JavaScript | mit | Sekhmet/busy,busyorg/busy,ryanbaer/busy,ryanbaer/busy,Sekhmet/busy,busyorg/busy | ---
+++
@@ -1,3 +1,5 @@
import { api } from 'steem';
+api.setWebSocket('ws://138.201.198.167:8090');
+
module.exports = api; |
d4828f471fe14b7843cb50ab2e6cfb63d3cdf8e0 | test/index.js | test/index.js |
/**
* Module dependencies.
*/
var path = require('path');
var spawn = require('child_process').spawn;
// node executable
var node = process.execPath || process.argv[0];
var gnode = path.resolve(__dirname, '..', 'bin', 'gnode');
var mocha = path.resolve(__dirname, '..', 'node_modules', '.bin', 'mocha');
var mochaOpts = [ '--reporter', 'spec' ];
run([
[ mocha, path.resolve(__dirname, 'cli.js') ]
]);
function run (tests) {
if (0 == tests.length) return;
var argv = tests.shift();
if (argv.indexOf(mocha) != -1) {
// running mocha, append "mochaOpts"
argv.push.apply(argv, mochaOpts);
}
var opts = {
customFds: [ 0, 1, 2 ],
stdio: 'inherit'
};
var child = spawn(node, argv, opts);
child.on('exit', function (code) {
if (0 == code) {
run(tests);
} else {
process.exit(code);
}
});
}
|
/**
* Module dependencies.
*/
var path = require('path');
var spawn = require('child_process').spawn;
// node executable
var node = process.execPath || process.argv[0];
var mocha = path.resolve(__dirname, '..', 'node_modules', 'mocha', 'bin', 'mocha');
var mochaOpts = [ '--reporter', 'spec' ];
run([
[ mocha, path.resolve(__dirname, 'cli.js') ]
]);
function run (tests) {
if (0 == tests.length) return;
var argv = tests.shift();
if (argv.indexOf(mocha) != -1) {
// running mocha, append "mochaOpts"
argv.push.apply(argv, mochaOpts);
}
var opts = {
customFds: [ 0, 1, 2 ],
stdio: 'inherit'
};
var child = spawn(node, argv, opts);
child.on('exit', function (code) {
if (0 == code) {
run(tests);
} else {
process.exit(code);
}
});
}
| Fix `npm test` failing to run | Fix `npm test` failing to run
Trying to run `npm test` fails because the mocha path was set to the
mocha shell script instead of the mocha init script (it tried to spawn
node with a shell script).
This commit fixes the issue and the tests run as expected.
| JavaScript | mit | TooTallNate/gnode | ---
+++
@@ -8,8 +8,7 @@
// node executable
var node = process.execPath || process.argv[0];
-var gnode = path.resolve(__dirname, '..', 'bin', 'gnode');
-var mocha = path.resolve(__dirname, '..', 'node_modules', '.bin', 'mocha');
+var mocha = path.resolve(__dirname, '..', 'node_modules', 'mocha', 'bin', 'mocha');
var mochaOpts = [ '--reporter', 'spec' ];
run([ |
08c88a615de11501f5e1e9e0e4450910c1868599 | src/Operator.js | src/Operator.js |
// add two numbers without using +
function add(a,b) {
if(b == 0)
return a;
var sum = a ^ b;
var carry = (a & b) << 1;
return add(sum,carry);
} |
// add two numbers without using +
function add(a,b) {
if(b == 0)
return a;
var sum = a ^ b;
var carry = (a & b) << 1;
return add(sum,carry);
}
console.log('Sum of 2 & 5 is',add(2,5)); | Add example invocation for operator override for + | Add example invocation for operator override for +
| JavaScript | mit | Pranay92/JS-Overrides | ---
+++
@@ -7,3 +7,5 @@
var carry = (a & b) << 1;
return add(sum,carry);
}
+
+console.log('Sum of 2 & 5 is',add(2,5)); |
6239588bbb9ea1dd01795551a12010c1465a8019 | src/client/app/layout/shell.controller.js | src/client/app/layout/shell.controller.js | (function() {
'use strict';
angular
.module('app.layout')
.controller('ShellController', ShellController);
function ShellController(
$rootScope,
$scope,
config,
logger,
coreevents,
$sessionStorage,
Users
) {
var vm = this;
vm.busyMessage = 'Please wait ...';
vm.isBusy = true;
vm.inHeader = true;
vm.currentUser = null;
activate();
function activate() {
logger.success(config.appTitle + ' loaded!', null);
if ($sessionStorage.user) {
setCurrentUser(null, $sessionStorage.user);
}
$rootScope.$on(coreevents.loginSuccess, setCurrentUser);
$rootScope.$on(coreevents.logoutSuccess, unsetCurrentUser);
}
function setCurrentUser(event, user) {
vm.currentUser = Users.initialize();
vm.currentUser.new = false;
vm.currentUser.stable = true;
vm.currentUser.synchronized = true;
vm.currentUser.data = user.data;
vm.currentUser.refresh();
$sessionStorage.user = user;
}
function unsetCurrentUser(event) {
vm.currentUser = null;
$sessionStorage.user = null;
$scope.$apply();
}
}
})();
| (function() {
'use strict';
angular
.module('app.layout')
.controller('ShellController', ShellController);
function ShellController(
$rootScope,
$scope,
config,
logger,
coreevents,
$sessionStorage,
Users
) {
var vm = this;
vm.busyMessage = 'Please wait ...';
vm.isBusy = true;
vm.inHeader = true;
vm.currentUser = null;
activate();
function activate() {
logger.success(config.appTitle + ' loaded!', null);
if ($sessionStorage.user) {
setCurrentUser(null, $sessionStorage.user);
}
$rootScope.$on(coreevents.loginSuccess, setCurrentUser);
$rootScope.$on(coreevents.logoutSuccess, unsetCurrentUser);
}
function setCurrentUser(event, user) {
vm.currentUser = Users.get(user.data.id);
$sessionStorage.user = user;
}
function unsetCurrentUser(event) {
vm.currentUser = null;
$sessionStorage.user = null;
$scope.$apply();
}
}
})();
| Load initial user data via get | Load initial user data via get
| JavaScript | apache-2.0 | Poniverse/Poniverse.net | ---
+++
@@ -34,14 +34,7 @@
}
function setCurrentUser(event, user) {
- vm.currentUser = Users.initialize();
- vm.currentUser.new = false;
- vm.currentUser.stable = true;
- vm.currentUser.synchronized = true;
- vm.currentUser.data = user.data;
-
- vm.currentUser.refresh();
-
+ vm.currentUser = Users.get(user.data.id);
$sessionStorage.user = user;
}
|
4034135c801f057fb1c891a36f07353221373755 | src/search.js | src/search.js | /*
* Provide a search widget with a popup to enter and clear search terms.
* Test suite can get a handle on this for clean slate testing.
*/
tsbar.initSearchWidget = function(exports, $) {
function SearchWidget() {
this.$compiledTemplate = $(exports.tswidgets.templates['search.hbs'](Handlebars));
//TODO: this is a hack as the pre-compiled templates have carriage returns which confuses jquery
this.$el = $(this.$compiledTemplate[0]);
this.$popup = $(this.$compiledTemplate[2]);
this._widget = tsbar.Widget({
el: this.$el,
popup: this.$popup
});
}
SearchWidget.prototype.getWidget = function() {
return this._widget;
};
SearchWidget.prototype._registerListeners = function() {
this.$popup.find('#tsbar-search-button').click(this._doSearch);
this.$popup.find('#tsbar-clear-button').click(this._doClear);
};
SearchWidget.prototype._doSearch = function() {
var query = $('#tsbar-query-text').val();
$('#tsbar-search-results').load('/hsearch?q=' + query + ' #container');
};
SearchWidget.prototype._doClear = function() {
$('#tsbar-search-results').html('');
$('#tsbar-query-text').val('');
};
function main() {
var searchWidget = new SearchWidget();
searchWidget._registerListeners();
exports.tsbar.searchWidget = searchWidget.getWidget();
}
main();
};
(function(exports, $) {
tsbar.initSearchWidget(exports, $);
}(window, jQuery));
| /*
* Provide a search widget with a popup to enter and clear search terms.
* Test suite can get a handle on this for clean slate testing.
*/
tsbar.initSearchWidget = function(exports, $) {
function SearchWidget() {
this.$compiledTemplate = $(exports.tswidgets.templates['search.hbs'](Handlebars));
this.$el = this.$compiledTemplate.first();
this.$popup = this.$compiledTemplate.last();
this._widget = tsbar.Widget({
el: this.$el,
popup: this.$popup
});
}
SearchWidget.prototype.getWidget = function() {
return this._widget;
};
SearchWidget.prototype._registerListeners = function() {
this.$popup.find('#tsbar-search-button').click(this._doSearch);
this.$popup.find('#tsbar-clear-button').click(this._doClear);
};
SearchWidget.prototype._doSearch = function() {
var query = $('#tsbar-query-text').val();
$('#tsbar-search-results').load('/hsearch?q=' + query + ' #container');
};
SearchWidget.prototype._doClear = function() {
$('#tsbar-search-results').html('');
$('#tsbar-query-text').val('');
};
function main() {
var searchWidget = new SearchWidget();
searchWidget._registerListeners();
exports.tsbar.searchWidget = searchWidget.getWidget();
}
main();
};
(function(exports, $) {
tsbar.initSearchWidget(exports, $);
}(window, jQuery));
| Refactor - slightly more elegant way of splitting the template | Refactor - slightly more elegant way of splitting the template
Splitting the template into the button element and the popup.
| JavaScript | bsd-3-clause | TiddlySpace/tsbar | ---
+++
@@ -7,9 +7,8 @@
function SearchWidget() {
this.$compiledTemplate = $(exports.tswidgets.templates['search.hbs'](Handlebars));
- //TODO: this is a hack as the pre-compiled templates have carriage returns which confuses jquery
- this.$el = $(this.$compiledTemplate[0]);
- this.$popup = $(this.$compiledTemplate[2]);
+ this.$el = this.$compiledTemplate.first();
+ this.$popup = this.$compiledTemplate.last();
this._widget = tsbar.Widget({
el: this.$el, |
64b30166be0c7a82065034e01d00643af5d979fa | sse4_crc32.js | sse4_crc32.js | var sse4_crc32 = require("bindings")("sse4_crc32");
/**
* Defines a progressive 32-bit CRC calculator
*
* @param input The input string for which the CRC is to be calculated
* @param initial_crc The initial CRC passed in [optional]
*
* @constructor
*/
function CRC32(input, initial_crc) {
this.crc32 = initial_crc || 0;
if (input) {
this.update(input);
}
}
/**
* Progressively calculates the 32-bit CRC
*
* @param input Additional input to calculate the CRC for
*/
CRC32.prototype.update = function (input) {
this.crc32 = sse4_crc32.calculate(input, this.crc32);
return this.crc32;
};
/**
* Returns the 32-bit CRC
*
* @returns {Integer}
*/
CRC32.prototype.crc = function () {
return this.crc32;
};
/**
* Used to calculate 32-bit CRC for single instances of strings and/or buffers
*
* @param input The input string for which the CRC is to be calculated
*
* @returns {Integer}
*/
function calculate(input) {
return sse4_crc32.calculate(input, 0);
}
module.exports = {
CRC32 : CRC32,
calculate: calculate
}; | var sse4_crc32 = require("bindings")("sse4_crc32");
/**
* Defines a progressive 32-bit CRC calculator
*
* @param input The input string for which the CRC is to be calculated
* @param initial_crc The initial CRC passed in [optional]
*
* @constructor
*/
function CRC32(input, initial_crc) {
this.crc32 = initial_crc || 0;
if (input) {
this.update(input);
}
}
/**
* Progressively calculates the 32-bit CRC
*
* @param input Additional input to calculate the CRC for
*/
CRC32.prototype.update = function (input) {
this.crc32 = sse4_crc32.calculate(input, this.crc32);
return this.crc32;
};
/**
* Returns the 32-bit CRC
*
* @returns {Integer}
*/
CRC32.prototype.crc = function () {
return this.crc32;
};
/**
* Used to calculate 32-bit CRC for single instances of strings and/or buffers
*
* @param input The input string for which the CRC is to be calculated
* @param initial_crc The initial CRC passed in [optional]
*
* @returns {Integer}
*/
function calculate(input, initial_crc) {
return sse4_crc32.calculate(input, initial_crc || 0);
}
module.exports = {
CRC32 : CRC32,
calculate: calculate
};
| Add optional initial_crc to calculate() | Add optional initial_crc to calculate() | JavaScript | mit | dudleycarr/sse4_crc32,Voxer/sse4_crc32,gagern/sse4_crc32,gagern/sse4_crc32,dudleycarr/sse4_crc32,Voxer/sse4_crc32,dudleycarr/sse4_crc32,dudleycarr/sse4_crc32,Voxer/sse4_crc32,Voxer/sse4_crc32,gagern/sse4_crc32 | ---
+++
@@ -41,11 +41,12 @@
* Used to calculate 32-bit CRC for single instances of strings and/or buffers
*
* @param input The input string for which the CRC is to be calculated
+ * @param initial_crc The initial CRC passed in [optional]
*
* @returns {Integer}
*/
-function calculate(input) {
- return sse4_crc32.calculate(input, 0);
+function calculate(input, initial_crc) {
+ return sse4_crc32.calculate(input, initial_crc || 0);
}
|
b6b3c9fc38f85b310bec6d73d90fda71ef5afed4 | app/scripts/help/main.js | app/scripts/help/main.js | define(['require', 'app', 'backbone.marionette', 'backbone', 'marked', 'underscore'],
function (require, App, Marionette, Backbone, marked, _) {
'use strict';
var controller = {
showHelp: function () {
require(['./views/HelpView'],
function (HelpView) {
$.getJSON('/scripts/help/keyboardShortcuts.json', function (data) {
_.each(data, function (category) {
_.each(category.shortcuts, function (shortcut) {
shortcut.description = marked(shortcut.description);
})
});
var helpModel = new Backbone.Model({keyboardShortcuts: data});
App.mainRegion.show(new HelpView({model: helpModel}));
});
});
}
};
App.addInitializer(function () {
new Marionette.AppRouter({
controller: controller,
appRoutes: {
'help': 'showHelp'
}
});
});
});
| define(['require', 'app', 'backbone.marionette', 'backbone', 'marked',
'underscore', 'json!./keyboardShortcuts.json'],
function (require, App, Marionette, Backbone, marked, _, keyboardShortcuts) {
'use strict';
var controller = {
showHelp: function () {
require(['./views/HelpView'],
function (HelpView) {
_.each(keyboardShortcuts, function (category) {
_.each(category.shortcuts, function (shortcut) {
shortcut.description = marked(shortcut.description);
});
});
var helpModel = new Backbone.Model({keyboardShortcuts: keyboardShortcuts});
App.mainRegion.show(new HelpView({model: helpModel}));
});
}
};
App.addInitializer(function () {
new Marionette.AppRouter({
controller: controller,
appRoutes: {
'help': 'showHelp'
}
});
});
});
| Load keyboard shortcuts json using json requirejs plugin so that it can be compiled into build | Load keyboard shortcuts json using json requirejs plugin so that it can be compiled into build
| JavaScript | mit | chunqi/nusmods,nusmodifications/nusmods,nathanajah/nusmods,mauris/nusmods,nusmodifications/nusmods,nusmodifications/nusmods,chunqi/nusmods,Yunheng/nusmods,Yunheng/nusmods,chunqi/nusmods,nusmodifications/nusmods,zhouyichen/nusmods,zhouyichen/nusmods,mauris/nusmods,mauris/nusmods,mauris/nusmods,zhouyichen/nusmods,Yunheng/nusmods,Yunheng/nusmods,nathanajah/nusmods,nathanajah/nusmods,Yunheng/nusmods,zhouyichen/nusmods,nathanajah/nusmods,chunqi/nusmods | ---
+++
@@ -1,21 +1,20 @@
-define(['require', 'app', 'backbone.marionette', 'backbone', 'marked', 'underscore'],
- function (require, App, Marionette, Backbone, marked, _) {
+define(['require', 'app', 'backbone.marionette', 'backbone', 'marked',
+ 'underscore', 'json!./keyboardShortcuts.json'],
+ function (require, App, Marionette, Backbone, marked, _, keyboardShortcuts) {
'use strict';
var controller = {
showHelp: function () {
require(['./views/HelpView'],
function (HelpView) {
- $.getJSON('/scripts/help/keyboardShortcuts.json', function (data) {
- _.each(data, function (category) {
- _.each(category.shortcuts, function (shortcut) {
- shortcut.description = marked(shortcut.description);
- })
+ _.each(keyboardShortcuts, function (category) {
+ _.each(category.shortcuts, function (shortcut) {
+ shortcut.description = marked(shortcut.description);
});
+ });
- var helpModel = new Backbone.Model({keyboardShortcuts: data});
- App.mainRegion.show(new HelpView({model: helpModel}));
- });
+ var helpModel = new Backbone.Model({keyboardShortcuts: keyboardShortcuts});
+ App.mainRegion.show(new HelpView({model: helpModel}));
});
}
}; |
6f274d1471bda67816e2de21bfc8b0e1897638d9 | lib/bundle/add_process_shim.js | lib/bundle/add_process_shim.js | var makeNode = require("../node/make_node"),
minify = require("../graph/minify"),
prettier = require("prettier");
module.exports = function(bundle, options){
var source = prettier.format(
`
if(typeof process === "undefined") {
process = { env: { NODE_ENV: "development" } };
}
`,
{ useTabs: true }
);
var node = makeNode("[process-shim]", source);
if(options.minify){
minify([node]);
}
bundle.nodes.unshift(node);
};
| var makeNode = require("../node/make_node"),
minify = require("../graph/minify"),
prettier = require("prettier");
module.exports = function(bundle, options){
var source = prettier.format(
`
if(typeof process === "undefined") {
(function(global){
global.process = { env: { NODE_ENV: "development" } };
})(typeof self !== "undefined" : self : global);
}
`,
{ useTabs: true }
);
var node = makeNode("[process-shim]", source);
if(options.minify){
minify([node]);
}
bundle.nodes.unshift(node);
};
| Set the global object explicitly | Set the global object explicitly
| JavaScript | mit | stealjs/steal-tools,stealjs/steal-tools | ---
+++
@@ -6,7 +6,9 @@
var source = prettier.format(
`
if(typeof process === "undefined") {
- process = { env: { NODE_ENV: "development" } };
+ (function(global){
+ global.process = { env: { NODE_ENV: "development" } };
+ })(typeof self !== "undefined" : self : global);
}
`,
{ useTabs: true } |
d7f4f424637e603768af853001efef54e5a5af9b | lib/protocol-handlers/topic.js | lib/protocol-handlers/topic.js |
module.exports = function () {
return function (irc) {
irc.topic = function (channel, topic, fn) {
if (typeof topic === 'function') {
fn = topic;
topic = '';
}
this.write('TOPIC ' + channel + (topic && ' :' + topic || ''), fn);
};
irc.on('RPL_NOTOPIC', function (msg, channel) {
var e = {};
e.target = channel;
e.message = null;
e.raw = msg.string;
irc.emit('topic', e);
});
irc.on('RPL_TOPIC', function (msg, channel, topic) {
var e = {};
e.target = channel;
e.message = topic;
e.raw = msg.string;
irc.emit('topic', e);
});
irc.on('RPL_TOPIC_WHO_TIME', function (msg, channel, nick, time) {
irc.emit('topic:time', {
target: channel,
nick: nick,
time: new Date(time),
raw: msg.string
});
});
irc.on('TOPIC', function (msg) {
var e = {};
e.nick = msg.nick;
e.target = msg.params.split(' ')[0];
e.message = msg.trailing;
e.raw = msg.string;
irc.emit('topic', e);
});
};
};
|
module.exports = function () {
return function (irc) {
irc.topic = function (channel, topic, fn) {
if (typeof topic === 'function') {
fn = topic;
topic = '';
}
this.write('TOPIC ' + channel + (topic && ' :' + topic || ''), fn);
};
irc.on('RPL_NOTOPIC', function (msg, channel) {
var e = {};
e.target = channel;
e.message = null;
e.raw = msg.string;
irc.emit('topic', e);
});
irc.on('RPL_TOPIC', function (msg, channel, topic) {
var e = {};
e.target = channel;
e.message = topic;
e.raw = msg.string;
irc.emit('topic', e);
});
irc.on('RPL_TOPIC_WHO_TIME', function (msg, channel, nick, time) {
irc.emit('topic:time', {
target: channel,
nick: nick,
time: new Date(parseFloat(time)*1000),
raw: msg.string
});
});
irc.on('TOPIC', function (msg) {
var e = {};
e.nick = msg.nick;
e.target = msg.params.split(' ')[0];
e.message = msg.trailing;
e.raw = msg.string;
irc.emit('topic', e);
irc.emit('topic:changed', e);
});
};
};
| Fix date processing on RPL_TOPIC_WHO_TIME | Fix date processing on RPL_TOPIC_WHO_TIME
| JavaScript | mit | ChiperSoft/ircsock.js | ---
+++
@@ -30,7 +30,7 @@
irc.emit('topic:time', {
target: channel,
nick: nick,
- time: new Date(time),
+ time: new Date(parseFloat(time)*1000),
raw: msg.string
});
});
@@ -42,6 +42,7 @@
e.message = msg.trailing;
e.raw = msg.string;
irc.emit('topic', e);
+ irc.emit('topic:changed', e);
});
};
}; |
008d8c2cb63391b2be5b2cbfd0b0bee96058b326 | test/index.js | test/index.js |
var assert = require('assert');
var ghir = require('../dist');
assert.ok(true);
assert(ghir.hasVote('I agree, +1!'));
assert(! ghir.hasVote('I agree, 2+1!'));
assert(! ghir.hasVote('I agree!'));
// assert(ghir.hasVote(' \uD83D\uDC4Db '));
// assert(ghir.hasVote('a\uD83D\uDC4Db'));
// assert(ghir.hasVote('a👍'));
// assert(ghir.hasVote('👍b'));
|
var assert = require('assert');
var ghir = require('../dist');
assert.ok(true);
assert(ghir.hasVote('I agree, +1!'));
assert(! ghir.hasVote('I agree, 2+1!'));
assert(! ghir.hasVote('I agree!'));
assert(ghir.hasVote(' \uD83D\uDC4D '));
assert(ghir.hasVote(' \uD83D\uDC4D b '));
assert(ghir.hasVote('a \uD83D\uDC4D b'));
assert(ghir.hasVote('a 👍'));
assert(ghir.hasVote('👍 b'));
| Add tests for unicode thumbs up. | Add tests for unicode thumbs up.
| JavaScript | mit | adjohnson916/github-issue-rank,adjohnson916/github-issue-rank | ---
+++
@@ -8,7 +8,8 @@
assert(! ghir.hasVote('I agree, 2+1!'));
assert(! ghir.hasVote('I agree!'));
-// assert(ghir.hasVote(' \uD83D\uDC4Db '));
-// assert(ghir.hasVote('a\uD83D\uDC4Db'));
-// assert(ghir.hasVote('a👍'));
-// assert(ghir.hasVote('👍b'));
+assert(ghir.hasVote(' \uD83D\uDC4D '));
+assert(ghir.hasVote(' \uD83D\uDC4D b '));
+assert(ghir.hasVote('a \uD83D\uDC4D b'));
+assert(ghir.hasVote('a 👍'));
+assert(ghir.hasVote('👍 b')); |
8799a7e7c3eaa7820e75d49cd4412e85c7252b4f | configs/webpack.base.js | configs/webpack.base.js | // noinspection JSUnresolvedVariable
module.exports = {
cache: false,
debug: false,
module: {
loaders: [
{
// This is a custom property.
name: 'jsx',
test: /\.jsx?$/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-0'],
},
exclude: /node_modules/,
},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.png$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.jpg$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.gif$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.woff2?$/, loader: 'url-loader?prefix=font/&limit=5000'},
{test: /\.eot$/, loader: 'file-loader?prefix=font/'},
{test: /\.ttf$/, loader: 'file-loader?prefix=font/'},
{test: /\.svg$/, loader: 'file-loader?prefix=font/'},
],
noParse: /\.min\.js/,
},
eslint: {
eslint: {
configFile: '.eslintrc',
},
},
resolve: {
extensions: ['', '.js', '.json', '.jsx'],
modulesDirectories: [
'node_modules',
'app/components',
],
},
node: {
__dirname: true,
fs: 'empty',
},
};
| // noinspection JSUnresolvedVariable
module.exports = {
cache: false,
debug: false,
module: {
loaders: [
{
// This is a custom property.
name: 'jsx',
test: /\.jsx?$/,
loader: 'babel',
query: {
presets: ['react', 'es2015', 'stage-0'],
},
exclude: /node_modules/,
},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.png$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.jpg$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.gif$/, loader: 'url-loader?prefix=img/&limit=5000'},
{ test: /\.woff2?(\?.*)?$/, loader: 'url-loader?prefix=font/&limit=5000' },
{ test: /\.(eot|ttf|svg)(\?.*)?$/, loader: 'file-loader?prefix=font/' },
],
noParse: /\.min\.js/,
},
eslint: {
eslint: {
configFile: '.eslintrc',
},
},
resolve: {
extensions: ['', '.js', '.json', '.jsx'],
modulesDirectories: [
'node_modules',
'app/components',
],
},
node: {
__dirname: true,
fs: 'empty',
},
};
| Allow query parameters in font source urls | Allow query parameters in font source urls
| JavaScript | mit | amcsi/szeremi,amcsi/szeremi | ---
+++
@@ -18,10 +18,8 @@
{test: /\.png$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.jpg$/, loader: 'url-loader?prefix=img/&limit=5000'},
{test: /\.gif$/, loader: 'url-loader?prefix=img/&limit=5000'},
- {test: /\.woff2?$/, loader: 'url-loader?prefix=font/&limit=5000'},
- {test: /\.eot$/, loader: 'file-loader?prefix=font/'},
- {test: /\.ttf$/, loader: 'file-loader?prefix=font/'},
- {test: /\.svg$/, loader: 'file-loader?prefix=font/'},
+ { test: /\.woff2?(\?.*)?$/, loader: 'url-loader?prefix=font/&limit=5000' },
+ { test: /\.(eot|ttf|svg)(\?.*)?$/, loader: 'file-loader?prefix=font/' },
],
noParse: /\.min\.js/,
}, |
b276c2e332e9482c1cd64ec4ac02e53c2245cd2c | test/index.js | test/index.js | var expect = require('chai').expect;
var passwords = require('..');
describe('mongoose-password-bcrypt-nodejs', function() {
});
| 'use strict';
var expect = require('chai').expect;
var passwords = require('..');
describe('mongoose-password-bcrypt-nodejs', function() {
});
| Add use strict to tests | Add use strict to tests
Signed-off-by: Ian Macalinao <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@ian.pw>
| JavaScript | mit | simplyianm/mongoose-password-bcrypt-nodejs | ---
+++
@@ -1,3 +1,5 @@
+'use strict';
+
var expect = require('chai').expect;
var passwords = require('..');
|
4de0b1a4f323dd6fc878f1213eb80412b241c4e9 | test/mocha.js | test/mocha.js | jsdom = require('jsdom')
window = jsdom.jsdom().createWindow();
document = window.document;
global.document.implementation.createHTMLDocument = function (html, url) {
return jsdom.html(html);
};
$ = jQuery = require('jquery');
$('body').html('<div id="fixtures"></div>');
| jsdom = require('jsdom')
window = jsdom.jsdom().createWindow();
document = window.document;
global.document.implementation.createHTMLDocument = function (html, url) {
return jsdom.html(html);
};
global.location = { href: '' };
$ = jQuery = require('jquery');
$('body').html('<div id="fixtures"></div>');
| Add location hack to node.js test runtime | Add location hack to node.js test runtime
| JavaScript | mit | ai/evil-blocks,ai/evil-blocks | ---
+++
@@ -5,6 +5,8 @@
return jsdom.html(html);
};
+global.location = { href: '' };
+
$ = jQuery = require('jquery');
$('body').html('<div id="fixtures"></div>'); |
a4ff3c9bbd5f6acd7e0069f06d2a3d8de5453300 | app/assets/javascripts/angular/directives/navbarDir.js | app/assets/javascripts/angular/directives/navbarDir.js | var navbar = function($interval, $q, User) {
return {
restrict: 'E', // only activate on element attribute
templateUrl: 'navbar.html',
link: function(scope, element) {
var formats = [formatPercentResolvedBugs, formatNumberProjects];
var currentFormat;
var $statisticLabel = $('.label-statistic', element);
function getStatistics() {
var deferred = $q.defer();
User.statistics(function(successData) {
deferred.resolve(successData);
}, function(errorData) {
deferred.reject(errorData);
});
return deferred.promise;
}
function formatPercentResolvedBugs(data) {
var percent = Math.round((data.number_resolved_bugs / data.number_bugs) * 100);
if (_.isNaN(percent)) {
percent = 100;
}
return percent + "% of the bugs across all your projects are resolved.";
}
function formatNumberProjects(data) {
return "You are currently working on " + data.number_projects + " projects.";
}
getStatistics().then(function(data) {
scope.statistics = [
formatPercentResolvedBugs(data),
formatNumberProjects(data)
];
});
$statisticLabel.textillate({
minDisplayTime: 15000,
initialDelay: 0,
loop: true,
autoStart: true,
in: {
effect: 'fadeInUp',
sync: true
},
out: {
effect: 'fadeOutUp',
sync: true
}
});
}
};
};
bugtracker.directive('navbar', ['$interval', '$q', 'User', navbar]); | var navbar = function($interval, $q, User) {
return {
restrict: 'E', // only activate on element attribute
templateUrl: 'navbar.html',
link: function(scope, element) {
var formats = [formatPercentResolvedBugs, formatNumberProjects];
var currentFormat;
var $statisticLabel = $('.label-statistic', element);
function getStatistics() {
var deferred = $q.defer();
User.statistics(function(successData) {
deferred.resolve(successData);
}, function(errorData) {
deferred.reject(errorData);
});
return deferred.promise;
}
function formatPercentResolvedBugs(data) {
var percent = Math.round((data.number_resolved_bugs / data.number_bugs) * 100);
if (_.isNaN(percent)) {
percent = 100;
}
return percent + "% of the bugs across all your projects are resolved.";
}
function formatNumberProjects(data) {
return "You are currently working on " + data.number_projects + " projects.";
}
getStatistics().then(function(data) {
scope.statistics = [
formatPercentResolvedBugs(data),
formatNumberProjects(data)
];
$statisticLabel.textillate({
minDisplayTime: 15000,
initialDelay: 0,
loop: true,
autoStart: true,
in: {
effect: 'fadeInUp',
sync: true
},
out: {
effect: 'fadeOutUp',
sync: true
}
});
});
}
};
};
bugtracker.directive('navbar', ['$interval', '$q', 'User', navbar]); | Fix statistics not showing in navbar during the first iteration of textillate | Fix statistics not showing in navbar during the first iteration of textillate
| JavaScript | mit | swm93/bugtracker,swm93/bugtracker,swm93/bugtracker | ---
+++
@@ -35,21 +35,21 @@
formatPercentResolvedBugs(data),
formatNumberProjects(data)
];
- });
- $statisticLabel.textillate({
- minDisplayTime: 15000,
- initialDelay: 0,
- loop: true,
- autoStart: true,
- in: {
- effect: 'fadeInUp',
- sync: true
- },
- out: {
- effect: 'fadeOutUp',
- sync: true
- }
+ $statisticLabel.textillate({
+ minDisplayTime: 15000,
+ initialDelay: 0,
+ loop: true,
+ autoStart: true,
+ in: {
+ effect: 'fadeInUp',
+ sync: true
+ },
+ out: {
+ effect: 'fadeOutUp',
+ sync: true
+ }
+ });
});
}
}; |
6bd97b4ee5d57db1258040978fa5649ecc68e419 | perf/madeup-parallel/promises-creed.js | perf/madeup-parallel/promises-creed.js | global.useBluebird = false;
global.useQ = false;
global.useWhen = false;
global.useCreed = true;
global.parallelQueries = 25;
var creed = require('../../dist/creed');
require('../lib/fakesP');
module.exports = function upload(stream, idOrPath, tag, done) {
var queries = new Array(global.parallelQueries);
var tx = db.begin();
for( var i = 0, len = queries.length; i < len; ++i ) {
queries[i] = FileVersion.insert({index: i}).execWithin(tx);
}
creed.all(queries).then(function() {
tx.commit();
done();
}, function(err) {
tx.rollback();
done(err);
});
};
| global.useBluebird = false;
global.useQ = false;
global.useWhen = false;
global.useCreed = true;
var creed = require('../../dist/creed');
require('../lib/fakesP');
module.exports = function upload(stream, idOrPath, tag, done) {
var queries = new Array(global.parallelQueries);
var tx = db.begin();
for( var i = 0, len = queries.length; i < len; ++i ) {
queries[i] = FileVersion.insert({index: i}).execWithin(tx);
}
creed.all(queries).then(function() {
tx.commit();
done();
}, function(err) {
tx.rollback();
done(err);
});
};
| Remove unnecessary perf test config | Remove unnecessary perf test config
| JavaScript | mit | briancavalier/creed,briancavalier/creed,bergus/creed,bergus/creed | ---
+++
@@ -3,7 +3,6 @@
global.useWhen = false;
global.useCreed = true;
-global.parallelQueries = 25;
var creed = require('../../dist/creed');
|
53a79fd3e8466db84253f8774261bef0d3833a62 | virun.js | virun.js | var virus = document.querySelector("div");
var x = 1;
var y = 0;
var vy = 0;
var ay = 0;
var vx = .1; // px per millisecond
var startTime = Date.now();
var clickTime;
timer = setInterval(function animate() {
var t = Date.now() - startTime;
x = vx * t;
y = vy * t + 400;
virus.style.left = x + "px";
virus.style.top = y + "px";
if ( x > document.body.clientWidth) {
startTime = Date.now();
}
if (ay >= .001) {
var t = Date.now() - clickTime;
vy = ay * t;
}
//if ( y > document.body.clientHeight && x > document.body.clientWidth) {
// console.log("hello");
// startTime = Date.now();
//}
if (y > screen.height){
console.log("hello");
startTime = Date.now();
vy = 0;
ay = 0;
}
//if ( y > document.body.clientHeight && x > document.body.clientWidth) {
// console.log("second if");
// vy = 0;
// ay = 0;
//}
},20); // ms | 1000/20 = 50 frames per second (50 fps)
virus.addEventListener("click", function onclick(event) {
ay = .001;
clickTime = Date.now();
});
| var virus = document.querySelector("div");
var x = 1;
var y = 0;
var vy = 0;
var ay = 0;
var vx = 0.1; // px per millisecond
var startTime = Date.now();
var clickTime;
timer = setInterval(function animate() {
var t = Date.now() - startTime;
x = vx * t;
y = vy * t + 400;
virus.style.left = x + "px";
virus.style.top = y + "px";
if ( x > document.body.clientWidth) {
startTime = Date.now();
}
if (ay >= 0.001) {
t = Date.now() - clickTime;
vy = ay * t;
}
if (y > screen.height){
console.log("hello");
startTime = setTimeout(function() {
vy = 0;
ay = 0;
}, 10000);
}
},20); // ms | 1000/20 = 50 frames per second (50 fps)
virus.addEventListener("click", function onclick(event) {
ay = 0.001;
clickTime = Date.now();
});
| Add setTimeout property to delay ufo before starting over again | Add setTimeout property to delay ufo before starting over again
| JavaScript | mit | BOZ2323/virun,BOZ2323/virun | ---
+++
@@ -3,45 +3,36 @@
var y = 0;
var vy = 0;
var ay = 0;
-var vx = .1; // px per millisecond
+var vx = 0.1; // px per millisecond
var startTime = Date.now();
var clickTime;
timer = setInterval(function animate() {
- var t = Date.now() - startTime;
+ var t = Date.now() - startTime;
x = vx * t;
y = vy * t + 400;
-
+
virus.style.left = x + "px";
virus.style.top = y + "px";
if ( x > document.body.clientWidth) {
startTime = Date.now();
}
- if (ay >= .001) {
- var t = Date.now() - clickTime;
+ if (ay >= 0.001) {
+ t = Date.now() - clickTime;
vy = ay * t;
}
- //if ( y > document.body.clientHeight && x > document.body.clientWidth) {
- // console.log("hello");
- // startTime = Date.now();
- //}
if (y > screen.height){
console.log("hello");
- startTime = Date.now();
- vy = 0;
- ay = 0;
+ startTime = setTimeout(function() {
+ vy = 0;
+ ay = 0;
+ }, 10000);
}
- //if ( y > document.body.clientHeight && x > document.body.clientWidth) {
- // console.log("second if");
- // vy = 0;
- // ay = 0;
-//}
},20); // ms | 1000/20 = 50 frames per second (50 fps)
virus.addEventListener("click", function onclick(event) {
- ay = .001;
+ ay = 0.001;
clickTime = Date.now();
-
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.