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 |
|---|---|---|---|---|---|---|---|---|---|---|
e5d4685e2aec3c40253a62f75b1266024ad3af2f | src/server/config/index.js | src/server/config/index.js | import Joi from 'joi';
import jsonServerConfig from 'config/server.json';
import schema from './schema.js';
class ServerConfig {
constructor() {
this._jsonConfig = jsonServerConfig;
/**
* Validate the JSON config
*/
try {
Joi.validate(this._jsonConfig, schema);
} catch (e) {
console.error('The config in \'config/server.json\' is not a valid config configuration. Error: ', e);
}
}
get (value) {
return this._jsonConfig[value];
}
}
export default new ServerConfig();
| import Joi from 'joi';
import jsonServerConfig from 'config/server.json';
import schema from './schema.js';
class ServerConfig {
constructor() {
/**
* Validate the JSON config
*/
try {
this._jsonConfig = Joi.validate(jsonServerConfig, schema).value;
} catch (e) {
console.error('The config in \'config/server.json\' is not a valid config configuration. Error: ', e);
}
}
get (value) {
return this._jsonConfig[value];
}
}
export default new ServerConfig();
| Update logger and add config | Update logger and add config
| JavaScript | mit | LuudJanssen/plus-min-list,LuudJanssen/plus-min-list,LuudJanssen/plus-min-list | ---
+++
@@ -4,13 +4,11 @@
class ServerConfig {
constructor() {
- this._jsonConfig = jsonServerConfig;
-
/**
* Validate the JSON config
*/
try {
- Joi.validate(this._jsonConfig, schema);
+ this._jsonConfig = Joi.validate(jsonServerConfig, schema).value;
} catch (e) {
console.error('The config in \'config/server.json\' is not a valid config configuration. Error: ', e);
} |
4d6139bcd9af2b8acd02343330bbbe74bbe7a7a1 | lib/config.js | lib/config.js | var fs = require('fs');
module.exports = function(opts) {
this.options = opts;
if (!opts.handlebars) this.options.handlebars = require('handlebars');
if (opts.template) {
var fileData = fs.readFileSync(this.options.template);
this.template = this.options.handlebars.compile(fileData.toString(), {noEscape: true});
}
return this;
}
| var fs = require('fs');
module.exports = function(opts) {
var fileData;
this.options = opts;
if (!opts.handlebars) this.options.handlebars = require('handlebars');
if (opts.template) {
try {
fileData = fs.readFileSync(this.options.template);
}
catch (e) {
throw new Error('Error loading Supercollider template file: ' + e.message);
}
this.template = this.options.handlebars.compile(fileData.toString(), {noEscape: true});
}
else {
throw new Error('No path to a template was set in Supercollider.config().');
}
return this;
}
| Throw errors if a template is not set, or if a template can't be loaded | Throw errors if a template is not set, or if a template can't be loaded
| JavaScript | mit | spacedoc/spacedoc,gakimball/supercollider,spacedoc/spacedoc | ---
+++
@@ -1,13 +1,23 @@
var fs = require('fs');
module.exports = function(opts) {
+ var fileData;
this.options = opts;
if (!opts.handlebars) this.options.handlebars = require('handlebars');
if (opts.template) {
- var fileData = fs.readFileSync(this.options.template);
+ try {
+ fileData = fs.readFileSync(this.options.template);
+ }
+ catch (e) {
+ throw new Error('Error loading Supercollider template file: ' + e.message);
+ }
+
this.template = this.options.handlebars.compile(fileData.toString(), {noEscape: true});
+ }
+ else {
+ throw new Error('No path to a template was set in Supercollider.config().');
}
return this; |
a34125408ec298bbe4083ee06db8727a59028688 | tests/dummy/app/routes/application.js | tests/dummy/app/routes/application.js | import Ember from 'ember';
export default Ember.Route.extend({
setupController: function() {
this.controllerFor( 'pagination' ).get( 'translateService' ).setDictionary( Ember.Object.create({
'PAGINATION_DISPLAYING' : 'Displaying',
'DEVICE_LIST_PAGINATION_LABEL' : 'Viewing {0} to {1} of {2} Devices',
'DEVICE_LIST_PAGINATION_PER_PAGE' : ' per page',
'HOSTNAME': 'Hostname',
'IPADDRESS': 'Ip Address',
'DEVICETYPE': 'DeviceType',
'PROVISIONDATE': 'Provision Date',
'ACTIONS': 'Actions',
'COLUMNS': 'Columns',
'RESETCOLUMNS':'Reset Columns',
'TESTACTION': 'Test Action',
'UNKNOWNDEVICE': '--Unknown Device--',
'NOTES': 'Notes'
}));
}
});
| import Ember from 'ember';
export default Ember.Route.extend({
setupController: function() {
this.controllerFor( 'pagination' ).get( 'translateService' ).setDictionary( Ember.Object.create({
'PAGINATION_DISPLAYING' : 'Displaying',
'DEVICE_LIST_PAGINATION_LABEL' : 'Viewing {0} to {1} of {2} Devices',
'DEVICE_LIST_PAGINATION_PER_PAGE' : ' per page',
'HOSTNAME': 'Hostname',
'IPADDRESS': 'IP Address',
'DEVICETYPE': 'Device Type',
'PROVISIONDATE': 'Provision Date',
'ACTIONS': 'Actions',
'COLUMNS': 'Columns',
'RESETCOLUMNS':'Reset Columns',
'TESTACTION': 'Test Action',
'UNKNOWNDEVICE': '--Unknown Device--',
'NOTES': 'Notes'
}));
}
});
| Tweak grid demo column header text | Tweak grid demo column header text
| JavaScript | mit | Suven/sl-ember-components,erangeles/sl-ember-components,theoshu/sl-ember-components,theoshu/sl-ember-components,notmessenger/sl-ember-components,softlayer/sl-ember-components,azizpunjani/sl-ember-components,Suven/sl-ember-components,alxyuu/sl-ember-components,azizpunjani/sl-ember-components,juwara0/sl-ember-components,jonathandavidson/sl-ember-components,SpikedKira/sl-ember-components,erangeles/sl-ember-components,juwara0/sl-ember-components,softlayer/sl-ember-components,alxyuu/sl-ember-components,SpikedKira/sl-ember-components,notmessenger/sl-ember-components | ---
+++
@@ -7,8 +7,8 @@
'DEVICE_LIST_PAGINATION_LABEL' : 'Viewing {0} to {1} of {2} Devices',
'DEVICE_LIST_PAGINATION_PER_PAGE' : ' per page',
'HOSTNAME': 'Hostname',
- 'IPADDRESS': 'Ip Address',
- 'DEVICETYPE': 'DeviceType',
+ 'IPADDRESS': 'IP Address',
+ 'DEVICETYPE': 'Device Type',
'PROVISIONDATE': 'Provision Date',
'ACTIONS': 'Actions',
'COLUMNS': 'Columns', |
9f2af655b2502eaed5f899651ab652f8561c92c2 | src/editor.js | src/editor.js | var h = require('html')
var Panel = require('panel')
function Editor() {
this.layersPanel = new Panel(this, 215, h('.layers-panel'))
this.inspectorPanel = new Panel(this, 215, h('.inspector-panel'))
this.el = h('.editor', [
this.layersPanel.el,
h('.canvas'),
this.inspectorPanel.el
])
}
Editor.prototype.start = function() {
document.body.appendChild(this.el)
return this
}
Editor.prototype.getData = function() {
throw new Error("Unimplemented")
}
Editor.prototype.loadData = function() {
throw new Error("Unimplemented")
}
exports = Editor
| var h = require('html')
var Panel = require('panel')
function Editor() {
this.layersPanel = new Panel(this, 215, h('.layers-panel'))
this.inspectorPanel = new Panel(this, 215, h('.inspector-panel'))
this.el = h('.editor', [
this.layersPanel.el,
h('.canvas'),
this.inspectorPanel.el
])
}
Editor.prototype.start = function() {
document.body.appendChild(this.el)
return this
}
Editor.prototype.getData = function(type) {
throw new Error("Unimplemented")
}
Editor.prototype.loadData = function(type, data) {
throw new Error("Unimplemented")
}
exports = Editor
| Add parameters to stub loading/saving methods | Add parameters to stub loading/saving methods
| JavaScript | unlicense | freedraw/core,freedraw/core | ---
+++
@@ -17,11 +17,11 @@
return this
}
-Editor.prototype.getData = function() {
+Editor.prototype.getData = function(type) {
throw new Error("Unimplemented")
}
-Editor.prototype.loadData = function() {
+Editor.prototype.loadData = function(type, data) {
throw new Error("Unimplemented")
}
|
ead1e86c6edeef2a064d417535b445c11eb18d47 | src/renderField.js | src/renderField.js | import React from 'react'
export const isRequired = (schema, fieldName) => {
if (!schema.required) {
return false
}
return (schema.required.indexOf(fieldName) != 1)
}
const renderField = (fieldSchema, fieldName, theme, prefix = '') => {
const widget = fieldSchema.format || fieldSchema.type || 'object'
if (!theme[widget]) {
throw new Error('liform: ' + widget + ' is not defined in the theme')
}
return React.createElement(theme[widget], {
key: fieldName,
fieldName: prefix ? prefix + fieldName : fieldName,
label: fieldSchema.showLabel === false ? '' : fieldSchema.title || fieldName,
required: isRequired(fieldSchema, fieldName),
schema: fieldSchema,
theme: theme,
})
}
export default renderField
| import React from 'react'
export const isRequired = (schema, fieldName) => {
if (!schema.required) {
return false
}
return (schema.required.indexOf(fieldName) != 1)
}
const renderField = (fieldSchema, fieldName, theme, prefix = '') => {
const widget = fieldSchema.widget || fieldSchema.type || 'object'
if (!theme[widget]) {
throw new Error('liform: ' + widget + ' is not defined in the theme')
}
return React.createElement(theme[widget], {
key: fieldName,
fieldName: prefix ? prefix + fieldName : fieldName,
label: fieldSchema.showLabel === false ? '' : fieldSchema.title || fieldName,
required: isRequired(fieldSchema, fieldName),
schema: fieldSchema,
theme: theme,
})
}
export default renderField
| Change format to widget to be more friendly with ajv | Change format to widget to be more friendly with ajv
| JavaScript | mit | Limenius/liform-react | ---
+++
@@ -8,7 +8,7 @@
}
const renderField = (fieldSchema, fieldName, theme, prefix = '') => {
- const widget = fieldSchema.format || fieldSchema.type || 'object'
+ const widget = fieldSchema.widget || fieldSchema.type || 'object'
if (!theme[widget]) {
throw new Error('liform: ' + widget + ' is not defined in the theme')
} |
17caa86e56c41bc5ce4092b1162b6cc5a12aa95f | example/nestedListView/NodeView.js | example/nestedListView/NodeView.js | /* @flow */
import React from 'react'
import {TouchableOpacity, View, FlatList} from 'react-native'
export default class NodeView extends React.PureComponent {
componentWillMount = () => {
let rootChildren = this.props.getChildren(this.props.node)
if (rootChildren) {
rootChildren = rootChildren.map((child, index) => {
return this.props.generateIds(rootChildren[index])
})
}
this.setState({data: rootChildren})
}
onNodePressed = (node: any) => {
const newState = rootChildren = this.state.data.map((child, index) => {
return this.props.searchTree(this.state.data[index], node)
})
this.setState({data: newState})
this.props.onNodePressed(node)
}
render() {
const {getChildren, node, nodeStyle, onLayout, onNodePressed, renderNode, renderChildrenNode} = this.props
const children = getChildren(node)
return (
<View onLayout={onLayout}>
<TouchableOpacity onPress={() => onNodePressed(node)}>
{renderNode()}
</TouchableOpacity>
{node.opened && this.state.data
? <FlatList
data={this.state.data}
renderItem={({item}) => renderChildrenNode(item)}
keyExtractor={(item) => item.id}/> : null}
</View>
)
}
}
| /* @flow */
import React from 'react'
import {TouchableOpacity, View, FlatList} from 'react-native'
export default class NodeView extends React.PureComponent {
componentWillMount = () => {
let rootChildren = this.props.getChildren(this.props.node)
if (rootChildren) {
rootChildren = rootChildren.map((child, index) => {
return this.props.generateIds(rootChildren[index])
})
}
this.setState({data: rootChildren})
}
onNodePressed = (node: any) => {
if (this.state.data) {
const newState = rootChildren = this.state.data.map((child, index) => {
return this.props.searchTree(this.state.data[index], node)
})
this.setState({data: newState})
}
this.props.onNodePressed(node)
}
render() {
const {getChildren, node, nodeStyle, onLayout, onNodePressed, renderNode, renderChildrenNode} = this.props
const children = getChildren(node)
return (
<View onLayout={onLayout}>
<TouchableOpacity onPress={() => this.onNodePressed(node)}>
{renderNode()}
</TouchableOpacity>
{node.opened && this.state.data
? <FlatList
data={this.state.data}
renderItem={({item}) => renderChildrenNode(item)}
keyExtractor={(item) => item.id}/> : null}
</View>
)
}
}
| Fix issue in flat list | Fix issue in flat list
| JavaScript | mit | fjmorant/react-native-nested-listview,fjmorant/react-native-nested-listview,fjmorant/react-native-nested-listview | ---
+++
@@ -18,11 +18,14 @@
}
onNodePressed = (node: any) => {
- const newState = rootChildren = this.state.data.map((child, index) => {
- return this.props.searchTree(this.state.data[index], node)
- })
-
- this.setState({data: newState})
+ if (this.state.data) {
+ const newState = rootChildren = this.state.data.map((child, index) => {
+ return this.props.searchTree(this.state.data[index], node)
+ })
+
+ this.setState({data: newState})
+ }
+
this.props.onNodePressed(node)
}
@@ -32,7 +35,7 @@
return (
<View onLayout={onLayout}>
- <TouchableOpacity onPress={() => onNodePressed(node)}>
+ <TouchableOpacity onPress={() => this.onNodePressed(node)}>
{renderNode()}
</TouchableOpacity>
{node.opened && this.state.data |
91451bab35e3e683d0c77c71f0ba1dbbf25ac302 | app/controllers/account.js | app/controllers/account.js | var express = require('express'),
router = express.Router(),
passport = require('passport');
module.exports = function (app) {
app.use('/account', router);
};
router.get('/', function (req, res, next) {
console.log('User: ', req);
res.render('account', {
title: 'Libbie: quickly add books to Goodreads!',
userName: req.user.clientInfo.displayName,
shelves: [
{ name: 'Owned books', value: 'owned-books' },
],
conditions: [
{ name: 'unspecified', value: 0 },
{ name: 'brand new', value: 10 },
{ name: 'like new', value: 20, default: true },
{ name: 'very good', value: 30 },
{ name: 'good', value: 40 },
{ name: 'acceptable', value: 50 },
{ name: 'poor', value: 60 },
],
helpers: {
isSelected: function (input) {
return typeof input !== 'undefined' && input === true ? 'selected' : '';
}
}
});
}); | var express = require('express'),
router = express.Router(),
passport = require('passport');
module.exports = function (app) {
app.use('/account', router);
};
router.get('/', function (req, res, next) {
console.log('User: ', req);
res.render('account', {
title: 'Libbie: quickly add books to Goodreads!',
userName: req.user.displayName,
shelves: [
{ name: 'Owned books', value: 'owned-books' },
],
conditions: [
{ name: 'unspecified', value: 0 },
{ name: 'brand new', value: 10 },
{ name: 'like new', value: 20, default: true },
{ name: 'very good', value: 30 },
{ name: 'good', value: 40 },
{ name: 'acceptable', value: 50 },
{ name: 'poor', value: 60 },
],
helpers: {
isSelected: function (input) {
return typeof input !== 'undefined' && input === true ? 'selected' : '';
}
}
});
}); | Fix due to removed clientInfo property | Fix due to removed clientInfo property
| JavaScript | apache-2.0 | Mobius5150/libbie,Mobius5150/libbie | ---
+++
@@ -10,7 +10,7 @@
console.log('User: ', req);
res.render('account', {
title: 'Libbie: quickly add books to Goodreads!',
- userName: req.user.clientInfo.displayName,
+ userName: req.user.displayName,
shelves: [
{ name: 'Owned books', value: 'owned-books' },
], |
87d77b7bb4a5ee73004c65df99649a491b58df87 | test/unit/unit.js | test/unit/unit.js | 'use strict';
require.config({
baseUrl: '../lib',
paths: {
'test': '..',
'forge': 'forge.min',
'stringencoding': 'stringencoding.min'
},
shim: {
sinon: {
exports: 'sinon',
}
}
});
// add function.bind polyfill
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof FNOP && oThis ? this : oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
mocha.setup('bdd');
require(['../unit/smtpclient-test', '../unit/smtpclient-response-parser-test'], function() {
(window.mochaPhantomJS || window.mocha).run();
}); | 'use strict';
require.config({
baseUrl: '../lib',
paths: {
'test': '..',
'forge': 'forge.min',
'stringencoding': 'stringencoding.min'
}
});
// add function.bind polyfill
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof FNOP && oThis ? this : oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
mocha.setup('bdd');
require(['../unit/smtpclient-test', '../unit/smtpclient-response-parser-test'], function() {
(window.mochaPhantomJS || window.mocha).run();
}); | Remove useless sinon require shim | Remove useless sinon require shim
| JavaScript | mit | whiteout-io/smtpclient,huangxok/smtpclient,huangxok/smtpclient,emailjs/emailjs-smtp-client,whiteout-io/smtpclient,emailjs/emailjs-smtp-client | ---
+++
@@ -6,11 +6,6 @@
'test': '..',
'forge': 'forge.min',
'stringencoding': 'stringencoding.min'
- },
- shim: {
- sinon: {
- exports: 'sinon',
- }
}
});
|
7ff6cd7e5b3993c62151f1ae57e146bbc9d2a13f | model/Post.js | model/Post.js | /*jslint eqeq: true, indent: 2, node: true, plusplus: true, regexp: true, unparam: true, vars: true, nomen: true */
'use strict';
var Schema = require('mongoose').Schema;
/**
* The article schema.
*/
var PostSchema = new Schema({
type: {type: Number, 'default': 0},
authorId: String,
catalogId: {type: String, ref: 'Catalog'},
tags: [String],
title: Number,
content: String,
date: {type: Date, 'default': Date.now}
});
var statics = PostSchema.statics;
statics.listLatestPosts = function (param, cb) {
var q = this.find();
if (param) {
if (param.start) {
q.skip(param.start);
}
if (param.limit) {
q.limit(param.limit);
}
}
q.sort({date: 'desc'});
if (cb) {
return q.exec(cb);
} else {
return q;
}
};
module.exports = PostSchema;
| /*jslint eqeq: true, indent: 2, node: true, plusplus: true, regexp: true, unparam: true, vars: true, nomen: true */
'use strict';
var Schema = require('mongoose').Schema;
/**
* The article schema.
*/
var PostSchema = new Schema({
type: {type: Number, 'default': 0},
authorId: String,
catalogId: {type: String, ref: 'Catalog'},
tags: [String],
title: String,
content: String,
date: {type: Date, 'default': Date.now}
});
var statics = PostSchema.statics;
statics.listLatestPosts = function (param, cb) {
var q = this.find();
if (param) {
if (param.start) {
q.skip(param.start);
}
if (param.limit) {
q.limit(param.limit);
}
}
q.sort({date: 'desc'});
if (cb) {
return q.exec(cb);
} else {
return q;
}
};
module.exports = PostSchema;
| Fix wrong type for title in post model. | Fix wrong type for title in post model.
| JavaScript | bsd-3-clause | neuola/neuola-data | ---
+++
@@ -11,7 +11,7 @@
authorId: String,
catalogId: {type: String, ref: 'Catalog'},
tags: [String],
- title: Number,
+ title: String,
content: String,
date: {type: Date, 'default': Date.now}
}); |
c13ba4cb8088fa883c7e399715608b2e16fed77c | karma.conf.js | karma.conf.js | module.exports = function(config) {
config.set({
frameworks: ['mocha'],
exclude: ['build/test/external.spec.js'],
files: [
'vendor/es5-shim.js',
'vendor/es5-sham.js',
'vendor/rsvp.js',
'vendor/unexpected-magicpen.min.js',
'build/test/promisePolyfill.js',
'unexpected.js',
'build/test/common.js',
'build/test/**/*.spec.js'
],
browsers: ['ChromeHeadlessNoSandbox'],
client: {
mocha: {
reporter: 'html'
}
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}
});
};
| module.exports = function(config) {
config.set({
frameworks: ['mocha'],
exclude: ['build/test/external.spec.js'],
files: [
'vendor/es5-shim.js',
'vendor/es5-sham.js',
'vendor/rsvp.js',
'vendor/unexpected-magicpen.min.js',
'build/test/promisePolyfill.js',
'unexpected.js',
'build/test/common.js',
'build/test/**/*.spec.js'
],
browsers: ['ChromeHeadlessNoSandbox'],
client: {
mocha: {
reporter: 'html'
}
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
reporters: ['progress']
});
};
| Use the progress reporter for karma | Use the progress reporter for karma
| JavaScript | mit | unexpectedjs/unexpected | ---
+++
@@ -28,6 +28,8 @@
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
- }
+ },
+
+ reporters: ['progress']
});
}; |
6a38487871bbfe84b915eac40bcb82a7bf742cb3 | tilt-client/spec/sock_spec.js | tilt-client/spec/sock_spec.js | describe('Sock object', function() {
var socket;
var pong;
var joinRoom;
beforeEach(function() {
});
afterEach(function() {
});
it('should exist', function() {
expect(window.Tilt.Sock).toBeDefined();
});
it('should connect and return a new sock object', function() {
expect(window.Tilt.connect('10.0.0.1') instanceof window.Tilt.Sock).toBeTruthy();
});
describe('for games', function() {
it('should emit messages', function() {
var s = window.Tilt.connect('10.0.0.1');
s.emit('cntID', 'msgname', 'argblah');
var emits = io.mockGetFunctionCalls('emit');
expect(emits[emits.length - 1]).toEqual(['msg', 'cntID', ['msgname', 'argblah']]);
});
});
}); | describe('Sock object', function() {
var socket;
var pong;
var joinRoom;
beforeEach(function() {
});
afterEach(function() {
});
it('should exist', function() {
expect(window.Tilt.Sock).toBeDefined();
});
it('should connect and return a new sock object', function() {
expect(window.Tilt.connect('10.0.0.1') instanceof window.Tilt.Sock).toBeTruthy();
});
describe('for games', function() {
it('should emit messages', function() {
var s = window.Tilt.connect('10.0.0.1');
s.emit('cntID', 'msgname', 'argblah');
var emits = io.mockGetFunctionCalls('emit');
expect(emits[emits.length - 1]).toEqual(['msg', 'cntID', ['msgname', 'argblah']]);
});
});
describe('for controllers', function() {
it('should emit messages', function() {
var s = window.Tilt.connect('10.0.0.1', 'gameidhere');
s.emit('msgname', 'argblah');
var emits = io.mockGetFunctionCalls('emit');
expect(emits[emits.length - 1]).toEqual(['msg', ['msgname', 'argblah']]);
});
});
}); | Add a test for controllers | Add a test for controllers
| JavaScript | mit | tilt-js/tilt.js | ---
+++
@@ -25,4 +25,14 @@
expect(emits[emits.length - 1]).toEqual(['msg', 'cntID', ['msgname', 'argblah']]);
});
});
+
+ describe('for controllers', function() {
+ it('should emit messages', function() {
+ var s = window.Tilt.connect('10.0.0.1', 'gameidhere');
+
+ s.emit('msgname', 'argblah');
+ var emits = io.mockGetFunctionCalls('emit');
+ expect(emits[emits.length - 1]).toEqual(['msg', ['msgname', 'argblah']]);
+ });
+ });
}); |
a387535d2d6fdc1d6391ce46f2de98e08209fea1 | static/js/feature_flags.js | static/js/feature_flags.js | var feature_flags = (function () {
var exports = {};
exports.mark_read_at_bottom = true;
exports.summarize_read_while_narrowed = true;
exports.twenty_four_hour_time = _.contains([],
page_params.email);
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
exports.email_forwarding = true;
exports.mandatory_topics = _.contains([
'customer7.invalid'
],
page_params.domain
);
exports.collapsible = page_params.staging;
exports.propagate_topic_edits = page_params.staging ||
_.contains(['customer7.invalid'], page_params.domain);
exports.fade_users_when_composing = page_params.staging;
exports.alert_words =
_.contains(['reddit.com', 'mit.edu', 'zulip.com'], page_params.domain);
exports.muting = page_params.staging;
exports.left_side_userlist = page_params.staging ||
_.contains(['customer7.invalid'], page_params.domain);
return exports;
}());
| var feature_flags = (function () {
var exports = {};
exports.mark_read_at_bottom = true;
exports.summarize_read_while_narrowed = true;
exports.twenty_four_hour_time = _.contains([],
page_params.email);
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
exports.email_forwarding = true;
exports.mandatory_topics = _.contains([
'customer7.invalid'
],
page_params.domain
);
exports.collapsible = page_params.staging;
exports.propagate_topic_edits = page_params.staging ||
_.contains(['customer7.invalid'], page_params.domain);
exports.fade_users_when_composing = page_params.staging;
exports.alert_words =
_.contains(['reddit.com', 'mit.edu', 'zulip.com'], page_params.domain);
var zulip_mit_emails = [];
var is_zulip_mit_user = _.contains(zulip_mit_emails, page_params.email);
exports.muting = page_params.staging || is_zulip_mit_user;
exports.left_side_userlist = page_params.staging ||
_.contains(['customer7.invalid'], page_params.domain);
return exports;
}());
| Enable muting for internal MIT users. | Enable muting for internal MIT users.
(imported from commit 82dc8c620c5f9af5b7a366bd16aee9125b9ba634)
| JavaScript | apache-2.0 | MayB/zulip,fw1121/zulip,peguin40/zulip,stamhe/zulip,brainwane/zulip,vikas-parashar/zulip,voidException/zulip,ericzhou2008/zulip,mahim97/zulip,babbage/zulip,souravbadami/zulip,easyfmxu/zulip,proliming/zulip,bssrdf/zulip,qq1012803704/zulip,xuanhan863/zulip,voidException/zulip,alliejones/zulip,guiquanz/zulip,yocome/zulip,eeshangarg/zulip,levixie/zulip,mdavid/zulip,samatdav/zulip,amanharitsh123/zulip,hackerkid/zulip,zorojean/zulip,dwrpayne/zulip,mansilladev/zulip,saitodisse/zulip,he15his/zulip,gigawhitlocks/zulip,Juanvulcano/zulip,voidException/zulip,isht3/zulip,Drooids/zulip,andersk/zulip,zacps/zulip,Gabriel0402/zulip,schatt/zulip,souravbadami/zulip,schatt/zulip,johnny9/zulip,zorojean/zulip,lfranchi/zulip,tiansiyuan/zulip,codeKonami/zulip,mahim97/zulip,bssrdf/zulip,jerryge/zulip,jeffcao/zulip,zachallaun/zulip,joshisa/zulip,johnny9/zulip,kokoar/zulip,jimmy54/zulip,babbage/zulip,jrowan/zulip,themass/zulip,stamhe/zulip,he15his/zulip,krtkmj/zulip,arpitpanwar/zulip,amyliu345/zulip,kaiyuanheshang/zulip,sharmaeklavya2/zulip,shubhamdhama/zulip,bluesea/zulip,jackrzhang/zulip,jainayush975/zulip,ryansnowboarder/zulip,willingc/zulip,suxinde2009/zulip,Jianchun1/zulip,eeshangarg/zulip,jackrzhang/zulip,amanharitsh123/zulip,pradiptad/zulip,levixie/zulip,zhaoweigg/zulip,mdavid/zulip,johnny9/zulip,hafeez3000/zulip,luyifan/zulip,grave-w-grave/zulip,rht/zulip,hengqujushi/zulip,jessedhillon/zulip,hj3938/zulip,MayB/zulip,timabbott/zulip,vakila/zulip,yocome/zulip,verma-varsha/zulip,PhilSk/zulip,synicalsyntax/zulip,andersk/zulip,zacps/zulip,wavelets/zulip,johnnygaddarr/zulip,hustlzp/zulip,LAndreas/zulip,hafeez3000/zulip,ApsOps/zulip,calvinleenyc/zulip,avastu/zulip,akuseru/zulip,punchagan/zulip,littledogboy/zulip,levixie/zulip,brockwhittaker/zulip,amallia/zulip,vakila/zulip,bowlofstew/zulip,wavelets/zulip,he15his/zulip,zofuthan/zulip,codeKonami/zulip,paxapy/zulip,tommyip/zulip,vikas-parashar/zulip,xuxiao/zulip,rht/zulip,lfranchi/zulip,Suninus/zulip,atomic-labs/zulip,xuxiao/zulip,wangdeshui/zulip,esander91/zulip,tommyip/zulip,calvinleenyc/zulip,zhaoweigg/zulip,arpith/zulip,hj3938/zulip,tbutter/zulip,sharmaeklavya2/zulip,aps-sids/zulip,Qgap/zulip,sharmaeklavya2/zulip,littledogboy/zulip,karamcnair/zulip,hengqujushi/zulip,kokoar/zulip,jackrzhang/zulip,stamhe/zulip,sharmaeklavya2/zulip,schatt/zulip,ipernet/zulip,hj3938/zulip,kou/zulip,fw1121/zulip,jimmy54/zulip,glovebx/zulip,jainayush975/zulip,jerryge/zulip,cosmicAsymmetry/zulip,ufosky-server/zulip,m1ssou/zulip,voidException/zulip,ipernet/zulip,seapasulli/zulip,gigawhitlocks/zulip,KingxBanana/zulip,ericzhou2008/zulip,kaiyuanheshang/zulip,avastu/zulip,KJin99/zulip,wavelets/zulip,deer-hope/zulip,schatt/zulip,nicholasbs/zulip,bitemyapp/zulip,souravbadami/zulip,arpitpanwar/zulip,niftynei/zulip,blaze225/zulip,sup95/zulip,vikas-parashar/zulip,bluesea/zulip,zacps/zulip,jonesgithub/zulip,lfranchi/zulip,aakash-cr7/zulip,so0k/zulip,mahim97/zulip,themass/zulip,deer-hope/zulip,dotcool/zulip,huangkebo/zulip,voidException/zulip,nicholasbs/zulip,ashwinirudrappa/zulip,eastlhu/zulip,ipernet/zulip,LAndreas/zulip,tbutter/zulip,zofuthan/zulip,willingc/zulip,punchagan/zulip,krtkmj/zulip,cosmicAsymmetry/zulip,udxxabp/zulip,rht/zulip,eeshangarg/zulip,Drooids/zulip,LAndreas/zulip,vikas-parashar/zulip,deer-hope/zulip,noroot/zulip,pradiptad/zulip,shrikrishnaholla/zulip,j831/zulip,RobotCaleb/zulip,isht3/zulip,avastu/zulip,dxq-git/zulip,TigorC/zulip,luyifan/zulip,ikasumiwt/zulip,MariaFaBella85/zulip,qq1012803704/zulip,synicalsyntax/zulip,jimmy54/zulip,proliming/zulip,dwrpayne/zulip,armooo/zulip,tommyip/zulip,ikasumiwt/zulip,dotcool/zulip,willingc/zulip,cosmicAsymmetry/zulip,Juanvulcano/zulip,technicalpickles/zulip,levixie/zulip,esander91/zulip,tbutter/zulip,ufosky-server/zulip,souravbadami/zulip,deer-hope/zulip,wangdeshui/zulip,hafeez3000/zulip,seapasulli/zulip,andersk/zulip,grave-w-grave/zulip,EasonYi/zulip,so0k/zulip,eastlhu/zulip,hayderimran7/zulip,Cheppers/zulip,arpith/zulip,joyhchen/zulip,wweiradio/zulip,paxapy/zulip,themass/zulip,calvinleenyc/zulip,developerfm/zulip,bowlofstew/zulip,moria/zulip,tommyip/zulip,johnny9/zulip,praveenaki/zulip,vikas-parashar/zulip,guiquanz/zulip,shubhamdhama/zulip,amyliu345/zulip,paxapy/zulip,brainwane/zulip,synicalsyntax/zulip,dhcrzf/zulip,littledogboy/zulip,deer-hope/zulip,Gabriel0402/zulip,so0k/zulip,joyhchen/zulip,JanzTam/zulip,firstblade/zulip,verma-varsha/zulip,synicalsyntax/zulip,glovebx/zulip,stamhe/zulip,natanovia/zulip,Galexrt/zulip,shubhamdhama/zulip,Galexrt/zulip,peiwei/zulip,swinghu/zulip,arpith/zulip,brainwane/zulip,ryanbackman/zulip,codeKonami/zulip,bastianh/zulip,hackerkid/zulip,hayderimran7/zulip,jimmy54/zulip,PaulPetring/zulip,blaze225/zulip,grave-w-grave/zulip,yuvipanda/zulip,AZtheAsian/zulip,udxxabp/zulip,nicholasbs/zulip,ikasumiwt/zulip,Cheppers/zulip,bitemyapp/zulip,ericzhou2008/zulip,wavelets/zulip,punchagan/zulip,amallia/zulip,Frouk/zulip,susansls/zulip,tdr130/zulip,DazWorrall/zulip,rishig/zulip,wweiradio/zulip,Vallher/zulip,amallia/zulip,so0k/zulip,ahmadassaf/zulip,shaunstanislaus/zulip,dnmfarrell/zulip,ufosky-server/zulip,littledogboy/zulip,Galexrt/zulip,bluesea/zulip,EasonYi/zulip,hustlzp/zulip,kou/zulip,sup95/zulip,hj3938/zulip,kou/zulip,jeffcao/zulip,firstblade/zulip,vakila/zulip,qq1012803704/zulip,suxinde2009/zulip,developerfm/zulip,zachallaun/zulip,adnanh/zulip,wavelets/zulip,esander91/zulip,tbutter/zulip,ryanbackman/zulip,JPJPJPOPOP/zulip,wdaher/zulip,moria/zulip,avastu/zulip,brockwhittaker/zulip,SmartPeople/zulip,jimmy54/zulip,MariaFaBella85/zulip,wweiradio/zulip,yocome/zulip,vabs22/zulip,bastianh/zulip,bitemyapp/zulip,ryanbackman/zulip,he15his/zulip,rishig/zulip,jonesgithub/zulip,paxapy/zulip,ryansnowboarder/zulip,amanharitsh123/zulip,jrowan/zulip,DazWorrall/zulip,reyha/zulip,yuvipanda/zulip,shaunstanislaus/zulip,reyha/zulip,timabbott/zulip,bastianh/zulip,proliming/zulip,PaulPetring/zulip,grave-w-grave/zulip,ryanbackman/zulip,bssrdf/zulip,gkotian/zulip,jainayush975/zulip,bluesea/zulip,dhcrzf/zulip,verma-varsha/zulip,hj3938/zulip,huangkebo/zulip,RobotCaleb/zulip,dnmfarrell/zulip,eeshangarg/zulip,jerryge/zulip,tdr130/zulip,mohsenSy/zulip,bastianh/zulip,glovebx/zulip,seapasulli/zulip,suxinde2009/zulip,Gabriel0402/zulip,niftynei/zulip,zacps/zulip,PhilSk/zulip,LAndreas/zulip,wavelets/zulip,aliceriot/zulip,eeshangarg/zulip,avastu/zulip,verma-varsha/zulip,susansls/zulip,dhcrzf/zulip,ryansnowboarder/zulip,jonesgithub/zulip,MariaFaBella85/zulip,zofuthan/zulip,shrikrishnaholla/zulip,cosmicAsymmetry/zulip,moria/zulip,kokoar/zulip,LeeRisk/zulip,punchagan/zulip,calvinleenyc/zulip,Cheppers/zulip,bowlofstew/zulip,hayderimran7/zulip,Galexrt/zulip,LAndreas/zulip,arpitpanwar/zulip,luyifan/zulip,ericzhou2008/zulip,bssrdf/zulip,PaulPetring/zulip,zwily/zulip,armooo/zulip,qq1012803704/zulip,seapasulli/zulip,johnnygaddarr/zulip,KingxBanana/zulip,LAndreas/zulip,synicalsyntax/zulip,kokoar/zulip,sharmaeklavya2/zulip,firstblade/zulip,vikas-parashar/zulip,MayB/zulip,eastlhu/zulip,Jianchun1/zulip,mohsenSy/zulip,zwily/zulip,jeffcao/zulip,ahmadassaf/zulip,PaulPetring/zulip,ufosky-server/zulip,jessedhillon/zulip,bastianh/zulip,shaunstanislaus/zulip,babbage/zulip,hengqujushi/zulip,ahmadassaf/zulip,proliming/zulip,j831/zulip,MariaFaBella85/zulip,mansilladev/zulip,thomasboyt/zulip,karamcnair/zulip,ipernet/zulip,guiquanz/zulip,pradiptad/zulip,susansls/zulip,timabbott/zulip,armooo/zulip,dotcool/zulip,ahmadassaf/zulip,timabbott/zulip,jrowan/zulip,technicalpickles/zulip,hayderimran7/zulip,EasonYi/zulip,verma-varsha/zulip,ApsOps/zulip,kaiyuanheshang/zulip,gkotian/zulip,EasonYi/zulip,alliejones/zulip,akuseru/zulip,ikasumiwt/zulip,akuseru/zulip,johnny9/zulip,AZtheAsian/zulip,brainwane/zulip,rht/zulip,thomasboyt/zulip,codeKonami/zulip,alliejones/zulip,cosmicAsymmetry/zulip,jrowan/zulip,shrikrishnaholla/zulip,hustlzp/zulip,joshisa/zulip,moria/zulip,samatdav/zulip,vaidap/zulip,timabbott/zulip,Jianchun1/zulip,armooo/zulip,wdaher/zulip,dawran6/zulip,saitodisse/zulip,huangkebo/zulip,dattatreya303/zulip,johnny9/zulip,arpith/zulip,Galexrt/zulip,seapasulli/zulip,blaze225/zulip,susansls/zulip,DazWorrall/zulip,krtkmj/zulip,schatt/zulip,ashwinirudrappa/zulip,noroot/zulip,gkotian/zulip,swinghu/zulip,jimmy54/zulip,brainwane/zulip,deer-hope/zulip,jackrzhang/zulip,zulip/zulip,Drooids/zulip,kaiyuanheshang/zulip,mahim97/zulip,Frouk/zulip,amanharitsh123/zulip,littledogboy/zulip,mohsenSy/zulip,moria/zulip,noroot/zulip,sonali0901/zulip,yuvipanda/zulip,easyfmxu/zulip,MariaFaBella85/zulip,RobotCaleb/zulip,glovebx/zulip,tbutter/zulip,PhilSk/zulip,hackerkid/zulip,pradiptad/zulip,ipernet/zulip,RobotCaleb/zulip,shaunstanislaus/zulip,karamcnair/zulip,EasonYi/zulip,eeshangarg/zulip,rht/zulip,blaze225/zulip,moria/zulip,JPJPJPOPOP/zulip,EasonYi/zulip,jimmy54/zulip,gigawhitlocks/zulip,xuxiao/zulip,showell/zulip,jonesgithub/zulip,calvinleenyc/zulip,schatt/zulip,hengqujushi/zulip,isht3/zulip,technicalpickles/zulip,schatt/zulip,samatdav/zulip,zachallaun/zulip,arpith/zulip,voidException/zulip,PaulPetring/zulip,technicalpickles/zulip,vakila/zulip,tiansiyuan/zulip,rishig/zulip,JanzTam/zulip,christi3k/zulip,samatdav/zulip,vaidap/zulip,dotcool/zulip,nicholasbs/zulip,christi3k/zulip,brockwhittaker/zulip,levixie/zulip,itnihao/zulip,niftynei/zulip,zachallaun/zulip,souravbadami/zulip,he15his/zulip,dnmfarrell/zulip,wweiradio/zulip,isht3/zulip,firstblade/zulip,alliejones/zulip,littledogboy/zulip,MayB/zulip,showell/zulip,JanzTam/zulip,willingc/zulip,thomasboyt/zulip,jeffcao/zulip,zacps/zulip,JanzTam/zulip,sonali0901/zulip,xuxiao/zulip,dawran6/zulip,mdavid/zulip,aps-sids/zulip,lfranchi/zulip,natanovia/zulip,umkay/zulip,Vallher/zulip,wavelets/zulip,Vallher/zulip,mdavid/zulip,andersk/zulip,KJin99/zulip,wangdeshui/zulip,developerfm/zulip,easyfmxu/zulip,vakila/zulip,praveenaki/zulip,AZtheAsian/zulip,Diptanshu8/zulip,xuanhan863/zulip,showell/zulip,j831/zulip,kou/zulip,ipernet/zulip,luyifan/zulip,pradiptad/zulip,fw1121/zulip,arpitpanwar/zulip,bastianh/zulip,Jianchun1/zulip,SmartPeople/zulip,akuseru/zulip,yuvipanda/zulip,LeeRisk/zulip,sonali0901/zulip,paxapy/zulip,rishig/zulip,m1ssou/zulip,umkay/zulip,ericzhou2008/zulip,mansilladev/zulip,vaidap/zulip,Drooids/zulip,swinghu/zulip,joshisa/zulip,dawran6/zulip,aps-sids/zulip,babbage/zulip,peiwei/zulip,zulip/zulip,showell/zulip,bowlofstew/zulip,tommyip/zulip,mahim97/zulip,Diptanshu8/zulip,zhaoweigg/zulip,adnanh/zulip,paxapy/zulip,wangdeshui/zulip,AZtheAsian/zulip,babbage/zulip,jessedhillon/zulip,wdaher/zulip,Suninus/zulip,ashwinirudrappa/zulip,easyfmxu/zulip,JPJPJPOPOP/zulip,hackerkid/zulip,esander91/zulip,johnnygaddarr/zulip,dxq-git/zulip,udxxabp/zulip,peiwei/zulip,vakila/zulip,RobotCaleb/zulip,arpitpanwar/zulip,johnnygaddarr/zulip,jackrzhang/zulip,Vallher/zulip,qq1012803704/zulip,hackerkid/zulip,Suninus/zulip,Qgap/zulip,babbage/zulip,shubhamdhama/zulip,bluesea/zulip,suxinde2009/zulip,peiwei/zulip,hustlzp/zulip,synicalsyntax/zulip,Juanvulcano/zulip,showell/zulip,Suninus/zulip,zhaoweigg/zulip,glovebx/zulip,dwrpayne/zulip,jerryge/zulip,Batterfii/zulip,lfranchi/zulip,avastu/zulip,guiquanz/zulip,sup95/zulip,TigorC/zulip,seapasulli/zulip,ufosky-server/zulip,qq1012803704/zulip,jackrzhang/zulip,grave-w-grave/zulip,karamcnair/zulip,suxinde2009/zulip,esander91/zulip,ryanbackman/zulip,ApsOps/zulip,grave-w-grave/zulip,dxq-git/zulip,LAndreas/zulip,ryansnowboarder/zulip,akuseru/zulip,itnihao/zulip,jainayush975/zulip,reyha/zulip,hafeez3000/zulip,akuseru/zulip,ashwinirudrappa/zulip,zacps/zulip,johnny9/zulip,ryansnowboarder/zulip,bowlofstew/zulip,bluesea/zulip,brockwhittaker/zulip,kaiyuanheshang/zulip,adnanh/zulip,xuxiao/zulip,SmartPeople/zulip,peguin40/zulip,yuvipanda/zulip,dotcool/zulip,itnihao/zulip,stamhe/zulip,susansls/zulip,sup95/zulip,mahim97/zulip,Batterfii/zulip,technicalpickles/zulip,ashwinirudrappa/zulip,xuanhan863/zulip,blaze225/zulip,swinghu/zulip,ikasumiwt/zulip,proliming/zulip,itnihao/zulip,Qgap/zulip,m1ssou/zulip,dattatreya303/zulip,levixie/zulip,Galexrt/zulip,atomic-labs/zulip,Qgap/zulip,reyha/zulip,praveenaki/zulip,JPJPJPOPOP/zulip,zofuthan/zulip,dattatreya303/zulip,rht/zulip,showell/zulip,m1ssou/zulip,dnmfarrell/zulip,suxinde2009/zulip,amanharitsh123/zulip,zorojean/zulip,Vallher/zulip,Batterfii/zulip,kokoar/zulip,vabs22/zulip,jerryge/zulip,ipernet/zulip,eastlhu/zulip,glovebx/zulip,praveenaki/zulip,saitodisse/zulip,easyfmxu/zulip,codeKonami/zulip,thomasboyt/zulip,dwrpayne/zulip,dhcrzf/zulip,dhcrzf/zulip,karamcnair/zulip,codeKonami/zulip,Galexrt/zulip,SmartPeople/zulip,huangkebo/zulip,developerfm/zulip,jphilipsen05/zulip,atomic-labs/zulip,joyhchen/zulip,dattatreya303/zulip,shaunstanislaus/zulip,dotcool/zulip,Diptanshu8/zulip,mohsenSy/zulip,hustlzp/zulip,natanovia/zulip,Drooids/zulip,m1ssou/zulip,KJin99/zulip,dawran6/zulip,deer-hope/zulip,mansilladev/zulip,armooo/zulip,niftynei/zulip,shrikrishnaholla/zulip,praveenaki/zulip,m1ssou/zulip,Cheppers/zulip,ahmadassaf/zulip,xuxiao/zulip,praveenaki/zulip,hengqujushi/zulip,jphilipsen05/zulip,dawran6/zulip,nicholasbs/zulip,wweiradio/zulip,dxq-git/zulip,Gabriel0402/zulip,rishig/zulip,amyliu345/zulip,isht3/zulip,tdr130/zulip,alliejones/zulip,j831/zulip,zorojean/zulip,peguin40/zulip,EasonYi/zulip,PhilSk/zulip,adnanh/zulip,sup95/zulip,ashwinirudrappa/zulip,hayderimran7/zulip,yuvipanda/zulip,amyliu345/zulip,umkay/zulip,jphilipsen05/zulip,zwily/zulip,isht3/zulip,amyliu345/zulip,ahmadassaf/zulip,jackrzhang/zulip,xuanhan863/zulip,ApsOps/zulip,fw1121/zulip,wdaher/zulip,xuxiao/zulip,zofuthan/zulip,zulip/zulip,wdaher/zulip,PhilSk/zulip,krtkmj/zulip,MariaFaBella85/zulip,udxxabp/zulip,zhaoweigg/zulip,saitodisse/zulip,fw1121/zulip,JanzTam/zulip,tbutter/zulip,krtkmj/zulip,aliceriot/zulip,bowlofstew/zulip,hafeez3000/zulip,he15his/zulip,karamcnair/zulip,zulip/zulip,so0k/zulip,mohsenSy/zulip,joshisa/zulip,firstblade/zulip,andersk/zulip,AZtheAsian/zulip,thomasboyt/zulip,dotcool/zulip,udxxabp/zulip,peiwei/zulip,thomasboyt/zulip,aps-sids/zulip,umkay/zulip,themass/zulip,dnmfarrell/zulip,jessedhillon/zulip,armooo/zulip,aakash-cr7/zulip,babbage/zulip,mohsenSy/zulip,tdr130/zulip,ahmadassaf/zulip,aliceriot/zulip,ashwinirudrappa/zulip,Cheppers/zulip,noroot/zulip,natanovia/zulip,arpitpanwar/zulip,Jianchun1/zulip,peguin40/zulip,aps-sids/zulip,dxq-git/zulip,huangkebo/zulip,johnnygaddarr/zulip,pradiptad/zulip,christi3k/zulip,christi3k/zulip,fw1121/zulip,peiwei/zulip,tommyip/zulip,amyliu345/zulip,TigorC/zulip,hustlzp/zulip,bowlofstew/zulip,ericzhou2008/zulip,Gabriel0402/zulip,dxq-git/zulip,DazWorrall/zulip,TigorC/zulip,wdaher/zulip,vaidap/zulip,mdavid/zulip,MayB/zulip,bastianh/zulip,swinghu/zulip,arpitpanwar/zulip,ikasumiwt/zulip,huangkebo/zulip,amanharitsh123/zulip,aps-sids/zulip,jeffcao/zulip,joshisa/zulip,eastlhu/zulip,zwily/zulip,noroot/zulip,xuanhan863/zulip,pradiptad/zulip,ApsOps/zulip,tiansiyuan/zulip,adnanh/zulip,johnnygaddarr/zulip,samatdav/zulip,tiansiyuan/zulip,hackerkid/zulip,Batterfii/zulip,j831/zulip,themass/zulip,zulip/zulip,fw1121/zulip,saitodisse/zulip,saitodisse/zulip,jessedhillon/zulip,hengqujushi/zulip,kou/zulip,dwrpayne/zulip,andersk/zulip,easyfmxu/zulip,dnmfarrell/zulip,nicholasbs/zulip,dnmfarrell/zulip,adnanh/zulip,hackerkid/zulip,Jianchun1/zulip,dxq-git/zulip,aakash-cr7/zulip,jonesgithub/zulip,arpith/zulip,bitemyapp/zulip,gigawhitlocks/zulip,jessedhillon/zulip,technicalpickles/zulip,jeffcao/zulip,synicalsyntax/zulip,Suninus/zulip,zofuthan/zulip,aliceriot/zulip,Cheppers/zulip,Qgap/zulip,alliejones/zulip,timabbott/zulip,wweiradio/zulip,Qgap/zulip,hafeez3000/zulip,wangdeshui/zulip,KJin99/zulip,esander91/zulip,aliceriot/zulip,shaunstanislaus/zulip,akuseru/zulip,cosmicAsymmetry/zulip,blaze225/zulip,Suninus/zulip,joyhchen/zulip,krtkmj/zulip,shrikrishnaholla/zulip,Frouk/zulip,jainayush975/zulip,samatdav/zulip,stamhe/zulip,JanzTam/zulip,KJin99/zulip,bluesea/zulip,JPJPJPOPOP/zulip,gigawhitlocks/zulip,themass/zulip,zachallaun/zulip,TigorC/zulip,DazWorrall/zulip,willingc/zulip,hustlzp/zulip,LeeRisk/zulip,LeeRisk/zulip,atomic-labs/zulip,jeffcao/zulip,sharmaeklavya2/zulip,KingxBanana/zulip,alliejones/zulip,zorojean/zulip,KingxBanana/zulip,hj3938/zulip,Diptanshu8/zulip,SmartPeople/zulip,punchagan/zulip,atomic-labs/zulip,esander91/zulip,TigorC/zulip,sonali0901/zulip,luyifan/zulip,qq1012803704/zulip,jerryge/zulip,Juanvulcano/zulip,tiansiyuan/zulip,voidException/zulip,levixie/zulip,jphilipsen05/zulip,SmartPeople/zulip,willingc/zulip,udxxabp/zulip,stamhe/zulip,brockwhittaker/zulip,wangdeshui/zulip,zulip/zulip,guiquanz/zulip,sup95/zulip,shaunstanislaus/zulip,brainwane/zulip,lfranchi/zulip,vabs22/zulip,itnihao/zulip,saitodisse/zulip,ericzhou2008/zulip,itnihao/zulip,dawran6/zulip,shrikrishnaholla/zulip,littledogboy/zulip,gkotian/zulip,Frouk/zulip,avastu/zulip,atomic-labs/zulip,Vallher/zulip,sonali0901/zulip,MariaFaBella85/zulip,reyha/zulip,Batterfii/zulip,RobotCaleb/zulip,amallia/zulip,RobotCaleb/zulip,so0k/zulip,dwrpayne/zulip,KingxBanana/zulip,gkotian/zulip,guiquanz/zulip,Cheppers/zulip,kou/zulip,krtkmj/zulip,punchagan/zulip,yocome/zulip,mansilladev/zulip,swinghu/zulip,umkay/zulip,niftynei/zulip,atomic-labs/zulip,zulip/zulip,natanovia/zulip,hj3938/zulip,eastlhu/zulip,souravbadami/zulip,zhaoweigg/zulip,jrowan/zulip,huangkebo/zulip,firstblade/zulip,yocome/zulip,guiquanz/zulip,luyifan/zulip,praveenaki/zulip,jphilipsen05/zulip,punchagan/zulip,aliceriot/zulip,johnnygaddarr/zulip,vaidap/zulip,luyifan/zulip,yocome/zulip,ApsOps/zulip,m1ssou/zulip,peguin40/zulip,lfranchi/zulip,aakash-cr7/zulip,Gabriel0402/zulip,zachallaun/zulip,amallia/zulip,tdr130/zulip,bitemyapp/zulip,zwily/zulip,hengqujushi/zulip,rht/zulip,jessedhillon/zulip,showell/zulip,PhilSk/zulip,DazWorrall/zulip,vaidap/zulip,joyhchen/zulip,joshisa/zulip,tdr130/zulip,jrowan/zulip,Juanvulcano/zulip,Drooids/zulip,LeeRisk/zulip,verma-varsha/zulip,developerfm/zulip,nicholasbs/zulip,xuanhan863/zulip,shrikrishnaholla/zulip,Batterfii/zulip,joyhchen/zulip,Frouk/zulip,KJin99/zulip,easyfmxu/zulip,Drooids/zulip,karamcnair/zulip,JPJPJPOPOP/zulip,eeshangarg/zulip,ryanbackman/zulip,ufosky-server/zulip,shubhamdhama/zulip,firstblade/zulip,christi3k/zulip,noroot/zulip,yuvipanda/zulip,eastlhu/zulip,bssrdf/zulip,kaiyuanheshang/zulip,ryansnowboarder/zulip,Juanvulcano/zulip,gigawhitlocks/zulip,developerfm/zulip,tiansiyuan/zulip,jerryge/zulip,KJin99/zulip,technicalpickles/zulip,mansilladev/zulip,tdr130/zulip,willingc/zulip,sonali0901/zulip,gkotian/zulip,PaulPetring/zulip,mdavid/zulip,vabs22/zulip,jphilipsen05/zulip,thomasboyt/zulip,codeKonami/zulip,moria/zulip,bitemyapp/zulip,rishig/zulip,zorojean/zulip,wdaher/zulip,amallia/zulip,tbutter/zulip,kaiyuanheshang/zulip,jonesgithub/zulip,Frouk/zulip,adnanh/zulip,he15his/zulip,suxinde2009/zulip,bssrdf/zulip,MayB/zulip,aps-sids/zulip,gkotian/zulip,mdavid/zulip,hafeez3000/zulip,xuanhan863/zulip,zorojean/zulip,jonesgithub/zulip,zwily/zulip,amallia/zulip,natanovia/zulip,tommyip/zulip,vabs22/zulip,yocome/zulip,calvinleenyc/zulip,so0k/zulip,MayB/zulip,dwrpayne/zulip,KingxBanana/zulip,shubhamdhama/zulip,Gabriel0402/zulip,mansilladev/zulip,proliming/zulip,vakila/zulip,andersk/zulip,seapasulli/zulip,niftynei/zulip,shubhamdhama/zulip,susansls/zulip,zachallaun/zulip,christi3k/zulip,themass/zulip,Vallher/zulip,j831/zulip,itnihao/zulip,swinghu/zulip,PaulPetring/zulip,noroot/zulip,aliceriot/zulip,peguin40/zulip,zhaoweigg/zulip,JanzTam/zulip,ryansnowboarder/zulip,ikasumiwt/zulip,Diptanshu8/zulip,dattatreya303/zulip,wangdeshui/zulip,bssrdf/zulip,dhcrzf/zulip,Qgap/zulip,DazWorrall/zulip,Frouk/zulip,kokoar/zulip,peiwei/zulip,aakash-cr7/zulip,aakash-cr7/zulip,jainayush975/zulip,reyha/zulip,vabs22/zulip,wweiradio/zulip,hayderimran7/zulip,ufosky-server/zulip,glovebx/zulip,Batterfii/zulip,brainwane/zulip,natanovia/zulip,udxxabp/zulip,rishig/zulip,proliming/zulip,ApsOps/zulip,armooo/zulip,bitemyapp/zulip,Suninus/zulip,umkay/zulip,joshisa/zulip,dhcrzf/zulip,AZtheAsian/zulip,Diptanshu8/zulip,kou/zulip,kokoar/zulip,timabbott/zulip,brockwhittaker/zulip,umkay/zulip,zwily/zulip,gigawhitlocks/zulip,LeeRisk/zulip,developerfm/zulip,tiansiyuan/zulip,hayderimran7/zulip,zofuthan/zulip,dattatreya303/zulip,LeeRisk/zulip | ---
+++
@@ -26,7 +26,12 @@
exports.alert_words =
_.contains(['reddit.com', 'mit.edu', 'zulip.com'], page_params.domain);
-exports.muting = page_params.staging;
+
+var zulip_mit_emails = [];
+
+var is_zulip_mit_user = _.contains(zulip_mit_emails, page_params.email);
+
+exports.muting = page_params.staging || is_zulip_mit_user;
exports.left_side_userlist = page_params.staging ||
_.contains(['customer7.invalid'], page_params.domain); |
de7b6aed2c248de3bcedc7f6b2ceba2d6de7558d | .eslintrc.js | .eslintrc.js | module.exports = {
env: {
browser: true,
es6: true,
},
globals: {
afterEach: true,
beforeEach: true,
chrome: true,
expect: true,
jest: true,
beforeEach: true,
afterEach: true,
describe: true,
test: true,
},
extends: [
'eslint:recommended',
'plugin:flowtype/recommended',
'plugin:react/recommended',
],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2015,
sourceType: 'module',
},
plugins: [
'flowtype',
'react',
],
rules: {
// Rules included in ESLint
'comma-dangle': [2, 'always-multiline'],
'consistent-return': 2,
'eqeqeq': [2, 'smart'],
'indent': [2, 2],
'max-len': [2, {'code': 100, 'ignoreUrls': true}],
'no-console': 0,
'no-multi-spaces': 2,
'no-unused-expressions': 2,
'no-var': 2,
'object-shorthand': 2,
'prefer-const': 2,
'quotes': [2, 'single', {'avoidEscape': true}],
'semi': 2,
'sort-imports': 2,
},
};
| module.exports = {
env: {
browser: true,
es6: true,
},
globals: {
afterEach: true,
beforeEach: true,
chrome: true,
describe: true,
expect: true,
jest: true,
test: true,
},
extends: [
'eslint:recommended',
'plugin:flowtype/recommended',
'plugin:react/recommended',
],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2015,
sourceType: 'module',
},
plugins: [
'flowtype',
'react',
],
rules: {
// Rules included in ESLint
'comma-dangle': [2, 'always-multiline'],
'consistent-return': 2,
'eqeqeq': [2, 'smart'],
'indent': [2, 2],
'max-len': [2, {'code': 100, 'ignoreUrls': true}],
'no-console': 0,
'no-multi-spaces': 2,
'no-unused-expressions': 2,
'no-var': 2,
'object-shorthand': 2,
'prefer-const': 2,
'quotes': [2, 'single', {'avoidEscape': true}],
'semi': 2,
'sort-imports': 2,
},
};
| Remove duplicate keys in eslint `globals` | Remove duplicate keys in eslint `globals` | JavaScript | mit | jacobSingh/tabwrangler,tabwrangler/tabwrangler,tabwrangler/tabwrangler,tabwrangler/tabwrangler,jacobSingh/tabwrangler | ---
+++
@@ -7,11 +7,9 @@
afterEach: true,
beforeEach: true,
chrome: true,
+ describe: true,
expect: true,
jest: true,
- beforeEach: true,
- afterEach: true,
- describe: true,
test: true,
},
extends: [ |
aa9c0c1abbcec19a1c7d179f262f228977637e88 | .eslintrc.js | .eslintrc.js | module.exports = {
"env": {
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
};
| module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
};
| Enable ES6 support for const | Enable ES6 support for const
| JavaScript | mit | raszi/node-tmp,raszi/node-tmp,coldrye-collaboration/node-tmp | ---
+++
@@ -1,5 +1,6 @@
module.exports = {
"env": {
+ "es6": true,
"node": true
},
"extends": "eslint:recommended", |
54457cc5cde30a6f0647dd6603d328c3a04e72cb | .eslintrc.js | .eslintrc.js | module.exports = {
'env': {
'commonjs': true,
'es6': true,
'node': true,
'browser': true,
'jest': true,
'mocha': true,
'jasmine': true,
},
'extends': 'eslint:recommended',
'parser': 'babel-eslint',
'parserOptions': {
'sourceType': 'module'
},
'rules': {
'no-console': 0,
'max-len': ['error', 80],
'no-unused-vars': ['error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_'
}],
quotes: ['error', 'single', {
allowTemplateLiterals: true,
}],
}
};
| module.exports = {
plugins: [
'html'
],
'env': {
'commonjs': true,
'es6': true,
'node': true,
'browser': true,
'jest': true,
'mocha': true,
'jasmine': true,
},
'extends': 'eslint:recommended',
'parser': 'babel-eslint',
'parserOptions': {
'sourceType': 'module'
},
'rules': {
'no-console': 0,
'max-len': ['error', 80],
'no-unused-vars': ['error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_'
}],
quotes: ['error', 'single', {
allowTemplateLiterals: true,
}],
}
};
| Add eslint-plugin-html to config file | Add eslint-plugin-html to config file
| JavaScript | mpl-2.0 | mozilla-iot/gateway,moziot/gateway,mozilla-iot/gateway,mozilla-iot/gateway,moziot/gateway,mozilla-iot/gateway,moziot/gateway,mozilla-iot/gateway | ---
+++
@@ -1,4 +1,7 @@
module.exports = {
+ plugins: [
+ 'html'
+ ],
'env': {
'commonjs': true,
'es6': true, |
464cfab7ac74137a2f7e5be052dac81d06386380 | lang/langs.js | lang/langs.js | var langs = {
'de':'deutsch',
'en':'english',
'es':'español',
'fr':'français',
'it':'italiano',
'ja':'日本',
'ko':'한국어',
'pl':'polski',
'pt':'português',
'ru':'русский',
'sv':'svenska',
'tr':'türkçe',
'uk':'українська',
'zh_cn':'简体中文'
};
| var langs = {
'de':'deutsch',
'en':'english',
'es':'español',
'fr':'français',
'it':'italiano',
'ja':'日本語',
'ko':'한국어',
'pl':'polski',
'pt':'português',
'ru':'русский',
'sv':'svenska',
'tr':'türkçe',
'uk':'українська',
'zh_cn':'简体中文'
};
| Change language name 'Japan' to 'Japanese'. | Change language name 'Japan' to 'Japanese'.
| JavaScript | mpl-2.0 | snazzysanoj/snazzysanoj.github.io,JamesKent/adarkroom,ngosang/adarkroom,sbakht/adarkroom,ikoan/adarkroom,doublespeakgames/adarkroom,Continuities/adarkroom,Pioneer11X/adarkroom,DDReaper/adarkroom,snazzysanoj/snazzysanoj.github.io,pablo-new17/adarkroom,sbakht/adarkroom,ngosang/adarkroom,bdorer/adarkroom,Razynoir/adarkroom,fsladkey/adarkroom,tehp/adarkroom,pablo-new17/adarkroom,as02700/adarkroom,tehp/adarkroom,snazzysano/adarkroom,JamesKent/adarkroom,as02700/adarkroom,snazzysano/snazzysano.github.io,doublespeakgames/adarkroom,purplemilk/adarkroom,kaisyu/adarkroom,asteri0n/adarkroom,purplemilk/adarkroom,bdorer/adarkroom,Tedko/adarkroom,snazzysano/snazzysano.github.io,crafteverywhere/adarkroom,kaisyu/adarkroom,marty13612/darkroom,gerred/adarkroom,gerred/adarkroom,acutesoftware/adarkroom,marty13612/darkroom,Tedko/adarkroom,asteri0n/adarkroom,snazzysanoj/snazzysanoj.github.io,Continuities/adarkroom,crafteverywhere/adarkroom,DDReaper/adarkroom,snazzysano/adarkroom,Pioneer11X/adarkroom,kaisyu/adarkroom,ikoan/adarkroom,Razynoir/adarkroom,acutesoftware/adarkroom,Bleyddyn/adarkroom,doublespeakgames/adarkroom,fsladkey/adarkroom,Bleyddyn/adarkroom | ---
+++
@@ -4,7 +4,7 @@
'es':'español',
'fr':'français',
'it':'italiano',
- 'ja':'日本',
+ 'ja':'日本語',
'ko':'한국어',
'pl':'polski',
'pt':'português', |
e50830b890710e142a25ecc6b31145fc11ebe3c1 | lib/config.js | lib/config.js | /**
* In-Memory configuration storage
*/
let Config = {
isInitialized: false,
debug: true,
overridePublishFunction: true,
mutationDefaults: {
pushToRedis: true,
optimistic: true,
},
passConfigDown: false,
redis: {
port: 6379,
host: '127.0.0.1',
},
globalRedisPrefix: '',
retryIntervalMs: 10000,
externalRedisPublisher: false,
redisExtras: {
retry_strategy: function(options) {
return Config.retryIntervalMs;
// reconnect after
// return Math.min(options.attempt * 100, 30000);
},
events: {
end(err) {
console.error('RedisOplog - Connection to redis ended');
},
error(err) {
console.error(
`RedisOplog - An error occured: \n`,
JSON.stringify(err)
);
},
connect(err) {
if (!err) {
console.log(
'RedisOplog - Established connection to redis.'
);
} else {
console.error(
'RedisOplog - There was an error when connecting to redis',
JSON.stringify(err)
);
}
},
reconnecting(err) {
if (err) {
console.error(
'RedisOplog - There was an error when re-connecting to redis',
JSON.stringify(err)
);
}
},
},
},
};
export default Config;
| /**
* In-Memory configuration storage
*/
let Config = {
isInitialized: false,
debug: false,
overridePublishFunction: true,
mutationDefaults: {
pushToRedis: true,
optimistic: true,
},
passConfigDown: false,
redis: {
port: 6379,
host: '127.0.0.1',
},
globalRedisPrefix: '',
retryIntervalMs: 10000,
externalRedisPublisher: false,
redisExtras: {
retry_strategy: function(options) {
return Config.retryIntervalMs;
// reconnect after
// return Math.min(options.attempt * 100, 30000);
},
events: {
end(err) {
console.error('RedisOplog - Connection to redis ended');
},
error(err) {
console.error(
`RedisOplog - An error occured: \n`,
JSON.stringify(err)
);
},
connect(err) {
if (!err) {
console.log(
'RedisOplog - Established connection to redis.'
);
} else {
console.error(
'RedisOplog - There was an error when connecting to redis',
JSON.stringify(err)
);
}
},
reconnecting(err) {
if (err) {
console.error(
'RedisOplog - There was an error when re-connecting to redis',
JSON.stringify(err)
);
}
},
},
},
};
export default Config;
| Change default debug behavior back to false | Change default debug behavior back to false
| JavaScript | mit | cult-of-coders/redis-oplog | ---
+++
@@ -3,7 +3,7 @@
*/
let Config = {
isInitialized: false,
- debug: true,
+ debug: false,
overridePublishFunction: true,
mutationDefaults: {
pushToRedis: true, |
4d56e2224c0292d1989e1c5c2a6d512925fa983a | lib/writer.js | lib/writer.js | var _ = require('underscore'),
fs = require('fs');
function Writer() {
function gen(templates, numSegments, params, outFile, cb) {
var stream = fs.createWriteStream(outFile,
{ flags: 'w', encoding: 'utf-8' }),
segmentId = 0;
stream.on('error', function (err) {
console.error('Error: ' + err);
});
stream.on('close', function () {
cb();
});
stream.write(templates.header);
function _writeSegment(segmentId) {
var segment = templates.segment;
params.segment_id = segmentId;
function _apply(param) {
segment = segment.replace(new RegExp('{' + param + '}', 'g'), params[param]);
}
_.keys(params).forEach(_apply);
stream.write(segment);
}
while (segmentId++ < numSegments) {
_writeSegment(segmentId);
}
stream.end(templates.footer);
}
return {
gen: gen
};
}
exports.Writer = Writer; | var _ = require('underscore'),
fs = require('fs');
function Writer() {
function gen(templates, numSegments, params, outFile, cb) {
var stream = fs.createWriteStream(outFile,
{ flags: 'w', encoding: 'utf-8' }),
segmentId = 0;
stream.on('error', function (err) {
console.error('Error: ' + err);
});
stream.on('close', function () {
cb();
});
function _apply(text, params) {
_.keys(params).forEach(function (param) {
text = text.replace(new RegExp('{' + param + '}', 'g'), params[param]);
});
return text;
}
stream.write(_apply(templates.header, params));
while (segmentId++ < numSegments) {
var segmentParams = _.clone(params);
segmentParams.segment_id = segmentId;
stream.write(_apply(templates.segment, segmentParams));
}
stream.end(_apply(templates.footer, params));
}
return {
gen: gen
};
}
exports.Writer = Writer; | Apply params in header and footer. | Apply params in header and footer.
| JavaScript | mit | cliffano/datagen | ---
+++
@@ -16,25 +16,22 @@
cb();
});
- stream.write(templates.header);
-
- function _writeSegment(segmentId) {
- var segment = templates.segment;
- params.segment_id = segmentId;
-
- function _apply(param) {
- segment = segment.replace(new RegExp('{' + param + '}', 'g'), params[param]);
- }
-
- _.keys(params).forEach(_apply);
- stream.write(segment);
+ function _apply(text, params) {
+ _.keys(params).forEach(function (param) {
+ text = text.replace(new RegExp('{' + param + '}', 'g'), params[param]);
+ });
+ return text;
}
+ stream.write(_apply(templates.header, params));
+
while (segmentId++ < numSegments) {
- _writeSegment(segmentId);
+ var segmentParams = _.clone(params);
+ segmentParams.segment_id = segmentId;
+ stream.write(_apply(templates.segment, segmentParams));
}
- stream.end(templates.footer);
+ stream.end(_apply(templates.footer, params));
}
return { |
7618f5f225ed9a0c87e37fc941fb1a045838372b | null-prune.js | null-prune.js | /* eslint-env amd */
(function (name, definition) {
if (typeof define === 'function') {
// AMD
define(definition)
} else if (typeof module !== 'undefined' && module.exports) {
// Node.js
module.exports = definition()
} else {
// Browser
window[name] = definition()
}
})('nullPrune', function () {
function hasOwnProperty (obj, property) {
return Object.prototype.hasOwnProperty.call(obj, property)
}
function isObject (input) {
return input && (typeof input === 'object')
}
function keys (obj) {
var key
var ownKeys = []
for (key in obj) {
if (hasOwnProperty(obj, key)) {
ownKeys.push(key)
}
}
return ownKeys
}
function nullPrune (inputObject, context) {
var objectKey = context.objectKey
var parentObject = context.parentObject
keys(inputObject).forEach(function (key) {
var node = inputObject[key]
if (isObject(node)) {
nullPrune(node, {
objectKey: key,
parentObject: inputObject
})
} else if (node == null) {
delete inputObject[key]
}
})
if (parentObject && keys(inputObject).length === 0) {
delete parentObject[objectKey]
}
}
return function (inputObject) {
if (!isObject(inputObject)) {
return inputObject
}
nullPrune(inputObject, {})
return inputObject
}
})
| /* eslint-env amd */
(function (name, definition) {
if (typeof define === 'function') {
// AMD
define(definition)
} else if (typeof module !== 'undefined' && module.exports) {
// Node.js
module.exports = definition()
} else {
// Browser
window[name] = definition()
}
})('nullPrune', function () {
function isObject (input) {
return input && (typeof input === 'object')
}
function ownKeys (obj) {
var key
var ownKeys = []
var hasOwnProperty = Object.prototype.hasOwnProperty
for (key in obj) {
if (hasOwnProperty.call(obj, key)) {
ownKeys.push(key)
}
}
return ownKeys
}
function nullPrune (inputObject, context) {
var objectKey = context.objectKey
var parentObject = context.parentObject
var keys = ownKeys(inputObject)
var k
var key
var node
for (k in keys) {
key = keys[k]
node = inputObject[key]
if (isObject(node)) {
nullPrune(node, {
objectKey: key,
parentObject: inputObject
})
} else if (node == null) {
delete inputObject[key]
}
}
if (parentObject && ownKeys(inputObject).length === 0) {
delete parentObject[objectKey]
}
}
return function (inputObject) {
if (!isObject(inputObject)) {
return inputObject
}
nullPrune(inputObject, {})
return inputObject
}
})
| Make it compatible with old browsers | Make it compatible with old browsers
| JavaScript | apache-2.0 | cskeppstedt/null-prune | ---
+++
@@ -11,20 +11,17 @@
window[name] = definition()
}
})('nullPrune', function () {
- function hasOwnProperty (obj, property) {
- return Object.prototype.hasOwnProperty.call(obj, property)
- }
-
function isObject (input) {
return input && (typeof input === 'object')
}
- function keys (obj) {
+ function ownKeys (obj) {
var key
var ownKeys = []
+ var hasOwnProperty = Object.prototype.hasOwnProperty
for (key in obj) {
- if (hasOwnProperty(obj, key)) {
+ if (hasOwnProperty.call(obj, key)) {
ownKeys.push(key)
}
}
@@ -35,9 +32,14 @@
function nullPrune (inputObject, context) {
var objectKey = context.objectKey
var parentObject = context.parentObject
+ var keys = ownKeys(inputObject)
+ var k
+ var key
+ var node
- keys(inputObject).forEach(function (key) {
- var node = inputObject[key]
+ for (k in keys) {
+ key = keys[k]
+ node = inputObject[key]
if (isObject(node)) {
nullPrune(node, {
@@ -47,9 +49,9 @@
} else if (node == null) {
delete inputObject[key]
}
- })
+ }
- if (parentObject && keys(inputObject).length === 0) {
+ if (parentObject && ownKeys(inputObject).length === 0) {
delete parentObject[objectKey]
}
} |
2a7b7d5fac3e7024af573dc21028bb29e7a05efd | test/setup.js | test/setup.js | steal('can/util/mvc.js')
.then('funcunit/qunit',
'can/util/fixture')
.then(function() {
var oldmodule = window.module;
// Set the test timeout to five minutes
QUnit.config.hidepassed = true;
QUnit.config.testTimeout = 300000;
if ( console && console.log ) {
QUnit.log(function( details ) {
if ( ! details.result ) {
console.log( "FAILURE: ", details.result, details.message );
}
});
}
if(window.TESTINGLIBRARY !== undefined) {
window.module = function(name, testEnvironment) {
oldmodule(TESTINGLIBRARY + '/' + name, testEnvironment);
}
}
})
| steal('can/util/mvc.js')
.then('funcunit/qunit',
'can/util/fixture')
.then(function() {
var oldmodule = window.module;
// Set the test timeout to five minutes
QUnit.config.hidepassed = true;
QUnit.config.testTimeout = 300000;
if ( typeof console !== "undefined" && console.log ) {
QUnit.log(function( details ) {
if ( ! details.result ) {
console.log( "FAILURE: ", details.result, details.message );
}
});
}
if(window.TESTINGLIBRARY !== undefined) {
window.module = function(name, testEnvironment) {
oldmodule(TESTINGLIBRARY + '/' + name, testEnvironment);
}
}
})
| Fix to console check causing breaks in IE. | Fix to console check causing breaks in IE.
| JavaScript | mit | patrick-steele-idem/canjs,cohuman/canjs,scorphus/canjs,rasjani/canjs,rjgotten/canjs,patrick-steele-idem/canjs,juristr/canjs,azazel75/canjs,rasjani/canjs,UXsree/canjs,mindscratch/canjs,sporto/canjs,dispatchrabbi/canjs,dimaf/canjs,rasjani/canjs,cohuman/canjs,jebaird/canjs,Psykoral/canjs,scorphus/canjs,schmod/canjs,airhadoken/canjs,beno/canjs,Psykoral/canjs,mindscratch/canjs,gsmeets/canjs,sporto/canjs,shiftplanning/canjs,sporto/canjs,thecountofzero/canjs,thecountofzero/canjs,thomblake/canjs,WearyMonkey/canjs,patrick-steele-idem/canjs,yusufsafak/canjs,dispatchrabbi/canjs,beno/canjs,azazel75/canjs,WearyMonkey/canjs,tracer99/canjs,tracer99/canjs,ackl/canjs,gsmeets/canjs,beno/canjs,airhadoken/canjs,juristr/canjs,rjgotten/canjs,cohuman/canjs,shiftplanning/canjs,whitecolor/canjs,yusufsafak/canjs,janza/canjs,tracer99/canjs,rjgotten/canjs,bitovi/canjs,jebaird/canjs,Psykoral/canjs,asavoy/canjs,whitecolor/canjs,bitovi/canjs,UXsree/canjs,ackl/canjs,ackl/canjs,dimaf/canjs,WearyMonkey/canjs,schmod/canjs,bitovi/canjs,Psykoral/canjs,rjgotten/canjs,gsmeets/canjs,janza/canjs,jebaird/canjs,rasjani/canjs,whitecolor/canjs,schmod/canjs,bitovi/canjs,thomblake/canjs,asavoy/canjs | ---
+++
@@ -7,7 +7,7 @@
// Set the test timeout to five minutes
QUnit.config.hidepassed = true;
QUnit.config.testTimeout = 300000;
- if ( console && console.log ) {
+ if ( typeof console !== "undefined" && console.log ) {
QUnit.log(function( details ) {
if ( ! details.result ) {
console.log( "FAILURE: ", details.result, details.message ); |
6720ea61038cf20824fe2b2e1c02db99a569cd3e | lib/variation-matches.js | lib/variation-matches.js | var basename = require('path').basename;
module.exports = variationMatches;
function variationMatches(variations, path) {
var result;
variations.some(function(variation) {
variation.chain.some(function(dir) {
var parts = path.split(new RegExp("/"+dir+"/"));
var found = parts.length > 1;
if (found) result = {
variation: variation,
dir: basename(dir),
file: parts[parts.length-1],
};
return found;
});
});
return result;
}
|
module.exports = variationMatches;
function variationMatches(variations, path) {
var result;
variations.some(function(variation) {
variation.chain.some(function(dir) {
var parts = path.split(new RegExp("/"+dir+"/"));
var found = parts.length > 1;
if (found) result = {
variation: variation,
dir: dir,
file: parts[parts.length-1],
};
return found;
});
});
return result;
}
| Fix variation matches with variations | Fix variation matches with variations
| JavaScript | mit | stephanwlee/mendel,stephanwlee/mendel,yahoo/mendel,yahoo/mendel | ---
+++
@@ -1,4 +1,3 @@
-var basename = require('path').basename;
module.exports = variationMatches;
function variationMatches(variations, path) {
@@ -9,7 +8,7 @@
var found = parts.length > 1;
if (found) result = {
variation: variation,
- dir: basename(dir),
+ dir: dir,
file: parts[parts.length-1],
};
return found; |
a11095a4d2b16822d79c3cea0500849fbbfc9fd0 | server/data/Movie.js | server/data/Movie.js | const mongoose = require('mongoose')
const uniqueValidator = require('mongoose-unique-validator')
const paginate = require('mongoose-paginate')
const requiredValidationMessage = '{PATH} is required'
let movieSchema = mongoose.Schema({
title: { type: String, required: requiredValidationMessage, trim: true },
image: [{ path: String, alt: String, title: String }],
year: { type: String },
rating: { type: Number, default: 0 },
description: { type: String, default: '' },
cast: [{ type: String, default: [] }],
categories: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Category', required: requiredValidationMessage }],
releaseDate: { type: Date, default: Date.now }
}, {
timestamps: true
})
movieSchema.index({ title: 1, year: 1 })
movieSchema.plugin(uniqueValidator)
movieSchema.plugin(paginate)
mongoose.model('Movie', movieSchema)
| const mongoose = require('mongoose')
const uniqueValidator = require('mongoose-unique-validator')
const paginate = require('mongoose-paginate')
const requiredValidationMessage = '{PATH} is required'
let movieSchema = mongoose.Schema({
title: { type: String, required: requiredValidationMessage, trim: true },
image: [{ path: String, alt: String, title: String }],
rating: { type: Number, default: 0 },
description: { type: String, default: '' },
cast: [{ type: String, default: [] }],
categories: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Category', required: requiredValidationMessage }],
releaseDate: { type: Date, default: Date.now }
}, {
timestamps: true,
toObject: { virtuals: true },
toJSON: { virtuals: true }
})
movieSchema
.virtual('year')
.get(function () {
return this.releaseDate.getFullYear()
})
movieSchema.index({ title: 1, year: 1 })
movieSchema.plugin(uniqueValidator)
movieSchema.plugin(paginate)
mongoose.model('Movie', movieSchema)
| Change 'year' from persistent to virtual and get from 'releaseDate' | Change 'year' from persistent to virtual and get from 'releaseDate'
| JavaScript | mit | iliandj/express-architecture,iliandj/express-architecture | ---
+++
@@ -6,15 +6,22 @@
let movieSchema = mongoose.Schema({
title: { type: String, required: requiredValidationMessage, trim: true },
image: [{ path: String, alt: String, title: String }],
- year: { type: String },
rating: { type: Number, default: 0 },
description: { type: String, default: '' },
cast: [{ type: String, default: [] }],
categories: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Category', required: requiredValidationMessage }],
releaseDate: { type: Date, default: Date.now }
}, {
- timestamps: true
+ timestamps: true,
+ toObject: { virtuals: true },
+ toJSON: { virtuals: true }
})
+
+movieSchema
+ .virtual('year')
+ .get(function () {
+ return this.releaseDate.getFullYear()
+ })
movieSchema.index({ title: 1, year: 1 })
movieSchema.plugin(uniqueValidator) |
9d2deacd0ee28da9ae78dc16f7174d3f5d593b32 | src/apps/global-nav-items.js | src/apps/global-nav-items.js | const fs = require('fs')
const path = require('path')
const { compact, sortBy, concat, includes } = require('lodash')
const config = require('../config')
const urls = require('../lib/urls')
const subApps = fs.readdirSync(__dirname)
const APP_GLOBAL_NAV_ITEMS = compact(
subApps.map((subAppDir) => {
const constantsPath = path.join(__dirname, subAppDir, 'constants.js')
if (
!fs.existsSync(constantsPath) ||
includes(constantsPath, 'propositions')
) {
return null
}
return require(constantsPath).GLOBAL_NAV_ITEM
})
)
const SORTED_APP_GLOBAL_NAV_ITEMS = sortBy(
APP_GLOBAL_NAV_ITEMS,
(globalNavItem) => globalNavItem.order
)
const GLOBAL_NAV_ITEMS = concat(
SORTED_APP_GLOBAL_NAV_ITEMS,
{
path: config.performanceDashboardsUrl,
label: 'MI dashboards',
key: 'datahub-mi',
},
{
path: urls.external.findExporters(),
label: 'Find exporters',
key: 'find-exporters',
}
)
/**
* Required for querying access to apps
*/
module.exports = GLOBAL_NAV_ITEMS
| const fs = require('fs')
const path = require('path')
const { compact, sortBy, concat, includes } = require('lodash')
const urls = require('../lib/urls')
const subApps = fs.readdirSync(__dirname)
const APP_GLOBAL_NAV_ITEMS = compact(
subApps.map((subAppDir) => {
const constantsPath = path.join(__dirname, subAppDir, 'constants.js')
if (
!fs.existsSync(constantsPath) ||
includes(constantsPath, 'propositions')
) {
return null
}
return require(constantsPath).GLOBAL_NAV_ITEM
})
)
const SORTED_APP_GLOBAL_NAV_ITEMS = sortBy(
APP_GLOBAL_NAV_ITEMS,
(globalNavItem) => globalNavItem.order
)
const GLOBAL_NAV_ITEMS = concat(SORTED_APP_GLOBAL_NAV_ITEMS, {
path: urls.external.findExporters(),
label: 'Find exporters',
key: 'find-exporters',
})
/**
* Required for querying access to apps
*/
module.exports = GLOBAL_NAV_ITEMS
| Remove deprecated MI site from GLOBAL_NAV_ITEMS | Remove deprecated MI site from GLOBAL_NAV_ITEMS
| JavaScript | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -2,7 +2,6 @@
const path = require('path')
const { compact, sortBy, concat, includes } = require('lodash')
-const config = require('../config')
const urls = require('../lib/urls')
const subApps = fs.readdirSync(__dirname)
@@ -26,19 +25,11 @@
APP_GLOBAL_NAV_ITEMS,
(globalNavItem) => globalNavItem.order
)
-const GLOBAL_NAV_ITEMS = concat(
- SORTED_APP_GLOBAL_NAV_ITEMS,
- {
- path: config.performanceDashboardsUrl,
- label: 'MI dashboards',
- key: 'datahub-mi',
- },
- {
- path: urls.external.findExporters(),
- label: 'Find exporters',
- key: 'find-exporters',
- }
-)
+const GLOBAL_NAV_ITEMS = concat(SORTED_APP_GLOBAL_NAV_ITEMS, {
+ path: urls.external.findExporters(),
+ label: 'Find exporters',
+ key: 'find-exporters',
+})
/**
* Required for querying access to apps |
08ca837aca83e7c8cab88244f69db3cdac4de0e0 | components/utils/testing.js | components/utils/testing.js | import React from 'react';
import TestUtils from 'react-addons-test-utils';
export default {
renderComponent(Component, props = {}, state = {}) {
const component = TestUtils.renderIntoDocument(<Component {...props} />);
if (state !== {}) { component.setState(state); }
return component;
},
shallowRenderComponent(component, props, ...children) {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(component, props, children.length > 1
? children
: children[0],
));
return shallowRenderer.getRenderOutput();
},
};
| import React from 'react';
import TestUtils from 'react-dom/test-utils';
export default {
renderComponent(Component, props = {}, state = {}) {
const component = TestUtils.renderIntoDocument(<Component {...props} />);
if (state !== {}) { component.setState(state); }
return component;
},
shallowRenderComponent(component, props, ...children) {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(component, props, children.length > 1
? children
: children[0],
));
return shallowRenderer.getRenderOutput();
},
};
| Update tests to use react-dom/test-utils | Update tests to use react-dom/test-utils
| JavaScript | mit | react-toolbox/react-toolbox,react-toolbox/react-toolbox,react-toolbox/react-toolbox | ---
+++
@@ -1,5 +1,5 @@
import React from 'react';
-import TestUtils from 'react-addons-test-utils';
+import TestUtils from 'react-dom/test-utils';
export default {
renderComponent(Component, props = {}, state = {}) { |
3b0d8f70ba2091d20dc91ea5235c0479a16f2991 | www/app/filters/app.filters.number.js | www/app/filters/app.filters.number.js | 'use strict';
/*
* Number Filters
*
* In HTML Template Binding
* {{ filter_expression | filter : expression : comparator}}
*
* In JavaScript
* $filter('filter')(array, expression, comparator)
*
* https://docs.angularjs.org/api/ng/filter/filter
*/
var app = angular.module('app.filters.number', []);
app.filter("formatPrice", function () {
return function (value) {
if (!value) {
return value;
}
return '$' + value;
};
});
app.filter("formatMySQLDate", function () {
return function (value) {
if (!value) {
return value;
}
return moment(value, 'YYYY-MM-DD HH:mm:ss').format('M/D/YYYY h:mm a');
};
}); | 'use strict';
/*
* Number Filters
*
* In HTML Template Binding
* {{ filter_expression | filter : expression : comparator}}
*
* In JavaScript
* $filter('filter')(array, expression, comparator)
*
* https://docs.angularjs.org/api/ng/filter/filter
*/
var app = angular.module('app.filters.number', []);
app.filter("formatPrice", function () {
return function (value) {
if (!value) {
return value;
}
return '$' + value;
};
});
app.filter("formatMySQLDate", function () {
return function (value) {
if (!value) {
return value;
}
return moment(value, 'YYYY-MM-DD HH:mm:ss').tz('America/New_York').format('M/D/YYYY h:mm a');
};
}); | Set the timezone on MySQL formatted dates. | Set the timezone on MySQL formatted dates.
| JavaScript | mit | rachellcarbone/angular-seed,rachellcarbone/angular-seed,rachellcarbone/angular-seed | ---
+++
@@ -28,6 +28,6 @@
if (!value) {
return value;
}
- return moment(value, 'YYYY-MM-DD HH:mm:ss').format('M/D/YYYY h:mm a');
+ return moment(value, 'YYYY-MM-DD HH:mm:ss').tz('America/New_York').format('M/D/YYYY h:mm a');
};
}); |
946eb3a92be4e3452f837130e5053643544ea08b | lib/app.js | lib/app.js | "use strict";
var zlib = require("zlib");
var cors = require("cors"),
express = require("express");
var SyslogFilter = require("./syslog-filter");
module.exports = function(source) {
var app = express();
app.disable('x-powered-by');
app.use(cors());
app.get("/:ps(\\w*)?", function(req, res, next) {
res.header("Content-Type", "text/plain");
// compression
var acceptEncoding = req.headers["accept-encoding"] || "",
options = {
flush: zlib.Z_PARTIAL_FLUSH
};
var src;
if (req.params.ps) {
// process name was provided
src = source.pipe(new SyslogFilter(req.params.ps));
} else {
src = source;
}
if (acceptEncoding.indexOf("gzip") >= 0) {
res.header("Content-Encoding", "gzip");
return src.pipe(zlib.createGzip(options)).pipe(res);
}
if (acceptEncoding.indexOf("deflate") >= 0) {
res.header("Content-Encoding", "deflate");
return src.pipe(zlib.createDeflate(options)).pipe(res);
}
return source.pipe(res);
});
return app;
};
| "use strict";
var stream = require("stream"),
zlib = require("zlib");
var cors = require("cors"),
express = require("express");
var SyslogFilter = require("./syslog-filter");
module.exports = function(nexus) {
var app = express();
app.disable('x-powered-by');
app.use(cors());
app.get("/:ps(\\w*)?", function(req, res, next) {
res.header("Content-Type", "text/plain");
// compression
var acceptEncoding = req.headers["accept-encoding"] || "",
options = {
flush: zlib.Z_PARTIAL_FLUSH
};
var sink = new stream.PassThrough();
if (req.params.ps) {
// process name was provided
console.log("Filtering for", req.params.ps);
sink = sink.pipe(new SyslogFilter(req.params.ps));
}
var response;
if (acceptEncoding.indexOf("gzip") >= 0) {
res.header("Content-Encoding", "gzip");
sink = sink.pipe(zlib.createGzip(options));
} else if (acceptEncoding.indexOf("deflate") >= 0) {
res.header("Content-Encoding", "deflate");
sink = sink.pipe(zlib.createDeflate(options));
}
// don't reassign to sink--we need the stream that's actually plugged into
// nexus
nexus.pipe(sink).pipe(res);
req.on("close", function() {
nexus.unpipe(sink);
});
});
return app;
};
| Unplug client streams when requests end | Unplug client streams when requests end
| JavaScript | isc | mojodna/log-nexus | ---
+++
@@ -1,13 +1,14 @@
"use strict";
-var zlib = require("zlib");
+var stream = require("stream"),
+ zlib = require("zlib");
var cors = require("cors"),
express = require("express");
var SyslogFilter = require("./syslog-filter");
-module.exports = function(source) {
+module.exports = function(nexus) {
var app = express();
app.disable('x-powered-by');
@@ -23,26 +24,31 @@
flush: zlib.Z_PARTIAL_FLUSH
};
- var src;
+ var sink = new stream.PassThrough();
if (req.params.ps) {
// process name was provided
- src = source.pipe(new SyslogFilter(req.params.ps));
- } else {
- src = source;
+ console.log("Filtering for", req.params.ps);
+ sink = sink.pipe(new SyslogFilter(req.params.ps));
}
+
+ var response;
if (acceptEncoding.indexOf("gzip") >= 0) {
res.header("Content-Encoding", "gzip");
- return src.pipe(zlib.createGzip(options)).pipe(res);
+ sink = sink.pipe(zlib.createGzip(options));
+ } else if (acceptEncoding.indexOf("deflate") >= 0) {
+ res.header("Content-Encoding", "deflate");
+ sink = sink.pipe(zlib.createDeflate(options));
}
- if (acceptEncoding.indexOf("deflate") >= 0) {
- res.header("Content-Encoding", "deflate");
- return src.pipe(zlib.createDeflate(options)).pipe(res);
- }
+ // don't reassign to sink--we need the stream that's actually plugged into
+ // nexus
+ nexus.pipe(sink).pipe(res);
- return source.pipe(res);
+ req.on("close", function() {
+ nexus.unpipe(sink);
+ });
});
return app; |
b94e3b3d2060456bd052a3cdde057f48a7e0ca91 | lib/cli.js | lib/cli.js | 'use strict';
var path = require('path'),
opener = require('opener'),
chalk = require('chalk'),
pkg = require('../package.json'),
server = require('./server'),
program = require('commander');
function getConfigPath(config) {
return path.resolve(config);
}
exports.run = function() {
program
.version(pkg.version)
.allowUnknownOption(true)
.option('-p, --port <port>', 'Port to launch server on', 8000)
.option('-h, --hostname <hostname>', 'Hostname to launch server on', 'localhost')
.option('-c, --config <file>', 'Gemini config file', getConfigPath)
.parse(process.argv);
program.testFiles = [].concat(program.args);
server.start(program).then(function(result) {
console.log('GUI is running at %s', chalk.cyan(result.url));
opener(result.url);
}).done();
};
| 'use strict';
var path = require('path'),
opener = require('opener'),
chalk = require('chalk'),
pkg = require('../package.json'),
server = require('./server'),
program = require('commander');
exports.run = function() {
program
.version(pkg.version)
.allowUnknownOption(true)
.option('-p, --port <port>', 'Port to launch server on', 8000)
.option('-h, --hostname <hostname>', 'Hostname to launch server on', 'localhost')
.option('-c, --config <file>', 'Gemini config file', path.resolve)
.parse(process.argv);
program.on('--help', function() {
console.log('Also you can override gemini config options.');
console.log('See all possible options in gemini documentation.');
});
program.testFiles = [].concat(program.args);
server.start(program).then(function(result) {
console.log('GUI is running at %s', chalk.cyan(result.url));
opener(result.url);
}).done();
};
| Add notification about gemini config overriding | Add notification about gemini config overriding
| JavaScript | mit | gemini-testing/gemini-gui,gemini-testing/gemini-gui | ---
+++
@@ -6,18 +6,19 @@
server = require('./server'),
program = require('commander');
-function getConfigPath(config) {
- return path.resolve(config);
-}
-
exports.run = function() {
program
.version(pkg.version)
.allowUnknownOption(true)
.option('-p, --port <port>', 'Port to launch server on', 8000)
.option('-h, --hostname <hostname>', 'Hostname to launch server on', 'localhost')
- .option('-c, --config <file>', 'Gemini config file', getConfigPath)
+ .option('-c, --config <file>', 'Gemini config file', path.resolve)
.parse(process.argv);
+
+ program.on('--help', function() {
+ console.log('Also you can override gemini config options.');
+ console.log('See all possible options in gemini documentation.');
+ });
program.testFiles = [].concat(program.args);
server.start(program).then(function(result) { |
5ad85f1120a19885ad11ade6a607542b6ea2e3ea | src/components/Logo/index.js | src/components/Logo/index.js | import React from 'react';
import SVGInline from 'react-svg-inline';
import svg from '../../static/logo.svg';
const Logo = (props) => {
return (
<SVGInline
svg={svg}
desc={props.desc}
width={props.width}
height={props.height}
/>
);
};
Logo.propTypes = {
desc: React.PropTypes.string,
width: React.PropTypes.string,
height: React.PropTypes.string,
};
Logo.defaultProps = {
desc: 'devnews logo',
width: 'auto',
height: '20',
};
export default Logo;
| import React from 'react';
import SVGInline from 'react-svg-inline';
import svg from '../../static/logo.svg';
const Logo = (props) => {
return (
<SVGInline
svg={svg}
desc={props.desc}
width={props.width}
height={props.height}
cleanup={['width', 'height']}
/>
);
};
Logo.propTypes = {
desc: React.PropTypes.string,
width: React.PropTypes.string,
height: React.PropTypes.string,
};
Logo.defaultProps = {
desc: 'devnews logo',
width: 'auto',
height: '20px',
};
export default Logo;
| Fix weird logo size on Firefox | Fix weird logo size on Firefox
| JavaScript | mit | devnews/web,devnews/web | ---
+++
@@ -9,6 +9,7 @@
desc={props.desc}
width={props.width}
height={props.height}
+ cleanup={['width', 'height']}
/>
);
};
@@ -22,7 +23,7 @@
Logo.defaultProps = {
desc: 'devnews logo',
width: 'auto',
- height: '20',
+ height: '20px',
};
export default Logo; |
2cb117bd56c5508c4abf885c6b8ed4d4c043462a | src/components/search_bar.js | src/components/search_bar.js | import React from 'react'
//class-based component (ES6)
class SearchBar extends React.Component {
render() { //method definition in ES6
return <input />;
}
}
export default SearchBar; | import React, { Component } from 'react'
//class-based component (ES6)
class SearchBar extends Component {
render() { //method definition in ES6
return <input />;
}
}
export default SearchBar; | Refactor to ES6 syntactic sugar | Refactor to ES6 syntactic sugar
| JavaScript | mit | phirefly/react-redux-starter,phirefly/react-redux-starter | ---
+++
@@ -1,7 +1,7 @@
-import React from 'react'
+import React, { Component } from 'react'
//class-based component (ES6)
-class SearchBar extends React.Component {
+class SearchBar extends Component {
render() { //method definition in ES6
return <input />;
} |
e0c685d096bac50e01946d43ab1c7c034ae68d98 | src/config/globalSettings.js | src/config/globalSettings.js | /**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration:500,
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'compose',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
| /**
* Global settings that do not change in a production environment
*/
if (typeof window === 'undefined') {
// For tests
global.window = {}
}
window.appSettings = {
boardOuterMargin: 30,
boardPostMargin: 25,
// The following settings can't be changed explcitly.
// Needs to be kept in sync with src/styles/base/variables
headerHeight: 60,
drawerWidth: 250,
drawerAnimationDuration: 500,
homeViewID: 'HomeView',
contentViewID: 'ContentView',
settingsViewID: 'SettingsView',
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
navbarCompose: 'ios-plus-outline',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more',
}
}
| Add view ID's and board layout options | feat(appSettings): Add view ID's and board layout options
| JavaScript | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -8,16 +8,25 @@
}
window.appSettings = {
+ boardOuterMargin: 30,
+ boardPostMargin: 25,
+
+ // The following settings can't be changed explcitly.
+ // Needs to be kept in sync with src/styles/base/variables
headerHeight: 60,
drawerWidth: 250,
- drawerAnimationDuration:500,
+ drawerAnimationDuration: 500,
+
+ homeViewID: 'HomeView',
+ contentViewID: 'ContentView',
+ settingsViewID: 'SettingsView',
icons: {
navbarArchive: 'ios-box',
navbarEye: 'ios-eye',
navbarChevron: 'ios-arrow-right',
navbarSearch: 'ios-search-strong',
- navbarCompose: 'compose',
+ navbarCompose: 'ios-plus-outline',
navbarRefresh: 'ios-reload',
threadPostMenu: 'more', |
382a847bbc4b483829e3ca3e8fb4169cc6649b92 | src/menu-item-content/menu-item-content-directive.js | src/menu-item-content/menu-item-content-directive.js | 'use strict';
angular.module('eehMenuBs3').directive('eehMenuBs3MenuItemContent', MenuItemContentDirective);
/** @ngInject */
function MenuItemContentDirective(eehNavigation) {
return {
restrict: 'A',
scope: {
menuItem: '=eehMenuBs3MenuItemContent'
},
templateUrl: 'template/eeh-menu/menu-item-content/menu-item-content.html',
link: function (scope) {
scope.iconBaseClass = function () {
return eehNavigation.iconBaseClass();
};
}
};
}
| 'use strict';
angular.module('eehMenuBs3').directive('eehMenuBs3MenuItemContent', MenuItemContentDirective);
/** @ngInject */
function MenuItemContentDirective(eehMenu) {
return {
restrict: 'A',
scope: {
menuItem: '=eehMenuBs3MenuItemContent'
},
templateUrl: 'template/eeh-menu-bs3/menu-item-content/menu-item-content.html',
link: function (scope) {
scope.iconBaseClass = function () {
return eehMenu.iconBaseClass();
};
}
};
}
| Fix names and paths in menu item content directive | Fix names and paths in menu item content directive
| JavaScript | mit | MenuJS/eeh-menu-bs3,MenuJS/eeh-menu-bs3 | ---
+++
@@ -2,16 +2,16 @@
angular.module('eehMenuBs3').directive('eehMenuBs3MenuItemContent', MenuItemContentDirective);
/** @ngInject */
-function MenuItemContentDirective(eehNavigation) {
+function MenuItemContentDirective(eehMenu) {
return {
restrict: 'A',
scope: {
menuItem: '=eehMenuBs3MenuItemContent'
},
- templateUrl: 'template/eeh-menu/menu-item-content/menu-item-content.html',
+ templateUrl: 'template/eeh-menu-bs3/menu-item-content/menu-item-content.html',
link: function (scope) {
scope.iconBaseClass = function () {
- return eehNavigation.iconBaseClass();
+ return eehMenu.iconBaseClass();
};
}
}; |
9846027ab68bccc2eb2ccfacc5a3f7c3a84c6793 | alien4cloud-ui/yo/app/scripts/services/rest_technical_error_interceptor.js | alien4cloud-ui/yo/app/scripts/services/rest_technical_error_interceptor.js | 'use strict';
angular.module('alienUiApp').factory('restTechnicalErrorInterceptor', ['$rootScope', '$q', '$window', 'toaster', '$translate',
function($rootScope, $q, $window, toaster, $translate) {
var extractErrorMessage = function(rejection) {
if (UTILS.isDefinedAndNotNull(rejection.data)) {
if (UTILS.isDefinedAndNotNull(rejection.data.error)) {
var error = rejection.data.error;
// Redirect to homepage when the user is not authenticated
if (error.code === 100) {
$window.location.href = '/';
} else {
return {
status: rejection.status,
data: 'ERRORS.' + error.code
};
}
} else {
// Error not defined ==> return the data part
return {
status: rejection.status,
data: rejection.data
};
}
} else {
// rejection.data not defined ==> unknown error
return {
status: rejection.status,
data: 'ERRORS.UNKNOWN'
};
}
};
return {
'responseError': function(rejection) {
var error = extractErrorMessage(rejection);
// Display the toaster message on top with 4000 ms display timeout
// Don't shot toaster for "tour" guides
if (error.data.indexOf('/data/guides') < 0) {
toaster.pop('error', $translate('ERRORS.INTERNAL') + ' - ' + error.status, $translate(error.data), 4000, 'trustedHtml', null);
}
return $q.reject(rejection);
}
};
}
]);
| 'use strict';
angular.module('alienUiApp').factory('restTechnicalErrorInterceptor', ['$rootScope', '$q', '$window', 'toaster', '$translate',
function($rootScope, $q, $window, toaster, $translate) {
var extractErrorMessage = function(rejection) {
if (UTILS.isDefinedAndNotNull(rejection.data)) {
if (UTILS.isDefinedAndNotNull(rejection.data.error)) {
var error = rejection.data.error;
// Redirect to homepage when the user is not authenticated
if (error.code === 100) {
$window.location.href = '/';
} else {
return {
status: rejection.status,
data: 'ERRORS.' + error.code
};
}
} else {
// Error not defined ==> return the data part
return {
status: rejection.status,
data: rejection.data
};
}
} else {
// rejection.data not defined ==> unknown error
return {
status: rejection.status,
data: 'ERRORS.UNKNOWN'
};
}
};
return {
'responseError': function(rejection) {
var error = extractErrorMessage(rejection);
// Display the toaster message on top with 4000 ms display timeout
// Don't shot toaster for "tour" guides
if (rejection.config.url.indexOf('data/guides') < 0) {
toaster.pop('error', $translate('ERRORS.INTERNAL') + ' - ' + error.status, $translate(error.data), 4000, 'trustedHtml', null);
}
return $q.reject(rejection);
}
};
}
]);
| Fix double error message when "tour" is missing | Fix double error message when "tour" is missing
| JavaScript | apache-2.0 | ahgittin/alien4cloud,broly-git/alien4cloud,ahgittin/alien4cloud,PierreLemordant/alien4cloud,broly-git/alien4cloud,broly-git/alien4cloud,PierreLemordant/alien4cloud,ngouagna/alien4cloud,loicalbertin/alien4cloud,loicalbertin/alien4cloud,broly-git/alien4cloud,loicalbertin/alien4cloud,ngouagna/alien4cloud,igorng/alien4cloud,OresteVisari/alien4cloud,san-tak/alien4cloud,alien4cloud/alien4cloud,igorng/alien4cloud,OresteVisari/alien4cloud,PierreLemordant/alien4cloud,san-tak/alien4cloud,igorng/alien4cloud,ngouagna/alien4cloud,xdegenne/alien4cloud,OresteVisari/alien4cloud,alien4cloud/alien4cloud,igorng/alien4cloud,loicalbertin/alien4cloud,ngouagna/alien4cloud,xdegenne/alien4cloud,san-tak/alien4cloud,alien4cloud/alien4cloud,san-tak/alien4cloud,xdegenne/alien4cloud,PierreLemordant/alien4cloud,OresteVisari/alien4cloud,alien4cloud/alien4cloud,xdegenne/alien4cloud,ahgittin/alien4cloud,ahgittin/alien4cloud | ---
+++
@@ -37,7 +37,7 @@
var error = extractErrorMessage(rejection);
// Display the toaster message on top with 4000 ms display timeout
// Don't shot toaster for "tour" guides
- if (error.data.indexOf('/data/guides') < 0) {
+ if (rejection.config.url.indexOf('data/guides') < 0) {
toaster.pop('error', $translate('ERRORS.INTERNAL') + ' - ' + error.status, $translate(error.data), 4000, 'trustedHtml', null);
}
return $q.reject(rejection); |
8f5b0dcd02f2b5b81139cba0c757a33d37204070 | app/js/arethusa.core/directives/lang_specific.js | app/js/arethusa.core/directives/lang_specific.js | 'use strict';
angular.module('arethusa.core').directive('langSpecific', [
'languageSettings',
function(languageSettings) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var settings = languageSettings.getFor('treebank');
if (settings) {
element.attr('lang', settings.lang);
element.attr('dir', settings.leftToRight ? 'ltr' : 'rtl');
element.css('font-family', settings.font);
}
}
};
}
]);
| 'use strict';
angular.module('arethusa.core').directive('langSpecific', [
'languageSettings',
function(languageSettings) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var settings = languageSettings.getFor('treebank') || languageSettings.getFor('hebrewMorph');
if (settings) {
element.attr('lang', settings.lang);
element.attr('dir', settings.leftToRight ? 'ltr' : 'rtl');
element.css('font-family', settings.font);
}
}
};
}
]);
| Check hebrew document in langSpecific | Check hebrew document in langSpecific
Very troublesome to hardcode this - we have to defer a decision on this
a little longer.
| JavaScript | mit | Masoumeh/arethusa,PonteIneptique/arethusa,Masoumeh/arethusa,alpheios-project/arethusa,PonteIneptique/arethusa,fbaumgardt/arethusa,latin-language-toolkit/arethusa,latin-language-toolkit/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa | ---
+++
@@ -6,7 +6,7 @@
return {
restrict: 'A',
link: function(scope, element, attrs) {
- var settings = languageSettings.getFor('treebank');
+ var settings = languageSettings.getFor('treebank') || languageSettings.getFor('hebrewMorph');
if (settings) {
element.attr('lang', settings.lang);
element.attr('dir', settings.leftToRight ? 'ltr' : 'rtl'); |
37267f761c06cd6ff101e96a484c8f61b017fb5a | server/config/config.js | server/config/config.js | var path = require('path');
var rootPath = path.normalize(__dirname + '/../../');
module.exports = {
local: {
baseUrl: 'http://localhost:3051',
db: 'mongodb://localhost/rp_local',
rootPath: rootPath,
port: process.env.PORT || 3051
},
staging : {
baseUrl: 'http://dev.resourceprojects.org',
//db: '@aws-us-east-1-portal.14.dblayer.com:10669/rp_dev?ssl=true',
db: '@aws-us-east-1-portal.14.dblayer.com:10669,aws-us-east-1-portal.13.dblayer.com:10499/rp_dev?ssl=true',
rootPath: rootPath,
port: process.env.PORT || 80
}
};
| var path = require('path');
var rootPath = path.normalize(__dirname + '/../../');
module.exports = {
local: {
baseUrl: 'http://localhost:3030',
db: 'mongodb://localhost/rp_local',
rootPath: rootPath,
port: process.env.PORT || 3030
},
staging : {
baseUrl: 'http://dev.resourceprojects.org',
//db: '@aws-us-east-1-portal.14.dblayer.com:10669/rp_dev?ssl=true',
db: '@aws-us-east-1-portal.14.dblayer.com:10669,aws-us-east-1-portal.13.dblayer.com:10499/rp_dev?ssl=true',
rootPath: rootPath,
port: process.env.PORT || 80
}
};
| Add to download links ng-csv | Add to download links ng-csv
| JavaScript | mit | NRGI/rp-org-frontend,NRGI/rp-org-frontend | ---
+++
@@ -3,10 +3,10 @@
module.exports = {
local: {
- baseUrl: 'http://localhost:3051',
+ baseUrl: 'http://localhost:3030',
db: 'mongodb://localhost/rp_local',
rootPath: rootPath,
- port: process.env.PORT || 3051
+ port: process.env.PORT || 3030
},
staging : {
baseUrl: 'http://dev.resourceprojects.org', |
38ed99078ce7ed579dd72eb1fd493ce756473b59 | server/config/routes.js | server/config/routes.js | module.exports = function(app, express) {
// Facebook OAuth
app.get('/auth/facebook', function(req, res) {
res.send('Facebook OAuth');
});
app.get('/auth/facebook/callback', function(req, res) {
res.send('Callback for Facebook OAuth');
});
// User Creation
app.route('/api/users')
.post(function(req, res) {
res.send('Create a new user');
})
.put(function(req, res) {
res.send('Update user info');
})
.delete(function(req, res) {
res.send('Delete the user');
});
}; | module.exports = function(app, express) {
// Facebook OAuth
app.get('/auth/facebook', function(req, res) {
res.send('Facebook OAuth');
});
app.get('/auth/facebook/callback', function(req, res) {
res.send('Callback for Facebook OAuth');
});
// User Creation
app.route('/api/users')
.post(function(req, res) {
res.send('Create a new user');
})
.put(function(req, res) {
res.send('Update user info');
})
.delete(function(req, res) {
res.send('Delete the user');
});
// Room Creation
app.post('/api/rooms', function(req, res) {
res.send('Create a room');
});
// Note Creation
app.post('/api/notes/new', function(req, res) {
res.send('End of lecture, and create all new notes for each user');
});
// Note Editing
app.route('/api/notes')
.get(function(req, res) {
/*
* /api/notes/?userId=id&roomId=id // compare all notes for user
* /api/notes/?userId=id&roomId=id&filter=show // get all notes for that lecture
*/
res.send('Compare all notes for the user/room');
})
.put(function(req, res) {
res.send('Edit existing notes (save button)');
})
.post(function(req, res) {
res.send('Add new notes (save button)');
});
}; | Add endpoints for Room creation (start of lecture), Note Creation (end of lecture), Editing Notes | Add endpoints for Room creation (start of lecture), Note Creation (end of lecture), Editing Notes
| JavaScript | mit | folksy-squid/Picky-Notes,inspiredtolive/Picky-Notes,derektliu/Picky-Notes,derektliu/Picky-Notes,inspiredtolive/Picky-Notes,derektliu/Picky-Notes,folksy-squid/Picky-Notes,inspiredtolive/Picky-Notes,folksy-squid/Picky-Notes | ---
+++
@@ -19,4 +19,30 @@
.delete(function(req, res) {
res.send('Delete the user');
});
+
+ // Room Creation
+ app.post('/api/rooms', function(req, res) {
+ res.send('Create a room');
+ });
+
+ // Note Creation
+ app.post('/api/notes/new', function(req, res) {
+ res.send('End of lecture, and create all new notes for each user');
+ });
+
+ // Note Editing
+ app.route('/api/notes')
+ .get(function(req, res) {
+ /*
+ * /api/notes/?userId=id&roomId=id // compare all notes for user
+ * /api/notes/?userId=id&roomId=id&filter=show // get all notes for that lecture
+ */
+ res.send('Compare all notes for the user/room');
+ })
+ .put(function(req, res) {
+ res.send('Edit existing notes (save button)');
+ })
+ .post(function(req, res) {
+ res.send('Add new notes (save button)');
+ });
}; |
d1785feb25125bf750daa35b3612124fc72e30b3 | app/scripts/timetable_builder/views/ExamsView.js | app/scripts/timetable_builder/views/ExamsView.js | define(['backbone.marionette', './ExamView', 'hbs!../templates/exams'],
function (Marionette, ExamView, template) {
'use strict';
return Marionette.CompositeView.extend({
tagName: 'table',
className: 'table table-bordered table-condensed',
itemView: ExamView,
itemViewContainer: 'tbody',
template: template,
collectionEvents: {
'add remove': function() {
$('#clash').toggleClass('hidden', !this.collection.clashCount);
}
},
appendHtml: function (compositeView, itemView, index) {
var childrenContainer = compositeView.$itemViewContainer;
var children = childrenContainer.children();
if (children.size() <= index) {
childrenContainer.append(itemView.el);
} else {
children.eq(index).before(itemView.el);
}
}
});
});
| define(['backbone.marionette', './ExamView', 'hbs!../templates/exams'],
function (Marionette, ExamView, template) {
'use strict';
return Marionette.CompositeView.extend({
tagName: 'table',
className: 'table table-bordered table-condensed',
itemView: ExamView,
itemViewContainer: 'tbody',
template: template,
collectionEvents: {
'add remove': function() {
$('#clash').toggleClass('hidden', !this.collection.clashCount);
}
},
appendHtml: function (compositeView, itemView, index) {
var childrenContainer = this.getItemViewContainer(compositeView);
var children = childrenContainer.children();
if (children.size() <= index) {
childrenContainer.append(itemView.el);
} else {
children.eq(index).before(itemView.el);
}
}
});
});
| Use getItemViewContainer() for safety - it ensures $itemViewContainer exists | Use getItemViewContainer() for safety - it ensures $itemViewContainer exists
| JavaScript | mit | chunqi/nusmods,nusmodifications/nusmods,nathanajah/nusmods,chunqi/nusmods,nathanajah/nusmods,zhouyichen/nusmods,mauris/nusmods,zhouyichen/nusmods,nathanajah/nusmods,Yunheng/nusmods,Yunheng/nusmods,mauris/nusmods,mauris/nusmods,chunqi/nusmods,zhouyichen/nusmods,nusmodifications/nusmods,zhouyichen/nusmods,nusmodifications/nusmods,chunqi/nusmods,nathanajah/nusmods,Yunheng/nusmods,mauris/nusmods,nusmodifications/nusmods,Yunheng/nusmods,Yunheng/nusmods | ---
+++
@@ -16,7 +16,7 @@
},
appendHtml: function (compositeView, itemView, index) {
- var childrenContainer = compositeView.$itemViewContainer;
+ var childrenContainer = this.getItemViewContainer(compositeView);
var children = childrenContainer.children();
if (children.size() <= index) {
childrenContainer.append(itemView.el); |
271974693930334174db0a01a86a7cffd3f7f9e0 | src/ObjectLocator.js | src/ObjectLocator.js | class ObjectLocator {
constructor(fs, objectName) {
this.fs = fs;
this.objectName = objectName;
this.objects = [];
this.objectDirectoryName = "objects";
}
run() {
this.loadAllObjects(this.objectName);
return this.objects;
}
loadAllObjects(dependencyName) {
let fileData = this.fs.readFileSync(process.cwd() + `/${this.objectDirectoryName}/${dependencyName}.json`);
let fileJson = {};
if (fileData != null || fileData.toString().length == 0) {
fileJson = JSON.parse(fileData);
}
if (fileJson != null && fileJson != {}) {
if (fileJson.dependencies == null) {
throw new Error(`Json for the file ${dependencyName} must have a dependency array, if none provide a blank array`);
}
let dependencies = fileJson.dependencies;
if (Array.isArray(dependencies)) {
dependencies.forEach((dependency) => {
if (this.objects.find(x => x.name == dependency) == null) {
this.loadAllObjects(dependency);
}
});
} else {
throw new Error(`Dependencies must be an array! object ${dependencyName} file dependencies is not an array`);
}
this.objects.push({
name: dependencyName,
metadata: {
fields: fileJson.fields,
dependencies: fileJson.dependencies
}
})
}
}
}
module.exports = ObjectLocator;
| class ObjectLocator {
constructor(fs, objectName) {
this.fs = fs;
this.objectName = objectName;
this.objects = [];
this.objectDirectoryName = "objects";
}
run() {
this.loadAllObjects(this.objectName);
return this.objects;
}
loadAllObjects(dependencyName) {
let fileData = this.fs.readFileSync(process.cwd() + `/${this.objectDirectoryName}/${dependencyName.toLowerCase()}.json`);
let fileJson = {};
if (fileData != null || fileData.toString().length == 0) {
fileJson = JSON.parse(fileData);
}
if (fileJson != null && fileJson != {}) {
if (fileJson.dependencies == null) {
throw new Error(`Json for the file ${dependencyName} must have a dependency array, if none provide a blank array`);
}
let dependencies = fileJson.dependencies;
if (Array.isArray(dependencies)) {
dependencies.forEach((dependency) => {
if (this.objects.find(x => x.name == dependency) == null) {
this.loadAllObjects(dependency);
}
});
} else {
throw new Error(`Dependencies must be an array! object ${dependencyName} file dependencies is not an array`);
}
this.objects.push({
name: dependencyName,
metadata: {
fields: fileJson.fields,
dependencies: fileJson.dependencies
}
})
}
}
}
module.exports = ObjectLocator;
| Make driver object filename case-insensitive | Make driver object filename case-insensitive
| JavaScript | mit | generationtux/cufflink | ---
+++
@@ -13,7 +13,7 @@
}
loadAllObjects(dependencyName) {
- let fileData = this.fs.readFileSync(process.cwd() + `/${this.objectDirectoryName}/${dependencyName}.json`);
+ let fileData = this.fs.readFileSync(process.cwd() + `/${this.objectDirectoryName}/${dependencyName.toLowerCase()}.json`);
let fileJson = {};
if (fileData != null || fileData.toString().length == 0) {
fileJson = JSON.parse(fileData); |
0ca10de801a0104fa3d9d3f23b074591672f2318 | server/lib/redirects.js | server/lib/redirects.js | const redirects = [
['192.168.99.100/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript'],
['lucaschmid.net/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript']
]
module.exports = function * (next) {
const redirect = redirects.find(el =>
el[0] === `${this.request.host}${this.request.url}`
)
if (redirect) {
this.set('Location', redirect[1])
this.status = 302
} else {
yield next
}
}
| const redirects = [
['192.168.99.100/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript'],
['ls7.ch/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript']
]
module.exports = function * (next) {
const redirect = redirects.find(el =>
el[0] === `${this.request.host}${this.request.url}`
)
if (redirect) {
this.set('Location', redirect[1])
this.status = 302
} else {
yield next
}
}
| Make the fjs redirect shorter | Make the fjs redirect shorter
| JavaScript | mit | Kriegslustig/lucaschmid.net,Kriegslustig/lucaschmid.net,Kriegslustig/lucaschmid.net | ---
+++
@@ -1,6 +1,6 @@
const redirects = [
['192.168.99.100/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript'],
- ['lucaschmid.net/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript']
+ ['ls7.ch/fjs', 'https://github.com/kriegslustig/presentation-functional-javascript']
]
module.exports = function * (next) { |
f585a93f9b3d9a830e752bd205c5427f7e1c4ac2 | character_sheet/js/main.js | character_sheet/js/main.js | // Source: http://stackoverflow.com/a/1830844
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function AppViewModel() {
this.statStrength = ko.observable();
this.statEndurance = ko.observable();
this.statAgility = ko.observable();
this.statSpeed = ko.observable();
this.statWillpower = ko.observable();
this.statInsight = ko.observable();
this.statReasoning = ko.observable();
this.statPerception = ko.observable();
this.statPresence = ko.observable();
this.statComposure = ko.observable();
this.statManipulation = ko.observable();
this.statBeauty = ko.observable();
this.statBonusStrength = ko.computed(function() {
return this.statStrength();
}, this);
}
// Activate knockout.js
ko.applyBindings(new AppViewModel());
| // Source: http://stackoverflow.com/a/1830844
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function statBonus(statValue) {
if(!isNumber(statValue)) {
return false;
}
switch(+statValue) { // cast to number
case 0:
return "–";
break;
case 1:
return -5;
break;
case 2:
return -3;
break;
case 3:
return 0;
break;
case 4:
return 1;
break;
case 5:
return 3;
break;
case 6:
return 5;
break;
case 7:
return 9;
break;
case 8:
return 15;
break;
case 9:
return 21;
break;
default:
return false;
}
}
function AppViewModel() {
this.statStrength = ko.observable();
this.statEndurance = ko.observable();
this.statAgility = ko.observable();
this.statSpeed = ko.observable();
this.statWillpower = ko.observable();
this.statInsight = ko.observable();
this.statReasoning = ko.observable();
this.statPerception = ko.observable();
this.statPresence = ko.observable();
this.statComposure = ko.observable();
this.statManipulation = ko.observable();
this.statBeauty = ko.observable();
this.statBonusStrength = ko.computed(function() {
return this.statStrength();
}, this);
}
// Activate knockout.js
ko.applyBindings(new AppViewModel());
| Add function to determine stat bonus from value. | Add function to determine stat bonus from value.
| JavaScript | bsd-2-clause | vegarbg/horizon | ---
+++
@@ -1,6 +1,46 @@
// Source: http://stackoverflow.com/a/1830844
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
+}
+
+function statBonus(statValue) {
+ if(!isNumber(statValue)) {
+ return false;
+ }
+ switch(+statValue) { // cast to number
+ case 0:
+ return "–";
+ break;
+ case 1:
+ return -5;
+ break;
+ case 2:
+ return -3;
+ break;
+ case 3:
+ return 0;
+ break;
+ case 4:
+ return 1;
+ break;
+ case 5:
+ return 3;
+ break;
+ case 6:
+ return 5;
+ break;
+ case 7:
+ return 9;
+ break;
+ case 8:
+ return 15;
+ break;
+ case 9:
+ return 21;
+ break;
+ default:
+ return false;
+ }
}
function AppViewModel() { |
0175c92b62010f33e7410cc0e6a5121ad87e52ba | templates/system/modules/ph7cms-donation/themes/base/js/donationbox.js | templates/system/modules/ph7cms-donation/themes/base/js/donationbox.js | /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $validationBox = (function () {
$.get(pH7Url.base + 'ph7cms-donation/main/donationbox', function (oData) {
$.colorbox({
width: '100%',
width: '200px',
height: '155px',
speed: 500,
scrolling: false,
html: $(oData).find('#box_block')
})
})
});
$validationBox();
| /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $donationBox = (function () {
$.get(pH7Url.base + 'ph7cms-donation/main/donationbox', function (oData) {
$.colorbox({
width: '100%',
width: '200px',
height: '155px',
speed: 500,
scrolling: false,
html: $(oData).find('#box_block')
})
})
});
$donationBox();
| Rename variable for more appropriate name | Rename variable for more appropriate name
| JavaScript | mit | pH7Software/pH7-Social-Dating-CMS,pH7Software/pH7-Social-Dating-CMS,pH7Software/pH7-Social-Dating-CMS,pH7Software/pH7-Social-Dating-CMS | ---
+++
@@ -4,7 +4,7 @@
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
-var $validationBox = (function () {
+var $donationBox = (function () {
$.get(pH7Url.base + 'ph7cms-donation/main/donationbox', function (oData) {
$.colorbox({
width: '100%',
@@ -17,4 +17,4 @@
})
});
-$validationBox();
+$donationBox(); |
f337cf6f58d0b0da1435e49023a2e7cf5d9d33d9 | protocols/discord.js | protocols/discord.js | const Core = require('./core');
class Discord extends Core {
constructor() {
super();
this.dnsResolver = { resolve: function(address) {return {address: address} } };
}
async run(state) {
this.usedTcp = true;
const raw = await this.request({
uri: 'https://discordapp.com/api/guilds/' + this.options.address + '/widget.json',
});
const json = JSON.parse(raw);
state.name = json.name;
if (json.instant_invite) {
state.connect = json.instant_invite;
} else {
state.connect = 'https://discordapp.com/channels/' + this.options.address
}
state.players = json.members.map(v => {
return {
name: v.username + '#' + v.discriminator,
username: v.username,
discriminator: v.discriminator,
team: v.status
}
});
state.maxplayers = json.presence_count;
state.raw = json;
}
}
module.exports = Discord;
| const Core = require('./core');
class Discord extends Core {
constructor() {
super();
this.dnsResolver = { resolve: function(address) {return {address: address} } };
}
async run(state) {
this.usedTcp = true;
const raw = await this.request({
uri: 'https://discordapp.com/api/guilds/' + this.options.address + '/widget.json',
});
const json = JSON.parse(raw);
state.name = json.name;
if (json.instant_invite) {
state.connect = json.instant_invite;
} else {
state.connect = 'https://discordapp.com/channels/' + this.options.address
}
state.players = json.members.map(v => {
return {
name: v.username,
team: v.status
}
});
state.maxplayers = json.presence_count;
state.raw = json;
}
}
module.exports = Discord;
| Remove discriminator's from player names | Remove discriminator's from player names
The widget API seems to always set discriminator to 0000
| JavaScript | mit | sonicsnes/node-gamedig | ---
+++
@@ -20,9 +20,7 @@
}
state.players = json.members.map(v => {
return {
- name: v.username + '#' + v.discriminator,
- username: v.username,
- discriminator: v.discriminator,
+ name: v.username,
team: v.status
}
}); |
7cf8d2f042c73277630a375f11c74ba8fe047e33 | jujugui/static/gui/src/app/components/user-menu/user-menu.js | jujugui/static/gui/src/app/components/user-menu/user-menu.js | /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const PropTypes = require('prop-types');
const React = require('react');
const ButtonDropdown = require('../button-dropdown/button-dropdown');
/**
Provides a user menu to the header - shows Profile, Account and Logout links.
If user is not logged in the user icon is replaced with a login button.
*/
class UserMenu extends React.Component {
_toggleDropdown() {
this.refs.buttonDropdown._toggleDropdown();
}
_handleProfileClick() {
this.props.navigateUserProfile();
this._toggleDropdown();
}
render() {
const controllerAPI = this.props.controllerAPI;
const showLogin = controllerAPI && !controllerAPI.userIsAuthenticated;
return (
<ButtonDropdown
classes={['user-menu']}
ref="buttonDropdown"
icon={showLogin ? this.props.USSOLoginLink : 'user_16'}
disableDropdown={showLogin}
listItems={[{
action: this.props.navigateUserProfile,
label: 'Profile'
}, {
action: this.props.showHelp,
label: 'GUI help'
}, {
element: this.props.LogoutLink
}]}
tooltip={showLogin ? '' : 'user'} />);
}
};
UserMenu.propTypes = {
LogoutLink: PropTypes.object,
USSOLoginLink: PropTypes.object,
controllerAPI: PropTypes.object,
navigateUserProfile: PropTypes.func.isRequired,
showHelp: PropTypes.func.isRequired
};
module.exports = UserMenu;
| /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const PropTypes = require('prop-types');
const React = require('react');
const ButtonDropdown = require('../button-dropdown/button-dropdown');
/**
Provides a user menu to the header - shows Profile, Account and Logout links.
If user is not logged in the user icon is replaced with a login button.
*/
const UserMenu = props => {
const controllerAPI = props.controllerAPI;
const showLogin = controllerAPI && !controllerAPI.userIsAuthenticated;
return (
<ButtonDropdown
classes={['user-menu']}
ref="buttonDropdown"
icon={showLogin ? props.USSOLoginLink : 'user_16'}
disableDropdown={showLogin}
listItems={[{
action: props.navigateUserProfile,
label: 'Profile'
}, {
action: props.showHelp,
label: 'GUI help'
}, {
element: props.LogoutLink
}]}
tooltip={showLogin ? '' : 'user'} />);
};
UserMenu.propTypes = {
LogoutLink: PropTypes.object,
USSOLoginLink: PropTypes.object,
controllerAPI: PropTypes.object,
navigateUserProfile: PropTypes.func.isRequired,
showHelp: PropTypes.func.isRequired
};
module.exports = UserMenu;
| Remove unused user menu methods. | Remove unused user menu methods.
| JavaScript | agpl-3.0 | mitechie/juju-gui,mitechie/juju-gui,mitechie/juju-gui,mitechie/juju-gui | ---
+++
@@ -9,37 +9,25 @@
Provides a user menu to the header - shows Profile, Account and Logout links.
If user is not logged in the user icon is replaced with a login button.
*/
-class UserMenu extends React.Component {
-
- _toggleDropdown() {
- this.refs.buttonDropdown._toggleDropdown();
- }
-
- _handleProfileClick() {
- this.props.navigateUserProfile();
- this._toggleDropdown();
- }
-
- render() {
- const controllerAPI = this.props.controllerAPI;
- const showLogin = controllerAPI && !controllerAPI.userIsAuthenticated;
- return (
- <ButtonDropdown
- classes={['user-menu']}
- ref="buttonDropdown"
- icon={showLogin ? this.props.USSOLoginLink : 'user_16'}
- disableDropdown={showLogin}
- listItems={[{
- action: this.props.navigateUserProfile,
- label: 'Profile'
- }, {
- action: this.props.showHelp,
- label: 'GUI help'
- }, {
- element: this.props.LogoutLink
- }]}
- tooltip={showLogin ? '' : 'user'} />);
- }
+const UserMenu = props => {
+ const controllerAPI = props.controllerAPI;
+ const showLogin = controllerAPI && !controllerAPI.userIsAuthenticated;
+ return (
+ <ButtonDropdown
+ classes={['user-menu']}
+ ref="buttonDropdown"
+ icon={showLogin ? props.USSOLoginLink : 'user_16'}
+ disableDropdown={showLogin}
+ listItems={[{
+ action: props.navigateUserProfile,
+ label: 'Profile'
+ }, {
+ action: props.showHelp,
+ label: 'GUI help'
+ }, {
+ element: props.LogoutLink
+ }]}
+ tooltip={showLogin ? '' : 'user'} />);
};
UserMenu.propTypes = { |
25dbfe06d90c794525c956bf08ccecc1b7c8d8fc | addon/components/mapbox-gl-source.js | addon/components/mapbox-gl-source.js | import Ember from 'ember';
import layout from '../templates/components/mapbox-gl-source';
const {
Component,
computed,
get,
getProperties,
guidFor
} = Ember;
export default Component.extend({
layout,
tagName: '',
map: null,
dataType: 'geojson',
data: null,
sourceId: computed({
get() {
return guidFor(this);
},
set(key, val) {
return val;
}
}),
init() {
this._super(...arguments);
const { sourceId, dataType, data } = getProperties(this, 'sourceId', 'dataType', 'data');
this.map.addSource(sourceId, { type: dataType, data });
},
didUpdateAttrs() {
this._super(...arguments);
const { sourceId, data } = getProperties(this, 'sourceId', 'data');
this.map.getSource(sourceId).setData(data);
},
willDestroy() {
this._super(...arguments);
this.map.removeSource(get(this, 'sourceId'));
}
});
| import Ember from 'ember';
import layout from '../templates/components/mapbox-gl-source';
const {
Component,
computed,
get,
getProperties,
guidFor
} = Ember;
export default Component.extend({
layout,
tagName: '',
map: null,
dataType: 'geojson',
data: null,
options: null,
sourceId: computed({
get() {
return guidFor(this);
},
set(key, val) {
return val;
}
}),
init() {
this._super(...arguments);
const { sourceId, dataType, data } = getProperties(this, 'sourceId', 'dataType', 'data');
let options = get(this, 'options') || {};
if (dataType) {
options.type = dataType;
}
if (data) {
options.data = data;
}
this.map.addSource(sourceId, options);
},
didUpdateAttrs() {
this._super(...arguments);
const { sourceId, data } = getProperties(this, 'sourceId', 'data');
this.map.getSource(sourceId).setData(data);
},
willDestroy() {
this._super(...arguments);
this.map.removeSource(get(this, 'sourceId'));
}
});
| Support any options mapbox source supports. Maintain backwards compatibility. | Support any options mapbox source supports. Maintain backwards compatibility.
| JavaScript | mit | kturney/ember-mapbox-gl,kturney/ember-mapbox-gl | ---
+++
@@ -17,6 +17,8 @@
dataType: 'geojson',
data: null,
+ options: null,
+
sourceId: computed({
get() {
return guidFor(this);
@@ -31,9 +33,17 @@
this._super(...arguments);
const { sourceId, dataType, data } = getProperties(this, 'sourceId', 'dataType', 'data');
+ let options = get(this, 'options') || {};
+ if (dataType) {
+ options.type = dataType;
+ }
- this.map.addSource(sourceId, { type: dataType, data });
+ if (data) {
+ options.data = data;
+ }
+
+ this.map.addSource(sourceId, options);
},
didUpdateAttrs() { |
142681d8ae8c96c30c03752426d6124d64e24c9a | server/readings-daily-aggregates/publications.js | server/readings-daily-aggregates/publications.js | Meteor.publish("dailyMeasuresBySensor", (sensorId, dayStart, dayEnd) => {
check(sensorId, String);
check(dayStart, String);
check(dayEnd, String);
return ReadingsDailyAggregates.find({
sensorId,
day: {
$gte: dayStart,
$lte: dayEnd
}
})
});
| Meteor.publish("dailyMeasuresBySensor", (sensorId, source, dayStart, dayEnd) => {
check(sensorId, String);
check(source, String);
check(dayStart, String);
check(dayEnd, String);
return ReadingsDailyAggregates.find({
sensorId,
source,
day: {
$gte: dayStart,
$lte: dayEnd
}
})
});
| Change publication of sensor-daily-aggregates to include source. | Change publication of sensor-daily-aggregates to include source.
| JavaScript | apache-2.0 | innowatio/iwwa-back,innowatio/iwwa-back | ---
+++
@@ -1,9 +1,11 @@
-Meteor.publish("dailyMeasuresBySensor", (sensorId, dayStart, dayEnd) => {
+Meteor.publish("dailyMeasuresBySensor", (sensorId, source, dayStart, dayEnd) => {
check(sensorId, String);
+ check(source, String);
check(dayStart, String);
check(dayEnd, String);
return ReadingsDailyAggregates.find({
sensorId,
+ source,
day: {
$gte: dayStart,
$lte: dayEnd |
26d299abc795cd90a5d2a3130e2a04e187e84799 | pac_script.js | pac_script.js | var BOARD_HEIGHT = 288;
var BOARD_WIDTH = 224;
var VERT_TILES = BOARD_HEIGHT / 8;
var HORIZ_TILES = BOARD_WIDTH / 8;
gameBoard = new Array(VERT_TILES);
for(var y = 0; y < VERT_TILES; y++) {
gameBoard[y] = new Array(HORIZ_TILES);
for(var x = 0; x < HORIZ_TILES; x++) {
gameBoard[y][x] = 0;
}
}
| var BOARD_HEIGHT = 288;
var BOARD_WIDTH = 224;
var VERT_TILES = BOARD_HEIGHT / 8;
var HORIZ_TILES = BOARD_WIDTH / 8;
gameBoard = new Array(VERT_TILES);
for(var y = 0; y < VERT_TILES; y++) {
gameBoard[y] = new Array(HORIZ_TILES);
for(var x = 0; x < HORIZ_TILES; x++) {
gameBoard[y][x] = 0;
}
}
var ready = function(fun) {
if(document.readyState != "loading") {
fun();
}
else if(document.addEventListener) {
document.addEventListener("DOMContentLoaded", fun);
}
else {
document.attachEvent("onreadystatechange", function() {
if(document.readyState != "loading") {
fun();
}
});
}
}
| Add ready function in js with IE8 compatibility | Add ready function in js with IE8 compatibility
| JavaScript | mit | peternatewood/pac-man-replica,peternatewood/pac-man-replica | ---
+++
@@ -10,3 +10,19 @@
gameBoard[y][x] = 0;
}
}
+
+var ready = function(fun) {
+ if(document.readyState != "loading") {
+ fun();
+ }
+ else if(document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", fun);
+ }
+ else {
+ document.attachEvent("onreadystatechange", function() {
+ if(document.readyState != "loading") {
+ fun();
+ }
+ });
+ }
+} |
721294c2debd50f91f191c60aa8183ac11b74bd0 | src/js/components/dateRangePicker.js | src/js/components/dateRangePicker.js | // @flow
/* flowlint
* untyped-import:off
*/
import * as React from 'react';
import Datepicker from '@salesforce/design-system-react/components/date-picker';
const dateRangePicker = ({onChange, startName, endName} :
{startName: string, endName: string,
onChange : (string, string) => void}) => {
var rc = {};
let localOnChange = (name, data) => {
onChange(name, data.date.getFullYear().toString() + "-"
+ (data.date.getMonth() +1).toString()+ "-"
+ data.date.getDate().toString() );
};
return (
<React.Fragment>
<Datepicker
onChange={(event, data) => {localOnChange(startName, data)}}
/> -
<Datepicker
onChange={(event, data) => {localOnChange(endName, data)}}
/>
</React.Fragment>
)
}
export default dateRangePicker;
| // @flow
/* flowlint
* untyped-import:off
*/
import * as React from 'react';
import Datepicker from '@salesforce/design-system-react/components/date-picker';
import Button from '@salesforce/design-system-react/components/button';
import { useState } from 'react';
const dateRangePicker = ({onChange, startName, endName, startValue, endValue} :
{startName: string, endName: string,
startValue: Date, endValue: Date,
onChange : (string, string | typeof undefined) => void}) => {
let localOnChange = (name, data) => {
if(data.formattedDate===""){
onChange(name, undefined);
}else if(data.date.getFullYear()>2015){
onChange(name, data.date.getFullYear().toString() + "-"
+ (data.date.getMonth() +1).toString()+ "-"
+ data.date.getDate().toString() );
}
};
// changing the key reliably clears the input,
// so these variables are part of an input clearing hack
let [startDateKey, setStartDateKey] = useState(1);
let [endDateKey, setEndDateKey] = useState(-1);
// check for bad or missing dates
let startValueOrNull = isNaN(startValue.getDate()) ? null : startValue;
let endValueOrNull = isNaN(endValue.getDate()) ? null : endValue;
console.log("StartValue", startValue);
return (
<React.Fragment>
<Datepicker
key={startDateKey}
value={startValueOrNull}
onChange={(event, data) => {localOnChange(startName, data)}}
/>
<Button iconCategory="action" variant="icon" iconName="remove"
onClick={()=>{
setStartDateKey(startDateKey+1);
onChange(startName, undefined)}}>
</Button>
-
<Datepicker
key={endDateKey}
value={endValueOrNull}
onChange={(event, data) => {localOnChange(endName, data)}}
/>
<Button iconCategory="action" variant="icon" iconName="remove"
onClick={()=>{onChange(endName, undefined); setEndDateKey(endDateKey-1)} }>
</Button>
</React.Fragment>
)
}
export default dateRangePicker;
| Allow clearing of date ranges. | Allow clearing of date ranges.
| JavaScript | bsd-3-clause | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | ---
+++
@@ -5,27 +5,55 @@
import * as React from 'react';
import Datepicker from '@salesforce/design-system-react/components/date-picker';
+import Button from '@salesforce/design-system-react/components/button';
+import { useState } from 'react';
-const dateRangePicker = ({onChange, startName, endName} :
+const dateRangePicker = ({onChange, startName, endName, startValue, endValue} :
{startName: string, endName: string,
- onChange : (string, string) => void}) => {
- var rc = {};
+ startValue: Date, endValue: Date,
+ onChange : (string, string | typeof undefined) => void}) => {
let localOnChange = (name, data) => {
- onChange(name, data.date.getFullYear().toString() + "-"
- + (data.date.getMonth() +1).toString()+ "-"
- + data.date.getDate().toString() );
+ if(data.formattedDate===""){
+ onChange(name, undefined);
+ }else if(data.date.getFullYear()>2015){
+ onChange(name, data.date.getFullYear().toString() + "-"
+ + (data.date.getMonth() +1).toString()+ "-"
+ + data.date.getDate().toString() );
+ }
};
+ // changing the key reliably clears the input,
+ // so these variables are part of an input clearing hack
+ let [startDateKey, setStartDateKey] = useState(1);
+ let [endDateKey, setEndDateKey] = useState(-1);
+
+ // check for bad or missing dates
+ let startValueOrNull = isNaN(startValue.getDate()) ? null : startValue;
+ let endValueOrNull = isNaN(endValue.getDate()) ? null : endValue;
+ console.log("StartValue", startValue);
return (
<React.Fragment>
<Datepicker
+ key={startDateKey}
+ value={startValueOrNull}
onChange={(event, data) => {localOnChange(startName, data)}}
- /> -
- <Datepicker
+ />
+ <Button iconCategory="action" variant="icon" iconName="remove"
+ onClick={()=>{
+ setStartDateKey(startDateKey+1);
+ onChange(startName, undefined)}}>
+ </Button>
+ -
+ <Datepicker
+ key={endDateKey}
+ value={endValueOrNull}
onChange={(event, data) => {localOnChange(endName, data)}}
/>
+ <Button iconCategory="action" variant="icon" iconName="remove"
+ onClick={()=>{onChange(endName, undefined); setEndDateKey(endDateKey-1)} }>
+ </Button>
-</React.Fragment>
+ </React.Fragment>
)
} |
ec279560086ca1addd3b6ea20ec6516bdd351fd9 | views/home.js | views/home.js | import React from "react-native";
import LocalitiesFiltered from "./localities-filtered";
export default class Home extends React.Component {
render() {
return <LocalitiesFiltered {...this.props} />;
}
}
| import React from "react-native";
import LocalitiesController from "./localities-controller";
export default class Home extends React.Component {
render() {
return <LocalitiesController {...this.props} />;
}
}
| Remove filter from my localities | Remove filter from my localities
| JavaScript | unknown | wesley1001/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods | ---
+++
@@ -1,8 +1,8 @@
import React from "react-native";
-import LocalitiesFiltered from "./localities-filtered";
+import LocalitiesController from "./localities-controller";
export default class Home extends React.Component {
render() {
- return <LocalitiesFiltered {...this.props} />;
+ return <LocalitiesController {...this.props} />;
}
} |
a1bcbe2c769e14ecbc54af8587c91555e268bf25 | service.js | service.js | /*!
**| PonkBot
**| A chat bot for CyTube
**|
**@author Xaekai
**@copyright 2017
**@license MIT
*/
'use strict';
const PonkBot = require('./lib/ponkbot.js');
const argv = require('minimist')(process.argv.slice(2));
const configfile = typeof argv.config == "String" ? argv.config : "./config";
const config = require(configfile);
const bot = new PonkBot(config);
| /*!
**| PonkBot
**| A chat bot for CyTube
**|
**@author Xaekai
**@copyright 2017
**@license MIT
*/
'use strict';
const PonkBot = require('./lib/ponkbot.js');
function getConfig(args){
let config = './config.js';
config = typeof args.config == "string" ? args.config : config;
// Check for relative path without leading "./"
if( !config.match(/^\//) && config.match(/\//)){
config = `./${config}`;
}
try {
require.resolve(config);
}
catch(err) {
console.error('Could not locate configuration file');
process.exit(78);
}
return config;
}
const argv = require('minimist')(process.argv.slice(2));
const configfile = getConfig(argv);
const config = require(configfile);
const bot = new PonkBot(config);
| Improve handling of missing config file | Improve handling of missing config file
| JavaScript | mit | Xaekai/PonkBot | ---
+++
@@ -11,8 +11,27 @@
const PonkBot = require('./lib/ponkbot.js');
+function getConfig(args){
+ let config = './config.js';
+ config = typeof args.config == "string" ? args.config : config;
+
+ // Check for relative path without leading "./"
+ if( !config.match(/^\//) && config.match(/\//)){
+ config = `./${config}`;
+ }
+
+ try {
+ require.resolve(config);
+ }
+ catch(err) {
+ console.error('Could not locate configuration file');
+ process.exit(78);
+ }
+
+ return config;
+}
+
const argv = require('minimist')(process.argv.slice(2));
-const configfile = typeof argv.config == "String" ? argv.config : "./config";
-
+const configfile = getConfig(argv);
const config = require(configfile);
const bot = new PonkBot(config); |
1e2e796d806f87ebd0eae4e7f68394ec0730febe | src/app/myOrders/orders/js/orders.config.js | src/app/myOrders/orders/js/orders.config.js | angular.module('orderCloud')
.config(OrdersConfig)
;
function OrdersConfig($stateProvider) {
$stateProvider
.state('orders', {
parent: 'account',
templateUrl: 'myOrders/orders/templates/orders.html',
controller: 'OrdersCtrl',
controllerAs: 'orders',
data: {
pageTitle: 'Orders'
},
url: '/orders/:tab?fromDate&toDate&search&page&pageSize&searchOn&sortBy&filters',
resolve: {
Parameters: function($stateParams, ocParameters){
return ocParameters.Get($stateParams);
},
OrderList: function(Parameters, CurrentUser, ocOrders){
return ocOrders.List(Parameters, CurrentUser);
}
}
});
} | angular.module('orderCloud')
.config(OrdersConfig)
;
function OrdersConfig($stateProvider) {
$stateProvider
.state('orders', {
parent: 'account',
templateUrl: 'myOrders/orders/templates/orders.html',
controller: 'OrdersCtrl',
controllerAs: 'orders',
data: {
pageTitle: 'Orders'
},
url: '/orders/:tab?fromDate&toDate&search&page&pageSize&searchOn&sortBy&status&filters',
resolve: {
Parameters: function($stateParams, ocParameters){
return ocParameters.Get($stateParams);
},
OrderList: function(Parameters, CurrentUser, ocOrders){
return ocOrders.List(Parameters, CurrentUser);
}
}
});
} | Add status as a query param for orders state | Add status as a query param for orders state
| JavaScript | mit | spencerwalker/angular-buyer,crhistianr/angular-buyer,ordercloud-api/angular-buyer,crhistianr/angular-buyer,spencerwalker/angular-buyer,Four51/demo_buyer,ordercloud-api/angular-buyer,Four51/demo_buyer | ---
+++
@@ -12,7 +12,7 @@
data: {
pageTitle: 'Orders'
},
- url: '/orders/:tab?fromDate&toDate&search&page&pageSize&searchOn&sortBy&filters',
+ url: '/orders/:tab?fromDate&toDate&search&page&pageSize&searchOn&sortBy&status&filters',
resolve: {
Parameters: function($stateParams, ocParameters){
return ocParameters.Get($stateParams); |
79b97488d91f194721d1d2c9a0c612e2b18307ec | public/app.js | public/app.js |
function something()
{
var x =window.localStorage.getItem('cc');
x = x * 1 + 1;
window.localStorage.setItem('cc', x);
alert(x);
}
function add_to_cart(id)
{
var key_id = 'product_' + id;
var x = window.localStorage.getItem(key_id);
x = x * 1 + 1;
window.localStorage.setItem(key_id, x);
// var total = 0; //Total numbers of products ordered
// for(var i in localStorage)
// {
// console.log(localStorage[i]);
// }
// for(var i=0, len=localStorage.length; i<len; i++) {
// var key = localStorage.key(i);
// var value = localStorage[key];
// total = total + value*1;
// console.log("Total = " + total);
// window.localStorage.setItem("total", total);
// }
}
|
function something()
{
var x =window.localStorage.getItem('cc');
x = x * 1 + 1;
window.localStorage.setItem('cc', x);
alert(x);
}
function add_to_cart(id)
{
var key_id = 'product_' + id;
var x = window.localStorage.getItem(key_id);
x = x * 1 + 1;
window.localStorage.setItem(key_id, x);
}
| Fix 2 Show numbers of products on cart | Fix 2 Show numbers of products on cart
| JavaScript | mit | airwall/PizzaShop,airwall/PizzaShop,airwall/PizzaShop | ---
+++
@@ -21,23 +21,6 @@
x = x * 1 + 1;
window.localStorage.setItem(key_id, x);
- // var total = 0; //Total numbers of products ordered
-
-
-
- // for(var i in localStorage)
- // {
- // console.log(localStorage[i]);
- // }
- // for(var i=0, len=localStorage.length; i<len; i++) {
- // var key = localStorage.key(i);
- // var value = localStorage[key];
- // total = total + value*1;
- // console.log("Total = " + total);
- // window.localStorage.setItem("total", total);
-
- // }
-
}
|
26799b61303d713c055705876e6e070c7726527f | src/index.js | src/index.js | import http from "http"
import { app, CONFIG } from "./server"
let currentApp = null
const server = http.createServer(app)
server.listen(CONFIG.port)
console.log(`GraphQL-server listening on port ${CONFIG.port}.`)
if (module.hot) {
module.hot.accept(["./server", "./graphql"], () => {
server.removeListener("request", currentApp)
server.on("request", app)
currentApp = app
})
}
| import http from "http"
import { app, CONFIG } from "./server"
let currentApp = app
const server = http.createServer(app)
server.listen(CONFIG.port)
console.log(`GraphQL-server listening on port ${CONFIG.port}.`)
if (module.hot) {
module.hot.accept(["./server", "./graphql"], () => {
server.removeListener("request", currentApp)
server.on("request", app)
currentApp = app
})
}
| Fix issue in hot reloading | Fix issue in hot reloading
| JavaScript | mit | DevNebulae/ads-pt-api | ---
+++
@@ -1,7 +1,7 @@
import http from "http"
import { app, CONFIG } from "./server"
-let currentApp = null
+let currentApp = app
const server = http.createServer(app)
server.listen(CONFIG.port)
console.log(`GraphQL-server listening on port ${CONFIG.port}.`) |
394ab4a2d670415e792504aaa25dbe7cb2b619ae | src/index.js | src/index.js | // require('./contentmeter.js');
import ContentMeter from './ContentMeter.js';
module.exports = ContentMeter;
| // require('./contentmeter.js');
import ContentMeter from './ContentMeter.js';
// module.exports = ContentMeter;
| Hide module.exports for rollup compatibility | Hide module.exports for rollup compatibility
| JavaScript | mit | bezet/baza-contentmeter | ---
+++
@@ -1,3 +1,3 @@
// require('./contentmeter.js');
import ContentMeter from './ContentMeter.js';
-module.exports = ContentMeter;
+// module.exports = ContentMeter; |
a54a5cbd19a400a13a071685f54de611391e62b5 | webpack.config.js | webpack.config.js | var path = require("path");
module.exports = {
cache: true,
entry: "./js/main.js",
devtool: "#source-map",
output: {
path: path.resolve("./build"),
filename: "bundle.js",
sourceMapFilename: "[file].map",
publicPath: "/build/",
stats: { colors: true },
},
module: {
noParse: [/node_modules\/react/,
/node_modules\/jquery/,
/bower_components\/MathJax/,
/bower_components\/KAS/,
/node_modules\/underscore/],
loaders: [
{
//tell webpack to use jsx-loader for all *.jsx files
test: /\.js$/,
loader: "regenerator-loader"
},
{
//tell webpack to use jsx-loader for all *.jsx files
test: /\.js$/,
loader: "jsx-loader?insertPragma=React.DOM&harmony&stripTypes"
}
],
},
resolve: {
alias: {
"react": path.resolve("node_modules/react/dist/react-with-addons.js"),
"underscore": path.resolve("node_modules/underscore/underscore-min.js"),
"jquery": path.resolve("node_modules/jquery/dist/jquery.min.js"),
"katex": path.resolve("bower_components/katex/build/katex.min.js"),
},
extensions: ["", ".js", ".jsx"]
}
}
| var path = require("path");
module.exports = {
cache: true,
entry: "./js/main.js",
devtool: "#source-map",
output: {
path: path.resolve("./build"),
filename: "bundle.js",
sourceMapFilename: "[file].map",
publicPath: "/build/",
stats: { colors: true },
},
module: {
noParse: [/node_modules\/react/,
/node_modules\/jquery/,
/bower_components\/MathJax/,
/bower_components\/KAS/,
/node_modules\/underscore/],
loaders: [
{
//tell webpack to use jsx-loader for all *.jsx files
test: /\.js$/,
loader: "regenerator-loader"
},
{
//tell webpack to use jsx-loader for all *.jsx files
test: /\.js$/,
loader: "jsx-loader?insertPragma=React.DOM&harmony&stripTypes"
}
],
},
resolve: {
alias: {
"react": path.resolve("node_modules/react/dist/react.js"),
"underscore": path.resolve("node_modules/underscore/underscore-min.js"),
"jquery": path.resolve("node_modules/jquery/dist/jquery.min.js"),
"katex": path.resolve("bower_components/katex/build/katex.min.js"),
},
extensions: ["", ".js", ".jsx"]
}
}
| Change to react from react-with-addons | Change to react from react-with-addons
| JavaScript | mpl-2.0 | bbondy/khan-academy-fxos,bbondy/khan-academy-fxos | ---
+++
@@ -32,7 +32,7 @@
},
resolve: {
alias: {
- "react": path.resolve("node_modules/react/dist/react-with-addons.js"),
+ "react": path.resolve("node_modules/react/dist/react.js"),
"underscore": path.resolve("node_modules/underscore/underscore-min.js"),
"jquery": path.resolve("node_modules/jquery/dist/jquery.min.js"),
"katex": path.resolve("bower_components/katex/build/katex.min.js"), |
43e6579c55ff8eb592d864c7cfc4858ca69e25ef | src/mongo.js | src/mongo.js |
var mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI);
mongoose.Model.prototype.psave = function () {
var that = this;
return new Promise(function (resolve) {
that.save(function (err) {
if (err) {
throw err
}
resolve();
});
});
};
var Tomato = mongoose.model('Tomato', {
title: String,
notes: String,
mood: String,
performance: Number,
startedAt: Date,
endedAt: Date,
interupted: Boolean,
finished: Boolean,
accountId: String
});
var Account = mongoose.model('Account', {
id: String,
name: String
});
module.exports.Tomato = Tomato;
module.exports.Account = Account;
|
var mongoose = require('mongoose');
// polyfill of catch
// https://github.com/aheckmann/mpromise/pull/14
require('mongoose/node_modules/mpromise').prototype.catch = function (onReject) {
return this.then(undefined, onReject);
};
mongoose.connect(process.env.MONGO_URI);
/**
* Saves the model and returns a promise
*/
mongoose.Model.prototype.psave = function () {
var that = this;
return new Promise(function (resolve) {
that.save(function (err) {
if (err) {
throw err
}
resolve();
});
});
};
var Tomato = mongoose.model('Tomato', {
title: String,
notes: String,
mood: String,
performance: Number,
startedAt: Date,
endedAt: Date,
interupted: Boolean,
finished: Boolean,
accountId: String
});
var Account = mongoose.model('Account', {
id: String,
displayName: String,
facebookId: String
});
Account.prototype.picture = function () {
return 'http://graph.facebook.com/' + this.facebookId + '/picture';
};
module.exports.Tomato = Tomato;
module.exports.Account = Account;
| Modify model and add polyfill of promise.catch | Modify model and add polyfill of promise.catch
| JavaScript | mit | kt3k/pomodoro-meter,kt3k/pomodoro-meter,kt3k/pomodoro-meter | ---
+++
@@ -1,7 +1,17 @@
var mongoose = require('mongoose');
+
+// polyfill of catch
+// https://github.com/aheckmann/mpromise/pull/14
+require('mongoose/node_modules/mpromise').prototype.catch = function (onReject) {
+ return this.then(undefined, onReject);
+};
+
mongoose.connect(process.env.MONGO_URI);
+/**
+ * Saves the model and returns a promise
+ */
mongoose.Model.prototype.psave = function () {
var that = this;
@@ -37,8 +47,15 @@
var Account = mongoose.model('Account', {
id: String,
- name: String
+ displayName: String,
+ facebookId: String
});
+
+Account.prototype.picture = function () {
+
+ return 'http://graph.facebook.com/' + this.facebookId + '/picture';
+
+};
module.exports.Tomato = Tomato; |
f7f7d921e1153a86c74d5dfb2d728095313885f9 | extension.js | extension.js | const UPower = imports.ui.status.power.UPower
const Main = imports.ui.main
let watching
function bind () {
getBattery(proxy => {
watching = proxy.connect('g-properties-changed', update)
})
}
function unbind () {
getBattery(proxy => {
proxy.disconnect(watching)
})
}
function show () {
getBattery((proxy, icon) => {
icon.show()
})
}
function hide () {
getBattery((proxy, icon) => {
icon.hide()
})
}
function update () {
getBattery(proxy => {
let isBattery = proxy.Type === UPower.DeviceKind.BATTERY
let notDischarging = proxy.State !== UPower.DeviceState.DISCHARGING
if (isBattery && notDischarging && proxy.Percentage === 100) {
hide()
} else {
show()
}
})
}
function getBattery (callback) {
let menu = Main.panel.statusArea.aggregateMenu
if (menu && menu._power) {
callback(menu._power._proxy, menu._power.indicators)
}
}
/* exported init, enable, disable */
function init () { }
function enable () {
bind()
update()
}
function disable () {
unbind()
show()
}
| const UPower = imports.ui.status.power.UPower
const Main = imports.ui.main
let watching
function bind () {
getBattery(proxy => {
watching = proxy.connect('g-properties-changed', update)
})
}
function unbind () {
getBattery(proxy => {
proxy.disconnect(watching)
})
}
function show () {
getBattery((proxy, icon) => {
icon.show()
})
}
function hide () {
getBattery((proxy, icon) => {
icon.hide()
})
}
function update () {
getBattery(proxy => {
let isDischarging = proxy.State === UPower.DeviceState.DISCHARGING
let isFullyCharged = proxy.State === UPower.DeviceState.FULLY_CHARGED
if (proxy.Type !== UPower.DeviceKind.BATTERY) {
show()
} else if (isFullyCharged) {
hide()
} else if (proxy.Percentage === 100 && !isDischarging) {
hide()
} else {
show()
}
})
}
function getBattery (callback) {
let menu = Main.panel.statusArea.aggregateMenu
if (menu && menu._power) {
callback(menu._power._proxy, menu._power.indicators)
}
}
/* exported init, enable, disable */
function init () { }
function enable () {
bind()
update()
}
function disable () {
unbind()
show()
}
| Improve logic for more edge cases | Improve logic for more edge cases
| JavaScript | mit | ai/autohide-battery | ---
+++
@@ -29,9 +29,13 @@
function update () {
getBattery(proxy => {
- let isBattery = proxy.Type === UPower.DeviceKind.BATTERY
- let notDischarging = proxy.State !== UPower.DeviceState.DISCHARGING
- if (isBattery && notDischarging && proxy.Percentage === 100) {
+ let isDischarging = proxy.State === UPower.DeviceState.DISCHARGING
+ let isFullyCharged = proxy.State === UPower.DeviceState.FULLY_CHARGED
+ if (proxy.Type !== UPower.DeviceKind.BATTERY) {
+ show()
+ } else if (isFullyCharged) {
+ hide()
+ } else if (proxy.Percentage === 100 && !isDischarging) {
hide()
} else {
show() |
810136cdab53dcc29751cb4584f9012c73aed0c3 | src/javascript/_common/check_new_release.js | src/javascript/_common/check_new_release.js | const moment = require('moment');
const urlForStatic = require('./url').urlForStatic;
const getStaticHash = require('./utility').getStaticHash;
// only reload if it's more than 10 minutes since the last reload
const shouldForceReload = last_reload => !last_reload || +last_reload + (10 * 60 * 1000) < moment().valueOf();
// calling this method is handled by GTM tags
const checkNewRelease = () => {
const last_reload = localStorage.getItem('new_release_reload_time');
if (!shouldForceReload(last_reload)) return false;
localStorage.setItem('new_release_reload_time', moment().valueOf());
const current_hash = getStaticHash();
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = () => {
if (+xhttp.readyState === 4 && +xhttp.status === 200) {
const latest_hash = xhttp.responseText;
if (latest_hash && current_hash && latest_hash !== current_hash) {
window.location.reload(true);
}
}
};
xhttp.open('GET', urlForStatic(`version?${Math.random().toString(36).slice(2)}`), true);
xhttp.send();
return true;
};
module.exports = {
shouldForceReload,
checkNewRelease,
};
| const moment = require('moment');
const urlForStatic = require('./url').urlForStatic;
const getStaticHash = require('./utility').getStaticHash;
const LocalStore = require('../_common/storage').LocalStore;
// only reload if it's more than 10 minutes since the last reload
const shouldForceReload = last_reload => !last_reload || +last_reload + (10 * 60 * 1000) < moment().valueOf();
// calling this method is handled by GTM tags
const checkNewRelease = () => {
const last_reload = LocalStore.getItem('new_release_reload_time');
if (!shouldForceReload(last_reload)) return false;
LocalStore.setItem('new_release_reload_time', moment().valueOf());
const current_hash = getStaticHash();
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = () => {
if (+xhttp.readyState === 4 && +xhttp.status === 200) {
const latest_hash = xhttp.responseText;
if (latest_hash && current_hash && latest_hash !== current_hash) {
window.location.reload(true);
}
}
};
xhttp.open('GET', urlForStatic(`version?${Math.random().toString(36).slice(2)}`), true);
xhttp.send();
return true;
};
module.exports = {
shouldForceReload,
checkNewRelease,
};
| Use LocalStore to have a fallback when localStorage is not avail. | Use LocalStore to have a fallback when localStorage is not avail.
| JavaScript | apache-2.0 | kellybinary/binary-static,ashkanx/binary-static,kellybinary/binary-static,binary-com/binary-static,ashkanx/binary-static,kellybinary/binary-static,binary-com/binary-static,ashkanx/binary-static,binary-com/binary-static | ---
+++
@@ -1,15 +1,16 @@
const moment = require('moment');
const urlForStatic = require('./url').urlForStatic;
const getStaticHash = require('./utility').getStaticHash;
+const LocalStore = require('../_common/storage').LocalStore;
// only reload if it's more than 10 minutes since the last reload
const shouldForceReload = last_reload => !last_reload || +last_reload + (10 * 60 * 1000) < moment().valueOf();
// calling this method is handled by GTM tags
const checkNewRelease = () => {
- const last_reload = localStorage.getItem('new_release_reload_time');
+ const last_reload = LocalStore.getItem('new_release_reload_time');
if (!shouldForceReload(last_reload)) return false;
- localStorage.setItem('new_release_reload_time', moment().valueOf());
+ LocalStore.setItem('new_release_reload_time', moment().valueOf());
const current_hash = getStaticHash();
const xhttp = new XMLHttpRequest(); |
03a6a9e6a2e50fcb5d8a425e7a6275f30e8e95f1 | src/modules/search/components/UnitSuggestions.js | src/modules/search/components/UnitSuggestions.js | import React from 'react';
import {Link} from 'react-router';
import ObservationStatus from '../../unit/components/ObservationStatus';
import {getAttr, getUnitIconURL, getServiceName, getObservation} from '../../unit/helpers';
const UnitSuggestion = ({unit, ...rest}) =>
<Link to={`/unit/${unit.id}`} className="search-suggestions__result" {...rest}>
<div className="search-suggestions__result-icon">
<img src={getUnitIconURL(unit)} alt={getServiceName(unit)} />
</div>
<div className="search-suggestions__result-details">
<div className="search-suggestions__result-details__name">{getAttr(unit.name)}</div>
<ObservationStatus observation={getObservation(unit)}/>
</div>
</Link>;
export default UnitSuggestion;
| import React from 'react';
import {Link} from 'react-router';
import ObservationStatus from '../../unit/components/ObservationStatus';
import {getUnitIconURL, getServiceName, getObservation} from '../../unit/helpers';
const UnitSuggestion = ({unit, ...rest}, context) =>
<Link to={`/unit/${unit.id}`} className="search-suggestions__result" {...rest}>
<div className="search-suggestions__result-icon">
<img src={getUnitIconURL(unit)} alt={getServiceName(unit)} />
</div>
<div className="search-suggestions__result-details">
<div className="search-suggestions__result-details__name">{context.getAttr(unit.name)}</div>
<ObservationStatus observation={getObservation(unit)}/>
</div>
</Link>;
UnitSuggestion.contextTypes = {
getAttr: React.PropTypes.func
};
export default UnitSuggestion;
| Fix translations for unit fields in search suggestions | Fix translations for unit fields in search suggestions
| JavaScript | mit | nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map | ---
+++
@@ -1,17 +1,21 @@
import React from 'react';
import {Link} from 'react-router';
import ObservationStatus from '../../unit/components/ObservationStatus';
-import {getAttr, getUnitIconURL, getServiceName, getObservation} from '../../unit/helpers';
+import {getUnitIconURL, getServiceName, getObservation} from '../../unit/helpers';
-const UnitSuggestion = ({unit, ...rest}) =>
+const UnitSuggestion = ({unit, ...rest}, context) =>
<Link to={`/unit/${unit.id}`} className="search-suggestions__result" {...rest}>
<div className="search-suggestions__result-icon">
<img src={getUnitIconURL(unit)} alt={getServiceName(unit)} />
</div>
<div className="search-suggestions__result-details">
- <div className="search-suggestions__result-details__name">{getAttr(unit.name)}</div>
+ <div className="search-suggestions__result-details__name">{context.getAttr(unit.name)}</div>
<ObservationStatus observation={getObservation(unit)}/>
</div>
</Link>;
+UnitSuggestion.contextTypes = {
+ getAttr: React.PropTypes.func
+};
+
export default UnitSuggestion; |
4f61ec02643d6c200301c63c56c40c58bb6a3209 | src/utils.js | src/utils.js | export function createPostbackAction(label, input, issuedAt) {
return {
type: 'postback',
label,
data: JSON.stringify({
input,
issuedAt,
}),
};
}
export function createFeedbackWords(feedbacks) {
let positive = 0, negative = 0;
feedbacks.forEach(e => {
if (e.score > 0) {
positive++;
}
if (e.score < 0) {
negative++;
}
});
if (positive + negative === 0) return '[還沒有人針對此回應評價]';
let result = '';
if (positive) result += `有 ${positive} 人覺得此回應有幫助\n`;
if (negative) result += `有 ${negative} 人覺得此回應沒幫助\n`;
return `[${result.trim()}]`;
}
export function createReferenceWords(reference) {
if (reference) return `出處:${reference}`;
return '出處:此回應沒有出處';
}
| export function createPostbackAction(label, input, issuedAt) {
return {
type: 'postback',
label,
data: JSON.stringify({
input,
issuedAt,
}),
};
}
export function createFeedbackWords(feedbacks) {
let positive = 0;
let negative = 0;
feedbacks.forEach(e => {
if (e.score > 0) {
positive++;
}
if (e.score < 0) {
negative++;
}
});
if (positive + negative === 0) return '[還沒有人針對此回應評價]';
let result = '';
if (positive) result += `有 ${positive} 人覺得此回應有幫助\n`;
if (negative) result += `有 ${negative} 人覺得此回應沒幫助\n`;
return `[${result.trim()}]`;
}
export function createReferenceWords(reference) {
if (reference) return `出處:${reference}`;
return '\uDBC0\uDC85 ⚠️️ 此回應沒有出處,請自行斟酌回應真實。⚠️️ \uDBC0\uDC85';
}
| Reword and add emoji on reference | Reword and add emoji on reference
| JavaScript | mit | cofacts/rumors-line-bot,cofacts/rumors-line-bot,cofacts/rumors-line-bot | ---
+++
@@ -10,7 +10,8 @@
}
export function createFeedbackWords(feedbacks) {
- let positive = 0, negative = 0;
+ let positive = 0;
+ let negative = 0;
feedbacks.forEach(e => {
if (e.score > 0) {
positive++;
@@ -28,5 +29,5 @@
export function createReferenceWords(reference) {
if (reference) return `出處:${reference}`;
- return '出處:此回應沒有出處';
+ return '\uDBC0\uDC85 ⚠️️ 此回應沒有出處,請自行斟酌回應真實。⚠️️ \uDBC0\uDC85';
} |
168bd2c28dedbed8b7c22a97138bf33d487250e4 | app/assets/javascripts/parent-taxon-prefix-preview.js | app/assets/javascripts/parent-taxon-prefix-preview.js | (function (Modules) {
"use strict";
Modules.ParentTaxonPrefixPreview = function () {
this.start = function(el) {
var $parentSelectEl = $(el).find('select.js-parent-taxon');
var $pathPrefixEl = $(el).find('.js-path-prefix-hint');
updateBasePathPreview();
$parentSelectEl.change(updateBasePathPreview);
function getParentPathPrefix(callback) {
var parentTaxonContentId = $parentSelectEl.val();
if (parentTaxonContentId.length === 0) {
callback();
return;
}
$.getJSON(
window.location.origin + '/taxons/' + parentTaxonContentId + '.json'
).done(function(taxon) {
callback(taxon.path_prefix);
});
}
function updateBasePathPreview() {
getParentPathPrefix(function (path_prefix) {
if (path_prefix) {
$pathPrefixEl.html('Base path must start with <b>/' + path_prefix + '</b>');
$pathPrefixEl.removeClass('hidden');
} else {
$pathPrefixEl.addClass('hidden');
$pathPrefixEl.text('');
}
});
}
};
};
})(window.GOVUKAdmin.Modules);
| (function (Modules) {
"use strict";
Modules.ParentTaxonPrefixPreview = function () {
this.start = function(el) {
var $parentSelectEl = $(el).find('select.js-parent-taxon');
var $pathPrefixEl = $(el).find('.js-path-prefix-hint');
function getParentPathPrefix(callback) {
var parentTaxonContentId = $parentSelectEl.val();
if (parentTaxonContentId.length === 0) {
callback();
return;
}
$.getJSON(
window.location.origin + '/taxons/' + parentTaxonContentId + '.json'
).done(function(taxon) {
callback(taxon.path_prefix);
});
}
function updateBasePathPreview() {
getParentPathPrefix(function (path_prefix) {
if (path_prefix) {
$pathPrefixEl.html('Base path must start with <b>/' + path_prefix + '</b>');
$pathPrefixEl.removeClass('hidden');
} else {
$pathPrefixEl.addClass('hidden');
$pathPrefixEl.text('');
}
});
}
updateBasePathPreview();
$parentSelectEl.change(updateBasePathPreview);
};
};
})(window.GOVUKAdmin.Modules);
| Move the ParentTaxonPrefixPreview logic to the bottom | Move the ParentTaxonPrefixPreview logic to the bottom
The functions are hoisted anyway.
| JavaScript | mit | alphagov/content-tagger,alphagov/content-tagger,alphagov/content-tagger | ---
+++
@@ -5,9 +5,6 @@
this.start = function(el) {
var $parentSelectEl = $(el).find('select.js-parent-taxon');
var $pathPrefixEl = $(el).find('.js-path-prefix-hint');
-
- updateBasePathPreview();
- $parentSelectEl.change(updateBasePathPreview);
function getParentPathPrefix(callback) {
var parentTaxonContentId = $parentSelectEl.val();
@@ -35,6 +32,9 @@
}
});
}
+
+ updateBasePathPreview();
+ $parentSelectEl.change(updateBasePathPreview);
};
};
})(window.GOVUKAdmin.Modules); |
429d78580b2f78b0bb12c79fe182c77986f89a5d | server/utils/get-db-sort-index-map.js | server/utils/get-db-sort-index-map.js | // Returns primitive { ownerId: sortIndexValue } map for provided sortKeyPath
'use strict';
var ensureString = require('es5-ext/object/validate-stringifiable-value')
, ee = require('event-emitter')
, memoize = require('memoizee')
, dbDriver = require('mano').dbDriver;
module.exports = memoize(function (storageName, sortKeyPath) {
var itemsMap = ee();
dbDriver.getStorage(storageName).on('key:' + (sortKeyPath + '&'), function (event) {
if (!itemsMap[event.ownerId]) {
itemsMap[event.ownerId] = { id: event.ownerId, stamp: event.data.stamp };
} else {
itemsMap[event.ownerId].stamp = event.data.stamp;
}
itemsMap.emit('update', event);
});
return itemsMap;
}, { primitive: true, resolvers: [ensureString, function (sortKeyPath) {
return (sortKeyPath == null) ? '' : String(sortKeyPath);
}] });
| // Returns primitive { ownerId: sortIndexValue } map for provided sortKeyPath
'use strict';
var ensureString = require('es5-ext/object/validate-stringifiable-value')
, ee = require('event-emitter')
, memoize = require('memoizee')
, dbDriver = require('mano').dbDriver
, isArray = Array.isArray;
module.exports = memoize(function (storageName, sortKeyPath) {
var itemsMap = ee(), storages;
if (isArray(storageName)) {
storages = storageName.map(function (storageName) {
return dbDriver.getStorage(storageName);
});
} else {
storages = [dbDriver.getStorage(storageName)];
}
storages.forEach(function (storage) {
storage.on('key:' + (sortKeyPath + '&'), function (event) {
if (!itemsMap[event.ownerId]) {
itemsMap[event.ownerId] = { id: event.ownerId, stamp: event.data.stamp };
} else {
itemsMap[event.ownerId].stamp = event.data.stamp;
}
itemsMap.emit('update', event);
});
});
return itemsMap;
}, { primitive: true, resolvers: [function (storageName) {
if (isArray(storageName)) return storageName.map(ensureString).sort();
return ensureString(storageName);
}, function (sortKeyPath) {
return (sortKeyPath == null) ? '' : String(sortKeyPath);
}] });
| Support for multiple storage names | Support for multiple storage names
| JavaScript | mit | egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations | ---
+++
@@ -5,19 +5,33 @@
var ensureString = require('es5-ext/object/validate-stringifiable-value')
, ee = require('event-emitter')
, memoize = require('memoizee')
- , dbDriver = require('mano').dbDriver;
+ , dbDriver = require('mano').dbDriver
+
+ , isArray = Array.isArray;
module.exports = memoize(function (storageName, sortKeyPath) {
- var itemsMap = ee();
- dbDriver.getStorage(storageName).on('key:' + (sortKeyPath + '&'), function (event) {
- if (!itemsMap[event.ownerId]) {
- itemsMap[event.ownerId] = { id: event.ownerId, stamp: event.data.stamp };
- } else {
- itemsMap[event.ownerId].stamp = event.data.stamp;
- }
- itemsMap.emit('update', event);
+ var itemsMap = ee(), storages;
+ if (isArray(storageName)) {
+ storages = storageName.map(function (storageName) {
+ return dbDriver.getStorage(storageName);
+ });
+ } else {
+ storages = [dbDriver.getStorage(storageName)];
+ }
+ storages.forEach(function (storage) {
+ storage.on('key:' + (sortKeyPath + '&'), function (event) {
+ if (!itemsMap[event.ownerId]) {
+ itemsMap[event.ownerId] = { id: event.ownerId, stamp: event.data.stamp };
+ } else {
+ itemsMap[event.ownerId].stamp = event.data.stamp;
+ }
+ itemsMap.emit('update', event);
+ });
});
return itemsMap;
-}, { primitive: true, resolvers: [ensureString, function (sortKeyPath) {
+}, { primitive: true, resolvers: [function (storageName) {
+ if (isArray(storageName)) return storageName.map(ensureString).sort();
+ return ensureString(storageName);
+}, function (sortKeyPath) {
return (sortKeyPath == null) ? '' : String(sortKeyPath);
}] }); |
7fa801c636d9b4bc3176699c154b927b8389cf8f | app/assets/javascripts/tagger/onClick/publishButton.js | app/assets/javascripts/tagger/onClick/publishButton.js | $(function() {
$("#publishButton").click( function() {
showPleaseWait('Publishing... (This can take some time depending on the number of resources you have selected..)');
if (!$(this).hasClass('disabled')) {
// First save the draft state
var str = processJSONOutput();
saveDraft(str);
// Then save those that are checked remotely.
var str = processJSONOutput(true);
saveRemote(str, 'LR');
}
});
}); | $(function() {
$("#publishButton").click( function() {
if (!$(this).hasClass('disabled')) {
showPleaseWait('Publishing... (This can take some time depending on the number of resources you have selected..)');
// First save the draft state
var str = processJSONOutput();
saveDraft(str);
// Then save those that are checked remotely.
var str = processJSONOutput(true);
saveRemote(str, 'LR');
}
});
}); | Move please wait to inside the block so we don't show it if its not actually publishing | Move please wait to inside the block so we don't show it if its not actually publishing
| JavaScript | apache-2.0 | inbloom/APP-tagger,inbloom/APP-tagger | ---
+++
@@ -1,9 +1,9 @@
$(function() {
$("#publishButton").click( function() {
- showPleaseWait('Publishing... (This can take some time depending on the number of resources you have selected..)');
+ if (!$(this).hasClass('disabled')) {
+ showPleaseWait('Publishing... (This can take some time depending on the number of resources you have selected..)');
- if (!$(this).hasClass('disabled')) {
// First save the draft state
var str = processJSONOutput();
saveDraft(str); |
d2c4c56877f64262d2d7637021f94af75671e909 | stamper.js | stamper.js | var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (system.args.length < 4 || system.args.length > 5) {
console.log('Usage: '+system.args[0]+' URL selector filename [zoom]');
phantom.exit(1);
} else {
address = system.args[1];
selector = system.args[2];
output = system.args[3];
if (system.args.length > 4) {
page.zoomFactor = system.args[4];
}
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit(1);
} else {
window.setTimeout(function () {
var rect = page.evaluate(function(selector) {
var el = document.querySelector(selector);
if (!el) {
return null;
}
return el.getBoundingClientRect();
}, selector);
if (!rect) {
console.log('Unabled to find the element!');
phantom.exit(2);
return false;
}
for (k in rect) {
rect[k] *= page.zoomFactor;
}
page.clipRect = rect;
page.render(output);
phantom.exit();
}, 500);
}
});
}
| var page = require('webpage').create(),
system = require('system'),
address, output, size;
page.viewportSize = {
width: 640,
height: 480
};
if (system.args.length < 4 || system.args.length > 5) {
console.log('Usage: '+system.args[0]+' URL selector filename [zoom]');
phantom.exit(1);
} else {
address = system.args[1];
selector = system.args[2];
output = system.args[3];
if (system.args.length > 4) {
page.zoomFactor = system.args[4];
}
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit(1);
} else {
window.setTimeout(function () {
var rect = page.evaluate(function(selector) {
var el = document.querySelector(selector);
if (!el) {
return null;
}
return el.getBoundingClientRect();
}, selector);
if (!rect) {
console.log('Unabled to find the element!');
phantom.exit(2);
return false;
}
for (k in rect) {
rect[k] *= page.zoomFactor;
}
page.clipRect = rect;
page.render(output);
phantom.exit();
}, 500);
}
});
}
| Set viewport size to 640 x 480 | Set viewport size to 640 x 480
| JavaScript | mit | buo/stamper | ---
+++
@@ -1,6 +1,11 @@
var page = require('webpage').create(),
system = require('system'),
address, output, size;
+
+page.viewportSize = {
+ width: 640,
+ height: 480
+};
if (system.args.length < 4 || system.args.length > 5) {
console.log('Usage: '+system.args[0]+' URL selector filename [zoom]'); |
3bd40745f69a0f44bcb47dd77180e3a675fc851a | back/controllers/index.controller.js | back/controllers/index.controller.js | const path = require('path');
const express = require('express');
const router = express.Router();
const log = require('../logger');
const wordsRepository = new (require("../repositories/word.repository"))();
router.get('/', (req, res) => {
wordsRepository.getRandomWords(6)
.then(words => {
res.render("index", {
"words": words.map(word => word.dataValues)
});
})
.catch(error => {
log.error(error);
res.status(500).json(error);
})
});
router.get(['/chat', '/account', '/leaderboards'], (req, res) => {
const mainFilePath = path.join(__dirname, '..', '..', 'front', 'dist', 'index.html');
res.sendFile(path.join(mainFilePath));
});
module.exports = router;
| const path = require('path');
const express = require('express');
const router = express.Router();
const log = require('../logger');
const wordsRepository = new (require("../repositories/word.repository"))();
router.get('/', (req, res) => {
wordsRepository.getRandomWords(6)
.then(words => {
res.render("index", {
"words": words.map(word => word.dataValues)
});
})
.catch(error => {
log.error(error);
res.status(500).json(error);
})
});
router.get([
'/chat',
'/account',
'/leaderboards',
'/signin',
'/signup',
'/score'], (req, res) => {
const mainFilePath = path.join(__dirname, '..', '..', 'front', 'dist', 'index.html');
res.sendFile(path.join(mainFilePath));
});
module.exports = router;
| Add mapping to angular routes | feat(back): Add mapping to angular routes
| JavaScript | bsd-3-clause | Saka7/word-kombat,Saka7/word-kombat,Saka7/word-kombat,Saka7/word-kombat | ---
+++
@@ -17,9 +17,15 @@
})
});
-router.get(['/chat', '/account', '/leaderboards'], (req, res) => {
- const mainFilePath = path.join(__dirname, '..', '..', 'front', 'dist', 'index.html');
- res.sendFile(path.join(mainFilePath));
+router.get([
+ '/chat',
+ '/account',
+ '/leaderboards',
+ '/signin',
+ '/signup',
+ '/score'], (req, res) => {
+ const mainFilePath = path.join(__dirname, '..', '..', 'front', 'dist', 'index.html');
+ res.sendFile(path.join(mainFilePath));
});
module.exports = router; |
2b4f8c7d914a2539af765ee2d1a56688073b2c25 | app/assets/javascripts/express_admin/utility.js | app/assets/javascripts/express_admin/utility.js | $(function() {
// toggle on/off switch
$(document).on('click', '[data-toggle]', function() {
targetHide = $(this).data('toggle-hide')
targetShow = $(this).data('toggle-show')
$('[data-toggle-name="' + targetHide + '"]').addClass('hide')
$('[data-toggle-name="' + targetShow + '"]').removeClass('hide')
.find('input:text, textarea').first().focus()
});
// AJAX request utility
AJAXRequest = function(url, method, data, success, error)
{
return $.ajax({
url : url,
type : method,
data : data,
dataType : 'JSON',
cache : false,
success : function(json)
{
success(json)
},
error : function()
{
error()
}
});
}
});
| $(function() {
// toggle on/off switch
$(document).on('click', '[data-toggle]', function() {
targetHide = $(this).data('toggle-hide')
targetShow = $(this).data('toggle-show')
$('[data-toggle-name="' + targetHide + '"]').addClass('hide')
$('[data-toggle-name="' + targetShow + '"]').removeClass('hide')
});
// AJAX request utility
AJAXRequest = function(url, method, data, success, error)
{
return $.ajax({
url : url,
type : method,
data : data,
dataType : 'JSON',
cache : false,
success : function(json)
{
success(json)
},
error : function()
{
error()
}
});
}
});
| Remove the auto focus on element toggle feature | Remove the auto focus on element toggle feature
| JavaScript | mit | aelogica/express_admin,aelogica/express_admin,aelogica/express_admin,aelogica/express_admin | ---
+++
@@ -6,7 +6,6 @@
targetShow = $(this).data('toggle-show')
$('[data-toggle-name="' + targetHide + '"]').addClass('hide')
$('[data-toggle-name="' + targetShow + '"]').removeClass('hide')
- .find('input:text, textarea').first().focus()
});
// AJAX request utility |
6bb308cd9a8860e6b99d9c23e070386883feaf17 | bundles/routing/bundle/inapprouting/instance.js | bundles/routing/bundle/inapprouting/instance.js | /**
* This bundle logs the map click coordinates to the console. This is a demonstration of using DefaultExtension.
*
* @class Oskari.routing.bundle.inapprouting.InAppRoutingBundleInstance
*/
Oskari.clazz.define('Oskari.routing.bundle.inapprouting.InAppRoutingBundleInstance',
/**
* @method create called automatically on construction
* @static
*/
function () {
// Best practice is to initialize instance variables here.
this.myVar = undefined;
}, {
/**
* @static
* @property __name
*/
__name : 'inapprouting',
/**
* Module protocol method
*
* @method getName
*/
getName : function () {
return this.__name;
},
start: function() {
var sandbox = Oskari.getSandbox();
console.log('Starting bundle with sandbox: ', sandbox);
},
eventHandlers: {
'MapClickedEvent': function (event) {
console.log('Map clicked at', event.getLonLat());
}
},
/**
* DefaultExtension method for doing stuff after the bundle has started.
*
* @method afterStart
*/
afterStart: function (sandbox) {
console.log('Bundle', this.getName(), 'started');
this.myVar = 'foobar';
}
}, {
"extend" : ["Oskari.userinterface.extension.DefaultExtension"]
}); | /**
* This bundle logs the map click coordinates to the console. This is a demonstration of using DefaultExtension.
*
* @class Oskari.routing.bundle.inapprouting.InAppRoutingBundleInstance
*/
Oskari.clazz.define('Oskari.routing.bundle.inapprouting.InAppRoutingBundleInstance',
/**
* @method create called automatically on construction
* @static
*/
function () {
// Best practice is to initialize instance variables here.
this.myVar = undefined;
}, {
/**
* @static
* @property __name
*/
__name : 'inapprouting',
/**
* Module protocol method
*
* @method getName
*/
getName : function () {
return this.__name;
},
eventHandlers: {
'MapClickedEvent': function (event) {
console.log('Map clicked at ' + event.getLonLat());
var sandbox = Oskari.getSandbox();
var url = sandbox.getAjaxUrl() + 'action_route=CalculateRoute';
jQuery.getJSON(url, function(data) { console.log('Great success: ', data) });
}
},
/**
* DefaultExtension method for doing stuff after the bundle has started.
*
* @method afterStart
*/
afterStart: function (sandbox) {
console.log('Bundle', this.getName(), 'started');
this.myVar = 'foobar';
}
}, {
"extend" : ["Oskari.userinterface.extension.DefaultExtension"]
}); | Make backend call for calculating route | Make backend call for calculating route
| JavaScript | mit | uhef/Oskari-Routing-frontend,uhef/Oskari-Routing-frontend,uhef/Oskari-Routing-frontend,uhef/Oskari-Routing-frontend,uhef/Oskari-Routing-frontend,uhef/Oskari-Routing-frontend | ---
+++
@@ -25,13 +25,12 @@
getName : function () {
return this.__name;
},
- start: function() {
- var sandbox = Oskari.getSandbox();
- console.log('Starting bundle with sandbox: ', sandbox);
- },
eventHandlers: {
'MapClickedEvent': function (event) {
- console.log('Map clicked at', event.getLonLat());
+ console.log('Map clicked at ' + event.getLonLat());
+ var sandbox = Oskari.getSandbox();
+ var url = sandbox.getAjaxUrl() + 'action_route=CalculateRoute';
+ jQuery.getJSON(url, function(data) { console.log('Great success: ', data) });
}
},
/** |
5387eae85dcaf6051d0d9fde7c108509d8cd7755 | sandbox/run_rhino.js | sandbox/run_rhino.js | load('bower_components/qunit/qunit/qunit.js');
load('bower_components/qunit-tap/lib/qunit-tap.js');
load('bower_components/power-assert-formatter/lib/power-assert-formatter.js');
load('bower_components/empower/lib/empower.js');
(function () {
qunitTap(QUnit, print, {
showModuleNameOnFailure: true,
showTestNameOnFailure: true,
showExpectationOnFailure: true,
showSourceOnFailure: false
});
empower(QUnit.assert, powerAssertFormatter(), {destructive: true});
})();
QUnit.config.autorun = false;
load('sandbox/qunit_rhino_espowered.js');
QUnit.load();
| load('bower_components/qunit/qunit/qunit.js');
load('bower_components/qunit-tap/lib/qunit-tap.js');
load('bower_components/estraverse/estraverse.js');
load('bower_components/power-assert-formatter/lib/power-assert-formatter.js');
load('bower_components/empower/lib/empower.js');
(function () {
qunitTap(QUnit, print, {
showModuleNameOnFailure: true,
showTestNameOnFailure: true,
showExpectationOnFailure: true,
showSourceOnFailure: false
});
empower(QUnit.assert, powerAssertFormatter(), {destructive: true});
})();
QUnit.config.autorun = false;
load('sandbox/qunit_rhino_espowered.js');
QUnit.load();
| Update Rhino example since power-assert-formatter requires estraverse as runtime dependency. | Update Rhino example since power-assert-formatter requires estraverse as runtime dependency.
| JavaScript | mit | twada/power-assert,saneyuki/power-assert,power-assert-js/power-assert,twada/power-assert,falsandtru/power-assert,yagitoshiro/power-assert,falsandtru/power-assert,power-assert-js/power-assert,saneyuki/power-assert,yagitoshiro/power-assert | ---
+++
@@ -1,5 +1,6 @@
load('bower_components/qunit/qunit/qunit.js');
load('bower_components/qunit-tap/lib/qunit-tap.js');
+load('bower_components/estraverse/estraverse.js');
load('bower_components/power-assert-formatter/lib/power-assert-formatter.js');
load('bower_components/empower/lib/empower.js');
|
ff82e198ca173fdbb5837982c3795af1dec3a15d | aura-components/src/main/components/ui/abstractList/abstractListRenderer.js | aura-components/src/main/components/ui/abstractList/abstractListRenderer.js | /*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
/*
* These helper methods are in the renderer due to the many ways
* that abstractList can be implemented. Since controller methods
* can be overridden, and component creation can be dynamic, putting
* the relevant helper method call in the renderer ensures that the
* emptyListContent is handled no matter how the list is implemented.
*/
afterRender : function(component, helper){
this.superAfterRender();
helper.updateEmptyListContent(component);
},
rerender : function(component, helper){
this.superRerender();
if (component.getConcreteComponent().isDirty('v.items')) {
helper.updateEmptyListContent(component);
}
}
})// eslint-disable-line semi
| /*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
/*
* These helper methods are in the renderer due to the many ways
* that abstractList can be implemented. Since controller methods
* can be overridden, and component creation can be dynamic, putting
* the relevant helper method call in the renderer ensures that the
* emptyListContent is handled no matter how the list is implemented.
*/
afterRender : function(component, helper){
this.superAfterRender();
helper.updateEmptyListContent(component);
},
rerender : function(component){
this.superRerender();
var concreteCmp = component.getConcreteComponent();
if (concreteCmp.isDirty('v.items')) {
concreteCmp.getDef().getHelper().updateEmptyListContent(component);
}
}
})// eslint-disable-line semi
| Make renderer polymorphically call updateEmptyListContent | Make renderer polymorphically call updateEmptyListContent
@bug W-3836575@
@rev trey.washington@
| JavaScript | apache-2.0 | forcedotcom/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,forcedotcom/aura,forcedotcom/aura,madmax983/aura,madmax983/aura,madmax983/aura,madmax983/aura,madmax983/aura | ---
+++
@@ -25,10 +25,11 @@
this.superAfterRender();
helper.updateEmptyListContent(component);
},
- rerender : function(component, helper){
+ rerender : function(component){
this.superRerender();
- if (component.getConcreteComponent().isDirty('v.items')) {
- helper.updateEmptyListContent(component);
+ var concreteCmp = component.getConcreteComponent();
+ if (concreteCmp.isDirty('v.items')) {
+ concreteCmp.getDef().getHelper().updateEmptyListContent(component);
}
}
})// eslint-disable-line semi |
582e35fe2da8239bec3675e837cb704f7275f1fc | examples/backbone_marionette/js/TodoMVC.Todos.js | examples/backbone_marionette/js/TodoMVC.Todos.js | /*global TodoMVC */
'use strict';
TodoMVC.module('Todos', function (Todos, App, Backbone) {
// Todo Model
// ----------
Todos.Todo = Backbone.Model.extend({
defaults: {
title: '',
completed: false,
created: 0
},
initialize: function () {
if (this.isNew()) {
this.set('created', Date.now());
}
},
toggle: function () {
return this.set('completed', !this.isCompleted());
},
isCompleted: function () {
return this.get('completed');
},
matchesFilter: function (filter) {
if (filter == 'all') {
return true;
}
if (filter == 'active') {
return !this.isCompleted();
}
return this.isCompleted();
}
});
// Todo Collection
// ---------------
Todos.TodoList = Backbone.Collection.extend({
model: Todos.Todo,
localStorage: new Backbone.LocalStorage('todos-backbone-marionette'),
getCompleted: function () {
return this.filter(this._isCompleted);
},
getActive: function () {
return this.reject(this._isCompleted);
},
comparator: 'created',
_isCompleted: function (todo) {
return todo.isCompleted();
}
});
});
| /*global TodoMVC */
'use strict';
TodoMVC.module('Todos', function (Todos, App, Backbone) {
// Todo Model
// ----------
Todos.Todo = Backbone.Model.extend({
defaults: {
title: '',
completed: false,
created: 0
},
initialize: function () {
if (this.isNew()) {
this.set('created', Date.now());
}
},
toggle: function () {
return this.set('completed', !this.isCompleted());
},
isCompleted: function () {
return this.get('completed');
},
matchesFilter: function (filter) {
if (filter == 'all') {
return true;
}
if (filter == 'active') {
return !this.isCompleted();
}
return this.isCompleted();
}
});
// Todo Collection
// ---------------
Todos.TodoList = Backbone.Collection.extend({
model: Todos.Todo,
localStorage: new Backbone.LocalStorage('todos-backbone-marionette'),
comparator: 'created',
getCompleted: function () {
return this.filter(this._isCompleted);
},
getActive: function () {
return this.reject(this._isCompleted);
},
_isCompleted: function (todo) {
return todo.isCompleted();
}
});
});
| Move attribute comparator with others | Move attribute comparator with others
| JavaScript | mit | skatejs/todomvc,luxiaojian/todomvc,amy-chiu/todomvc,sophiango/todomvc,raiamber1/todomvc,Granze/todomvc,webcoding/todomvc,laomagege/todomvc,wangcan2014/todomvc,digideskio/todomvc,planttheidea/todomvc,wangjun/todomvc,vanyadymousky/todomvc,nbr1ninrsan2/todomvc,msi008/todomvc,mboudreau/todomvc,watonyweng/todomvc,nancy44/todomvc,stoeffel/todomvc,Anasskebabi/todomvc,ssarber/todo-mvc-angular,commana/todomvc,jcpeters/todomvc,webcoding/todomvc,nharada1/todomvc,dchambers/todomvc,briancavalier/todomvc-fab,shui91/todomvc,slegrand45/todomvc,ksteigerwald/todomvc,joelmatiassilva/todomvc,somallg/todomvc,ryoia/todomvc,winweb/todomvc,mikesprague/todomvc,cbolton97/todomvc,shawn-dsz/todomvc,niki571/todomvc,Granze/todomvc,planttheidea/todomvc,silentHoo/todomvc-ngpoly,massimiliano-mantione/todomvc,sohucw/todomvc,Aupajo/todomvc,sohucw/todomvc,Garbar/todomvc,colinkuo/todomvc,zingorn/todomvc,mikesprague/todomvc,massimiliano-mantione/todomvc,samccone/todomvc,zingorn/todomvc,shanemgrey/todomvc,luxiaojian/todomvc,nordfjord/todomvc,yuetsh/todomvc,brsteele/todomvc,youprofit/todomvc,weijye91/todomvc,balintsoos/todomvc,biomassives/angular2_todomvc,kaidokert/todomvc,ivanKaunov/todomvc,SooyoungYoon/todomvc,rdingwall/todomvc,bsoe003/todomvc,jrpeasee/todomvc,wangjun/todomvc,rodrigoolivares/todomvc,aarai/todomvc,miyai-chihiro/todomvc,baiyaaaaa/todomvc,jrpeasee/todomvc,dylanham/todomvc,slegrand45/todomvc,holydevilboy/todomvc,smasala/todomvc,Kedarnath13/todomvc,cbolton97/todomvc,pplgin/todomvc,blink1073/todomvc,Senhordim/todomvc,bryanborough/todomvc,leverz/todomvc,edueo/todomvc,pawelqbera/todomvc,joelmatiassilva/todomvc,txchen/todomvc,edueo/todomvc,jdlawrence/todomvc,pro100jam/todomvc,natelaclaire/todomvc,asudoh/todomvc,xtian/todomvc,evansendra/todomvc,teng2015/todomvc,TodoFlux/todoflux,petebacondarwin/todomvc,arthurvr/todomvc,s-endres/todomvc,alohaglenn/todomvc,kaidokert/todomvc,jcpeters/todomvc,fangjing828/todomvc,sergeirybalko/todomvc,allanbrito/todomvc,mikesprague/todomvc,Qwenbo/todomvc,planttheidea/todomvc,kaidokert/todomvc,joelmatiassilva/todomvc,nweber/todomvc,silentHoo/todomvc-ngpoly,unmanbearpig/todomvc,mweststrate/todomvc,MikeDulik/todomvc,bryan7c/todomvc,ajansa/todomvc,Duc-Ngo-CSSE/todomvc,rdingwall/todomvc,mweststrate/todomvc,ryoia/todomvc,slegrand45/todomvc,szytko/todomvc,bowcot84/todomvc,robwilde/todomvc,jdfeemster/todomvc,stoeffel/todomvc,slegrand45/todomvc,colingourlay/todomvc,sjclijie/todomvc,unmanbearpig/todomvc,mroserov/todomvc,chrisdarroch/todomvc,feathersjs/todomvc,fszlin/todomvc,skatejs/todomvc,bryanborough/todomvc,guillermodiazga/todomvc,vikbert/todomvc,thebkbuffalo/todomvc,maksymkhar/todomvc,YaqubGhazi/todomvc,chrisfcarroll/todomvc,zeropool/todomvc,ZusOR/todomvc,sammcgrail/todomvc,eduardogomes/todomvc,ABaldwinHunter/todomvc-clone,SooyoungYoon/todomvc,blink1073/todomvc,colinkuo/todomvc,bondvt04/todomvc,olegbc/todomvc,guillermodiazga/todomvc,altmind/todomvc,dchambers/todomvc,bonbonez/todomvc,brsteele/todomvc,kasperpeulen/todomvc,freeyiyi1993/todomvc,fangjing828/todomvc,arthurvr/todomvc,tianskyluj/todomvc,zeropool/todomvc,AmilaViduranga/todomvc,jchadwick/todomvc,thibaultzanini/todomvc,Granze/todomvc,planttheidea/todomvc,sethkrasnianski/todomvc,marcolamberto/todomvc,theflimflam/todomvc,vicentemaximilianoh/todomvc,MakarovMax/todomvc,andrepitombeira/todomvc,yisbug/todomvc,jrpeasee/todomvc,natalieparellano/todomvc,cssJumper1995/todomvc,vanyadymousky/todomvc,sophiango/todomvc,brenopolanski/todomvc,lh8725473/todomvc,4talesa/todomvc,freeyiyi1993/todomvc,MikeDulik/todomvc,webcoding/todomvc,suryasingh/todomvc,lingjuan/todomvc,biomassives/angular2_todomvc,dudeOFprosper/todomvc,ClashTheBunny/todomvc,bondvt04/todomvc,Keystion/todomvc,nbr1ninrsan2/todomvc,aarai/todomvc,Drup/todomvc,ajream/todomvc,xtian/todomvc,ABaldwinHunter/todomvc-clone,jdlawrence/todomvc,kidbai/todomvc,korrawit/todomvc,ngbrya/todomvc,CreaturePhil/todomvc,unmanbearpig/todomvc,Live4Code/todomvc,kaidokert/todomvc,XiaominnHoo/todomvc,pbaron977/todomvc,santhoshi-viriventi/todomvc,jdfeemster/todomvc,edwardpark/todomvc,nancy44/todomvc,yzfcxr/todomvc,ac-adekunle/todomvc,wangdahoo/todomvc,akollegger/todomvc,xtian/todomvc,pro100jam/todomvc,john-jay/todomvc,meligatt/todomvc,suryasingh/todomvc,lorgiorepo/todomvc,yzfcxr/todomvc,amorphid/todomvc,laomagege/todomvc,Keystion/todomvc,pplgin/todomvc,pplgin/todomvc,zeropool/todomvc,kmalakoff/todomvc,niki571/todomvc,ksteigerwald/todomvc,arthurvr/todomvc,yejodido/todomvc,s-endres/todomvc,Anasskebabi/todomvc,somallg/todomvc,zingorn/todomvc,Senhordim/todomvc,Brycetastic/todomvc,yejodido/todomvc,pawelqbera/todomvc,massimiliano-mantione/todomvc,amy-chiu/todomvc,biomassives/angular2_todomvc,wcyz666/todomvc,chrisfcarroll/todomvc,kidbai/todomvc,shanemgrey/todomvc,yuetsh/todomvc,aitchkhan/todomvc,Granze/todomvc,allanbrito/todomvc,startersacademy/todomvc,nharada1/todomvc,pandoraui/todomvc,freeyiyi1993/todomvc,ngbrya/todomvc,sethkrasnianski/todomvc,Live4Code/todomvc,kpaxqin/todomvc,zingorn/todomvc,asudoh/todomvc,pgraff/js4secourse,laomagege/todomvc,neapolitan-a-la-code/todoAngJS,wangjun/todomvc,baymaxi/todomvc,lgsanjos/todomvc,massimiliano-mantione/todomvc,Senhordim/todomvc,Rithie/todomvc,YaqubGhazi/todomvc,jrpeasee/todomvc,samccone/todomvc,bdylanwalker/todomvc,bdylanwalker/todomvc,baymaxi/todomvc,shanemgrey/todomvc,jj4th/todomvc-poc,petebacondarwin/todomvc,zxc0328/todomvc,lorgiorepo/todomvc,ozywuli/todomvc,msi008/todomvc,Qwenbo/todomvc,vikbert/todomvc,fchareyr/todomvc,colinkuo/todomvc,pgraff/js4secourse,edwardpark/todomvc,theflimflam/todomvc,fchareyr/todomvc,massimiliano-mantione/todomvc,michalsnik/todomvc,bonbonez/todomvc,guillermodiazga/todomvc,arunrajnayak/todomvc,arthurvr/todomvc,smasala/todomvc,pbaron977/todomvc,biomassives/angular2_todomvc,santhoshi-viriventi/todomvc,gmoura/todomvc,Brycetastic/todomvc,briancavalier/todomvc-fab,watonyweng/todomvc,dudeOFprosper/todomvc,s-endres/todomvc,zxc0328/todomvc,stevengregory/todomvc,tweinfeld/todomvc,xtian/todomvc,makelivedotnet/todomvc,zxc0328/todomvc,marcolamberto/todomvc,lh8725473/todomvc,glizer/todomvc,gmoura/todomvc,Aupajo/todomvc,lh8725473/todomvc,peterkokot/todomvc,niki571/todomvc,edueo/todomvc,Drup/todomvc,wangcan2014/todomvc,albrow/todomvc,cledwyn/todomvc,sohucw/todomvc,v2018z/todomvc,watonyweng/todomvc,MariaSimion/todomvc,rdingwall/todomvc,cyberkoi/todomvc,fszlin/todomvc,zxc0328/todomvc,kasperpeulen/todomvc,jkf91/todomvc,shanemgrey/todomvc,kmalakoff/todomvc,mweststrate/todomvc,albrow/todomvc,fr0609/todomvc,ivanKaunov/todomvc,laomagege/todomvc,ajream/todomvc,YaqubGhazi/todomvc,bonbonez/todomvc,pandoraui/todomvc,andrepitombeira/todomvc,dudeOFprosper/todomvc,babarqb/todomvc,johnbender/todomvc,natalieparellano/todomvc,weivea/todomvc,troopjs-university/todomvc,bondvt04/todomvc,skatejs/todomvc,jj4th/todomvc-poc,weijye91/todomvc,lh8725473/todomvc,trexnix/todomvc,marchant/todomvc,therebelbeta/todomvc,yblee85/todomvc,kingsj/todomvc,stoeffel/todomvc,jeff235255/todomvc,johnbender/todomvc,youprofit/todomvc,YaqubGhazi/todomvc,winweb/todomvc,dudeOFprosper/todomvc,tianskyluj/todomvc,JinaLeeK/todomvc,bowcot84/todomvc,blink2ce/todomvc,baymaxi/todomvc,JinaLeeK/todomvc,danleavitt0/todomvc,mweststrate/todomvc,samccone/todomvc,startersacademy/todomvc,jeff235255/todomvc,yblee85/todomvc,cledwyn/todomvc,vikbert/todomvc,urkaver/todomvc,danleavitt0/todomvc,NickManos/todoMVC,Kedarnath13/todomvc,suryasingh/todomvc,asudoh/todomvc,arunrajnayak/todomvc,CreaturePhil/todomvc,thebkbuffalo/todomvc,theflimflam/todomvc,griffiti/todomvc,smasala/todomvc,zxc0328/todomvc,youprofit/todomvc,michalsnik/todomvc,nordfjord/todomvc,therebelbeta/todomvc,ssarber/todo-mvc-angular,natelaclaire/todomvc,margaritis/todomvc,peterkokot/todomvc,Kedarnath13/todomvc,sjclijie/todomvc,Drup/todomvc,arthurvr/todomvc,aitchkhan/todomvc,Anasskebabi/todomvc,AmilaViduranga/todomvc,lingjuan/todomvc,mroserov/todomvc,edygar/todomvc,PolarBearAndrew/todomvc,mweststrate/todomvc,dsumac/todomvc,PolarBearAndrew/todomvc,v2018z/todomvc,XiaominnHoo/todomvc,jj4th/todomvc-poc,ivanKaunov/todomvc,ccpowell/todomvc,pbaron977/todomvc,lorgiorepo/todomvc,SooyoungYoon/todomvc,arthurvr/todomvc,margaritis/todomvc,Granze/todomvc,peterkokot/todomvc,ajansa/todomvc,jchadwick/todomvc,korrawit/todomvc,chrisfcarroll/todomvc,bondvt04/todomvc,yuetsh/todomvc,vite21/todomvc,glizer/todomvc,samccone/todomvc,beni55/todomvc,cyberkoi/todomvc,electricessence/todomvc,startersacademy/todomvc,ABaldwinHunter/todomvc-clone,4talesa/todomvc,chrisfcarroll/todomvc,yisbug/todomvc,dcrlz/todomvc,colingourlay/todomvc,lingjuan/todomvc,dudeOFprosper/todomvc,sjclijie/todomvc,eatrocks/todomvc,cledwyn/todomvc,tweinfeld/todomvc,benmccormick/todomvc,aarai/todomvc,weijye91/todomvc,CreaturePhil/todomvc,fr0609/todomvc,yejodido/todomvc,somallg/todomvc,Duc-Ngo-CSSE/todomvc,SooyoungYoon/todomvc,xtian/todomvc,somallg/todomvc,maksymkhar/todomvc,NickManos/todoMVC,sohucw/todomvc,bryan7c/todomvc,yalishizhude/todomvc,cssJumper1995/todomvc,rwson/todomvc,kasperpeulen/todomvc,dasaprakashk/todomvc,bowcot84/todomvc,bryan7c/todomvc,biomassives/angular2_todomvc,Keystion/todomvc,smasala/todomvc,luxiaojian/todomvc,altmind/todomvc,NickManos/todoMVC,akollegger/todomvc,2011uit1719/todomvc,jeremyeaton89/todomvc,sammcgrail/todomvc,cledwyn/todomvc,kaidokert/todomvc,bondvt04/todomvc,wcyz666/todomvc,yyx990803/todomvc,vuejs/todomvc,watonyweng/todomvc,yisbug/todomvc,benmccormick/todomvc,jcpeters/todomvc,johnbender/todomvc,laomagege/todomvc,bondvt04/todomvc,weivea/todomvc,Yogi-Jiang/todomvc,teng2015/todomvc,jaredhensley/todomvc,watonyweng/todomvc,jeremyeaton89/todomvc,colinkuo/todomvc,santhoshi-viriventi/todomvc,kpaxqin/todomvc,holydevilboy/todomvc,Live4Code/todomvc,sammcgrail/todomvc,jcpeters/todomvc,oskargustafsson/todomvc,cyberkoi/todomvc,aitchkhan/todomvc,ksteigerwald/todomvc,brenopolanski/todomvc,cyberkoi/todomvc,elacin/todomvc,Bieliakov/todomvc,MarkHarper/todomvc,samccone/todomvc,vite21/todomvc,rdingwall/todomvc,makelivedotnet/todomvc,eatrocks/todomvc,alohaglenn/todomvc,albrow/todomvc,lgsanjos/todomvc,trexnix/todomvc,robwilde/todomvc,jwabbitt/todomvc,ZusOR/todomvc,bryan7c/todomvc,bdylanwalker/todomvc,andrepitombeira/todomvc,zingorn/todomvc,craigmckeachie/todomvc,podefr/todomvc,CreaturePhil/todomvc,andreaswachowski/todomvc,Drup/todomvc,shanemgrey/todomvc,gmoura/todomvc,pawelqbera/todomvc,sammcgrail/todomvc,lh8725473/todomvc,margaritis/todomvc,Gsearch/todomvc,smasala/todomvc,dcrlz/todomvc,edwardpark/todomvc,lingjuan/todomvc,ivanKaunov/todomvc,korrawit/todomvc,Senhordim/todomvc,Bieliakov/todomvc,pandoraui/todomvc,MarkHarper/todomvc,fangjing828/todomvc,rodrigoolivares/todomvc,kingsj/todomvc,sophiango/todomvc,smasala/todomvc,MikeDulik/todomvc,thibaultzanini/todomvc,MakarovMax/todomvc,leverz/todomvc,andrepitombeira/todomvc,olegbc/todomvc,michalsnik/todomvc,fr0609/todomvc,amy-chiu/todomvc,sjclijie/todomvc,mroserov/todomvc,pbaron977/todomvc,mhoyer/todomvc,joelmatiassilva/todomvc,jeff235255/todomvc,edwardpark/todomvc,skatejs/todomvc,griffiti/todomvc,eatrocks/todomvc,briancavalier/todomvc-fab,nbr1ninrsan2/todomvc,kaidokert/todomvc,tianskyluj/todomvc,colinkuo/todomvc,trexnix/todomvc,electricessence/todomvc,eduardogomes/todomvc,patrick-frontend/todomvc,dcrlz/todomvc,ccpowell/todomvc,wcyz666/todomvc,bowcot84/todomvc,troopjs-university/todomvc,dcrlz/todomvc,YaqubGhazi/todomvc,patrick-frontend/todomvc,tianskyluj/todomvc,XiaominnHoo/todomvc,sammcgrail/todomvc,yzfcxr/todomvc,TodoFlux/todoflux,sjclijie/todomvc,neapolitan-a-la-code/todoAngJS,trexnix/todomvc,amorphid/todomvc,ssarber/todo-mvc-angular,pgraff/js4secourse,startersacademy/todomvc,bryan7c/todomvc,gmoura/todomvc,txchen/todomvc,dudeOFprosper/todomvc,sergeirybalko/todomvc,vikbert/todomvc,commana/todomvc,ac-adekunle/todomvc,planttheidea/todomvc,edwardpark/todomvc,CreaturePhil/todomvc,digideskio/todomvc,niki571/todomvc,tianskyluj/todomvc,suryasingh/todomvc,lh8725473/todomvc,luxiaojian/todomvc,craigmckeachie/todomvc,edygar/todomvc,peterkokot/todomvc,lorgiorepo/todomvc,pgraff/js4secourse,peterkokot/todomvc,Gsearch/todomvc,mikesprague/todomvc,skatejs/todomvc,edwardpark/todomvc,balintsoos/todomvc,jcpeters/todomvc,chrisdarroch/todomvc,pbaron977/todomvc,bryanborough/todomvc,ivanKaunov/todomvc,kidbai/todomvc,nordfjord/todomvc,sohucw/todomvc,Bieliakov/todomvc,therebelbeta/todomvc,digideskio/todomvc,cbolton97/todomvc,andrepitombeira/todomvc,bryan7c/todomvc,ebidel/todomvc,edueo/todomvc,guillermodiazga/todomvc,bonbonez/todomvc,colingourlay/todomvc,margaritis/todomvc,mboudreau/todomvc,kpaxqin/todomvc,yalishizhude/todomvc,jaredhensley/todomvc,chrisfcarroll/todomvc,Keystion/todomvc,jchadwick/todomvc,wangdahoo/todomvc,chrisdarroch/todomvc,TodoFlux/todoflux,trexnix/todomvc,bsoe003/todomvc,patrick-frontend/todomvc,kmalakoff/todomvc,patrick-frontend/todomvc,jaredhensley/todomvc,sergeirybalko/todomvc,NickManos/todoMVC,raiamber1/todomvc,cornerbodega/todomvc,mhoyer/todomvc,stevengregory/todomvc,mikesprague/todomvc,commana/todomvc,shui91/todomvc,SooyoungYoon/todomvc,suryasingh/todomvc,niki571/todomvc,ebidel/todomvc,rdingwall/todomvc,oskargustafsson/todomvc,colinkuo/todomvc,yyx990803/todomvc,edueo/todomvc,raiamber1/todomvc,yalishizhude/todomvc,electricessence/todomvc,dcrlz/todomvc,babarqb/todomvc,amorphid/todomvc,theoldnewbie/todomvc,arunrajnayak/todomvc,feathersjs/todomvc,blink2ce/todomvc,ac-adekunle/todomvc,cledwyn/todomvc,zxc0328/todomvc,Granze/todomvc,ssarber/todo-mvc-angular,maksymkhar/todomvc,ebidel/todomvc,mweststrate/todomvc,planttheidea/todomvc,olegbc/todomvc,joelmatiassilva/todomvc,brsteele/todomvc,troopjs-university/todomvc,pgraff/js4secourse,electricessence/todomvc,shui91/todomvc,dylanham/todomvc,blink2ce/todomvc,pro100jam/todomvc,andreaswachowski/todomvc,lorgiorepo/todomvc,guillermodiazga/todomvc,theoldnewbie/todomvc,ClashTheBunny/todomvc,CreaturePhil/todomvc,cyberkoi/todomvc,jwabbitt/todomvc,ngbrya/todomvc,podefr/todomvc,feathersjs/todomvc,eatrocks/todomvc,troopjs-university/todomvc,Rithie/todomvc,vicentemaximilianoh/todomvc,jdlawrence/todomvc,cornerbodega/todomvc,sohucw/todomvc,massimiliano-mantione/todomvc,petebacondarwin/todomvc,silentHoo/todomvc-ngpoly,v2018z/todomvc,trungtranthanh93/todomvc,danleavitt0/todomvc,eatrocks/todomvc,samccone/todomvc,balintsoos/todomvc,therebelbeta/todomvc,StanislavMar/todomvc,rwson/todomvc,somallg/todomvc,MakarovMax/todomvc,meligatt/todomvc,Qwenbo/todomvc,marchant/todomvc,natalieparellano/todomvc,urkaver/todomvc,tianskyluj/todomvc,bonbonez/todomvc,dchambers/todomvc,yzfcxr/todomvc,PolarBearAndrew/todomvc,nitish1125/todomvc,holydevilboy/todomvc,trexnix/todomvc,jkf91/todomvc,szytko/todomvc,altmind/todomvc,mboudreau/todomvc,natalieparellano/todomvc,jdlawrence/todomvc,ozywuli/todomvc,blink1073/todomvc,vite21/todomvc,Garbar/todomvc,leverz/todomvc,StanislavMar/todomvc,msi008/todomvc,Yogi-Jiang/todomvc,arunrajnayak/todomvc,cbolton97/todomvc,elacin/todomvc,shawn-dsz/todomvc,dsumac/todomvc,bsoe003/todomvc,nitish1125/todomvc,miyai-chihiro/todomvc,john-jay/todomvc,elacin/todomvc,AmilaViduranga/todomvc,startersacademy/todomvc,fszlin/todomvc,laomagege/todomvc,allanbrito/todomvc,MariaSimion/todomvc,gmoura/todomvc,ozywuli/todomvc,winweb/todomvc,YaqubGhazi/todomvc,nancy44/todomvc,Senhordim/todomvc,v2018z/todomvc,ivanKaunov/todomvc,ccpowell/todomvc,guillermodiazga/todomvc,weivea/todomvc,wallacecmo86/todomvc,2011uit1719/todomvc,Yogi-Jiang/todomvc,slegrand45/todomvc,wishpishh/todomvc,yalishizhude/todomvc,lingjuan/todomvc,dasaprakashk/todomvc,fr0609/todomvc,trungtranthanh93/todomvc,unmanbearpig/todomvc,luxiaojian/todomvc,arunrajnayak/todomvc,andrepitombeira/todomvc,makelivedotnet/todomvc,brenopolanski/todomvc,troopjs-university/todomvc,willycz/todomvc,slegrand45/todomvc,Rithie/todomvc,robwilde/todomvc,wishpishh/todomvc,Keystion/todomvc,briancavalier/todomvc-fab,youprofit/todomvc,txchen/todomvc,glizer/todomvc,electricessence/todomvc,benmccormick/todomvc,dylanham/todomvc,vuejs/todomvc,sammcgrail/todomvc,flaviotsf/todomvc,Qwenbo/todomvc,jkf91/todomvc,rodrigoolivares/todomvc,Drup/todomvc,pandoraui/todomvc,andreaswachowski/todomvc,szytko/todomvc,griffiti/todomvc,therebelbeta/todomvc,electricessence/todomvc,youprofit/todomvc,natelaclaire/todomvc,patrick-frontend/todomvc,jeremyeaton89/todomvc,unmanbearpig/todomvc,wallacecmo86/todomvc,lorgiorepo/todomvc,watonyweng/todomvc,bowcot84/todomvc,skatejs/todomvc,yzfcxr/todomvc,wishpishh/todomvc,vuejs/todomvc,Senhordim/todomvc,nitish1125/todomvc,Keystion/todomvc,shanemgrey/todomvc,yzfcxr/todomvc,zingorn/todomvc,altmind/todomvc,cyberkoi/todomvc,teng2015/todomvc,msi008/todomvc,ajansa/todomvc,pandoraui/todomvc,Anasskebabi/todomvc,v2018z/todomvc,theoldnewbie/todomvc,altmind/todomvc,yblee85/todomvc,andreaswachowski/todomvc,evansendra/todomvc,startersacademy/todomvc,nancy44/todomvc,MarkHarper/todomvc,ZusOR/todomvc,flaviotsf/todomvc,andreaswachowski/todomvc,Brycetastic/todomvc,yyx990803/todomvc,evansendra/todomvc,vanyadymousky/todomvc,dsumac/todomvc,msi008/todomvc,biomassives/angular2_todomvc,Drup/todomvc,wallacecmo86/todomvc,youprofit/todomvc,MariaSimion/todomvc,Live4Code/todomvc,Garbar/todomvc,Qwenbo/todomvc,jdlawrence/todomvc,neapolitan-a-la-code/todoAngJS,jwabbitt/todomvc,jdlawrence/todomvc,cornerbodega/todomvc,yyx990803/todomvc,mikesprague/todomvc,dasaprakashk/todomvc,gmoura/todomvc,baiyaaaaa/todomvc,edueo/todomvc,2011uit1719/todomvc,cssJumper1995/todomvc,Live4Code/todomvc,ajream/todomvc,andreaswachowski/todomvc,marcolamberto/todomvc,thebkbuffalo/todomvc,sethkrasnianski/todomvc,nancy44/todomvc,yalishizhude/todomvc,dylanham/todomvc,xtian/todomvc,pbaron977/todomvc,Aupajo/todomvc,v2018z/todomvc,edygar/todomvc,nweber/todomvc,Anasskebabi/todomvc,patrick-frontend/todomvc,lgsanjos/todomvc,flaviotsf/todomvc,msi008/todomvc,nharada1/todomvc,eatrocks/todomvc,alohaglenn/todomvc,fchareyr/todomvc,pgraff/js4secourse,joelmatiassilva/todomvc,podefr/todomvc,johnbender/todomvc,arunrajnayak/todomvc,bonbonez/todomvc,nweber/todomvc,willycz/todomvc,Yogi-Jiang/todomvc,thibaultzanini/todomvc,rwson/todomvc,StanislavMar/todomvc,john-jay/todomvc,Live4Code/todomvc,oskargustafsson/todomvc,wangcan2014/todomvc,dylanham/todomvc,sjclijie/todomvc,akollegger/todomvc,niki571/todomvc,shawn-dsz/todomvc,bowcot84/todomvc,craigmckeachie/todomvc,cbolton97/todomvc,beni55/todomvc,trungtranthanh93/todomvc,luxiaojian/todomvc,meligatt/todomvc,rdingwall/todomvc,urkaver/todomvc,ClashTheBunny/todomvc,miyai-chihiro/todomvc,willycz/todomvc,tweinfeld/todomvc,vikbert/todomvc,Duc-Ngo-CSSE/todomvc,Gsearch/todomvc,4talesa/todomvc,jrpeasee/todomvc,marchant/todomvc,ryoia/todomvc,Qwenbo/todomvc,nancy44/todomvc,cbolton97/todomvc,babarqb/todomvc,jdfeemster/todomvc,stevengregory/todomvc,mhoyer/todomvc,SooyoungYoon/todomvc,natalieparellano/todomvc,somallg/todomvc,asudoh/todomvc,lingjuan/todomvc,dylanham/todomvc,jrpeasee/todomvc,natalieparellano/todomvc,cledwyn/todomvc,unmanbearpig/todomvc,wangdahoo/todomvc,commana/todomvc,JinaLeeK/todomvc,vicentemaximilianoh/todomvc,dcrlz/todomvc,jcpeters/todomvc,neapolitan-a-la-code/todoAngJS,Anasskebabi/todomvc,troopjs-university/todomvc,baiyaaaaa/todomvc,chrisfcarroll/todomvc,pandoraui/todomvc | ---
+++
@@ -45,6 +45,8 @@
localStorage: new Backbone.LocalStorage('todos-backbone-marionette'),
+ comparator: 'created',
+
getCompleted: function () {
return this.filter(this._isCompleted);
},
@@ -53,8 +55,6 @@
return this.reject(this._isCompleted);
},
- comparator: 'created',
-
_isCompleted: function (todo) {
return todo.isCompleted();
} |
acbd127fda54894c0f99b8f852c39402049bcabf | templates/sb-admin-v2/js/sb-admin.js | templates/sb-admin-v2/js/sb-admin.js | $(function() {
$('#side-menu').metisMenu();
});
//Loads the correct sidebar on window load,
//collapses the sidebar on window resize.
$(function() {
$(window).bind("load resize", function() {
console.log($(this).width())
if ($(this).width() < 768) {
$('div.sidebar-collapse').addClass('collapse')
} else {
$('div.sidebar-collapse').removeClass('collapse')
}
})
})
| $(function() {
$('#side-menu').metisMenu();
});
//Loads the correct sidebar on window load,
//collapses the sidebar on window resize.
$(function() {
$(window).bind("load resize", function() {
if (this.window.innerWidth < 768) {
$('div.sidebar-collapse').addClass('collapse')
} else {
$('div.sidebar-collapse').removeClass('collapse')
}
})
})
| Use innerWindow as conditional comparison for appending/removing collapse class | Use innerWindow as conditional comparison for appending/removing collapse class
| JavaScript | apache-2.0 | habibmasuro/startbootstrap,roth1002/startbootstrap,javierperezferrada/startbootstrap,thejavamonk/startbootstrap,Sabertn/startbootstrap,agustik/startbootstrap,WangRex/startbootstrap,anupamme/startbootstrap,IronSummitMedia/startbootstrap,lee15/startbootstrap,lee15/startbootstrap,dguardia/startbootstrap,roth1002/startbootstrap,e-tang/startbootstrap,LeoYao/startbootstrap,gn0st1k4m/startbootstrap,WangRex/startbootstrap,CaileenD/startbootstrap,IronSummitMedia/startbootstrap,joshmccall221/bootstrapfork,habibmasuro/startbootstrap,joshmccall221/bootstrapfork,lancevalour/startbootstrap,LeoYao/startbootstrap,agustik/startbootstrap,jfederico/startbootstrap,roth1002/startbootstrap,Shinobi881/startbootstrap,aejolene/startbootstrap,S1AnGeR/startbootstrap,wavicles/startbootstrap,ftcosta/startbootstrap,dongguangming/startbootstrap,Warsztaty2015/Warsztaty2015.github.io,Liarliarboom/startbootstrap,gn0st1k4m/startbootstrap,blelem/startbootstrap,bitcoinapi/startbootstrap,e-tang/startbootstrap,dicrescenzob/startbootstrap,joshmccall221/bootstrapfork,agustik/startbootstrap,Warsztaty2015/Warsztaty2015.github.io,CHOUAiB/startbootstrap,slimpig879/startbootstrap,ausmon/startbootstrap,lokinell/startbootstrap,qwertysocket/startbootstrap,ausmon/startbootstrap,Aaron1992/startbootstrap,gokuale/startbootstrap,jfederico/startbootstrap,SPikeVanz/startbootstrap,dguardia/startbootstrap,e-tang/startbootstrap,shannonshsu/startbootstrap,aejolene/startbootstrap,lancevalour/startbootstrap,Aionics/startbootstrap,gn0st1k4m/startbootstrap,Liarliarboom/startbootstrap,thejavamonk/startbootstrap,Sabertn/startbootstrap,anupamme/startbootstrap,ftcosta/startbootstrap,lancevalour/startbootstrap,gokuale/startbootstrap,cnbin/startbootstrap,anupamme/startbootstrap,lee15/startbootstrap,RWander/startbootstrap,cnbin/startbootstrap,shannonshsu/startbootstrap,CHOUAiB/startbootstrap,fsladkey/startbootstrap,dicrescenzob/startbootstrap,dongguangming/startbootstrap,bitcoinapi/startbootstrap,Warsztaty2015/Warsztaty2015.github.io,Aionics/startbootstrap,picrin/startbootstrap,thejavamonk/startbootstrap,RWander/startbootstrap,92Sam/startbootstrap,92Sam/startbootstrap,Liarliarboom/startbootstrap,shannonshsu/startbootstrap,ftcosta/startbootstrap,Gasparas/startbootstrap,dicrescenzob/startbootstrap,qwertysocket/startbootstrap,blelem/startbootstrap,SPikeVanz/startbootstrap,joshmccall221/bootstrapfork,Shinobi881/startbootstrap,Shinobi881/startbootstrap,lokinell/startbootstrap,aejolene/startbootstrap,Aionics/startbootstrap,picrin/startbootstrap,slimpig879/startbootstrap,javierperezferrada/startbootstrap,gokuale/startbootstrap,bitcoinapi/startbootstrap,dongguangming/startbootstrap,javierperezferrada/startbootstrap,Gasparas/startbootstrap,picrin/startbootstrap,blelem/startbootstrap,LeoYao/startbootstrap,Gasparas/startbootstrap,IronSummitMedia/startbootstrap,slimpig879/startbootstrap,wavicles/startbootstrap,MrPowers/startbootstrap,wavicles/startbootstrap,CaileenD/startbootstrap,dguardia/startbootstrap,fsladkey/startbootstrap,S1AnGeR/startbootstrap,fsladkey/startbootstrap,jfederico/startbootstrap,cnbin/startbootstrap,WangRex/startbootstrap,S1AnGeR/startbootstrap,CHOUAiB/startbootstrap,92Sam/startbootstrap,MrPowers/startbootstrap,ausmon/startbootstrap,qwertysocket/startbootstrap,habibmasuro/startbootstrap,RWander/startbootstrap,SPikeVanz/startbootstrap,MrPowers/startbootstrap,Aaron1992/startbootstrap,lokinell/startbootstrap,CaileenD/startbootstrap | ---
+++
@@ -8,8 +8,7 @@
//collapses the sidebar on window resize.
$(function() {
$(window).bind("load resize", function() {
- console.log($(this).width())
- if ($(this).width() < 768) {
+ if (this.window.innerWidth < 768) {
$('div.sidebar-collapse').addClass('collapse')
} else {
$('div.sidebar-collapse').removeClass('collapse') |
d4b1e50aa6d35fffc4e6ce579ea33c97d2799614 | selfish-youtube.user.js | selfish-youtube.user.js | // ==UserScript==
// @name Selfish Youtube
// @namespace https://github.com/ASzc/selfish-youtube
// @description On the watch page, prevent the share panel from being switched to after pressing Like
// @include http://youtube.com/*
// @include http://*.youtube.com/*
// @include https://youtube.com/*
// @include https://*.youtube.com/*
// ==/UserScript==
var oldPanelName = "action-panel-share";
var newPanelName = "action-panel-share-foo";
// Change share panel id so Google's JS can't reference it properly unless we give it the new name
var actionPanelShare = document.getElementById(oldPanelName);
actionPanelShare.id = newPanelName;
// Change target of Share UI button so it points at the new panel ID
var buttons = document.body.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
var buttonDTF = button.getAttribute("data-trigger-for");
if (buttonDTF != null && buttonDTF == oldPanelName) {
button.setAttribute("data-trigger-for", newPanelName);
}
}
| // ==UserScript==
// @name Selfish Youtube
// @namespace https://github.com/ASzc/selfish-youtube
// @description On the watch page, remove the share panel.
// @include http://youtube.com/*
// @include http://*.youtube.com/*
// @include https://youtube.com/*
// @include https://*.youtube.com/*
// ==/UserScript==
var panelName = "action-panel-share";
// Remove panel
var actionPanelShare = document.getElementById(panelName);
actionPanelShare.parentNode.removeChild(actionPanelShare);
// Remove buttons targeting the panel
var buttons = document.body.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
var buttonDTF = button.getAttribute("data-trigger-for");
if (buttonDTF != null && buttonDTF == panelName) {
button.parentNode.removeChild(button);
}
}
| Change to simple removal of the share panel and button | Change to simple removal of the share panel and button
| JavaScript | mit | ASzc/selfish-youtube | ---
+++
@@ -1,27 +1,26 @@
// ==UserScript==
// @name Selfish Youtube
// @namespace https://github.com/ASzc/selfish-youtube
-// @description On the watch page, prevent the share panel from being switched to after pressing Like
+// @description On the watch page, remove the share panel.
// @include http://youtube.com/*
// @include http://*.youtube.com/*
// @include https://youtube.com/*
// @include https://*.youtube.com/*
// ==/UserScript==
-var oldPanelName = "action-panel-share";
-var newPanelName = "action-panel-share-foo";
+var panelName = "action-panel-share";
-// Change share panel id so Google's JS can't reference it properly unless we give it the new name
-var actionPanelShare = document.getElementById(oldPanelName);
-actionPanelShare.id = newPanelName;
+// Remove panel
+var actionPanelShare = document.getElementById(panelName);
+actionPanelShare.parentNode.removeChild(actionPanelShare);
-// Change target of Share UI button so it points at the new panel ID
+// Remove buttons targeting the panel
var buttons = document.body.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
var button = buttons[i];
var buttonDTF = button.getAttribute("data-trigger-for");
- if (buttonDTF != null && buttonDTF == oldPanelName) {
- button.setAttribute("data-trigger-for", newPanelName);
+ if (buttonDTF != null && buttonDTF == panelName) {
+ button.parentNode.removeChild(button);
}
} |
e16769cfb773e9e07b32e30ebebe9338f635b8e7 | common.blocks/link/link.tests/simple.bemjson.js | common.blocks/link/link.tests/simple.bemjson.js | ({
block : 'page',
title : 'bem-components: link',
mods : { theme : 'normal' },
head : [
{ elem : 'css', url : '_simple.css' },
{ elem : 'js', url : '_simple.js' }
],
content : [
{
block : 'link',
content : 'Empty link 1'
},
{
block : 'link',
url : {
block : 'link-content',
tag : '',
content : '/action'
},
content : 'url with bemjson'
},
{
block : 'link',
url : 'http://yandex.ru',
content : 'yandex.ru'
},
{
block : 'link',
url : 'http://yandex.com',
title : 'One of the largest internet companies in Europe',
content : 'yandex.com'
},
{
block : 'link',
url : 'http://yandex.com.tr',
title : 'One of the largest internet companies in Europe',
target : '_blank',
content : 'yandex.com.tr'
},
{
block : 'link',
mods : { pseudo : true },
content : 'Pseudo link'
},
{
block : 'link',
tabIndex : -1,
content : 'yandex.ru'
}
].map(function(l) { return { tag : 'div', content : l } })
})
| ({
block : 'page',
title : 'bem-components: link',
mods : { theme : 'normal' },
head : [
{ elem : 'css', url : '_simple.css' },
{ elem : 'js', url : '_simple.js' }
],
content : ['default', 'simple', 'normal'].map(function(theme, i) {
var content = [
{ block : 'link', content : 'with no url' },
{ block : 'link', url : 'http://example.com/', content : 'plain url' },
{
block : 'link',
url : {
block : 'link-content',
tag : '',
content : '/action'
},
content : 'bemjson url'
},
{
block : 'link',
url : 'http://example.com/',
title : 'One of the largest internet companies in Europe',
content : 'with title'
},
{
block : 'link',
url : 'http://example.com/',
title : 'One of the largest internet companies in Europe',
target : '_blank',
content : 'blank target'
},
{ block : 'link', mods : { pseudo : true }, content : 'pseudo link' },
{
block : 'link',
url : 'http://example.com/',
tabIndex : -1,
content : 'out of tab order'
}
].map(function(link, j) {
link.mods || (link.mods = {});
i && (link.mods.theme = theme);
return [
j > 0 && { tag : 'br' },
link
]
});
content.unshift({ tag : 'h2', content : theme });
i && content.unshift({ tag : 'hr' });
return content;
})
})
| Add example cases for block:link | Add example cases for block:link
| JavaScript | mpl-2.0 | just-boris/bem-components,just-boris/bem-components,pepelsbey/bem-components,pepelsbey/bem-components,dojdev/bem-components,tadatuta/bem-components,tadatuta/bem-components,dojdev/bem-components,tadatuta/bem-components,pepelsbey/bem-components,dojdev/bem-components,just-boris/bem-components | ---
+++
@@ -6,47 +6,51 @@
{ elem : 'css', url : '_simple.css' },
{ elem : 'js', url : '_simple.js' }
],
- content : [
- {
- block : 'link',
- content : 'Empty link 1'
- },
- {
- block : 'link',
- url : {
- block : 'link-content',
- tag : '',
- content : '/action'
- },
- content : 'url with bemjson'
- },
- {
- block : 'link',
- url : 'http://yandex.ru',
- content : 'yandex.ru'
- },
- {
- block : 'link',
- url : 'http://yandex.com',
- title : 'One of the largest internet companies in Europe',
- content : 'yandex.com'
- },
- {
- block : 'link',
- url : 'http://yandex.com.tr',
- title : 'One of the largest internet companies in Europe',
- target : '_blank',
- content : 'yandex.com.tr'
- },
- {
- block : 'link',
- mods : { pseudo : true },
- content : 'Pseudo link'
- },
- {
- block : 'link',
- tabIndex : -1,
- content : 'yandex.ru'
- }
- ].map(function(l) { return { tag : 'div', content : l } })
+ content : ['default', 'simple', 'normal'].map(function(theme, i) {
+ var content = [
+ { block : 'link', content : 'with no url' },
+ { block : 'link', url : 'http://example.com/', content : 'plain url' },
+ {
+ block : 'link',
+ url : {
+ block : 'link-content',
+ tag : '',
+ content : '/action'
+ },
+ content : 'bemjson url'
+ },
+ {
+ block : 'link',
+ url : 'http://example.com/',
+ title : 'One of the largest internet companies in Europe',
+ content : 'with title'
+ },
+ {
+ block : 'link',
+ url : 'http://example.com/',
+ title : 'One of the largest internet companies in Europe',
+ target : '_blank',
+ content : 'blank target'
+ },
+ { block : 'link', mods : { pseudo : true }, content : 'pseudo link' },
+ {
+ block : 'link',
+ url : 'http://example.com/',
+ tabIndex : -1,
+ content : 'out of tab order'
+ }
+ ].map(function(link, j) {
+ link.mods || (link.mods = {});
+ i && (link.mods.theme = theme);
+ return [
+ j > 0 && { tag : 'br' },
+ link
+ ]
+ });
+
+ content.unshift({ tag : 'h2', content : theme });
+ i && content.unshift({ tag : 'hr' });
+
+ return content;
+ })
}) |
68045361c6f994e015f2d28026a443d67fc0507a | common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js | common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js | var assert = chai.assert;
describe('LMLayer', function () {
describe('[[constructor]]', function () {
it('should construct with zero arguments', function () {
let lmLayer = new LMLayer();
assert.instanceOf(lmLayer, LMLayer);
});
});
describe('#initialize()', function () {
// TODO: implement configuration negotiation?
it.skip('should yield a reasonable configuration', function () {
let maxLeftContext = 64;
let lmLayer = new LMLayer();
return lmLayer.initialize(
{ maxLeftContextCodeUnits: maxLeftContext },
{ model: { type: 'dummy' } }
).then(function (configuration) {
assert.isAtMost(configuration.leftContextCodeUnits, maxLeftContext);
assert.propertyVal(configuration, 'rightContextCodeUnits', 0);
});
});
});
describe('#asBlobURI()', function () {
// #asBlobURI() requires browser APIs, hence why it cannot be tested headless in Node.
it('should take a function and convert it into a blob function', function (done) {
let uri = LMLayer.asBlobURI(function dummyHandler() {
// Post something weird, so we can be reasonably certain the Web Worker is...
// well, working.
// WARNING: Do NOT refactor this string as a variable. It **MUST** remain a string
// in this function body, because the code in this function's body gets
// stringified!
postMessage('fhqwhgads');
});
assert.match(uri, /^blob:/);
let worker = new Worker(uri);
worker.onmessage = function thisShouldBeCalled(event) {
assert.propertyVal(event, 'data', 'fhqwhgads');
done();
};
})
})
});
| var assert = chai.assert;
describe('LMLayer', function () {
describe('[[constructor]]', function () {
it('should construct with zero arguments', function () {
let lmLayer = new LMLayer();
assert.instanceOf(lmLayer, LMLayer);
});
});
describe('#asBlobURI()', function () {
// #asBlobURI() requires browser APIs, hence why it cannot be tested headless in Node.
it('should take a function and convert it into a blob function', function (done) {
let uri = LMLayer.asBlobURI(function dummyHandler() {
// Post something weird, so we can be reasonably certain the Web Worker is...
// well, working.
// WARNING: Do NOT refactor this string as a variable. It **MUST** remain a string
// in this function body, because the code in this function's body gets
// stringified!
postMessage('fhqwhgads');
});
assert.match(uri, /^blob:/);
let worker = new Worker(uri);
worker.onmessage = function thisShouldBeCalled(event) {
assert.propertyVal(event, 'data', 'fhqwhgads');
done();
};
})
})
});
| Remove test for configuration-negotiation (not applicable to dummy model). | Remove test for configuration-negotiation (not applicable to dummy model).
| JavaScript | apache-2.0 | tavultesoft/keymanweb,tavultesoft/keymanweb | ---
+++
@@ -5,21 +5,6 @@
it('should construct with zero arguments', function () {
let lmLayer = new LMLayer();
assert.instanceOf(lmLayer, LMLayer);
- });
- });
-
- describe('#initialize()', function () {
- // TODO: implement configuration negotiation?
- it.skip('should yield a reasonable configuration', function () {
- let maxLeftContext = 64;
- let lmLayer = new LMLayer();
- return lmLayer.initialize(
- { maxLeftContextCodeUnits: maxLeftContext },
- { model: { type: 'dummy' } }
- ).then(function (configuration) {
- assert.isAtMost(configuration.leftContextCodeUnits, maxLeftContext);
- assert.propertyVal(configuration, 'rightContextCodeUnits', 0);
- });
});
});
|
27b62998e1c57d39bcd051c7c9d75ed487136af7 | routes/main.js | routes/main.js | var express = require('express');
var utils = require('../utils');
var router = express.Router();
/**
* Render the home page.
*/
router.get('/', function(req, res) {
res.render('index.jade');
});
/**
* Render the dashboard page.
*/
router.get('/dashboard', utils.requireLogin, function(req, res) {
res.render('dashboard.jade');
});
router.get('/user/:filename', function(req, res) {
res.render('user/'+req.params.filename+'.jade');
});
module.exports = router;
| var express = require('express');
var utils = require('../utils');
var router = express.Router();
/**
* Render the home page.
*/
router.get('/', function(req, res) {
res.render('user/index.jade');
});
/**
* Render the dashboard page.
*/
router.get('/dashboard', utils.requireLogin, function(req, res) {
res.render('dashboard.jade');
});
router.get('/user/:filename', function(req, res) {
res.render('user/'+req.params.filename+'.jade');
});
module.exports = router;
| Change the index default jade file | Change the index default jade file
| JavaScript | mit | DecisionSystemsGroup/dsg.teiste.gr,DecisionSystemsGroup/dsg.teiste.gr,DecisionSystemsGroup/dsg.teiste.gr,DecisionSystemsGroup/dsg.teiste.gr | ---
+++
@@ -8,7 +8,7 @@
* Render the home page.
*/
router.get('/', function(req, res) {
- res.render('index.jade');
+ res.render('user/index.jade');
});
|
f25865901f69302ca1f924ebb1644506ce6ec63c | index.js | index.js | /**
Copyright 2015 Covistra Technologies Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var SocketIO = require('socket.io'),
_ = require('lodash');
"use strict";
exports.register = function (server, options, next) {
server.log(['plugin', 'info'], "Registering the Socket plugin");
var io = SocketIO.listen(server.listener);
var log = server.plugins['covistra-system'].systemLog;
var config = server.plugins['hapi-config'].CurrentConfiguration;
var socketManager = require('./lib/socket-manager')(server, io, log.child({service: 'socket-manager'}), config);
io.on('connection', function(socket) {
server.log(['plugin', 'socket', 'debug'], "Client is connected on our socket");
socketManager.clientConnected(socket);
});
server.expose('socketManager', socketManager);
next();
};
exports.register.attributes = {
pkg: require('./package.json')
};
| /**
Copyright 2015 Covistra Technologies Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var SocketIO = require('socket.io'),
_ = require('lodash');
"use strict";
exports.register = function (server, options, next) {
var log = server.plugins['covistra-system'].systemLog;
var config = server.plugins['hapi-config'].CurrentConfiguration;
log.info("Registering the socket plugin", server.select('api').listener);
var io = SocketIO(server.select('api').listener);
log.debug("Socket.IO instance has been successfully created");
var socketManager = require('./lib/socket-manager')(server, io, log.child({service: 'socket-manager'}), config);
io.on('connection', function(socket) {
server.log(['plugin', 'socket', 'debug'], "Client is connected on our socket");
socketManager.clientConnected(socket);
});
server.expose('socketManager', socketManager);
next();
};
exports.register.attributes = {
pkg: require('./package.json')
};
| Connect the socket.io instance to the API connection only | Connect the socket.io instance to the API connection only
| JavaScript | apache-2.0 | Covistra/hapi-plugin-covistra-socket | ---
+++
@@ -20,12 +20,15 @@
"use strict";
exports.register = function (server, options, next) {
- server.log(['plugin', 'info'], "Registering the Socket plugin");
-
- var io = SocketIO.listen(server.listener);
var log = server.plugins['covistra-system'].systemLog;
var config = server.plugins['hapi-config'].CurrentConfiguration;
+
+ log.info("Registering the socket plugin", server.select('api').listener);
+
+ var io = SocketIO(server.select('api').listener);
+
+ log.debug("Socket.IO instance has been successfully created");
var socketManager = require('./lib/socket-manager')(server, io, log.child({service: 'socket-manager'}), config);
|
2fb53769d3e52170accaa7b978ca7eb1ca4f5ba0 | index.js | index.js | import $ from 'jquery';
export default function plugit( pluginName, pluginClass ) {
let dataName = `plugin_${pluginName}`;
$.fn[pluginName] = function( options ) {
return this.each( function() {
let $this = $( this );
let data = $this.data( dataName );
if ( ! data ) {
$this.data( dataName, ( data = new pluginClass( this, options ) ) );
}
} );
};
}
| import $ from 'jquery';
export default function plugit( pluginName, pluginClass ) {
let dataName = `plugin_${pluginName}`;
$.fn[pluginName] = function( opts ) {
return this.each( function() {
let $this = $( this );
let data = $this.data( dataName );
let options = $.extend( {}, this._defaults, opts );
pluginClass.element = this;
pluginClass.$element = $this;
if ( ! data ) {
$this.data( dataName, ( data = new pluginClass( this, options ) ) );
}
} );
};
}
| Add cached element and props before construction, merge defaults. | Add cached element and props before construction, merge defaults.
| JavaScript | mit | statnews/pugin | ---
+++
@@ -3,10 +3,14 @@
export default function plugit( pluginName, pluginClass ) {
let dataName = `plugin_${pluginName}`;
- $.fn[pluginName] = function( options ) {
+ $.fn[pluginName] = function( opts ) {
return this.each( function() {
let $this = $( this );
let data = $this.data( dataName );
+ let options = $.extend( {}, this._defaults, opts );
+
+ pluginClass.element = this;
+ pluginClass.$element = $this;
if ( ! data ) {
$this.data( dataName, ( data = new pluginClass( this, options ) ) ); |
7482a98a1050118ec5f52568ea66945e5429162f | index.js | index.js | var gulp = require('gulp');
var elixir = require('laravel-elixir');
var urlAdjuster = require('gulp-css-url-adjuster');
/*
|----------------------------------------------------------------
| adjust css urls for images and stuff
|----------------------------------------------------------------
|
| A wrapper for gulp-css-url-adjuster.
|
*/
elixir.extend('urlAdjuster', function(input, options, output) {
gulp.task('urlAdjuster', function() {
gulp.src(input)
.pipe(urlAdjuster(options))
.pipe(gulp.dest(output));
});
return this.queueTask('urlAdjuster');
});
| var gulp = require('gulp');
var elixir = require('laravel-elixir');
var urlAdjuster = require('gulp-css-url-adjuster');
var files = [];
/*
|----------------------------------------------------------------
| adjust css urls for images and stuff
|----------------------------------------------------------------
|
| A wrapper for gulp-css-url-adjuster.
|
*/
elixir.extend('urlAdjuster', function(input, options, output) {
files.push({
input: input,
options: options,
output: output
});
var stream;
gulp.task('urlAdjuster', function() {
files.forEach(function(toUrlAdjust) {
stream = gulp.src(toUrlAdjust.input)
.pipe(urlAdjuster(toUrlAdjust.options))
.pipe(gulp.dest(toUrlAdjust.output));
});
return stream;
});
return this.queueTask('urlAdjuster');
});
| Allow for multiple files to be urlAdjsted. | Allow for multiple files to be urlAdjsted.
| JavaScript | mit | farrrr/laravel-elixir-css-url-adjuster | ---
+++
@@ -1,6 +1,7 @@
var gulp = require('gulp');
var elixir = require('laravel-elixir');
var urlAdjuster = require('gulp-css-url-adjuster');
+var files = [];
/*
|----------------------------------------------------------------
@@ -13,10 +14,22 @@
elixir.extend('urlAdjuster', function(input, options, output) {
+ files.push({
+ input: input,
+ options: options,
+ output: output
+ });
+
+ var stream;
+
gulp.task('urlAdjuster', function() {
- gulp.src(input)
- .pipe(urlAdjuster(options))
- .pipe(gulp.dest(output));
+ files.forEach(function(toUrlAdjust) {
+ stream = gulp.src(toUrlAdjust.input)
+ .pipe(urlAdjuster(toUrlAdjust.options))
+ .pipe(gulp.dest(toUrlAdjust.output));
+ });
+
+ return stream;
});
return this.queueTask('urlAdjuster'); |
db100aa0ca744fb152d32b1453135c5175b78125 | index.js | index.js | 'use strict'
const express = require('express')
const bodyParser = require('body-parser')
const config = require('./config')
const app = express()
const publisher = require('./publisher')
var cronJob = require('cron').CronJob
app.set('port', (process.env.PORT || config.PORT))
app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())
app.get('/', function (req, res) {
res.send('Meeaaww')
})
app.get('/meaw', function (req, res) {
res.status(200).send('Meaaawww 200')
})
app.listen(app.get('port'), () => {
console.log(`Running Crypty on port : ${app.get('port')}`)
var cryptoJob = new cronJob({
cronTime: '0 */20 * * * *',
onTick: function () {
// Publish every 20 min
publisher.publish()
},
start: false,
timeZone: 'Asia/Bangkok'
})
cryptoJob.start()
})
| 'use strict'
const express = require('express')
const bodyParser = require('body-parser')
const config = require('./config')
const app = express()
const publisher = require('./publisher')
var cronJob = require('cron').CronJob
app.set('port', (process.env.PORT || config.PORT))
app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())
app.get('/', function (req, res) {
res.send('Meeaaww')
})
app.get('/meaw', function (req, res) {
res.status(200).send('Meaaawww 200')
})
app.listen(app.get('port'), () => {
console.log(`Running Crypty on port : ${app.get('port')}`)
var cryptoJob = new cronJob({
cronTime: '0 */60 * * * *',
onTick: function () {
// Publish every 60 min
publisher.publish()
},
start: false,
timeZone: 'Asia/Bangkok'
})
cryptoJob.start()
})
| Change time frequency to publish message | Change time frequency to publish message
| JavaScript | mit | igroomgrim/Crypty | ---
+++
@@ -25,9 +25,9 @@
console.log(`Running Crypty on port : ${app.get('port')}`)
var cryptoJob = new cronJob({
- cronTime: '0 */20 * * * *',
+ cronTime: '0 */60 * * * *',
onTick: function () {
- // Publish every 20 min
+ // Publish every 60 min
publisher.publish()
},
start: false, |
0cb448c2978cdb213e9dc04ccad7fcc571f519c7 | index.js | index.js | 'use strict';
var nomnom = require('nomnom');
var signal = require('./lib/signal');
var tree = require('./lib/tree');
var task = function (name, callback, options) {
var command = nomnom.command(name);
options.forEach(function (option) {
command = command.option(option.name, {
abbr: option.abbr,
flag: option.flag,
default: option.default
});
});
command.callback(function (opts) {
var args = options.map(function (option) {
return opts[option.name];
});
callback.apply(null, args);
});
};
var combine = function (/* ...signals */) {
var args = Array.prototype.slice.call(arguments);
var combinator = tree.merge;
args.unshift(combinator);
return signal.combine.apply(null, args);
};
module.exports = {
task: task,
combine: combine,
files: require('./base/files'),
write: require('./base/write'),
noop: require('./base/noop')
};
| 'use strict';
var nomnom = require('nomnom');
var signal = require('./lib/signal');
var tree = require('./lib/tree');
var task = function (name, callback, options) {
options = options || [];
var command = nomnom.command(name);
options.forEach(function (option) {
command = command.option(option.name, {
abbr: option.abbr,
flag: option.flag,
default: option.default
});
});
command.callback(function (opts) {
var args = options.map(function (option) {
return opts[option.name];
});
callback.apply(null, args);
});
};
var combine = function (/* ...signals */) {
var args = Array.prototype.slice.call(arguments);
var combinator = tree.merge;
args.unshift(combinator);
return signal.combine.apply(null, args);
};
module.exports = {
task: task,
combine: combine,
files: require('./base/files'),
write: require('./base/write'),
noop: require('./base/noop')
};
| Allow task third parameter to be optional | Allow task third parameter to be optional
| JavaScript | mit | byggjs/bygg | ---
+++
@@ -6,6 +6,8 @@
var tree = require('./lib/tree');
var task = function (name, callback, options) {
+ options = options || [];
+
var command = nomnom.command(name);
options.forEach(function (option) { |
7e6be2fd2346557fc81bd544ac8745021c50e266 | index.js | index.js | 'use strict';
var toStr = Number.prototype.toString;
module.exports = function isNumberObject(value) {
if (typeof value === 'number') { return true; }
if (typeof value !== 'object') { return false; }
try {
toStr.call(value);
return true;
} catch (e) {
return false;
}
};
| 'use strict';
var toStr = Number.prototype.toString;
var tryNumberObject = function tryNumberObject(value) {
try {
toStr.call(value);
return true;
} catch (e) {
return false;
}
};
module.exports = function isNumberObject(value) {
if (typeof value === 'number') { return true; }
if (typeof value !== 'object') { return false; }
return tryNumberObject(value);
};
| Improve optimizability of the non-try/catch part. | Improve optimizability of the non-try/catch part. | JavaScript | mit | ljharb/is-number-object | ---
+++
@@ -1,10 +1,7 @@
'use strict';
var toStr = Number.prototype.toString;
-
-module.exports = function isNumberObject(value) {
- if (typeof value === 'number') { return true; }
- if (typeof value !== 'object') { return false; }
+var tryNumberObject = function tryNumberObject(value) {
try {
toStr.call(value);
return true;
@@ -12,3 +9,9 @@
return false;
}
};
+
+module.exports = function isNumberObject(value) {
+ if (typeof value === 'number') { return true; }
+ if (typeof value !== 'object') { return false; }
+ return tryNumberObject(value);
+}; |
0f375c2e85a348ce377cd7c6eced277b47a470ba | index.js | index.js | #!/usr/bin/env node
/**
* index.js
*
* for `character-map` command
*/
var opts = require('minimist')(process.argv.slice(2));
var opentype = require('opentype.js');
if (!opts.f || typeof opts.f !== 'string') {
console.log('use -f to specify your font path, TrueType and OpenType supported');
return;
}
opentype.load(opts.f, function(err, font) {
if (err) {
console.log(err);
return;
}
if (!font.glyphs || font.glyphs.length === 0) {
console.log('no glyphs found in this font');
return;
}
var table = '';
font.glyphs.forEach(function(glyph) {
if (!glyph.unicode) {
return;
}
table += String.fromCharCode(glyph.unicode);
});
console.log(table);
});
| #!/usr/bin/env node
/**
* index.js
*
* for `character-map` command
*/
var opts = require('minimist')(process.argv.slice(2));
var opentype = require('opentype.js');
if (!opts.f || typeof opts.f !== 'string') {
console.log('use -f to specify your font path, TrueType and OpenType supported');
return;
}
opentype.load(opts.f, function(err, font) {
if (err) {
console.log(err);
return;
}
var glyphs = font.glyphs.glyphs;
if (!glyphs || glyphs.length === 0) {
console.log('no glyphs found in this font');
return;
}
var table = '';
Object.keys(glyphs).forEach(function(key) {
var glyph = glyphs[key];
if (!glyph.unicode) {
return;
}
table += String.fromCharCode(glyph.unicode);
});
console.log(table);
});
| Fix broken iteration of items in Opentype.js slyphs object | Fix broken iteration of items in Opentype.js slyphs object
| JavaScript | mit | bitinn/character-map | ---
+++
@@ -20,17 +20,19 @@
return;
}
- if (!font.glyphs || font.glyphs.length === 0) {
+ var glyphs = font.glyphs.glyphs;
+ if (!glyphs || glyphs.length === 0) {
console.log('no glyphs found in this font');
return;
}
var table = '';
- font.glyphs.forEach(function(glyph) {
+ Object.keys(glyphs).forEach(function(key) {
+ var glyph = glyphs[key];
if (!glyph.unicode) {
return;
}
-
+
table += String.fromCharCode(glyph.unicode);
});
|
73eb904356c11abab11481a9585005afc017edd8 | src/conjure/fragment.js | src/conjure/fragment.js | 'use strict';
export default class Fragment {
render () {
return null;
}
/**
* Generic event handler. Turns class methods into closures that can be used as event handlers. If you need to use
* data from the event object, or have access to the event object in general, use handleEvent instead.
*
* For non class methods (or methods that call into a different `this`, use framework/utils/handle).
*/
handle (fn, final=false, args) {
var self = this;
return function (ev) {
fn.apply(self, args);
if (final) {
ev.preventDefault();
ev.stopPropagation();
return false;
}
}
}
}
| 'use strict';
export default class Fragment {
render () {
return null;
}
/**
* Generic event handler. Turns class methods into closures that can be used as event handlers. If you need to use
* data from the event object, or have access to the event object in general, use handleEvent instead.
*
* For non class methods (or methods that call into a different `this`, use framework/utils/handle).
*/
handle (fn, args, final=false) {
var self = this;
return function (ev) {
fn.apply(self, args);
if (final) {
ev.preventDefault();
ev.stopPropagation();
return false;
}
}
}
}
| Change order of arguments in Fragment.handle | Change order of arguments in Fragment.handle
| JavaScript | mit | smiley325/conjure | ---
+++
@@ -11,7 +11,7 @@
*
* For non class methods (or methods that call into a different `this`, use framework/utils/handle).
*/
- handle (fn, final=false, args) {
+ handle (fn, args, final=false) {
var self = this;
return function (ev) { |
70c052fb4faeafd3fa31fc3d030f70b5aed19b5c | src/internal/_curryN.js | src/internal/_curryN.js | var _arity = require('./_arity');
/**
* Internal curryN function.
*
* @private
* @category Function
* @param {Number} length The arity of the curried function.
* @return {array} An array of arguments received thus far.
* @param {Function} fn The function to curry.
*/
module.exports = function _curryN(length, received, fn) {
return function() {
var combined = [];
var argsIdx = 0;
var left = length;
var combinedIdx = 0;
while (combinedIdx < received.length || argsIdx < arguments.length) {
var result;
if (combinedIdx < received.length &&
(received[combinedIdx] == null ||
received[combinedIdx]['@@functional/placeholder'] !== true ||
argsIdx >= arguments.length)) {
result = received[combinedIdx];
} else {
result = arguments[argsIdx];
argsIdx += 1;
}
combined[combinedIdx] = result;
if (result == null || result['@@functional/placeholder'] !== true) {
left -= 1;
}
combinedIdx += 1;
}
return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
};
};
| var _arity = require('./_arity');
/**
* Internal curryN function.
*
* @private
* @category Function
* @param {Number} length The arity of the curried function.
* @param {Array} An array of arguments received thus far.
* @param {Function} fn The function to curry.
* @return {Function} The curried function.
*/
module.exports = function _curryN(length, received, fn) {
return function() {
var combined = [];
var argsIdx = 0;
var left = length;
var combinedIdx = 0;
while (combinedIdx < received.length || argsIdx < arguments.length) {
var result;
if (combinedIdx < received.length &&
(received[combinedIdx] == null ||
received[combinedIdx]['@@functional/placeholder'] !== true ||
argsIdx >= arguments.length)) {
result = received[combinedIdx];
} else {
result = arguments[argsIdx];
argsIdx += 1;
}
combined[combinedIdx] = result;
if (result == null || result['@@functional/placeholder'] !== true) {
left -= 1;
}
combinedIdx += 1;
}
return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
};
};
| Fix param/return documentation for internal curryN | Fix param/return documentation for internal curryN
fix(_curryN) fix capitalization in return type
| JavaScript | mit | jimf/ramda,arcseldon/ramda,maowug/ramda,kedashoe/ramda,asaf-romano/ramda,ccorcos/ramda,iofjuupasli/ramda,jimf/ramda,asaf-romano/ramda,besarthoxhaj/ramda,Bradcomp/ramda,davidchambers/ramda,ramda/ramda,svozza/ramda,arcseldon/ramda,maowug/ramda,Nigiss/ramda,CrossEye/ramda,angeloocana/ramda,angeloocana/ramda,Nigiss/ramda,ramda/ramda,TheLudd/ramda,jethrolarson/ramda,TheLudd/ramda,asaf-romano/ramda,Bradcomp/ramda,iofjuupasli/ramda,Nigiss/ramda,besarthoxhaj/ramda,ccorcos/ramda,CrossEye/ramda,jethrolarson/ramda,plynch/ramda,ramda/ramda,benperez/ramda,plynch/ramda,CrossEye/ramda,buzzdecafe/ramda,buzzdecafe/ramda,jethrolarson/ramda,paldepind/ramda,kedashoe/ramda,paldepind/ramda,svozza/ramda,davidchambers/ramda,benperez/ramda | ---
+++
@@ -7,8 +7,9 @@
* @private
* @category Function
* @param {Number} length The arity of the curried function.
- * @return {array} An array of arguments received thus far.
+ * @param {Array} An array of arguments received thus far.
* @param {Function} fn The function to curry.
+ * @return {Function} The curried function.
*/
module.exports = function _curryN(length, received, fn) {
return function() { |
d14a4867f19147c40efa0d09fc1d623f7373424c | packages/accounts-oauth/package.js | packages/accounts-oauth/package.js | Package.describe({
summary: "Common code for OAuth-based login services",
version: "1.3.0",
});
Package.onUse(api => {
api.use('check', 'server');
api.use('webapp', 'server');
api.use(['accounts-base', 'ecmascript'], ['client', 'server']);
// Export Accounts (etc) to packages using this one.
api.imply('accounts-base', ['client', 'server']);
api.use('oauth');
api.addFiles('oauth_common.js');
api.addFiles('oauth_client.js', 'client');
api.addFiles('oauth_server.js', 'server');
});
Package.onTest(api => {
api.addFiles("oauth_tests.js", 'server');
});
| Package.describe({
summary: "Common code for OAuth-based login services",
version: "1.3.1",
});
Package.onUse(api => {
api.use('check', 'server');
api.use('webapp', 'server');
api.use(['accounts-base', 'ecmascript'], ['client', 'server']);
// Export Accounts (etc) to packages using this one.
api.imply('accounts-base', ['client', 'server']);
api.use('oauth');
api.addFiles('oauth_common.js');
api.addFiles('oauth_client.js', 'client');
api.addFiles('oauth_server.js', 'server');
});
Package.onTest(api => {
api.addFiles("oauth_tests.js", 'server');
});
| Bump patch version of accounts-oauth | Bump patch version of accounts-oauth
| JavaScript | mit | Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor | ---
+++
@@ -1,6 +1,6 @@
Package.describe({
summary: "Common code for OAuth-based login services",
- version: "1.3.0",
+ version: "1.3.1",
});
Package.onUse(api => { |
1db4ea20c6ce67559a5c28b6b423abe292354dd8 | app/assets/javascripts/mr_notes/index.js | app/assets/javascripts/mr_notes/index.js | import Vue from 'vue';
import notesApp from '../notes/components/notes_app.vue';
import discussionCounter from '../notes/components/discussion_counter.vue';
import store from '../notes/stores';
export default function initMrNotes() {
// eslint-disable-next-line no-new
new Vue({
el: '#js-vue-mr-discussions',
components: {
notesApp,
},
data() {
const notesDataset = document.getElementById('js-vue-mr-discussions')
.dataset;
return {
noteableData: JSON.parse(notesDataset.noteableData),
currentUserData: JSON.parse(notesDataset.currentUserData),
notesData: JSON.parse(notesDataset.notesData),
};
},
render(createElement) {
return createElement('notes-app', {
props: {
noteableData: this.noteableData,
notesData: this.notesData,
userData: this.currentUserData,
},
});
},
});
// eslint-disable-next-line no-new
new Vue({
el: '#js-vue-discussion-counter',
components: {
discussionCounter,
},
store,
render(createElement) {
return createElement('discussion-counter');
},
});
}
| import Vue from 'vue';
import notesApp from '../notes/components/notes_app.vue';
import discussionCounter from '../notes/components/discussion_counter.vue';
import store from '../notes/stores';
export default function initMrNotes() {
// eslint-disable-next-line no-new
new Vue({
el: '#js-vue-mr-discussions',
components: {
notesApp,
},
data() {
const notesDataset = document.getElementById('js-vue-mr-discussions')
.dataset;
const noteableData = JSON.parse(notesDataset.noteableData);
noteableData.noteableType = notesDataset.noteableType;
return {
noteableData,
currentUserData: JSON.parse(notesDataset.currentUserData),
notesData: JSON.parse(notesDataset.notesData),
};
},
render(createElement) {
return createElement('notes-app', {
props: {
noteableData: this.noteableData,
notesData: this.notesData,
userData: this.currentUserData,
},
});
},
});
// eslint-disable-next-line no-new
new Vue({
el: '#js-vue-discussion-counter',
components: {
discussionCounter,
},
store,
render(createElement) {
return createElement('discussion-counter');
},
});
}
| Set noteableType on noteableData as provided from DOM dataset | Set noteableType on noteableData as provided from DOM dataset
| JavaScript | mit | jirutka/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,jirutka/gitlabhq,mmkassem/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,dreampet/gitlab,iiet/iiet-git,axilleas/gitlabhq,stoplightio/gitlabhq,dreampet/gitlab,mmkassem/gitlabhq,axilleas/gitlabhq,stoplightio/gitlabhq,jirutka/gitlabhq,dreampet/gitlab,jirutka/gitlabhq,iiet/iiet-git,stoplightio/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,stoplightio/gitlabhq,axilleas/gitlabhq | ---
+++
@@ -13,8 +13,11 @@
data() {
const notesDataset = document.getElementById('js-vue-mr-discussions')
.dataset;
+ const noteableData = JSON.parse(notesDataset.noteableData);
+ noteableData.noteableType = notesDataset.noteableType;
+
return {
- noteableData: JSON.parse(notesDataset.noteableData),
+ noteableData,
currentUserData: JSON.parse(notesDataset.currentUserData),
notesData: JSON.parse(notesDataset.notesData),
}; |
efbb2dbe9425a831507ccbab1843784b525a255a | src/Mailer.js | src/Mailer.js | /*
* @Author: Mike Reich
* @Date: 2016-01-26 11:48:16
* @Last Modified 2016-01-26
*/
'use strict';
import MandrilService from './MandrilService'
export default class Mailer {
constructor(app) {
new MandrilService(app)
this.app = app;
this.mailer = app.get('mailer')
this._services = [];
this.mailer.gather('service', this._registerService.bind(this))
}
_registerService(service) {
console.log('registering service')
this.mailer.respond('send', service.sendMessage.bind(service))
}
} | /*
* @Author: Mike Reich
* @Date: 2016-01-26 11:48:16
* @Last Modified 2016-01-26
*/
'use strict';
import MandrilService from './MandrilService'
export default class Mailer {
constructor(app) {
this.app = app;
this.mailer = app.get('mailer')
if(this.app.config.MANDRILL_APIKEY || app.config.mandrill.api_key) new MandrilService(app)
this._services = [];
this.mailer.gather('service', this._registerService.bind(this))
}
_registerService(service) {
console.log('registering service')
this.mailer.respond('send', service.sendMessage.bind(service))
}
} | Make Mandrill install only if service APIKEYs exist | Make Mandrill install only if service APIKEYs exist
| JavaScript | mit | nxus/mailer | ---
+++
@@ -11,10 +11,10 @@
export default class Mailer {
constructor(app) {
- new MandrilService(app)
-
this.app = app;
this.mailer = app.get('mailer')
+
+ if(this.app.config.MANDRILL_APIKEY || app.config.mandrill.api_key) new MandrilService(app)
this._services = [];
this.mailer.gather('service', this._registerService.bind(this)) |
49ada139533acf0a1e743de8cf2cd7e668efb824 | app/scripts/views/visits/date_divider.js | app/scripts/views/visits/date_divider.js | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
define([
'underscore',
'moment',
'views/base',
'stache!templates/visits/date_divider',
], function (_, moment, BaseView, VisitsDateDividerTemplate, UserPagePresenter) {
'use strict';
var VisitsDateDividerView = BaseView.extend({
tagName: 'h3',
className: 'visit-date-divider',
template: VisitsDateDividerTemplate,
initialize: function (date) {
this.date = date;
},
getContext: function (date) {
return {
formattedDate: this._formatDate()
};
},
_formatDate: function () {
var formattedDate;
var diff = this.date.diff(moment().startOf('day'), 'days');
if (diff === 0) {
formattedDate = 'Today';
} else if (diff === -1) {
formattedDate = 'Yesterday';
} else {
formattedDate = this.date.format('MMMM do');
}
return formattedDate;
}
});
return VisitsDateDividerView;
});
| /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
define([
'underscore',
'moment',
'views/base',
'stache!templates/visits/date_divider',
], function (_, moment, BaseView, VisitsDateDividerTemplate, UserPagePresenter) {
'use strict';
var VisitsDateDividerView = BaseView.extend({
tagName: 'h3',
className: 'visit-date-divider',
template: VisitsDateDividerTemplate,
initialize: function (date) {
this.date = date;
},
getContext: function (date) {
return {
formattedDate: this._formatDate()
};
},
_formatDate: function () {
var formattedDate;
var diff = this.date.diff(moment().startOf('day'), 'days');
if (diff === 0) {
formattedDate = 'Today';
} else if (diff === -1) {
formattedDate = 'Yesterday';
} else {
formattedDate = this.date.format('MMMM Do');
}
return formattedDate;
}
});
return VisitsDateDividerView;
});
| Change date heading to use day of month with ordinal | fix(visit): Change date heading to use day of month with ordinal
| JavaScript | mpl-2.0 | mozilla/chronicle,mozilla/chronicle,mozilla/chronicle | ---
+++
@@ -35,7 +35,7 @@
} else if (diff === -1) {
formattedDate = 'Yesterday';
} else {
- formattedDate = this.date.format('MMMM do');
+ formattedDate = this.date.format('MMMM Do');
}
return formattedDate; |
221852e851ed84d1d8e2f5db6e973f0a8fcc7307 | node4.js | node4.js | module.exports = {
extends: [
'./base.js'
],
plugins: [
'node'
],
rules: {
'node/no-unsupported-features': 'error',
'node/no-deprecated-api': 'error',
'generator-star-spacing': ['error', { before: true }],
'template-curly-spacing': ['error', 'always'],
'prefer-arrow-callback': 'error',
'no-dupe-class-members': 'error',
'no-this-before-super': 'error',
'constructor-super': 'error',
'arrow-body-style': 'error',
'object-shorthand': 'error',
'no-const-assign': 'error',
'prefer-template': 'error',
'no-new-symbol': 'error',
'require-yield': 'error',
'arrow-spacing': 'error',
'arrow-parens': ['error', 'as-needed'],
'prefer-const': 'error',
'strict': ['error', 'global'],
'no-var': 'error'
},
env: {
es6: true
}
}
| module.exports = {
extends: [
'./base.js'
],
plugins: [
'node'
],
rules: {
'node/no-unsupported-features': 'error',
'node/no-deprecated-api': 'error',
'generator-star-spacing': ['error', { before: true }],
'template-curly-spacing': ['error', 'always'],
'prefer-arrow-callback': 'error',
'no-dupe-class-members': 'error',
'no-this-before-super': 'error',
'constructor-super': 'error',
'arrow-body-style': 'error',
'object-shorthand': 'error',
'no-const-assign': 'error',
'prefer-template': 'error',
'no-new-symbol': 'error',
'require-yield': 'error',
'arrow-spacing': 'error',
'arrow-parens': ['error', 'as-needed'],
'prefer-const': 'error',
'strict': ['error', 'global'],
'no-var': 'error'
},
env: {
es6: true
},
parserOptions: {
sourceType: 'script'
}
}
| Fix sourceType in server config | Fix sourceType in server config
| JavaScript | mit | logux/eslint-config-logux | ---
+++
@@ -29,5 +29,8 @@
},
env: {
es6: true
+ },
+ parserOptions: {
+ sourceType: 'script'
}
} |
700610e9881e6d19aaef5a8c6257b4cd6679f326 | chrome/browser/resources/print_preview.js | chrome/browser/resources/print_preview.js | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var localStrings = new LocalStrings();
/**
* Window onload handler, sets up the page.
*/
function load() {
chrome.send('getPrinters');
};
/**
* Fill the printer list drop down.
*/
function setPrinters(printers) {
if (printers.length > 0) {
for (var i = 0; i < printers.length; ++i) {
var option = document.createElement('option');
option.textContent = printers[i];
$('printer-list').add(option);
}
} else {
var option = document.createElement('option');
option.textContent = localStrings.getString('no-printer');
$('printer-list').add(option);
$('printer-list').disabled = true;
$('print-button').disabled = true;
}
}
window.addEventListener('DOMContentLoaded', load);
| // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var localStrings = new LocalStrings();
/**
* Window onload handler, sets up the page.
*/
function load() {
$('cancel-button').addEventListener('click', function(e) {
window.close();
});
chrome.send('getPrinters');
};
/**
* Fill the printer list drop down.
*/
function setPrinters(printers) {
if (printers.length > 0) {
for (var i = 0; i < printers.length; ++i) {
var option = document.createElement('option');
option.textContent = printers[i];
$('printer-list').add(option);
}
} else {
var option = document.createElement('option');
option.textContent = localStrings.getString('no-printer');
$('printer-list').add(option);
$('printer-list').disabled = true;
$('print-button').disabled = true;
}
}
window.addEventListener('DOMContentLoaded', load);
| Print Preview: Hook up the cancel button. | Print Preview: Hook up the cancel button.
BUG=57895
TEST=manual
Review URL: http://codereview.chromium.org/5151009
git-svn-id: http://src.chromium.org/svn/trunk/src@66822 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Former-commit-id: b25a2a4aa82aa8107b7f95d2e4a61633652024d7 | JavaScript | bsd-3-clause | meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser | ---
+++
@@ -8,6 +8,10 @@
* Window onload handler, sets up the page.
*/
function load() {
+ $('cancel-button').addEventListener('click', function(e) {
+ window.close();
+ });
+
chrome.send('getPrinters');
};
|
84414914d90dc00b512be0ba838b9df95399253d | src/api/baseUrl.js | src/api/baseUrl.js | export default function getBaseUrl() {
const inDevelopment = window.location.hostname === 'localhost';
return inDevelopment ? 'http://localhost:3001/' : '/'
} | export default function getBaseUrl() {
return getQueryStringParameterByName('useMockApi') ? 'http://localhost:3001/' : '/';
}
function getQueryStringParameterByName(name, url) {
url = url || window.location.href;
console.log(url.indexOf(name) > -1, url);
return url.indexOf(name) > -1;
} | Check for mock api in path | Check for mock api in path
| JavaScript | mit | chrisrymer/js-dev-env,chrisrymer/js-dev-env | ---
+++
@@ -1,4 +1,9 @@
export default function getBaseUrl() {
- const inDevelopment = window.location.hostname === 'localhost';
- return inDevelopment ? 'http://localhost:3001/' : '/'
+ return getQueryStringParameterByName('useMockApi') ? 'http://localhost:3001/' : '/';
}
+
+function getQueryStringParameterByName(name, url) {
+ url = url || window.location.href;
+ console.log(url.indexOf(name) > -1, url);
+ return url.indexOf(name) > -1;
+} |
ddedc841fb1459118668496987704e085d315a83 | client/templates/duplicates/duplicates.js | client/templates/duplicates/duplicates.js | Template.duplicates.onRendered(function() {
var playlist_id = Router.current().params['_id']
Meteor.call('getDuplicateTracksFromPlaylist', playlist_id, function(err, response) {
console.log(response);
Session.set('duplicateTracks', response);
Session.set('loadedDuplicates', true);
});
});
Template.duplicates.events({
'click .remove-dup': function (e) {
var track_uri = e.currentTarget.id;
var track_id = e.currentTarget.id.split(':')[2];
var playlist_id = e.currentTarget.baseURI.split('/')[4];
console.log(track_uri);
console.log(playlist_id);
Meteor.call('removeDuplicates', playlist_id, track_uri, function(err, response) {
});
// Temporary hack, can't
// remove more than 1 duplicate without
// completely reloading
window.location.reload()
//$('#' + track_id).remove();
//Session.set('duplicateTracks', $.grep(Session.get('duplicateTracks'), function(e) { return e.uri != track_uri }));
},
'click .home': function(e) {
Session.set('loadedPlaylists', true);
Router.go('/');
}
});
Template.duplicates.helpers({
duplicates: function() {
return Session.get('duplicateTracks');
},
loadedDuplicates: function() {
return Session.get('loadedDuplicates');
}
});
| Template.duplicates.onRendered(function() {
Session.set('loadedDuplicates', false);
var playlist_id = Router.current().params['_id']
Meteor.call('getDuplicateTracksFromPlaylist', playlist_id, function(err, response) {
console.log(response);
Session.set('duplicateTracks', response);
Session.set('loadedDuplicates', true);
});
});
Template.duplicates.events({
'click .remove-dup': function (e) {
var track_uri = e.currentTarget.id;
var track_id = e.currentTarget.id.split(':')[2];
var playlist_id = e.currentTarget.baseURI.split('/')[4];
console.log(track_uri);
console.log(playlist_id);
Meteor.call('removeDuplicates', playlist_id, track_uri, function(err, response) {
});
// Temporary hack, can't
// remove more than 1 duplicate without
// completely reloading
window.location.reload()
//$('#' + track_id).remove();
//Session.set('duplicateTracks', $.grep(Session.get('duplicateTracks'), function(e) { return e.uri != track_uri }));
},
'click .home': function(e) {
Session.set('loadedPlaylists', true);
Router.go('/');
}
});
Template.duplicates.helpers({
duplicates: function() {
return Session.get('duplicateTracks');
},
loadedDuplicates: function() {
return Session.get('loadedDuplicates');
}
});
| Make spinner reappear on subsequent visits | Make spinner reappear on subsequent visits
| JavaScript | mit | Assios/Spotify-Deduplicator,Assios/Spotify-Deduplicator | ---
+++
@@ -1,4 +1,6 @@
Template.duplicates.onRendered(function() {
+
+ Session.set('loadedDuplicates', false);
var playlist_id = Router.current().params['_id']
|
e3f82b199c2f1e287b3d7892584c0836b894316e | Resources/utils/utils.js | Resources/utils/utils.js | var Utils = {};
(function() {
Utils.convertTemp = function(temp) {
if(Ti.App.Properties.getString('units','c')==='f') {
return Math.round(temp*1.8+32) +'\u00b0F'; // convert to Fahrenheit & append degree symbol-F
} else {
return temp +'\u00b0C';
}
};
Utils.weatherIcon = function(iconName) {
// Determine if this icon is already downloaded.
var appDir = Ti.Filesystem.applicationDataDirectory;
var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
// If the file does not already exists, download and store it.
if (file.exists()) {
Ti.API.log('Icon ' + iconName + ' exists on device filesystem. Use local file.');
return appDir + 'weathericons/' + iconName;
}
else {
Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.');
return 'http://www.worldweather.org/img_cartoon/' + iconName;
}
}
})();
| var Utils = {};
(function() {
Utils.convertTemp = function(temp) {
if(Ti.App.Properties.getString('units','c')==='f') {
return Math.round(temp*1.8+32) +'\u00b0F'; // convert to Fahrenheit & append degree symbol-F
} else {
return temp +'\u00b0C';
}
};
Utils.weatherIcon = function(iconName) {
// Determine if this icon is already downloaded.
var appDir = Ti.Filesystem.applicationDataDirectory;
var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
// If the file already exists, display the file stored on the local filesystem.
if (file.exists()) {
Ti.API.log('Icon ' + iconName + ' exists on device filesystem. Use local file.');
return appDir + 'weathericons/' + iconName;
}
// Otherwise, cache the image in the local filesystem, but still
// return the path right away, as caching takes a few seconds.
else {
Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.');
var imageView = Ti.UI.createImageView({
image:'http://www.worldweather.org/img_cartoon/' + iconName
});
// Wait a few seconds because it'll take a little bit to download the image.
setTimeout(function() {
// Valid images will be 35 pixels wide. Only store those images
// in the local filesystem.
var imageBlob = imageView.toImage();
Ti.API.log('Width of this icon is ' + imageBlob.width);
var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
file.write(imageBlob);
Ti.API.log('Successfully created this weathericon file: ' + iconName);
}, 5000);
return 'http://www.worldweather.org/img_cartoon/' + iconName;
}
}
})();
| Add caching mechanism for weather icons. | Add caching mechanism for weather icons.
| JavaScript | apache-2.0 | danielhanold/DannySink | ---
+++
@@ -13,13 +13,29 @@
// Determine if this icon is already downloaded.
var appDir = Ti.Filesystem.applicationDataDirectory;
var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
- // If the file does not already exists, download and store it.
+
+ // If the file already exists, display the file stored on the local filesystem.
if (file.exists()) {
Ti.API.log('Icon ' + iconName + ' exists on device filesystem. Use local file.');
return appDir + 'weathericons/' + iconName;
}
+ // Otherwise, cache the image in the local filesystem, but still
+ // return the path right away, as caching takes a few seconds.
else {
Ti.API.log('Icon ' + iconName + ' does not exists on device. Use external URL.');
+ var imageView = Ti.UI.createImageView({
+ image:'http://www.worldweather.org/img_cartoon/' + iconName
+ });
+ // Wait a few seconds because it'll take a little bit to download the image.
+ setTimeout(function() {
+ // Valid images will be 35 pixels wide. Only store those images
+ // in the local filesystem.
+ var imageBlob = imageView.toImage();
+ Ti.API.log('Width of this icon is ' + imageBlob.width);
+ var file = Ti.Filesystem.getFile(appDir, 'weathericons/' + iconName);
+ file.write(imageBlob);
+ Ti.API.log('Successfully created this weathericon file: ' + iconName);
+ }, 5000);
return 'http://www.worldweather.org/img_cartoon/' + iconName;
}
} |
bbd0d87faade33d2a072b012ad163aa8ac1973c2 | src/util/reactify.js | src/util/reactify.js | import Bit from '../components/Bit'
import { createElement } from 'react'
const COMMENT_TAG = '--'
const DEFAULT_TAG = Bit
// eslint-disable-next-line max-params
function parse (buffer, doc, options, key) {
switch (doc.type) {
case 'text':
return [...buffer, doc.content]
case 'tag': {
if (doc.name.startsWith(COMMENT_TAG)) {
return buffer
}
const tag = options.mappings[doc.name] || DEFAULT_TAG
let children = reactify(doc.children, options, key)
if (!children.length) {
children = null
}
if (tag.fromMarkup) {
doc.attrs = tag.fromMarkup(doc.attrs)
}
if (tag === DEFAULT_TAG && !doc.attrs.as) {
doc.attrs.as = doc.name
}
if (doc.attrs.class) {
// Rename class to className for React compatibility
doc.attrs.className = doc.attrs.class
delete doc.attrs.class
}
return [...buffer, createElement(tag, { key, ...doc.attrs }, children)]
}
default:
return buffer
}
}
export default function reactify (doc, options, keyPrefix = '$') {
return doc.reduce(
(collection, rootEl, key) => [
...collection,
...parse([], rootEl, options, `${keyPrefix}.${key}`)
],
[]
)
}
| import Bit from '../components/Bit'
import { createElement } from 'react'
const COMMENT_TAG = '--'
const DEFAULT_TAG = Bit
// eslint-disable-next-line max-params
function parse (buffer, doc, options, key) {
switch (doc.type) {
case 'text':
return [...buffer, doc.content]
case 'tag': {
let children = reactify(doc.children, options, key)
if (!children.length) {
children = null
}
if (doc.name.startsWith(COMMENT_TAG)) {
return [...buffer, ...children]
}
const tag = options.mappings[doc.name] || DEFAULT_TAG
if (tag.fromMarkup) {
doc.attrs = tag.fromMarkup(doc.attrs)
}
if (tag === DEFAULT_TAG && !doc.attrs.as) {
doc.attrs.as = doc.name
}
if (doc.attrs.class) {
// Rename class to className for React compatibility
doc.attrs.className = doc.attrs.class
delete doc.attrs.class
}
return [...buffer, createElement(tag, { key, ...doc.attrs }, children)]
}
default:
return buffer
}
}
export default function reactify (doc, options, keyPrefix = '$') {
return doc.reduce(
(collection, rootEl, key) => [
...collection,
...parse([], rootEl, options, `${keyPrefix}.${key}`)
],
[]
)
}
| Fix bug that caused HTML comments to halt all additional parsing | Fix bug that caused HTML comments to halt all additional parsing
| JavaScript | mit | dlindahl/stemcell,dlindahl/stemcell | ---
+++
@@ -10,14 +10,14 @@
case 'text':
return [...buffer, doc.content]
case 'tag': {
- if (doc.name.startsWith(COMMENT_TAG)) {
- return buffer
- }
- const tag = options.mappings[doc.name] || DEFAULT_TAG
let children = reactify(doc.children, options, key)
if (!children.length) {
children = null
}
+ if (doc.name.startsWith(COMMENT_TAG)) {
+ return [...buffer, ...children]
+ }
+ const tag = options.mappings[doc.name] || DEFAULT_TAG
if (tag.fromMarkup) {
doc.attrs = tag.fromMarkup(doc.attrs)
} |
83f96ed1f8fb5938b6b1c129ec19f3f7f1892ae1 | src/test/ed/db/find2.js | src/test/ed/db/find2.js | // Test object id find.
function testObjectIdFind( db ) {
r = db.ed_db_find2_oif;
r.drop();
z = [ {}, {}, {} ];
for( i = 0; i < z.length; ++i )
r.save( z[ i ] );
center = r.find( { _id: z[ 1 ]._id } );
assert.eq( 1, center.count() );
assert.eq( z[ 1 ]._id, center[ 0 ]._id );
left = r.find( { _id: { $lt: z[ 1 ]._id } } );
assert.eq( 1, left.count() );
assert.eq( z[ 0 ]._id, left[ 0 ]._id );
right = r.find( { _id: { $gt: z[ 1 ]._id } } );
assert.eq( 1, right.count() );
assert.eq( z[ 2 ]._id, right[ 0 ]._id );
}
db = connect( "test" );
testObjectIdFind( db ); | // Test object id sorting.
function testObjectIdFind( db ) {
r = db.ed_db_find2_oif;
r.drop();
for( i = 0; i < 3; ++i )
r.save( {} );
f = r.find().sort( { _id: 1 } );
assert.eq( 3, f.count() );
assert( f[ 0 ]._id < f[ 1 ]._id );
assert( f[ 1 ]._id < f[ 2 ]._id );
}
db = connect( "test" );
testObjectIdFind( db ); | Test shouldn't assume object ids are strictly increasing | Test shouldn't assume object ids are strictly increasing
| JavaScript | apache-2.0 | babble/babble,babble/babble,babble/babble,babble/babble,babble/babble,babble/babble | ---
+++
@@ -1,24 +1,16 @@
-// Test object id find.
+// Test object id sorting.
function testObjectIdFind( db ) {
r = db.ed_db_find2_oif;
r.drop();
- z = [ {}, {}, {} ];
- for( i = 0; i < z.length; ++i )
- r.save( z[ i ] );
-
- center = r.find( { _id: z[ 1 ]._id } );
- assert.eq( 1, center.count() );
- assert.eq( z[ 1 ]._id, center[ 0 ]._id );
+ for( i = 0; i < 3; ++i )
+ r.save( {} );
- left = r.find( { _id: { $lt: z[ 1 ]._id } } );
- assert.eq( 1, left.count() );
- assert.eq( z[ 0 ]._id, left[ 0 ]._id );
-
- right = r.find( { _id: { $gt: z[ 1 ]._id } } );
- assert.eq( 1, right.count() );
- assert.eq( z[ 2 ]._id, right[ 0 ]._id );
+ f = r.find().sort( { _id: 1 } );
+ assert.eq( 3, f.count() );
+ assert( f[ 0 ]._id < f[ 1 ]._id );
+ assert( f[ 1 ]._id < f[ 2 ]._id );
}
db = connect( "test" ); |
bcd2285e1e385ac8b527a0100470b073f9416210 | routes/user.js | routes/user.js | var env = require('../lib/environment');
var persona = require('../lib/persona');
var util = require('util');
exports.login = function(req, res){
if (req.method === 'GET')
return res.render("login.html");
var assertion = req.body.assertion;
persona.verify(assertion, function (err, email) {
if (err)
return res.send(util.inspect(err));
if (!userIsAuthorized(email))
return res.send(403, 'not authorized')
req.session.user = email;
return res.redirect('/admin');
});
};
exports.logout = function (req, res) {
req.session.destroy(function () {
return res.redirect('/login');
});
};
var middleware = exports.middleware = {};
middleware.requireAuth = function requireAuth(options) {
var whitelist = options.whitelist || [];
return function (req, res, next) {
var path = req.path;
var user = req.session.user;
if (whitelist.indexOf(path) > -1)
return next();
if (!user || !userIsAuthorized(user))
return res.redirect(options.redirectTo);
return next();
};
};
function userIsAuthorized(email) {
var admins = env.get('admins');
return admins.indexOf(email) >= -1;
} | var env = require('../lib/environment');
var persona = require('../lib/persona');
var util = require('util');
exports.login = function(req, res){
if (req.method === 'GET')
return res.render("login.html");
var assertion = req.body.assertion;
persona.verify(assertion, function (err, email) {
if (err)
return res.send(util.inspect(err));
if (!userIsAuthorized(email))
return res.send(403, 'not authorized')
req.session.user = email;
return res.redirect('/admin');
});
};
exports.logout = function (req, res) {
req.session.destroy(function () {
return res.redirect('/login');
});
};
var middleware = exports.middleware = {};
middleware.requireAuth = function requireAuth(options) {
var whitelist = options.whitelist || [];
return function (req, res, next) {
var path = req.path;
var user = req.session.user;
if (whitelist.indexOf(path) > -1)
return next();
if (!user || !userIsAuthorized(user))
return res.redirect(options.redirectTo);
return next();
};
};
function userIsAuthorized(email) {
var admins = env.get('admins');
var authorized = false;
admins.forEach(function (admin) {
if (authorized) return;
var adminRe = new RegExp(admin.replace('*', '.+?'));
if (adminRe.test(email))
return authorized = true;
});
return authorized;
} | Allow regexp for authorized array. | Allow regexp for authorized array.
| JavaScript | mpl-2.0 | kayaelle/msol-badger,bdgio/msol-site,kayaelle/msol-badger,kayaelle/msol-badger,bdgio/msol-site,mozilla/openbadger,bdgio/msol-site,mozilla/openbadger | ---
+++
@@ -38,5 +38,12 @@
function userIsAuthorized(email) {
var admins = env.get('admins');
- return admins.indexOf(email) >= -1;
+ var authorized = false;
+ admins.forEach(function (admin) {
+ if (authorized) return;
+ var adminRe = new RegExp(admin.replace('*', '.+?'));
+ if (adminRe.test(email))
+ return authorized = true;
+ });
+ return authorized;
} |
9ba19962871bac5bcf79db9be6252d0cc5cd966a | src/js/main.js | src/js/main.js | $(".hamburger").click(function () {
$('.slider').slideToggle();
});
| $(".hamburger").click(function () {
$('.slider').slideToggle();
}); //TODO: Write own CSS animation or use animate.css or alternative
| Add TODO to fix animation. | Add TODO to fix animation.
| JavaScript | cc0-1.0 | ShayHall/shayhall.github.io,ShayHall/shayhall.github.io | ---
+++
@@ -1,3 +1,3 @@
$(".hamburger").click(function () {
$('.slider').slideToggle();
-});
+}); //TODO: Write own CSS animation or use animate.css or alternative |
b58632ecc31006ecb64f1879abc55537d44125b8 | src/js/util.js | src/js/util.js | let Q = require("q");
module.exports = {
// `pcall` takes a function that takes a set of arguments and
// a callback (NON-Node.js style) and turns it into a promise
// that gets resolved with the arguments to the callback.
pcall: function(fn) {
let deferred = Q.defer();
let callback = function() {
deferred.resolve(Array.prototype.slice.call(arguments)[0]);
};
let newArgs = Array.prototype.slice.call(arguments, 1);
newArgs.push(callback);
fn.apply(null, newArgs);
return deferred.promise;
}
};
| let Q = require("q");
module.exports = {
// `pcall` takes a function that takes a set of arguments and
// a callback (NON-Node.js style) and turns it into a promise
// that gets resolved with the arguments to the callback.
pcall: function(fn) {
let deferred = Q.defer();
let callback = function() {
deferred.resolve(Array.prototype.slice.call(arguments)[0]);
let message = chrome.runtime.lastError.message;
if (message != "") {
console.log("pcall message: " + message);
}
};
let newArgs = Array.prototype.slice.call(arguments, 1);
newArgs.push(callback);
fn.apply(null, newArgs);
return deferred.promise;
}
};
| Add logging for pcall errors | Add logging for pcall errors
| JavaScript | mit | jaredsohn/mutetab,jaredsohn/mutetab,jaredsohn/mutetab | ---
+++
@@ -8,6 +8,10 @@
let deferred = Q.defer();
let callback = function() {
deferred.resolve(Array.prototype.slice.call(arguments)[0]);
+ let message = chrome.runtime.lastError.message;
+ if (message != "") {
+ console.log("pcall message: " + message);
+ }
};
let newArgs = Array.prototype.slice.call(arguments, 1);
newArgs.push(callback); |
aacc74db050f1ba5889a12a35014d83070ed028b | src/mochito.js | src/mochito.js | 'use strict';
var JsMockito = require('jsmockito').JsMockito;
var JsHamcrest = require('jsmockito/node_modules/jshamcrest').JsHamcrest;
var mochito = {
installTo: function(target) {
JsMockito.Integration.importTo(target);
JsHamcrest.Integration.copyMembers(target);
}
};
mochito.installTo(mochito);
module.exports = mochito;
| 'use strict';
var JsMockito = require('jsmockito').JsMockito;
// NOTE: the line below only works if you are using NPM 3, and even then it might fail!
var JsHamcrest = require('jshamcrest').JsHamcrest;
var mochito = {
installTo: function(target) {
JsMockito.Integration.importTo(target);
JsHamcrest.Integration.copyMembers(target);
}
};
mochito.installTo(mochito);
module.exports = mochito;
| Update to work in NPM 3 | Update to work in NPM 3
| JavaScript | apache-2.0 | dchambers/mochito | ---
+++
@@ -1,7 +1,8 @@
'use strict';
var JsMockito = require('jsmockito').JsMockito;
-var JsHamcrest = require('jsmockito/node_modules/jshamcrest').JsHamcrest;
+// NOTE: the line below only works if you are using NPM 3, and even then it might fail!
+var JsHamcrest = require('jshamcrest').JsHamcrest;
var mochito = {
installTo: function(target) { |
8a5ae248a879106ab6f41cfdf8772ecd1bf667ab | src/logger_test.js | src/logger_test.js | /**
* @module src/logger_test
*/
'use strict'
const test = require('unit.js')
const logger = require('./logger')
const sinon = test.sinon
describe('src/logger', () => {
it('load', () => {
test.function(logger)
})
describe('logger function', () => {
it('should return a child bunyan logger', () => {
const log = logger(__filename)
test.object(log).match({
info: sinon.match.func
})
})
})
})
| Add unit tests for 100% coverage logger module | Add unit tests for 100% coverage logger module
| JavaScript | mit | cflynn07/simple-producer-consumer,cflynn07/simple-producer-consumer | ---
+++
@@ -0,0 +1,26 @@
+/**
+ * @module src/logger_test
+ */
+'use strict'
+
+const test = require('unit.js')
+
+const logger = require('./logger')
+
+const sinon = test.sinon
+
+describe('src/logger', () => {
+
+ it('load', () => {
+ test.function(logger)
+ })
+
+ describe('logger function', () => {
+ it('should return a child bunyan logger', () => {
+ const log = logger(__filename)
+ test.object(log).match({
+ info: sinon.match.func
+ })
+ })
+ })
+}) | |
d22f47cff38a0f65ae6e5fde9f1f6517ec0f2c57 | spec/util/stringTest.js | spec/util/stringTest.js | const string = require('../../src/util/string.js');
describe('string', () => {
it('exports string', () => {
expect(string).toBeDefined();
});
describe('mapAscii', () => {
it('should return same result for no-ops', () => {
const before = string.mapAscii('', '');
const after = string.mapAscii('', '');
expect(before).toEqual(after);
});
it('should return different results given input', () => {
const before = string.mapAscii('b', 'a');
const after = string.mapAscii('a', 'b');
expect(before).not.toEqual(after);
});
});
describe('translate', () => {
const NO_OP = string.mapAscii('', '');
const LEET = string.mapAscii('let', '137');
it('should be a no-op for empty strings', () => {
expect(string.translate('', '', '')).toEqual('');
});
it('should be a no-op for empty translations', () => {
expect(string.translate('example', NO_OP)).toEqual('example');
});
it('should translate characters', () => {
expect(string.translate('leet', LEET)).toEqual('1337');
});
});
});
| const string = require('../../src/util/string.js');
describe('string', () => {
it('exports string', () => {
expect(string).toBeDefined();
});
describe('mapAscii', () => {
it('should return same result for no-ops', () => {
const before = string.mapAscii('', '');
const after = string.mapAscii('', '');
expect(before).toEqual(after);
});
it('should return different results given input', () => {
const before = string.mapAscii('b', 'a');
const after = string.mapAscii('a', 'b');
expect(before).not.toEqual(after);
});
});
describe('translate', () => {
const NO_OP = string.mapAscii('', '');
const LEET = string.mapAscii('let', '137');
it('should be a no-op for empty strings', () => {
expect(string.translate('', NO_OP)).toEqual('');
});
it('should be a no-op for empty translations', () => {
expect(string.translate('example', NO_OP)).toEqual('example');
});
it('should translate characters', () => {
expect(string.translate('leet', LEET)).toEqual('1337');
});
});
});
| Fix no-op test for string library. | Fix no-op test for string library.
| JavaScript | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | ---
+++
@@ -24,7 +24,7 @@
const LEET = string.mapAscii('let', '137');
it('should be a no-op for empty strings', () => {
- expect(string.translate('', '', '')).toEqual('');
+ expect(string.translate('', NO_OP)).toEqual('');
});
it('should be a no-op for empty translations', () => { |
2d092c88e1d45102dd32b9a9b92c7a1f5bd00d13 | src/server/main.js | src/server/main.js | /* eslint-disable no-console */
import AccessTokenRetriever from './access-token-retriever';
import ConfigurationProvider from './configuration-provider';
import WebServer from './web-server';
import WindowsGraphUsersRetriever from './windows-graph-users-retriever';
export default class Main {
constructor() {
this.configuration = new ConfigurationProvider().getConfiguration();
this.directoryItems = [];
this.isRefreshing = false;
}
start() {
return this.refreshData()
.then(() => new WebServer(this.directoryItems, () => this.refreshData()).start())
.catch(err => {
console.error(err);
process.exit(-1); // eslint-disable-line no-process-exit, no-magic-numbers
});
}
refreshData() {
if (this.isRefreshing) {
return Promise.resolve(true);
}
this.isRefreshing = true;
return new AccessTokenRetriever()
.getAccessToken(
this.configuration.endpointId,
this.configuration.clientId,
this.configuration.clientSecret)
.then(accessToken => new WindowsGraphUsersRetriever()
.getUsers(this.configuration.endpointId, accessToken))
.then(users => {
this.directoryItems = users;
this.isRefreshing = false;
})
.catch(x => {
this.isRefreshing = false;
return x;
});
}
}
| /* eslint-disable no-console */
import AccessTokenRetriever from './access-token-retriever';
import ConfigurationProvider from './configuration-provider';
import WebServer from './web-server';
import WindowsGraphUsersRetriever from './windows-graph-users-retriever';
import RandomUsersRetriever from './random-users-retriever';
export default class Main {
constructor() {
this.configuration = new ConfigurationProvider().getConfiguration();
this.directoryItems = [];
this.isRefreshing = false;
}
start() {
return this.refreshData()
.then(() => new WebServer(this.directoryItems, () => this.refreshData()).start())
.catch(err => {
console.error(err);
process.exit(-1); // eslint-disable-line no-process-exit, no-magic-numbers
});
}
refreshData() {
if (!this.configuration.endpointId) {
console.log('process.env.ENDPOINT_ID is not set, using RandomUsersRetriever ...');
return new RandomUsersRetriever()
.getUsers(100, 4) // eslint-disable-line no-magic-numbers
.then(users => {
this.directoryItems = users;
});
}
if (this.isRefreshing) {
return Promise.resolve(true);
}
this.isRefreshing = true;
return new AccessTokenRetriever()
.getAccessToken(
this.configuration.endpointId,
this.configuration.clientId,
this.configuration.clientSecret)
.then(accessToken => new WindowsGraphUsersRetriever()
.getUsers(this.configuration.endpointId, accessToken))
.then(users => {
this.directoryItems = users;
this.isRefreshing = false;
})
.catch(x => {
this.isRefreshing = false;
return x;
});
}
}
| Use RandomUsersRetriever when ENDPOINT_ID is not set | Use RandomUsersRetriever when ENDPOINT_ID is not set
| JavaScript | mit | ritterim/star-orgs,kendaleiv/star-orgs,ritterim/star-orgs,kendaleiv/star-orgs | ---
+++
@@ -4,6 +4,7 @@
import ConfigurationProvider from './configuration-provider';
import WebServer from './web-server';
import WindowsGraphUsersRetriever from './windows-graph-users-retriever';
+import RandomUsersRetriever from './random-users-retriever';
export default class Main {
constructor() {
@@ -23,6 +24,16 @@
}
refreshData() {
+ if (!this.configuration.endpointId) {
+ console.log('process.env.ENDPOINT_ID is not set, using RandomUsersRetriever ...');
+
+ return new RandomUsersRetriever()
+ .getUsers(100, 4) // eslint-disable-line no-magic-numbers
+ .then(users => {
+ this.directoryItems = users;
+ });
+ }
+
if (this.isRefreshing) {
return Promise.resolve(true);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.