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 |
|---|---|---|---|---|---|---|---|---|---|---|
b2fb0e989f5e76838766b4a36572155d9c1b0847 | plugins/relay_force_routing.js | plugins/relay_force_routing.js | // relay_force_routing
// documentation via: haraka -h plugins/relay_force_routing
exports.register = function() {
this.register_hook('get_mx', 'force_routing');
this.domain_ini = this.config.get('relay_dest_domains.ini', 'ini');
};
exports.force_routing = function (next, hmail, domain) {
var force_route = lookup_routing(this, this.domain_ini['domains'], domain);
if (force_route != "NOTFOUND" ){
this.logdebug(this, 'using ' + force_route + ' for ' + domain);
next(OK, force_route);
} else {
this.logdebug(this, 'using normal MX lookup' + ' for ' + domain);
next(CONT);
}
};
/**
* @return {string}
*/
function lookup_routing (plugin, domains_ini, domain) {
if (domain in domains_ini) {
var config = JSON.parse(domains_ini[domain]);
plugin.logdebug(plugin, 'found config for' + domain + ': ' + domains_ini['nexthop']);
return config['nexthop'];
}
return "NOTFOUND";
}
| // relay_force_routing
// documentation via: haraka -h plugins/relay_force_routing
exports.hook_get_mx = function (next, hmail, domain) {
var domain_ini = this.config.get('relay_dest_domains.ini', 'ini');
var force_route = lookup_routing(domain_ini['domains'], domain);
if (force_route != "NOTFOUND" ){
this.logdebug('using ' + force_route + ' for: ' + domain);
next(OK, force_route);
} else {
this.logdebug('using normal MX lookup for: ' + domain);
next(CONT);
}
}
/**
* @return {string}
*/
function lookup_routing (domains_ini, domain) {
if (domain in domains_ini) {
var config = JSON.parse(domains_ini[domain]);
return config['nexthop'];
}
return "NOTFOUND";
}
| Change around so config is loaded when changed | Change around so config is loaded when changed
| JavaScript | mit | AbhilashSrivastava/haraka_sniffer,danucalovj/Haraka,Dexus/Haraka,haraka/Haraka,typingArtist/Haraka,msimerson/Haraka,abhas/Haraka,jjz/Haraka,niteoweb/Haraka,danucalovj/Haraka,MignonCornet/Haraka,baudehlo/Haraka,bsmr-x-script/Haraka,zombified/Haraka,MignonCornet/Haraka,Synchro/Haraka,fredjean/Haraka,MignonCornet/Haraka,baudehlo/Haraka,jjz/Haraka,fatalbanana/Haraka,jaredj/Haraka,bsmr-x-script/Haraka,pedroaxl/Haraka,jjz/Haraka,armored/Haraka,abhas/Haraka,zombified/Haraka,hatsebutz/Haraka,Dexus/Haraka,danucalovj/Haraka,Dexus/Haraka,bsmr-x-script/Haraka,slattery/Haraka,slattery/Haraka,typingArtist/Haraka,hatsebutz/Haraka,fatalbanana/Haraka,smfreegard/Haraka,craigslist/Haraka,typingArtist/Haraka,msimerson/Haraka,jaredj/Haraka,abhas/Haraka,msimerson/Haraka,fredjean/Haraka,niteoweb/Haraka,danucalovj/Haraka,fatalbanana/Haraka,DarkSorrow/Haraka,armored/Haraka,msimerson/Haraka,jaredj/Haraka,baudehlo/Haraka,niteoweb/Haraka,craigslist/Haraka,hiteshjoshi/my-haraka-config,Dexus/Haraka,smfreegard/Haraka,smfreegard/Haraka,pedroaxl/Haraka,typingArtist/Haraka,haraka/Haraka,Synchro/Haraka,hiteshjoshi/my-haraka-config,hatsebutz/Haraka,DarkSorrow/Haraka,baudehlo/Haraka,MignonCornet/Haraka,DarkSorrow/Haraka,jaredj/Haraka,haraka/Haraka,zombified/Haraka,AbhilashSrivastava/haraka_sniffer,craigslist/Haraka,slattery/Haraka,Synchro/Haraka,DarkSorrow/Haraka,AbhilashSrivastava/haraka_sniffer,fatalbanana/Haraka,Synchro/Haraka,AbhilashSrivastava/haraka_sniffer,bsmr-x-script/Haraka,jjz/Haraka,zombified/Haraka,armored/Haraka,smfreegard/Haraka,slattery/Haraka,haraka/Haraka,fredjean/Haraka,hatsebutz/Haraka,pedroaxl/Haraka,hiteshjoshi/my-haraka-config,craigslist/Haraka | ---
+++
@@ -2,30 +2,25 @@
// documentation via: haraka -h plugins/relay_force_routing
-exports.register = function() {
- this.register_hook('get_mx', 'force_routing');
- this.domain_ini = this.config.get('relay_dest_domains.ini', 'ini');
-};
-
-exports.force_routing = function (next, hmail, domain) {
- var force_route = lookup_routing(this, this.domain_ini['domains'], domain);
+exports.hook_get_mx = function (next, hmail, domain) {
+ var domain_ini = this.config.get('relay_dest_domains.ini', 'ini');
+ var force_route = lookup_routing(domain_ini['domains'], domain);
if (force_route != "NOTFOUND" ){
- this.logdebug(this, 'using ' + force_route + ' for ' + domain);
+ this.logdebug('using ' + force_route + ' for: ' + domain);
next(OK, force_route);
} else {
- this.logdebug(this, 'using normal MX lookup' + ' for ' + domain);
+ this.logdebug('using normal MX lookup for: ' + domain);
next(CONT);
}
-};
+}
/**
* @return {string}
*/
-function lookup_routing (plugin, domains_ini, domain) {
+function lookup_routing (domains_ini, domain) {
if (domain in domains_ini) {
var config = JSON.parse(domains_ini[domain]);
- plugin.logdebug(plugin, 'found config for' + domain + ': ' + domains_ini['nexthop']);
return config['nexthop'];
}
return "NOTFOUND"; |
3dc61cf44f794cce36c4b008aeaa035cf37c8c76 | client/src/AudioButton.js | client/src/AudioButton.js | function AudioButton() {
var that = this;
this.position = {
x: 15.5,
y: 0.5
};
if (typeof localStorage.soundActivated === 'undefined') {
localStorage.soundActivated = "1";
}
this.on = !!localStorage.soundActivated;
setTimeout(function() {
createjs.Sound.setMute(!that.on);
mm.music.volume = !!that.on * 0.4;
}, 10);
}
AudioButton.prototype.render = function() {
var sprite = this.on ? this.sprite_on : this.sprite_off;
ctx.save();
var scaler = sprite.width * GU * 0.00025;
ctx.translate(this.position.x * GU, this.position.y * GU);
ctx.scale(scaler, scaler);
ctx.drawImage(sprite, -sprite.width / 2, -sprite.height / 2);
ctx.restore();
};
AudioButton.prototype.pause = function() {
this.musicElement.pause && this.musicElement.pause();
localStorage.soundActivated = "";
};
AudioButton.prototype.toggleActivated = function() {
this.on = !this.on;
createjs.Sound.setMute(!this.on);
mm.music.volume = !!this.on * 0.4;
localStorage.soundActivated = this.on ? "1" : "";
};
| function AudioButton() {
var that = this;
this.position = {
x: 15.5,
y: 0.4
};
if (typeof localStorage.soundActivated === 'undefined') {
localStorage.soundActivated = "1";
}
this.on = !!localStorage.soundActivated;
setTimeout(function() {
createjs.Sound.setMute(!that.on);
mm.music.volume = !!that.on * 0.4;
}, 10);
}
AudioButton.prototype.render = function() {
var sprite = this.on ? this.sprite_on : this.sprite_off;
ctx.save();
var scaler = sprite.width * GU * 0.00015;
ctx.translate(this.position.x * GU, this.position.y * GU);
ctx.scale(scaler, scaler);
ctx.drawImage(sprite, -sprite.width / 2, -sprite.height / 2);
ctx.restore();
};
AudioButton.prototype.pause = function() {
this.musicElement.pause && this.musicElement.pause();
localStorage.soundActivated = "";
};
AudioButton.prototype.toggleActivated = function() {
this.on = !this.on;
createjs.Sound.setMute(!this.on);
mm.music.volume = !!this.on * 0.4;
localStorage.soundActivated = this.on ? "1" : "";
};
| Adjust audio button position, size | Adjust audio button position, size
| JavaScript | apache-2.0 | ninjadev/globalgamejam2016,ninjadev/globalgamejam2016 | ---
+++
@@ -2,7 +2,7 @@
var that = this;
this.position = {
x: 15.5,
- y: 0.5
+ y: 0.4
};
if (typeof localStorage.soundActivated === 'undefined') {
@@ -19,7 +19,7 @@
AudioButton.prototype.render = function() {
var sprite = this.on ? this.sprite_on : this.sprite_off;
ctx.save();
- var scaler = sprite.width * GU * 0.00025;
+ var scaler = sprite.width * GU * 0.00015;
ctx.translate(this.position.x * GU, this.position.y * GU);
ctx.scale(scaler, scaler);
ctx.drawImage(sprite, -sprite.width / 2, -sprite.height / 2); |
ce4d683bf0d7a47782646fcd140db12a10583c8f | .storybook/styles.js | .storybook/styles.js | export const baseStyles = {};
export const centerStyles = {
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
};
| export const baseStyles = {
};
export const centerStyles = {
margin: '24px auto',
maxWidth: '90%',
};
| Modify baseStyles & centerStyles for a better centering of the content without flexbox | Modify baseStyles & centerStyles for a better centering of the content without flexbox
| JavaScript | mit | teamleadercrm/teamleader-ui | ---
+++
@@ -1,7 +1,7 @@
-export const baseStyles = {};
+export const baseStyles = {
+};
export const centerStyles = {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center'
+ margin: '24px auto',
+ maxWidth: '90%',
}; |
bf87ac15b529447a0906f47fdeeb842faa5739ff | src/components/Cards/ImageCard.js | src/components/Cards/ImageCard.js | import React, { PropTypes } from 'react';
import { Card } from '../UI';
import styles from './ImageCard.css';
export default class ImageCard extends React.Component {
render() {
const { onClick, onImageLoaded, image, text, description } = this.props;
return (
<Card onClick={onClick} className={styles.root}>
<img src={image} onLoad={onImageLoaded} />
<h1>{text}</h1>
{description ? <p>{description}</p> : null}
</Card>
);
}
}
ImageCard.propTypes = {
image: PropTypes.string,
onClick: PropTypes.func,
onImageLoaded: PropTypes.func,
text: PropTypes.string.isRequired,
description: PropTypes.string
};
ImageCard.defaultProps = {
onClick: function() {},
onImageLoaded: function() {}
};
| import React, { PropTypes } from 'react';
import { Card } from '../UI';
import styles from './ImageCard.css';
export default class ImageCard extends React.Component {
render() {
const { onClick, onImageLoaded, image, text, description } = this.props;
return (
<Card onClick={onClick} className={styles.root}>
<img src={image} onLoad={onImageLoaded} />
<h2>{text}</h2>
{description ? <p>{description}</p> : null}
</Card>
);
}
}
ImageCard.propTypes = {
image: PropTypes.string,
onClick: PropTypes.func,
onImageLoaded: PropTypes.func,
text: PropTypes.string.isRequired,
description: PropTypes.string
};
ImageCard.defaultProps = {
onClick: function() {},
onImageLoaded: function() {}
};
| Make cards have h2s not h1s | Make cards have h2s not h1s
| JavaScript | mit | dopry/netlify-cms,Aloomaio/netlify-cms,Aloomaio/netlify-cms,netlify/netlify-cms,netlify/netlify-cms,dopry/netlify-cms,netlify/netlify-cms,netlify/netlify-cms | ---
+++
@@ -9,7 +9,7 @@
return (
<Card onClick={onClick} className={styles.root}>
<img src={image} onLoad={onImageLoaded} />
- <h1>{text}</h1>
+ <h2>{text}</h2>
{description ? <p>{description}</p> : null}
</Card> |
feeaac41b60172495adb7d60779ff0f1330dfa6f | lib/formatters/codeclimate.js | lib/formatters/codeclimate.js | 'use strict';
module.exports = function (err, data) {
if (err) {
return 'Debug output: %j' + data + '\n' + JSON.stringify(err);
}
if (!data.length) {
return;
}
var returnString = '';
for (var i = 0, il = data.length; i < il; ++i) {
returnString += JSON.stringify({
type: 'issue',
check_name: 'Vulnerable module "' + data[i].module + '" identified',
description: '`' + data[i].module + '` ' + data[i].title,
categories: ['Security'],
content: {
body: data[i].content
},
location: {
path: 'npm-shrinkwrap.json',
lines: {
begin: data[i].line.start,
end: data[i].line.end
}
}
}) + '\0\n';
}
return returnString;
};
| 'use strict';
module.exports = function (err, data) {
if (err) {
return 'Debug output: %j' + data + '\n' + JSON.stringify(err);
}
if (!data.length) {
return;
}
var returnString = '';
for (var i = 0, il = data.length; i < il; ++i) {
returnString += JSON.stringify({
type: 'issue',
check_name: 'Vulnerable module "' + data[i].module + '" identified',
description: '`' + data[i].module + '` ' + data[i].title,
categories: ['Security'],
remediation_points: 300000,
content: {
body: data[i].content
},
location: {
path: 'npm-shrinkwrap.json',
lines: {
begin: data[i].line.start,
end: data[i].line.end
}
}
}) + '\0\n';
}
return returnString;
};
| Add Remediation Points to issues | Add Remediation Points to issues
| JavaScript | apache-2.0 | chetanddesai/nsp,nodesecurity/nsp,requiresafe/cli,ABaldwinHunter/nsp-classic,ABaldwinHunter/nsp | ---
+++
@@ -17,6 +17,7 @@
check_name: 'Vulnerable module "' + data[i].module + '" identified',
description: '`' + data[i].module + '` ' + data[i].title,
categories: ['Security'],
+ remediation_points: 300000,
content: {
body: data[i].content
}, |
0bc1c4e2a0802a90b35a438c79eee23830ee9878 | lib/worker/app-worker-info.js | lib/worker/app-worker-info.js | var AppWorkerInfo = function(appSpec, listenPort, logFilePath, exitPromise) {
this.appSpec = appSpec;
this.listenPort = listenPort;
this.logFilePath = logFilePath;
this.exitPromise = exitPromise;
};
module.exports = AppWorkerInfo;
(function() {
}).call(AppWorkerInfo.prototype); | var events = require('events');
var util = require('util');
var AppWorkerInfo = function(appSpec, listenPort, logFilePath, exitPromise) {
events.EventEmitter.call(this);
this.appSpec = appSpec;
this.listenPort = listenPort;
this.logFilePath = logFilePath;
this.exitPromise = exitPromise;
this.$refCount = 0;
};
module.exports = AppWorkerInfo;
util.inherits(AppWorkerInfo, events.EventEmitter);
(function() {
/**
* Increment reference count.
*
* Call when a client is using this worker. This prevents the worker from
* being reaped. Call release() when the client is done using the worker.
*/
this.acquire = function() {
this.$refCount++;
this.emit('acquire', this.$refCount);
};
/**
* Decrement reference count.
*
* Call when a client is done using this worker. This allows the worker to
* potentially be reaped if the refcount is zero.
*/
this.release = function() {
this.$refCount--;
this.emit('release', this.$refCount);
};
}).call(AppWorkerInfo.prototype); | Add acquire/release to worker info | Add acquire/release to worker info
| JavaScript | agpl-3.0 | githubfun/shiny-server,nvoron23/shiny-server,joequant/shiny-server,ekergy/shiny-ekergy,dpryan79/shiny-server,ekergy/shiny-ekergy,sneumann/shiny-server,nvoron23/shiny-server,sneumann/shiny-server,dpryan79/shiny-server,sneumann/shiny-server,trestletech/shiny-server,dpryan79/shiny-server,dpryan79/shiny-server,githubfun/shiny-server,ekergy/shiny-ekergy,trestletech/shiny-server,githubfun/shiny-server,joequant/shiny-server,ekergy/shiny-ekergy,sneumann/shiny-server,githubfun/shiny-server,nvoron23/shiny-server,dpryan79/shiny-server,sneumann/shiny-server,joequant/shiny-server,dpryan79/shiny-server,sneumann/shiny-server,nvoron23/shiny-server,joequant/shiny-server,trestletech/shiny-server,githubfun/shiny-server,githubfun/shiny-server,ekergy/shiny-ekergy,trestletech/shiny-server,trestletech/shiny-server,sneumann/shiny-server,joequant/shiny-server,joequant/shiny-server,ekergy/shiny-ekergy,joequant/shiny-server,trestletech/shiny-server,nvoron23/shiny-server,nvoron23/shiny-server,githubfun/shiny-server,dpryan79/shiny-server,ekergy/shiny-ekergy | ---
+++
@@ -1,11 +1,41 @@
+var events = require('events');
+var util = require('util');
+
var AppWorkerInfo = function(appSpec, listenPort, logFilePath, exitPromise) {
+ events.EventEmitter.call(this);
this.appSpec = appSpec;
this.listenPort = listenPort;
this.logFilePath = logFilePath;
this.exitPromise = exitPromise;
+
+ this.$refCount = 0;
};
module.exports = AppWorkerInfo;
+util.inherits(AppWorkerInfo, events.EventEmitter);
+
(function() {
+ /**
+ * Increment reference count.
+ *
+ * Call when a client is using this worker. This prevents the worker from
+ * being reaped. Call release() when the client is done using the worker.
+ */
+ this.acquire = function() {
+ this.$refCount++;
+ this.emit('acquire', this.$refCount);
+ };
+
+ /**
+ * Decrement reference count.
+ *
+ * Call when a client is done using this worker. This allows the worker to
+ * potentially be reaped if the refcount is zero.
+ */
+ this.release = function() {
+ this.$refCount--;
+ this.emit('release', this.$refCount);
+ };
+
}).call(AppWorkerInfo.prototype); |
6e60972f8c2fc04cfe34e5afcf793e9170fe0356 | scripts/pugbomb.js | scripts/pugbomb.js | module.exports = function(robot){
var pugBombReplies = [
'There will be no more of that. Take your {{number}} pugs elsewhere.',
'Nope. Nobody needs to see that many pugs.',
'Why do you think we all need to see {{number}} pugs?',
'No pugs for you!',
'{{number}} pugs... {{number}} PUGS?? Absolutely not.'
];
robot.respond(/pug bomb (.*)/i, function(res){
var number = res.match[1],
index = Math.floor(Math.random() * pugBombReplies.length),
reply = pugBombReplies[index].replace(/{{number}}/g, number.trim());
res.reply(reply);
});
} | module.exports = function(robot){
var pugBombReplies = [
'There will be no more of that. Take your {{number}} pugs elsewhere.',
'Nope. Nobody needs to see that many pugs.',
'Why do you think we all need to see {{number}} pugs?',
'No pugs for you!',
'{{number}} pugs... {{number}} PUGS?? Absolutely not.',
'http://i.imgur.com/cUJd5aO.jpg'
];
robot.respond(/pug bomb (.*)/i, function(res){
var number = res.match[1],
index = Math.floor(Math.random() * pugBombReplies.length),
reply = pugBombReplies[index].replace(/{{number}}/g, number.trim());
res.reply(reply);
});
} | Add lumberg meme to pug bomb replies | Add lumberg meme to pug bomb replies
| JavaScript | mit | BallinOuttaControl/bocbot,BallinOuttaControl/bocbot | ---
+++
@@ -5,7 +5,8 @@
'Nope. Nobody needs to see that many pugs.',
'Why do you think we all need to see {{number}} pugs?',
'No pugs for you!',
- '{{number}} pugs... {{number}} PUGS?? Absolutely not.'
+ '{{number}} pugs... {{number}} PUGS?? Absolutely not.',
+ 'http://i.imgur.com/cUJd5aO.jpg'
];
robot.respond(/pug bomb (.*)/i, function(res){ |
030839d136309e814d9da289c88662c025da833f | src/extendables/SendAliases.js | src/extendables/SendAliases.js | const { APIMessage } = require('discord.js');
const { Extendable } = require('klasa');
const { TextChannel, DMChannel, GroupDMChannel, User } = require('discord.js');
module.exports = class extends Extendable {
constructor(...args) {
super(...args, { appliesTo: [TextChannel, DMChannel, GroupDMChannel, User] });
}
sendCode(code, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { code }));
}
sendEmbed(embed, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { embed }));
}
sendFile(attachment, name, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { files: [{ attachment, name }] }));
}
sendFiles(files, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { files }));
}
sendLocale(key, args = [], options = {}) {
if (!Array.isArray(args)) [options, args] = [args, []];
const language = this.guild ? this.guild.language : this.client.languages.default;
return this.send({ content: language.get(key, ...args), ...options });
}
sendMessage(content, options) {
return this.send(content, options);
}
};
| const { APIMessage } = require('discord.js');
const { Extendable } = require('klasa');
const { TextChannel, DMChannel, GroupDMChannel, User } = require('discord.js');
module.exports = class extends Extendable {
constructor(...args) {
super(...args, { appliesTo: [TextChannel, DMChannel, GroupDMChannel, User] });
}
sendCode(code, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { code }));
}
sendEmbed(embed, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { embed }));
}
sendFile(attachment, name, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { files: [{ attachment, name }] }));
}
sendFiles(files, content, options = {}) {
return this.send(APIMessage.transformOptions(content, options, { files }));
}
sendLocale(key, args = [], options = {}) {
if (!Array.isArray(args)) [options, args] = [args, []];
const language = this.guild ? this.guild.language : this.client.languages.default;
return this.send(language.get(key, ...args), options);
}
sendMessage(content, options) {
return this.send(content, options);
}
};
| Fix [object Object] in sendLocale extendable | Fix [object Object] in sendLocale extendable
#494 | JavaScript | mit | dirigeants/klasa | ---
+++
@@ -27,7 +27,7 @@
sendLocale(key, args = [], options = {}) {
if (!Array.isArray(args)) [options, args] = [args, []];
const language = this.guild ? this.guild.language : this.client.languages.default;
- return this.send({ content: language.get(key, ...args), ...options });
+ return this.send(language.get(key, ...args), options);
}
sendMessage(content, options) { |
e2eca91cfe4a7a13fa825b40815d0749cc11f989 | src/foam/nanos/menu/SubMenu.js | src/foam/nanos/menu/SubMenu.js | /**
* @license
* Copyright 2017 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.nanos.menu',
name: 'SubMenu',
extends: 'foam.nanos.menu.AbstractMenu',
requires: [ 'foam.nanos.menu.SubMenuView' ],
methods: [
// Code below is for conventional style menus which pop-up,
// which no longer happens as opening a menu just opens the tree view.
/*
function createView(X, menu, parent) {
return this.SubMenuView.create({menu: menu, parent: parent}, X);
},
function launch(X, menu, parent) {
var view = this.createView(X, menu, parent);
view.open();
}
*/
]
});
| /**
* @license
* Copyright 2017 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.nanos.menu',
name: 'SubMenu',
extends: 'foam.nanos.menu.AbstractMenu',
requires: [ 'foam.nanos.menu.SubMenuView' ],
methods: [
function launch() { /** NOP **/ }
// Code below is for conventional style menus which pop-up,
// which no longer happens as opening a menu just opens the tree view.
/*
function createView(X, menu, parent) {
return this.SubMenuView.create({menu: menu, parent: parent}, X);
},
function launch(X, menu, parent) {
var view = this.createView(X, menu, parent);
view.open();
}
*/
]
});
| Fix for my last menu fix. | Fix for my last menu fix.
| JavaScript | apache-2.0 | jacksonic/vjlofvhjfgm,jacksonic/vjlofvhjfgm,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,jacksonic/vjlofvhjfgm,foam-framework/foam2 | ---
+++
@@ -12,6 +12,7 @@
requires: [ 'foam.nanos.menu.SubMenuView' ],
methods: [
+ function launch() { /** NOP **/ }
// Code below is for conventional style menus which pop-up,
// which no longer happens as opening a menu just opens the tree view.
/* |
9e734eca0da3e455a11460b9e27b78254fa43809 | core/build/webpack.client.config.js | core/build/webpack.client.config.js | const webpack = require('webpack')
const merge = require('webpack-merge')
const base = require('./webpack.base.config')
const path = require('path')
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const config = merge(base, {
output: {
path: path.resolve(__dirname, '../../dist'),
publicPath: '/dist/',
filename: '[name].js'
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
runtimeChunk: {
name: "manifest",
}
},
mode: 'development',
resolve: {
alias: {
'create-api': './create-api-client.js'
}
},
plugins: [
// strip dev-only code in Vue source
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"client"'
}),
new VueSSRClientPlugin()
]
})
module.exports = config;
| const webpack = require('webpack')
const merge = require('webpack-merge')
const base = require('./webpack.base.config')
const path = require('path')
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const config = merge(base, {
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all',
},
},
},
runtimeChunk: {
name: "manifest",
}
},
mode: 'development',
resolve: {
alias: {
'create-api': './create-api-client.js'
}
},
plugins: [
// strip dev-only code in Vue source
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"client"'
}),
new VueSSRClientPlugin()
]
})
module.exports = config;
| Revert "Minor - webpack client filename change" | Revert "Minor - webpack client filename change"
This reverts commit 8a687defb70b7c4bab6c5aac3be8867d8efd7542.
| JavaScript | mit | DivanteLtd/vue-storefront,pkarw/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront,DivanteLtd/vue-storefront,pkarw/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront | ---
+++
@@ -5,11 +5,6 @@
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const config = merge(base, {
- output: {
- path: path.resolve(__dirname, '../../dist'),
- publicPath: '/dist/',
- filename: '[name].js'
- },
optimization: {
splitChunks: {
cacheGroups: { |
8286e9787c23e67c714918dd794b67e45c140128 | src/modules/news.js | src/modules/news.js | const axios = require('axios');
const chalk = require('chalk');
const helpers = require('../helpers');
exports.listArticles = function (argv) {
const articleCount = argv.limit > 1 ? argv.limit : 1;
axios.get('https://api.spaceflightnewsapi.net/articles/', {
params: {
limit: articleCount
}
}).then((response) => {
const articles = response.data;
const articlesByDate = articles.reduce((byDate, article) => {
const title = chalk`${article.title}`;
const publishedAt = new Date(article.date_published * 1000).toLocaleDateString();
const articleDetails = chalk`{yellow ${article.news_site_long}}`;
const readSource = `Read on ${article.url}`;
const dayArticles = byDate[publishedAt] = byDate[publishedAt] || [];
dayArticles.push(`${articleDetails} | ${title}\n${readSource}\n`);
return byDate;
}, {});
for (const date in articlesByDate) {
const dayArticles = articlesByDate[date];
helpers.printMessage(`${date}\n----------`);
dayArticles.forEach(article => helpers.printMessage(article));
}
}).catch(error => {
const errorMessage = `${error.code}: ${error.message}`;
helpers.printError(errorMessage);
});
};
| const axios = require('axios');
const chalk = require('chalk');
const helpers = require('../helpers');
exports.listArticles = function (argv) {
const articleCount = argv.limit > 1 ? argv.limit : 1;
axios.get('https://api.spaceflightnewsapi.net/articles/', {
params: {
limit: articleCount
}
}).then((response) => {
const articles = response.data;
const articlesByDate = articles.reduce((byDate, article) => {
const title = chalk`${article.title}`;
const publishedAt = new Date(article.date_published * 1000).toLocaleDateString();
const articleDetails = chalk`{yellow ${article.news_site_long}}`;
const readSource = `Read on ${article.url}`;
const dayArticles = byDate[publishedAt] = byDate[publishedAt] || [];
dayArticles.push(`${articleDetails} | ${title}\n${readSource} \n`);
return byDate;
}, {});
for (const date in articlesByDate) {
const dayArticles = articlesByDate[date];
helpers.printMessage(`${date}\n----------`);
dayArticles.forEach(article => helpers.printMessage(article));
}
}).catch(error => {
const errorMessage = `${error.code}: ${error.message}`;
helpers.printError(errorMessage);
});
};
| Fix new line being included in an anchor | Fix new line being included in an anchor
| JavaScript | mit | Belar/space-cli | ---
+++
@@ -22,7 +22,7 @@
const readSource = `Read on ${article.url}`;
const dayArticles = byDate[publishedAt] = byDate[publishedAt] || [];
- dayArticles.push(`${articleDetails} | ${title}\n${readSource}\n`);
+ dayArticles.push(`${articleDetails} | ${title}\n${readSource} \n`);
return byDate;
}, {}); |
a5dbd6f84a5acc166dea63c4643ee543e5ec48a1 | src/native/index.js | src/native/index.js | import 'react-native-browser-polyfill';
import App from './app/App.react';
import Component from 'react-pure-render/component';
import React, { AppRegistry, Platform } from 'react-native';
import config from './config';
import configureStore from '../common/configureStore';
import createEngine from 'redux-storage-engine-reactnativeasyncstorage';
import messages from './messages';
import { Provider } from 'react-redux';
require('../server/intl/polyfillLocales')(self, config.locales);
export default function index() {
const initialState = {
config: {
appName: config.appName,
firebaseUrl: config.firebaseUrl
},
intl: {
// TODO: Detect native current locale.
currentLocale: config.defaultLocale,
locales: config.locales,
messages
},
device: {
platform: Platform.OS
}
};
const store = configureStore({ createEngine, initialState });
class Root extends Component {
render() {
return (
<Provider store={store}>
<App />
</Provider>
);
}
}
AppRegistry.registerComponent('Este', () => Root);
}
| import 'react-native-browser-polyfill';
import App from './app/App.react';
import Component from 'react-pure-render/component';
import React, { AppRegistry, Platform } from 'react-native';
import config from './config';
import configureStore from '../common/configureStore';
import createEngine from 'redux-storage-engine-reactnativeasyncstorage';
import messages from './messages';
import { Provider } from 'react-redux';
require('../server/intl/polyfillLocales')(self, config.locales);
export default function index() {
const initialState = {
config: {
appName: config.appName,
firebaseUrl: config.firebaseUrl
},
intl: {
// TODO: Detect native current locale.
currentLocale: config.defaultLocale,
initialNow: Date.now(),
locales: config.locales,
messages
},
device: {
platform: Platform.OS
}
};
const store = configureStore({ createEngine, initialState });
class Root extends Component {
render() {
return (
<Provider store={store}>
<App />
</Provider>
);
}
}
AppRegistry.registerComponent('Este', () => Root);
}
| Add missing initialNow for native | Add missing initialNow for native
| JavaScript | mit | TheoMer/este,vacuumlabs/este,christophediprima/este,TheoMer/Gyms-Of-The-World,christophediprima/este,skallet/este,este/este,steida/este,robinpokorny/este,syroegkin/mikora.eu,este/este,este/este,amrsekilly/updatedEste,robinpokorny/este,christophediprima/este,SidhNor/este-cordova-starter-kit,steida/este,TheoMer/Gyms-Of-The-World,amrsekilly/updatedEste,robinpokorny/este,sikhote/davidsinclair,TheoMer/Gyms-Of-The-World,TheoMer/este,cjk/smart-home-app,abelaska/este,amrsekilly/updatedEste,skallet/este,sikhote/davidsinclair,syroegkin/mikora.eu,abelaska/este,vacuumlabs/este,christophediprima/este,syroegkin/mikora.eu,skallet/este,este/este,TheoMer/este,abelaska/este,sikhote/davidsinclair | ---
+++
@@ -19,6 +19,7 @@
intl: {
// TODO: Detect native current locale.
currentLocale: config.defaultLocale,
+ initialNow: Date.now(),
locales: config.locales,
messages
}, |
f389dd376c8fc90e92eb643583afbc0a49dc8930 | src/render-queue.js | src/render-queue.js | import options from './options';
import { defer } from './util';
import { renderComponent } from './vdom/component';
/** Managed queue of dirty components to be re-rendered */
// items/itemsOffline swap on each rerender() call (just a simple pool technique)
let items = [],
itemsOffline = [];
export function enqueueRender(component) {
if (!component._dirty && (component._dirty = true) && items.push(component)==1) {
(options.debounceRendering || defer)(rerender);
}
}
export function rerender() {
if (!items.length) return;
let currentItems = items,
p;
// swap online & offline
items = itemsOffline;
itemsOffline = currentItems;
while ( (p = currentItems.pop()) ) {
if (p._dirty) renderComponent(p);
}
}
| import options from './options';
import { defer } from './util';
import { renderComponent } from './vdom/component';
/** Managed queue of dirty components to be re-rendered */
// items/itemsOffline swap on each rerender() call (just a simple pool technique)
let items = [],
itemsOffline = [];
export function enqueueRender(component) {
if (!component._dirty && (component._dirty = true) && items.push(component)==1) {
(options.debounceRendering || defer)(rerender);
}
}
export function rerender() {
let currentItems = items,
p;
// swap online & offline
items = itemsOffline;
itemsOffline = currentItems;
while ( (p = currentItems.pop()) ) {
if (p._dirty) renderComponent(p);
}
}
| Remove unnecessary early exit for a condition that rarely/never occurs. | Remove unnecessary early exit for a condition that rarely/never occurs.
| JavaScript | mit | neeharv/preact,developit/preact,gogoyqj/preact,neeharv/preact,developit/preact | ---
+++
@@ -16,7 +16,6 @@
export function rerender() {
- if (!items.length) return;
let currentItems = items,
p; |
34bf08d08b111fd67b2a346f8bcae1658fe68a51 | src/routes/index.js | src/routes/index.js | /* eslint-disable no-unused-vars*/
import React from 'react';
/* eslint-enable no-unused-vars*/
import { Router, Route, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import App from 'containers/App/';
import Home from 'containers/Home/';
const Routes = () => (
<Router history={createBrowserHistory()}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
</Route>
</Router>
);
export default Routes;
| /* eslint-disable no-unused-vars*/
import React from 'react';
/* eslint-enable no-unused-vars*/
import { Router, Route, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import App from './App/';
import Home from './Home/';
const Routes = () => (
<Router history={createBrowserHistory()}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
</Route>
</Router>
);
export default Routes;
| Change import path of routes | Change import path of routes
| JavaScript | mit | pl12133/pl12133.github.io,pl12133/pl12133.github.io | ---
+++
@@ -4,8 +4,8 @@
import { Router, Route, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
-import App from 'containers/App/';
-import Home from 'containers/Home/';
+import App from './App/';
+import Home from './Home/';
const Routes = () => (
<Router history={createBrowserHistory()}> |
bf4bd191015a4f8994fa138bc95fec6fdd012e6b | docs/_js/examples/todo.js | docs/_js/examples/todo.js | var TODO_COMPONENT = `
var TodoList = React.createClass({
render: function() {
var createItem = function(itemText, index) {
return <li key={index + itemText}>{itemText}</li>;
};
return <ul>{this.props.items.map(createItem)}</ul>;
}
});
var TodoApp = React.createClass({
getInitialState: function() {
return {items: [], text: ''};
},
onChange: function(e) {
this.setState({text: e.target.value});
},
handleSubmit: function(e) {
e.preventDefault();
var nextItems = this.state.items.concat([this.state.text]);
var nextText = '';
this.setState({items: nextItems, text: nextText});
},
render: function() {
return (
<div>
<h3>TODO</h3>
<TodoList items={this.state.items} />
<form onSubmit={this.handleSubmit}>
<input onChange={this.onChange} value={this.state.text} />
<button>{'Add #' + (this.state.items.length + 1)}</button>
</form>
</div>
);
}
});
ReactDOM.render(<TodoApp />, mountNode);
`;
ReactDOM.render(
<ReactPlayground codeText={TODO_COMPONENT} />,
document.getElementById('todoExample')
);
| var TODO_COMPONENT = `
var TodoList = React.createClass({
render: function() {
var createItem = function(item) {
return <li key={item.id}>{item.text}</li>;
};
return <ul>{this.props.items.map(createItem)}</ul>;
}
});
var TodoApp = React.createClass({
getInitialState: function() {
return {items: [], text: ''};
},
onChange: function(e) {
this.setState({text: e.target.value});
},
handleSubmit: function(e) {
e.preventDefault();
var nextItems = this.state.items.concat([{text: this.state.text, id: Date.now()}]);
var nextText = '';
this.setState({items: nextItems, text: nextText});
},
render: function() {
return (
<div>
<h3>TODO</h3>
<TodoList items={this.state.items} />
<form onSubmit={this.handleSubmit}>
<input onChange={this.onChange} value={this.state.text} />
<button>{'Add #' + (this.state.items.length + 1)}</button>
</form>
</div>
);
}
});
ReactDOM.render(<TodoApp />, mountNode);
`;
ReactDOM.render(
<ReactPlayground codeText={TODO_COMPONENT} />,
document.getElementById('todoExample')
);
| Use id for TodoApp example | [docs] Use id for TodoApp example
| JavaScript | bsd-3-clause | AlmeroSteyn/react,reactkr/react,chippieTV/react,claudiopro/react,roth1002/react,airondumael/react,tomocchino/react,TheBlasfem/react,claudiopro/react,cody/react,TheBlasfem/react,terminatorheart/react,trueadm/react,jzmq/react,STRML/react,yangshun/react,ABaldwinHunter/react-engines,salzhrani/react,TheBlasfem/react,maxschmeling/react,billfeller/react,silvestrijonathan/react,salzhrani/react,acdlite/react,VioletLife/react,chenglou/react,acdlite/react,salier/react,rickbeerendonk/react,roth1002/react,rohannair/react,jdlehman/react,hejld/react,theseyi/react,silvestrijonathan/react,sekiyaeiji/react,with-git/react,yangshun/react,maxschmeling/react,mjackson/react,apaatsio/react,richiethomas/react,trueadm/react,facebook/react,wmydz1/react,sekiyaeiji/react,chicoxyzzy/react,roth1002/react,jzmq/react,rohannair/react,mhhegazy/react,miaozhirui/react,eoin/react,jquense/react,reactkr/react,theseyi/react,billfeller/react,aaron-goshine/react,camsong/react,brigand/react,yungsters/react,rohannair/react,reactkr/react,nhunzaker/react,edmellum/react,facebook/react,jquense/react,STRML/react,airondumael/react,richiethomas/react,cpojer/react,aickin/react,claudiopro/react,dmitriiabramov/react,ericyang321/react,tom-wang/react,camsong/react,camsong/react,VioletLife/react,niubaba63/react,yiminghe/react,wmydz1/react,kaushik94/react,silvestrijonathan/react,billfeller/react,elquatro/react,andrerpena/react,empyrical/react,Simek/react,DJCordhose/react,elquatro/react,jimfb/react,staltz/react,rlugojr/react,eoin/react,ericyang321/react,edvinerikson/react,rlugojr/react,AlmeroSteyn/react,prometheansacrifice/react,mjackson/react,mhhegazy/react,pyitphyoaung/react,jontewks/react,kaushik94/react,pandoraui/react,brigand/react,pswai/react,wmydz1/react,dortonway/react,nhunzaker/react,andrerpena/react,flarnie/react,prometheansacrifice/react,zeke/react,shergin/react,cpojer/react,with-git/react,mhhegazy/react,AlmeroSteyn/react,rricard/react,jontewks/react,quip/react,aaron-goshine/react,jorrit/react,TaaKey/react,bspaulding/react,ABaldwinHunter/react-classic,roth1002/react,rohannair/react,ericyang321/react,ABaldwinHunter/react-engines,salzhrani/react,silvestrijonathan/react,jordanpapaleo/react,reactkr/react,with-git/react,jquense/react,nhunzaker/react,nathanmarks/react,rickbeerendonk/react,niubaba63/react,dortonway/react,jquense/react,wmydz1/react,flipactual/react,yungsters/react,flipactual/react,TaaKey/react,syranide/react,anushreesubramani/react,edmellum/react,acdlite/react,VioletLife/react,rickbeerendonk/react,shergin/react,niubaba63/react,miaozhirui/react,salier/react,zeke/react,joecritch/react,Simek/react,pandoraui/react,dilidili/react,chicoxyzzy/react,dittos/react,jzmq/react,ericyang321/react,yuhualingfeng/react,claudiopro/react,yungsters/react,ABaldwinHunter/react-engines,salier/react,Simek/react,edvinerikson/react,staltz/react,jorrit/react,wmydz1/react,miaozhirui/react,reactkr/react,chenglou/react,tlwirtz/react,with-git/react,maxschmeling/react,jimfb/react,DJCordhose/react,dilidili/react,quip/react,apaatsio/react,brigand/react,AlmeroSteyn/react,rlugojr/react,eoin/react,trueadm/react,dilidili/react,apaatsio/react,brigand/react,dittos/react,rricard/react,jimfb/react,tomocchino/react,rohannair/react,yangshun/react,chippieTV/react,tom-wang/react,jimfb/react,krasimir/react,ameyms/react,flarnie/react,cpojer/react,pswai/react,brigand/react,elquatro/react,bspaulding/react,ameyms/react,airondumael/react,nhunzaker/react,jdlehman/react,krasimir/react,rickbeerendonk/react,pyitphyoaung/react,rricard/react,mhhegazy/react,theseyi/react,shergin/react,claudiopro/react,chenglou/react,maxschmeling/react,dmitriiabramov/react,zeke/react,yungsters/react,ameyms/react,tomocchino/react,hejld/react,chippieTV/react,chenglou/react,miaozhirui/react,miaozhirui/react,dortonway/react,krasimir/react,ABaldwinHunter/react-classic,andrerpena/react,niubaba63/react,quip/react,theseyi/react,TaaKey/react,edvinerikson/react,ABaldwinHunter/react-engines,mosoft521/react,TaaKey/react,chenglou/react,syranide/react,dortonway/react,rlugojr/react,ArunTesco/react,bspaulding/react,salzhrani/react,dmitriiabramov/react,flipactual/react,dittos/react,chicoxyzzy/react,edvinerikson/react,ArunTesco/react,reactjs-vn/reactjs_vndev,trueadm/react,dmitriiabramov/react,salzhrani/react,bspaulding/react,mgmcdermott/react,jquense/react,tlwirtz/react,theseyi/react,aickin/react,pyitphyoaung/react,jontewks/react,rickbeerendonk/react,zeke/react,facebook/react,DJCordhose/react,STRML/react,edmellum/react,mjackson/react,iamchenxin/react,kaushik94/react,ABaldwinHunter/react-engines,DJCordhose/react,cody/react,leexiaosi/react,joecritch/react,niubaba63/react,billfeller/react,iamchenxin/react,bspaulding/react,reactjs-vn/reactjs_vndev,dmitriiabramov/react,reactjs-vn/reactjs_vndev,shergin/react,yiminghe/react,joecritch/react,kaushik94/react,staltz/react,yiminghe/react,edmellum/react,reactjs-vn/reactjs_vndev,with-git/react,camsong/react,jordanpapaleo/react,mhhegazy/react,empyrical/react,nathanmarks/react,ABaldwinHunter/react-engines,glenjamin/react,nhunzaker/react,richiethomas/react,flarnie/react,flarnie/react,jzmq/react,apaatsio/react,eoin/react,edmellum/react,terminatorheart/react,mosoft521/react,joaomilho/react,Simek/react,edvinerikson/react,rricard/react,microlv/react,tlwirtz/react,microlv/react,jorrit/react,yiminghe/react,DJCordhose/react,reactkr/react,terminatorheart/react,zeke/react,anushreesubramani/react,rohannair/react,microlv/react,anushreesubramani/react,mosoft521/react,mhhegazy/react,ABaldwinHunter/react-classic,glenjamin/react,dilidili/react,chenglou/react,jquense/react,with-git/react,jimfb/react,tomocchino/react,shergin/react,krasimir/react,microlv/react,prometheansacrifice/react,rricard/react,tom-wang/react,wmydz1/react,reactjs-vn/reactjs_vndev,yangshun/react,aickin/react,jontewks/react,reactjs-vn/reactjs_vndev,cody/react,yuhualingfeng/react,joecritch/react,claudiopro/react,hejld/react,billfeller/react,cody/react,joaomilho/react,elquatro/react,microlv/react,jameszhan/react,TaaKey/react,STRML/react,bspaulding/react,ABaldwinHunter/react-classic,staltz/react,jorrit/react,sekiyaeiji/react,ericyang321/react,pswai/react,cody/react,nhunzaker/react,empyrical/react,acdlite/react,Simek/react,ashwin01/react,empyrical/react,quip/react,anushreesubramani/react,ericyang321/react,andrerpena/react,airondumael/react,yiminghe/react,salier/react,chippieTV/react,billfeller/react,aickin/react,chippieTV/react,aaron-goshine/react,AlmeroSteyn/react,iamchenxin/react,maxschmeling/react,glenjamin/react,yuhualingfeng/react,richiethomas/react,krasimir/react,usgoodus/react,jameszhan/react,iamchenxin/react,jameszhan/react,mgmcdermott/react,jorrit/react,iamchenxin/react,rohannair/react,jdlehman/react,joaomilho/react,eoin/react,empyrical/react,niubaba63/react,krasimir/react,flarnie/react,jzmq/react,STRML/react,tomocchino/react,jdlehman/react,roth1002/react,shergin/react,yangshun/react,ABaldwinHunter/react-classic,prometheansacrifice/react,facebook/react,nathanmarks/react,aickin/react,elquatro/react,TheBlasfem/react,jontewks/react,tomocchino/react,empyrical/react,brigand/react,mhhegazy/react,usgoodus/react,joaomilho/react,Simek/react,apaatsio/react,maxschmeling/react,TaaKey/react,jzmq/react,trueadm/react,andrerpena/react,jameszhan/react,jameszhan/react,mjackson/react,mgmcdermott/react,silvestrijonathan/react,rricard/react,pswai/react,yuhualingfeng/react,camsong/react,microlv/react,jordanpapaleo/react,salier/react,prometheansacrifice/react,jorrit/react,kaushik94/react,dittos/react,apaatsio/react,anushreesubramani/react,glenjamin/react,jimfb/react,nathanmarks/react,zeke/react,TaaKey/react,bspaulding/react,ashwin01/react,tom-wang/react,apaatsio/react,nhunzaker/react,trueadm/react,tlwirtz/react,glenjamin/react,mosoft521/react,aickin/react,DJCordhose/react,jdlehman/react,cpojer/react,TheBlasfem/react,hejld/react,claudiopro/react,TaaKey/react,silvestrijonathan/react,glenjamin/react,pyitphyoaung/react,yungsters/react,Simek/react,acdlite/react,prometheansacrifice/react,ABaldwinHunter/react-classic,acdlite/react,ameyms/react,maxschmeling/react,nathanmarks/react,anushreesubramani/react,camsong/react,jameszhan/react,mjackson/react,dortonway/react,joecritch/react,joecritch/react,tlwirtz/react,yiminghe/react,aickin/react,VioletLife/react,cpojer/react,pandoraui/react,AlmeroSteyn/react,roth1002/react,edvinerikson/react,salier/react,acdlite/react,empyrical/react,jdlehman/react,tomocchino/react,pyitphyoaung/react,kaushik94/react,quip/react,terminatorheart/react,tom-wang/react,dilidili/react,mjackson/react,with-git/react,richiethomas/react,prometheansacrifice/react,rlugojr/react,ameyms/react,roth1002/react,aaron-goshine/react,jordanpapaleo/react,dmitriiabramov/react,yangshun/react,trueadm/react,staltz/react,ashwin01/react,joaomilho/react,joaomilho/react,richiethomas/react,pyitphyoaung/react,TaaKey/react,salzhrani/react,VioletLife/react,dortonway/react,camsong/react,hejld/react,chicoxyzzy/react,rlugojr/react,syranide/react,pswai/react,glenjamin/react,richiethomas/react,andrerpena/react,dilidili/react,leexiaosi/react,dittos/react,quip/react,yuhualingfeng/react,terminatorheart/react,yungsters/react,theseyi/react,staltz/react,AlmeroSteyn/react,VioletLife/react,shergin/react,jorrit/react,nathanmarks/react,ashwin01/react,pyitphyoaung/react,tom-wang/react,usgoodus/react,jontewks/react,facebook/react,ArunTesco/react,eoin/react,ameyms/react,TaaKey/react,jzmq/react,jdlehman/react,pandoraui/react,yangshun/react,ashwin01/react,usgoodus/react,aaron-goshine/react,facebook/react,quip/react,dilidili/react,edmellum/react,mosoft521/react,STRML/react,jordanpapaleo/react,pandoraui/react,wmydz1/react,flarnie/react,ericyang321/react,miaozhirui/react,kaushik94/react,niubaba63/react,chippieTV/react,tlwirtz/react,ashwin01/react,airondumael/react,krasimir/react,chicoxyzzy/react,elquatro/react,aaron-goshine/react,yungsters/react,usgoodus/react,TaaKey/react,jquense/react,silvestrijonathan/react,leexiaosi/react,chenglou/react,STRML/react,mgmcdermott/react,VioletLife/react,mosoft521/react,facebook/react,brigand/react,TheBlasfem/react,anushreesubramani/react,billfeller/react,joecritch/react,iamchenxin/react,mjackson/react,jameszhan/react,rickbeerendonk/react,hejld/react,mosoft521/react,dittos/react,usgoodus/react,syranide/react,pswai/react,rickbeerendonk/react,flarnie/react,cpojer/react,cpojer/react,yiminghe/react,terminatorheart/react,rlugojr/react,chicoxyzzy/react,jordanpapaleo/react,mgmcdermott/react,chicoxyzzy/react,jordanpapaleo/react,cody/react,edvinerikson/react,mgmcdermott/react | ---
+++
@@ -1,8 +1,8 @@
var TODO_COMPONENT = `
var TodoList = React.createClass({
render: function() {
- var createItem = function(itemText, index) {
- return <li key={index + itemText}>{itemText}</li>;
+ var createItem = function(item) {
+ return <li key={item.id}>{item.text}</li>;
};
return <ul>{this.props.items.map(createItem)}</ul>;
}
@@ -16,7 +16,7 @@
},
handleSubmit: function(e) {
e.preventDefault();
- var nextItems = this.state.items.concat([this.state.text]);
+ var nextItems = this.state.items.concat([{text: this.state.text, id: Date.now()}]);
var nextText = '';
this.setState({items: nextItems, text: nextText});
}, |
8d40f4d706fa898002ea3b8cc33b38ab377befcb | addon/classes/row.js | addon/classes/row.js | import ObjectProxy from '@ember/object/proxy';
import { merge } from '@ember/polyfills';
/**
* @class Row
* @extends Ember.ObjectProxy
* @namespace SemanticUI
*/
const Row = ObjectProxy.extend({
/**
* Whether the row is currently selected.
*
* @property selected
* @type Boolean
* @default false
* @public
*/
selected: false,
/**
* Whether the row is currently expanded.
*
* @property expanded
* @type Boolean
* @default false
* @public
*/
expanded: false,
/**
* Whether thw row is currently being edited.
*
* @property editing
* @type Boolean
* @default false
* @public
*/
editing: false,
/**
* Content for this row. See {{#crossLink "Ember.ObjectProxy"}}{{/crossLink}}.
*
* @property content
* @type Object
* @public
*/
content: null
});
Row.reopenClass({
/**
* @method create
* @param {Object} content Content for this row.
* @param {Object} options Properties to initialize in this object.
* @return Row
* @public
* @static
*/
create(content, options = {}) {
let _options = merge({ content }, options);
return this._super(_options);
}
});
export default Row;
| import ObjectProxy from '@ember/object/proxy';
import { assign } from '@ember/polyfills';
/**
* @class Row
* @extends Ember.ObjectProxy
* @namespace SemanticUI
*/
const Row = ObjectProxy.extend({
/**
* Whether the row is currently selected.
*
* @property selected
* @type Boolean
* @default false
* @public
*/
selected: false,
/**
* Whether the row is currently expanded.
*
* @property expanded
* @type Boolean
* @default false
* @public
*/
expanded: false,
/**
* Whether thw row is currently being edited.
*
* @property editing
* @type Boolean
* @default false
* @public
*/
editing: false,
/**
* Content for this row. See {{#crossLink "Ember.ObjectProxy"}}{{/crossLink}}.
*
* @property content
* @type Object
* @public
*/
content: null
});
Row.reopenClass({
/**
* @method create
* @param {Object} content Content for this row.
* @param {Object} options Properties to initialize in this object.
* @return Row
* @public
* @static
*/
create(content, options = {}) {
const _options = assign({ content }, options);
return this._super(_options);
}
});
export default Row;
| Replace usage of merge with assign | Replace usage of merge with assign
| JavaScript | mit | quantosobra/ember-semantic-ui-table,quantosobra/ember-semantic-ui-table | ---
+++
@@ -1,5 +1,5 @@
import ObjectProxy from '@ember/object/proxy';
-import { merge } from '@ember/polyfills';
+import { assign } from '@ember/polyfills';
/**
* @class Row
@@ -57,7 +57,7 @@
* @static
*/
create(content, options = {}) {
- let _options = merge({ content }, options);
+ const _options = assign({ content }, options);
return this._super(_options);
}
}); |
43646a6e0b8503ed8a6422037d25614a738b94e6 | addon/errors/load.js | addon/errors/load.js | /**
* A simple Error type to represent an error that occured while loading a
* resource.
*
* @class LoadError
* @extends Error
*/
export default class LoadError extends Error {
/**
* Constructs a new LoadError with a supplied error message and an instance
* of the AssetLoader service to use when retrying a load.
*
* @param {String} message
* @param {AssetLoader} assetLoader
*/
constructor(message, assetLoader) {
super(...arguments);
this.name = 'LoadError';
this.message = message;
this.loader = assetLoader;
}
/**
* An abstract hook to define in a sub-class that specifies how to retry
* loading the errored resource.
*/
retryLoad() {
throw new Error(`You must define a behavior for 'retryLoad' in a subclass.`);
}
/**
* Invokes a specified method on the AssetLoader service and caches the
* result. Should be used in implementations of the retryLoad hook.
*
* @protected
*/
_invokeAndCache(method, ...args) {
return this._retry || (this._retry = this.loader[method](...args));
}
}
| function ExtendBuiltin(klass) {
function ExtendableBuiltin() {
klass.apply(this, arguments);
}
ExtendableBuiltin.prototype = Object.create(klass.prototype);
ExtendableBuiltin.prototype.constructor = ExtendableBuiltin;
return ExtendableBuiltin;
}
/**
* A simple Error type to represent an error that occured while loading a
* resource.
*
* @class LoadError
* @extends Error
*/
export default class LoadError extends ExtendBuiltin(Error) {
/**
* Constructs a new LoadError with a supplied error message and an instance
* of the AssetLoader service to use when retrying a load.
*
* @param {String} message
* @param {AssetLoader} assetLoader
*/
constructor(message, assetLoader) {
super(...arguments);
this.name = 'LoadError';
this.message = message;
this.loader = assetLoader;
}
/**
* An abstract hook to define in a sub-class that specifies how to retry
* loading the errored resource.
*/
retryLoad() {
throw new Error(`You must define a behavior for 'retryLoad' in a subclass.`);
}
/**
* Invokes a specified method on the AssetLoader service and caches the
* result. Should be used in implementations of the retryLoad hook.
*
* @protected
*/
_invokeAndCache(method, ...args) {
return this._retry || (this._retry = this.loader[method](...args));
}
}
| Make it possible to extend from `Error` in Babel 6. | Make it possible to extend from `Error` in Babel 6.
| JavaScript | mit | ember-engines/ember-asset-loader,trentmwillis/ember-asset-loader,trentmwillis/ember-asset-loader,trentmwillis/ember-asset-loader,ember-engines/ember-asset-loader,ember-engines/ember-asset-loader | ---
+++
@@ -1,3 +1,13 @@
+function ExtendBuiltin(klass) {
+ function ExtendableBuiltin() {
+ klass.apply(this, arguments);
+ }
+
+ ExtendableBuiltin.prototype = Object.create(klass.prototype);
+ ExtendableBuiltin.prototype.constructor = ExtendableBuiltin;
+ return ExtendableBuiltin;
+}
+
/**
* A simple Error type to represent an error that occured while loading a
* resource.
@@ -5,7 +15,7 @@
* @class LoadError
* @extends Error
*/
-export default class LoadError extends Error {
+export default class LoadError extends ExtendBuiltin(Error) {
/**
* Constructs a new LoadError with a supplied error message and an instance
* of the AssetLoader service to use when retrying a load. |
6d78bdca94ff5e35edf2e09e228ad534c57008c6 | public/dist/js/voter-login.js | public/dist/js/voter-login.js | $(document).ready(function() {
$('#voterloginbox').submit(function(event) {
var formData = {
'voter_token' : $('input[name=voter_token]').val(),
'_csrf' : $('input[name=_csrf]').val(),
'g-recaptcha-response' : $('textarea[name=g-recaptcha-response]').val()
};
$('#voterloginbox').hide("slow");
var formsub = $.ajax({
type : 'POST',
url : '/endpoints/process_voter_login.php',
data : formData,
dataType : 'json',
encode : true }
});
formsub.done(function(data) {
if (data.success) {
setTimeout(function() { window.location.href = "/vote"; }, 2000);
}
});
event.preventDefault();
});
});
| $(document).ready(function() {
$("#voter_token").keyup(function(event){
if(event.keyCode == 13){
$("#next_btn").click();
}
});
$('#voterloginbox').submit(function(event) {
var formData = {
'voter_token' : $('input[name=voter_token]').val(),
'_csrf' : $('input[name=_csrf]').val(),
'g-recaptcha-response' : $('textarea[name=g-recaptcha-response]').val()
};
$('#voterloginbox').hide("slow");
var formsub = $.ajax({
type : 'POST',
url : '/endpoints/process_voter_login.php',
data : formData,
dataType : 'json',
encode : true }
});
formsub.done(function(data) {
if (data.success) {
setTimeout(function() { window.location.href = "/vote"; }, 2000);
}
});
event.preventDefault();
});
});
| Test out having enter press bring up modal | Test out having enter press bring up modal | JavaScript | agpl-3.0 | WireShoutLLC/votehaus,WireShoutLLC/votehaus,WireShoutLLC/votehaus,WireShoutLLC/votehaus | ---
+++
@@ -1,4 +1,10 @@
$(document).ready(function() {
+ $("#voter_token").keyup(function(event){
+ if(event.keyCode == 13){
+ $("#next_btn").click();
+ }
+ });
+
$('#voterloginbox').submit(function(event) {
var formData = {
'voter_token' : $('input[name=voter_token]').val(), |
63fc607d48bf8e5439e6addc1cf3fc45adb444d4 | fp.js | fp.js | module.exports = {
"extends": [
"./index.js",
],
plugins: ["fp"],
rules: {
"fp/no-arguments": "error",
"fp/no-class": "warn",
"fp/no-delete": "error",
"fp/no-events": "error",
"fp/no-get-set": "error",
"fp/no-let": "error",
"fp/no-loops": "error",
"fp/no-mutating-assign": "error",
"fp/no-mutating-methods": "error",
"fp/no-mutation": ["error", {commonjs:true}],
"fp/no-nil": "error",
"fp/no-proxy": "error",
"fp/no-rest-parameters": "warn",
"fp/no-this": "warn",
"fp/no-throw": "warn",
"fp/no-unused-expression": "warn",
"fp/no-valueof-field": "error",
"no-new-object": "warn",
"no-magic-numbers": [2, { "ignore": [0,1] }],
"no-unused-expressions": 2, // disallow usage of expressions in statement position
"no-lonely-if": 2, // disallow if as the only statement in an else block
},
}
| module.exports = {
"extends": [
"./index.js",
],
plugins: ["fp"],
rules: {
"fp/no-arguments": "error",
"fp/no-class": "warn",
"fp/no-delete": "error",
"fp/no-events": "error",
"fp/no-get-set": "error",
"fp/no-let": "error",
"fp/no-loops": "error",
"fp/no-mutating-assign": "error",
"fp/no-mutating-methods": "error",
"fp/no-mutation": ["error", {commonjs:true}],
"fp/no-nil": "error",
"fp/no-proxy": "error",
"fp/no-rest-parameters": "warn",
"fp/no-this": "warn",
"fp/no-throw": "warn",
"fp/no-unused-expression": "warn",
"fp/no-valueof-field": "error",
"no-new-object": "warn",
"no-magic-numbers": [2, { "ignore": [0,1] }],
"no-unused-expressions": 2, // disallow usage of expressions in statement position
"no-lonely-if": 2, // disallow if as the only statement in an else block
"sort-keys": [1, "asc", {"caseSensitive": true, "natural": false}],
},
}
| Add a warning for sorting keys | Add a warning for sorting keys
| JavaScript | mit | momentumft/eslint-config-momentumft | ---
+++
@@ -27,5 +27,6 @@
"no-magic-numbers": [2, { "ignore": [0,1] }],
"no-unused-expressions": 2, // disallow usage of expressions in statement position
"no-lonely-if": 2, // disallow if as the only statement in an else block
+ "sort-keys": [1, "asc", {"caseSensitive": true, "natural": false}],
},
} |
540ec2d5e090e0e9740e00c90d4b4fd9ff09ca55 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require jquery.kinetic
//= require_tree .
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.kinetic
//= require_tree .
| Add jquery ui to app.js | Add jquery ui to app.js
| JavaScript | mit | dma315/ambrosia,dma315/ambrosia,dma315/ambrosia | ---
+++
@@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
+//= require jquery-ui
//= require jquery_ujs
//= require jquery.kinetic
//= require_tree . |
82322ac222c9a0c6b3534270d38f063a3c67cf50 | addon/change-gate.js | addon/change-gate.js | import Em from 'ember';
let get = Em.get;
let defaultFilter = function(value) { return value; };
export default function(dependentKey, filter) {
filter = filter || defaultFilter;
let computed = Em.computed(function handler(key) {
let lastValueKey = `__changeGate${key}LastValue`;
let isFirstRun = !this.hasOwnProperty(lastValueKey);
if (isFirstRun) { //setup an observer which is responsible for notifying property changes
this[lastValueKey] = filter.call(this, get(this, dependentKey));
this.addObserver(dependentKey, function() {
let newValue = filter.call(this, get(this, dependentKey));
let lastValue = this[lastValueKey];
if(newValue !== lastValue) {
this[lastValueKey] = newValue;
this.notifyPropertyChange(key);
}
});
}
return this[lastValueKey];
});
return computed;
}
| import Em from 'ember';
let get = Em.get;
let defaultFilter = function(value) { return value; };
export default function(dependentKey, filter) {
filter = filter || defaultFilter;
let computed = Em.computed(function handler(key) {
let lastValueKey = `__changeGate${key}LastValue`;
let isFirstRun = !this.hasOwnProperty(lastValueKey);
if (isFirstRun) { //setup an observer which is responsible for notifying property changes
this[lastValueKey] = filter.call(this, get(this, dependentKey));
this.addObserver(dependentKey, function() {
let newValue = filter.call(this, get(this, dependentKey));
let lastValue = this[lastValueKey];
if(!Em.isEqual(newValue, lastValue)) {
this[lastValueKey] = newValue;
this.notifyPropertyChange(key);
}
});
}
return this[lastValueKey];
});
return computed;
}
| Use Ember.isEqual instead of direct equality | Use Ember.isEqual instead of direct equality | JavaScript | mit | GavinJoyce/ember-computed-change-gate,givanse/ember-computed-change-gate,GavinJoyce/ember-computed-change-gate,givanse/ember-computed-change-gate | ---
+++
@@ -17,7 +17,7 @@
let newValue = filter.call(this, get(this, dependentKey));
let lastValue = this[lastValueKey];
- if(newValue !== lastValue) {
+ if(!Em.isEqual(newValue, lastValue)) {
this[lastValueKey] = newValue;
this.notifyPropertyChange(key);
} |
fd1c12db210589a285b5917353e40714ca23e4b2 | app/models/league.js | app/models/league.js | import CoreObject from 'fantasy-weather/models/_core/core-object';
import Team from 'fantasy-weather/models/team';
let League = CoreObject.extend({
// Set defaults and stub out properties
_defaults() {
return {
name: "",
teams: []
};
},
addTeam(team) {
let teams = this.get('teams');
teams.push(Team.create(team));
return teams;
},
addTeams(teams) {
_.forEach(teams, this.addTeam.bind(this));
return teams;
}
});
League.reopenClass({
});
export default League;
| import CoreObject from 'fantasy-weather/models/_core/core-object';
import Team from 'fantasy-weather/models/team';
let League = CoreObject.extend({
// Set defaults and stub out properties
_defaults() {
return {
name: "",
teams: []
};
},
addTeam(team) {
let teams = this.get('teams');
teams.push(Team.create(team));
return teams;
},
addTeams(teams) {
_.forEach(teams, this.addTeam.bind(this));
return teams;
},
findTeamByAbbr(abbr) {
let teams = this.get('teams');
return _.find(teams, { abbr });
},
findStadiumByAbbr(abbr) {
let team = this.findTeamByAbbr(abbr);
return _.get(team, 'stadium.location');
}
});
League.reopenClass({
});
export default League;
| Add methods to find team/stadium by abbreviation | Add methods to find team/stadium by abbreviation
| JavaScript | mit | rjhilgefort/nfl-weather,rjhilgefort/nfl-weather,rjhilgefort/nfl-weather | ---
+++
@@ -20,7 +20,18 @@
addTeams(teams) {
_.forEach(teams, this.addTeam.bind(this));
return teams;
+ },
+
+ findTeamByAbbr(abbr) {
+ let teams = this.get('teams');
+ return _.find(teams, { abbr });
+ },
+
+ findStadiumByAbbr(abbr) {
+ let team = this.findTeamByAbbr(abbr);
+ return _.get(team, 'stadium.location');
}
+
});
|
ad65d3a5d5419132635f188e90b3aa4e25626064 | scripts/assertion-messages.js | scripts/assertion-messages.js | #!/usr/bin/env node
var recast = require('recast');
var messages = require('./transform/messages');
var exec = require('child_process').exec;
var fs = require('fs');
var glob = require('glob');
var usage = [
'Usage: assertion-messages.js "globbing expression"',
'To generate assertion messages for a set of test files, provide a valid glob expression.',
'File search begins at `../test262/test/`'
].join('\n');
var gexpr = process.argv[2];
if (!gexpr) {
console.log(usage);
return;
}
glob('../test262/test/' + gexpr, function(err, list) {
list.forEach(function(file) {
var source = fs.readFileSync(file, 'utf8');
try {
var ast = recast.parse(source);
var result = messages(ast);
fs.writeFileSync(file, recast.print(ast).code, 'utf8');
} catch (e) {
console.log("failed: ", file);
}
});
});
| #!/usr/bin/env node
var recast = require('recast');
var messages = require('./transform/messages');
var exec = require('child_process').exec;
var fs = require('fs');
var glob = require('glob');
var usage = [
'Usage: assertion-messages.js "globbing expression"',
'To generate assertion messages for a set of test files, provide a valid glob expression.',
'File search is relative to the `test/` sub-directory of the local',
'Test262 repository'
].join('\n');
var gexpr = process.argv[2];
if (!gexpr) {
console.log(usage);
return;
}
glob(__dirname + '/../test262/test/' + gexpr, function(err, list) {
list.forEach(function(file) {
var source = fs.readFileSync(file, 'utf8');
try {
var ast = recast.parse(source);
var result = messages(ast);
fs.writeFileSync(file, recast.print(ast).code, 'utf8');
} catch (e) {
console.log("failed: ", file);
}
});
});
| Allow script to be invoke from any directory | Allow script to be invoke from any directory
| JavaScript | mit | bocoup/test262-v8-machinery,bocoup/test262-v8-machinery | ---
+++
@@ -7,7 +7,8 @@
var usage = [
'Usage: assertion-messages.js "globbing expression"',
'To generate assertion messages for a set of test files, provide a valid glob expression.',
- 'File search begins at `../test262/test/`'
+ 'File search is relative to the `test/` sub-directory of the local',
+ 'Test262 repository'
].join('\n');
var gexpr = process.argv[2];
@@ -17,7 +18,7 @@
return;
}
-glob('../test262/test/' + gexpr, function(err, list) {
+glob(__dirname + '/../test262/test/' + gexpr, function(err, list) {
list.forEach(function(file) {
var source = fs.readFileSync(file, 'utf8'); |
d6e3cdc458867d1aa90197b1b8b9a10ce65b9118 | src/MentionMenu.js | src/MentionMenu.js | import React from "react";
import portal from "react-portal-hoc";
const MentionMenu = props => {
const {
active,
className,
item: Item,
options,
top,
left,
hoverItem,
selectItem,
style = {}
} = props;
const menuStyle = {
...style,
left,
top,
position: "absolute"
};
return (
<div style={menuStyle} className={className}>
{options.map((option, idx) => {
return (
<div key={idx} onClick={selectItem(idx)} onMouseOver={hoverItem(idx)}>
<Item active={active === idx} {...option} />
</div>
);
})}
</div>
);
};
export default portal({ clickToClose: true, escToClose: true })(MentionMenu);
| import React from "react";
import portal from "react-portal-hoc";
class MentionMenu extends React.Component {
constructor(props) {
super(props);
this.state = {
left: props.left,
top: props.top
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.left != this.state.left || nextProps.top != this.state.top) {
this.setState({ left: nextProps.left, right: nextProps.right });
}
}
componentDidMount() {
//prevent menu from going off the right of the screen
if (this.node && this.props.left + this.node.offsetWidth > window.innerWidth) {
this.setState({ left: window.innerWidth - (this.node.offsetWidth + 10) });
}
//prevent menu from going off bottom of screen
if (this.node && this.props.top + this.node.offsetHeight > window.innerHeight) {
this.setState({ top: window.innerHeight - (this.node.offsetHeight + 10) });
}
}
render() {
const {
active,
className,
item: Item,
options,
hoverItem,
selectItem,
style = {}
} = this.props;
const {
top,
left
} = this.state;
const menuStyle = {
...style,
left,
top,
position: "absolute"
};
return (
<div style={menuStyle} className={className} ref={node => this.node = node}>
{options.map((option, idx) => {
return (
<div key={idx} onClick={selectItem(idx)} onMouseOver={hoverItem(idx)}>
<Item active={active === idx} {...option} />
</div>
);
})}
</div>
);
}
}
export default portal({ clickToClose: true, escToClose: true })(MentionMenu);
| Improve menu positioning to keep it from going off screen | Improve menu positioning to keep it from going off screen
tries to keep the menu from going off the bottom or right of screen | JavaScript | mit | mattkrick/react-githubish-mentions | ---
+++
@@ -1,35 +1,63 @@
import React from "react";
import portal from "react-portal-hoc";
-const MentionMenu = props => {
- const {
- active,
- className,
- item: Item,
- options,
- top,
- left,
- hoverItem,
- selectItem,
- style = {}
- } = props;
- const menuStyle = {
- ...style,
- left,
- top,
- position: "absolute"
- };
- return (
- <div style={menuStyle} className={className}>
- {options.map((option, idx) => {
- return (
- <div key={idx} onClick={selectItem(idx)} onMouseOver={hoverItem(idx)}>
- <Item active={active === idx} {...option} />
- </div>
- );
- })}
- </div>
- );
-};
+class MentionMenu extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ left: props.left,
+ top: props.top
+ };
+ }
+ componentWillReceiveProps(nextProps) {
+ if (nextProps.left != this.state.left || nextProps.top != this.state.top) {
+ this.setState({ left: nextProps.left, right: nextProps.right });
+ }
+ }
+ componentDidMount() {
+ //prevent menu from going off the right of the screen
+ if (this.node && this.props.left + this.node.offsetWidth > window.innerWidth) {
+ this.setState({ left: window.innerWidth - (this.node.offsetWidth + 10) });
+ }
+ //prevent menu from going off bottom of screen
+ if (this.node && this.props.top + this.node.offsetHeight > window.innerHeight) {
+ this.setState({ top: window.innerHeight - (this.node.offsetHeight + 10) });
+ }
+ }
+ render() {
+ const {
+ active,
+ className,
+ item: Item,
+ options,
+ hoverItem,
+ selectItem,
+ style = {}
+ } = this.props;
+
+ const {
+ top,
+ left
+ } = this.state;
+
+ const menuStyle = {
+ ...style,
+ left,
+ top,
+ position: "absolute"
+ };
+ return (
+ <div style={menuStyle} className={className} ref={node => this.node = node}>
+ {options.map((option, idx) => {
+ return (
+ <div key={idx} onClick={selectItem(idx)} onMouseOver={hoverItem(idx)}>
+ <Item active={active === idx} {...option} />
+ </div>
+ );
+ })}
+ </div>
+ );
+ }
+}
export default portal({ clickToClose: true, escToClose: true })(MentionMenu); |
23557892e740c28ea38304874636b3295e99a68c | test/scripts/cli.js | test/scripts/cli.js | 'use strict';
var opbeat = require('../../');
var inquirer = require('inquirer');
var questions = [
{ name: 'app_id', message: 'App ID' },
{ name: 'organization_id', message: 'Organization ID' },
{ name: 'secret_token', message: 'Secret token' }
];
var test = function (options) {
options.env = 'production';
options.level = 'fatal';
options.handleExceptions = false;
var client = opbeat.createClient(options);
client.handleUncaughtExceptions(function (err) {
console.log('Handled uncaught exception correctly');
process.exit();
});
console.log('Capturing error...');
client.captureError(new Error('captureError()'), function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The error have been logged at:', url);
console.log('Capturing message...');
client.captureError('captureError()', function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The message have been logged at:', url);
console.log('Throwing exception...');
throw new Error('throw');
});
});
};
inquirer.prompt(questions, function (answers) {
// inquirer gives quite a long stack-trace, so let's do this async
process.nextTick(test.bind(null, answers));
});
| 'use strict';
var opbeat = require('../../');
var inquirer = require('inquirer');
var questions = [
{ name: 'app_id', message: 'App ID' },
{ name: 'organization_id', message: 'Organization ID' },
{ name: 'secret_token', message: 'Secret token' }
];
var test = function (options) {
options.env = 'production';
options.level = 'fatal';
options.handleExceptions = false;
var client = opbeat.createClient(options);
client.handleUncaughtExceptions(function (err) {
console.log('Handled uncaught exception correctly');
process.exit();
});
console.log('Capturing error...');
client.captureError(new Error('This is an Error object'), function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The error have been logged at:', url);
console.log('Capturing message...');
client.captureError('This is a string', function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The message have been logged at:', url);
console.log('Throwing exception...');
throw new Error('This Error was thrown');
});
});
};
inquirer.prompt(questions, function (answers) {
// inquirer gives quite a long stack-trace, so let's do this async
process.nextTick(test.bind(null, answers));
});
| Improve error names when running integration test | Improve error names when running integration test
| JavaScript | bsd-2-clause | opbeat/opbeat-node,driftyco/opbeat-node,opbeat/opbeat-node | ---
+++
@@ -21,17 +21,17 @@
});
console.log('Capturing error...');
- client.captureError(new Error('captureError()'), function (err, url) {
+ client.captureError(new Error('This is an Error object'), function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The error have been logged at:', url);
console.log('Capturing message...');
- client.captureError('captureError()', function (err, url) {
+ client.captureError('This is a string', function (err, url) {
if (err) console.log('Something went wrong:', err.message);
console.log('The message have been logged at:', url);
console.log('Throwing exception...');
- throw new Error('throw');
+ throw new Error('This Error was thrown');
});
});
}; |
428785e0bbcb9b61b87eddf79e76e04d896be710 | src/Components/pages/Index.js | src/Components/pages/Index.js | import React, { Component } from 'react'
import { Link } from 'react-router'
import Header from 'Components/Header'
import Footer from 'Components/Footer'
import zhcn from '../../../intl/zh-cn'
import en from '../../../intl/en'
import 'styles/pages/index.scss'
const format = (locale) => {
return (key) => {
let v = null;
if (locale === 'zh-cn') {
v = zhcn[key]
} else {
v = en[key]
}
return v || key;
}
}
export default class Index extends Component {
changeLang(lang) {
let {pathname, query} = this.props.location
query.locale = lang
this.context.router.replace({pathname: location.pathname, query})
}
render() {
const {query} = this.props.location
const __ = format(query.locale);
return (
<div id='container'>
<Header __={__} query={query} changeLang={this.changeLang.bind(this)} />
{React.cloneElement(this.props.children, {__, query})}
<Footer __={__} query={query} />
</div>
)
}
}
Index.contextTypes = {
router: React.PropTypes.object.isRequired
}
| import React, { Component } from 'react'
import { Link } from 'react-router'
import Header from 'Components/Header'
import Footer from 'Components/Footer'
import zhcn from '../../../intl/zh-cn'
import en from '../../../intl/en'
import 'styles/pages/index.scss'
const format = (locale) => {
return (key) => {
let v = null;
if (locale === 'zh-cn') {
v = zhcn[key]
} else {
v = en[key]
}
return v || key;
}
}
export default class Index extends Component {
changeLang(lang) {
let {pathname, query} = this.props.location
query.locale = lang
this.context.router.replace({pathname: pathname, query})
}
render() {
const {query} = this.props.location
const __ = format(query.locale);
return (
<div id='container'>
<Header __={__} query={query} changeLang={this.changeLang.bind(this)} />
{React.cloneElement(this.props.children, {__, query})}
<Footer __={__} query={query} />
</div>
)
}
}
Index.contextTypes = {
router: React.PropTypes.object.isRequired
}
| Fix redirect when switch language. | Fix redirect when switch language.
| JavaScript | mit | jsconfcn/ningjs,jsconfcn/ningjs | ---
+++
@@ -24,7 +24,7 @@
changeLang(lang) {
let {pathname, query} = this.props.location
query.locale = lang
- this.context.router.replace({pathname: location.pathname, query})
+ this.context.router.replace({pathname: pathname, query})
}
render() { |
e9e8eb0a238a641c190f200b684fb3549b5a276d | src/objects/mob.js | src/objects/mob.js | // namespace
var App = App || {};
App.Mob = (function () {
"use strict";
var fn = function (game, username, x, y) {
Phaser.Sprite.call(this, game, x, y, 'alienBlue');
this.game.physics.arcade.enable(this);
this.frame = 0;
this.scale.setTo(.7, .7);
this.animations.add('right', [0, 4, 2], 8, true);
this.animations.add('left', [1, 5, 3], 8, true);
this.collideWorldBounds = true;
this.playerName = username;
this.usernameText = game.add.text(20, 20, username, { font: "16px Arial", fill: "#ffffff", align: "center" });
this.usernameText.x = this.x;
this.usernameText.y = this.y + 60;
};
fn.prototype = Object.create(Phaser.Sprite.prototype);
fn.prototype.constructor = fn;
fn.prototype.update = function () {
this.usernameText.x = this.x;
this.usernameText.y = this.y + 60;
};
return fn;
})();
| // namespace
var App = App || {};
App.Mob = (function () {
"use strict";
var fn = function (game, username, x, y) {
Phaser.Sprite.call(this, game, x, y, 'alienBlue');
this.game.physics.arcade.enable(this);
this.frame = 0;
this.scale.setTo(.7, .7);
this.animations.add('right', [0, 4, 2], 8, true);
this.animations.add('left', [1, 5, 3], 8, true);
this.collideWorldBounds = true;
this.playerName = username;
this.usernameText = game.add.text(20, 20, username, { font: "16px Arial", fill: "#ffffff", align: "center" });
this.usernameText.x = this.x;
this.usernameText.y = this.y + 60;
};
fn.prototype = Object.create(Phaser.Sprite.prototype);
fn.prototype.constructor = fn;
fn.prototype.update = function () {
this.usernameText.x = this.x;
this.usernameText.y = this.y + 60;
this.game.physics.arcade.collide(this, this.game.global.forest.layers.collisionLayer);
};
return fn;
})();
| Add arcade.collide logic to App.Mob objects. | Add arcade.collide logic to App.Mob objects.
| JavaScript | mit | hookbot/multi-player,hookbot/multi-player | ---
+++
@@ -24,6 +24,7 @@
fn.prototype.update = function () {
this.usernameText.x = this.x;
this.usernameText.y = this.y + 60;
+ this.game.physics.arcade.collide(this, this.game.global.forest.layers.collisionLayer);
};
return fn; |
f9331ee186f212290d771fb10e45e1628b89b49f | species-explorer/app/services/species.service.js | species-explorer/app/services/species.service.js | /* global angular */
angular
.module('speciesApp')
.factory('SpeciesService', [
'API_BASE_URL',
'$resource',
SpeciesService
])
function SpeciesService (API_BASE_URL, $resource) {
return $resource(
API_BASE_URL,
null,
{
getKingdoms: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getkingdomnames'
}
},
getClasses: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getclassnames'
}
},
getFamilies: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getfamilynames'
}
}
}
)
}
| /* global angular */
angular
.module('speciesApp')
.factory('SpeciesService', [
'API_BASE_URL',
'$resource',
SpeciesService
])
function SpeciesService (API_BASE_URL, $resource) {
return $resource(
API_BASE_URL,
null,
{
getKingdoms: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getkingdomnames'
}
},
getClasses: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getclassnames'
}
},
getFamilies: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getfamilynames'
}
},
getSpecies: {
method: 'GET',
isArray: false,
cache: true,
params: {
op: 'getspecies'
}
}
}
)
}
| Add an action to get species by family | Add an action to get species by family
| JavaScript | mit | stivaliserna/scripts,stivaliserna/scripts | ---
+++
@@ -36,6 +36,14 @@
params: {
op: 'getfamilynames'
}
+ },
+ getSpecies: {
+ method: 'GET',
+ isArray: false,
+ cache: true,
+ params: {
+ op: 'getspecies'
+ }
}
}
) |
9b31522d4d65b8f1b0e8b0133914b9059bd81787 | src/constants/action_types.js | src/constants/action_types.js | export const START_DATE_CHANGE = 'START_DATE_CHANGE';
export const END_DATE_CHANGE = 'END_DATE_CHANGE';
export const FILTER_BY_AREA = 'FILTER_BY_AREA';
export const FILTER_BY_IDENTIFIER = 'FILTER_BY_IDENTIFIER';
export const FILTER_BY_TYPE_INJURY = 'FILTER_BY_TYPE_INJURY';
export const FILTER_BY_TYPE_FATALITY = 'FILTER_BY_TYPE_HARM';
export const FILTER_BY_NO_INJURY_FATALITY = 'FILTER_BY_NO_INJURY_FATALITY';
export const FILTER_BY_CONTRIBUTING_FACTOR = 'FILTER_BY_CONTRIBUTING_FACTOR';
export const CRASHES_ALL_REQUEST = 'CRASHES_ALL_REQUEST';
export const CRASHES_ALL_SUCCESS = 'CRASHES_ALL_SUCCESS';
export const CRASHES_ALL_ERROR = 'CRASHES_ALL_ERROR';
export const CONTRIBUTING_FACTORS_REQUEST = 'CONTRIBUTING_FACTORS_REQUEST';
export const CONTRIBUTING_FACTORS_SUCCESS = 'CONTRIBUTING_FACTORS_SUCCESS';
export const CONTRIBUTING_FACTORS_ERROR = 'CONTRIBUTING_FACTORS_ERROR';
| export const START_DATE_CHANGE = 'START_DATE_CHANGE';
export const END_DATE_CHANGE = 'END_DATE_CHANGE';
export const FILTER_BY_AREA = 'FILTER_BY_AREA';
export const FILTER_BY_IDENTIFIER = 'FILTER_BY_IDENTIFIER';
export const FILTER_BY_TYPE_INJURY = 'FILTER_BY_TYPE_INJURY';
export const FILTER_BY_TYPE_FATALITY = 'FILTER_BY_TYPE_FATALITY';
export const FILTER_BY_NO_INJURY_FATALITY = 'FILTER_BY_NO_INJURY_FATALITY';
export const FILTER_BY_CONTRIBUTING_FACTOR = 'FILTER_BY_CONTRIBUTING_FACTOR';
export const CRASHES_ALL_REQUEST = 'CRASHES_ALL_REQUEST';
export const CRASHES_ALL_SUCCESS = 'CRASHES_ALL_SUCCESS';
export const CRASHES_ALL_ERROR = 'CRASHES_ALL_ERROR';
export const CONTRIBUTING_FACTORS_REQUEST = 'CONTRIBUTING_FACTORS_REQUEST';
export const CONTRIBUTING_FACTORS_SUCCESS = 'CONTRIBUTING_FACTORS_SUCCESS';
export const CONTRIBUTING_FACTORS_ERROR = 'CONTRIBUTING_FACTORS_ERROR';
| Fix typo in action types for filter by type fatality | Fix typo in action types for filter by type fatality
| JavaScript | mit | clhenrick/nyc-crash-mapper,clhenrick/nyc-crash-mapper,clhenrick/nyc-crash-mapper | ---
+++
@@ -5,7 +5,7 @@
export const FILTER_BY_IDENTIFIER = 'FILTER_BY_IDENTIFIER';
export const FILTER_BY_TYPE_INJURY = 'FILTER_BY_TYPE_INJURY';
-export const FILTER_BY_TYPE_FATALITY = 'FILTER_BY_TYPE_HARM';
+export const FILTER_BY_TYPE_FATALITY = 'FILTER_BY_TYPE_FATALITY';
export const FILTER_BY_NO_INJURY_FATALITY = 'FILTER_BY_NO_INJURY_FATALITY';
export const FILTER_BY_CONTRIBUTING_FACTOR = 'FILTER_BY_CONTRIBUTING_FACTOR'; |
086b7eafeefb761f3883b9eeccb231152dfdbda0 | src/filters/filter-builder.js | src/filters/filter-builder.js | import { cloneDeep } from 'lodash'
import filters from './index'
import { boolMerge } from '../utils'
export default class FilterBuilder {
constructor () {
this._filters = {}
}
/**
* Apply a filter of a given type providing all the necessary arguments,
* passing these arguments directly to the specified filter builder. Merges
* existing filter(s) with the new filter.
*
* @param {String} type Name of the filter type.
* @param {...args} args Arguments passed to filter builder.
* @returns {FilterBuilder} Builder class.
*/
filter(type, ...args) {
this._filter('and', type, ...args)
return this
}
_filter(boolType, filterType, ...args) {
let klass = filters[filterType]
let newFilter
if (!klass) {
throw new TypeError(`Filter type ${filterType} not found.`)
}
newFilter = klass(...args)
this._filters = boolMerge(newFilter, this._filters, boolType)
return this
}
/**
* Alias to FilterBuilder#filter.
*
* @private
*
* @returns {FilterBuilder} Builder class.
*/
andFilter(...args) {
return this._filter('and', ...args)
}
orFilter(type, ...args) {
this._filter('or', type, ...args)
return this
}
notFilter(type, ...args) {
this._filter('not', type, ...args)
return this
}
get filters () {
return cloneDeep(this._filters)
}
}
| import { cloneDeep } from 'lodash'
import filters from './index'
import { boolMerge } from '../utils'
export default class FilterBuilder {
constructor () {
this._filters = {}
}
/**
* Apply a filter of a given type providing all the necessary arguments,
* passing these arguments directly to the specified filter builder. Merges
* existing filter(s) with the new filter.
*
* @private
*
* @param {String} type Name of the filter type.
* @param {...args} args Arguments passed to filter builder.
* @returns {FilterBuilder} Builder class.
*/
filter(type, ...args) {
this._filter('and', type, ...args)
return this
}
_filter(boolType, filterType, ...args) {
let klass = filters[filterType]
let newFilter
if (!klass) {
throw new TypeError(`Filter type ${filterType} not found.`)
}
newFilter = klass(...args)
this._filters = boolMerge(newFilter, this._filters, boolType)
return this
}
/**
* Alias to FilterBuilder#filter.
*
* @private
*
* @returns {FilterBuilder} Builder class.
*/
andFilter(...args) {
return this._filter('and', ...args)
}
orFilter(type, ...args) {
this._filter('or', type, ...args)
return this
}
notFilter(type, ...args) {
this._filter('not', type, ...args)
return this
}
get filters () {
return cloneDeep(this._filters)
}
}
| Annotate jsdoc for FilterBuilder class as private | Annotate jsdoc for FilterBuilder class as private
| JavaScript | mit | node-packages/bodybuilder,node-packages/bodybuilder,ShareIQ/bodybuilder,ShareIQ/bodybuilder,danpaz/bodybuilder,danpaz/bodybuilder,danpaz/bodybuilder | ---
+++
@@ -10,6 +10,8 @@
* Apply a filter of a given type providing all the necessary arguments,
* passing these arguments directly to the specified filter builder. Merges
* existing filter(s) with the new filter.
+ *
+ * @private
*
* @param {String} type Name of the filter type.
* @param {...args} args Arguments passed to filter builder. |
d6f71748d574a0d8d00de034328224d0c28e6b22 | src/gfx/modes/LicoriceMode.js | src/gfx/modes/LicoriceMode.js | /* eslint-disable no-magic-numbers */
import LabeledMode from './LabeledMode';
class LicoriceMode extends LabeledMode {
static id = 'LC';
constructor(opts) {
super(opts);
}
calcAtomRadius(_atom) {
return this.opts.bond;
}
calcStickRadius() {
return this.opts.bond;
}
calcSpaceFraction() {
return this.opts.space;
}
getAromRadius() {
return this.opts.aromrad;
}
showAromaticLoops() {
return this.opts.showarom;
}
drawMultiorderBonds() {
return this.opts.multibond;
}
/** @deprecated Old-fashioned atom labels, to be removed in the next major version. */
getLabelOpts() {
return {
fg: 'none',
bg: '0x202020',
showBg: false,
labels: this.settings.now.labels,
colors: true,
adjustColor: true,
transparent: true,
};
}
}
LicoriceMode.prototype.id = 'LC';
LicoriceMode.prototype.hortName = 'Licorice';
LicoriceMode.prototype.shortName = 'Licorice';
LicoriceMode.prototype.depGroups = [
'AtomsSpheres',
'BondsCylinders',
'ALoopsTorus',
];
export default LicoriceMode;
| /* eslint-disable no-magic-numbers */
import LabeledMode from './LabeledMode';
class LicoriceMode extends LabeledMode {
static id = 'LC';
constructor(opts) {
super(opts);
}
calcAtomRadius(_atom) {
return this.opts.bond;
}
calcStickRadius() {
return this.opts.bond;
}
calcSpaceFraction() {
return this.opts.space;
}
getAromRadius() {
return this.opts.aromrad;
}
showAromaticLoops() {
return this.opts.showarom;
}
drawMultiorderBonds() {
return this.opts.multibond;
}
/** @deprecated Old-fashioned atom labels, to be removed in the next major version. */
getLabelOpts() {
return {
fg: 'none',
bg: '0x202020',
showBg: false,
labels: this.settings.now.labels,
colors: true,
adjustColor: true,
transparent: true,
};
}
}
LicoriceMode.prototype.id = 'LC';
LicoriceMode.prototype.name = 'Licorice';
LicoriceMode.prototype.shortName = 'Licorice';
LicoriceMode.prototype.depGroups = [
'AtomsSpheres',
'BondsCylinders',
'ALoopsTorus',
];
export default LicoriceMode;
| Fix typo in Licorice Mode name assignment | Fix typo in Licorice Mode name assignment
| JavaScript | mit | epam/miew,epam/miew,epam/miew,epam/miew,epam/miew | ---
+++
@@ -47,7 +47,7 @@
}
LicoriceMode.prototype.id = 'LC';
-LicoriceMode.prototype.hortName = 'Licorice';
+LicoriceMode.prototype.name = 'Licorice';
LicoriceMode.prototype.shortName = 'Licorice';
LicoriceMode.prototype.depGroups = [
'AtomsSpheres', |
cb20cbe08c0e52613124e18ec8991a216949a11b | Resources/public/js/emails.js | Resources/public/js/emails.js | jQuery(document).ready(function () {
jQuery('#add-another-email').click(function () {
var emailList = jQuery('#email-fields-list');
var newWidget = emailList.attr('data-prototype');
newWidget = newWidget.replace(/__name__/g, emailCount);
emailCount++;
var newDiv = jQuery('<div></div>').html(newWidget);
newDiv.appendTo(jQuery('#email-fields-list'));
return false;
});
jQuery('.removeRow').live('click', function (event) {
var name = $(this).attr('data-related');
jQuery('*[data-content="' + name + '"]').remove();
return false;
});
}); | $(document).ready(function () {
$('#add-another-email').click(function () {
var emailList = $('#email-fields-list');
var newWidget = emailList.attr('data-prototype');
newWidget = newWidget.replace(/__name__/g, emailCount);
emailCount++;
var newDiv = $('<div></div>').html(newWidget);
newDiv.appendTo($('#email-fields-list'));
return false;
});
$(document).on('click', '.removeRow', function (event) {
var name = $(this).attr('data-related');
$('*[data-content="' + name + '"]').remove();
return false;
});
}); | Add design to email collection | BAP-251: Add design to email collection
| JavaScript | mit | geoffroycochard/platform,orocrm/platform,umpirsky/platform,trustify/oroplatform,hugeval/platform,mszajner/platform,akeneo/platform,Djamy/platform,northdakota/platform,2ndkauboy/platform,morontt/platform,ramunasd/platform,trustify/oroplatform,umpirsky/platform,hugeval/platform,akeneo/platform,hugeval/platform,northdakota/platform,northdakota/platform,mszajner/platform,2ndkauboy/platform,akeneo/platform,mszajner/platform,ramunasd/platform,morontt/platform,geoffroycochard/platform,geoffroycochard/platform,orocrm/platform,orocrm/platform,ramunasd/platform,morontt/platform,Djamy/platform,Djamy/platform,trustify/oroplatform,2ndkauboy/platform | ---
+++
@@ -1,17 +1,17 @@
-jQuery(document).ready(function () {
- jQuery('#add-another-email').click(function () {
- var emailList = jQuery('#email-fields-list');
+$(document).ready(function () {
+ $('#add-another-email').click(function () {
+ var emailList = $('#email-fields-list');
var newWidget = emailList.attr('data-prototype');
newWidget = newWidget.replace(/__name__/g, emailCount);
emailCount++;
- var newDiv = jQuery('<div></div>').html(newWidget);
- newDiv.appendTo(jQuery('#email-fields-list'));
+ var newDiv = $('<div></div>').html(newWidget);
+ newDiv.appendTo($('#email-fields-list'));
return false;
});
- jQuery('.removeRow').live('click', function (event) {
+ $(document).on('click', '.removeRow', function (event) {
var name = $(this).attr('data-related');
- jQuery('*[data-content="' + name + '"]').remove();
+ $('*[data-content="' + name + '"]').remove();
return false;
});
}); |
2c62380798476a22bbb50dd7780fbf4f24e02b5c | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['app/bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'default'
},
files: {
'app/app.css': 'scss/app.scss'
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
}
},
clean: ['../solartime-pages/'],
copy: {
main: {
files: [
{expand: true, cwd: 'app/', src: ['**'], dest: '../solartime-pages/'}
]
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('build', ['sass']);
grunt.registerTask('publish',['clean', 'copy']);
grunt.registerTask('default', ['build','watch']);
}
| module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['app/bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'default'
},
files: {
'app/app.css': 'scss/app.scss'
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
}
},
clean: ['../solartime-pages/'],
copy: {
main: {
files: [
{expand: true, cwd: 'app/', src: ['**','!**/*_test.js','!index-async.html'], dest: '../solartime-pages/'}
]
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('build', ['sass']);
grunt.registerTask('publish',['clean', 'copy']);
grunt.registerTask('default', ['build','watch']);
}
| Exclude testing files from deploy | Exclude testing files from deploy
| JavaScript | mit | regdoug/solartime | ---
+++
@@ -30,7 +30,7 @@
copy: {
main: {
files: [
- {expand: true, cwd: 'app/', src: ['**'], dest: '../solartime-pages/'}
+ {expand: true, cwd: 'app/', src: ['**','!**/*_test.js','!index-async.html'], dest: '../solartime-pages/'}
]
}
}, |
ac7fa80dbd84e31a06dc99a65e268de7c69e0924 | Gruntfile.js | Gruntfile.js | module.exports = function( grunt ) {
"use strict";
grunt.initConfig({
bump: {
options: {
files: [ "package.json" ],
// Commit
commit: true,
commitMessage: "Release v%VERSION%",
commitFiles: [ "package.json" ],
// Tag
createTag: true,
tagName: "%VERSION%",
tagMessage: "Version %VERSION%",
// Push
push: true,
pushTo: "origin"
}
},
jshint: {
options: {
jshintrc: ".jshintrc"
},
all: [ "Gruntfile.js", "tasks/*.js", "test/*.js" ]
},
jscs: {
all: {
files: {
src: "<%= jshint.all %>"
},
options: {
junit: "jscs-output.xml"
}
}
},
nodeunit: {
test: "test/test.js"
}
});
// Load grunt tasks from NPM packages
require( "load-grunt-tasks" )( grunt );
grunt.loadTasks( "tasks" );
grunt.registerTask( "default", [ "jshint", "jscs", "nodeunit" ] );
};
| module.exports = function( grunt ) {
"use strict";
grunt.initConfig({
bump: {
options: {
files: [ "package.json" ],
// Commit
commit: true,
commitMessage: "Release v%VERSION%",
commitFiles: [ "package.json" ],
// Tag
createTag: true,
tagName: "%VERSION%",
tagMessage: "Version %VERSION%",
// Push
push: true,
pushTo: "origin"
}
},
jshint: {
options: {
jshintrc: ".jshintrc"
},
all: [ "Gruntfile.js", "tasks/*.js", "test/*.js" ]
},
jscs: {
src: "<%= jshint.all %>"
},
nodeunit: {
test: "test/test.js"
}
});
// Load grunt tasks from NPM packages
require( "load-grunt-tasks" )( grunt );
grunt.loadTasks( "tasks" );
grunt.registerTask( "default", [ "jshint", "jscs", "nodeunit" ] );
};
| Simplify definition of jscs task | Simplify definition of jscs task
| JavaScript | mit | markelog/grunt-checker,jscs-dev/grunt-jscs,BridgeAR/grunt-jscs | ---
+++
@@ -28,14 +28,7 @@
all: [ "Gruntfile.js", "tasks/*.js", "test/*.js" ]
},
jscs: {
- all: {
- files: {
- src: "<%= jshint.all %>"
- },
- options: {
- junit: "jscs-output.xml"
- }
- }
+ src: "<%= jshint.all %>"
},
nodeunit: {
test: "test/test.js" |
1dfe8b60b598e9f1ed87f1087c1a43a49d57dbe0 | postcss.config.js | postcss.config.js | /* eslint global-require:0 */
module.exports = {
map: { inline: true },
plugins: [
require('postcss-custom-properties')({
importFrom: 'src/css/00_variables.css'
}),
]
};
| /* eslint global-require:0 */
module.exports = {
map: { inline: true },
plugins: [
require('postcss-custom-properties')({
preserve: false,
importFrom: 'src/css/00_variables.css'
}),
]
};
| Add preserve: false to dev as well | Add preserve: false to dev as well
| JavaScript | mit | frippz/frippz.se,frippz/frippz.se,frippz/frippz.se | ---
+++
@@ -4,6 +4,7 @@
map: { inline: true },
plugins: [
require('postcss-custom-properties')({
+ preserve: false,
importFrom: 'src/css/00_variables.css'
}),
] |
470860f96e1b2b2c866d41690ae9769ad30f89a7 | Themeleon.js | Themeleon.js | 'use strict';
var path = require('path');
/**
* Themeleon helper constructor.
*
* See the functions from `factory.js` for variables signification.
*
* This constructor has an empty prototype (except the `use` method) since
* Themeleon works only with mixins. There's a main mixin in `main.js`
* containing the base functions, and all the extensions are merged in the
* same way on the object instance.
*
* The purpose of this constructor is only to create new instances with
* conventional properties to be used by the mixins.
*
* @constructor
* @param {String} src
* @param {String} dest
* @param {Object} ctx
*/
module.exports = function Themeleon(src, dest, ctx) {
this.tasks = [];
this.src = path.resolve(src);
this.dest = path.resolve(dest);
this.ctx = ctx;
// Shortcut to push a promise
this.push = this.tasks.push.bind(this.tasks);
};
/**
* Mix given object(s) with current instance.
*
* @param {...Object} obj
*/
module.exports.prototype.use = function (/* obj... */) {
for (var i = 0; i < arguments.length; i++) {
for (var j in arguments[i]) {
this[j] = arguments[i][j];
}
}
};
| 'use strict';
var fs = require('fs');
var path = require('path');
var q = require('q');
var mkdir = q.denodeify(fs.mkdir);
/**
* Themeleon helper constructor.
*
* See the functions from `factory.js` for variables signification.
*
* This constructor has an empty prototype (except the `use` method) since
* Themeleon works only with mixins. There's a main mixin in `main.js`
* containing the base functions, and all the extensions are merged in the
* same way on the object instance.
*
* The purpose of this constructor is only to create new instances with
* conventional properties to be used by the mixins.
*
* @constructor
* @param {String} src
* @param {String} dest
* @param {Object} ctx
*/
module.exports = function Themeleon(src, dest, ctx) {
this.tasks = [];
this.src = path.resolve(src);
this.dest = path.resolve(dest);
this.ctx = ctx;
// Shortcut to push a promise
this.push = this.tasks.push.bind(this.tasks);
// Create directory maybe
this.push(mkdir(dest));
};
/**
* Mix given object(s) with current instance.
*
* @param {...Object} obj
*/
module.exports.prototype.use = function (/* obj... */) {
for (var i = 0; i < arguments.length; i++) {
for (var j in arguments[i]) {
this[j] = arguments[i][j];
}
}
};
| Create destination directory if not exists | Create destination directory if not exists
| JavaScript | unlicense | themeleon/themeleon,themeleon/themeleon | ---
+++
@@ -1,6 +1,10 @@
'use strict';
+var fs = require('fs');
var path = require('path');
+var q = require('q');
+
+var mkdir = q.denodeify(fs.mkdir);
/**
* Themeleon helper constructor.
@@ -28,6 +32,9 @@
// Shortcut to push a promise
this.push = this.tasks.push.bind(this.tasks);
+
+ // Create directory maybe
+ this.push(mkdir(dest));
};
/** |
bac5bacb594b772b07f42ce321626337c19dde0b | TrackAnnot/app/view/Viewport.js | TrackAnnot/app/view/Viewport.js | Ext.define('TrackAnnot.view.Viewport', {
renderTo: Ext.getBody(),
extend: 'Ext.container.Viewport',
items: [{
xtype: 'toolbar',
items: [{
text: 'Metrics',
menu: {
xtype: 'menu',
items: [{
text: 'Video',
checked: false
}, {
text: 'GPS',
checked: true
}, {
text: 'Temperature',
checked: true
}, {
text: 'Accelerometers',
checked: true
}, {
xtype: 'menuseparator'
}, {
text: 'Add ...'
}]
}
}, {
text:'Switch tracker',
action: 'switch'
}]
}]
}); | Ext.define('TrackAnnot.view.Viewport', {
renderTo: Ext.getBody(),
extend: 'Ext.container.Viewport',
items: [{
xtype: 'toolbar',
items: ['<b>A</b>nnotation <b>M</b>ovement <b>A</b>ccelerometer', {
text: 'Metrics',
menu: {
xtype: 'menu',
items: [{
text: 'Accelerometers',
checked: true
}, {
disabled: true,
text: 'Altitude',
checked: false
}, {
disabled: true,
text: 'Direction',
checked: false
}, {
text: 'Google Earth',
checked: true
}, {
disabled: true,
text: 'Speed',
checked: false
}, {
text: 'Temperature',
checked: true
}, {
disabled: true,
text: 'Video',
checked: false
}, {
xtype: 'menuseparator'
}, {
disabled: true,
text: 'Add ...'
}]
}
}, {
text:'Switch tracker',
action: 'switch'
}]
}]
}); | Add placeholders for new metrics. | Add placeholders for new metrics.
| JavaScript | apache-2.0 | NLeSC/eEcology-Annotation-UI,NLeSC/eEcology-Annotation-UI,NLeSC/eEcology-Annotation-UI | ---
+++
@@ -3,25 +3,39 @@
extend: 'Ext.container.Viewport',
items: [{
xtype: 'toolbar',
- items: [{
+ items: ['<b>A</b>nnotation <b>M</b>ovement <b>A</b>ccelerometer', {
text: 'Metrics',
menu: {
xtype: 'menu',
items: [{
- text: 'Video',
- checked: false
- }, {
- text: 'GPS',
- checked: true
+ text: 'Accelerometers',
+ checked: true
+ }, {
+ disabled: true,
+ text: 'Altitude',
+ checked: false
+ }, {
+ disabled: true,
+ text: 'Direction',
+ checked: false
+ }, {
+ text: 'Google Earth',
+ checked: true
+ }, {
+ disabled: true,
+ text: 'Speed',
+ checked: false
}, {
text: 'Temperature',
checked: true
- }, {
- text: 'Accelerometers',
- checked: true
+ }, {
+ disabled: true,
+ text: 'Video',
+ checked: false
}, {
xtype: 'menuseparator'
}, {
+ disabled: true,
text: 'Add ...'
}]
} |
3501a2a8868b0e2c9594555de00d2ed6279696d1 | app/data/bookshelf/migrate.js | app/data/bookshelf/migrate.js | import Knex from 'knex';
import config from '../../config/config.json';
const knex = Knex.initialize(config.bookshelf.postgresql);
export default function () {
knex.migrate.latest(config.bookshelf.migrations)
.then(function () {
knex.destroy();
});
}
| import Knex from 'knex';
import config from '../../config/config.json';
const knex = Knex(config.bookshelf.postgresql);
export default function () {
knex.migrate.latest(config.bookshelf.migrations)
.then(function () {
knex.destroy();
});
}
| Stop using the deprecated knex.initialize | Stop using the deprecated knex.initialize
| JavaScript | mit | wellsam/nerd,Xantier/nerd-stack,Xantier/nerd-stack,wellsam/nerd,isp1r0/nerd-stack,isp1r0/nerd-stack | ---
+++
@@ -1,6 +1,6 @@
import Knex from 'knex';
import config from '../../config/config.json';
-const knex = Knex.initialize(config.bookshelf.postgresql);
+const knex = Knex(config.bookshelf.postgresql);
export default function () {
knex.migrate.latest(config.bookshelf.migrations) |
1a93325776c6ae619d85239a0336cb06d40682fb | conkeror/bindings.js | conkeror/bindings.js | define_key(text_keymap, "C-w", "cmd_deleteWordBackward");
define_key(content_buffer_normal_keymap, "c", "copy", $browser_object = browser_object_dom_node);
| function history_clear () {
var history = Cc["@mozilla.org/browser/nav-history-service;1"]
.getService(Ci.nsIBrowserHistory);
history.removeAllPages();
}
interactive("history-clear", "Clear the history.", history_clear);
define_key(text_keymap, "C-w", "cmd_deleteWordBackward");
define_key(content_buffer_normal_keymap, "c", "copy", $browser_object = browser_object_dom_node);
| Add a history-clear function to conkeror | Add a history-clear function to conkeror
| JavaScript | bsd-3-clause | pjones/emacsrc | ---
+++
@@ -1,2 +1,11 @@
+function history_clear () {
+ var history = Cc["@mozilla.org/browser/nav-history-service;1"]
+ .getService(Ci.nsIBrowserHistory);
+ history.removeAllPages();
+}
+
+interactive("history-clear", "Clear the history.", history_clear);
+
+
define_key(text_keymap, "C-w", "cmd_deleteWordBackward");
define_key(content_buffer_normal_keymap, "c", "copy", $browser_object = browser_object_dom_node); |
04cf346847f0472555407997f5167cf233ba6e0e | cli.js | cli.js | #!/usr/bin/env node
'use strict';
var assertSchema = require('./index');
var yargs = require('yargs');
var opts = yargs
.demand(1)
.usage(
'Usage: $0 [ -d database url ] <schema>\n' +
'Asserts the existence of schema, creating it if necessary'
)
.option('d', {
alias: 'database_url',
type: 'string',
default: process.env.DATABASE_URL,
describe: 'database url (defaults to $DATABASE_URL)'
})
.help('h')
.alias('h', 'help')
.argv;
assertSchema(opts.database_url, opts._[0]);
| #!/usr/bin/env node
'use strict';
var assertSchema = require('./index');
var yargs = require('yargs');
var opts = yargs
.demand(1)
.usage(
'Usage: $0 [ -d database url ] <schema>\n' +
'Asserts the existence of schema, creating it if necessary'
)
.option('d', {
alias: 'database_url',
type: 'string',
describe: 'database url (overriden by $DATABASE_URL)'
})
.help('h')
.alias('h', 'help')
.argv;
assertSchema(process.env.DATABASE_URL || opts.database_url, opts._[0]);
| Allow DATABASE_URL to override passed option | Allow DATABASE_URL to override passed option
| JavaScript | mit | apechimp/node-pg-assert-schema | ---
+++
@@ -14,11 +14,10 @@
.option('d', {
alias: 'database_url',
type: 'string',
- default: process.env.DATABASE_URL,
- describe: 'database url (defaults to $DATABASE_URL)'
+ describe: 'database url (overriden by $DATABASE_URL)'
})
.help('h')
.alias('h', 'help')
.argv;
-assertSchema(opts.database_url, opts._[0]);
+assertSchema(process.env.DATABASE_URL || opts.database_url, opts._[0]); |
520e87c145d4b659affd67936ea9cd86d4e100ee | app/index.js | app/index.js |
var util = require('util'),
yeoman = require('yeoman-generator');
// mocha:app generator
//
// Setup the test/ directory.
//
module.exports = Generator;
function Generator(args, options, config) {
yeoman.generators.Base.apply(this, arguments);
this.option('assert-framework', {
type: String,
defaults: 'chai',
desc: 'Choose your prefered assertion library'
});
this.option('assert-style', {
desc: 'Choose the asssert style you wish to use (assert, expect, should). Only enabled with chai.',
type: String,
defaults: 'expect'
});
this.option('ui', {
desc: 'Choose your style of DSL (bdd, tdd, qunit, or exports)',
type: String,
defaults: 'bdd'
});
// parse arguments for now, manually
this.assert_framework = options['assert-framework'] || 'chai';
this.assert_style = options['assert-style'] || 'expect';
}
util.inherits(Generator, yeoman.generators.Base);
Generator.prototype.setupEnv = function setupEnv() {
this.directory('.', 'test');
};
| 'use strict';
// mocha:app generator
//
// Sets up the test/ directory
//
var Generator = module.exports = function (args, options) {
this.option('assert-framework', {
type: String,
defaults: 'chai',
desc: 'Choose your prefered assertion library'
});
this.option('assert-style', {
desc: 'Choose the asssert style you wish to use (assert, expect, should). Only enabled with chai.',
type: String,
defaults: 'expect'
});
this.option('ui', {
desc: 'Choose your style of DSL (bdd, tdd, qunit, or exports)',
type: String,
defaults: 'bdd'
});
this.directory('.', 'test');
};
Generator.name = 'Mocha';
| Convert generator to the simple format | Convert generator to the simple format
| JavaScript | bsd-2-clause | yeoman/generator-mocha,yeoman/generator-mocha | ---
+++
@@ -1,18 +1,9 @@
-
-var util = require('util'),
- yeoman = require('yeoman-generator');
-
+'use strict';
// mocha:app generator
//
-// Setup the test/ directory.
+// Sets up the test/ directory
//
-
-module.exports = Generator;
-
-function Generator(args, options, config) {
-
- yeoman.generators.Base.apply(this, arguments);
-
+var Generator = module.exports = function (args, options) {
this.option('assert-framework', {
type: String,
defaults: 'chai',
@@ -31,14 +22,7 @@
defaults: 'bdd'
});
- // parse arguments for now, manually
- this.assert_framework = options['assert-framework'] || 'chai';
- this.assert_style = options['assert-style'] || 'expect';
-}
-
-util.inherits(Generator, yeoman.generators.Base);
-
-Generator.prototype.setupEnv = function setupEnv() {
this.directory('.', 'test');
};
+Generator.name = 'Mocha'; |
17aab292abe123e4812a09c41e3a68762213f432 | src/victory-primitives/box.js | src/victory-primitives/box.js | import React from "react";
import PropTypes from "prop-types";
import { assign } from "lodash";
import CommonProps from "./common-props";
export default class Box extends React.Component {
static propTypes = {
...CommonProps,
groupComponent: PropTypes.element,
horizontal: PropTypes.bool,
width: PropTypes.number,
x: PropTypes.number,
y: PropTypes.number
}
static defaultProps = {
groupComponent: <g/>
};
renderBox(boxProps) {
return <rect {...boxProps} />;
}
getBoxProps(props) {
const { x, y, width, height, events, role, className, style } = props;
const attribs = { x, y, width, height, style };
return assign({
...attribs,
role,
className
}, events);
}
render() {
const boxProps = this.getBoxProps(this.props);
return React.cloneElement(
this.props.groupComponent,
{},
this.renderBox(boxProps)
);
}
}
| import React from "react";
import PropTypes from "prop-types";
import { assign } from "lodash";
import CommonProps from "./common-props";
export default class Box extends React.Component {
static propTypes = {
...CommonProps,
groupComponent: PropTypes.element,
height: PropTypes.number,
width: PropTypes.number,
x: PropTypes.number,
y: PropTypes.number
}
static defaultProps = {
groupComponent: <g/>
};
renderBox(boxProps) {
return <rect {...boxProps} />;
}
getBoxProps(props) {
const { x, y, width, height, events, role, className, style } = props;
const attribs = { x, y, width, height, style };
return assign({
...attribs,
role,
className
}, events);
}
render() {
const boxProps = this.getBoxProps(this.props);
return React.cloneElement(
this.props.groupComponent,
{},
this.renderBox(boxProps)
);
}
}
| Add missing height prop to PropTypes. | Add missing height prop to PropTypes.
| JavaScript | mit | FormidableLabs/victory-core,FormidableLabs/victory-core | ---
+++
@@ -7,7 +7,7 @@
static propTypes = {
...CommonProps,
groupComponent: PropTypes.element,
- horizontal: PropTypes.bool,
+ height: PropTypes.number,
width: PropTypes.number,
x: PropTypes.number,
y: PropTypes.number |
b4c12ea5777db86718f7bcbf17836e53070f7ed8 | lib/ember-addon.js | lib/ember-addon.js | var path = require('path');
var fs = require('fs');
var mergeTrees = require('broccoli-merge-trees');
var manifest = require('./manifest');
module.exports = {
name: 'broccoli-manifest',
initializeOptions: function() {
var defaultOptions = {
enabled: this.app.env === 'production',
appcacheFile: "/manifest.appcache"
}
this.options = this.app.options.manifest = this.app.options.manifest || {};
for (var option in defaultOptions) {
if (!this.options.hasOwnProperty(option)) {
this.options[option] = defaultOptions[option];
}
}
},
postprocessTree: function (type, tree) {
if (type === 'all') { //} && this.options.enabled) {
return mergeTrees([tree, manifest(tree, this.options)]);
}
return tree;
},
included: function (app) {
this.app = app;
this.initializeOptions();
},
treeFor: function() {}
} | var path = require('path');
var fs = require('fs');
var mergeTrees = require('broccoli-merge-trees');
var fileRemover = require('broccoli-file-remover');
var manifest = require('./manifest');
module.exports = {
name: 'broccoli-manifest',
initializeOptions: function() {
var defaultOptions = {
enabled: this.app.env === 'production',
appcacheFile: "/manifest.appcache"
}
this.options = this.app.options.manifest = this.app.options.manifest || {};
for (var option in defaultOptions) {
if (!this.options.hasOwnProperty(option)) {
this.options[option] = defaultOptions[option];
}
}
},
postprocessTree: function (type, tree) {
if (type === 'all') { //} && this.options.enabled) {
tree = removeFile(tree, {
paths: ['index.html', 'tests/']
});
return mergeTrees([tree, manifest(tree, this.options)]);
}
return tree;
},
included: function (app) {
this.app = app;
this.initializeOptions();
},
treeFor: function() {}
}
| Exclude index.html and tests from manifest | Exclude index.html and tests from manifest | JavaScript | mit | racido/broccoli-manifest,arenoir/broccoli-manifest,nybblr/broccoli-manifest,matthewlehner/broccoli-manifest | ---
+++
@@ -1,6 +1,7 @@
var path = require('path');
var fs = require('fs');
var mergeTrees = require('broccoli-merge-trees');
+var fileRemover = require('broccoli-file-remover');
var manifest = require('./manifest');
@@ -22,6 +23,9 @@
},
postprocessTree: function (type, tree) {
if (type === 'all') { //} && this.options.enabled) {
+ tree = removeFile(tree, {
+ paths: ['index.html', 'tests/']
+ });
return mergeTrees([tree, manifest(tree, this.options)]);
}
|
97fa03ff3bf49d09cbd774fc9846b3298d11b2f2 | scripts/chris.js | scripts/chris.js | var audio = document.getElementById("chris");
function pauseChris() {
audio.pause();
}
function playChris() {
audio.currentTime = 952;
audio.play();
setTimeout(pauseChris, 331000);
}
function addChrisButton() {
var div = document.getElementById("audioContainer");
var button = document.createElement("BUTTON");
button.setAttribute("type", "button");
button.setAttribute("onclick", "playChris()");
button.innerText = "Escuchar a Chris";
div.insertBefore(button, audio);
}
addChrisButton();
| var audio = document.getElementById("chris");
function pauseChris() {
if (audio.currentTime >= 331000) {
audio.pause();
}
}
function playChris() {
audio.currentTime = 952;
audio.play();
var interval = setInterval(pauseChris, 1000);
}
function clearInterval() {
clearInterval(interval)
}
function addChrisButton() {
var div = document.getElementById("audioContainer");
var button = document.createElement("BUTTON");
button.setAttribute("type", "button");
button.addEventListener("click", playChris);
audio.addEventListener("pause", clearInterval);
audio.addEventListener("seeking", clearInterval);
button.innerText = "Escuchar a Chris";
div.insertBefore(button, audio);
}
addChrisButton();
| Use interval in Chris button | Use interval in Chris button
| JavaScript | mit | nvdaes/nvdaes.github.io,nvdaes/nvdaes.github.io | ---
+++
@@ -1,20 +1,28 @@
var audio = document.getElementById("chris");
function pauseChris() {
- audio.pause();
+ if (audio.currentTime >= 331000) {
+ audio.pause();
+ }
}
function playChris() {
audio.currentTime = 952;
audio.play();
- setTimeout(pauseChris, 331000);
+ var interval = setInterval(pauseChris, 1000);
+}
+
+function clearInterval() {
+ clearInterval(interval)
}
function addChrisButton() {
var div = document.getElementById("audioContainer");
var button = document.createElement("BUTTON");
button.setAttribute("type", "button");
- button.setAttribute("onclick", "playChris()");
+ button.addEventListener("click", playChris);
+ audio.addEventListener("pause", clearInterval);
+ audio.addEventListener("seeking", clearInterval);
button.innerText = "Escuchar a Chris";
div.insertBefore(button, audio);
} |
2609a05dec6e32991e1375ad7991e17dae9d262b | server-config.js | server-config.js | module.exports = {
port: 3000,
internalClientPort: 3001,
authKey: 'ASDASD'
};
| const fs = require('fs');
module.exports = {
port: 3000,
internalClientPort: 3001,
authKey: process.env.AUTH_KEY || fs.readFileSync('/run/secrets/authkey', { encoding: 'utf-8' }).trim()
};
| Make server auth key configurable | Make server auth key configurable
Can be provided with an env var or with a Docker secret named "authkey".
| JavaScript | mit | mikko/CentralIntelligence-server | ---
+++
@@ -1,5 +1,7 @@
+const fs = require('fs');
+
module.exports = {
port: 3000,
internalClientPort: 3001,
- authKey: 'ASDASD'
+ authKey: process.env.AUTH_KEY || fs.readFileSync('/run/secrets/authkey', { encoding: 'utf-8' }).trim()
}; |
72360c8d6f8c868c9ea88f5f9018e7ff01ad3fb9 | lib/methods/raw.js | lib/methods/raw.js | "use strict";
var Base = require('../base')
/**
* @function raw converts the Base object into a normal javascript wObject, removing internal properties.
* It also converts nested objects and rebuilds arrays from objects with nothing but integer keys.
* @memberOf Base#
* @param {object} [options]
* @param {boolean} options.fnToString
* @return {object}
* @example
* var a = new Base({ 'a': 123 })
* console.log(a.raw()) //it logs { 'a': 123 }
*/
exports.$define = {
raw:function( options ) {
var exclude
if (options) {
exclude = options.exclude
}
function raw ( obj ) {
var newObj = {}
var val = obj._$val
if (val !== void 0) {
newObj = val
} else {
var isArrayLike = true
var asArray = []
var newVal
for( var key in obj ) {
if ( key[0] !== '_' && key !== '$key' && key !== '$val' && (!exclude||!exclude(key, obj)) ) {
if (key.match(/\D/)) {
isArrayLike = false
}
newVal = raw(obj[key])
newObj[key] = newVal
if (isArrayLike) {
asArray[key] = newVal
}
}
}
if (isArrayLike) {
newObj = asArray
}
}
return newObj
}
return raw(this)
}
} | "use strict";
var Base = require('../base')
var isLikeNumber =require('../util').isLikeNumber
/**
* @function raw converts the Base object into a normal javascript wObject, removing internal properties.
* It also converts nested objects and rebuilds arrays from objects with nothing but integer keys.
* @memberOf Base#
* @param {object} [options]
* @param {boolean} options.fnToString
* @return {object}
* @example
* var a = new Base({ 'a': 123 })
* console.log(a.raw()) //it logs { 'a': 123 }
*/
exports.$define = {
raw:function( options ) {
var exclude
if (options) {
exclude = options.exclude
}
function raw ( obj ) {
var newObj = {}
var val = obj._$val
if (val !== void 0) {
newObj = val
} else {
var isArrayLike = true
var asArray = []
var newVal
for( var key in obj ) {
if ( key[0] !== '_' && key !== '$key' && key !== '$val' && (!exclude||!exclude(key, obj)) ) {
if (!isLikeNumber(key)) {
isArrayLike = false
}
newVal = raw(obj[key])
newObj[key] = newVal
if (isArrayLike) {
asArray[key] = newVal
}
}
}
if (isArrayLike) {
newObj = asArray
}
}
return newObj
}
return raw(this)
}
}
| Use `!util/isLikeNumber(key)` instead of `key.match(/\D/)` | Use `!util/isLikeNumber(key)` instead of `key.match(/\D/)`
| JavaScript | isc | vigour-io/vjs | ---
+++
@@ -1,6 +1,6 @@
"use strict";
var Base = require('../base')
-
+var isLikeNumber =require('../util').isLikeNumber
/**
* @function raw converts the Base object into a normal javascript wObject, removing internal properties.
* It also converts nested objects and rebuilds arrays from objects with nothing but integer keys.
@@ -29,7 +29,7 @@
var newVal
for( var key in obj ) {
if ( key[0] !== '_' && key !== '$key' && key !== '$val' && (!exclude||!exclude(key, obj)) ) {
- if (key.match(/\D/)) {
+ if (!isLikeNumber(key)) {
isArrayLike = false
}
newVal = raw(obj[key]) |
f9421ab35aecdede1ca8454e231043e9f94edba6 | server/config.js | server/config.js | path = require('path');
module.exports = {
mongo: {
dbUrl: 'https://api.mongolab.com/api/1', // The base url of the MongoLab DB server
apiKey: 'gubV4zs5yN-ItUUQDpgUx0pUA98K3MYH', // Our MongoLab API key
dbPath: 'mongodb://root:4DaysKillerDemo@ds029979.mongolab.com:29979/paymymeeting'
},
server: {
listenPort: 3000,
distFolder: path.resolve(__dirname, '../client/dist'),
staticUrl: ''
}
}; | path = require('path');
module.exports = {
mongo: {
dbUrl: 'https://api.mongolab.com/api/1', // The base url of the MongoLab DB server
apiKey: 'gubV4zs5yN-ItUUQDpgUx0pUA98K3MYH', // Our MongoLab API key
//dbPath: 'mongodb://root:4DaysKillerDemo@ds029979.mongolab.com:29979/paymymeeting'
dbPath: 'mongodb://localhost:27017'
},
server: {
listenPort: 3000,
distFolder: path.resolve(__dirname, '../client/dist'),
staticUrl: ''
}
}; | Add localhost path for MongoDB | Add localhost path for MongoDB
| JavaScript | mit | PythagoreLab/PayMyMeeting | ---
+++
@@ -4,7 +4,8 @@
mongo: {
dbUrl: 'https://api.mongolab.com/api/1', // The base url of the MongoLab DB server
apiKey: 'gubV4zs5yN-ItUUQDpgUx0pUA98K3MYH', // Our MongoLab API key
- dbPath: 'mongodb://root:4DaysKillerDemo@ds029979.mongolab.com:29979/paymymeeting'
+ //dbPath: 'mongodb://root:4DaysKillerDemo@ds029979.mongolab.com:29979/paymymeeting'
+ dbPath: 'mongodb://localhost:27017'
},
server: {
listenPort: 3000, |
8848878d6341abee73b0afcd6670988aeb37ad58 | index.js | index.js | var clientio = require("socket.io-client");
var client = clientio.connect(process.env.HOST + ":" + process.env.PORT);
var Gpio = require("onoff").Gpio;
var slot = {}
slot.led1 = new Gpio(14, "out");
client.emit("join-end");
client.on("command", function(data){
console.log("change " + data.key + " status to : " + data.value);
slot[data.key].writeSync(parseInt(data.value));
})
// This is an example, the pi trigger a switch.
setTimeout(function(){
client.emit("switch1", 1);
client.on("message", function(data){
console.log(data);
});
}, 5000)
var exit = function(){
led.unexport();
process.exit();
}
process.on("SIGINT", exit);
| var clientio = require("socket.io-client");
var hostname = process.env.HOST || "localhost";
var port = process.env.PORT || 3001;
var client = clientio.connect(host + ":" + port.toString());
var Gpio = require("onoff").Gpio;
var slot = {}
slot.led1 = new Gpio(14, "out");
client.emit("join-end");
client.on("command", function(data){
console.log("change " + data.key + " status to : " + data.value);
slot[data.key].writeSync(parseInt(data.value));
})
client.on("message", function(data){
console.log(data);
});
// This is an example, the pi trigger a switch.
setTimeout(function(){
client.emit("switch1", 1);
}, 5000)
var exit = function(){
slot.led1.unexport();
process.exit();
}
process.on("SIGINT", exit);
| Fix typo, optional condition for hostname & port | Fix typo, optional condition for hostname & port
| JavaScript | mit | herpiko/nf-iot-end | ---
+++
@@ -1,5 +1,7 @@
var clientio = require("socket.io-client");
-var client = clientio.connect(process.env.HOST + ":" + process.env.PORT);
+var hostname = process.env.HOST || "localhost";
+var port = process.env.PORT || 3001;
+var client = clientio.connect(host + ":" + port.toString());
var Gpio = require("onoff").Gpio;
var slot = {}
@@ -11,18 +13,19 @@
console.log("change " + data.key + " status to : " + data.value);
slot[data.key].writeSync(parseInt(data.value));
})
+
+client.on("message", function(data){
+ console.log(data);
+});
// This is an example, the pi trigger a switch.
setTimeout(function(){
client.emit("switch1", 1);
- client.on("message", function(data){
- console.log(data);
- });
}, 5000)
+
var exit = function(){
- led.unexport();
+ slot.led1.unexport();
process.exit();
}
-
process.on("SIGINT", exit); |
fed7876c125287523fed18c0053f5d4456cacdbd | source/Divider.js | source/Divider.js | (function (enyo, scope) {
/**
* {@link moon.Divider} is a simply styled component that may be used as a separator
* between groups of components.
*
* @class moon.Divider
* @mixes moon.MarqueeSupport
* @mixes moon.MarqueeItem
* @ui
* @public
*/
enyo.kind(
/** @lends moon.Divider.prototype */ {
/**
* @private
*/
name: 'moon.Divider',
/**
* @private
*/
classes: 'moon-divider moon-divider-text',
/**
* @private
*/
mixins: ['moon.MarqueeSupport', 'moon.MarqueeItem'],
/**
* @private
*/
marqueeOnSpotlight: false,
/**
* @private
*/
marqueeOnRender: true,
/**
* @private
*/
contentChanged: enyo.inherit(function (sup) {
return function () {
sup.apply(this, arguments);
this.content = this.content.split(' ').map(enyo.cap).join(' ');
};
})
});
})(enyo, this);
| (function (enyo, scope) {
/**
* {@link moon.Divider} is a simply styled component that may be used as a separator
* between groups of components.
*
* @class moon.Divider
* @mixes moon.MarqueeSupport
* @mixes moon.MarqueeItem
* @ui
* @public
*/
enyo.kind(
/** @lends moon.Divider.prototype */ {
/**
* @private
*/
name: 'moon.Divider',
/**
* @private
*/
classes: 'moon-divider moon-divider-text',
/**
* @private
*/
mixins: ['moon.MarqueeSupport', 'moon.MarqueeItem'],
/**
* @private
*/
marqueeOnSpotlight: false,
/**
* @private
*/
marqueeOnRender: true,
/**
* @private
*/
contentChanged: enyo.inherit(function (sup) {
return function () {
this.content = this.content.split(' ').map(enyo.cap).join(' ');
sup.apply(this, arguments);
};
})
});
})(enyo, this);
| Set content property before DOM is updated. | BHV-12598: Set content property before DOM is updated.
Enyo-DCO-1.1-Signed-off-by: Aaron Tam <aaron.tam@lge.com>
| JavaScript | apache-2.0 | enyojs/moonstone,mcanthony/moonstone,mcanthony/moonstone,mcanthony/moonstone | ---
+++
@@ -42,8 +42,8 @@
*/
contentChanged: enyo.inherit(function (sup) {
return function () {
+ this.content = this.content.split(' ').map(enyo.cap).join(' ');
sup.apply(this, arguments);
- this.content = this.content.split(' ').map(enyo.cap).join(' ');
};
})
}); |
ad43d8c6a4c83b67b5ca95edbf9093bc89e16882 | client/webpack.base.config.js | client/webpack.base.config.js | const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
inject: 'true',
template: 'app/index.html'
});
const extractLess = new ExtractTextPlugin({
filename: "[name].css",
});
module.exports = (options) => ({
entry: './app/app.jsx',
output: Object.assign({
path: path.resolve(__dirname, "build"),
}, options.output),
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015','react']
}
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015','react']
}
},
{
test: /\.css$/,
use: "css-loader",
},
{
test: /\.less$/,
use: extractLess.extract({
use: [
{
loader: "css-loader",
options: {
url: false,
import: false,
}
},
{
loader: "less-loader",
options: {
relativeUrls: false,
}
}
],
fallback: "style-loader"
}),
},
]
},
plugins: options.plugins.concat([HtmlWebpackPluginConfig, new ExtractTextPlugin('[name].css', {allChunks: true})])
});
| const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
inject: 'true',
template: 'app/index.html'
});
const extractLess = new ExtractTextPlugin({
filename: "[name].css",
});
module.exports = (options) => ({
entry: './app/app.jsx',
output: Object.assign({
path: path.resolve(__dirname, "build"),
publicPath: "/"
}, options.output),
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015','react']
}
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015','react']
}
},
{
test: /\.css$/,
use: "css-loader",
},
{
test: /\.less$/,
use: extractLess.extract({
use: [
{
loader: "css-loader",
options: {
url: false,
import: false,
}
},
{
loader: "less-loader",
options: {
relativeUrls: false,
}
}
],
fallback: "style-loader"
}),
},
]
},
plugins: options.plugins.concat([HtmlWebpackPluginConfig, new ExtractTextPlugin('[name].css', {allChunks: true})])
});
| Make webpack dev server work for nested route paths. | Make webpack dev server work for nested route paths.
| JavaScript | mit | katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming,katharosada/bus-shaming | ---
+++
@@ -15,6 +15,7 @@
entry: './app/app.jsx',
output: Object.assign({
path: path.resolve(__dirname, "build"),
+ publicPath: "/"
}, options.output),
module: {
loaders: [ |
f22d12a06b8b90506f2ad6bbaf165948df145f60 | src/js/weapon.js | src/js/weapon.js | (function() {
'use strict';
function Weapon(game, x, y, coolDown, bulletSpeed, bullets, damage) {
this.game = game;
this.x = x;
this.y = y;
this.coolDown = coolDown;
this.nextFire = 0;
this.bullets = bullets;
this.bulletSpeed = bulletSpeed;
this.damage = damage;
}
Weapon.prototype = {
updateManually: function(x, y){
this.x = x;
this.y = y;
this.game.physics.angleToPointer(this);
if (this.game.input.activePointer.isDown){
this.fire();
}
},
fire: function(){
if (this.game.time.now > this.nextFire && this.bullets.countDead() > 0){
this.nextFire = this.game.time.now + this.coolDown;
var bullet = this.bullets.getFirstDead();
this.resetBullet(bullet);
}
},
resetBullet: function(bullet){
bullet.reset(this.x, this.y); // resets sprite and body
bullet.rotation = this.game.physics.moveToPointer(bullet, this.bulletSpeed);
}
};
window.Darwinator = window.Darwinator || {};
window.Darwinator.Weapon = Weapon;
}());
| (function() {
'use strict';
function Weapon(game, x, y, coolDown, bulletSpeed, bullets, damage) {
this.game = game;
this.x = x;
this.y = y;
this.coolDown = coolDown;
this.nextFire = 0;
this.bullets = bullets;
this.bulletSpeed = bulletSpeed;
this.damage = damage;
}
Weapon.prototype = {
updateManually: function(x, y){
this.x = x;
this.y = y;
},
fire: function(x, y){
if (this.game.time.now > this.nextFire && this.bullets.countDead() > 0){
this.nextFire = this.game.time.now + this.coolDown;
var bullet = this.bullets.getFirstDead();
bullet.reset(this.x, this.y);
bullet.rotation = this.takeAim(x, y);
}
},
takeAim: function(x, y) {
var perfAngle = this.game.physics.angleToXY(this.game.player, x, y);
// TODO: Make targeting depend on users intelligence.
return perfAngle;
}
};
window.Darwinator = window.Darwinator || {};
window.Darwinator.Weapon = Weapon;
}());
| Make fire take coordinates, add function for aiming | Make fire take coordinates, add function for aiming
| JavaScript | mit | werme/DATX02 | ---
+++
@@ -16,24 +16,23 @@
updateManually: function(x, y){
this.x = x;
this.y = y;
- this.game.physics.angleToPointer(this);
- if (this.game.input.activePointer.isDown){
- this.fire();
+ },
+
+ fire: function(x, y){
+ if (this.game.time.now > this.nextFire && this.bullets.countDead() > 0){
+ this.nextFire = this.game.time.now + this.coolDown;
+ var bullet = this.bullets.getFirstDead();
+ bullet.reset(this.x, this.y);
+ bullet.rotation = this.takeAim(x, y);
}
},
- fire: function(){
- if (this.game.time.now > this.nextFire && this.bullets.countDead() > 0){
- this.nextFire = this.game.time.now + this.coolDown;
- var bullet = this.bullets.getFirstDead();
- this.resetBullet(bullet);
- }
- },
+ takeAim: function(x, y) {
+ var perfAngle = this.game.physics.angleToXY(this.game.player, x, y);
+ // TODO: Make targeting depend on users intelligence.
+ return perfAngle;
+ }
- resetBullet: function(bullet){
- bullet.reset(this.x, this.y); // resets sprite and body
- bullet.rotation = this.game.physics.moveToPointer(bullet, this.bulletSpeed);
- }
};
window.Darwinator = window.Darwinator || {}; |
36b0096973cbcdfb00aa5f2562d075a70df6e4a0 | src/background.js | src/background.js | 'use strict';
chrome.app.runtime.onLaunched.addListener(function() {
chrome.runtime.getPlatformInfo(function(info) {
// don't render statusbar over app UI on iOS
if (info.os === 'cordova-ios' && window.StatusBar) {
window.StatusBar.overlaysWebView(false);
}
// open chrome app in new window
chrome.app.window.create('index.html', {
'bounds': {
'width': 1280,
'height': 800
}
});
});
}); | 'use strict';
chrome.app.runtime.onLaunched.addListener(function() {
chrome.runtime.getPlatformInfo(function(info) {
// don't render statusbar over app UI on iOS
if (info.os === 'cordova-ios' && window.StatusBar) {
window.StatusBar.overlaysWebView(false);
}
// open chrome app in new window
chrome.app.window.create('index.html', {
id: '0',
innerBounds: {
width: 1280,
height: 800
}
});
});
}); | Add id to chrome.window api to remember position and size | Add id to chrome.window api to remember position and size
| JavaScript | mit | clochix/mail-html5,halitalf/mail-html5,sheafferusa/mail-html5,sheafferusa/mail-html5,b-deng/mail-html5,whiteout-io/mail-html5,b-deng/mail-html5,whiteout-io/mail,halitalf/mail-html5,clochix/mail-html5,whiteout-io/mail,kalatestimine/mail-html5,tanx/hoodiecrow,sheafferusa/mail-html5,whiteout-io/mail-html5,whiteout-io/mail-html5,dopry/mail-html5,clochix/mail-html5,whiteout-io/mail,clochix/mail-html5,dopry/mail-html5,kalatestimine/mail-html5,halitalf/mail-html5,tanx/hoodiecrow,whiteout-io/mail,b-deng/mail-html5,sheafferusa/mail-html5,tanx/hoodiecrow,kalatestimine/mail-html5,halitalf/mail-html5,kalatestimine/mail-html5,dopry/mail-html5,b-deng/mail-html5,whiteout-io/mail-html5,dopry/mail-html5 | ---
+++
@@ -10,9 +10,10 @@
// open chrome app in new window
chrome.app.window.create('index.html', {
- 'bounds': {
- 'width': 1280,
- 'height': 800
+ id: '0',
+ innerBounds: {
+ width: 1280,
+ height: 800
}
});
}); |
fcf75a1589637715c76accbcfc7bb6dd9605ed31 | src/background.js | src/background.js | 'use strict';
function createTask(chrome, title, note) {
let task = 'twodo://x-callback-url/add?task=' + encodeURI(title) + '¬e=' + encodeURI(note);
chrome.tabs.update({
url: task
});
}
chrome.browserAction.onClicked.addListener(function(aTab) {
chrome.tabs.executeScript(aTab.id, {
code: "window.getSelection().toString()"
}, function(selectedText) {
let title = aTab.title;
let note = aTab.url;
if (selectedText instanceof Array && selectedText.length > 0) {
selectedText = selectedText[0];
}
if (selectedText && selectedText.length) {
note = note + "\n--\n" + selectedText;
}
createTask(chrome, title, note);
});
}); | 'use strict';
function createTask(chrome, title, note, url) {
let task = 'twodo://x-callback-url/add?task=' + encodeURI(title) + '¬e=' + encodeURI(note) + '&action=url:' + encodeURI(url);
chrome.tabs.update({
url: task
});
}
chrome.browserAction.onClicked.addListener(function(aTab) {
chrome.tabs.executeScript(aTab.id, {
code: "window.getSelection().toString()"
}, function(selectedText) {
let title = aTab.title;
let url = aTab.url;
let note = '';
if (selectedText instanceof Array && selectedText.length > 0) {
selectedText = selectedText[0];
}
if (selectedText && selectedText.length) {
note = selectedText;
}
createTask(chrome, title, note, url);
});
});
| Set URL action in newly created 2Do Task | Set URL action in newly created 2Do Task
Still add any selected text as a note, but use the current tab's URL as the
2Do action instead.
| JavaScript | mit | mkleucker/2do-webextension | ---
+++
@@ -1,7 +1,7 @@
'use strict';
-function createTask(chrome, title, note) {
- let task = 'twodo://x-callback-url/add?task=' + encodeURI(title) + '¬e=' + encodeURI(note);
+function createTask(chrome, title, note, url) {
+ let task = 'twodo://x-callback-url/add?task=' + encodeURI(title) + '¬e=' + encodeURI(note) + '&action=url:' + encodeURI(url);
chrome.tabs.update({
url: task
});
@@ -14,17 +14,18 @@
}, function(selectedText) {
let title = aTab.title;
- let note = aTab.url;
+ let url = aTab.url;
+ let note = '';
if (selectedText instanceof Array && selectedText.length > 0) {
selectedText = selectedText[0];
}
if (selectedText && selectedText.length) {
- note = note + "\n--\n" + selectedText;
+ note = selectedText;
}
- createTask(chrome, title, note);
+ createTask(chrome, title, note, url);
});
}); |
79b6179285a28efaad30ba45648a0a871e598324 | esnext.js | esnext.js | 'use strict';
const path = require('path');
module.exports = {
extends: path.join(__dirname, 'index.js'),
rules: {
'no-var': 'error',
'object-shorthand': [
'error',
'always'
],
'prefer-arrow-callback': [
'error',
{
allowNamedFunctions: true
}
],
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'prefer-numeric-literals': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-object-spread': 'error',
'prefer-destructuring': [
'error',
{
// `array` is disabled because it forces destructuring on
// stupid stuff like `foo.bar = process.argv[2];`
// TODO: Open ESLint issue about this
VariableDeclarator: {
array: false,
object: true
},
AssignmentExpression: {
array: false,
// Disabled because object assignment destructuring requires parens wrapping:
// `let foo; ({foo} = object);`
object: false
}
},
{
enforceForRenamedProperties: false
}
],
'no-useless-catch': 'error',
'prefer-named-capture-group': 'error'
}
};
| 'use strict';
const path = require('path');
module.exports = {
extends: path.join(__dirname, 'index.js'),
rules: {
'no-var': 'error',
'object-shorthand': [
'error',
'always'
],
'prefer-arrow-callback': [
'error',
{
allowNamedFunctions: true
}
],
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'prefer-numeric-literals': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-object-spread': 'error',
'prefer-destructuring': [
'error',
{
// `array` is disabled because it forces destructuring on
// stupid stuff like `foo.bar = process.argv[2];`
// TODO: Open ESLint issue about this
VariableDeclarator: {
array: false,
object: true
},
AssignmentExpression: {
array: false,
// Disabled because object assignment destructuring requires parens wrapping:
// `let foo; ({foo} = object);`
object: false
}
},
{
enforceForRenamedProperties: false
}
],
'no-useless-catch': 'error',
// Disabled for now as Firefox doesn't support named capture groups and I'm tired of getting issues about the use of named capture groups...
// 'prefer-named-capture-group': 'error'
}
};
| Disable the `prefer-named-capture-group` rule temporarily | Disable the `prefer-named-capture-group` rule temporarily
| JavaScript | mit | sindresorhus/eslint-config-xo | ---
+++
@@ -48,6 +48,8 @@
}
],
'no-useless-catch': 'error',
- 'prefer-named-capture-group': 'error'
+
+ // Disabled for now as Firefox doesn't support named capture groups and I'm tired of getting issues about the use of named capture groups...
+ // 'prefer-named-capture-group': 'error'
}
}; |
c3aeac1fd9568ea064f88e92cf16425ba7050f1b | test/app.spec.js | test/app.spec.js | 'use strict';
var expect = require('chai').expect;
var App = require('../app/scripts/app');
describe('app', function () {
it('should initialize app with no arguments', function () {
var app = new App();
expect(app).to.have.property('variables');
expect(app.variables).to.have.length(2);
expect(app).to.have.property('expressions');
expect(app.expressions).to.have.length(3);
});
});
| 'use strict';
var expect = require('chai').expect;
var App = require('../app/scripts/app');
describe('app', function () {
it('should initialize app with no arguments', function () {
var app = new App();
expect(app).to.have.property('variables');
expect(app.variables).to.have.length(2);
expect(app).to.have.property('expressions');
expect(app.expressions).to.have.length(3);
});
it('should initialize app with arguments', function () {
var app = new App({
variables: {items: [{name: 'a'}, {name: 'b'}, {name: 'c'}]},
expressions: {items: [{string: 'a xor b'}, {string: 'a nand b'}]}
});
expect(app).to.have.property('variables');
expect(app.variables).to.have.length(3);
expect(app.variables.items[0]).to.have.property('name', 'a');
expect(app.variables.items[1]).to.have.property('name', 'b');
expect(app.variables.items[2]).to.have.property('name', 'c');
expect(app).to.have.property('expressions');
expect(app.expressions).to.have.length(2);
expect(app.expressions.items[0]).to.have.property('string', 'a xor b');
expect(app.expressions.items[1]).to.have.property('string', 'a nand b');
});
});
| Add test for initializing app with arguments | Add test for initializing app with arguments
| JavaScript | mit | caleb531/truthy,caleb531/truthy | ---
+++
@@ -13,4 +13,20 @@
expect(app.expressions).to.have.length(3);
});
+ it('should initialize app with arguments', function () {
+ var app = new App({
+ variables: {items: [{name: 'a'}, {name: 'b'}, {name: 'c'}]},
+ expressions: {items: [{string: 'a xor b'}, {string: 'a nand b'}]}
+ });
+ expect(app).to.have.property('variables');
+ expect(app.variables).to.have.length(3);
+ expect(app.variables.items[0]).to.have.property('name', 'a');
+ expect(app.variables.items[1]).to.have.property('name', 'b');
+ expect(app.variables.items[2]).to.have.property('name', 'c');
+ expect(app).to.have.property('expressions');
+ expect(app.expressions).to.have.length(2);
+ expect(app.expressions.items[0]).to.have.property('string', 'a xor b');
+ expect(app.expressions.items[1]).to.have.property('string', 'a nand b');
+ });
+
}); |
e0d8b2aa93bf72a99893e6aaccb8dfbb23085dc2 | components/ProgramLine/index.js | components/ProgramLine/index.js | import React from 'react'
import PropTypes from 'prop-types'
import Moment from 'react-moment'
import Link from 'next/link'
import generateUrl from 'utils/urlGenerator'
import EditButton from 'containers/EditButton'
import stylesheet from './style.scss'
const ProgramLine = (props) => (
<div className='program-line'>
<style dangerouslySetInnerHTML={{ __html: stylesheet }} />
<div className='columns is-shadowless'>
<div className='column is-narrow'>
<Moment format='DD/MM/YYYY' unix>{Math.trunc(props.date / 1000)}</Moment>
</div>
<div className='column is-expanded'>
<Link href={`/program?id=${props.id}`} as={`/program/${props.id}`}><a>{props.title}</a></Link>
</div>
<div className='column is-narrow'>
<EditButton id={props.id} />
</div>
<div className='column is-narrow'>
<a href={generateUrl(props.url)}><i className='fa fa-download' /></a>
</div>
</div>
</div>
)
ProgramLine.propTypes = {
id: PropTypes.string.isRequired,
title: PropTypes.string,
date: PropTypes.number,
url: PropTypes.string
}
export default ProgramLine
| import React from 'react'
import PropTypes from 'prop-types'
import Moment from 'react-moment'
import Link from 'next/link'
import Head from 'next/head'
import generateUrl from 'utils/urlGenerator'
import EditButton from 'containers/EditButton'
import stylesheet from './style.scss'
const ProgramLine = (props) => (
<div className='program-line'>
<Head>
<style dangerouslySetInnerHTML={{ __html: stylesheet }} />
</Head>
<div className='columns is-shadowless'>
<div className='column is-narrow'>
<Moment format='DD/MM/YYYY' unix>{Math.trunc(props.date / 1000)}</Moment>
</div>
<div className='column is-expanded'>
<Link href={`/program?id=${props.id}`} as={`/program/${props.id}`}><a>{props.title}</a></Link>
</div>
<div className='column is-narrow'>
<EditButton id={props.id} />
</div>
<div className='column is-narrow'>
<a href={generateUrl(props.url)}><i className='fa fa-download' /></a>
</div>
</div>
</div>
)
ProgramLine.propTypes = {
id: PropTypes.string.isRequired,
title: PropTypes.string,
date: PropTypes.number,
url: PropTypes.string
}
export default ProgramLine
| Move ProgramLine style into head | Move ProgramLine style into head
| JavaScript | mit | bmagic/acdh-client | ---
+++
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import Moment from 'react-moment'
import Link from 'next/link'
+import Head from 'next/head'
import generateUrl from 'utils/urlGenerator'
import EditButton from 'containers/EditButton'
@@ -10,7 +11,9 @@
const ProgramLine = (props) => (
<div className='program-line'>
- <style dangerouslySetInnerHTML={{ __html: stylesheet }} />
+ <Head>
+ <style dangerouslySetInnerHTML={{ __html: stylesheet }} />
+ </Head>
<div className='columns is-shadowless'>
<div className='column is-narrow'>
<Moment format='DD/MM/YYYY' unix>{Math.trunc(props.date / 1000)}</Moment> |
4fe711dc8b18d93b711b5872f92593c37dfe9d7c | static/js/chat.js | static/js/chat.js | "use strict";
function Chat (p_session) {
var _session;
var self = this;
this._queue = [];
this.initialize = function (p_session) {
// register chat to session
p_session.register_chat(self);
// attach submit event
$("#send-message-form").submit(function(event){
event.preventDefault();
var date = new Date(), message = {
user_dst: parseInt($(this).find("#send-message-form-to").val(), 10),
stamp: Math.round(date.getTime() / 1000), // timestamp
content: $(this).find("#send-message-form-content").val()
};
self.queueMessage(message);
// close send message dialog
$(".ui-dialog").dialog("close");
});
};
this.getQueue = function () {
var queue = this._queue;
this._queue = [];
return queue;
};
this.queueMessage = function (message) {
this._queue.push(message);
};
// call initialize method
this.initialize(p_session);
}
| "use strict";
function Chat (p_session) {
var _session;
var self = this;
this._queue = [];
this.initialize = function (p_session) {
// register chat to session
p_session.register_chat(self);
// initialize list of users for the send message form
if (0 < p_session.other_users.length) {
var select = $("#send-message-form-to");
for (var i=0; i < p_session.other_users.length; i++) {
select.append('<option value="' + p_session.other_users[i].id + '">' + p_session.other_users[i].name + ' (' + p_session.other_users[i].id + ')</option>');
}
}
// attach submit event
$("#send-message-form").submit(function(event){
event.preventDefault();
var date = new Date(), message = {
user_dst: parseInt($(this).find("#send-message-form-to").val(), 10),
stamp: Math.round(date.getTime() / 1000), // timestamp
content: $(this).find("#send-message-form-content").val()
};
self.queueMessage(message);
// close send message dialog
$(".ui-dialog").dialog("close");
});
};
this.getQueue = function () {
var queue = this._queue;
this._queue = [];
return queue;
};
this.queueMessage = function (message) {
this._queue.push(message);
};
// call initialize method
this.initialize(p_session);
}
| Initialize the select element for sending a message. | Initialize the select element for sending a message.
| JavaScript | agpl-3.0 | mose/poietic-generator,mose/poietic-generator,mose/poietic-generator | ---
+++
@@ -10,6 +10,14 @@
this.initialize = function (p_session) {
// register chat to session
p_session.register_chat(self);
+
+ // initialize list of users for the send message form
+ if (0 < p_session.other_users.length) {
+ var select = $("#send-message-form-to");
+ for (var i=0; i < p_session.other_users.length; i++) {
+ select.append('<option value="' + p_session.other_users[i].id + '">' + p_session.other_users[i].name + ' (' + p_session.other_users[i].id + ')</option>');
+ }
+ }
// attach submit event
$("#send-message-form").submit(function(event){ |
f284b16e5bb43deb3f00a947d5515b515162cfcf | test/rpc-spec.js | test/rpc-spec.js | var assert = require('assert');
var producer = require('../index')().producer;
var consumer = require('../index')().consumer;
var uuid = require('node-uuid');
var fixtures = {
queues: ['test-queue-0']
};
describe('Producer/Consumer RPC messaging:', function() {
before(function (done) {
return consumer.connect()
.then(function (_channel) {
assert(_channel !== undefined);
assert(_channel !== null);
})
.then(function () {
return producer.connect();
})
.then(function (_channel) {
assert(_channel !== undefined);
assert(_channel !== null);
})
.then(done);
});
it('should be able to create a consumer that returns true if called as RPC [test-queue-0]', function (done) {
consumer.consume(fixtures.queues[0], function () {
return true;
})
.then(function(created) {
assert(created, true);
})
.then(done);
});
it('should be able to produce a RPC message and get a response [test-queue-0]', function (done) {
producer.produce(fixtures.queues[0], { msg: uuid.v4() })
.then(function (response) {
assert(response, true);
})
.then(done);
});
});
| var assert = require('assert');
var producer = require('../index')().producer;
var consumer = require('../index')().consumer;
var uuid = require('node-uuid');
var fixtures = {
queues: ['rpc-queue-0']
};
describe('Producer/Consumer RPC messaging:', function() {
before(function (done) {
return consumer.connect()
.then(function (_channel) {
assert(_channel !== undefined);
assert(_channel !== null);
})
.then(function () {
return producer.connect();
})
.then(function (_channel) {
assert(_channel !== undefined);
assert(_channel !== null);
})
.then(done);
});
it('should be able to create a consumer that returns a message if called as RPC [rpc-queue-0]', function (done) {
consumer.consume(fixtures.queues[0], function () {
return 'Power Ranger Red';
})
.then(function(created) {
assert.equal(created, true);
})
.then(done);
});
it('should be able to produce a RPC message and get a response [rpc-queue-0]', function (done) {
producer.produce(fixtures.queues[0], { msg: uuid.v4() })
.then(function (response) {
assert.equal(response, 'Power Ranger Red');
})
.then(done);
});
});
| Rename rpc test queue and change rpc message | Rename rpc test queue and change rpc message
| JavaScript | mit | dial-once/node-bunnymq | ---
+++
@@ -4,7 +4,7 @@
var uuid = require('node-uuid');
var fixtures = {
- queues: ['test-queue-0']
+ queues: ['rpc-queue-0']
};
describe('Producer/Consumer RPC messaging:', function() {
@@ -24,20 +24,20 @@
.then(done);
});
- it('should be able to create a consumer that returns true if called as RPC [test-queue-0]', function (done) {
+ it('should be able to create a consumer that returns a message if called as RPC [rpc-queue-0]', function (done) {
consumer.consume(fixtures.queues[0], function () {
- return true;
+ return 'Power Ranger Red';
})
.then(function(created) {
- assert(created, true);
+ assert.equal(created, true);
})
.then(done);
});
- it('should be able to produce a RPC message and get a response [test-queue-0]', function (done) {
+ it('should be able to produce a RPC message and get a response [rpc-queue-0]', function (done) {
producer.produce(fixtures.queues[0], { msg: uuid.v4() })
.then(function (response) {
- assert(response, true);
+ assert.equal(response, 'Power Ranger Red');
})
.then(done);
}); |
78ad3613e02ed2ab7c848d33d6ff9ad40a0789ff | client/scripts/sw.js | client/scripts/sw.js | const toolbox = require('sw-toolbox');
// Try network but fallback to cache
toolbox.router.default = toolbox.networkFirst;
// Data should query the network first
toolbox.router.any('/api/*', toolbox.networkOnly);
// Data should query the network first
toolbox.router.any('/auth/*', toolbox.networkOnly);
| import {router} from 'sw-toolbox';
// Try network but fallback to cache
router.default = toolbox.networkFirst;
// Data should query the network first
router.any('/api/*', toolbox.networkOnly);
// Data should query the network first
router.any('/auth/*', toolbox.networkOnly);
| Use import rather than require | Use import rather than require
| JavaScript | mit | AdaRoseEdwards/81,AdaRoseEdwards/81,AdaRoseEdwards/81 | ---
+++
@@ -1,10 +1,10 @@
-const toolbox = require('sw-toolbox');
+import {router} from 'sw-toolbox';
// Try network but fallback to cache
-toolbox.router.default = toolbox.networkFirst;
+router.default = toolbox.networkFirst;
// Data should query the network first
-toolbox.router.any('/api/*', toolbox.networkOnly);
+router.any('/api/*', toolbox.networkOnly);
// Data should query the network first
-toolbox.router.any('/auth/*', toolbox.networkOnly);
+router.any('/auth/*', toolbox.networkOnly); |
74bd38f424fbdea30488ab5ef33afe5036be6018 | script/mylowyat.user.js | script/mylowyat.user.js | // ==UserScript==
// @author sk3dsu(Fadli Ishak)
// @name MyLowyat
// @version 0.2.1
// @description Removing some elements of the forum to be a bit cleaner for SFW.
// @namespace https://github.com/mfadliishak/lowyatAvatars
// @icon https://forum.lowyat.net/favicon.ico
// @match http*://forum.lowyat.net/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// ==/UserScript==
/**
* 1. Remove all those annoying avatars!
*
*/
var avatars = $('.avatarwrap');
for (i = 0; i < avatars.length; i++)
{
var item = avatars[i];
item.style = "display:none;";
}
/**
* 2. Remove that big banner up there.
*
*/
var banner = $('.borderwrap');
if (banner)
{
banner.style = "display:none;";
}
| // ==UserScript==
// @author sk3dsu(Fadli Ishak)
// @name MyLowyat
// @version 0.2.2
// @description Removing some elements of the forum to be a bit cleaner for SFW.
// @namespace https://github.com/mfadliishak/lowyatAvatars
// @icon https://forum.lowyat.net/favicon.ico
// @match http*://forum.lowyat.net/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// @run-at document-idle
// ==/UserScript==
/**
* 1. Remove all those annoying avatars!
*
*/
var avatars = $('.avatarwrap');
for (i = 0; i < avatars.length; i++)
{
var item = avatars[i];
item.style.display = "none";
}
/**
* 2. Remove that big banner up there.
*
*/
var banner = $('.borderwrap #logostrip');
if (banner.length)
{
banner.css("display", "none");
}
| Fix Remove banner still showing, use inline css instead. | Fix Remove banner still showing, use inline css instead.
| JavaScript | mit | mfadliishak/mylowyat | ---
+++
@@ -1,12 +1,13 @@
// ==UserScript==
// @author sk3dsu(Fadli Ishak)
// @name MyLowyat
-// @version 0.2.1
+// @version 0.2.2
// @description Removing some elements of the forum to be a bit cleaner for SFW.
// @namespace https://github.com/mfadliishak/lowyatAvatars
// @icon https://forum.lowyat.net/favicon.ico
// @match http*://forum.lowyat.net/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
+// @run-at document-idle
// ==/UserScript==
/**
@@ -17,15 +18,15 @@
for (i = 0; i < avatars.length; i++)
{
var item = avatars[i];
- item.style = "display:none;";
+ item.style.display = "none";
}
/**
* 2. Remove that big banner up there.
*
*/
-var banner = $('.borderwrap');
-if (banner)
+var banner = $('.borderwrap #logostrip');
+if (banner.length)
{
- banner.style = "display:none;";
+ banner.css("display", "none");
} |
22f41b9cfcf10af245b9bb185d9eb04c2fa82da6 | lib/rules/space-after-comma.js | lib/rules/space-after-comma.js | 'use strict';
var helpers = require('../helpers');
module.exports = {
'name': 'space-after-comma',
'defaults': {
'include': true
},
'detect': function (ast, parser) {
var result = [];
ast.traverseByTypes(['operator', 'delimiter'], function (operator, i, parent) {
var next;
if (operator.content === ',') {
next = parent.content[i + 1];
if (next) {
if (operator.is('delimiter')) {
if (next.is('simpleSelector')) {
next = next.content[0];
}
}
if ((next.is('space') && !helpers.hasEOL(next.content)) && !parser.options.include) {
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': next.start.line,
'column': next.start.column,
'message': 'Commas should not be followed by a space',
'severity': parser.severity
});
}
if (!next.is('space') && parser.options.include) {
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': operator.start.line,
'column': operator.start.column,
'message': 'Commas should be followed by a space',
'severity': parser.severity
});
}
}
}
});
return result;
}
};
| 'use strict';
var helpers = require('../helpers');
module.exports = {
'name': 'space-after-comma',
'defaults': {
'include': true
},
'detect': function (ast, parser) {
var result = [];
ast.traverseByTypes(['operator', 'delimiter'], function (operator, i, parent) {
var next,
doubleNext;
if (operator.content === ',') {
next = parent.content[i + 1] || false;
doubleNext = parent.content[i + 2] || false;
if (next) {
if (operator.is('delimiter')) {
if (next.is('selector')) {
next = next.content[0];
}
}
if ((next.is('space') && !helpers.hasEOL(next.content)) && !parser.options.include) {
if (doubleNext && doubleNext.is('singlelineComment')) {
return false;
}
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': next.start.line,
'column': next.start.column,
'message': 'Commas should not be followed by a space',
'severity': parser.severity
});
}
if (!next.is('space') && parser.options.include) {
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': operator.start.line,
'column': operator.start.column,
'message': 'Commas should be followed by a space',
'severity': parser.severity
});
}
}
}
});
return result;
}
};
| Refactor rule to work with gonzales 3.2.1 | :art: Refactor rule to work with gonzales 3.2.1
| JavaScript | mit | sasstools/sass-lint,flacerdk/sass-lint,bgriffith/sass-lint,sktt/sass-lint,srowhani/sass-lint,DanPurdy/sass-lint,sasstools/sass-lint,srowhani/sass-lint | ---
+++
@@ -11,18 +11,25 @@
var result = [];
ast.traverseByTypes(['operator', 'delimiter'], function (operator, i, parent) {
- var next;
+ var next,
+ doubleNext;
if (operator.content === ',') {
- next = parent.content[i + 1];
+ next = parent.content[i + 1] || false;
+ doubleNext = parent.content[i + 2] || false;
if (next) {
if (operator.is('delimiter')) {
- if (next.is('simpleSelector')) {
+ if (next.is('selector')) {
next = next.content[0];
}
}
+
if ((next.is('space') && !helpers.hasEOL(next.content)) && !parser.options.include) {
+ if (doubleNext && doubleNext.is('singlelineComment')) {
+ return false;
+ }
+
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': next.start.line,
@@ -31,6 +38,7 @@
'severity': parser.severity
});
}
+
if (!next.is('space') && parser.options.include) {
result = helpers.addUnique(result, {
'ruleId': parser.rule.name, |
b909320915b98e7906a6753da3ec68c5a0567a22 | net/data/proxy_resolver_v8_unittest/ends_with_comment.js | net/data/proxy_resolver_v8_unittest/ends_with_comment.js | function FindProxyForURL(url, host) {
return "PROXY success:80";
}
// We end the script with a comment (and no trailing newline).
// This used to cause problems, because internally ProxyResolverV8
// would append some functions to the script; the first line of
// those extra functions was being considered part of the comment.
| function FindProxyForURL(url, host) {
return "PROXY success:80";
}
// We end the script with a comment (and no trailing newline).
// This used to cause problems, because internally ProxyResolverV8
// would append some functions to the script; the first line of
// those extra functions was being considered part of the comment. | Set the mime-type on a test data file to binary. | Set the mime-type on a test data file to binary.
I just checked this file in, and it shouldn't have a trailing newline.
However when I checked it out, SVN seems to have put back an LF at the end.
Hopefully this will prevent that from happening.
BUG=http://crbug.com/22864
TBR=cpu
Review URL: http://codereview.chromium.org/223020
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@27036 0039d316-1c4b-4281-b951-d872f2087c98
| JavaScript | bsd-3-clause | adobe/chromium,yitian134/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,ropik/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,gavinp/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,gavinp/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,ropik/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,gavinp/chromium | |
a39aa576808891460fd674345162cecf57a45ee8 | examples/configs/webpack-base.config.js | examples/configs/webpack-base.config.js | /* eslint-disable global-require */
const path = require('path');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const babelConfig = require('../../package.json').babel;
module.exports = {
entry: {
app: path.join(__dirname, '../index.js'),
vendor: [
'babel-polyfill',
'lodash',
],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
quiet: true,
},
},
},
{
exclude: /node_modules/,
test: /\.js$/,
use: {
loader: 'babel-loader',
options: babelConfig,
},
},
],
},
output: {
filename: '[name].[chunkhash].bundle.js',
path: path.resolve(__dirname, '../dist'),
},
plugins: [
new CleanWebpackPlugin([
path.join(__dirname, '../dist'),
]),
new HtmlWebpackPlugin({
appMountId: 'root',
baseHref: '/',
inject: false,
title: 'dawww Testing',
template: require('html-webpack-template'),
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'runtime',
}),
new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true,
}),
],
};
| /* eslint-disable global-require */
const path = require('path');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const babelConfig = require('../../package.json').babel;
module.exports = {
entry: {
app: path.join(__dirname, '../index.js'),
vendor: [
'lodash',
],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
quiet: true,
},
},
},
{
exclude: /node_modules/,
test: /\.js$/,
use: {
loader: 'babel-loader',
options: babelConfig,
},
},
],
},
output: {
filename: '[name].[chunkhash].bundle.js',
path: path.resolve(__dirname, '../dist'),
},
plugins: [
new CleanWebpackPlugin([
path.join(__dirname, '../dist'),
]),
new HtmlWebpackPlugin({
appMountId: 'root',
baseHref: '/',
inject: false,
title: 'dawww Testing',
template: require('html-webpack-template'),
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'runtime',
}),
new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true,
}),
],
};
| Remove babel-polyfill from vendor bundle | build(webpack): Remove babel-polyfill from vendor bundle
| JavaScript | mit | nickjohnson-dev/dawww | ---
+++
@@ -10,7 +10,6 @@
entry: {
app: path.join(__dirname, '../index.js'),
vendor: [
- 'babel-polyfill',
'lodash',
],
}, |
57079e22ece4cde0aef427eee163810a141c4731 | config/assets/cloud-foundry.js | config/assets/cloud-foundry.js | 'use strict';
module.exports = {
client: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.min.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
],
js: [
'public/lib/angular/angular.min.js',
'public/lib/angular-resource/angular-resource.min.js',
'public/lib/angular-animate/angular-animate.min.js',
'public/lib/angular-ui-router/release/angular-ui-router.min.js',
'public/lib/angular-ui-utils/ui-utils.min.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'public/lib/angular-file-upload/angular-file-upload.min.js'
]
},
css: 'public/dist/application.min.css',
js: 'public/dist/application.min.js'
}
};
| 'use strict';
module.exports = {};
| Remove non CF specific files | Remove non CF specific files
| JavaScript | mit | duppercloud/mean,edwardt4482/customerRates,Karma-Tech-Consulting/recipes,NicolasKovalsky/mean,amoundr/doctorNet,mc-funk/exostie-device-sim-js,shteeven/scradio,cleargif/mean,lirantal/vault,ChristopherJones72521/KHE2015,spacetag/TechEx_Josiah_2,devypt/mean,Boonda-P/newmean,ryanjbaxter/mean,helaili/automatic-octo-spork,etkirsch/tolmea,tleskin/mean,monolithx/smallbatch-node,FisherYu-CN/riskcontrolplatform,ryanjbaxter/mean,steven-st-james/mapping-slc,annafatsevych/meanjs,CavHack/MEAN-DALI,heaguado/mean,vilallonga/mean,amitdhakad/MEAN,CEN30317a/mean,wraak/mean,woodmark888/meanjs,mbonig/mean,CSALucasNascimento/Personal-APP,MatthieuNICOLAS/PLMProfiles,helaili/automatic-octo-spork,elliottross23/blur-admin-meanjs,ebonertz/mean-blog,wraak/mean,tmrotz/LinkedIn-People-MEAN.JS,meanjs/mean,atumachimela/stocktaker,skyees/start,CEN30317a/mean,Hkurtis/capstone,amalo95/mean,etkirsch/cnd-mean,Tsuna-mi/owwwly-app,amoundr/docnet1,cuervox105/meanjs,tidemann/loopradio,dtytomi/classiecargo,trendzetter/VegetableGardenPlanner,dcdrawk/paperCMS,sotito/ATHMovilB2P,johnk13/meanjs,ProjectGroupB/SchoolNotes,clintecum/digitalInclusion,NicolasKovalsky/mean,trainerbill/mean,hpham33/schoolmanager,Peretus/homepage,clintecum/digitalInclusion,AlekseyH/buildingCompany,damianham/boatdata,qolart/qolart,MengtingXie/fccNightlifeCoordinationApp,ajain27/M.E.A.N,stefan8888/meanjs_experiment,renethio/afelalagi,renethio/afelalagi,mpatc/gulp,zhaokejian/SenImgVis-meanjs,shubham2192/aws-codeStore,tmullen71/automata,GLatendresse/GTI510,muarif/wb,fauria/mean,etkirsch/tolmea,jingkecn/StreamingJS,abhijitkamb/introtomean,ProjectGroupB/SchoolNotes,zaramckeown/Mentor.me,atumachimela/invent,zeldar/meanjs-0.4.2,erChupa8/PruebaMeanJs,StetSolutions/pean,arawak-io/cashew,logancodes/esm-server,monolithx/smallbatch-node,braisman/fosetov1,Mulumoodi/smartCams,jingkecn/StreamingJS,p4cm4n972/galajsy.proto,MPX4132/SocializerJS,erChupa8/PruebaMeanJs,AbdullahElamir/Full_EXAMPLE_MEANJS,nirajnishan27/webapp01,ignasg/revbot,elvisobiaks/development,tleskin/mean,amtkmrsmn/myApp,vaucouleur/mean,geastham/mean-admin-lte,PoetsRock/mapping-slc,langman66/hos,geastham/mean-admin-lte,benobab/honolulu-meanjs,Mr-Smithy-x/Lehman-Hackthon,rastemoh/mean,tonymullen/flipflop,gustavodemari/mean,trainerbill/mean,sotito/Helei.io,prosanes/discoteca_meanjs,luebken/mean,kumaria/mean-1,steve-visibble/codesnippets,zhaokejian/SenImgVis-meanjs,arawak-io/cashew,mattpetters/mean_stack_demo,BuggleInc/PLM-profiles,monolithx/smallbatch-node,abhijitkamb/introtomean,jloveland/mean,pcnicklaus/jobfinder-app-master,Mr-Smithy-x/Lehman-Hackthon,CEN3031-6a/party-up,bhollan/teamgreenbits,Joanclopez/frikilandia,GdBdP/mean.js,mpatc/meanSpace,0xNacho/mean,bhollan/teamgreenbits,JoshuaJWilborn/wilborn.tech,meanjs/mean,paramananda/mean-1,renethio/afelalagi,StewartDunlop/LifeMapTools,jingkecn/StreamingJS,damianham/boatdata,steve-visibble/codesnippets,fauria/mean,interactive-learning-systems/skill-finder,MengtingXie/fccNightlifeCoordinationApp,villapilla/dop_tester_dev,interactive-learning-systems/skill-finder,carlosrj/spenergy,ahurtado-ht/go5app_portal_meanjs,amtkmrsmn/myApp,ahurtado-ht/go5app_portal_meanjs,jloveland/mean,cwtwc/mean,pcullin-ratio/mean,ProjectGroupB/SchoolNotes,chelnydev/hive,mbonig/mean,trendzetter/VegetableGardenPlanner,CSantosCompSci/MEANstackAcademicApp,arawak-io/arawak.space,zfxsss/mean,tleskin/mean,ChristopherJones72521/KHE2015,ckim06/crimemap,Karma-Tech-Consulting/recipes,diogoriba/dbdemo,sotito/ddr,Boonda-P/newmean,S00157097/GP,sotito/ddr,hernii8/udemy-meanjs,ppoplawska/mean,hieugie/rental-rio,zhaokejian/SenImgVis-meanjs,kumaria/mean-1,ebonertz/mean-blog,sloangrif/mean,CannedFish/teammgr4fun,johnk13/meanjs,elvisobiaks/development,Sodtseren/jobfinder,muarif/wb,polakowo/seba-recver,amalo95/mean,RyanKirby/server-ccncl,BrianBeeler/angular-challenge,tecnoscience/clubmanager,StetSolutions/pean,heaguado/mean,kieferbonk/meanjs,frasermacquarrie/thenoiseontoys,clintecum/digitalInclusion,MSaifAsif/magmachine,emaraan/BossableMeanChallenge,SodY2/meanAP,CEN3031Group5B/mean,bangbh81/MyFirstMeanjs,nias-r/pdf_csv,jpca999/properties-dec,RyanKirby/server-ccncl,H3rN4n/thunder-mean,benobab/honolulu-meanjs,AlekseyH/buildingCompany,gisheri/ericgish,davidmohara/OAW,e178551/mean.edu,erChupa8/PruebaMeanJs,stefansvensson/tsp,flacoeterno/flaco.com.ar,benobab/honolulu-meanjs,kieferbonk/meanjs,braisman/fosetov1,frasermacquarrie/thenoiseontoys,luebken/mean,Four-Dales/team-agreements,tidemann/loopradio,ppoplawska/mean,annafatsevych/meanjs,ChristopherJones72521/KHE2015,GLatendresse/GTI510,DoubleA7/SoundPadLab,codydaig/mean,nyghtwel/mean,dcdrawk/paperCMS,ckim06/crimemap,S00157097/GP,arawak-io/arawak.io,GdBdP/mean.js,sotito/ATHMovilB2P,Gym/mean,jpca999/properties-dec,Four-Dales/team-agreements,chelnydev/hive,amoundr/docnet1,tmullen71/automata,caleb272/nightlife-app,READYTOMASSACRE/example-calendar-mean,simison/mean,AbdullahElamir/Full_EXAMPLE_MEANJS,Karma-Tech-Consulting/recipes,lirantal/meanjs,mcshekhar/CustomerManagementSystem,Gym/mean,etkirsch/cnd-mean,lirantal/vault,davidmohara/OAW,MengtingXie/fccNightlifeCoordinationApp,stefansvensson/tsp,nagarjunredla/mean-material,CavHack/MEAN-DALI,pcullin-ratio/mean,alfrededison/mean-stack-learning,jaketurton/camera-app,zeldar/meanjs-0.4.2,vilallonga/mean,cone-7/sistema-liga,trendzetter/mean,cmbusse/recipebook,frasermacquarrie/thenoiseontoys,saabdoli/mean-rss-app,aivrit/Prioreatize,megatronv7/pos,rastemoh/mean,JoshuaJWilborn/wilborn.tech,Four-Dales/team-agreements,scottrehlander/lrig-mean,BuggleInc/PLM-accounts,paramananda/mean-1,lirantal/vault,oierbravo/meanjs-abestuz,CEN3031-6a/party-up,vaucouleur/mean,skyees/start,rodp82/mean,mapping-slc/mapping-slc,trendzetter/mean,emaraan/BossableMeanChallenge,brewlogic/brewapp,BrianBeeler/angular-challenge,colinwitkamp/DataEntry-MEAN-,helios1989/MEANTEST,shteeven/scradio,nias-r/pdf_csv,gisheri/ericgish,tutley/mean,e178551/mean.edu,amoundr/doctorNet,cknism/meanjs-upload,ccheng312/chordsheets,Sodtseren/jobfinder,hyperreality/mean,Tsuna-mi/owwwly-app,alexliubj/mean,Fadolf/ranking-app,e178551/mean.edu,XuanyuZhao1984/GradeUp,sotito/ATHMovilB2P,tutley/mean,bhollan/teamgreenbits,zfxsss/mean,janvenstermans/culturelog,kieferbonk/meanjs,DoubleA7/SoundPadLab,stefan8888/meanjs_experiment,steve-visibble/codesnippets,SodY2/meanAP,abhijitkamb/Template_MEANjs,CEN30317a/mean,thecoons/HearthDeep,cleargif/mean,Peretus/homepage,tutley/mean,megatronv7/pos,DoubleA7/SoundPadLab,ccheng312/chordsheets,stefansvensson/tsp,mattpetters/mean_stack_demo,saabdoli/mean-rss-app,gaelgf/twitter-mongo,CSantosCompSci/MEANstackAcademicApp,jemsotry/mean,brewlogic/brewapp,Joanclopez/MEANHeroes,Tsuna-mi/owwwly-app,cleargif/mean,sloangrif/mean,polakowo/seba-recver,prosanes/discoteca_meanjs,dtytomi/classiecargo,ProjectGroupB/SchoolNotes,zfxsss/mean,luebken/mean,dcdrawk/paperCMS,Tsuna-mi/owwwly-app,s207152/mean,CEN3031-6a/party-up,mcshekhar/CustomerManagementSystem,s207152/mean,ahurtado-ht/go5app_portal_meanjs,ElevenFiftyApprentices/ShoppingList_J3,H3rN4n/thunder-mean,ahurtado-dj/evnt_producer_meanjs,mpatc/meanSpace,interactive-learning-systems/skill-finder,steven-st-james/mapping-slc,CEN3031Group9B/mean-1,BuggleInc/PLM-accounts,lonAlbert/my30daysofmean,pcnicklaus/jobfinder-app-master,ebonertz/mean-blog,kassemshehady/mean,bur/mean,braisman/fosetov1,nyghtwel/mean,janvenstermans/culturelog,sotito/Helei.io,carlosrj/spenergy,StewartDunlop/LifeMapTools,shteeven/deutschapp,edelrosario/mean,simison/mean,ajain27/M.E.A.N,Sunderous/lupine,hieugie/rental-rio,S00157097/GP,gaelgf/twitter-mongo,BrianBeeler/angular-challenge,nirajnishan27/webapp01,polakowo/seba-recver,flacoeterno/flaco.com.ar,chelnydev/hive,CEN3031Group5B/mean,shteeven/deutschapp,lonAlbert/my30daysofmean,sotito/Helei.io,amalo95/mean,bur/mean,mcshekhar/CustomerManagementSystem,charliejl28/MyMoments,davidrocklee/mean,nyghtwel/mean,agileurbanite/dms-mean-modo,woodmark888/meanjs,ElevenFiftyApprentices/ShoppingList_J3,cuervox105/meanjs,oierbravo/meanjs-abestuz,arawak-io/cashew,ckim06/crimemap,jemsotry/mean,amoundr/doctorNet,edwardt4482/customerRates,duppercloud/mean,alexliubj/mean,Sunderous/lupine,CSALucasNascimento/Personal-APP,BuggleInc/PLM-accounts,rastemoh/mean,frasermacquarrie/thenoiseontoys,cknism/meanjs-upload,ehsan5505/jobDirect,hyperreality/mean,atumachimela/stocktaker,Fadolf/ranking-app,qolart/qolart,qolart/qolart,aivrit/Prioreatize,meanjs/mean,GLatendresse/GTI510,agileurbanite/dms-mean-modo,trendzetter/mean,langman66/hos,atumachimela/invent,aivrit/Prioreatize,blietz71/AppMakers,wraak/mean,abhijitkamb/Template_MEANjs,brewlogic/brewapp,kassemshehady/mean,etkirsch/cnd-mean,arawak-io/cashew,cuervox105/meanjs,hpham33/schoolmanager,MatthieuNICOLAS/PLMAccounts,Joanclopez/MEANHeroes,arawak-io/arawak.space,edwardt4482/customerRates,tonymullen/flipflop,MSaifAsif/magmachine,Sodtseren/jobfinder,colinwitkamp/DataEntry-MEAN-,CEN3031Group5B/mean,nagarjunredla/mean-material,PayYourNight/Pay_Your_Night_MEAN,rastemoh/mean,paramananda/mean-1,PoetsRock/mapping-slc,blietz71/AppMakers,lonAlbert/my30daysofmean,amoundr/docnet1,hernii8/udemy-meanjs,midroid/mean,MSaifAsif/magmachine,Hkurtis/capstone,mapping-slc/mapping-slc,fauria/mean,sloangrif/mean,duppercloud/mean,tejaser/meanApp,Gym/mean,prosanes/discoteca_meanjs,caleb272/nightlife-app,oolawo09/Threshold,zhaokejian/SenImgVis-meanjs,MatthieuNICOLAS/PLMProfiles,alfrededison/mean-stack-learning,FisherYu-CN/riskcontrolplatform,StetSolutions/pean,ElevenFiftyApprentices/ShoppingList_J3,sotito/ddr,ehsan5505/jobDirect,caleb272/nightlife-app,NicolasKovalsky/mean,combefis/OpenSM,villapilla/dop_tester_dev,tejaser/meanApp,ProjectGroupB/SchoolNotes,thecoons/HearthDeep,ppoplawska/mean,mc-funk/exostie-device-sim-js,logancodes/esm-server,PayYourNight/Pay_Your_Night_MEAN,villapilla/dop_tester_dev,oierbravo/meanjs-abestuz,jemsotry/mean,approgramer/mean,shubham2192/aws-codeStore,cmbusse/recipebook,ryanjbaxter/mean,AbdullahElamir/Full_EXAMPLE_MEANJS,H3rN4n/thunder-mean,helios1989/MEANTEST,osbornch/image-stock,ajain27/M.E.A.N,p4cm4n972/galajsy.proto,davidrocklee/mean,siliconrhino/mean,pcnicklaus/jobfinder-app-master,cmbusse/recipebook,mpatc/gulp,SodY2/meanAP,codydaig/mean,ccheng312/chordsheets,cone-7/sistema-liga,siliconrhino/mean,saabdoli/mean-rss-app,tonymullen/flipflop,amtkmrsmn/myApp,mpatc/gulp,amitdhakad/MEAN,edelrosario/mean,siliconrhino/mean,trendzetter/VegetableGardenPlanner,megatronv7/pos,emaraan/BossableMeanChallenge,shteeven/scr-radio,lirantal/meanjs,ElevenFiftyApprentices/ShoppingList_J3,hieugie/rental-rio,Joanclopez/MEANHeroes,ignasg/revbot,janvenstermans/culturelog,Mulumoodi/smartCams,gustavodemari/mean,squeetus/PizzaCats,READYTOMASSACRE/example-calendar-mean,elvisobiaks/development,elliottross23/blur-admin-meanjs,jpca999/properties-dec,tecnoscience/clubmanager,atumachimela/invent,cknism/meanjs-upload,CEN3031Group9B/mean-1,pcullin-ratio/mean,hyperreality/mean,taobataoma/imean,BuggleInc/PLM-profiles,kassemshehady/mean,alexliubj/mean,gisheri/ericgish,mattpetters/mean_stack_demo,cwtwc/mean,devypt/mean,JoshuaJWilborn/wilborn.tech,BuggleInc/PLM-profiles,charliejl28/MyMoments,nagarjunredla/mean-material,cone-7/sistema-liga,squeetus/PizzaCats,nias-r/pdf_csv,CEN3031Group9B/mean-1,etkirsch/tolmea,flacoeterno/flaco.com.ar,Joanclopez/frikilandia,Joanclopez/frikilandia,tmrotz/LinkedIn-People-MEAN.JS,spacetag/TechEx_Josiah_2,rodp82/mean,carlosrj/spenergy,simison/mean,CannedFish/teammgr4fun,p4cm4n972/galajsy.proto,arawak-io/arawak.io,sibantolon331/1234567890,zaramckeown/Mentor.me,zeldar/meanjs-0.4.2,damianham/boatdata,alfrededison/mean-stack-learning,jaketurton/camera-app,tejaser/meanApp,CSantosCompSci/MEANstackAcademicApp,Hkurtis/capstone,combefis/OpenSM,ehsan5505/jobDirect,mpatc/meanSpace,osbornch/image-stock,NicolasKovalsky/mean,AlekseyH/buildingCompany,fauria/mean,charliejl28/MyMoments,hernii8/udemy-meanjs,colinwitkamp/DataEntry-MEAN-,helios1989/MEANTEST,vilallonga/mean,sibantolon331/1234567890,gaelgf/twitter-mongo,edelrosario/mean,shteeven/scr-radio,logancodes/esm-server,trainerbill/mean,XuanyuZhao1984/GradeUp,MPX4132/SocializerJS,jaketurton/camera-app,RyanKirby/server-ccncl,shteeven/rtd,mapping-slc/mapping-slc,heaguado/mean,gustavodemari/mean,bangbh81/MyFirstMeanjs,diogoriba/dbdemo,Mulumoodi/smartCams,MatthieuNICOLAS/PLMAccounts,annafatsevych/meanjs,davidmohara/OAW,arawak-io/arawak.space,GdBdP/mean.js,midroid/mean,CannedFish/teammgr4fun,taobataoma/imean,osbornch/image-stock,scottrehlander/lrig-mean,bangbh81/MyFirstMeanjs,shteeven/scr-radio,mc-funk/exostie-device-sim-js,shteeven/rtd,blietz71/AppMakers,diogoriba/dbdemo,READYTOMASSACRE/example-calendar-mean,midroid/mean,abhijitkamb/Template_MEANjs,taobataoma/imean,shteeven/rtd,shteeven/deutschapp,kumaria/mean-1,0xNacho/mean,dtytomi/classiecargo,ignasg/revbot,oolawo09/Threshold,vaucouleur/mean,rodp82/mean,geastham/mean-admin-lte,zaramckeown/Mentor.me,arawak-io/arawak.io,hpham33/schoolmanager,jloveland/mean,XuanyuZhao1984/GradeUp,davidrocklee/mean,mbonig/mean,tecnoscience/clubmanager,cwtwc/mean,squeetus/PizzaCats,Mr-Smithy-x/Lehman-Hackthon,PoetsRock/mapping-slc,zhaokejian/SenImgVis-meanjs,shteeven/scradio,scottrehlander/lrig-mean,sibantolon331/1234567890,skyees/start,bur/mean,MPX4132/SocializerJS,ahurtado-dj/evnt_producer_meanjs,helaili/automatic-octo-spork,atumachimela/stocktaker,Boonda-P/newmean,muarif/wb,lirantal/meanjs,codydaig/mean,agileurbanite/dms-mean-modo,steven-st-james/mapping-slc,approgramer/mean,approgramer/mean,s207152/mean,Sunderous/lupine,langman66/hos,MatthieuNICOLAS/PLMAccounts,Hkurtis/capstone,abhijitkamb/introtomean,spacetag/TechEx_Josiah_2,StewartDunlop/LifeMapTools,tmrotz/LinkedIn-People-MEAN.JS,ahurtado-dj/evnt_producer_meanjs,stefan8888/meanjs_experiment,johnk13/meanjs,brewlogic/brewapp,CavHack/MEAN-DALI,amitdhakad/MEAN,Peretus/homepage,woodmark888/meanjs,shubham2192/aws-codeStore,elliottross23/blur-admin-meanjs,thecoons/HearthDeep,oolawo09/Threshold,MatthieuNICOLAS/PLMProfiles,tidemann/loopradio,Mr-Smithy-x/Lehman-Hackthon,0xNacho/mean,tecnoscience/clubmanager,nirajnishan27/webapp01,tmullen71/automata,PayYourNight/Pay_Your_Night_MEAN,devypt/mean,CSALucasNascimento/Personal-APP,FisherYu-CN/riskcontrolplatform,ProjectGroupB/SchoolNotes | ---
+++
@@ -1,23 +1,3 @@
'use strict';
-module.exports = {
- client: {
- lib: {
- css: [
- 'public/lib/bootstrap/dist/css/bootstrap.min.css',
- 'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
- ],
- js: [
- 'public/lib/angular/angular.min.js',
- 'public/lib/angular-resource/angular-resource.min.js',
- 'public/lib/angular-animate/angular-animate.min.js',
- 'public/lib/angular-ui-router/release/angular-ui-router.min.js',
- 'public/lib/angular-ui-utils/ui-utils.min.js',
- 'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
- 'public/lib/angular-file-upload/angular-file-upload.min.js'
- ]
- },
- css: 'public/dist/application.min.css',
- js: 'public/dist/application.min.js'
- }
-};
+module.exports = {}; |
466ab72d4d10df22740968461398b588b13cc909 | tempLog_server.js | tempLog_server.js | var fs = require('fs');
var intervalId = setInterval(function() {
fs.readFile('/sys/class/thermal/thermal_zone0/temp', function(err, data) {
var date = new Date();
var temp = data / 1000;
var newData = date + ',' + temp + '\n';
fs.appendFile('./data-log.csv', newData, function(err) {
console.log('File Appended: ' + date + ' at ' + temp);
if (err) throw err;
count++;
});
});
}, 3600000);
| var fs = require('fs');
var intervalId = setInterval(function() {
fs.readFile('/sys/class/thermal/thermal_zone0/temp', function(err, data) {
var date = new Date();
var temp = data / 1000;
var newData = date + ',' + temp + '\n';
fs.appendFile('./data-log.csv', newData, function(err) {
console.log('File Appended: ' + date + ' at ' + temp);
if (err) throw err;
});
});
}, 3600000);
console.log('Log running...');
| Remove the count and added a feedback when started | Remove the count and added a feedback when started
| JavaScript | mit | DevinCarr/piTemp,DevinCarr/piTemp | ---
+++
@@ -8,7 +8,8 @@
fs.appendFile('./data-log.csv', newData, function(err) {
console.log('File Appended: ' + date + ' at ' + temp);
if (err) throw err;
- count++;
});
});
}, 3600000);
+
+console.log('Log running...'); |
af50546f56a995ae69158bed8679eed9a2b69894 | app/assets/party/profile.js | app/assets/party/profile.js | 'use strict';
app.controller('party/profile', [
'$scope', 'displayService', 'party', 'pageService',
function ($scope, display, party, page) {
$scope.clickUser = function(user){
_.each($scope.volumes, function(v, i){
$scope.volumes[i].selectedClass = (v.users.indexOf(user.id) > -1) ? "volumeSelected" : "" ;
});
};
$scope.clickVolume = function(volume){
_.each($scope.users, function(u, i){
$scope.users[i].selectedClass = (u.volumes.indexOf(volume.id) > -1) ? "userSelected" : "" ;
});
};
$scope.party = party;
$scope.volumes = party.volumes;
$scope.page = page;
$scope.profile = page.$location.path() === '/profile';
display.title = party.name;
}
]);
| 'use strict';
app.controller('party/profile', [
'$scope', 'displayService', 'party', 'pageService',
function ($scope, display, party, page) {
// This function takes in a user, and loops through
// volumes, and attaches a "volumeSelected" class
// to all the pertinent volumes.
$scope.clickUser = function(user) {
_.each($scope.volumes, function(v, i) {
$scope.volumes[i].selectedClass = (v.users.indexOf(user.id) > -1) ? "volumeSelected" : "" ;
});
};
// This function takes in a volume, and loops
// through the users and attaches a class
// called "userSelected"
$scope.clickVolume = function(volume) {
_.each($scope.users, function(u, i) {
$scope.users[i].selectedClass = (u.volumes.indexOf(volume.id) > -1) ? "userSelected" : "" ;
});
};
$scope.party = party;
$scope.volumes = party.volumes;
$scope.page = page;
$scope.profile = page.$location.path() === '/profile';
display.title = party.name;
}
]);
| Add comments and fix formatting. | Add comments and fix formatting.
| JavaScript | agpl-3.0 | databrary/databrary,databrary/databrary,databrary/databrary,databrary/databrary | ---
+++
@@ -3,14 +3,21 @@
app.controller('party/profile', [
'$scope', 'displayService', 'party', 'pageService',
function ($scope, display, party, page) {
- $scope.clickUser = function(user){
- _.each($scope.volumes, function(v, i){
+
+ // This function takes in a user, and loops through
+ // volumes, and attaches a "volumeSelected" class
+ // to all the pertinent volumes.
+ $scope.clickUser = function(user) {
+ _.each($scope.volumes, function(v, i) {
$scope.volumes[i].selectedClass = (v.users.indexOf(user.id) > -1) ? "volumeSelected" : "" ;
});
};
- $scope.clickVolume = function(volume){
- _.each($scope.users, function(u, i){
+ // This function takes in a volume, and loops
+ // through the users and attaches a class
+ // called "userSelected"
+ $scope.clickVolume = function(volume) {
+ _.each($scope.users, function(u, i) {
$scope.users[i].selectedClass = (u.volumes.indexOf(volume.id) > -1) ? "userSelected" : "" ;
});
}; |
f084957ab6edc9c70333bc83637271730cf3c036 | src/finalisers/shared/getExportBlock.js | src/finalisers/shared/getExportBlock.js | function propertyAccess ( name ) {
return name === 'default' ? `['default']` : `.${name}`;
}
export default function getExportBlock ( bundle, exportMode, mechanism = 'return' ) {
if ( exportMode === 'default' ) {
const defaultExportName = bundle.exports.lookup( 'default' ).name;
return `${mechanism} ${defaultExportName};`;
}
return bundle.toExport
.map( name => {
const id = bundle.exports.lookup( name );
const reference = ( id.originalName !== 'default' && id.module && id.module.isExternal ) ?
id.module.name + propertyAccess( id.name ) : id.name;
return `exports${propertyAccess( name )} = ${reference};`;
})
.join( '\n' );
}
| function wrapAccess ( id ) {
return ( id.originalName !== 'default' && id.module && id.module.isExternal ) ?
id.module.name + propertyAccess( id.originalName ) : id.name;
}
function propertyAccess ( name ) {
return name === 'default' ? `['default']` : `.${name}`;
}
export default function getExportBlock ( bundle, exportMode, mechanism = 'return' ) {
if ( exportMode === 'default' ) {
const id = bundle.exports.lookup( 'default' );
return `${mechanism} ${wrapAccess( id )};`;
}
return bundle.toExport
.map( name => {
const id = bundle.exports.lookup( name );
return `exports${propertyAccess( name )} = ${wrapAccess( id )};`;
})
.join( '\n' );
}
| Access reexports of externals safely when needed. | Access reexports of externals safely when needed.
| JavaScript | mit | lukeapage/rollup,Victorystick/rollup,alalonde/rollup,Permutatrix/rollup,corneliusweig/rollup | ---
+++
@@ -1,22 +1,24 @@
+function wrapAccess ( id ) {
+ return ( id.originalName !== 'default' && id.module && id.module.isExternal ) ?
+ id.module.name + propertyAccess( id.originalName ) : id.name;
+}
+
function propertyAccess ( name ) {
return name === 'default' ? `['default']` : `.${name}`;
}
export default function getExportBlock ( bundle, exportMode, mechanism = 'return' ) {
if ( exportMode === 'default' ) {
- const defaultExportName = bundle.exports.lookup( 'default' ).name;
+ const id = bundle.exports.lookup( 'default' );
- return `${mechanism} ${defaultExportName};`;
+ return `${mechanism} ${wrapAccess( id )};`;
}
return bundle.toExport
.map( name => {
const id = bundle.exports.lookup( name );
- const reference = ( id.originalName !== 'default' && id.module && id.module.isExternal ) ?
- id.module.name + propertyAccess( id.name ) : id.name;
-
- return `exports${propertyAccess( name )} = ${reference};`;
+ return `exports${propertyAccess( name )} = ${wrapAccess( id )};`;
})
.join( '\n' );
} |
f29302c93dfb5b6e41193a14e82552a04cc9177e | MUMPSCompiler.js | MUMPSCompiler.js | 'use strict';
const fs = require('fs');
const util = require('util');
const _ = require('lodash');
const LineTokens = require('./LineTokens');
const AbstractSyntaxTree = require('./AbstractSyntaxTree');
class MUMPSCompiler {
readFile(fileName) {
return fs.readFileSync(fileName, 'utf8').split('\n');
}
compile(fileName) {
this.lines = this.readFile(fileName);
this.tokens = this.lines.map((line, index) => (new LineTokens(line, index)));
this.abstractSyntaxTrees = this.tokens.map(tokens => (new AbstractSyntaxTree(tokens)));
console.log(util.inspect(this.abstractSyntaxTrees, { depth: null, colors: true }));
}
}
module.exports = MUMPSCompiler;
// We can also just run this script straight-up.
if (require.main === module) {
const options = {};
const args = process.argv.slice(2);
const fileName = args[0] || '';
const compiler = new MUMPSCompiler();
compiler.compile(fileName);
} | 'use strict';
const fs = require('fs');
const util = require('util');
const _ = require('lodash');
const LineTokens = require('./LineTokens');
const AbstractSyntaxTree = require('./AbstractSyntaxTree');
class MUMPSCompiler {
readFile(fileName) {
return fs.readFileSync(fileName, 'utf8').split('\n');
}
compile(fileName) {
this.lines = this.readFile(fileName);
this.tokens = this.lines.map((line, index) => (new LineTokens(line, index)));
this.abstractSyntaxTree = new AbstractSyntaxTree(this.tokens);
console.log(util.inspect(this.abstractSyntaxTree, { depth: null, colors: true }));
}
}
module.exports = MUMPSCompiler;
// We can also just run this script straight-up.
if (require.main === module) {
const options = {};
const args = process.argv.slice(2);
const fileName = args[0] || '';
const compiler = new MUMPSCompiler();
compiler.compile(fileName);
} | Restructure the creation of the AST | Restructure the creation of the AST
| JavaScript | apache-2.0 | mfuroyama/mumps-compiler | ---
+++
@@ -13,8 +13,8 @@
compile(fileName) {
this.lines = this.readFile(fileName);
this.tokens = this.lines.map((line, index) => (new LineTokens(line, index)));
- this.abstractSyntaxTrees = this.tokens.map(tokens => (new AbstractSyntaxTree(tokens)));
- console.log(util.inspect(this.abstractSyntaxTrees, { depth: null, colors: true }));
+ this.abstractSyntaxTree = new AbstractSyntaxTree(this.tokens);
+ console.log(util.inspect(this.abstractSyntaxTree, { depth: null, colors: true }));
}
}
|
102b402570437fa38dfbd4d5afb94115aaa495dc | public/test/spec/config_spec.js | public/test/spec/config_spec.js | define(['config'],
function(config) {
'use strict';
describe('config module', function() {
it('should allow values to be functions with returns', function() {
config.option('fn_test', function() { return (1 + 2 + 3) / 4; });
expect(config.fn_test).toEqual(1.5);
});
it('should force booleans to always be or return booleans', function() {
config.option('foo_test', false);
config.foo_test = 'Hello'; // something truthy
expect(config.foo_test).toEqual(true);
config.option('bar_test', true);
config.bar_test = function() { return ''; } // return something falsey
expect(config.bar_test).toEqual(false);
});
});
});
| define(['config'],
function(config) {
'use strict';
describe('config module', function() {
it('should allow values to be functions with returns', function() {
config._priv.set_option('fn_test', function() { return (1 + 2 + 3) / 4; });
expect(config.fn_test).toEqual(1.5);
});
it('should force booleans to always be or return booleans', function() {
config._priv.set_option('foo_test', false);
config.foo_test = 'Hello'; // something truthy
expect(config.foo_test).toEqual(true);
config._priv.set_option('bar_test', true);
config.bar_test = function() { return ''; } // return something falsey
expect(config.bar_test).toEqual(false);
});
});
});
| Fix config unit tests with methods moved to _priv (see commit ef68784) | Fix config unit tests with methods moved to _priv (see commit ef68784)
| JavaScript | mit | gavinhungry/debugger.io,gavinhungry/debugger.io | ---
+++
@@ -4,16 +4,16 @@
describe('config module', function() {
it('should allow values to be functions with returns', function() {
- config.option('fn_test', function() { return (1 + 2 + 3) / 4; });
+ config._priv.set_option('fn_test', function() { return (1 + 2 + 3) / 4; });
expect(config.fn_test).toEqual(1.5);
});
it('should force booleans to always be or return booleans', function() {
- config.option('foo_test', false);
+ config._priv.set_option('foo_test', false);
config.foo_test = 'Hello'; // something truthy
expect(config.foo_test).toEqual(true);
- config.option('bar_test', true);
+ config._priv.set_option('bar_test', true);
config.bar_test = function() { return ''; } // return something falsey
expect(config.bar_test).toEqual(false);
}); |
0dd80408bb9b2ab204f984b8f16f964cef6ab629 | src/test/integration-test.js | src/test/integration-test.js | !function (assert, path) {
'use strict';
require('vows').describe('Integration test').addBatch({
'When minifying a CSS file': {
topic: function () {
var callback = this.callback,
topic;
require('publishjs')({
cache: false,
log: false,
processors: {
less: require('../index')
}
}).build(function (pipe) {
pipe.from(path.resolve(path.dirname(module.filename), 'integration-test-files'))
.less()
.run(callback);
}, callback);
},
'should returns a compiled version': function (topic) {
assert.equal(Object.getOwnPropertyNames(topic).length, 1);
assert.equal(topic['default.css'].buffer.toString(), 'html body {\n font-family: Arial;\n}\n');
}
}
}).export(module);
}(
require('assert'),
require('path')
); | !function (assert, path) {
'use strict';
require('vows').describe('Integration test').addBatch({
'When minifying a CSS file': {
topic: function () {
var callback = this.callback,
topic;
require('publishjs')({
cache: false,
log: false,
processors: {
less: require('../index')
}
}).build(function (pipe, callback) {
pipe.from(path.resolve(path.dirname(module.filename), 'integration-test-files'))
.less()
.run(callback);
}, callback);
},
'should returns a compiled version': function (topic) {
assert.equal(Object.getOwnPropertyNames(topic).length, 1);
assert.equal(topic['default.css'].toString(), 'html body {\n font-family: Arial;\n}\n');
}
}
}).export(module);
}(
require('assert'),
require('path')
); | Use build() result for test | Use build() result for test
| JavaScript | mit | candrholdings/publishjs-less,candrholdings/publishjs-less | ---
+++
@@ -13,7 +13,7 @@
processors: {
less: require('../index')
}
- }).build(function (pipe) {
+ }).build(function (pipe, callback) {
pipe.from(path.resolve(path.dirname(module.filename), 'integration-test-files'))
.less()
.run(callback);
@@ -22,7 +22,7 @@
'should returns a compiled version': function (topic) {
assert.equal(Object.getOwnPropertyNames(topic).length, 1);
- assert.equal(topic['default.css'].buffer.toString(), 'html body {\n font-family: Arial;\n}\n');
+ assert.equal(topic['default.css'].toString(), 'html body {\n font-family: Arial;\n}\n');
}
}
}).export(module); |
6a5bac62634300a1f34977694840d1cfa1154fd6 | assets/js/adminselection.js | assets/js/adminselection.js | function editselection(adminname, adminusername, adminpassword, adminid){
document.getElementById("inputadminname").value = adminname;
document.getElementById("inputadminusername").value = adminusername;
document.getElementById("inputadminpassword").value = adminpassword;
document.getElementById("inputadminadminid").value = adminid;
}
function deleteadmin(adminname, adminid){
document.getElementById("deleteadminname").innerHTML = "Delete " + adminname + "'s account?";
document.getElementById("deleteadminadminid").value = adminid;
}
function editUser(username, userusername, userpassword, userid){
document.getElementById("editusername").value = username;
document.getElementById("edituserusername").value = userusername;
document.getElementById("edituserpassword").value = userpassword;
document.getElementById("edituseruserid").value = userid;
}
function changeday(){
var day = document.getElementById("dayselect").value;
document.getElementById("daychange").value = day;
}
function changemonth(){
var month = document.getElementById("monthselect").value;
document.getElementById("monthchange").value = month;
} | function editselection(adminname, adminusername, adminpassword, adminid){
document.getElementById("inputadminname").value = adminname;
document.getElementById("inputadminusername").value = adminusername;
document.getElementById("inputadminpassword").value = adminpassword;
document.getElementById("inputadminadminid").value = adminid;
}
function deleteadmin(adminname, adminid){
document.getElementById("deleteadminname").innerHTML = "Delete " + adminname + "'s account?";
document.getElementById("deleteadminadminid").value = adminid;
}
function editUser(username, userusername, userpassword, userid){
document.getElementById("editusername").value = username;
document.getElementById("edituserusername").value = userusername;
document.getElementById("edituserpassword").value = userpassword;
document.getElementById("edituseruserid").value = userid;
}
function changeday(){
var day = document.getElementById("dayselect").value; //Get the value from the day select
document.getElementById("daychange").value = day; //Change the input value to the selected value
}
function changemonth(){
var month = document.getElementById("monthselect").value; //Get the value from the month select
document.getElementById("monthchange").value = month; //Change the input value to the selected value
}
function changeyear(){
var year = document.getElementById("yearselect").value; //Get the value from the year select
document.getElementById("yearchange").value = year; //Change the input value to the selected value
} | Add changeyear() and commented on selected functions. | Add changeyear() and commented on selected functions.
| JavaScript | mit | altusgerona/cmsc127project,altusgerona/cmsc127project,altusgerona/cmsc127project | ---
+++
@@ -18,11 +18,16 @@
}
function changeday(){
- var day = document.getElementById("dayselect").value;
- document.getElementById("daychange").value = day;
+ var day = document.getElementById("dayselect").value; //Get the value from the day select
+ document.getElementById("daychange").value = day; //Change the input value to the selected value
}
function changemonth(){
- var month = document.getElementById("monthselect").value;
- document.getElementById("monthchange").value = month;
+ var month = document.getElementById("monthselect").value; //Get the value from the month select
+ document.getElementById("monthchange").value = month; //Change the input value to the selected value
}
+
+function changeyear(){
+ var year = document.getElementById("yearselect").value; //Get the value from the year select
+ document.getElementById("yearchange").value = year; //Change the input value to the selected value
+} |
8dc69b9f6571baaff8dad5ff61debd0c10cfb0f3 | app/initializers/honeybadger.js | app/initializers/honeybadger.js | import Ember from 'ember';
import ENV from '../config/environment';
export function initialize() {
$.getScript('//js.honeybadger.io/v0.2/honeybadger.min.js').then(function() {
if (window.Honeybadger) {
var apiKey = Ember.get(ENV, 'honeybadger.apiKey');
var environment = Ember.get(ENV, 'honeybadger.environment');
var debug = Ember.get(ENV, 'honeybadger.debug') || false;
window.Honeybadger.configure({
api_key: apiKey,
environment: environment,
debug: debug,
onerror: true
});
}
});
}
export default {
name: 'honeybadger',
initialize: initialize
}; | import Ember from 'ember';
import ENV from '../config/environment';
export function initialize() {
Ember.$.getScript('//js.honeybadger.io/v0.2/honeybadger.min.js').then(function() {
if (window.Honeybadger) {
var apiKey = Ember.get(ENV, 'honeybadger.apiKey');
var environment = Ember.get(ENV, 'honeybadger.environment');
var debug = Ember.get(ENV, 'honeybadger.debug') || false;
window.Honeybadger.configure({
api_key: apiKey,
environment: environment,
debug: debug,
onerror: true
});
}
});
}
export default {
name: 'honeybadger',
initialize: initialize
};
| Use Ember alias for jQuery | Use Ember alias for jQuery
| JavaScript | mit | webnuts/ember-cli-honeybadger,webnuts/ember-cli-honeybadger | ---
+++
@@ -2,7 +2,7 @@
import ENV from '../config/environment';
export function initialize() {
- $.getScript('//js.honeybadger.io/v0.2/honeybadger.min.js').then(function() {
+ Ember.$.getScript('//js.honeybadger.io/v0.2/honeybadger.min.js').then(function() {
if (window.Honeybadger) {
var apiKey = Ember.get(ENV, 'honeybadger.apiKey');
var environment = Ember.get(ENV, 'honeybadger.environment'); |
a7c61ddb11083242d38c64e6db4f6de2e0dd76d1 | app/lib/stub-router-context.js | app/lib/stub-router-context.js | import _ from 'lodash';
import React from 'react/addons';
var stubRouterContext = (Component, props, stubs) => {
return React.createClass({
childContextTypes: {
getCurrentPath: React.PropTypes.func,
getCurrentRoutes: React.PropTypes.func,
getCurrentPathname: React.PropTypes.func,
getCurrentParams: React.PropTypes.func,
getCurrentQuery: React.PropTypes.func
},
getChildContext: function() {
return _.extend({
getCurrentPath () {},
getCurrentRoutes () {},
getCurrentPathname () {},
getCurrentParams () {},
getCurrentQuery () {}
}, stubs);
},
render: function() {
return <Component {...props} />;
}
});
};
export default stubRouterContext;
| import _ from 'lodash';
import React from 'react/addons';
var stubRouterContext = (Component, props, stubs) => {
return React.createClass({
childContextTypes: {
getCurrentPath: React.PropTypes.func,
getCurrentRoutes: React.PropTypes.func,
getCurrentPathname: React.PropTypes.func,
getCurrentParams: React.PropTypes.func,
getCurrentQuery: React.PropTypes.func
},
getChildContext: function() {
return _.extend({
getCurrentPath () {},
getCurrentRoutes () {},
getCurrentPathname () {},
getCurrentParams () {},
getCurrentQuery () {}
}, stubs);
},
render: function() {
return <Component ref='stub' {...props} />;
}
});
};
export default stubRouterContext;
| Add ref to stub router component for accessibility | Add ref to stub router component for accessibility | JavaScript | isc | jeffreymoya/sprintly-kanban,pipermerriam/sprintly-kanban,pipermerriam/sprintly-kanban,florapdx/sprintly-kanban,datachand/sprintly-kanban,sprintly/sprintly-kanban,datachand/sprintly-kanban,sprintly/sprintly-kanban,whitebird08/sprintly-kanban,whitebird08/sprintly-kanban,jeffreymoya/sprintly-kanban,florapdx/sprintly-kanban | ---
+++
@@ -22,7 +22,8 @@
},
render: function() {
- return <Component {...props} />;
+
+ return <Component ref='stub' {...props} />;
}
});
}; |
fd0b38cd3e80b84fc0d9965d61e849d507203e41 | app/assets/javascripts/views/user/mega_drop.js | app/assets/javascripts/views/user/mega_drop.js | Teikei.module("User", function(User, App, Backbone, Marionette, $, _) {
User.MegaDropView = Marionette.View.extend({
el: "#mega-drop",
ui: {
toggle: ".toggle",
slider: ".slider",
toggleText: ".toggle b"
},
isOpen: false,
events: {
"click .toggle": "toggleDropdown",
"click #start-for-consumers": "onStartForConsumers",
"click #start-for-farmers": "onStartForFarmers"
},
initialize: function(controller) {
this.bindUIElements();
},
toggleDropdown: function(controller) {
this.isOpen = !this.isOpen;
this.ui.slider.animate({ height: "toggle", opacity: "toggle"}, 200 );
this.ui.toggle.toggleClass("open");
if (this.isOpen) {
this.ui.toggleText.text("ausblenden");
}
else {
this.ui.toggleText.text("mehr erfahren");
}
},
onStartForConsumers: function() {
App.vent.trigger("show:consumer:infos");
},
onStartForFarmers: function() {
App.vent.trigger("show:farmer:infos");
}
});
});
| Teikei.module("User", function(User, App, Backbone, Marionette, $, _) {
User.MegaDropView = Marionette.View.extend({
el: "#mega-drop",
ui: {
toggle: ".toggle-button",
slider: ".slider",
toggleText: ".toggle-button b"
},
isOpen: false,
events: {
"click .toggle-button": "toggleDropdown",
"click #start-for-consumers": "onStartForConsumers",
"click #start-for-farmers": "onStartForFarmers"
},
initialize: function(controller) {
this.bindUIElements();
},
toggleDropdown: function(controller) {
this.isOpen = !this.isOpen;
this.ui.slider.animate({ height: "toggle", opacity: "toggle"}, 200 );
this.ui.toggle.toggleClass("open");
if (this.isOpen) {
this.ui.toggleText.text("ausblenden");
}
else {
this.ui.toggleText.text("mehr erfahren");
}
},
onStartForConsumers: function() {
App.vent.trigger("show:consumer:infos");
},
onStartForFarmers: function() {
App.vent.trigger("show:farmer:infos");
}
});
});
| Fix a bug in the mega-drop that prevented it opening. | Fix a bug in the mega-drop that prevented it opening.
| JavaScript | agpl-3.0 | sjockers/teikei,sjockers/teikei,teikei/teikei,sjockers/teikei,teikei/teikei,teikei/teikei | ---
+++
@@ -5,15 +5,15 @@
el: "#mega-drop",
ui: {
- toggle: ".toggle",
+ toggle: ".toggle-button",
slider: ".slider",
- toggleText: ".toggle b"
+ toggleText: ".toggle-button b"
},
isOpen: false,
events: {
- "click .toggle": "toggleDropdown",
+ "click .toggle-button": "toggleDropdown",
"click #start-for-consumers": "onStartForConsumers",
"click #start-for-farmers": "onStartForFarmers"
}, |
e2c43007eec0e388425f4fc07693fae1b33fa775 | webpack.config.js | webpack.config.js | const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
entry: './client/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [new HtmlWebpackPlugin({
title: 'Beer.ly'
})]
} | const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
entry: './client/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [new HtmlWebpackPlugin({
title: 'Beer.ly',
template: './client/index.ejs',
inject: 'body' // inject all script files at the bottom of the body
})]
} | Add HtmlWebpackPlugin options for template and script injection | Add HtmlWebpackPlugin options for template and script injection
| JavaScript | mit | ntoung/beer.ly,ntoung/beer.ly | ---
+++
@@ -8,6 +8,8 @@
filename: 'bundle.js'
},
plugins: [new HtmlWebpackPlugin({
- title: 'Beer.ly'
+ title: 'Beer.ly',
+ template: './client/index.ejs',
+ inject: 'body' // inject all script files at the bottom of the body
})]
} |
576da3b37112a0eba4ff1ab61f0029c66a8a66a4 | app/javascript/app/pages/ndcs/ndcs-reducers.js | app/javascript/app/pages/ndcs/ndcs-reducers.js | export const initialState = {
loading: false,
loaded: false,
error: false,
data: {}
};
const setLoading = (state, loading) => ({ ...state, loading });
const setError = (state, error) => ({ ...state, error });
const setLoaded = (state, loaded) => ({ ...state, loaded });
export default {
fetchNDCSInit: state => setLoading(state, true),
fetchNDCSReady: (state, { payload }) =>
setLoaded(
setLoading(
{
...state,
data: {
categories: payload.categories,
sectors: payload.sectors,
mapIndicators: state.data.mapIndicators || [],
indicators: payload.indicators
}
},
false
),
true
),
fetchNDCSMapIndicatorsReady: (state, { payload }) =>
setLoaded(
setLoading(
{
...state,
data: {
categories: payload.categories,
sectors: payload.sectors,
indicators: state.data.indicators || [],
mapIndicators: payload.indicators
}
},
false
),
true
),
fetchNDCSFail: state => setError(state, true)
};
| export const initialState = {
loading: false,
loaded: false,
error: false,
data: {}
};
const setLoading = (state, loading) => ({ ...state, loading });
const setError = (state, error) => ({ ...state, error });
const setLoaded = (state, loaded) => ({ ...state, loaded });
export default {
fetchNDCSInit: state => setLoading(state, true),
fetchNDCSReady: (state, { payload }) =>
setLoaded(
setLoading(
{
...state,
data: {
categories: payload.categories,
mapCategories: state.data.mapCategories || {},
sectors: payload.sectors,
mapIndicators: state.data.mapIndicators || [],
indicators: payload.indicators
}
},
false
),
true
),
fetchNDCSMapIndicatorsReady: (state, { payload }) =>
setLoaded(
setLoading(
{
...state,
data: {
categories: state.data.categories || {},
mapCategories: payload.categories,
sectors: payload.sectors,
indicators: state.data.indicators || [],
mapIndicators: payload.indicators
}
},
false
),
true
),
fetchNDCSFail: state => setError(state, true)
};
| Create mapCategories on ndcs reducer | Create mapCategories on ndcs reducer
| JavaScript | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -18,6 +18,7 @@
...state,
data: {
categories: payload.categories,
+ mapCategories: state.data.mapCategories || {},
sectors: payload.sectors,
mapIndicators: state.data.mapIndicators || [],
indicators: payload.indicators
@@ -33,7 +34,8 @@
{
...state,
data: {
- categories: payload.categories,
+ categories: state.data.categories || {},
+ mapCategories: payload.categories,
sectors: payload.sectors,
indicators: state.data.indicators || [],
mapIndicators: payload.indicators |
e60823af502d8fb5a51be7d41c177f5b2fab5055 | src/index.js | src/index.js | function wrap(res, fn) {
return function(...args) {
if (res.timedout) {
return res;
} else {
return fn.apply(res, args);
}
};
}
export default (timeoutValue) => {
return (req, res, next) => {
const {send, sendStatus, status} = res;
res.setTimeout(timeoutValue);
res.on('timeout', () => {
res.timedout = true;
if (!res.headersSent) {
res.statusCode = 408;
res.type('txt');
send.apply(res, ['Request Timeout']);
}
});
res.send = wrap(res, send);
res.sendStatus = wrap(res, sendStatus);
res.status = wrap(res, status);
next();
};
} | function wrap(res, fn) {
return function(...args) {
if (res.timedout) {
return res;
} else {
return fn.apply(res, args);
}
};
}
export default (timeoutValue) => {
return (req, res, next) => {
const {send, sendStatus, status} = res;
res.setTimeout(timeoutValue);
res.on('timeout', () => {
res.timedout = true;
if (!res.headersSent) {
res.statusCode = 503;
res.type('txt');
send.apply(res, ['Request Timeout']);
}
});
res.send = wrap(res, send);
res.sendStatus = wrap(res, sendStatus);
res.status = wrap(res, status);
next();
};
}
| Change from 408 to 503 since it is a server error | Change from 408 to 503 since it is a server error
| JavaScript | mit | fjodorekstrom/timeout-middleware | ---
+++
@@ -15,7 +15,7 @@
res.on('timeout', () => {
res.timedout = true;
if (!res.headersSent) {
- res.statusCode = 408;
+ res.statusCode = 503;
res.type('txt');
send.apply(res, ['Request Timeout']);
} |
05b841b505d91a974a06bb20ae78652cbb9b48e6 | src/index.js | src/index.js | import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { Router, Route } from 'react-router'
import config from 'react-global-configuration'
//views
import HomePage from './views/Home'
import ListPageContainer from './views/List'
//store
import { store, history } from './store'
//set up config
config.set(
{
baseUrl: '/api',
entities: {
ids: ['package'],
byId: {
'package': {},
}
}
}
);
class CrudApp extends React.Component {
render() {
return (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={HomePage} />
<Route path="/:entity(/edit/:entityId)" component={ListPageContainer} />
</Router>
</Provider>
)
}
}
export default CrudApp | import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { Router, Route } from 'react-router'
import config from 'react-global-configuration'
//views
import HomePage from './views/Home'
import ListPageContainer from './views/List'
//store
import { store, history } from './store'
//set up config
config.set(
{
baseUrl: '/api',
entities: {
ids: ['plugin'],
byId: {
'plugin': {},
}
}
}
);
class CrudApp extends React.Component {
render() {
return (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={HomePage} />
<Route path="/:entity(/edit/:entityId)" component={ListPageContainer} />
</Router>
</Provider>
)
}
}
export default CrudApp | Update config for plugin (still needs moving outside this lib) | Update config for plugin (still needs moving outside this lib)
| JavaScript | mit | aerian-studios/react-crud | ---
+++
@@ -16,9 +16,9 @@
{
baseUrl: '/api',
entities: {
- ids: ['package'],
+ ids: ['plugin'],
byId: {
- 'package': {},
+ 'plugin': {},
}
}
} |
74ee10552c8791941df3c436dddf25ba2680cc78 | tests/integration/components/permission-language-test.js | tests/integration/components/permission-language-test.js | import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('permission-language', 'Integration | Component | permission language', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{permission-language}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#permission-language}}
template block text
{{/permission-language}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import Ember from 'ember';
moduleForComponent('permission-language', 'Integration | Component | permission language', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
let providerModel = Ember.Object.create({
engrXiv: {name:'engrXiv'},
SocArXiv: {name:'SocArXiv'},
PsyArXiv: {name:'PsyArXiv'}
});
this.set('providerModel', providerModel);
this.render(hbs`{{permission-language model=providerModel.engrXiv}}`);
assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on engrXiv by Cornell University or arXiv.');
this.render(hbs`{{permission-language model=providerModel.SocArXiv}}`);
assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license.');
this.render(hbs`{{permission-language model=providerModel.PsyArXiv}}`);
assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on PsyArXiv by Cornell University or arXiv.');
// Template block usage:
this.render(hbs`
{{#permission-language}}
template block text
{{/permission-language}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});
| Add Component testing for permission-language component. The test passes three provider names to the component and verify that the returned results is correct. | Add Component testing for permission-language component. The test passes three provider names to the component and verify that the returned results is correct.
Ticket ID: EOSF-403
| JavaScript | apache-2.0 | CenterForOpenScience/ember-preprints,laurenrevere/ember-preprints,caneruguz/ember-preprints,CenterForOpenScience/ember-preprints,baylee-d/ember-preprints,baylee-d/ember-preprints,caneruguz/ember-preprints,laurenrevere/ember-preprints | ---
+++
@@ -1,5 +1,6 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
+import Ember from 'ember';
moduleForComponent('permission-language', 'Integration | Component | permission language', {
integration: true
@@ -10,9 +11,28 @@
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
- this.render(hbs`{{permission-language}}`);
+ let providerModel = Ember.Object.create({
+ engrXiv: {name:'engrXiv'},
+ SocArXiv: {name:'SocArXiv'},
+ PsyArXiv: {name:'PsyArXiv'}
+ });
- assert.equal(this.$().text().trim(), '');
+ this.set('providerModel', providerModel);
+
+
+ this.render(hbs`{{permission-language model=providerModel.engrXiv}}`);
+
+ assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on engrXiv by Cornell University or arXiv.');
+
+ this.render(hbs`{{permission-language model=providerModel.SocArXiv}}`);
+
+ assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license.');
+
+ this.render(hbs`{{permission-language model=providerModel.PsyArXiv}}`);
+
+ assert.equal(this.$().text().trim(), 'arXiv is a trademark of Cornell University, used under license. This license should not be understood to indicate endorsement of content on PsyArXiv by Cornell University or arXiv.');
+
+
// Template block usage:
this.render(hbs` |
907f0b008587aadbcaf1da93491662e874a0301d | share/spice/canistreamit/spice.js | share/spice/canistreamit/spice.js | function ddg_spice_canistreamit(movies) {
// console.log(xk);
var result,img,snippet,link,div;
var items = new Array();
for(var i = 0; i<movies.length; i++)
{
result = movies[i];
// Make title for header
var header = result.title + " ("+result.year+")";
// Call nra function as per Spice Plugin Guidelines
var item = new Array();
var content = "<div><i>Starring:</i> "+result.actors+".</div>";
content += "<div><i>Streaming:</i> ";
var count = 0;
for(var subtype in result.affiliates)
{
var service = result.affiliates[subtype];
content += "<a href='"+service.url+"'>"+service.friendlyName;
var price = parseFloat(service.price);
if(price > 0)
content += " ($"+service.price+")";
content += "</a>, "
count++;
}
if(count > 0)
content = content.substring(0,content.length-2);
content += ".</div>"
item['a'] = content;
item['h'] = header;
// Source name and url for the More at X link.
item['s'] = 'CanIStream.It';
item['u'] = result.links.shortUrl;
// Force no compression.
item['f'] = 1;
// Thumbnail url
item['i'] = result.image;
items.push(item);
}
// The rendering function is nra.
nra(items);
}
| function ddg_spice_canistreamit(movies) {
// console.log(xk);
var result,img,snippet,link,div;
var items = new Array();
for(var i = 0; i<movies.length; i++)
{
result = movies[i];
// Make title for header
var header = 'Watch ' + result.title + " ("+result.year+")";
// Call nra function as per Spice Plugin Guidelines
var item = new Array();
var content = "<div><i>Starring:</i> "+result.actors+".</div>";
content += "<div><i>Streaming:</i> ";
var count = 0;
for(var subtype in result.affiliates)
{
var service = result.affiliates[subtype];
content += "<a href='"+service.url+"'>"+service.friendlyName;
var price = parseFloat(service.price);
if(price > 0)
content += " ($"+service.price+")";
content += "</a>, "
count++;
}
if(count > 0)
content = content.substring(0,content.length-2);
content += ".</div>"
item['a'] = content;
item['h'] = header;
// Source name and url for the More at X link.
item['s'] = 'CanIStream.It';
item['u'] = result.links.shortUrl;
// Force no compression.
item['f'] = 1;
// Thumbnail url
item['i'] = result.image;
items.push(item);
}
// The rendering function is nra.
nra(items);
}
| Add watch to Canistreamit header. | Add watch to Canistreamit header.
| JavaScript | apache-2.0 | andrey-p/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,soleo/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,deserted/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,mayo/zeroclickinfo-spice,ppant/zeroclickinfo-spice,mayo/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,ppant/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,mayo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,P71/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,deserted/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,soleo/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,ppant/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,lernae/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,stennie/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,lerna/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,imwally/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,levaly/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,lernae/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,stennie/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,sevki/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,loganom/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,deserted/zeroclickinfo-spice,P71/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,echosa/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,sevki/zeroclickinfo-spice,levaly/zeroclickinfo-spice,ppant/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,P71/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,soleo/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,lerna/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,stennie/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,levaly/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,sevki/zeroclickinfo-spice,deserted/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,stennie/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,soleo/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,levaly/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,loganom/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,lerna/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,loganom/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,levaly/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,imwally/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,deserted/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,imwally/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,echosa/zeroclickinfo-spice,sevki/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,loganom/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,lernae/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,lernae/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,deserted/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,lernae/zeroclickinfo-spice,mayo/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,soleo/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,imwally/zeroclickinfo-spice,P71/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,lerna/zeroclickinfo-spice,echosa/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,imwally/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,levaly/zeroclickinfo-spice,echosa/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,lerna/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,soleo/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,echosa/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice | ---
+++
@@ -8,7 +8,7 @@
result = movies[i];
// Make title for header
- var header = result.title + " ("+result.year+")";
+ var header = 'Watch ' + result.title + " ("+result.year+")";
// Call nra function as per Spice Plugin Guidelines
|
c63cc693b7854745c2abdd8eea55dd695c669821 | Core/BaseLoader.js | Core/BaseLoader.js | const fetch = require('node-fetch');
class BaseLoader {
constructor(APIToken, baseURL) {
this.APIToken = APIToken;
this.fetch = fetch
this.baseURL = baseURL
}
get fetchConfiguration() {
const headers = {
Authorization: `Bearer ${this.APIToken}`,
};
const configuration = {
method: 'GET',
headers,
};
return configuration;
}
static parseJSON(res, APIName) {
return res.json()
.catch(error => {
let errorMessage;
switch (error.type) {
case 'system': {
errorMessage = `${APIName}: Failed to load data`;
}
case 'invalid-json': {
errorMessage = `${APIName}: Failed to parse JSON`;
}
default: {
errorMessage = `${APIName}: Unknown Error`;
}
console.warn(errorMessage, res);
throw new Error(errorMessage);
}
})
}
}
module.exports = BaseLoader
| const fetch = require("node-fetch");
class BaseLoader {
constructor(APIToken, baseURL) {
this.APIToken = APIToken;
this.fetch = fetch;
this.baseURL = baseURL;
}
get fetchConfiguration() {
const headers = {
Authorization: `Bearer ${this.APIToken}`
};
const configuration = {
method: "GET",
headers
};
return configuration;
}
static parseJSON(res, APIName) {
const resStatusCode = res.status;
console.log(`STATUS CODE WAS: ${resStatusCode}`);
if (between(resStatusCode, 200, 399)) {
return res.json().catch(error => {
let errorMessage;
switch (error.type) {
case "system": {
errorMessage = `${APIName}: Failed to load data`;
break;
}
case "invalid-json": {
errorMessage = `${APIName}: Failed to parse JSON`;
break;
}
default: {
errorMessage = `${APIName}: Unknown Error`;
break;
}
}
console.error(errorMessage);
throw new Error(errorMessage);
});
} else if (between(resStatusCode, 400, 499)) {
const errorMessage = `${res.status}: ${res.statusText} while requesting ${res.url}`;
console.error(errorMessage);
throw new Error(errorMessage);
} else {
const errorMessage = `${res.status}: ${res.statusText} while requesting ${res.url}`;
console.error(errorMessage);
throw new Error(errorMessage);
}
}
}
function between(x, min, max) {
return x >= min && x <= max;
}
module.exports = BaseLoader;
| Add status code check for error handling | Add status code check for error handling
| JavaScript | mit | dbsystel/1BahnQL | ---
+++
@@ -1,45 +1,61 @@
-const fetch = require('node-fetch');
+const fetch = require("node-fetch");
class BaseLoader {
-
constructor(APIToken, baseURL) {
this.APIToken = APIToken;
- this.fetch = fetch
- this.baseURL = baseURL
+ this.fetch = fetch;
+ this.baseURL = baseURL;
}
get fetchConfiguration() {
const headers = {
- Authorization: `Bearer ${this.APIToken}`,
+ Authorization: `Bearer ${this.APIToken}`
};
const configuration = {
- method: 'GET',
- headers,
+ method: "GET",
+ headers
};
return configuration;
}
static parseJSON(res, APIName) {
- return res.json()
- .catch(error => {
- let errorMessage;
- switch (error.type) {
-
- case 'system': {
- errorMessage = `${APIName}: Failed to load data`;
+ const resStatusCode = res.status;
+ console.log(`STATUS CODE WAS: ${resStatusCode}`);
+ if (between(resStatusCode, 200, 399)) {
+ return res.json().catch(error => {
+ let errorMessage;
+ switch (error.type) {
+ case "system": {
+ errorMessage = `${APIName}: Failed to load data`;
+ break;
+ }
+ case "invalid-json": {
+ errorMessage = `${APIName}: Failed to parse JSON`;
+ break;
+ }
+ default: {
+ errorMessage = `${APIName}: Unknown Error`;
+ break;
+ }
}
- case 'invalid-json': {
- errorMessage = `${APIName}: Failed to parse JSON`;
- }
- default: {
- errorMessage = `${APIName}: Unknown Error`;
- }
- console.warn(errorMessage, res);
+ console.error(errorMessage);
throw new Error(errorMessage);
- }
- })
+ });
+ } else if (between(resStatusCode, 400, 499)) {
+ const errorMessage = `${res.status}: ${res.statusText} while requesting ${res.url}`;
+ console.error(errorMessage);
+ throw new Error(errorMessage);
+ } else {
+ const errorMessage = `${res.status}: ${res.statusText} while requesting ${res.url}`;
+ console.error(errorMessage);
+ throw new Error(errorMessage);
+ }
}
}
-module.exports = BaseLoader
+function between(x, min, max) {
+ return x >= min && x <= max;
+}
+
+module.exports = BaseLoader; |
e12a57b8d5c005bbb4e7a4f4f98638aa70df3562 | web/static/js/components/game/header.js | web/static/js/components/game/header.js | import React, {PropTypes} from 'react';
export default class Header extends React.Component {
_renderContent() {
const { game } = this.props;
return (
<h1>Place your ships</h1>
);
}
render() {
return (
<header id="game_header">{::this._renderContent()}</header>
);
}
}
| import React, {PropTypes} from 'react';
export default class Header extends React.Component {
_renderContent() {
const { game } = this.props;
const title = this._titleText(game);
return (
<h1>{::this._titleText(game)}</h1>
);
}
_titleText(game) {
const { my_board, opponents_board } = game;
if (!my_board.ready) {
return 'Place your ships';
} else if (!opponents_board || !opponents_board.ready) {
return 'Waiting for opponent ';
} else {
return 'Let the battle begin';
}
}
render() {
return (
<header id="game_header">{::this._renderContent()}</header>
);
}
}
| Set title depending on boards statuses | Set title depending on boards statuses
| JavaScript | mit | bigardone/phoenix-battleship,bigardone/phoenix-battleship | ---
+++
@@ -4,9 +4,22 @@
_renderContent() {
const { game } = this.props;
+ const title = this._titleText(game);
return (
- <h1>Place your ships</h1>
+ <h1>{::this._titleText(game)}</h1>
);
+ }
+
+ _titleText(game) {
+ const { my_board, opponents_board } = game;
+
+ if (!my_board.ready) {
+ return 'Place your ships';
+ } else if (!opponents_board || !opponents_board.ready) {
+ return 'Waiting for opponent ';
+ } else {
+ return 'Let the battle begin';
+ }
}
render() { |
f65d07bd4493f4af71e30722f496bbef8f37832c | src/js/utils/code-list-utils.js | src/js/utils/code-list-utils.js | export function nbCodesFromId(codeListById, id) {
return id ? nbCodes(codeListById[id]) : 0
}
function nbCodes({ isSpec, isLoaded, codes }) {
return isSpec && !isLoaded ? 10 : codes.length
} | /**
* Returns the number of code in a code list from its `id`
*
* For a code list specification, it returns `1`.
* If the `id` is not provided, it returns `1`.
*
* Explanations :
*
* For a code list specification which has not been loaded yet, we do not know
* the number of codes in the code list. We need this number in order to
* serialize the questionnaire (how many `Response` do we need to create ?) and
* for parsing the questionnaire (if we have a TABLE response format with two
* information axes and multiple measures, how do we know which response goes
* with which measure ? => We need this informtion to extract the dataytype from
* thoses responses). If a code list specification has been loaded (ie
* `isLoaded` set to `true`), we could know the number of codes, but since we
* cannot ensure that the specification will be loaded when the questionnaire
* will be parsed, we cannot rely on this number and use 1 as a convention,
* whether it has been loaded or not.
*
* If the `id` is not provided, the user might not have selected the code list
* yet, so we do not know the number of codes. But since this number will be
* used to generate responses and responses hold the information about the
* datatype, we choose to return `1` by default to have at least one response
* to infer datatype when retrieving a questionnaire.
*
* @param {Object} codeListById collection of code lists (comes from the
* reducer)
* @param {String} id code list id
* @return {Number} number of codes in the code list
*/
export function nbCodesFromId(codeListById, id) {
return id ? nbCodes(codeListById[id]) : 1
}
/**
* Returns the number of code in a code list
*
* For a code list specification which has not been loaded yet, it returns `1`.
*
* @param {Boolean} isSpec does this code list comes from a specification
* @param {Boolean} isLoaded if it's a code list specification, has it been
* loaded ?
* @param {Array} codes codes of the code list
* @return {Number} number of codes in the code list
*/
function nbCodes({ isSpec, isLoaded, codes }) {
return isSpec ? 1 : codes.length
} | Use 1 as a default value for the number of codes in a code list | Use 1 as a default value for the number of codes in a code list
This number is used to build the right number of responses when serializing the questionnaire. If we work with a code list specification, It's not trivial to get this information: we need to load the code list specificaiton before serializing the questionnaire (asyncrhonous call), and for now, loading a code list specification is not operational.
When `id` is not set, we need a default value which enables extraction of datatype information from a `Response`. | JavaScript | mit | Zenika/Pogues,Zenika/Pogues,InseeFr/Pogues,InseeFr/Pogues,InseeFr/Pogues,Zenika/Pogues | ---
+++
@@ -1,7 +1,48 @@
+/**
+ * Returns the number of code in a code list from its `id`
+ *
+ * For a code list specification, it returns `1`.
+ * If the `id` is not provided, it returns `1`.
+ *
+ * Explanations :
+ *
+ * For a code list specification which has not been loaded yet, we do not know
+ * the number of codes in the code list. We need this number in order to
+ * serialize the questionnaire (how many `Response` do we need to create ?) and
+ * for parsing the questionnaire (if we have a TABLE response format with two
+ * information axes and multiple measures, how do we know which response goes
+ * with which measure ? => We need this informtion to extract the dataytype from
+ * thoses responses). If a code list specification has been loaded (ie
+ * `isLoaded` set to `true`), we could know the number of codes, but since we
+ * cannot ensure that the specification will be loaded when the questionnaire
+ * will be parsed, we cannot rely on this number and use 1 as a convention,
+ * whether it has been loaded or not.
+ *
+ * If the `id` is not provided, the user might not have selected the code list
+ * yet, so we do not know the number of codes. But since this number will be
+ * used to generate responses and responses hold the information about the
+ * datatype, we choose to return `1` by default to have at least one response
+ * to infer datatype when retrieving a questionnaire.
+ *
+ * @param {Object} codeListById collection of code lists (comes from the
+ * reducer)
+ * @param {String} id code list id
+ * @return {Number} number of codes in the code list
+ */
export function nbCodesFromId(codeListById, id) {
- return id ? nbCodes(codeListById[id]) : 0
+ return id ? nbCodes(codeListById[id]) : 1
}
-
+/**
+ * Returns the number of code in a code list
+ *
+ * For a code list specification which has not been loaded yet, it returns `1`.
+ *
+ * @param {Boolean} isSpec does this code list comes from a specification
+ * @param {Boolean} isLoaded if it's a code list specification, has it been
+ * loaded ?
+ * @param {Array} codes codes of the code list
+ * @return {Number} number of codes in the code list
+ */
function nbCodes({ isSpec, isLoaded, codes }) {
- return isSpec && !isLoaded ? 10 : codes.length
+ return isSpec ? 1 : codes.length
} |
1df6a847d47cee94cbc2c761a794521a66f2392c | src/block/selection.js | src/block/selection.js | define([], function() {
var saveSelection, restoreSelection;
if (window.getSelection && document.createRange) {
saveSelection = function(el) {
var sel = window.getSelection && window.getSelection();
if (sel && sel.rangeCount > 0) {
return sel.getRangeAt(0);
}
};
restoreSelection = function(el, sel) {
var range = document.createRange();
range.setStart(sel.startContainer, sel.startOffset);
range.setEnd(sel.endContainer, sel.endOffset)
sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
} else if (document.selection && document.body.createTextRange) {
saveSelection = function(el) {
return document.selection.createRange();
};
restoreSelection = function(el, sel) {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.setStart(sel.startContanier, sel.startOffset);
textRange.setEnd(sel.endContainer, sel.endOffset);
textRange.select();
};
}
});
| define([], function() {
var saveSelection, restoreSelection;
if (window.getSelection && document.createRange) {
saveSelection = function(el) {
var sel = window.getSelection && window.getSelection();
if (sel && sel.rangeCount > 0) {
return sel.getRangeAt(0);
}
};
restoreSelection = function(el, sel) {
var range = document.createRange();
range.setStart(sel.startContainer, sel.startOffset);
range.setEnd(sel.endContainer, sel.endOffset)
sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
} else if (document.selection && document.body.createTextRange) {
saveSelection = function(el) {
return document.selection.createRange();
};
restoreSelection = function(el, sel) {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.setStart(sel.startContainer, sel.startOffset);
textRange.setEnd(sel.endContainer, sel.endOffset);
textRange.select();
};
}
});
| Fix typo startContanier should be startContainer. | Fix typo startContanier should be startContainer.
| JavaScript | mit | mervick/emojionearea | ---
+++
@@ -25,7 +25,7 @@
restoreSelection = function(el, sel) {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
- textRange.setStart(sel.startContanier, sel.startOffset);
+ textRange.setStart(sel.startContainer, sel.startOffset);
textRange.setEnd(sel.endContainer, sel.endOffset);
textRange.select();
}; |
97290f01c55a2426856d4c9fe095760bf2483e44 | src/components/Menu.js | src/components/Menu.js | import React from 'react';
import {
Link
} from 'react-router';
import './Menu.css';
import User from './User';
import language from '../language/language';
const menuLanguage = language.components.menu;
let Menu = React.createClass ({
getInitialState() {
return { showUser: false };
},
onClick(e) {
e.preventDefault(e);
if (!this.state.showUser) {
this.setState({showUser : true});
} else {
this.setState({showUser : false});
}
},
render() {
const {
user
} = this.props;
let userElement;
userElement = (
<User
user={user} />
);
return (
<div>
<ul>
<li>
<Link
to="recent-tracks"
className="Menu__item">
{menuLanguage.recentTracks}
</Link>
</li>
<li>
<Link
to="top-artists"
className="Menu__item">
{menuLanguage.topArtists}
</Link>
</li>
<li>
<Link
className="Menu__item"
onClick={this.onClick}>
{menuLanguage.userInfo}
</Link>
</li>
</ul>
{this.state.showUser ? userElement : null}
</div>
);
}
});
export default Menu;
| import React from 'react';
import {
Link
} from 'react-router';
import './Menu.css';
import User from './User';
import language from '../language/language';
const menuLanguage = language.components.menu;
let Menu = React.createClass ({
getInitialState() {
return { showUser: false };
},
toggleUser(e) {
e.preventDefault(e);
if (!this.state.showUser) {
this.setState({showUser : true});
} else {
this.setState({showUser : false});
}
},
render() {
const {
user
} = this.props;
let userElement;
userElement = (
<User
user={user} />
);
return (
<div>
<ul>
<li>
<Link
to="recent-tracks"
className="Menu__item">
{menuLanguage.recentTracks}
</Link>
</li>
<li>
<Link
to="top-artists"
className="Menu__item">
{menuLanguage.topArtists}
</Link>
</li>
<li>
<Link
className="Menu__item"
onClick={this.toggleUser}>
{menuLanguage.userInfo}
</Link>
</li>
</ul>
{this.state.showUser ? userElement : null}
</div>
);
}
});
export default Menu;
| Rename click handler function so it’s more explicit what it does | Rename click handler function so it’s more explicit what it does
| JavaScript | bsd-3-clause | jeromelachaud/Last.fm-Activities-React,jeromelachaud/Last.fm-Activities-React | ---
+++
@@ -14,7 +14,7 @@
return { showUser: false };
},
- onClick(e) {
+ toggleUser(e) {
e.preventDefault(e);
if (!this.state.showUser) {
this.setState({showUser : true});
@@ -55,7 +55,7 @@
<li>
<Link
className="Menu__item"
- onClick={this.onClick}>
+ onClick={this.toggleUser}>
{menuLanguage.userInfo}
</Link>
</li> |
bf7b3c5fb899a1f7b7fef673f691bf20cae94571 | src/main/resources/static/mp.js | src/main/resources/static/mp.js | angular.module('webapp').factory('mp', function($q, $rootScope, $timeout, host) {
var socket = new WebSocket("ws://" + host + ":8080/stomp");
var stompClient = Stomp.over(socket);
//stompClient.debug = angular.noop();
var connectedDeferred = $q.defer();
var connected = connectedDeferred.promise;
stompClient.connect({}, function() {
connectedDeferred.resolve();
});
return {
connected: connected,
subscribe: function(queue, callback) {
connected.then(function() {
stompClient.subscribe(queue, function(frame) {
$timeout(function() {
if (typeof frame.body === 'string' && frame.body && (frame.body.charAt(0) === '{' || frame.body.charAt(0) === '['))
frame.body = JSON.parse(frame.body);
callback(frame);
})
});
})
},
send: function(destination, message) {
if (typeof message === 'object')
message = JSON.stringify(message);
connected.then(function() {
stompClient.send(destination, {}, message);
})
}
}
}); | angular.module('webapp').factory('mp', function($q, $rootScope, $timeout, host) {
var socket = new WebSocket("ws://" + host + ":8080/stomp");
var stompClient = Stomp.over(socket);
stompClient.debug = angular.noop();
var connectedDeferred = $q.defer();
var connected = connectedDeferred.promise;
stompClient.connect({}, function() {
connectedDeferred.resolve();
});
return {
connected: connected,
subscribe: function(queue, callback) {
connected.then(function() {
stompClient.subscribe(queue, function(frame) {
$timeout(function() {
if (typeof frame.body === 'string' && frame.body && (frame.body.charAt(0) === '{' || frame.body.charAt(0) === '['))
frame.body = JSON.parse(frame.body);
callback(frame);
})
});
})
},
send: function(destination, message) {
if (typeof message === 'object')
message = JSON.stringify(message);
connected.then(function() {
stompClient.send(destination, {}, message);
})
}
}
}); | Revert accidental commit of debug logging | Revert accidental commit of debug logging
| JavaScript | apache-2.0 | gillius/lunchbus,gillius/lunchbus | ---
+++
@@ -2,7 +2,7 @@
var socket = new WebSocket("ws://" + host + ":8080/stomp");
var stompClient = Stomp.over(socket);
- //stompClient.debug = angular.noop();
+ stompClient.debug = angular.noop();
var connectedDeferred = $q.defer();
var connected = connectedDeferred.promise; |
bd26a8c14f8f1f44a6ad745cf93af2a9898299e7 | src/main/webapp/scripts/main.js | src/main/webapp/scripts/main.js | $().ready(() => {
loadContentSection().then(() =>{
$("#loader").addClass("hide");
$("#real-body").removeClass("hide");
$("#real-body").addClass("body");
$(".keyword").click(function() {
$(this).addClass("active");
$(".base").hide(200);
$("#real-body").addClass("focus");
});
$(".close").click(function(event) {
event.stopPropagation();
$(this).parent().removeClass("active");
$(".base").show(200);
$("#real-body").removeClass("focus");
});
$(".active .item").click(function() {
$(".item").off("click");
const url = $(this).attr("data-url");
window.location.replace(url);
});
});
});
| $().ready(() => {
loadContentSection().then(() =>{
$("#loader").addClass("hide");
$("#real-body").removeClass("hide");
$("#real-body").addClass("body");
$(".keyword").click(function() {
$(this).addClass("active");
$(".base").hide(200);
$("#real-body").addClass("focus");
$(".active .item").click(function() {
$(".item").off("click");
const url = $(this).attr("data-url");
window.location.href = url;
});
});
$(".close").click(function(event) {
event.stopPropagation();
$(this).parent().removeClass("active");
$(".base").show(200);
$("#real-body").removeClass("focus");
});
});
});
| Fix redirecting and back button bug | Fix redirecting and back button bug
| JavaScript | apache-2.0 | googleinterns/step36-2020,googleinterns/step36-2020,googleinterns/step36-2020 | ---
+++
@@ -8,6 +8,11 @@
$(this).addClass("active");
$(".base").hide(200);
$("#real-body").addClass("focus");
+ $(".active .item").click(function() {
+ $(".item").off("click");
+ const url = $(this).attr("data-url");
+ window.location.href = url;
+ });
});
$(".close").click(function(event) {
@@ -16,11 +21,5 @@
$(".base").show(200);
$("#real-body").removeClass("focus");
});
-
- $(".active .item").click(function() {
- $(".item").off("click");
- const url = $(this).attr("data-url");
- window.location.replace(url);
- });
});
}); |
fe88f534341eabeff89313ae046a2be48043833f | client/src/components/NavBar.js | client/src/components/NavBar.js | import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { logoutUser } from '../../redux/actions';
const NavBar = ({ isAuthenticated, logoutUser }) => (
<ul className="navbar">
<li className="navbar__link"><Link to="/">Home</Link></li>
{ isAuthenticated &&
[
<li className="navbar__link"><Link to="/history">History</Link></li>,
<li className="navbar__link"><Link to="/history/april">April</Link></li>,
<li className="navbar__link"><Link to="/stopwatch">Stopwatch</Link></li>
]
}
{ !isAuthenticated &&
[
<li className="navbar__link"><Link to="/signup">Signup</Link></li>,
<li className="navbar__link">
<Link to="/login">Login</Link>
</li>
]
}
{ isAuthenticated &&
<li className="navbar__link">
<button onClick={ logoutUser }>Logout</button>
</li>
}
</ul>
);
export default connect(
({ root }) => ({ isAuthenticated: root.isAuthenticated }),
{ logoutUser }
)(NavBar);
| import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { logoutUser } from '../../redux/actions';
const NavBar = ({ isAuthenticated, logoutUser }) => (
<ul className="navbar">
<li key={0} className="navbar__link"><Link to="/">Home</Link></li>
{ isAuthenticated &&
[
<li key={1} className="navbar__link"><Link to="/history">History</Link></li>,
<li key={2} className="navbar__link"><Link to="/history/april">April</Link></li>,
<li key={3} className="navbar__link"><Link to="/stopwatch">Stopwatch</Link></li>
]
}
{ !isAuthenticated &&
[
<li key={4} className="navbar__link"><Link to="/signup">Signup</Link></li>,
<li key={5} className="navbar__link">
<Link to="/login">Login</Link>
</li>
]
}
{ isAuthenticated &&
<li key={6} className="navbar__link">
<button onClick={ logoutUser }>Logout</button>
</li>
}
</ul>
);
export default connect(
({ root }) => ({ isAuthenticated: root.isAuthenticated }),
{ logoutUser }
)(NavBar);
| Fix React missing key iterator warning | Fix React missing key iterator warning
| JavaScript | mit | mbchoa/presence,mbchoa/presence | ---
+++
@@ -6,24 +6,24 @@
const NavBar = ({ isAuthenticated, logoutUser }) => (
<ul className="navbar">
- <li className="navbar__link"><Link to="/">Home</Link></li>
+ <li key={0} className="navbar__link"><Link to="/">Home</Link></li>
{ isAuthenticated &&
[
- <li className="navbar__link"><Link to="/history">History</Link></li>,
- <li className="navbar__link"><Link to="/history/april">April</Link></li>,
- <li className="navbar__link"><Link to="/stopwatch">Stopwatch</Link></li>
+ <li key={1} className="navbar__link"><Link to="/history">History</Link></li>,
+ <li key={2} className="navbar__link"><Link to="/history/april">April</Link></li>,
+ <li key={3} className="navbar__link"><Link to="/stopwatch">Stopwatch</Link></li>
]
}
{ !isAuthenticated &&
[
- <li className="navbar__link"><Link to="/signup">Signup</Link></li>,
- <li className="navbar__link">
+ <li key={4} className="navbar__link"><Link to="/signup">Signup</Link></li>,
+ <li key={5} className="navbar__link">
<Link to="/login">Login</Link>
</li>
]
}
{ isAuthenticated &&
- <li className="navbar__link">
+ <li key={6} className="navbar__link">
<button onClick={ logoutUser }>Logout</button>
</li>
} |
942b75631721f83ac139bf08eb4712718630d552 | main.js | main.js | var STATUSES = {
UP: 0,
DOWN: 1
}
var mouseStatus = {
left: STATUSES.UP,
right: STATUSES.UP
}
var BUTTONS = {
LEFT: 1,
RIGHT: 3
};
document.onmousedown = function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.DOWN;
if (mouseStatus.right === STATUSES.DOWN) {
chrome.extension.sendMessage({
event: 'previous',
mouseStatus: mouseStatus
});
}
} else if (event.which === BUTTONS.RIGHT) {
mouseStatus.right = STATUSES.DOWN;
if (mouseStatus.left === STATUSES.DOWN) {
chrome.extension.sendMessage({
event: 'next',
mouseStatus: mouseStatus
});
}
}
};
document.onmouseup = function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.UP;
} else if (event.which === BUTTONS.RIGHT) {
mouseStatus.right = STATUSES.UP;
}
chrome.extension.sendMessage({mouseStatus: mouseStatus});
};
document.oncontextmenu = function(event) {
if (mouseStatus.left === STATUSES.DOWN) {
return false;
}
};
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
mouseStatus = request;
}); | var STATUSES = {
UP: 0,
DOWN: 1
}
var mouseStatus = {
left: STATUSES.UP,
right: STATUSES.UP
}
var BUTTONS = {
LEFT: 1,
RIGHT: 3
};
document.addEventListener('mousedown', function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.DOWN;
if (mouseStatus.right === STATUSES.DOWN) {
chrome.extension.sendMessage({
event: 'previous',
mouseStatus: mouseStatus
});
}
} else if (event.which === BUTTONS.RIGHT) {
mouseStatus.right = STATUSES.DOWN;
if (mouseStatus.left === STATUSES.DOWN) {
chrome.extension.sendMessage({
event: 'next',
mouseStatus: mouseStatus
});
}
}
});
document.addEventListener('mouseup', function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.UP;
} else if (event.which === BUTTONS.RIGHT) {
mouseStatus.right = STATUSES.UP;
}
chrome.extension.sendMessage({mouseStatus: mouseStatus});
});
document.addEventListener('contextmenu', function(event) {
if (mouseStatus.left === STATUSES.DOWN) {
return event.preventDefault();
}
});
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
mouseStatus = request;
}); | Use addEventListener instead of setting old onmouse* properties | Use addEventListener instead of setting old onmouse* properties
| JavaScript | isc | wendorf/mousetures,wendorf/mousetures | ---
+++
@@ -12,7 +12,7 @@
RIGHT: 3
};
-document.onmousedown = function(event) {
+document.addEventListener('mousedown', function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.DOWN;
if (mouseStatus.right === STATUSES.DOWN) {
@@ -31,22 +31,22 @@
});
}
}
-};
+});
-document.onmouseup = function(event) {
+document.addEventListener('mouseup', function(event) {
if (event.which === BUTTONS.LEFT) {
mouseStatus.left = STATUSES.UP;
} else if (event.which === BUTTONS.RIGHT) {
mouseStatus.right = STATUSES.UP;
}
chrome.extension.sendMessage({mouseStatus: mouseStatus});
-};
+});
-document.oncontextmenu = function(event) {
+document.addEventListener('contextmenu', function(event) {
if (mouseStatus.left === STATUSES.DOWN) {
- return false;
+ return event.preventDefault();
}
-};
+});
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
mouseStatus = request; |
1b63df7382dea64feaa9d22ba415b141837277fc | main.js | main.js | define(['mathlive/mathlive'],
function(mLive) {
MathLive = mLive;
MathLive.renderMathInDocument();
TheActiveMathField = MathLive.makeMathField(
document.getElementById('mathEditorActive'),
{//commandbarToggle: 'hidden',
overrideDefaultInlineShortcuts: false,
onSelectionDidChange: UpdatePalette
}
);
}
)
| define(['mathlive/mathlive'],
function(mLive) {
MathLive = mLive;
MathLive.renderMathInDocument();
TheActiveMathField = MathLive.makeMathField(
document.getElementById('mathEditorActive'),
{commandbarToggle: 'hidden',
overrideDefaultInlineShortcuts: false,
onSelectionDidChange: UpdatePalette,
}
);
document.onkeydown = HandleKeyDown;
}
)
| Add handler for cntl+backspace/delete to be a crossout | Add handler for cntl+backspace/delete to be a crossout
| JavaScript | mit | NSoiffer/ProceduralMathEditor,NSoiffer/ProceduralMathEditor | ---
+++
@@ -4,10 +4,11 @@
MathLive.renderMathInDocument();
TheActiveMathField = MathLive.makeMathField(
document.getElementById('mathEditorActive'),
- {//commandbarToggle: 'hidden',
+ {commandbarToggle: 'hidden',
overrideDefaultInlineShortcuts: false,
- onSelectionDidChange: UpdatePalette
+ onSelectionDidChange: UpdatePalette,
}
);
+ document.onkeydown = HandleKeyDown;
}
) |
e92ff29bd378db3d07fa389d9b950834234dbc61 | main.js | main.js | const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
let win
function createWindow () {
win = new BrowserWindow({width: 650, height: 450})
win.loadURL(url.format({
pathname: path.join(__dirname, 'public/index.html'),
protocol: 'file:',
slashes: true
}))
if (process.env.REACT_DEBUG) {
BrowserWindow.addDevToolsExtension(process.env.REACT_DEBUG)
win.webContents.openDevTools()
}
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
| const {app, shell, BrowserWindow, Menu} = require('electron')
const path = require('path')
const url = require('url')
let win
process.env.PATH = `${process.env.PATH}:/usr/local/bin`
const menu = Menu.buildFromTemplate([
{
label: app.getName(),
submenu: [{
label: 'About',
click() {
shell.openExternal('https://github.com/jysperm/elecpass')
}
},{
label: 'Open DevTools',
click() {
win.webContents.openDevTools()
}
},{
role: 'quit'
}]
}
])
function createWindow () {
Menu.setApplicationMenu(menu)
win = new BrowserWindow({width: 650, height: 450})
win.loadURL(url.format({
pathname: path.join(__dirname, 'public/index.html'),
protocol: 'file:',
slashes: true
}))
if (process.env.REACT_DEBUG) {
BrowserWindow.addDevToolsExtension(process.env.REACT_DEBUG)
win.webContents.openDevTools()
}
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
| Add menu to open dev tools | :wheelchair: Add menu to open dev tools
| JavaScript | apache-2.0 | jysperm/elecpass,jysperm/elecpass | ---
+++
@@ -1,10 +1,33 @@
-const {app, BrowserWindow} = require('electron')
+const {app, shell, BrowserWindow, Menu} = require('electron')
const path = require('path')
const url = require('url')
let win
+process.env.PATH = `${process.env.PATH}:/usr/local/bin`
+
+const menu = Menu.buildFromTemplate([
+ {
+ label: app.getName(),
+ submenu: [{
+ label: 'About',
+ click() {
+ shell.openExternal('https://github.com/jysperm/elecpass')
+ }
+ },{
+ label: 'Open DevTools',
+ click() {
+ win.webContents.openDevTools()
+ }
+ },{
+ role: 'quit'
+ }]
+ }
+])
+
function createWindow () {
+ Menu.setApplicationMenu(menu)
+
win = new BrowserWindow({width: 650, height: 450})
win.loadURL(url.format({ |
426fc75610582bbcfad0a8d1cac575e400419326 | lib/store.js | lib/store.js | var uuid = require('node-uuid');
var JSData = require('js-data');
var store;
var adapter;
var Report;
function error(msg) {
return new Promise(function(resolve, reject) {
return resolve({ error: msg });
});
}
function get(id) {
if (!id) return error('No id specified.');
if (!adapter) {
return new Promise(function(resolve) {
var report = Report.get(id);
return resolve(report);
});
}
return Report.find(id);
}
function add(data) {
if (!data.type || !data.payload) {
return error('Required parameters aren\'t specified.');
}
var obj = {
id: uuid.v4(),
type: data.type,
payload: data.payload
};
if (!adapter) {
return new Promise(function(resolve) {
var report = Report.inject(obj);
return resolve(report);
});
}
return Report.create(obj);
}
function createStore(options) {
store = new JSData.DS();
Report = store.defineResource('report');
return {
get: get,
add: add
};
}
module.exports = createStore;
| var uuid = require('node-uuid');
var JSData = require('js-data');
var store;
var adapter;
var Report;
function error(msg) {
return new Promise(function(resolve, reject) {
return resolve({ error: msg });
});
}
function get(id) {
if (!id) return error('No id specified.');
if (!adapter) {
return new Promise(function(resolve) {
var report = Report.get(id);
return resolve(report);
});
}
return Report.find(id);
}
function add(data) {
if (!data.type || !data.payload) {
return error('Required parameters aren\'t specified.');
}
var obj = {
id: uuid.v4(),
type: data.type,
title: data.title,
description: data.description,
failed: data.failed,
payload: data.payload,
screen: data.screen,
user: data.user,
isLog: !!data.isLog,
added: Date.now()
};
if (!adapter) {
return new Promise(function(resolve) {
var report = Report.inject(obj);
return resolve(report);
});
}
return Report.create(obj);
}
function createStore(options) {
store = new JSData.DS();
Report = store.defineResource('report');
return {
get: get,
add: add
};
}
module.exports = createStore;
| Add more data to the report | Add more data to the report
| JavaScript | mit | zalmoxisus/remotedev-server,zalmoxisus/remotedev-server | ---
+++
@@ -31,7 +31,14 @@
var obj = {
id: uuid.v4(),
type: data.type,
- payload: data.payload
+ title: data.title,
+ description: data.description,
+ failed: data.failed,
+ payload: data.payload,
+ screen: data.screen,
+ user: data.user,
+ isLog: !!data.isLog,
+ added: Date.now()
};
if (!adapter) { |
be3833211473eaa2f24e4f8ef20af9969d2bd0d0 | webpack.config.js | webpack.config.js | const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: {
IntelliSearch: "./src/SearchClient.ts",
"IntelliSearch.min": "./src/SearchClient.ts"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
libraryTarget: "umd",
library: "IntelliSearch",
umdNamedDefine: true
},
resolve: {
mainFields: ["browser", "module", "main"],
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
plugins: [
new UglifyJsPlugin({
sourceMap: true,
include: /\.min\.js$/
})
],
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
watch: false,
watchOptions: {
aggregateTimeout: 300, // The default
ignored: ["dist", "es", "lib", "doc", "samples", "node_modules"]
}
};
| const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: {
IntelliSearch: "./src/SearchClient.ts",
"IntelliSearch.min": "./src/SearchClient.ts"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
libraryTarget: "umd",
library: "IntelliSearch",
umdNamedDefine: true
},
resolve: {
mainFields: ["browser", "module", "main"],
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
plugins: [
new UglifyJsPlugin({
sourceMap: false,
extractComments: true,
include: /\.min\.js$/
})
],
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
watch: false,
watchOptions: {
aggregateTimeout: 300, // The default
ignored: ["dist", "es", "lib", "doc", "samples", "node_modules"]
}
};
| Remove comments and source-map from the minified version. | Remove comments and source-map from the minified version.
| JavaScript | mit | IntelliSearch/search-client,IntelliSearch/search-client | ---
+++
@@ -22,7 +22,8 @@
},
plugins: [
new UglifyJsPlugin({
- sourceMap: true,
+ sourceMap: false,
+ extractComments: true,
include: /\.min\.js$/
})
], |
68e3266af5daacee80d207b14ea123898c201b0b | webpack.config.js | webpack.config.js | var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
index: './src/main/index.js'
},
output: {
path: './target/out',
filename: '[name].js',
libraryTarget: 'commonjs'
},
externals: [
{
'react': true,
'react-dom': true
}
],
plugins: [
new ExtractTextPlugin('[name].css')
],
module: {
loaders: [
{test: /\.js$/, loader: 'babel'},
{test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css!less?strictUnits=true&strictMath=true')}
]
}
};
| var path = require('path'),
ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
index: [
'./src/main/index.js',
'./src/main/index.less'
]
},
output: {
path: './target/out',
filename: '[name].js',
libraryTarget: 'commonjs'
},
externals: [
{
'react': true,
'react-dom': true
}
],
resolve: {
root: [
path.resolve(__dirname, '..'),
path.resolve(__dirname, 'node_modules')
]
},
plugins: [
new ExtractTextPlugin('[name].css')
],
module: {
loaders: [
{test: /\.js$/, loader: 'babel'},
{test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css!less?strictUnits=true&strictMath=true')}
]
}
};
| Build styles apart from JS code | Build styles apart from JS code
| JavaScript | mit | smikhalevski/react-text-input,smikhalevski/react-text-input | ---
+++
@@ -1,8 +1,12 @@
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
+var path = require('path'),
+ ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
- index: './src/main/index.js'
+ index: [
+ './src/main/index.js',
+ './src/main/index.less'
+ ]
},
output: {
path: './target/out',
@@ -15,6 +19,12 @@
'react-dom': true
}
],
+ resolve: {
+ root: [
+ path.resolve(__dirname, '..'),
+ path.resolve(__dirname, 'node_modules')
+ ]
+ },
plugins: [
new ExtractTextPlugin('[name].css')
], |
5113f6ac77db5315c9b311505f86a3dc1e627204 | fetch.js | fetch.js | const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
const version = process.versions.v8;
const tmpfile = path.join(__dirname, version+'.flags.json');
if (!fs.existsSync(tmpfile)) {
exec('node --v8-options', function (execErr, result) {
var flags;
if (execErr) {
throw new Error(execErr);
} else {
flags = result.match(/\s\s--(\w+)/gm).map(function (match) {
return match.substring(2);
});
fs.writeFile(tmpfile, JSON.stringify(flags), { encoding:'utf8' },
function (writeErr) {
if (writeErr) {
throw new Error(writeErr);
} else {
console.log('flags for v8 '+version+' cached.');
}
}
);
}
});
}
module.exports = require.bind(null, tmpfile);
| const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
const nodepath = process.env._;
const version = process.versions.v8;
const tmpfile = path.join(__dirname, version+'.flags.json');
if (!fs.existsSync(tmpfile)) {
exec(nodepath+' --v8-options', function (execErr, result) {
var flags;
if (execErr) {
throw new Error(execErr);
} else {
flags = result.match(/\s\s--(\w+)/gm).map(function (match) {
return match.substring(2);
});
fs.writeFile(tmpfile, JSON.stringify(flags), { encoding:'utf8' },
function (writeErr) {
if (writeErr) {
throw new Error(writeErr);
} else {
console.log('flags for v8 '+version+' cached.');
}
}
);
}
});
}
module.exports = require.bind(null, tmpfile);
| Use node path from process.env._ | Fix: Use node path from process.env._
| JavaScript | mit | tkellen/js-v8flags,js-cli/js-v8flags | ---
+++
@@ -2,11 +2,12 @@
const path = require('path');
const exec = require('child_process').exec;
+const nodepath = process.env._;
const version = process.versions.v8;
const tmpfile = path.join(__dirname, version+'.flags.json');
if (!fs.existsSync(tmpfile)) {
- exec('node --v8-options', function (execErr, result) {
+ exec(nodepath+' --v8-options', function (execErr, result) {
var flags;
if (execErr) {
throw new Error(execErr); |
72a8fa47e9f43325b1eb78afda1abea84f79d3fb | jslib/controlNode.js | jslib/controlNode.js | // Modules
var http = require('http'),
urllib = require('url'),
RPCHandler = require('jsonrpc').RPCHandler,
scheduler = require('./schedulerRpcWrapper');
// Configuration
var cfg = require('config')('ControlNode', {
port: 46212,
address: "",
jsonRpcPath: "/jsonrpc",
debugRpc: false
});
// Local variables
var version = "0.1.4"
versionString = "ControlNode " + version + " on node.js";
var schedulerWrapper = new scheduler.Wrapper(cfg.mongodbAddress);
var handleHttpRequest = function(req, res) {
if(req.method == "POST"){
// Define whether this is JSON request.
if (urllib.parse(req.url).pathname == cfg.jsonRpcPath) {
new RPCHandler(req, res, schedulerWrapper, cfg.debugRpc);
} else {
res.writeHead(404, {'Content-Type': 'text/plain'});
res.end('Unknown path!\n');
}
} else {
res.writeHead(200, {'Content-Type': 'text/plain'});
//res.end('Hello World\n');
res.end(JSON.stringify(schedulerWrapper.getStatus(), null, 4))
}
};
// Run server.
http.createServer(handleHttpRequest).listen(cfg.port, cfg.address);
console.log(['Server running at http://', cfg.address, ':', cfg.port, ' on ',
process.version].join(''));
| // Modules
var http = require('http'),
urllib = require('url'),
RPCHandler = require('jsonrpc').RPCHandler,
scheduler = require('./schedulerRpcWrapper');
// Configuration
var cfg = require('config')('ControlNode', {
port: 46212,
address: "",
jsonRpcPath: "/jsonrpc",
debugRpc: false
});
// Local variables
var version = "0.1.5",
versionString = ["ControlNode;v", version, ";node.js ", process.version].join("");
var schedulerWrapper = new scheduler.Wrapper(cfg.mongodbAddress);
var handleHttpRequest = function(req, res) {
if(req.method == "POST"){
// Define whether this is JSON request.
if (urllib.parse(req.url).pathname == cfg.jsonRpcPath) {
new RPCHandler(req, res, schedulerWrapper, cfg.debugRpc);
} else {
res.writeHead(404, {'Content-Type': 'text/plain'});
res.end('Unknown path!\n');
}
} else {
res.writeHead(200, {'Content-Type': 'text/plain'});
//res.end('Hello World\n');
res.end(JSON.stringify(schedulerWrapper.getStatus(), null, 4))
}
};
// Run server.
http.createServer(handleHttpRequest).listen(cfg.port, cfg.address);
console.log([versionString, ";at http://", cfg.address, ':', cfg.port].join(''));
| Change version string in control node. | Change version string in control node.
| JavaScript | apache-2.0 | anthony-kolesov/kts46,anthony-kolesov/kts46,anthony-kolesov/kts46,anthony-kolesov/kts46 | ---
+++
@@ -13,8 +13,8 @@
});
// Local variables
-var version = "0.1.4"
- versionString = "ControlNode " + version + " on node.js";
+var version = "0.1.5",
+ versionString = ["ControlNode;v", version, ";node.js ", process.version].join("");
var schedulerWrapper = new scheduler.Wrapper(cfg.mongodbAddress);
@@ -37,5 +37,4 @@
// Run server.
http.createServer(handleHttpRequest).listen(cfg.port, cfg.address);
-console.log(['Server running at http://', cfg.address, ':', cfg.port, ' on ',
- process.version].join(''));
+console.log([versionString, ";at http://", cfg.address, ':', cfg.port].join('')); |
1a55d508fdb0c9f3fc5bf9a74aea73ab922f287b | packages/core/lib/debug/compiler.js | packages/core/lib/debug/compiler.js | const { Compile } = require("@truffle/compile-solidity");
class DebugCompiler {
constructor(config) {
this.config = config;
}
async compile(sources = undefined) {
const compileConfig = this.config.with({ quiet: true });
const { compilations } = sources
? await Compile.sources({ sources, options: compileConfig }) //used by external.js
: await Compile.all(compileConfig);
return compilations;
}
}
module.exports = {
DebugCompiler
};
| const { Compile } = require("@truffle/compile-solidity");
const WorkflowCompile = require("@truffle/workflow-compile");
class DebugCompiler {
constructor(config) {
this.config = config;
}
async compile(sources = undefined) {
const compileConfig = this.config.with({ quiet: true });
const { compilations } = sources
? await Compile.sources({ sources, options: compileConfig }) //used by external.js
: await WorkflowCompile.compile(compileConfig.with({ all: true }));
//note: we don't allow for the possibility here of compiling with specified sources
//that are *not* solidity. only external.js specifies sources, and making that work
//with Vyper is a hard problem atm (how do we get the right version??)
return compilations;
}
}
module.exports = {
DebugCompiler
};
| Allow CLI debugger to compile non-Solidity sources | Allow CLI debugger to compile non-Solidity sources
| JavaScript | mit | ConsenSys/truffle | ---
+++
@@ -1,4 +1,5 @@
const { Compile } = require("@truffle/compile-solidity");
+const WorkflowCompile = require("@truffle/workflow-compile");
class DebugCompiler {
constructor(config) {
@@ -10,7 +11,10 @@
const { compilations } = sources
? await Compile.sources({ sources, options: compileConfig }) //used by external.js
- : await Compile.all(compileConfig);
+ : await WorkflowCompile.compile(compileConfig.with({ all: true }));
+ //note: we don't allow for the possibility here of compiling with specified sources
+ //that are *not* solidity. only external.js specifies sources, and making that work
+ //with Vyper is a hard problem atm (how do we get the right version??)
return compilations;
} |
ca7e4f4c5d6ba470b557e87c47b7f298ce40437e | audio_channel.js | audio_channel.js | var AudioChannel = function(args) {
this.context = AudioContext ? new AudioContext() : new webkitAudioContext();
this.oscill = this.context.createOscillator();
this.gain = this.context.createGain();
if(args) {
this.frequency = args.freq ? args.freq : 220;
this.wave = args.wave ? args.wave : "triangle";
this.volume = args.gain ? args.gain : 0.05;
}
}
AudioChannel.prototype.setNodes = function() {
this.oscill = this.context.createOscillator();
this.gain = this.context.createGain();
this.oscill.connect(this.gain);
this.gain.connect(this.context.destination);
this.oscill.frequency.value = this.frequency;
this.oscill.type = this.wave;
this.gain.gain.value = this.volume;
};
AudioChannel.prototype.playSong = function(song) {
this.oscill.start();
var playNextNote = function(song) {
this.oscill.frequency.value = song[0].freq;
if(song[1]) {
setTimeout(playNextNote.bind(this, song.slice(1)), song[0].length);
}
else {
setTimeout(function() {
this.gain.gain.value = 0;
}.bind(this), song[0].length);
}
}.bind(this);
playNextNote(song);
};
| var AudioChannel = function(args) {
this.context = AudioContext ? new AudioContext() : new webkitAudioContext();
this.oscill = this.context.createOscillator();
this.gain = this.context.createGain();
var args = args ? args : {};
this.frequency = args.freq ? args.freq : 220;
this.wave = args.wave ? args.wave : "triangle";
this.volume = args.gain ? args.gain : 0.05;
}
AudioChannel.prototype.setNodes = function() {
this.oscill = this.context.createOscillator();
this.gain = this.context.createGain();
this.oscill.connect(this.gain);
this.gain.connect(this.context.destination);
this.oscill.frequency.value = this.frequency;
this.oscill.type = this.wave;
this.gain.gain.value = this.volume;
};
AudioChannel.prototype.playSong = function(song) {
this.setNodes();
this.oscill.start();
var playNextNote = function(song) {
this.oscill.frequency.value = noteToFreq(song[0].note, song[0].octave);
if(song[1]) {
setTimeout(playNextNote.bind(this, song.slice(1)), song[0].length);
}
else {
setTimeout(function() {
this.gain.gain.value = 0;
}.bind(this), song[0].length);
}
}.bind(this);
playNextNote(song);
};
| Update AudioChannel.playSong to use noteToFreq | Update AudioChannel.playSong to use noteToFreq
| JavaScript | mit | peternatewood/pac-man-replica,peternatewood/pac-man-replica | ---
+++
@@ -3,11 +3,11 @@
this.oscill = this.context.createOscillator();
this.gain = this.context.createGain();
- if(args) {
- this.frequency = args.freq ? args.freq : 220;
- this.wave = args.wave ? args.wave : "triangle";
- this.volume = args.gain ? args.gain : 0.05;
- }
+ var args = args ? args : {};
+
+ this.frequency = args.freq ? args.freq : 220;
+ this.wave = args.wave ? args.wave : "triangle";
+ this.volume = args.gain ? args.gain : 0.05;
}
AudioChannel.prototype.setNodes = function() {
this.oscill = this.context.createOscillator();
@@ -21,9 +21,10 @@
this.gain.gain.value = this.volume;
};
AudioChannel.prototype.playSong = function(song) {
+ this.setNodes();
this.oscill.start();
var playNextNote = function(song) {
- this.oscill.frequency.value = song[0].freq;
+ this.oscill.frequency.value = noteToFreq(song[0].note, song[0].octave);
if(song[1]) {
setTimeout(playNextNote.bind(this, song.slice(1)), song[0].length);
} |
b44662de07df147bc64fb439db554f5d045cbb5e | api/models/Image.js | api/models/Image.js | /**
* Image.js
*
* @description :: This represents a product image with file paths for different variations (original, thumb, ...).
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
width: {
type: 'integer',
min: 0
},
height: {
type: 'integer',
min: 0
},
thumb: {
type: 'string'
},
medium: {
type: 'string'
},
large: {
type: 'string'
},
original: {
type: 'string',
required: true
},
toJSON: function() {
var obj = this.toObject()
, baseUrl = sails.config.app.baseUrl;
if (obj.thumb) {
obj.thumb = baseUrl + obj.thumb;
}
if (obj.medium) {
obj.medium = baseUrl + obj.medium;
}
if (obj.large) {
obj.large = baseUrl + obj.large;
}
obj.original = baseUrl + obj.original;
return obj;
}
},
beforeUpdate: function (values, next) {
// Prevent user from overriding these attributes
delete values.thumb;
delete values.medium;
delete values.large;
delete values.original;
delete values.createdAt;
delete values.updatedAt;
next();
}
};
| /**
* Image.js
*
* @description :: This represents a product image with file paths for different variations (original, thumb, ...).
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
width: {
type: 'integer',
min: 0
},
height: {
type: 'integer',
min: 0
},
thumb: {
type: 'string'
},
medium: {
type: 'string'
},
large: {
type: 'string'
},
original: {
type: 'string',
required: true
},
toJSON: function() {
var obj = this.toObject()
, baseUrl = sails.config.app.baseUrl;
if (obj.thumb) {
obj.thumb = baseUrl + obj.thumb;
}
if (obj.medium) {
obj.medium = baseUrl + obj.medium;
}
if (obj.large) {
obj.large = baseUrl + obj.large;
}
obj.original = baseUrl + obj.original;
return obj;
}
},
beforeUpdate: function (values, next) {
if (obj.thumb && obj.thumb.indexOf('http') === 0) {
delete obj.thumb;
}
if (obj.medium && obj.medium.indexOf('http') === 0) {
delete obj.medium;
}
if (obj.large && obj.large.indexOf('http') === 0) {
delete obj.large;
}
// Prevent user from overriding these attributes
delete values.original;
delete values.createdAt;
delete values.updatedAt;
next();
}
};
| Fix bug where images could not be created | Fix bug where images could not be created
| JavaScript | mit | joschaefer/online-shop-api | ---
+++
@@ -63,10 +63,19 @@
beforeUpdate: function (values, next) {
+ if (obj.thumb && obj.thumb.indexOf('http') === 0) {
+ delete obj.thumb;
+ }
+
+ if (obj.medium && obj.medium.indexOf('http') === 0) {
+ delete obj.medium;
+ }
+
+ if (obj.large && obj.large.indexOf('http') === 0) {
+ delete obj.large;
+ }
+
// Prevent user from overriding these attributes
- delete values.thumb;
- delete values.medium;
- delete values.large;
delete values.original;
delete values.createdAt;
delete values.updatedAt; |
1eede171c8f8d0d8e141832414d258708fac9579 | lib/index.js | lib/index.js | "use strict";
function createDefaultFormatter() {
return function defaultFormatter(ctx, errors) {
ctx.body = {};
if (errors && errors.length) {
ctx.status = 500;
if (errors.length === 1) {
ctx.status = errors[0].status;
}
ctx.body['ok'] = 0;
ctx.body['status'] = ctx.status;
ctx.body['errors'] = errors.map((error) => {
return error.message;
});
} else {
ctx.body['ok'] = 1;
}
ctx.body['status'] = ctx.status;
if (ctx.result != null) {
ctx.body['result'] = ctx.result;
}
}
}
module.exports = function (options) {
options = options || {};
const fn = options.formatter || createDefaultFormatter();
return function formatter(ctx, next) {
const self = this;
return next().then(function () {
fn(ctx);
}).catch(function (err) {
var errors;
if (Array.isArray(err)) {
errors = err;
} else {
errors = [ err ];
}
fn(ctx, errors);
for (var i = 0; i < errors.length; i++) {
ctx.app.emit('error', errors[i], self);
}
});
}
};
module.exports.defaultFormatter = createDefaultFormatter; | "use strict";
function createDefaultFormatter() {
return function defaultFormatter(ctx, errors) {
ctx.body = {};
if (errors && errors.length) {
ctx.status = 500;
if (errors.length === 1) {
ctx.status = errors[0].status || ctx.status;
}
ctx.body['ok'] = 0;
ctx.body['status'] = ctx.status;
ctx.body['errors'] = errors.map((error) => {
return error.message;
});
} else {
ctx.body['ok'] = 1;
}
ctx.body['status'] = ctx.status;
if (ctx.result != null) {
ctx.body['result'] = ctx.result;
}
}
}
module.exports = function (options) {
options = options || {};
const fn = options.formatter || createDefaultFormatter();
return function formatter(ctx, next) {
const self = this;
return next().then(function () {
fn(ctx);
}).catch(function (err) {
var errors;
if (Array.isArray(err)) {
errors = err;
} else {
errors = [ err ];
}
fn(ctx, errors);
for (var i = 0; i < errors.length; i++) {
ctx.app.emit('error', errors[i], self);
}
});
}
};
module.exports.defaultFormatter = createDefaultFormatter; | Add status fallback when an error does not expose one | Add status fallback when an error does not expose one
| JavaScript | mit | njakob/koa-formatter | ---
+++
@@ -6,7 +6,7 @@
if (errors && errors.length) {
ctx.status = 500;
if (errors.length === 1) {
- ctx.status = errors[0].status;
+ ctx.status = errors[0].status || ctx.status;
}
ctx.body['ok'] = 0;
ctx.body['status'] = ctx.status; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.