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 |
|---|---|---|---|---|---|---|---|---|---|---|
0123500c30cb7acf695d5486b161f3b4ecd3b545 | test/trie.js | test/trie.js | var Trie = require('../app/trie');
describe('Trie', function() {
var trie;
beforeEach(function() {
trie = new Trie();
});
it('should be an object', function() {
expect(trie).to.be.ok;
});
it('should have a root', function() {
expect(trie.root).to.be.ok;
});
it('should have add method', function() {
expect(trie.add).to.be.an.instanceof(Function);
});
it('should have search method', function() {
expect(trie.search).to.be.an.instanceof(Function);
});
it('should have find method', function() {
expect(trie.find).to.be.an.instanceof(Function);
});
it('should add string to trie', function() {
expect(trie.add('test')).to.be.undefined;
});
it('should correctly find an added string', function() {
trie.add('test');
expect(trie.find('test')).to.be.true;
});
});
| var Trie = require('../app/trie');
describe('Trie', function() {
var trie;
beforeEach(function() {
trie = new Trie();
});
it('should be an object', function() {
expect(trie).to.be.ok;
});
it('should have a root', function() {
expect(trie.root).to.be.ok;
});
it('should have add method', function() {
expect(trie.add).to.be.an.instanceof(Function);
});
it('should have search method', function() {
expect(trie.search).to.be.an.instanceof(Function);
});
it('should have find method', function() {
expect(trie.find).to.be.an.instanceof(Function);
});
it('should add string to trie', function() {
expect(trie.add('test')).to.be.undefined;
});
it('should correctly find an added string', function() {
trie.add('test');
expect(trie.find('test')).to.be.true;
});
it('should trim leading/trailing spaces when adding a string', function() {
trie.add(' test ');
expect(trie.find('test')).to.be.true;
});
});
| Add test for trimming leading/trailing whitespace | Add test for trimming leading/trailing whitespace
| JavaScript | mit | mgarbacz/nordrassil,mgarbacz/nordrassil | ---
+++
@@ -36,4 +36,9 @@
expect(trie.find('test')).to.be.true;
});
+ it('should trim leading/trailing spaces when adding a string', function() {
+ trie.add(' test ');
+ expect(trie.find('test')).to.be.true;
+ });
+
}); |
21c33458f27ade177cdced1f2f9adba321883274 | protractor-demo/conf.js | protractor-demo/conf.js | // An example configuration file.
exports.config = {
// The address of a running selenium server.
//seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to the location of the spec file. They may
// include glob patterns.
specs: ['*.spec.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
}
}; | // An example configuration file.
exports.config = {
// The address of a running selenium server.
//seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
allScriptsTimeout: 11000,
// Spec patterns are relative to the location of the spec file. They may
// include glob patterns.
specs: ['*.spec.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
defaultTimeoutInterval: 30000
}
}; | Add timeouts to protractor demo | Add timeouts to protractor demo
| JavaScript | mit | petebacondarwin/angularjs-testing-presentation | ---
+++
@@ -8,6 +8,8 @@
'browserName': 'chrome'
},
+ allScriptsTimeout: 11000,
+
// Spec patterns are relative to the location of the spec file. They may
// include glob patterns.
specs: ['*.spec.js'],
@@ -15,5 +17,6 @@
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
+ defaultTimeoutInterval: 30000
}
}; |
802462643c25d33f0632b0a58671094277f8a541 | examples/producer.js | examples/producer.js |
var starsky = require('..');
setInterval(function () {
starsky.publish('starsky.test', {
subject: 'test message'
});
}, 1000);
starsky.connect(); |
var starsky = require('..');
starsky.configure(__dirname + '/config.yml');
setInterval(function () {
starsky.publish('starsky.test', {
subject: 'test message'
}, confirm);
}, 1000);
function confirm (err) {
if (err) console.error(err.message);
}
starsky.connect();
| Add confirm callback to example | Add confirm callback to example
| JavaScript | mit | recurly/starsky | ---
+++
@@ -1,10 +1,16 @@
var starsky = require('..');
+
+starsky.configure(__dirname + '/config.yml');
setInterval(function () {
starsky.publish('starsky.test', {
subject: 'test message'
- });
+ }, confirm);
}, 1000);
+function confirm (err) {
+ if (err) console.error(err.message);
+}
+
starsky.connect(); |
b1e159223635a33ba2c3e5ad239b0dd50baa5bad | src/apps/contacts/middleware/collection.js | src/apps/contacts/middleware/collection.js | const { pick, mapValues, isArray, pickBy, get } = require('lodash')
const { search } = require('../../search/services')
const { transformApiResponseToSearchCollection } = require('../../search/transformers')
const { transformContactToListItem } = require('../transformers')
const removeArray = require('../../../lib/remove-array')
async function getContactsCollection (req, res, next) {
try {
res.locals.results = await search({
searchEntity: 'contact',
requestBody: req.body,
token: req.session.token,
page: req.query.page,
isAggregation: false,
})
.then(transformApiResponseToSearchCollection(
{ query: req.query },
transformContactToListItem,
))
next()
} catch (error) {
next(error)
}
}
function getRequestBody (req, res, next) {
const selectedFiltersQuery = removeArray(pick(req.query, [
'archived',
'company_name',
'company_sector',
'address_country',
'company_uk_region',
]), 'archived')
mapValues(get(selectedFiltersQuery, 'archived'), (value) => {
return isArray(value) ? null : value
})
const selectedSortBy = req.query.sortby
? { sortby: req.query.sortby }
: null
req.body = Object.assign({}, req.body, selectedSortBy, pickBy(selectedFiltersQuery))
next()
}
module.exports = {
getContactsCollection,
getRequestBody,
}
| const { pick, mapValues, isArray, pickBy, get } = require('lodash')
const { search } = require('../../search/services')
const { transformApiResponseToSearchCollection } = require('../../search/transformers')
const { transformContactToListItem } = require('../transformers')
const removeArray = require('../../../lib/remove-array')
async function getContactsCollection (req, res, next) {
try {
res.locals.results = await search({
searchEntity: 'contact',
requestBody: req.body,
token: req.session.token,
page: req.query.page,
isAggregation: false,
})
.then(transformApiResponseToSearchCollection(
{ query: req.query },
transformContactToListItem,
))
next()
} catch (error) {
next(error)
}
}
function getRequestBody (req, res, next) {
const selectedFiltersQuery = removeArray(pick(req.query, [
'archived',
'name',
'company_name',
'company_sector',
'address_country',
'company_uk_region',
]), 'archived')
mapValues(get(selectedFiltersQuery, 'archived'), (value) => {
return isArray(value) ? null : value
})
const selectedSortBy = req.query.sortby
? { sortby: req.query.sortby }
: null
req.body = Object.assign({}, req.body, selectedSortBy, pickBy(selectedFiltersQuery))
next()
}
module.exports = {
getContactsCollection,
getRequestBody,
}
| Add support to the contact list middleware for contact name | Add support to the contact list middleware for contact name
| JavaScript | mit | uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend | ---
+++
@@ -28,6 +28,7 @@
function getRequestBody (req, res, next) {
const selectedFiltersQuery = removeArray(pick(req.query, [
'archived',
+ 'name',
'company_name',
'company_sector',
'address_country', |
e235cdc5790481504b81622b52b9049cb97ef5a0 | models/profile.js | models/profile.js | // Profile Model
module.exports = function(sequelize, DataTypes) {
var Profile = sequelize.define('Profile', {
tagLine: {
type: DataTypes.STRING,
allowNull: false
},
description: {
type: DataTypes.TEXT,
allowNull: false
}
}, {
associate: function(models) {
Profile.hasMany(models.ProfileItem);
}
});
return Profile;
}
| // Profile Model
module.exports = function(sequelize, DataTypes) {
var Profile = sequelize.define('Profile', {
tagLine: {
type: DataTypes.STRING,
allowNull: false
},
description: {
type: DataTypes.TEXT,
allowNull: false
},
votes: {
type: DataTypes.INTEGER,
defaultValue: 0
}
}, {
associate: function(models) {
Profile.hasMany(models.ProfileItem);
}
});
return Profile;
}
| Add 'votes' field to Profile model | Add 'votes' field to Profile model
| JavaScript | mit | kocsenc/nodejs-tutorme,kocsenc/nodejs-tutorme | ---
+++
@@ -8,6 +8,10 @@
description: {
type: DataTypes.TEXT,
allowNull: false
+ },
+ votes: {
+ type: DataTypes.INTEGER,
+ defaultValue: 0
}
}, {
associate: function(models) { |
ca2cbd5b3f051ac74922da0fa7ab7b3d1f5630a8 | lib/assert-full-equal/utilities.js | lib/assert-full-equal/utilities.js | 'use strict';
function isObject(/* subjects... */) {
var index,
length = arguments.length,
current;
if (length < 1) {
return false;
}
for (index = 0; index < length; index += 1) {
current = arguments[index];
if (('object' !== typeof current) || (null === current)) {
return false;
}
}
return true;
}
function isInstanceOf(constructor /*, subjects... */) {
var index,
length = arguments.length;
if (length < 2) {
return false;
}
for (index = 1; index < length; index += 1) {
if (!(arguments[index] instanceof constructor)) {
return false;
}
}
return true;
}
function xor(left, right) {
return (left && !right) || (!left && right);
}
module.exports.isObject = isObject;
module.exports.isInstanceOf = isInstanceOf;
module.exports.xor = xor;
| 'use strict';
function isObject(/* subjects... */) {
var index,
length = arguments.length,
current;
if (length < 1) {
return false;
}
for (index = 0; index < length; index += 1) {
current = arguments[index];
if (('object' !== typeof current) || (null === current)) {
return false;
}
}
return true;
}
function isInstanceOf(constructor /*, subjects... */) {
var index,
length = arguments.length;
if (length < 2) {
return false;
}
for (index = 1; index < length; index += 1) {
if (!(arguments[index] instanceof constructor)) {
return false;
}
}
return true;
}
module.exports.isObject = isObject;
module.exports.isInstanceOf = isInstanceOf;
| Remove unused `xor` utility function | Remove unused `xor` utility function
| JavaScript | mit | dervus/assert-paranoid-equal | ---
+++
@@ -40,11 +40,5 @@
}
-function xor(left, right) {
- return (left && !right) || (!left && right);
-}
-
-
module.exports.isObject = isObject;
module.exports.isInstanceOf = isInstanceOf;
-module.exports.xor = xor; |
4da68c1db54090b480551211563610d9a4c45713 | tests/acceptance/css-styles-test.js | tests/acceptance/css-styles-test.js | import { test } from 'qunit';
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | css styles');
test('check that Octicons scss is being applied', function(assert) {
visit('/');
andThen(function() {
assert.equal($('.octicon').css('display'), 'inline-block');
});
});
| import { test } from 'qunit';
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | css styles');
test('check that Octicons scss is being applied', function(assert) {
visit('/');
andThen(function() {
assert.equal($('span.octicon').css('display'), 'inline-block');
});
});
| Make sure we're testing span | Make sure we're testing span
| JavaScript | mit | kpfefferle/ember-octicons,kpfefferle/ember-cli-octicons,kpfefferle/ember-cli-octicons,kpfefferle/ember-octicons | ---
+++
@@ -7,6 +7,6 @@
visit('/');
andThen(function() {
- assert.equal($('.octicon').css('display'), 'inline-block');
+ assert.equal($('span.octicon').css('display'), 'inline-block');
});
}); |
57addfba221451214ed59738f528c5febfc5265b | src/types/var-type.js | src/types/var-type.js | const DocumentedItem = require('./item');
class DocumentedVarType extends DocumentedItem {
registerMetaInfo(data) {
this.directData = data;
}
serialize() {
const names = [];
for(const name of this.directData.names) names.push(this.constructor.splitVarName(name));
if(!this.directData.description && !this.directData.nullable) return names;
return {
types: names,
description: this.directData.description,
nullable: this.directData.nullable
};
}
static splitVarName(str) {
if(str === '*') return ['*'];
const matches = str.match(/([\w*]+)([^\w*]+)/g);
const output = [];
if(matches) {
for(const match of matches) {
const groups = match.match(/([\w*]+)([^\w*]+)/);
output.push([groups[1], groups[2]]);
}
} else {
output.push([str.match(/([\w*]+)/g)[0]]);
}
return output;
}
}
/*
{
"names":[
"String"
]
}
*/
module.exports = DocumentedVarType;
| const DocumentedItem = require('./item');
class DocumentedVarType extends DocumentedItem {
registerMetaInfo(data) {
this.directData = data;
}
serialize() {
const names = [];
for(const name of this.directData.names) names.push(this.constructor.splitVarName(name));
if(!this.directData.description && !this.directData.nullable) return names;
return {
types: names,
description: this.directData.description,
nullable: this.directData.nullable
};
}
static splitVarName(str) {
if(str === '*') return ['*'];
str = str.replace(/\./g, '');
const matches = str.match(/([\w*]+)([^\w*]+)/g);
const output = [];
if(matches) {
for(const match of matches) {
const groups = match.match(/([\w*]+)([^\w*]+)/);
output.push([groups[1], groups[2]]);
}
} else {
output.push([str.match(/([\w*]+)/g)[0]]);
}
return output;
}
}
/*
{
"names":[
"String"
]
}
*/
module.exports = DocumentedVarType;
| Remove dots from generic types | Remove dots from generic types
| JavaScript | apache-2.0 | hydrabolt/discord.js-docgen | ---
+++
@@ -18,6 +18,7 @@
static splitVarName(str) {
if(str === '*') return ['*'];
+ str = str.replace(/\./g, '');
const matches = str.match(/([\w*]+)([^\w*]+)/g);
const output = [];
if(matches) { |
fa071535ee1bd3ea9421d98903d39803558405b8 | back/routes/city.router.js | back/routes/city.router.js | /**
* @fileOverview Routes for City.
*/
var log = require('logg').getLogger('app.router.city');
var HomeCtrl = require('../controllers/city/index.ctrl');
var StaticsCtrl = require('../controllers/city/statics.ctrl');
var router = module.exports = {};
/**
* Initialize routes.
*
* @param {express} app Express instance.
*/
router.init = function(app) {
log.fine('init() :: initializing routes...');
var homeCtrl = HomeCtrl.getInstance();
var staticsCtrl = StaticsCtrl.getInstance();
app.get('/', homeCtrl.use);
app.get('/submit-event/', staticsCtrl.use);
};
| /**
* @fileOverview Routes for City.
*/
var log = require('logg').getLogger('app.router.city');
var HomeCtrl = require('../controllers/city/index.ctrl');
var StaticsCtrl = require('../controllers/city/statics.ctrl');
var TogetherCtrl = require('../controllers/city/together.ctrl');
var router = module.exports = {};
/**
* Initialize routes.
*
* @param {express} app Express instance.
*/
router.init = function(app) {
log.fine('init() :: initializing routes...');
var homeCtrl = HomeCtrl.getInstance();
var staticsCtrl = StaticsCtrl.getInstance();
var togetherCtrl = TogetherCtrl.getInstance();
app.get('/', homeCtrl.use);
app.get('/submit-event', staticsCtrl.use);
app.get('/together', togetherCtrl.use);
};
| Add route for together event | Add route for together event
| JavaScript | mpl-2.0 | WeAreTech/wearetech.io,WeAreRoots/weareroots.org,WeAreTech/wearetech.io | ---
+++
@@ -5,6 +5,7 @@
var HomeCtrl = require('../controllers/city/index.ctrl');
var StaticsCtrl = require('../controllers/city/statics.ctrl');
+var TogetherCtrl = require('../controllers/city/together.ctrl');
var router = module.exports = {};
@@ -17,8 +18,11 @@
log.fine('init() :: initializing routes...');
var homeCtrl = HomeCtrl.getInstance();
var staticsCtrl = StaticsCtrl.getInstance();
+ var togetherCtrl = TogetherCtrl.getInstance();
app.get('/', homeCtrl.use);
- app.get('/submit-event/', staticsCtrl.use);
+ app.get('/submit-event', staticsCtrl.use);
+
+ app.get('/together', togetherCtrl.use);
}; |
dcd4c2c790536ee755b42f9cc0a51b5cdb6f04e7 | js/chartist2image-with-svg2bitmap.js | js/chartist2image-with-svg2bitmap.js | window.onload = function() {
createChart('.ct-chart', true);
document.getElementById('button1').onclick = function () {
var chartDivNode = document.getElementById('chart');
var chartSvgNode = chartDivNode.children[0];
SVG2Bitmap(chartSvgNode, document.getElementById('canvas'));
};
document.getElementById('button2').onclick = function () {
var dataURL = document.getElementById('canvas').toDataURL();
document.getElementById('image').src = dataURL;
};
}
| window.onload = function() {
// using true as the second parameter we force chartist.js to use plain SVG not <foreignObject>
createChart('.ct-chart', true);
document.getElementById('button1').onclick = function () {
var chartDivNode = document.getElementById('chart');
var chartSvgNode = chartDivNode.children[0];
// SVG2Bitmap will render the chartist SVG code and create all necessary inline styles
SVG2Bitmap(chartSvgNode, document.getElementById('canvas'));
};
document.getElementById('button2').onclick = function () {
var dataURL = document.getElementById('canvas').toDataURL();
document.getElementById('image').src = dataURL;
};
}
| Comment added to the JS code | Comment added to the JS code
| JavaScript | apache-2.0 | giraone/chartist2image,giraone/chartist2image | ---
+++
@@ -1,5 +1,6 @@
window.onload = function() {
+ // using true as the second parameter we force chartist.js to use plain SVG not <foreignObject>
createChart('.ct-chart', true);
document.getElementById('button1').onclick = function () {
@@ -7,6 +8,7 @@
var chartDivNode = document.getElementById('chart');
var chartSvgNode = chartDivNode.children[0];
+ // SVG2Bitmap will render the chartist SVG code and create all necessary inline styles
SVG2Bitmap(chartSvgNode, document.getElementById('canvas'));
};
|
097e4552a3f47a38bc4ae97eb53993f13106904e | vendor/ember-cli-qunit/test-loader.js | vendor/ember-cli-qunit/test-loader.js | /* globals jQuery,QUnit */
jQuery(document).ready(function() {
var TestLoader = require('ember-cli/test-loader')['default'];
TestLoader.prototype.shouldLoadModule = function(moduleName) {
return moduleName.match(/\/.*[-_]test$/) || (!QUnit.urlParams.nojshint && moduleName.match(/\.jshint$/));
};
TestLoader.prototype.moduleLoadFailure = function(moduleName, error) {
QUnit.module('TestLoader Failures');
QUnit.test(moduleName + ': could not be loaded', function() {
throw error;
});
};
var autostart = QUnit.config.autostart !== false;
QUnit.config.autostart = false;
setTimeout(function() {
TestLoader.load();
if (autostart) {
QUnit.start();
}
}, 250);
});
| /* globals jQuery,QUnit */
jQuery(document).ready(function() {
var TestLoaderModule = require('ember-cli/test-loader');
var TestLoader = TestLoaderModule['default'];
var addModuleIncludeMatcher = TestLoaderModule['addModuleIncludeMatcher'];
function moduleMatcher(moduleName) {
return moduleName.match(/\/.*[-_]test$/) || (!QUnit.urlParams.nojshint && moduleName.match(/\.jshint$/));
}
if (addModuleIncludeMatcher) {
addModuleIncludeMatcher(moduleMatcher);
} else {
TestLoader.prototype.shouldLoadModule = moduleMatcher;
}
TestLoader.prototype.moduleLoadFailure = function(moduleName, error) {
QUnit.module('TestLoader Failures');
QUnit.test(moduleName + ': could not be loaded', function() {
throw error;
});
};
var autostart = QUnit.config.autostart !== false;
QUnit.config.autostart = false;
setTimeout(function() {
TestLoader.load();
if (autostart) {
QUnit.start();
}
}, 250);
});
| Use addModuleIncludeMatcher instead of prototype mutation. | Use addModuleIncludeMatcher instead of prototype mutation.
| JavaScript | mit | ember-cli/ember-cli-qunit,nathanhammond/ember-cli-qunit,ember-cli/ember-cli-qunit,nathanhammond/ember-cli-qunit | ---
+++
@@ -1,10 +1,19 @@
/* globals jQuery,QUnit */
jQuery(document).ready(function() {
- var TestLoader = require('ember-cli/test-loader')['default'];
- TestLoader.prototype.shouldLoadModule = function(moduleName) {
+ var TestLoaderModule = require('ember-cli/test-loader');
+ var TestLoader = TestLoaderModule['default'];
+ var addModuleIncludeMatcher = TestLoaderModule['addModuleIncludeMatcher'];
+
+ function moduleMatcher(moduleName) {
return moduleName.match(/\/.*[-_]test$/) || (!QUnit.urlParams.nojshint && moduleName.match(/\.jshint$/));
- };
+ }
+
+ if (addModuleIncludeMatcher) {
+ addModuleIncludeMatcher(moduleMatcher);
+ } else {
+ TestLoader.prototype.shouldLoadModule = moduleMatcher;
+ }
TestLoader.prototype.moduleLoadFailure = function(moduleName, error) {
QUnit.module('TestLoader Failures'); |
407de35036baf8aec2cca3f0bf6dede8870fa327 | public/javascripts/pluginUpload.js | public/javascripts/pluginUpload.js | var MAX_FILE_SIZE = 1048576;
$(function() {
$('#pluginFile').on('change', function() {
var alert = $('.alert-file');
var fileName = $(this).val().trim();
var fileSize = this.files[0].size;
if (!fileName) {
alert.fadeOut(1000);
return;
}
if (fileSize > MAX_FILE_SIZE) {
alert.find('i').removeClass('fa-upload').addClass('fa-times');
alert.find('.file-upload').find('button')
.removeClass('btn-success')
.addClass('btn-danger')
.prop('disabled', true);
alert.find('.file-size').css('color', '#d9534f');
}
fileName = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length);
alert.find('.file-name').text(fileName);
alert.find('.file-size').text(filesize(this.files[0].size));
alert.fadeIn('slow');
});
});
| var MAX_FILE_SIZE = 1048576;
$(function() {
$('#pluginFile').on('change', function() {
var alert = $('.alert-file');
var fileName = $(this).val().trim();
var fileSize = this.files[0].size;
if (!fileName) {
alert.fadeOut(1000);
return;
}
if (fileSize > MAX_FILE_SIZE) {
alert.find('i').removeClass('fa-upload').addClass('fa-times');
alert.find('.file-upload').find('button')
.removeClass('btn-success')
.addClass('btn-danger')
.prop('disabled', true);
alert.find('.file-size').css('color', '#d9534f');
}
fileName = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length);
alert.find('.file-name').text(fileName);
alert.find('.file-size').text(filesize(this.files[0].size));
alert.fadeIn('slow');
});
$('.file-upload').find('button').click(function() {
$(this).find('i').removeClass('fa-upload').addClass('fa-spinner fa-spin');
});
});
| Add spinner to upload button | Add spinner to upload button
Signed-off-by: Walker Crouse <a52c6ce3cf7a08dcbb27377aa79f9b994b446d4c@hotmail.com>
| JavaScript | mit | SpongePowered/Ore,SpongePowered/Ore,SpongePowered/Ore,SpongePowered/Ore,SpongePowered/Ore | ---
+++
@@ -24,4 +24,8 @@
alert.find('.file-size').text(filesize(this.files[0].size));
alert.fadeIn('slow');
});
+
+ $('.file-upload').find('button').click(function() {
+ $(this).find('i').removeClass('fa-upload').addClass('fa-spinner fa-spin');
+ });
}); |
2c8a9fb5fe88c71970af1ad428221251136307eb | functions/helper-intents/ask-for-datetime.js | functions/helper-intents/ask-for-datetime.js | // Copyright 2018, Google, 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.
const {DateTime} = require('actions-on-google');
module.exports = {
'ask_for_datetime': (conv) => {
const options = {
prompts: {
initial: 'When would you like to schedule the appointment?',
date: 'What day was that?',
time: 'What time?',
},
};
conv.ask(new DateTime(options));
},
'ask_for_datetime_confirmation': (conv, params, datetime) => {
const { month, day } = datetime.date
const { hours, minutes } = datetime.time
conv.ask(`<speak>
Great, we will see you on
<say-as interpret-as="date" format="dm">${day}-${month}</say-as>
<say-as interpret-as="time" format="hms12" detail="2">${hours}:${minutes || '00'}</say-as>
</speak>`);
},
};
| // Copyright 2018, Google, 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.
const {DateTime} = require('actions-on-google');
module.exports = {
'ask_for_datetime': (conv) => {
const options = {
prompts: {
initial: 'When would you like to schedule the appointment?',
date: 'What day was that?',
time: 'What time?',
},
};
conv.ask(new DateTime(options));
},
'ask_for_datetime_confirmation': (conv, params, datetime) => {
const { month, day } = datetime.date
const { hours, minutes } = datetime.time
conv.ask(`<speak>` +
`Great, we will see you on ` +
`<say-as interpret-as="date" format="dm">${day}-${month}</say-as>` +
`<say-as interpret-as="time" format="hms12" detail="2">${hours}:${minutes || '00'}</say-as>` +
`</speak>`);
},
};
| Remove spaces from datetime SSML response. | Remove spaces from datetime SSML response.
bug: b/124764992
Change-Id: I846c6e96311350215b2237ebc213c12fc4e79610
| JavaScript | apache-2.0 | actions-on-google/dialogflow-helper-intents-nodejs | ---
+++
@@ -29,10 +29,10 @@
'ask_for_datetime_confirmation': (conv, params, datetime) => {
const { month, day } = datetime.date
const { hours, minutes } = datetime.time
- conv.ask(`<speak>
- Great, we will see you on
- <say-as interpret-as="date" format="dm">${day}-${month}</say-as>
- <say-as interpret-as="time" format="hms12" detail="2">${hours}:${minutes || '00'}</say-as>
- </speak>`);
+ conv.ask(`<speak>` +
+ `Great, we will see you on ` +
+ `<say-as interpret-as="date" format="dm">${day}-${month}</say-as>` +
+ `<say-as interpret-as="time" format="hms12" detail="2">${hours}:${minutes || '00'}</say-as>` +
+ `</speak>`);
},
}; |
33619ceac4f7453c87c02610ef297af0d76beee9 | gulp/tasks/styles.js | gulp/tasks/styles.js | 'use strict';
var config = require('../config');
var gulp = require('gulp');
var sass = require('gulp-sass');
var gulpif = require('gulp-if');
var handleErrors = require('../util/handleErrors');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('styles', function () {
return gulp.src(config.styles.src)
.pipe(sass({
includePaths: [
'./node_modules/bootstrap-sass/assets/stylesheets',
],
sourceComments: global.isProd ? 'none' : 'map',
sourceMap: 'sass',
outputStyle: global.isProd ? 'compressed' : 'nested'
}))
.pipe(autoprefixer("last 2 versions", "> 1%", "ie 8"))
.on('error', handleErrors)
.pipe(gulp.dest(config.styles.dest))
.pipe(gulpif(browserSync.active, browserSync.reload({ stream: true })));
}); | 'use strict';
var config = require('../config');
var gulp = require('gulp');
var sass = require('gulp-sass');
var gulpif = require('gulp-if');
var handleErrors = require('../util/handleErrors');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('styles', function () {
return gulp.src(config.styles.src)
.pipe(sass({
includePaths: [
'./node_modules/bootstrap-sass/assets/stylesheets',
],
sourceComments: global.isProd ? 'none' : 'map',
sourceMap: 'sass',
outputStyle: global.isProd ? 'compressed' : 'nested',
errLogToConsole: true
}))
.pipe(autoprefixer("last 2 versions", "> 1%", "ie 8"))
.on('error', handleErrors)
.pipe(gulp.dest(config.styles.dest))
.pipe(gulpif(browserSync.active, browserSync.reload({ stream: true })));
}); | Add option to not break pipe when sass syntax error | Add option to not break pipe when sass syntax error
| JavaScript | mit | loklak/loklak_webclient,loklak/loklak_webclient,aayusharora/loklak_webclient,aayusharora/loklak_webclient,codethejason/loklak_webclient,loklak/loklak_webclient,codethejason/loklak_webclient,codethejason/loklak_webclient,aayusharora/loklak_webclient | ---
+++
@@ -17,7 +17,8 @@
],
sourceComments: global.isProd ? 'none' : 'map',
sourceMap: 'sass',
- outputStyle: global.isProd ? 'compressed' : 'nested'
+ outputStyle: global.isProd ? 'compressed' : 'nested',
+ errLogToConsole: true
}))
.pipe(autoprefixer("last 2 versions", "> 1%", "ie 8"))
.on('error', handleErrors) |
4e7632351780a9fe7ba52616313e7a1b31b410ac | packages/coinstac-ui/app/render/components/projects/dashboard-projects.js | packages/coinstac-ui/app/render/components/projects/dashboard-projects.js | import React, { PropTypes } from 'react';
export default class DashboardProjects extends React.Component { // eslint-disable-line
render() {
return (
<div className="projects">
<div className="page-header clearfix">
<h1 className="pull-left">Projects</h1>
</div>
{this.props.children}
</div>
);
}
}
DashboardProjects.propTypes = {
children: PropTypes.array,
};
| import React, { PropTypes } from 'react';
export default class DashboardProjects extends React.Component { // eslint-disable-line
render() {
return (
<div className="projects">
<div className="page-header clearfix">
<h1 className="pull-left">Projects</h1>
</div>
{this.props.children}
</div>
);
}
}
DashboardProjects.propTypes = {
children: PropTypes.element,
};
| Fix project dashboard's prop type. | Fix project dashboard's prop type.
| JavaScript | mit | MRN-Code/coinstac,MRN-Code/coinstac,MRN-Code/coinstac | ---
+++
@@ -14,5 +14,5 @@
}
DashboardProjects.propTypes = {
- children: PropTypes.array,
+ children: PropTypes.element,
}; |
fe70897411c2109d1cbc725068e96ae177dfdbb9 | lib/composition/node/subelm/index.js | lib/composition/node/subelm/index.js | var Deffy = require("deffy")
function SubElm(data, parent) {
this.name = data.name;
this.label = Deffy(data.label, this.name);
this.type = data.type;
this.id = [this.type, parent.name, this.name].join("_");
}
module.exports = SubElm;
| var Deffy = require("deffy")
, Typpy = require("typpy")
;
function SubElm(type, data, parent) {
if (Typpy(data, SubElm)) {
return data;
}
this.name = data.name || data.event || data.method;
this.label = Deffy(data.label, this.name);
this.type = type;
this.id = [this.type, parent.name, this.name].join("_");
}
module.exports = SubElm;
| Set the sub element name | Set the sub element name
| JavaScript | mit | jillix/engine-builder | ---
+++
@@ -1,9 +1,14 @@
var Deffy = require("deffy")
+ , Typpy = require("typpy")
+ ;
-function SubElm(data, parent) {
- this.name = data.name;
+function SubElm(type, data, parent) {
+ if (Typpy(data, SubElm)) {
+ return data;
+ }
+ this.name = data.name || data.event || data.method;
this.label = Deffy(data.label, this.name);
- this.type = data.type;
+ this.type = type;
this.id = [this.type, parent.name, this.name].join("_");
}
|
edfeb5b06100df3c2ccc46eb56edc9224624b96b | packages/ember-cli-fastboot/vendor/experimental-render-mode-rehydrate.js | packages/ember-cli-fastboot/vendor/experimental-render-mode-rehydrate.js | (function() {
if (typeof FastBoot === 'undefined') {
var current = document.getElementById('fastboot-body-start');
if (
current &&
typeof Ember.ViewUtils.isSerializationFirstNode === 'function' &&
Ember.ViewUtils.isSerializationFirstNode(current.nextSibling)
) {
Ember.ApplicationInstance.reopen({
_bootSync: function(options) {
if (options === undefined) {
options = {
_renderMode: 'rehydrate'
};
}
return this._super(options);
}
});
// Prevent clearRender by removing `fastboot-body-start` which is already
// guarded for
current.parentNode.removeChild(current);
var end = document.getElementById('fastboot-body-end');
if (end) {
end.parentNode.removeChild(end);
}
}
}
})();
| (function() {
if (typeof FastBoot === 'undefined') {
var current = document.getElementById('fastboot-body-start');
var Ember = require('ember').default;
if (
current &&
typeof Ember.ViewUtils.isSerializationFirstNode === 'function' &&
Ember.ViewUtils.isSerializationFirstNode(current.nextSibling)
) {
Ember.ApplicationInstance.reopen({
_bootSync: function(options) {
if (options === undefined) {
options = {
_renderMode: 'rehydrate'
};
}
return this._super(options);
}
});
// Prevent clearRender by removing `fastboot-body-start` which is already
// guarded for
current.parentNode.removeChild(current);
var end = document.getElementById('fastboot-body-end');
if (end) {
end.parentNode.removeChild(end);
}
}
}
})();
| Fix use of Ember global | Fix use of Ember global
Fixes #827
| JavaScript | mit | ember-fastboot/ember-cli-fastboot,ember-fastboot/ember-cli-fastboot | ---
+++
@@ -1,6 +1,7 @@
(function() {
if (typeof FastBoot === 'undefined') {
var current = document.getElementById('fastboot-body-start');
+ var Ember = require('ember').default;
if (
current && |
d3ced289507adb4840c6bfdbb53dc015c864e190 | website/index.js | website/index.js | /* global window */
/* @jsx createElement */
// @flow
// eslint-disable-next-line no-unused-vars
import { createElement } from 'jsx-dom';
import { watch } from '../core';
// $FlowFixMe
import cardInfoHeader from '../assets/tooltip-header-sprite.png';
// $FlowFixMe
import cardInfoBackground from '../assets/tooltip-text-background.png';
// $FlowFixMe
import Gwent from '../assets/fonts/hinted-GWENT-ExtraBold.woff2';
// $FlowFixMe
import HalisGRRegular from '../assets/fonts/hinted-HalisGR-Regular.woff2';
// $FlowFixMe
import HalisGRBold from '../assets/fonts/hinted-HalisGR-Bold.woff2';
// Setup the homepage
async function onLoad() {
// fetch card data
const { cards, dictionary } = await fetchJson('./data.json');
// Start watching the whole body for card names.
watch(
window.document.body,
{
cards,
dictionary,
assets: {
cardInfoHeader,
cardInfoBackground,
Gwent,
HalisGRRegular,
HalisGRBold
}
},
{ shouldUnderline: true }
);
}
async function fetchJson(src: string): Promise<Object> {
const response = await window.fetch(src);
const json = await response.json();
return json;
}
onLoad();
| /* global window */
/* @jsx createElement */
// @flow
// eslint-disable-next-line no-unused-vars
import { createElement } from 'jsx-dom';
import { watch } from '../core';
// $FlowFixMe
import cardInfoHeader from '../assets/tooltip-header-sprite.png';
// $FlowFixMe
import cardInfoBackground from '../assets/tooltip-text-background.png';
// $FlowFixMe
import Gwent from '../assets/fonts/hinted-GWENT-ExtraBold.woff2';
// $FlowFixMe
import HalisGRRegular from '../assets/fonts/hinted-HalisGR-Regular.woff2';
// $FlowFixMe
import HalisGRBold from '../assets/fonts/hinted-HalisGR-Bold.woff2';
// $FlowFixMe importing so that it is copied to the font folder
import '../assets/fonts/hinted-HalisGR-Book.woff2';
// Setup the homepage
async function onLoad() {
// fetch card data
const { cards, dictionary } = await fetchJson('./data.json');
// Start watching the whole body for card names.
watch(
window.document.body,
{
cards,
dictionary,
assets: {
cardInfoHeader,
cardInfoBackground,
Gwent,
HalisGRRegular,
HalisGRBold
}
},
{ shouldUnderline: true }
);
}
async function fetchJson(src: string): Promise<Object> {
const response = await window.fetch(src);
const json = await response.json();
return json;
}
onLoad();
| Fix missing Halis Book font on website | Fix missing Halis Book font on website
| JavaScript | mit | Soreine/hyper-gwent,Soreine/hyper-gwent,Soreine/hyper-gwent | ---
+++
@@ -15,6 +15,8 @@
import HalisGRRegular from '../assets/fonts/hinted-HalisGR-Regular.woff2';
// $FlowFixMe
import HalisGRBold from '../assets/fonts/hinted-HalisGR-Bold.woff2';
+// $FlowFixMe importing so that it is copied to the font folder
+import '../assets/fonts/hinted-HalisGR-Book.woff2';
// Setup the homepage
async function onLoad() { |
84a40d835cb1f4d6abcfd44db26b342a6ba8dbb3 | webpack/build.js | webpack/build.js | const esbuild = require("esbuild");
const isProduction = false;
esbuild.buildSync({
entryPoints: ['./src/platform/current/server/serverStartup.ts'],
bundle: true,
outfile: './build/server/js/bundle2.js',
platform: "node",
sourcemap: true,
minify: false,
define: {
"process.env.NODE_ENV": isProduction ? "\"production\"" : "\"development\"",
"webpackIsServer": true,
},
external: [
"akismet-api", "mongodb", "canvas", "express", "mz", "pg", "pg-promise",
"mathjax", "mathjax-node", "jsdom", "@sentry/node", "node-fetch", "later", "turndown",
"apollo-server", "apollo-server-express", "graphql",
"bcrypt", "node-pre-gyp", "@lesswrong",
],
})
esbuild.buildSync({
entryPoints: ['./src/platform/current/client/clientStartup.ts'],
bundle: true,
target: "es6",
sourcemap: true,
outfile: "./build/client/js/bundle.js",
minify: false,
define: {
"process.env.NODE_ENV": isProduction ? "\"production\"" : "\"development\"",
"webpackIsServer": false,
"global": "window",
},
});
| const esbuild = require("esbuild");
const isProduction = false;
esbuild.buildSync({
entryPoints: ['./src/platform/current/server/serverStartup.ts'],
bundle: true,
outfile: './build/server/js/bundle2.js',
platform: "node",
sourcemap: true,
minify: false,
define: {
"process.env.NODE_ENV": isProduction ? "\"production\"" : "\"development\"",
"webpackIsServer": true,
},
external: [
"akismet-api", "mongodb", "canvas", "express", "mz", "pg", "pg-promise",
"mathjax", "mathjax-node", "mathjax-node-page", "jsdom", "@sentry/node", "node-fetch", "later", "turndown",
"apollo-server", "apollo-server-express", "graphql",
"bcrypt", "node-pre-gyp", "@lesswrong", "intercom-client",
],
})
esbuild.buildSync({
entryPoints: ['./src/platform/current/client/clientStartup.ts'],
bundle: true,
target: "es6",
sourcemap: true,
outfile: "./build/client/js/bundle.js",
minify: false,
define: {
"process.env.NODE_ENV": isProduction ? "\"production\"" : "\"development\"",
"webpackIsServer": false,
"global": "window",
},
});
| Fix crash in intercom on server navigation events | Fix crash in intercom on server navigation events
| JavaScript | mit | Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -15,9 +15,9 @@
},
external: [
"akismet-api", "mongodb", "canvas", "express", "mz", "pg", "pg-promise",
- "mathjax", "mathjax-node", "jsdom", "@sentry/node", "node-fetch", "later", "turndown",
+ "mathjax", "mathjax-node", "mathjax-node-page", "jsdom", "@sentry/node", "node-fetch", "later", "turndown",
"apollo-server", "apollo-server-express", "graphql",
- "bcrypt", "node-pre-gyp", "@lesswrong",
+ "bcrypt", "node-pre-gyp", "@lesswrong", "intercom-client",
],
})
|
f403af1dfbe36cab61e52f7faafe80a6a3e22e24 | statsd/config.js | statsd/config.js | (function() {
return {
port: 8125,
mgmt_port: 8126,
percentThreshold: [ 50, 75, 90, 95, 98, 99, 99.9, 99.99, 99.999],
graphitePort: parseInt(process.env.GRAPHITE_PORT) || 2003,
graphiteHost: process.env.GRAPHITE_HOST || "127.0.0.1",
flushInterval: 10000,
prefixStats: "statsd",
backends: ['./backends/graphite'],
graphite: {
legacyNamespace: false,
prefixCounter: "",
prefixTimer: "",
prefixGauge: "",
prefixSet: ""
},
deleteIdleStats: true,
dumpMessages: true
};
})()
| (function() {
return {
port: 8125,
mgmt_port: 8126,
percentThreshold: [ 50, 75, 90, 95, 98, 99, 99.9, 99.99, 99.999],
graphitePort: parseInt(process.env.GRAPHITE_PORT) || 2003,
graphiteHost: process.env.GRAPHITE_HOST || "127.0.0.1",
flushInterval: 60000,
prefixStats: "statsd",
backends: ['./backends/graphite'],
graphite: {
legacyNamespace: false,
prefixCounter: "",
prefixTimer: "",
prefixGauge: "",
prefixSet: ""
},
deleteIdleStats: true,
dumpMessages: false
};
})()
| Set flush to 60s and disable dumpMessages by default | Set flush to 60s and disable dumpMessages by default
| JavaScript | epl-1.0 | ibm-watson-iot/connector-statsd,ibm-watson-iot/connector-statsd | ---
+++
@@ -7,7 +7,7 @@
graphitePort: parseInt(process.env.GRAPHITE_PORT) || 2003,
graphiteHost: process.env.GRAPHITE_HOST || "127.0.0.1",
- flushInterval: 10000,
+ flushInterval: 60000,
prefixStats: "statsd",
@@ -22,6 +22,6 @@
deleteIdleStats: true,
- dumpMessages: true
+ dumpMessages: false
};
})() |
a169d2ecdb6e7d4457eadfc15f33129847c370ec | app/assets/javascripts/angular/common/models/review-model.js | app/assets/javascripts/angular/common/models/review-model.js | (function(){
'use strict';
angular
.module('secondLead')
.factory('ReviewModel',['Restangular', 'store', function(Restangular, store) {
var currentUser = store.get('user');
return {
getAll: function(dramaID){
return Restangular.one('dramas', dramaID).getList('reviews').$object
},
getOne: function(dramaID, reviewID) {
return Restangular.one('dramas', dramaID).one('reviews', reviewID).get()
}
};
}])
})();
| (function(){
'use strict';
angular
.module('secondLead')
.factory('ReviewModel',['Restangular', 'store', function(Restangular, store) {
var currentUser = store.get('user');
return {
getAll: function(dramaID){
return Restangular.one('dramas', dramaID).getList('reviews').$object
},
getOne: function(dramaID, reviewID) {
return Restangular.one('dramas', dramaID).one('reviews', reviewID).get()
},
create: function(dramaID, userID, review) {
return Restangular.one('dramas', dramaID).getList('reviews').post({drama_id: dramaID, body: review, reviewer_id: userID})
},
update: function(dramaID, reviewID,review){
return Restangular.one('dramas', dramaID).one('reviews', reviewID).put({body: review})
}
};
}])
})();
| Add create and update functions to ang review model | Add create and update functions to ang review model
| JavaScript | mit | ac-adekunle/secondlead,ac-adekunle/secondlead,ac-adekunle/secondlead | ---
+++
@@ -14,6 +14,14 @@
getOne: function(dramaID, reviewID) {
return Restangular.one('dramas', dramaID).one('reviews', reviewID).get()
+ },
+
+ create: function(dramaID, userID, review) {
+ return Restangular.one('dramas', dramaID).getList('reviews').post({drama_id: dramaID, body: review, reviewer_id: userID})
+ },
+
+ update: function(dramaID, reviewID,review){
+ return Restangular.one('dramas', dramaID).one('reviews', reviewID).put({body: review})
}
}; |
c210a34a20955ac96f5d8bc0913f5aa8e2aa6634 | blueprints/ember-cli-mirage/files/app/mirage/factories/contact.js | blueprints/ember-cli-mirage/files/app/mirage/factories/contact.js | /*
This is an example factory definition. Factories are
used inside acceptance tests.
Create more files in this directory to define additional factories.
*/
import Mirage from 'ember-cli-mirage';
export default Mirage.Factory.extend({
name: 'Pete',
age: 20,
email: (i) => `person${i}@test.com`,
admin: function() {
return this.age > 30;
}
});
| /*
This is an example factory definition. Factories are
used inside acceptance tests.
Create more files in this directory to define additional factories.
*/
import Mirage from 'ember-cli-mirage';
export default Mirage.Factory.extend({
// name: 'Pete', // strings
// age: 20, // numbers
// tall: true, // booleans
// email: (i) => `person${i}@test.com`, // and functions
// admin: function() {
// return this.age > 30;
// }
});
| Update blueprint to use comments | Update blueprint to use comments | JavaScript | mit | unchartedcode/ember-cli-mirage,martinmaillard/ember-cli-mirage,PrecisionNutrition/ember-cli-mirage,mixonic/ember-cli-mirage,kategengler/ember-cli-mirage,flexyford/ember-cli-mirage,rubygiulioni/testing-waffle,lazybensch/ember-cli-mirage,andrei1089/ember-cli-mirage,samselikoff/ember-cli-mirage,alecho/ember-cli-mirage,makepanic/ember-cli-mirage,mixonic/ember-cli-mirage,oliverbarnes/ember-cli-mirage,andrei1089/ember-cli-mirage,HeroicEric/ember-cli-mirage,ronco/ember-cli-mirage,IAmJulianAcosta/ember-cli-mirage,flexyford/ember-cli-mirage,cibernox/ember-cli-mirage,samselikoff/ember-cli-mirage,samselikoff/ember-cli-mirage,oliverbarnes/ember-cli-mirage,jamesdixon/ember-cli-mirage,PrecisionNutrition/ember-cli-mirage,alecho/ember-cli-mirage,jamesdixon/ember-cli-mirage,maxcal/ember-cli-mirage,LevelbossMike/ember-cli-mirage,HeroicEric/ember-cli-mirage,escobera/ember-cli-mirage,samselikoff/ember-cli-mirage,cs3b/ember-cli-mirage,jerel/ember-cli-mirage,ibroadfo/ember-cli-mirage,alvinvogelzang/ember-cli-mirage,seawatts/ember-cli-mirage,rubygiulioni/testing-waffle,ronco/ember-cli-mirage,lazybensch/ember-cli-mirage,ballPointPenguin/ember-cli-mirage,blimmer/ember-cli-mirage,mrandre/ember-cli-mirage,kategengler/ember-cli-mirage,jherdman/ember-cli-mirage,martinmaillard/ember-cli-mirage,lependu/ember-cli-mirage,makepanic/ember-cli-mirage,mydea/ember-cli-mirage,mydea/ember-cli-mirage,bantic/ember-cli-mirage,constantm/ember-cli-mirage,unchartedcode/ember-cli-mirage,unchartedcode/ember-cli-mirage,alvinvogelzang/ember-cli-mirage,cibernox/ember-cli-mirage,jherdman/ember-cli-mirage,mfeckie/ember-cli-mirage,bantic/ember-cli-mirage,mfeckie/ember-cli-mirage,lependu/ember-cli-mirage,seawatts/ember-cli-mirage,kagemusha/ember-cli-mirage,escobera/ember-cli-mirage,jerel/ember-cli-mirage,maxcal/ember-cli-mirage,IAmJulianAcosta/ember-cli-mirage,cs3b/ember-cli-mirage,blimmer/ember-cli-mirage,ghedamat/ember-cli-mirage,jherdman/ember-cli-mirage,LevelbossMike/ember-cli-mirage,jherdman/ember-cli-mirage,unchartedcode/ember-cli-mirage,mrandre/ember-cli-mirage,kagemusha/ember-cli-mirage,ibroadfo/ember-cli-mirage,ghedamat/ember-cli-mirage,ballPointPenguin/ember-cli-mirage,constantm/ember-cli-mirage | ---
+++
@@ -7,12 +7,13 @@
import Mirage from 'ember-cli-mirage';
export default Mirage.Factory.extend({
- name: 'Pete',
- age: 20,
+ // name: 'Pete', // strings
+ // age: 20, // numbers
+ // tall: true, // booleans
- email: (i) => `person${i}@test.com`,
+ // email: (i) => `person${i}@test.com`, // and functions
- admin: function() {
- return this.age > 30;
- }
+ // admin: function() {
+ // return this.age > 30;
+ // }
}); |
eb26baf49634cc1547b2a8a9be0befac551c11ac | src/app-webapp/app/components/new-question/new-question.js | src/app-webapp/app/components/new-question/new-question.js | import React from 'react'
class NewQuestion extends React.Component {
render () {
return <div>
<h2>Create a New Question</h2>
</div>
}
}
export default NewQuestion
| import React from 'react'
import {
Form, FormGroup, ControlLabel, FormControl, Col
} from 'react-bootstrap'
import Button from 'react-bootstrap-button-loader'
class NewQuestion extends React.Component {
constructor (props) {
super(props)
this.state = { question: '', answer: '', isLoading: false }
this.handleChange = this.handleChange.bind(this)
this.onSubmit = this.onSubmit.bind(this)
}
render () {
return <div>
<h2>Create a New Question</h2>
<Form horizontal>
<FormGroup>
<Col sm={2} componentClass={ControlLabel}>Question</Col>
<Col sm={10}>
<FormControl
componentClass='textarea'
name='question'
value={this.state.question}
placeholder='Enter your question here...'
onChange={this.handleChange}
/>
</Col>
</FormGroup>
<FormGroup>
<Col sm={2} componentClass={ControlLabel}>Answer</Col>
<Col sm={10}>
<FormControl
type='text'
name='answer'
value={this.state.answer}
placeholder='Enter the correct answer here...'
onChange={this.handleChange}
/>
</Col>
</FormGroup>
<FormGroup>
<Col smOffset={2} sm={10}>
<Button
bsStyle='primary'
bsSize='large'
loading={this.state.isLoading}
disabled={!this.validFormInput()}
onClick={this.onSubmit}
>
Create
</Button>
</Col>
</FormGroup>
</Form>
</div>
}
handleChange (event) {
let target = event.target
this.setState({ [target.name]: target.value })
}
onSubmit () {
this.setState({ isLoading: true })
}
validFormInput () {
return this.state.question !== '' && this.state.answer !== ''
}
}
export default NewQuestion
| Add form for for creating a new question. | Add form for for creating a new question.
| JavaScript | mit | Charterhouse/NextBuild2017,Charterhouse/NextBuild2017,Charterhouse/NextBuild2017 | ---
+++
@@ -1,11 +1,76 @@
import React from 'react'
+import {
+ Form, FormGroup, ControlLabel, FormControl, Col
+} from 'react-bootstrap'
+import Button from 'react-bootstrap-button-loader'
class NewQuestion extends React.Component {
+
+ constructor (props) {
+ super(props)
+ this.state = { question: '', answer: '', isLoading: false }
+ this.handleChange = this.handleChange.bind(this)
+ this.onSubmit = this.onSubmit.bind(this)
+ }
+
render () {
return <div>
<h2>Create a New Question</h2>
+ <Form horizontal>
+ <FormGroup>
+ <Col sm={2} componentClass={ControlLabel}>Question</Col>
+ <Col sm={10}>
+ <FormControl
+ componentClass='textarea'
+ name='question'
+ value={this.state.question}
+ placeholder='Enter your question here...'
+ onChange={this.handleChange}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup>
+ <Col sm={2} componentClass={ControlLabel}>Answer</Col>
+ <Col sm={10}>
+ <FormControl
+ type='text'
+ name='answer'
+ value={this.state.answer}
+ placeholder='Enter the correct answer here...'
+ onChange={this.handleChange}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup>
+ <Col smOffset={2} sm={10}>
+ <Button
+ bsStyle='primary'
+ bsSize='large'
+ loading={this.state.isLoading}
+ disabled={!this.validFormInput()}
+ onClick={this.onSubmit}
+ >
+ Create
+ </Button>
+ </Col>
+ </FormGroup>
+ </Form>
</div>
}
+
+ handleChange (event) {
+ let target = event.target
+ this.setState({ [target.name]: target.value })
+ }
+
+ onSubmit () {
+ this.setState({ isLoading: true })
+ }
+
+ validFormInput () {
+ return this.state.question !== '' && this.state.answer !== ''
+ }
+
}
export default NewQuestion |
5f80a1d7d6737168e211e8e04f70a0baaf2864b5 | app/aptible/torii-provider.js | app/aptible/torii-provider.js | import BaseProvider from "torii/providers/base";
import ajax from "../utils/ajax";
import config from "../config/environment";
export default BaseProvider.extend({
open: function(credentials){
return ajax(config.authBaseUri+'/tokens', {
type: 'POST',
data: credentials
}).catch(function(jqXHR){
if (jqXHR.responseJSON) {
throw new Error(jqXHR.responseJSON.message);
} else if (jqXHR.responseText) {
throw new Error(jqXHR.responseText);
} else {
throw new Error("Unknown error from the server.");
}
});
}
});
| import BaseProvider from "torii/providers/base";
import ajax from "../utils/ajax";
import config from "../config/environment";
export default BaseProvider.extend({
open: function(credentials){
return ajax(config.authBaseUri+'/tokens', {
type: 'POST',
data: credentials,
xhrFields: { withCredentials: true }
}).catch(function(jqXHR){
if (jqXHR.responseJSON) {
throw new Error(jqXHR.responseJSON.message);
} else if (jqXHR.responseText) {
throw new Error(jqXHR.responseText);
} else {
throw new Error("Unknown error from the server.");
}
});
}
});
| Send the cookies with the request | Send the cookies with the request
| JavaScript | mit | blakepettersson/dashboard.aptible.com,blakepettersson/dashboard.aptible.com,aptible/dashboard.aptible.com,aptible/dashboard.aptible.com,aptible/dashboard.aptible.com,blakepettersson/dashboard.aptible.com,chasballew/dashboard.aptible.com,chasballew/dashboard.aptible.com,chasballew/dashboard.aptible.com | ---
+++
@@ -6,7 +6,8 @@
open: function(credentials){
return ajax(config.authBaseUri+'/tokens', {
type: 'POST',
- data: credentials
+ data: credentials,
+ xhrFields: { withCredentials: true }
}).catch(function(jqXHR){
if (jqXHR.responseJSON) {
throw new Error(jqXHR.responseJSON.message); |
7e950ec73d741059adb354a6d65d564a7b27ab5a | scripts/clients/git_diff.js | scripts/clients/git_diff.js | const {
spawn
} = require("child_process");
const gitCommand = "git";
const gitDiff = "diff";
const statOption = "--numstat";
function promisify(child_process) {
return new Promise((resolve, reject) => {
const result = "";
child_process.stdout.on('data', data => {
result.push(data.toString());
});
child_process.on('error', (err) => {
reject(err);
})
child_process.on('close', () => {
resolve(result);
});
});
}
module.exports = {
getDiff: function (commit1, commit2, options) {
const gitProcess = spawn(gitCommand, [gitDiff, statOption, commit1, commit2], {
cwd: options.cwd
});
return promisify(gitProcess);
}
} | const {
spawn
} = require("child_process");
const Promise = require("bluebird").Promise;
const gitCommand = "git";
const gitDiff = "diff";
const statOption = "--numstat";
function promisify(child) {
return new Promise((resolve, reject) => {
let result = "";
child.stdout.on('data', data => {
console.log(data.toString());
result += data;
});
child.stderr.on('data', data => {
console.error(data.toString());
});
child.on('error', (err) => {
reject(err);
});
child.on('exit', () => {
resolve(result);
});
});
}
module.exports = {
getDiff: function (commit1, commit2, options) {
const gitProcess = spawn(gitCommand, [gitDiff, statOption, commit1, commit2], {
// stdio: "inherit",
cwd: options.cwd
});
return promisify(gitProcess);
}
} | Return output from child process git diff | Return output from child process git diff
| JavaScript | mit | ovidiup13/L5-ProjectSource | ---
+++
@@ -1,24 +1,31 @@
const {
spawn
} = require("child_process");
+
+const Promise = require("bluebird").Promise;
const gitCommand = "git";
const gitDiff = "diff";
const statOption = "--numstat";
-function promisify(child_process) {
+function promisify(child) {
return new Promise((resolve, reject) => {
- const result = "";
+ let result = "";
- child_process.stdout.on('data', data => {
- result.push(data.toString());
+ child.stdout.on('data', data => {
+ console.log(data.toString());
+ result += data;
});
- child_process.on('error', (err) => {
+ child.stderr.on('data', data => {
+ console.error(data.toString());
+ });
+
+ child.on('error', (err) => {
reject(err);
- })
+ });
- child_process.on('close', () => {
+ child.on('exit', () => {
resolve(result);
});
});
@@ -28,6 +35,7 @@
getDiff: function (commit1, commit2, options) {
const gitProcess = spawn(gitCommand, [gitDiff, statOption, commit1, commit2], {
+ // stdio: "inherit",
cwd: options.cwd
});
|
2a138502bf320dcf7b25bfb7340aa6ac00d7e8aa | first_controller/script.js | first_controller/script.js | // Code goes here
/*
* Time to display not just simple data, but data from an object.
*/
var MainController = function($scope, $http) {
$scope.message = "Hello, Angular World!";
var whenGetComplete = function(response) {
$scope.person = response.data;
}
var ifErrorResponse = function(reason) {
$scope.error = "Oops! Could not get person."
}
/**
* The function, `$http.get` is asynchronous. It returns a promise. A promise is an object with a `then` method. We
* supply a callback function invoked when the response is returned to our request.
*
* In our situation, the callback function simply sets the `$scope.person` to `response.data`.
*
* If an error occurs, for example because I incorrectly typed the resource, I invoke the error callback,
* `ifErrorResponse`. This function sets `$scope.error` to the error message.
*/
$http.get("https://api.github.com/users/odetocod").then(whenGetComplete, ifErrorResponse);
}
/*
* Aha! I just figured out the purpose of the call to `inject`. AngularJS support dependency injection. Calling the
* `inject` method injects objects (dependencies) into the controller.
*/
MainController.inject = ['$scope', '$http'];
angular.module('first-controller', []).controller('MainController', MainController);
/*
* This controller now works by making simple text, `message`, and a JavaScript object, `person`, available to the
* controller.
*
*/
| // Code goes here
/*
* Time to display not just simple data, but data from an object.
*/
var MainController = function($scope, $http) {
$scope.message = "Hello, Angular World!";
var whenGetComplete = function(response) {
$scope.person = response.data;
}
var ifErrorResponse = function(reason) {
$scope.error = "Oops! Could not get person."
}
/**
* The function, `$http.get` is asynchronous. It returns a promise. A promise is an object with a `then` method. We
* supply a callback function invoked when the response is returned to our request.
*
* In our situation, the callback function simply sets the `$scope.person` to `response.data`.
*
* If an error occurs, for example because I incorrectly typed the resource, I invoke the error callback,
* `ifErrorResponse`. This function sets `$scope.error` to the error message.
*/
$http.get("https://api.github.com/users/odetocode").then(whenGetComplete, ifErrorResponse);
}
/*
* Aha! I just figured out the purpose of the call to `inject`. AngularJS support dependency injection. Calling the
* `inject` method injects objects (dependencies) into the controller.
*/
MainController.inject = ['$scope', '$http'];
angular.module('first-controller', []).controller('MainController', MainController);
/*
* This controller now works by making simple text, `message`, and a JavaScript object, `person`, available to the
* controller.
*
*/
| Correct the GitHub API call; everything works! | Correct the GitHub API call; everything works!
| JavaScript | mit | mrwizard82d1/angular_js_getting_started,mrwizard82d1/angular_js_getting_started | ---
+++
@@ -24,7 +24,7 @@
* If an error occurs, for example because I incorrectly typed the resource, I invoke the error callback,
* `ifErrorResponse`. This function sets `$scope.error` to the error message.
*/
- $http.get("https://api.github.com/users/odetocod").then(whenGetComplete, ifErrorResponse);
+ $http.get("https://api.github.com/users/odetocode").then(whenGetComplete, ifErrorResponse);
}
/* |
07a30d57ac292bbb630a78eb58f4995c702222f2 | test/conversorTest.js | test/conversorTest.js | const chai = require('chai')
const exec = require('child_process').exec
var assert = chai.assert
console.log('Testing the app')
describe('Conversion Params', function () {
// Further code for tests goes here
it('If no params', function (done) {
// Test implementation goes here
exec('currencyconv',
function (err, stdout, stderr) {
assert.isNotNull(err)
done()
})
})
it('If no amount', function (done) {
exec('currencyconv --f=USD --to=EUR --ouput=fulls',
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Amount param should be defined\n')
done()
})
})
})
describe('Conversion Logic', function () {
it('If currency does not exist', function (done) {
exec('currencyconv --f=USDG --to=EURs --ouput=fulls 1',
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Currency no supported or bad spell\n')
done()
})
})
it('If conversion is good', function (done) {
exec('currencyconv --f=USD --to=EUR --ouput=fulls 1',
function (err, stdout, stderr) {
assert.isNull(err)
var result = stdout.split(' ')
assert.isNotNull(result[0])
assert.isNumber(parseInt(result[0]))
done()
})
})
})
| /*
global describe
global it
*/
const chai = require('chai')
const exec = require('child_process').exec
const path = require('path')
var assert = chai.assert
console.log('Testing the app')
var cmd = 'node ' + path.join(__dirname, '../index.js') + ' '
describe('Conversion Params', function () {
// Further code for tests goes here
it('If no params', function (done) {
// Test implementation goes here
exec(`${cmd}`,
function (err, stdout, stderr) {
assert.isNotNull(err)
done()
})
})
it('If no amount', function (done) {
exec(`${cmd} --f=USD --to=EUR --ouput=fulls`,
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Amount param should be defined\n')
done()
})
})
})
describe('Conversion Logic', function () {
it('If currency does not exist', function (done) {
exec(`${cmd} --f=USDG --to=EURs --ouput=fulls 1`,
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Currency no supported or bad spell\n')
done()
})
})
it('If conversion is good', function (done) {
exec(`${cmd} --f=USD --to=EUR --ouput=fulls 1`,
function (err, stdout, stderr) {
assert.isNull(err)
var result = stdout.split(' ')
assert.isNotNull(result[0])
assert.isNumber(parseInt(result[0]))
done()
})
})
})
| Change the way the test works with the command | Change the way the test works with the command
| JavaScript | mit | duvanmonsa/currency_conversor_cli | ---
+++
@@ -1,15 +1,25 @@
+/*
+ global describe
+ global it
+ */
+
const chai = require('chai')
const exec = require('child_process').exec
+const path = require('path')
var assert = chai.assert
console.log('Testing the app')
+var cmd = 'node ' + path.join(__dirname, '../index.js') + ' '
+
describe('Conversion Params', function () {
// Further code for tests goes here
it('If no params', function (done) {
// Test implementation goes here
- exec('currencyconv',
+
+
+ exec(`${cmd}`,
function (err, stdout, stderr) {
assert.isNotNull(err)
done()
@@ -17,7 +27,7 @@
})
it('If no amount', function (done) {
- exec('currencyconv --f=USD --to=EUR --ouput=fulls',
+ exec(`${cmd} --f=USD --to=EUR --ouput=fulls`,
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Amount param should be defined\n')
@@ -28,7 +38,7 @@
describe('Conversion Logic', function () {
it('If currency does not exist', function (done) {
- exec('currencyconv --f=USDG --to=EURs --ouput=fulls 1',
+ exec(`${cmd} --f=USDG --to=EURs --ouput=fulls 1`,
function (err, stdout, stderr) {
assert.isNull(err)
assert.strictEqual(stdout, 'Currency no supported or bad spell\n')
@@ -37,7 +47,7 @@
})
it('If conversion is good', function (done) {
- exec('currencyconv --f=USD --to=EUR --ouput=fulls 1',
+ exec(`${cmd} --f=USD --to=EUR --ouput=fulls 1`,
function (err, stdout, stderr) {
assert.isNull(err)
var result = stdout.split(' ') |
f5822d9e9fd386b46194fd719e6b4b6f8dfcec42 | test/lib/dashycode.js | test/lib/dashycode.js | 'use strict';
const assert = require('assert');
const Dashycode = require('./../../.lib-dist/dashycode');
describe('Dashycode', function () {
// Technically we should be testing for values up to 0x10FFFF, but we will
// never see any above 0xFFFF because of how SockJS works.
const codepoints = Array.from({length: 0x10000}, (v, k) => k);
const encoded = new Map();
const encode = (codepoint, allowCaps) => {
const character = String.fromCodePoint(codepoint);
const dashycode = Dashycode.encode(character);
assert.strictEqual(encoded.has(dashycode), false);
encoded.set(dashycode, character);
};
const decode = (dashycode) => {
const character = Dashycode.decode(dashycode);
assert.strictEqual(encoded.get(dashycode), character);
};
it('should encode all codepoints uniquely', function () {
return codepoints.reduce((p, codepoint) => (
p.then(v => encode(codepoint))
), Promise.resolve());
});
it('should decode all codepoints accurately', function () {
return [...encoded.keys()].reduce((p, dashycode) => (
p.then(v => decode(dashycode))
), Promise.resolve());
});
after(function () {
encoded.clear();
});
});
| 'use strict';
const assert = require('assert');
const Dashycode = require('./../../.lib-dist/dashycode');
describe('Dashycode', function () {
// Technically we should be testing for values up to 0x10FFFF, but we will
// never see any above 0xFFFF because of how SockJS works.
const codepoints = Array.from({length: 0x10000}, (v, k) => k);
const encoded = new Map();
const encode = (codepoint) => {
const character = String.fromCodePoint(codepoint);
const dashycode = Dashycode.encode(character);
assert.strictEqual(encoded.has(dashycode), false);
encoded.set(dashycode, character);
};
const decode = (dashycode) => {
const character = Dashycode.decode(dashycode);
assert.strictEqual(encoded.get(dashycode), character);
};
it('should encode all codepoints uniquely', function () {
return codepoints.reduce((p, codepoint) => (
p.then(v => encode(codepoint))
), Promise.resolve());
});
it('should decode all codepoints accurately', function () {
return [...encoded.keys()].reduce((p, dashycode) => (
p.then(v => decode(dashycode))
), Promise.resolve());
});
after(function () {
encoded.clear();
});
});
| Remove unused parameter from function in Dashycode's unit tests | Remove unused parameter from function in Dashycode's unit tests
| JavaScript | mit | sirDonovan/Pokemon-Showdown,sirDonovan/Pokemon-Showdown,svivian/Pokemon-Showdown,QuiteQuiet/Pokemon-Showdown,xfix/Pokemon-Showdown,urkerab/Pokemon-Showdown,panpawn/Gold-Server,Zarel/Pokemon-Showdown,urkerab/Pokemon-Showdown,jumbowhales/Pokemon-Showdown,Enigami/Pokemon-Showdown,Zarel/Pokemon-Showdown,Zarel/Pokemon-Showdown,xfix/Pokemon-Showdown,panpawn/Gold-Server,xfix/Pokemon-Showdown,urkerab/Pokemon-Showdown,sirDonovan/Pokemon-Showdown,jumbowhales/Pokemon-Showdown,QuiteQuiet/Pokemon-Showdown,svivian/Pokemon-Showdown,panpawn/Gold-Server,svivian/Pokemon-Showdown,xfix/Pokemon-Showdown,svivian/Pokemon-Showdown,AustinXII/Pokemon-Showdown,Enigami/Pokemon-Showdown,AustinXII/Pokemon-Showdown,Enigami/Pokemon-Showdown,Enigami/Pokemon-Showdown,jumbowhales/Pokemon-Showdown,QuiteQuiet/Pokemon-Showdown,svivian/Pokemon-Showdown,xfix/Pokemon-Showdown,AustinXII/Pokemon-Showdown | ---
+++
@@ -9,7 +9,7 @@
const codepoints = Array.from({length: 0x10000}, (v, k) => k);
const encoded = new Map();
- const encode = (codepoint, allowCaps) => {
+ const encode = (codepoint) => {
const character = String.fromCodePoint(codepoint);
const dashycode = Dashycode.encode(character);
assert.strictEqual(encoded.has(dashycode), false); |
3223750e3abc0b941331c960b6c3afa027ef31dc | find-core/src/main/public/static/js/find/app/page/search/results/query-strategy.js | find-core/src/main/public/static/js/find/app/page/search/results/query-strategy.js | /*
* Copyright 2015 Hewlett-Packard Development Company, L.P.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
*/
define([], function () {
"use strict";
function displayPromotions() {
return true;
}
function requestParams(queryModel, infiniteScroll) {
return {
text: queryModel.get('queryText'),
auto_correct: infiniteScroll ? false : queryModel.get('autoCorrect')
};
}
function validateQuery(queryModel) {
return queryModel.get('queryText');
}
function waitForIndexes(queryModel) {
return _.isEmpty(queryModel.get('indexes'));
}
return {
colourboxGrouping: 'results',
displayPromotions: displayPromotions,
requestParams: requestParams,
validateQuery: validateQuery,
waitForIndexes: waitForIndexes
}
}); | /*
* Copyright 2015 Hewlett-Packard Development Company, L.P.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
*/
define([], function () {
"use strict";
function displayPromotions() {
return true;
}
function requestParams(queryModel, infiniteScroll) {
return {
text: queryModel.get('queryText'),
auto_correct: false
};
}
function validateQuery(queryModel) {
return queryModel.get('queryText');
}
function waitForIndexes(queryModel) {
return _.isEmpty(queryModel.get('indexes'));
}
return {
colourboxGrouping: 'results',
displayPromotions: displayPromotions,
requestParams: requestParams,
validateQuery: validateQuery,
waitForIndexes: waitForIndexes
}
}); | Disable spellcheck/auto correct as there are platform issues with it | Disable spellcheck/auto correct as there are platform issues with it
| JavaScript | mit | LinkPowerHK/find,hpe-idol/find,LinkPowerHK/find,LinkPowerHK/find,hpe-idol/java-powerpoint-report,hpautonomy/find,hpautonomy/find,LinkPowerHK/find,hpautonomy/find,hpautonomy/find,hpe-idol/java-powerpoint-report,hpe-idol/find,hpe-idol/find,LinkPowerHK/find,hpe-idol/find,hpe-idol/find,hpautonomy/find | ---
+++
@@ -13,7 +13,7 @@
function requestParams(queryModel, infiniteScroll) {
return {
text: queryModel.get('queryText'),
- auto_correct: infiniteScroll ? false : queryModel.get('autoCorrect')
+ auto_correct: false
};
}
|
bc077131bfdef8a35e54bdb61089914d376fdc59 | src/middleware.js | src/middleware.js | class Middleware {
constructor() {
}
before(event) {
}
after(event) {
}
}
module.exports = Middleware | class Middleware {
constructor() {
}
before(event) {
return event
}
after(event) {
return event
}
}
module.exports = Middleware | Make sure stub methods return event. | Make sure stub methods return event.
| JavaScript | mit | surebot/Eventline,surebot/Eventline | ---
+++
@@ -4,11 +4,11 @@
}
before(event) {
-
+ return event
}
after(event) {
-
+ return event
}
}
|
7050035874fdd5d42d5e74617011201f9595065d | native/components/thread-visibility.react.js | native/components/thread-visibility.react.js | // @flow
import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { threadTypes, type ThreadType } from 'lib/types/thread-types';
type Props = {|
+threadType: ThreadType,
+color: string,
|};
function ThreadVisibility(props: Props) {
const { threadType, color } = props;
const visLabelStyle = [styles.visibilityLabel, { color }];
if (threadType === threadTypes.CHAT_SECRET) {
return (
<View style={styles.container}>
<Icon name="lock-outline" size={18} color={color} />
<Text style={visLabelStyle}>Secret</Text>
</View>
);
} else if (threadType === threadTypes.PRIVATE) {
return (
<View style={styles.container}>
<Icon name="person" size={18} color={color} />
<Text style={visLabelStyle}>Private</Text>
</View>
);
} else {
return (
<View style={styles.container}>
<Icon name="public" size={18} color={color} />
<Text style={visLabelStyle}>Open</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
},
visibilityLabel: {
fontSize: 16,
fontWeight: 'bold',
paddingLeft: 4,
},
});
export default ThreadVisibility;
| // @flow
import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { threadTypes, type ThreadType } from 'lib/types/thread-types';
import ThreadIcon from './thread-icon.react';
type Props = {|
+threadType: ThreadType,
+color: string,
|};
function ThreadVisibility(props: Props) {
const { threadType, color } = props;
const visLabelStyle = [styles.visibilityLabel, { color }];
let label;
if (threadType === threadTypes.CHAT_SECRET) {
label = 'Secret';
} else if (threadType === threadTypes.PRIVATE) {
label = 'Private';
} else {
label = 'Open';
}
return (
<View style={styles.container}>
<ThreadIcon threadType={threadType} color={color} />
<Text style={visLabelStyle}>{label}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flexDirection: 'row',
},
visibilityLabel: {
fontSize: 16,
fontWeight: 'bold',
paddingLeft: 4,
},
});
export default ThreadVisibility;
| Make thread-visiblity icon use thread-icon | Make thread-visiblity icon use thread-icon
Summary: Made it so thread-visiblity uses thread-icon.react.js instead of its own icon.
Test Plan: Checked in thread settings to see if icon still worked. Also checked private threads before and after updates to make sure they still work. And also made sure normal threads still work
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D626
| JavaScript | bsd-3-clause | Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal | ---
+++
@@ -2,9 +2,10 @@
import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';
-import Icon from 'react-native-vector-icons/MaterialIcons';
import { threadTypes, type ThreadType } from 'lib/types/thread-types';
+
+import ThreadIcon from './thread-icon.react';
type Props = {|
+threadType: ThreadType,
@@ -13,28 +14,22 @@
function ThreadVisibility(props: Props) {
const { threadType, color } = props;
const visLabelStyle = [styles.visibilityLabel, { color }];
+
+ let label;
if (threadType === threadTypes.CHAT_SECRET) {
- return (
- <View style={styles.container}>
- <Icon name="lock-outline" size={18} color={color} />
- <Text style={visLabelStyle}>Secret</Text>
- </View>
- );
+ label = 'Secret';
} else if (threadType === threadTypes.PRIVATE) {
- return (
- <View style={styles.container}>
- <Icon name="person" size={18} color={color} />
- <Text style={visLabelStyle}>Private</Text>
- </View>
- );
+ label = 'Private';
} else {
- return (
- <View style={styles.container}>
- <Icon name="public" size={18} color={color} />
- <Text style={visLabelStyle}>Open</Text>
- </View>
- );
+ label = 'Open';
}
+
+ return (
+ <View style={styles.container}>
+ <ThreadIcon threadType={threadType} color={color} />
+ <Text style={visLabelStyle}>{label}</Text>
+ </View>
+ );
}
const styles = StyleSheet.create({ |
b4181ef46197cdaf830014e57f42d97efdebec92 | src/components/FormViewerContainer.js | src/components/FormViewerContainer.js | import {
connect
} from "react-redux";
import FormViewer from "./FormViewer";
const mapStateToProps = (state) => {
const points = state.waterlines.filter((offset) => {
return offset && offset.x != undefined && offset.y != undefined;
});
points.push(...state.buttocks.filter((offset) => {
return offset && offset.x !== undefined && offset.y != undefined;
}));
return {
points: points
};
},
mapDispatchToProps = (dispatch) => {
return {};
};
export default connect(mapStateToProps, mapDispatchToProps)(FormViewer); | import {
connect
} from "react-redux";
import FormViewer from "./FormViewer";
const mapStateToProps = (state) => {
const points = state.waterlines.filter((offset) => {
return offset && offset.x !== undefined && offset.y !== undefined;
});
points.push(...state.buttocks.filter((offset) => {
return offset && offset.x !== undefined && offset.y !== undefined;
}));
points.sort((a, b) => {
if (a.order < b.order) {
return -1;
}
if (a.order > b.order) {
return 1;
}
// a must be equal to b
return 0;
});
return {
points: points
};
},
mapDispatchToProps = (dispatch) => {
return {};
};
export default connect(mapStateToProps, mapDispatchToProps)(FormViewer); | Sort points based on order, waterlines and buttocks fully integrated now | Sort points based on order, waterlines and buttocks fully integrated now
| JavaScript | apache-2.0 | sel129/lofter,sel129/lofter | ---
+++
@@ -5,12 +5,23 @@
const mapStateToProps = (state) => {
const points = state.waterlines.filter((offset) => {
- return offset && offset.x != undefined && offset.y != undefined;
+ return offset && offset.x !== undefined && offset.y !== undefined;
});
points.push(...state.buttocks.filter((offset) => {
- return offset && offset.x !== undefined && offset.y != undefined;
+ return offset && offset.x !== undefined && offset.y !== undefined;
}));
+
+ points.sort((a, b) => {
+ if (a.order < b.order) {
+ return -1;
+ }
+ if (a.order > b.order) {
+ return 1;
+ }
+ // a must be equal to b
+ return 0;
+ });
return {
points: points |
dc51280c20545b07c9dc7bb0cd11dd60384e9b79 | test/exceptions/minified_code.spec.js | test/exceptions/minified_code.spec.js | var context = require('../../src/exceptions/context')
describe("Minified code detection", function() {
it("Empty source returns false", function() {
expect(context.isSourceMinified('')).toBe(false)
})
it("Minified JS Bundle returns true", function() {
var source = require('./data/bundle.js')
expect(context.isSourceMinified(source)).toBe(true)
})
})
| var context = require('../../src/exceptions/context')
describe("isSourceMinified", function() {
it("Empty source returns false", function() {
expect(context.isSourceMinified('')).toBe(false)
})
it("Minified JS Bundle returns true", function() {
var source = require('./data/bundle.js')
expect(context.isSourceMinified(source)).toBe(true)
})
})
| Add tests of minified code detection logic | Add tests of minified code detection logic
| JavaScript | mit | opbeat/opbeat-angular,opbeat/opbeat-react,opbeat/opbeat-angular,jahtalab/opbeat-js,opbeat/opbeat-angular,opbeat/opbeat-react,opbeat/opbeat-react,opbeat/opbeat-js-core,opbeat/opbeat-js-core,jahtalab/opbeat-js,jahtalab/opbeat-js | ---
+++
@@ -1,6 +1,6 @@
var context = require('../../src/exceptions/context')
-describe("Minified code detection", function() {
+describe("isSourceMinified", function() {
it("Empty source returns false", function() {
expect(context.isSourceMinified('')).toBe(false) |
ee7042ed28b7e15087543b59609e74276bf5befa | nodejs_projects/basic_nodejs_samples/read.js | nodejs_projects/basic_nodejs_samples/read.js | logMessage("Script Begins!");
var Galileo = require("galileo-io");
var board = new Galileo();
var previousData = 0;
logMessage("Setting Ready event for the Galileo Board");
board.on("ready", galileoReadyHandler);
logMessage("Root Execution Complete!");
/*
* Contains the logic for when the Galileo Board is Ready
* @returns {undefined}
*/
function galileoReadyHandler() {
/***
* This line sets a Digital Read event handler. Every time the Galileo Board completes a read operation
* it will call the readHandler function to process it.
**/
logMessage("Galileo Ready Handler Begins! - Setting a Digital Read Handler...");
board.digitalRead(10, readHandler);
logMessage("Galileo Ready Handler Complete!");
}
/***
* Receives DATA from a read event and uses it.
* @param data
* @returns {undefined}
*/
function readHandler(data) {
logMessage("Read Handler Begins!");
if (previousData !== data) {
logMessage("Data Changed!");
previousData = data;
logMessage("New Data: " + data);
}
}
/***
* Logs messages into the console including a milliseconds timestamp
* @param {type} message
* @returns {undefined}
*/
function logMessage(message) {
var d = new Date().getTime();
console.log(d + " - " + message);
} | logMessage("Script Begins!");
var Galileo = require("galileo-io");
var board = new Galileo();
var previousData = 0;
logMessage("Setting Ready event for the Galileo Board");
board.on("ready", galileoReadyHandler);
logMessage("Root Execution Complete!");
/*
* Contains the logic for when the Galileo Board is Ready
* @returns {undefined}
*/
function galileoReadyHandler() {
/***
* This line sets a Digital Read event handler. Every time the Galileo Board completes a read operation
* it will call the readHandler function to process it.
**/
logMessage("Galileo Ready Handler Begins! - Setting a Digital Read Handler...");
board.digitalRead(10, readHandler);
logMessage("Galileo Ready Handler Complete!");
}
/***
* Receives DATA from a read event and uses it.
* @param data
* @returns {undefined}
*/
var readtimes = 0;
function readHandler(data) {
if (readtimes<5) {
readtimes++;
logMessage("Read Handler Begins!");
}
if (previousData !== data) {
logMessage("Data Changed!");
previousData = data;
logMessage("New Data: " + data);
}
if (readtimes<5) {
logMessage("Read Handler END!");
}
}
/***
* Logs messages into the console including a milliseconds timestamp
* @param {type} message
* @returns {undefined}
*/
function logMessage(message) {
var d = new Date().getTime();
console.log(d + " - " + message);
} | Tidy code for basic examples on NodeJS | Tidy code for basic examples on NodeJS | JavaScript | mit | janunezc/GALILEO,janunezc/GALILEO,janunezc/GALILEO | ---
+++
@@ -26,13 +26,21 @@
* @param data
* @returns {undefined}
*/
+var readtimes = 0;
function readHandler(data) {
- logMessage("Read Handler Begins!");
+
+ if (readtimes<5) {
+ readtimes++;
+ logMessage("Read Handler Begins!");
+ }
if (previousData !== data) {
logMessage("Data Changed!");
previousData = data;
logMessage("New Data: " + data);
}
+ if (readtimes<5) {
+ logMessage("Read Handler END!");
+ }
}
/*** |
5897c870fa46c8844c3f0bc92d8888377eb0f2ce | ui/src/registrator/PrihlaskyDohlasky/Input/InputActions.js | ui/src/registrator/PrihlaskyDohlasky/Input/InputActions.js | // eslint-disable-next-line import/prefer-default-export
export const createInputChanged = actionPrefix => (name, event) => ({
type: `${actionPrefix}_INPUT_CHANGED`,
name,
id: event.target.id,
startovne: event.target.nonce,
value: event.target.type === 'checkbox' ? event.target.checked : event.target.value
});
| // eslint-disable-next-line import/prefer-default-export
export const createInputChanged = actionPrefix => (name, event) => {
const action = {
type: `${actionPrefix}_INPUT_CHANGED`,
name,
id: event.target.id,
value: event.target.type === 'checkbox' ? event.target.checked : event.target.value
};
if (event.target.nonce) {
const startovne = parseInt(event.target.nonce, 10);
if (!Number.isNaN(startovne)) {
action.startovne = startovne;
}
}
return action;
};
| Convert startovne to a number. | Convert startovne to a number.
| JavaScript | mit | ivosh/jcm2018,ivosh/jcm2018,ivosh/jcm2018 | ---
+++
@@ -1,8 +1,18 @@
// eslint-disable-next-line import/prefer-default-export
-export const createInputChanged = actionPrefix => (name, event) => ({
- type: `${actionPrefix}_INPUT_CHANGED`,
- name,
- id: event.target.id,
- startovne: event.target.nonce,
- value: event.target.type === 'checkbox' ? event.target.checked : event.target.value
-});
+export const createInputChanged = actionPrefix => (name, event) => {
+ const action = {
+ type: `${actionPrefix}_INPUT_CHANGED`,
+ name,
+ id: event.target.id,
+ value: event.target.type === 'checkbox' ? event.target.checked : event.target.value
+ };
+
+ if (event.target.nonce) {
+ const startovne = parseInt(event.target.nonce, 10);
+ if (!Number.isNaN(startovne)) {
+ action.startovne = startovne;
+ }
+ }
+
+ return action;
+}; |
47048495b692d66fdd3ef3c7e472705e455ddd29 | frontend/src/core/Store.js | frontend/src/core/Store.js | import {createStore, compose, applyMiddleware} from 'redux';
import {devTools, persistState} from 'redux-devtools';
import thunkMiddleware from 'redux-thunk';
import travelApp from 'reducers/Reducers.js';
const enhancedCreateStore = compose(
applyMiddleware(
thunkMiddleware),
devTools(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(createStore);
export default enhancedCreateStore(travelApp);
| import {createStore, compose, applyMiddleware} from 'redux';
import {devTools, persistState} from 'redux-devtools';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger';
import travelApp from 'reducers/Reducers.js';
const logger = createLogger();
const enhancedCreateStore = compose(
applyMiddleware(
logger,
thunkMiddleware),
devTools(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(createStore);
export default enhancedCreateStore(travelApp);
| Apply the logger as middleware | Apply the logger as middleware
| JavaScript | agpl-3.0 | jilljenn/voyageavecmoi,jilljenn/voyageavecmoi,jilljenn/voyageavecmoi | ---
+++
@@ -1,10 +1,14 @@
import {createStore, compose, applyMiddleware} from 'redux';
import {devTools, persistState} from 'redux-devtools';
import thunkMiddleware from 'redux-thunk';
+import createLogger from 'redux-logger';
import travelApp from 'reducers/Reducers.js';
+
+const logger = createLogger();
const enhancedCreateStore = compose(
applyMiddleware(
+ logger,
thunkMiddleware),
devTools(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) |
25519614f435bc1f0e277e823fe17ffd9a89f240 | app/boxoffice.block/boxoffice.block.js | app/boxoffice.block/boxoffice.block.js | 'use strict';
angular.module('ticketbox.boxoffice.block', [
'ngRoute',
'ticketbox.config',
'ticketbox.components.api',
'ticketbox.common.seatplan.handlers',
'ticketbox.components.seatplan',
'ticketbox.components.reserver',
'ticketbox.boxoffice.toolbar'])
.config(function($routeProvider) {
$routeProvider.when('/block/:blockId', {
controller: 'BlockCtrl',
templateUrl: 'boxoffice.block/boxoffice.block.html'
});
})
.controller('BlockCtrl', function($scope, $routeParams, $location, Eventblock, reserver, maxNumberOfUnspecifiedSeats) {
$scope.block = Eventblock.get({ 'id': $routeParams.blockId });
$scope.selectableNumbersOfUnspecifiedSeats = _.range(1, maxNumberOfUnspecifiedSeats + 1);
$scope.data = {
numberOfSeats: 0
};
$scope.reserveMultiple = function(block, numberOfSeats) {
reserver.reserveMultiple(block.id, numberOfSeats)
.then(function() {
$scope.data.numberOfSeats = undefined;
});
}
}); | 'use strict';
angular.module('ticketbox.boxoffice.block', [
'ngRoute',
'ticketbox.config',
'ticketbox.components.api',
'ticketbox.common.seatplan.handlers',
'ticketbox.components.seatplan',
'ticketbox.components.reserver',
'ticketbox.boxoffice.toolbar'])
.config(function($routeProvider) {
$routeProvider.when('/block/:blockId', {
controller: 'BlockCtrl',
templateUrl: 'boxoffice.block/boxoffice.block.html'
});
})
.controller('BlockCtrl', function($scope, $routeParams, $location, Eventblock, reserver, maxNumberOfUnspecifiedSeats) {
$scope.block = Eventblock.get({ 'id': $routeParams.blockId });
$scope.selectableNumbersOfUnspecifiedSeats = _.range(1, maxNumberOfUnspecifiedSeats + 1);
$scope.data = {
numberOfSeats: 0
};
$scope.reserveMultiple = function(block, numberOfSeats) {
reserver.reserveMultiple(block.id, numberOfSeats)
.then(function() {
$scope.data.numberOfSeats = 0;
});
}
}); | Set back number of seats when unspecified seats are reserved | Set back number of seats when unspecified seats are reserved
| JavaScript | mit | ssigg/ticketbox-client-angularjs,ssigg/ticketbox-client-angularjs | ---
+++
@@ -27,7 +27,7 @@
$scope.reserveMultiple = function(block, numberOfSeats) {
reserver.reserveMultiple(block.id, numberOfSeats)
.then(function() {
- $scope.data.numberOfSeats = undefined;
+ $scope.data.numberOfSeats = 0;
});
}
}); |
79885e0a2710b2be0bad18c2fac206e129cbdbf6 | get-flashplayer-program.js | get-flashplayer-program.js | var inspect = require("util").inspect
var path = require("path")
module.exports = function (callback) {
try_in_order([
function (callback) {
if (process.env.RUN_SWF_VERBOSE) {
console.warn("run-swf: looking for $FLASHPLAYER...")
}
if (process.env.FLASHPLAYER) {
get_program(process.env.FLASHPLAYER, callback)
} else {
callback(null)
}
},
function (callback) {
get_osx_app_program("Flash Player Debugger", callback)
},
function (callback) {
get_osx_app_program("Flash Player", callback)
}
], callback)
function get_osx_app_program(name, callback) {
get_program(
"/Applications/" + name + ".app/Contents/MacOS/" + name,
callback
)
}
function get_program(filename, callback) {
if (process.env.RUN_SWF_VERBOSE) {
console.warn("run-swf: looking for %s...", inspect(filename))
}
path.exists(filename, function (exists) {
callback(exists ? filename : null)
})
}
}
function try_in_order(functions, callback) {
functions = [].slice.call(functions)
;(function loop () {
if (functions.length === 0) {
callback(null)
} else {
functions.shift()(function (program) {
if (program) {
callback(program)
} else {
loop()
}
})
}
})()
}
| var inspect = require("util").inspect
var fs = require("fs")
module.exports = function (callback) {
try_in_order([
function (callback) {
if (process.env.RUN_SWF_VERBOSE) {
console.warn("run-swf: looking for $FLASHPLAYER...")
}
if (process.env.FLASHPLAYER) {
get_program(process.env.FLASHPLAYER, callback)
} else {
callback(null)
}
},
function (callback) {
get_osx_app_program("Flash Player Debugger", callback)
},
function (callback) {
get_osx_app_program("Flash Player", callback)
}
], callback)
function get_osx_app_program(name, callback) {
get_program(
"/Applications/" + name + ".app/Contents/MacOS/" + name,
callback
)
}
function get_program(filename, callback) {
if (process.env.RUN_SWF_VERBOSE) {
console.warn("run-swf: looking for %s...", inspect(filename))
}
fs.exists(filename, function (exists) {
callback(exists ? filename : null)
})
}
}
function try_in_order(functions, callback) {
functions = [].slice.call(functions)
;(function loop () {
if (functions.length === 0) {
callback(null)
} else {
functions.shift()(function (program) {
if (program) {
callback(program)
} else {
loop()
}
})
}
})()
}
| Use fs.exists instead of path.exists | Use fs.exists instead of path.exists
| JavaScript | mit | dbrock/stdio.as,dbrock/stdio.as,dbrock/stdio.as | ---
+++
@@ -1,5 +1,5 @@
var inspect = require("util").inspect
-var path = require("path")
+var fs = require("fs")
module.exports = function (callback) {
try_in_order([
@@ -34,7 +34,7 @@
console.warn("run-swf: looking for %s...", inspect(filename))
}
- path.exists(filename, function (exists) {
+ fs.exists(filename, function (exists) {
callback(exists ? filename : null)
})
} |
475b9aa8146e6e4307c0fac0df76e3810c4eb9d3 | tests/unit/utils/round-number-test.js | tests/unit/utils/round-number-test.js | import roundNumber from 'dummy/utils/round-number';
import { module, test } from 'qunit';
module('Unit | Utility | round number');
test('it rounds a number to two decimal places by default', function(assert) {
let result = roundNumber(123.123);
assert.equal(result, 123.12);
});
test('it rounds a number to a configurable number of decimal places', function(assert) {
let result = roundNumber(123.123123, 1);
assert.equal(result, 123.1);
});
test('it returns undefined when nothing provided', function(assert) {
let result = roundNumber();
assert.equal(result, undefined);
});
test('it parses a String number', function(assert) {
let result = roundNumber('34.3333');
assert.equal(result, 34.33);
});
test('it returns undefined when provided a string that is not a number', function(assert) {
let result = roundNumber('boogers');
assert.equal(result, undefined);
});
| import roundNumber from 'dummy/utils/round-number';
import { module, test } from 'qunit';
module('Unit | Utility | round number');
test('it rounds a number to two decimal places by default', function(assert) {
let result = roundNumber(123.123);
assert.equal(result, 123.12);
});
test('it rounds a number to a configurable number of decimal places', function(assert) {
let result = roundNumber(123.123123, 1);
assert.equal(result, 123.1);
});
test('it rounds a number to a whole number if precision is 0', function(assert) {
let result = roundNumber(123.123123, 0);
assert.equal(result, 123);
});
test('it returns undefined when nothing provided', function(assert) {
let result = roundNumber();
assert.equal(result, undefined);
});
test('it parses a String number', function(assert) {
let result = roundNumber('34.3333');
assert.equal(result, 34.33);
});
test('it returns undefined when provided a string that is not a number', function(assert) {
let result = roundNumber('boogers');
assert.equal(result, undefined);
});
| Add Unit Test For precision=0 | Add Unit Test For precision=0
| JavaScript | mit | PrecisionNutrition/unit-utils,PrecisionNutrition/unit-utils | ---
+++
@@ -11,6 +11,11 @@
test('it rounds a number to a configurable number of decimal places', function(assert) {
let result = roundNumber(123.123123, 1);
assert.equal(result, 123.1);
+});
+
+test('it rounds a number to a whole number if precision is 0', function(assert) {
+ let result = roundNumber(123.123123, 0);
+ assert.equal(result, 123);
});
test('it returns undefined when nothing provided', function(assert) { |
09a038dde6ea453fafad4899c43746e461c24a40 | test/index.js | test/index.js | var assert = require('chai').assert;
var StorageService = require('../');
var AmazonStorage = StorageService.AmazonStorage;
describe('Factory Method', function () {
it('Should properly export', function () {
assert.isObject(StorageService);
assert.isFunction(StorageService.create);
assert.isFunction(StorageService.AmazonStorage);
});
it('Should properly create storage instances', function () {
assert.instanceOf(StorageService.create('amazon'), AmazonStorage);
});
});
| var assert = require('chai').assert;
var StorageService = require('../');
var AmazonStorage = StorageService.AmazonStorage;
describe('Factory Method', function () {
it('Should properly export', function () {
assert.isObject(StorageService);
assert.isFunction(StorageService.create);
assert.isFunction(StorageService.AmazonStorage);
});
it('Should properly create storage instances', function () {
assert.instanceOf(StorageService.create('amazon'), AmazonStorage);
});
it('Should properly throw error on unrecognized type', function () {
assert.throws(function () {
StorageService.create('NOT_EXISTS');
}, Error);
});
});
| Improve test coverage for StorageService | Improve test coverage for StorageService
| JavaScript | mit | ghaiklor/sails-service-storage | ---
+++
@@ -12,4 +12,10 @@
it('Should properly create storage instances', function () {
assert.instanceOf(StorageService.create('amazon'), AmazonStorage);
});
+
+ it('Should properly throw error on unrecognized type', function () {
+ assert.throws(function () {
+ StorageService.create('NOT_EXISTS');
+ }, Error);
+ });
}); |
fe00fb8e58535abb1818bcbe3dfb4a780c4d8558 | providers/latest-provider/index.js | providers/latest-provider/index.js | import { useEffect, useMemo } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import reducerRegistry from 'redux/registry';
import * as actions from './actions';
import { getLatestProps } from './selectors';
import reducers, { initialState } from './reducers';
const LatestProvider = ({ latestEndpoints, getLatest }) => {
const endpoint = useMemo(() => {
return latestEndpoints;
}, [latestEndpoints]);
useEffect(() => {
getLatest(endpoint);
}, [endpoint]);
return null;
};
LatestProvider.propTypes = {
getLatest: PropTypes.func.isRequired,
latestEndpoints: PropTypes.array,
};
reducerRegistry.registerModule('latest', {
actions,
reducers,
initialState,
});
export default connect(getLatestProps, actions)(LatestProvider);
| import { PureComponent } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import reducerRegistry from 'redux/registry';
import isEqual from 'lodash/isEqual';
import * as actions from './actions';
import { getLatestProps } from './selectors';
import reducers, { initialState } from './reducers';
class LatestProvider extends PureComponent {
componentDidUpdate(prevProps) {
const { getLatest, latestEndpoints } = this.props;
const { latestEndpoints: prevLatestEndpoints } = prevProps;
if (!isEqual(latestEndpoints, prevLatestEndpoints)) {
getLatest(latestEndpoints);
}
}
render() {
return null;
}
}
LatestProvider.propTypes = {
getLatest: PropTypes.func.isRequired,
latestEndpoints: PropTypes.array,
};
reducerRegistry.registerModule('latest', {
actions,
reducers,
initialState,
});
export default connect(getLatestProps, actions)(LatestProvider);
| Fix loop if same provider endpoints | Fix loop if same provider endpoints
| JavaScript | mit | Vizzuality/gfw,Vizzuality/gfw | ---
+++
@@ -1,23 +1,27 @@
-import { useEffect, useMemo } from 'react';
+import { PureComponent } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import reducerRegistry from 'redux/registry';
+import isEqual from 'lodash/isEqual';
import * as actions from './actions';
import { getLatestProps } from './selectors';
import reducers, { initialState } from './reducers';
-const LatestProvider = ({ latestEndpoints, getLatest }) => {
- const endpoint = useMemo(() => {
- return latestEndpoints;
- }, [latestEndpoints]);
+class LatestProvider extends PureComponent {
+ componentDidUpdate(prevProps) {
+ const { getLatest, latestEndpoints } = this.props;
+ const { latestEndpoints: prevLatestEndpoints } = prevProps;
- useEffect(() => {
- getLatest(endpoint);
- }, [endpoint]);
+ if (!isEqual(latestEndpoints, prevLatestEndpoints)) {
+ getLatest(latestEndpoints);
+ }
+ }
- return null;
-};
+ render() {
+ return null;
+ }
+}
LatestProvider.propTypes = {
getLatest: PropTypes.func.isRequired, |
6d3ae8de4e99fc2fb925b3a645b8549756ccdb11 | website/mcapp.projects/src/app/project/home/mc-project-home-reminders.components.js | website/mcapp.projects/src/app/project/home/mc-project-home-reminders.components.js | class MCProjectHomeRemindersComponentController {
/*@ngInject*/
constructor(projectsAPI) {
this.projectsAPI = projectsAPI;
}
removeReminder(index) {
this.project.reminders.splice(index, 1);
}
addReminder() {
this.project.reminders.push({note: '', status: 'none'});
}
updateReminders() {
this.projectsAPI.updateProject(this.project.id, {reminders: this.project.reminders});
}
}
angular.module('materialscommons').component('mcProjectHomeReminders', {
templateUrl: 'app/project/home/mc-project-home-reminders.html',
controller: MCProjectHomeRemindersComponentController,
bindings: {
project: '<'
}
});
| class MCProjectHomeRemindersComponentController {
/*@ngInject*/
constructor(projectsAPI) {
this.projectsAPI = projectsAPI;
}
removeReminder(index) {
this.project.reminders.splice(index, 1);
this.projectsAPI.updateProject(this.project.id, {reminders: this.project.reminders});
}
addReminder() {
this.project.reminders.push({note: '', status: 'none'});
}
updateReminders() {
this.projectsAPI.updateProject(this.project.id, {reminders: this.project.reminders});
}
}
angular.module('materialscommons').component('mcProjectHomeReminders', {
templateUrl: 'app/project/home/mc-project-home-reminders.html',
controller: MCProjectHomeRemindersComponentController,
bindings: {
project: '<'
}
});
| Delete project reminder on backend | Delete project reminder on backend
When a reminder is deleted on the front-end ensure that it is also deleted on the backend.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -6,6 +6,7 @@
removeReminder(index) {
this.project.reminders.splice(index, 1);
+ this.projectsAPI.updateProject(this.project.id, {reminders: this.project.reminders});
}
addReminder() { |
413642773139e4d18c3c07193a873f98136fbad8 | src/components/panel/editForm/Panel.edit.display.js | src/components/panel/editForm/Panel.edit.display.js | export default [
{
weight: 10,
type: 'textfield',
input: true,
placeholder: 'Panel Title',
label: 'Title',
key: 'title',
tooltip: 'The title text that appears in the header of this panel.'
},
{
weight: 20,
type: 'textarea',
input: true,
key: 'tooltip',
label: 'Tooltip',
placeholder: 'To add a tooltip to this field, enter text here.',
tooltip: 'Adds a tooltip to the side of this field.'
},
{
weight: 30,
type: 'select',
input: true,
label: 'Theme',
key: 'theme',
dataSrc: 'values',
data: {
values: [
{ label: 'Default', value: 'default' },
{ label: 'Primary', value: 'primary' },
{ label: 'Info', value: 'info' },
{ label: 'Success', value: 'success' },
{ label: 'Danger', value: 'danger' },
{ label: 'Warning', value: 'warning' }
]
}
},
{
weight: 40,
type: 'select',
input: true,
label: 'Show Breadcrumb',
key: 'breadcrumb',
dataSrc: 'values',
data: {
values: [
{ label: 'Yes', value: 'default' },
{ label: 'No', value: 'none' }
]
}
}
];
| export default [
{
key: 'label',
hidden: true,
calculateValue: 'value = data.title'
},
{
weight: 1,
type: 'textfield',
input: true,
placeholder: 'Panel Title',
label: 'Title',
key: 'title',
tooltip: 'The title text that appears in the header of this panel.'
},
{
weight: 20,
type: 'textarea',
input: true,
key: 'tooltip',
label: 'Tooltip',
placeholder: 'To add a tooltip to this field, enter text here.',
tooltip: 'Adds a tooltip to the side of this field.'
},
{
weight: 30,
type: 'select',
input: true,
label: 'Theme',
key: 'theme',
dataSrc: 'values',
data: {
values: [
{ label: 'Default', value: 'default' },
{ label: 'Primary', value: 'primary' },
{ label: 'Info', value: 'info' },
{ label: 'Success', value: 'success' },
{ label: 'Danger', value: 'danger' },
{ label: 'Warning', value: 'warning' }
]
}
},
{
weight: 40,
type: 'select',
input: true,
label: 'Show Breadcrumb',
key: 'breadcrumb',
dataSrc: 'values',
data: {
values: [
{ label: 'Yes', value: 'default' },
{ label: 'No', value: 'none' }
]
}
}
];
| Hide the label settings for Panels since they have a title field. | Hide the label settings for Panels since they have a title field.
| JavaScript | mit | formio/formio.js,formio/formio.js,formio/formio.js | ---
+++
@@ -1,6 +1,11 @@
export default [
{
- weight: 10,
+ key: 'label',
+ hidden: true,
+ calculateValue: 'value = data.title'
+ },
+ {
+ weight: 1,
type: 'textfield',
input: true,
placeholder: 'Panel Title', |
ede88730cd71028cf01cd6a43d80e0b14622eccc | apps/jsgi/main.js | apps/jsgi/main.js | // start the web server. (we'll soon write a dedicated script to do this.)
if (module.id === require.main) {
require('ringo/httpserver').start();
}
| // start the web server. (we'll soon write a dedicated script to do this.)
if (module == require.main) {
require('ringo/webapp').start();
}
| Make jsgi demo app run again | Make jsgi demo app run again
| JavaScript | apache-2.0 | oberhamsi/ringojs,Transcordia/ringojs,ashwinrayaprolu1984/ringojs,ringo/ringojs,ashwinrayaprolu1984/ringojs,ashwinrayaprolu1984/ringojs,Transcordia/ringojs,ringo/ringojs,Transcordia/ringojs,Transcordia/ringojs,ringo/ringojs,ashwinrayaprolu1984/ringojs,oberhamsi/ringojs,oberhamsi/ringojs,ringo/ringojs | ---
+++
@@ -1,4 +1,4 @@
// start the web server. (we'll soon write a dedicated script to do this.)
-if (module.id === require.main) {
- require('ringo/httpserver').start();
+if (module == require.main) {
+ require('ringo/webapp').start();
} |
eb0bf2ff537bf74fc8027074380870d473af03b7 | Restaurant.js | Restaurant.js | import React from 'react'
import RestaurantModel from './RestaurantModel'
class Restaurant extends React.Component {
constructor(props) {
super(props)
this.displayName = "Restaurant"
}
render() {
// helper for code simplicity.
var model = this.props.model
// Controller calculats food icon for HTML View presentation.
var foodTypeImage = "";
if (model.foodType === "Burger") {
foodTypeImage = "assets/img/Burger.png"
} else {
foodTypeImage = "http://placeponi.es/48/48"
}
// Prepare rating JSX
var ratings = [];
for (var i=0; i < model.rating; i++) {
ratings.push(<span className="glyphicon glyphicon-star" key={i}/>);
}
return (
<li className="media" onClick={this.props.onClick}>
<div className="media-left">
<img className="media-object" src={foodTypeImage} />
</div>
<div className={"media-body" + (this.props.selected ? " selected" : "")}>
<h4 className="media-heading">{model.name}</h4>
<p>
Rating: {ratings}
</p>
</div>
</li>
)
}
}
Restaurant.propTypes = {
model: React.PropTypes.instanceOf(RestaurantModel)
}
Restaurant.defaultProps = {
restaurant : new RestaurantModel("NameOfPlace", "Burger", 2, "Dubnov 7, Tel Aviv-Yafo, Israel")
}
export default Restaurant
| import React from 'react'
import RestaurantModel from './RestaurantModel'
class Restaurant extends React.Component {
constructor(props) {
super(props)
this.displayName = "Restaurant"
}
render() {
// helper for code simplicity.
var model = this.props.model
// Controller calculats food icon for HTML View presentation.
var foodTypeImage = "";
if (model.foodType === "Burger") {
foodTypeImage = "assets/img/Burger.png"
} else {
foodTypeImage = "http://placeponi.es/48/48"
}
// Prepare rating JSX
var ratings = [];
for (var i=0; i < model.rating; i++) {
ratings.push(<span className="glyphicon glyphicon-star" key={i}/>);
}
return (
<li className="media" onClick={this.props.onClick}>
<div className="media-left">
<img className="media-object" src={foodTypeImage} />
</div>
<div className={"media-body" + (this.props.selected ? " selected-restaurant-row" : "")}>
<h4 className="media-heading">{model.name}</h4>
<p>
Rating: {ratings}
</p>
</div>
</li>
)
}
}
Restaurant.propTypes = {
model: React.PropTypes.instanceOf(RestaurantModel)
}
Restaurant.defaultProps = {
restaurant : new RestaurantModel("NameOfPlace", "Burger", 2, "Dubnov 7, Tel Aviv-Yafo, Israel")
}
export default Restaurant
| Use better css selector naming. | Use better css selector naming.
Fixes https://github.com/maximveksler/EatWell/pull/2#discussion_r60944809
| JavaScript | apache-2.0 | maximveksler/EatWell,maximveksler/EatWell | ---
+++
@@ -31,7 +31,7 @@
<img className="media-object" src={foodTypeImage} />
</div>
- <div className={"media-body" + (this.props.selected ? " selected" : "")}>
+ <div className={"media-body" + (this.props.selected ? " selected-restaurant-row" : "")}>
<h4 className="media-heading">{model.name}</h4>
<p> |
0d50135bf62bcb3bd2e8d5a978ecb4c2f1599d1d | src/client/app/core/core.routes.js | src/client/app/core/core.routes.js | (function () {
'use strict';
angular
.module('app.core')
.run(function($rootScope, $state) {
return $rootScope.$on('$stateChangeStart', function() {
return $rootScope.$state = $state;
});
})
.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
.state('home', {
url: '/home',
controller: 'Home',
controllerAs: 'home',
templateUrl: 'app/home/home.html',
data: {
title: 'Home'
}
})
.state('color', {
url: '/color',
controller: 'Color',
controllerAs: 'color',
templateUrl: 'app/color/color.html',
data: {
title: 'Color'
}
})
.state('404', {
url: '/404',
templateUrl: 'app/core/404.html',
data: {
title: '404'
}
});
});
}());
| (function () {
'use strict';
angular
.module('app.core')
.run(function($rootScope, $state) {
return $rootScope.$on('$stateChangeStart', function() {
$rootScope.$state = $state;
});
})
.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
.state('home', {
url: '/home',
controller: 'Home',
controllerAs: 'home',
templateUrl: 'app/home/home.html',
data: {
title: 'Home'
}
})
.state('color', {
url: '/color',
controller: 'Color',
controllerAs: 'color',
templateUrl: 'app/color/color.html',
data: {
title: 'Color'
}
})
.state('404', {
url: '/404',
templateUrl: 'app/core/404.html',
data: {
title: '404'
}
});
});
}());
| Correct code to remove JSHint error "Did you mean to return a conditional instead of an assignment?" | Correct code to remove JSHint error "Did you mean to return a conditional instead of an assignment?"
| JavaScript | mit | MAustinMMDP/web-brownie,MAustinMMDP/web-brownie | ---
+++
@@ -5,7 +5,7 @@
.module('app.core')
.run(function($rootScope, $state) {
return $rootScope.$on('$stateChangeStart', function() {
- return $rootScope.$state = $state;
+ $rootScope.$state = $state;
});
})
.config(function ($stateProvider, $urlRouterProvider) { |
b02b5ddc87d50fd64808f54d026c3e5675fd9973 | app/store/configureStore.js | app/store/configureStore.js | import { createStore, applyMiddleware } from 'redux'
import rootReducer from '../reducers'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
const loggerMiddleware = createLogger()
export default function configureStore(initialState) {
return createStore(
rootReducer,
applyMiddleware(
thunkMiddleware, // lets us dispatch() functions
loggerMiddleware // neat middleware that logs actions
),
initialState
)
}
| import { createStore, applyMiddleware } from 'redux'
import rootReducer from '../reducers'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
const loggerMiddleware = createLogger()
export default function configureStore(initialState) {
const store = createStore(
rootReducer,
applyMiddleware(
thunkMiddleware, // lets us dispatch() functions
loggerMiddleware // neat middleware that logs actions
),
initialState
)
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextRootReducer = require('../reducers');
store.replaceReducer(nextRootReducer);
});
}
return store;
}
| Enable store module hot loading | Enable store module hot loading
| JavaScript | mit | UCSD/campus-mobile,UCSD/campus-mobile,UCSD/campus-mobile,UCSD/now-mobile,UCSD/now-mobile,UCSD/now-mobile,UCSD/campus-mobile,UCSD/campus-mobile,UCSD/campus-mobile | ---
+++
@@ -7,7 +7,7 @@
const loggerMiddleware = createLogger()
export default function configureStore(initialState) {
- return createStore(
+ const store = createStore(
rootReducer,
applyMiddleware(
thunkMiddleware, // lets us dispatch() functions
@@ -15,4 +15,14 @@
),
initialState
)
+
+ if (module.hot) {
+ // Enable Webpack hot module replacement for reducers
+ module.hot.accept('../reducers', () => {
+ const nextRootReducer = require('../reducers');
+ store.replaceReducer(nextRootReducer);
+ });
+ }
+
+ return store;
} |
b06754b77fa01e847b959f823fe9d19c44b1aaa4 | ui/protractor.conf.js | ui/protractor.conf.js | const ts = require('ts-node')
exports.config = {
baseUrl: 'http://localhost:3000',
specs: ['test-e2e/**/*.spec.ts'],
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': [
'--show-fps-counter',
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--disable-background-timer-throttling',
'--disable-renderer-backgrounding',
'--disable-device-discovery-notifications',
'--no-gpu',
'--headless'
]
}
},
onPrepare: () => {
ts.register({
compilerOptions: { module: 'commonjs' },
fast: true
})
},
plugins: [{
package: 'aurelia-protractor-plugin'
}],
SELENIUM_PROMISE_MANAGER: 0
}
| const ts = require('ts-node')
exports.config = {
baseUrl: 'http://localhost:3000',
specs: ['test-e2e/**/*.spec.ts'],
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': [
'--show-fps-counter',
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--disable-background-timer-throttling',
'--disable-renderer-backgrounding',
'--disable-device-discovery-notifications',
'--no-gpu',
'--headless'
]
}
},
beforeLaunch: () => {
ts.register({
compilerOptions: { module: 'commonjs' },
fast: true
})
},
plugins: [{
package: 'aurelia-protractor-plugin'
}],
SELENIUM_PROMISE_MANAGER: 0
}
| Use before-lauch as highlighted in the protractor docs. | Use before-lauch as highlighted in the protractor docs.
| JavaScript | mit | jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr | ---
+++
@@ -22,7 +22,7 @@
]
}
},
- onPrepare: () => {
+ beforeLaunch: () => {
ts.register({
compilerOptions: { module: 'commonjs' },
fast: true |
80b744b2af3964abf6d1c26991bebd4070cbc19d | jquery.focusleave.js | jquery.focusleave.js | (function ( $ ) {
$.fn.onFocusLeave = function(cb) {
return this.each(function() {
var $this = $(this),
timeout;
$(this).on('focusout', function(e) {
timeout = window.setTimeout(function(){cb($this);}, 50);
});
$(this).on('focusin', function(e) {
window.clearTimeout(timeout);
});
});
};
}( jQuery ));
| (function ( $ ) {
$.fn.onFocusLeave = function(cb) {
return this.each(function() {
var $this = $(this),
timeout;
$this.on('focusout', function(e) {
timeout = window.setTimeout(function(){cb($this);}, 50);
});
$this.on('focusin', function(e) {
window.clearTimeout(timeout);
});
});
};
}( jQuery ));
| Use cached version of $this | Use cached version of $this
| JavaScript | mit | ianmcburnie/jquery-focusexit-js | ---
+++
@@ -7,11 +7,11 @@
var $this = $(this),
timeout;
- $(this).on('focusout', function(e) {
+ $this.on('focusout', function(e) {
timeout = window.setTimeout(function(){cb($this);}, 50);
});
- $(this).on('focusin', function(e) {
+ $this.on('focusin', function(e) {
window.clearTimeout(timeout);
});
}); |
c3f8a9bed2417d96a88890d43c16e2323cbea730 | src/repositories/PlayersStats.test.js | src/repositories/PlayersStats.test.js | import PlayersStats from './PlayersStats'
test('should add player stat to collection', () => {
// given
let repository = new PlayersStats([])
let playerStats = { id: 1, data: 'some-data' }
// when
let added = repository.add(playerStats)
// then
expect(added).toBeTruthy()
expect(repository.all().length).toBe(1)
expect(repository.all()[0]).toBe(playerStats)
})
test('should return players stats collection', () => {
// given
let playersStats = [
{ id: 1, data: 'some-data' },
{ id: 2, data: 'another-data' }
]
let repository = new PlayersStats(playersStats)
// when
let collection = repository.all()
// then
expect(collection.length).toBe(2)
expect(collection).toEqual(expect.arrayContaining(playersStats))
})
test('should export data with a given exporter service', () => {
// given
let playersStats = [
{ id: 1, data: 'some-data' },
{ id: 2, data: 'another-data' }
]
let mockExport = jest.fn()
let repository = new PlayersStats(playersStats, { export: mockExport })
// when
repository.export()
// then
expect(mockExport).toBeCalled()
expect(mockExport.mock.calls.length).toBe(1)
expect(mockExport).toBeCalledWith('players_stats', playersStats)
})
| import PlayersStats from './PlayersStats'
test('should add player stat to collection', () => {
// given
let repository = new PlayersStats()
let playerStats = { id: 1, data: 'some-data' }
// when
let added = repository.add(playerStats)
// then
expect(added).toBeTruthy()
expect(repository.all().length).toBe(1)
expect(repository.all()[0]).toBe(playerStats)
})
test('should return players stats collection', () => {
// given
let playersStats = [
{ id: 1, data: 'some-data' },
{ id: 2, data: 'another-data' }
]
let repository = new PlayersStats(playersStats)
// when
let collection = repository.all()
// then
expect(collection.length).toBe(2)
expect(collection).toEqual(expect.arrayContaining(playersStats))
})
test('should export data with a given exporter service', () => {
// given
let playersStats = [
{ id: 1, data: 'some-data' },
{ id: 2, data: 'another-data' }
]
let mockExport = jest.fn()
let repository = new PlayersStats(playersStats, { export: mockExport })
// when
repository.export()
// then
expect(mockExport).toBeCalled()
expect(mockExport.mock.calls.length).toBe(1)
expect(mockExport).toBeCalledWith('players_stats', playersStats)
})
| Test playersstats without default empty array | Test playersstats without default empty array
| JavaScript | mit | chagasaway/nba-players-scrapper | ---
+++
@@ -2,7 +2,7 @@
test('should add player stat to collection', () => {
// given
- let repository = new PlayersStats([])
+ let repository = new PlayersStats()
let playerStats = { id: 1, data: 'some-data' }
// when |
90423ebf435d8c3dbb66af12729ad9d2a0475a0c | src/foam/apploader/ModelRefines.js | src/foam/apploader/ModelRefines.js | foam.CLASS({
package: 'foam.apploader',
name: 'ModelRefines',
refines: 'foam.core.Model',
methods: [
{
name: 'getClassDeps',
code: function() {
var deps = this.requires ?
this.requires.map(function(r) { return r.path }) :
[];
deps = deps.concat(this.implements ?
this.implements.map(function(i) { return i.path }) :
[]);
if ( this.extends ) deps.push(this.extends);
return deps;
}
},
],
});
| foam.CLASS({
package: 'foam.apploader',
name: 'ModelRefines',
refines: 'foam.core.Model',
methods: [
{
name: 'getClassDeps',
code: function() {
var deps = this.requires ?
this.requires.map(function(r) { return r.path }) :
[];
deps = deps.concat(this.implements ?
this.implements.map(function(i) { return i.path }) :
[]);
if ( this.extends ) deps.push(this.extends);
if ( this.refines ) deps.push(this.refines);
return deps.map(function(d) {
if ( d.indexOf('.') == -1 ) return 'foam.core.' + d;
return d;
});
return deps;
}
},
],
});
| Add refines to getClassDeps and prepend any deps with no package with 'foam.core.' | Add refines to getClassDeps and prepend any deps with no package with 'foam.core.'
| JavaScript | apache-2.0 | jacksonic/vjlofvhjfgm,jacksonic/vjlofvhjfgm,foam-framework/foam2,jacksonic/vjlofvhjfgm,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2 | ---
+++
@@ -15,6 +15,13 @@
[]);
if ( this.extends ) deps.push(this.extends);
+
+ if ( this.refines ) deps.push(this.refines);
+
+ return deps.map(function(d) {
+ if ( d.indexOf('.') == -1 ) return 'foam.core.' + d;
+ return d;
+ });
return deps;
}
}, |
3c48a5d5af10d9b9d6a13fcde859b1d7d91f70e5 | commands/randomness_commands.js | commands/randomness_commands.js |
module.exports = {
factcheck: (message, _, msg) => {
const bool1 = (Math.random() > 0.5);
const bool2 = (Math.random() > 0.5);
let str;
if (msg) {
str = `${message.author}'s claim, "${msg}",`;
str = bool1 ? `${str} is obviously ${bool2.toString()}.`
: `${str} can't possibly be ${bool2.toString()}.`;
} else {
str = bool1 ? `${message.author} is always ${bool2 ? 'right' : 'wrong'}.`
: `${message.author} is never ${bool2 ? 'right' : 'wrong'}.`;
}
message.channel.send(str);
},
coin: (message) => {
const bool = (Math.random() > 0.5);
message.channel.send(bool ? 'Heads.' : 'Tails.');
},
dice: (message, _, __, n) => {
n = Math.max(Number(n), 0) || 6;
message.channel.send(Math.floor(Math.random() * n) + 1)
.catch(() => message.channel.send('Input a valid number!'));
},
};
|
module.exports = {
factcheck: (message, _, msg) => {
const bool1 = (Math.random() > 0.5);
const bool2 = (Math.random() > 0.5);
let str;
if (msg) {
str = `${message.author}'s claim, "${msg}",`;
str = bool1 ? `${str} is obviously ${bool2.toString()}.`
: `${str} can't possibly be ${bool2.toString()}.`;
} else {
str = bool1 ? `${message.author} is always ${bool2 ? 'right' : 'wrong'}.`
: `${message.author} is never ${bool2 ? 'right' : 'wrong'}.`;
}
message.channel.send(str);
},
coin: (message) => {
const bool = (Math.random() > 0.5);
const headsUrl = 'http://www.antheads.co.uk/_/rsrc/1467896244461/catguide/heads/Heads-21-30.jpg';
const tailsUrl = 'https://upload.wikimedia.org/wikipedia/en/7/73/Sonicchannel_tails_cg.png';
message.channel.send(bool ? `Heads.\n${headsUrl}`
: `Tails.\n${tailsUrl}`);
},
dice: (message, _, __, n) => {
n = Math.max(Number(n), 0) || 6;
message.channel.send(Math.floor(Math.random() * n) + 1)
.catch(() => message.channel.send('Input a valid number!'));
},
};
| Add images to coin command | Add images to coin command
| JavaScript | mit | Rafer45/soup | ---
+++
@@ -18,7 +18,10 @@
coin: (message) => {
const bool = (Math.random() > 0.5);
- message.channel.send(bool ? 'Heads.' : 'Tails.');
+ const headsUrl = 'http://www.antheads.co.uk/_/rsrc/1467896244461/catguide/heads/Heads-21-30.jpg';
+ const tailsUrl = 'https://upload.wikimedia.org/wikipedia/en/7/73/Sonicchannel_tails_cg.png';
+ message.channel.send(bool ? `Heads.\n${headsUrl}`
+ : `Tails.\n${tailsUrl}`);
},
dice: (message, _, __, n) => { |
4c2fefb8422f93ef861fe171bcc73273de577153 | addon/pods/components/rui-icon/component.js | addon/pods/components/rui-icon/component.js | import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout: layout,
tagName: 'i',
classNames: ['fa'],
classNameBindings: ['nameComputed'],
// Constructors
classPrefix: 'fa',
// Computed
nameComputed: Ember.computed('style', function() {
// Builds the icon class.
// REVIEW: I wonder if there's an "easy" way to have this check if the icon
// name exists that doesn't rely on manually updating an array. It would
// be nice to give an Ember warning if the icon name doesn't exist.
var iconName = this.get('name');
return this.get('classPrefix') + '-' + iconName;
})
});
| import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout: layout,
tagName: 'i',
classNames: ['fa'],
classNameBindings: ['nameComputed'],
// Constructors
classPrefix: 'fa',
// Computed
nameComputed: Ember.computed('name', function() {
// Builds the icon class.
// REVIEW: I wonder if there's an "easy" way to have this check if the icon
// name exists that doesn't rely on manually updating an array. It would
// be nice to give an Ember warning if the icon name doesn't exist.
var iconName = this.get('name');
return this.get('classPrefix') + '-' + iconName;
})
});
| Change computed to update on name change | Change computed to update on name change
| JavaScript | mit | revelation/ember-cli-revelation-ui,revelation/ember-cli-revelation-ui | ---
+++
@@ -11,7 +11,7 @@
classPrefix: 'fa',
// Computed
- nameComputed: Ember.computed('style', function() {
+ nameComputed: Ember.computed('name', function() {
// Builds the icon class.
// REVIEW: I wonder if there's an "easy" way to have this check if the icon
// name exists that doesn't rely on manually updating an array. It would |
6489f67e37a39828a2553c0913c4f1ee5b201835 | test/let_tests.js | test/let_tests.js | var expect = require('chai').expect;
describe('let', function() {
it('variables declared with let are accessible within nested blocks', function() {
'use strict';
let foo = 'bar';
if (true) {
expect(foo).to.equal('bar');
}
});
});
| 'use strict';
var expect = require('chai').expect;
describe('let', function() {
it('variables declared with let are accessible within nested blocks', function() {
let foo = 'bar';
if (true) {
expect(foo).to.equal('bar');
}
});
});
| Use string for all tests | Use string for all tests
| JavaScript | mit | chrisneave/es2015-demo | ---
+++
@@ -1,8 +1,8 @@
+'use strict';
var expect = require('chai').expect;
describe('let', function() {
it('variables declared with let are accessible within nested blocks', function() {
- 'use strict';
let foo = 'bar';
if (true) { |
5ec387aa829d0f9bef9b1e2871491c4c30fcf188 | shells/browser/shared/src/renderer.js | shells/browser/shared/src/renderer.js | /**
* In order to support reload-and-profile functionality, the renderer needs to be injected before any other scripts.
* Since it is a complex file (with imports) we can't just toString() it like we do with the hook itself,
* So this entry point (one of the web_accessible_resources) provcides a way to eagerly inject it.
* The hook will look for the presence of a global __REACT_DEVTOOLS_ATTACH__ and attach an injected renderer early.
* The normal case (not a reload-and-profile) will not make use of this entry point though.
*
* @flow
*/
import { attach } from 'src/backend/renderer';
Object.defineProperty(
window,
'__REACT_DEVTOOLS_ATTACH__',
({
enumerable: false,
get() {
return attach;
},
}: Object)
);
| /**
* In order to support reload-and-profile functionality, the renderer needs to be injected before any other scripts.
* Since it is a complex file (with imports) we can't just toString() it like we do with the hook itself,
* So this entry point (one of the web_accessible_resources) provcides a way to eagerly inject it.
* The hook will look for the presence of a global __REACT_DEVTOOLS_ATTACH__ and attach an injected renderer early.
* The normal case (not a reload-and-profile) will not make use of this entry point though.
*
* @flow
*/
import { attach } from 'src/backend/renderer';
Object.defineProperty(
window,
'__REACT_DEVTOOLS_ATTACH__',
({
enumerable: false,
configurable: true,
get() {
return attach;
},
}: Object)
);
| Mark reload-and-profile attach as configurable | Mark reload-and-profile attach as configurable
| JavaScript | mit | rickbeerendonk/react,billfeller/react,chenglou/react,billfeller/react,acdlite/react,acdlite/react,trueadm/react,flarnie/react,acdlite/react,glenjamin/react,yungsters/react,terminatorheart/react,camsong/react,tomocchino/react,Simek/react,mjackson/react,tomocchino/react,trueadm/react,TheBlasfem/react,rickbeerendonk/react,mosoft521/react,yungsters/react,chenglou/react,billfeller/react,ericyang321/react,facebook/react,ericyang321/react,jzmq/react,tomocchino/react,mosoft521/react,mjackson/react,flarnie/react,billfeller/react,jzmq/react,mosoft521/react,cpojer/react,TheBlasfem/react,chenglou/react,camsong/react,glenjamin/react,Simek/react,chenglou/react,facebook/react,tomocchino/react,ArunTesco/react,chicoxyzzy/react,jzmq/react,rricard/react,rickbeerendonk/react,TheBlasfem/react,camsong/react,ericyang321/react,mjackson/react,trueadm/react,terminatorheart/react,mosoft521/react,rickbeerendonk/react,facebook/react,Simek/react,mosoft521/react,terminatorheart/react,terminatorheart/react,ArunTesco/react,ericyang321/react,tomocchino/react,flarnie/react,cpojer/react,flarnie/react,tomocchino/react,chicoxyzzy/react,rricard/react,rricard/react,facebook/react,flarnie/react,rickbeerendonk/react,chenglou/react,yungsters/react,terminatorheart/react,trueadm/react,cpojer/react,yungsters/react,ArunTesco/react,mjackson/react,ericyang321/react,rricard/react,glenjamin/react,trueadm/react,cpojer/react,jzmq/react,billfeller/react,Simek/react,cpojer/react,rricard/react,chicoxyzzy/react,mosoft521/react,glenjamin/react,camsong/react,chicoxyzzy/react,facebook/react,trueadm/react,rickbeerendonk/react,TheBlasfem/react,Simek/react,chicoxyzzy/react,rricard/react,billfeller/react,jzmq/react,cpojer/react,jzmq/react,chenglou/react,glenjamin/react,acdlite/react,flarnie/react,chicoxyzzy/react,terminatorheart/react,acdlite/react,yungsters/react,mjackson/react,acdlite/react,ericyang321/react,rickbeerendonk/react,chicoxyzzy/react,yungsters/react,cpojer/react,glenjamin/react,billfeller/react,jzmq/react,camsong/react,glenjamin/react,acdlite/react,Simek/react,chenglou/react,facebook/react,Simek/react,flarnie/react,camsong/react,camsong/react,facebook/react,tomocchino/react,yungsters/react,mosoft521/react,trueadm/react,mjackson/react,ericyang321/react,TheBlasfem/react,mjackson/react,TheBlasfem/react | ---
+++
@@ -15,6 +15,7 @@
'__REACT_DEVTOOLS_ATTACH__',
({
enumerable: false,
+ configurable: true,
get() {
return attach;
}, |
d4aea530dd9588dd23cfb0a914be138626a4bd43 | input/fixture.js | input/fixture.js | 'use strict';
/* eslint-disable indent */
module.exports = function(tx) {
var body = tx.get('body');
tx.create({
id: 'title',
type: 'heading',
level: 1,
content: 'Input Element'
});
body.show('title');
tx.create({
id: 'intro',
type: 'paragraph',
content: [
"You can use custom elements with an HTML input element"
].join('')
});
body.show('intro');
tx.create({
type: 'input',
id: 'input',
content: 'Lorem ipsum...'
});
body.show('input');
tx.create({
id: 'the-end',
type: 'paragraph',
content: [
"That's it."
].join('')
});
body.show('the-end');
};
| 'use strict';
/* eslint-disable indent */
module.exports = function(tx) {
var body = tx.get('body');
tx.create({
id: 'title',
type: 'heading',
level: 1,
content: 'Input Element'
});
body.show('title');
tx.create({
id: 'intro',
type: 'paragraph',
content: [
"You can use custom elements with an HTML input element"
].join('')
});
body.show('intro');
tx.create({
type: 'input',
id: 'input',
content: 'Lorem ipsum...'
});
body.show('input');
tx.create({
id: 'the-end',
type: 'paragraph',
content: [
"That way you can implement editor functionality using class web development practices."
].join('')
});
body.show('the-end');
};
| Add more description to input example. | Add more description to input example.
| JavaScript | mit | philschatz/substance-editor,substance/examples,substance/examples,philschatz/substance-editor,substance/demos,substance/demos | ---
+++
@@ -32,7 +32,7 @@
id: 'the-end',
type: 'paragraph',
content: [
- "That's it."
+ "That way you can implement editor functionality using class web development practices."
].join('')
});
body.show('the-end'); |
f5ae5d64c43915af9e2da0ab1f1c08c94b7249e1 | app/containers/NavigationContainer/sagas.js | app/containers/NavigationContainer/sagas.js | // import { take, call, put, select } from 'redux-saga/effects';
import { REQUEST_TOPICS } from './constants';
import { takeLatest } from 'redux-saga';
import { call } from 'redux-saga/effects';
export function fetchTopicsFromServer() {
return fetch('http://locahost:3000/api/topics')
.then(response => response.json());
}
// Generator functions: do async logic without
// using callbacks.
function* fetchTopics() {
const topics = yield call(fetchTopicsFromServer);
console.log('Topics from server: ', topics);
}
export function* fetchTopicsSaga() {
yield* takeLatest(REQUEST_TOPICS, fetchTopics);
}
// All sagas to be loaded
export default [
fetchTopicsSaga,
];
| // import { take, call, put, select } from 'redux-saga/effects';
import { REQUEST_TOPICS } from './constants';
import { takeLatest } from 'redux-saga';
import { call, put } from 'redux-saga/effects';
import { requestTopicsSucceeded, requestTopicsFailed } from './actions';
export function fetchTopicsFromServer() {
return fetch('http://localhost:3000/api/topics')
.then(response => response.json());
}
// Generator functions: do async logic without
// using callbacks.
function* fetchTopics() {
try {
const topics = yield call(fetchTopicsFromServer);
yield put(requestTopicsSucceeded(topics));
} catch (e) {
yield put(requestTopicsFailed(e.message));
}
}
export function* fetchTopicsSaga() {
yield* takeLatest(REQUEST_TOPICS, fetchTopics);
}
// All sagas to be loaded
export default [
fetchTopicsSaga,
];
| Handle response from server in saga | Handle response from server in saga
| JavaScript | mit | GeertHuls/react-async-saga-example,GeertHuls/react-async-saga-example | ---
+++
@@ -1,18 +1,23 @@
// import { take, call, put, select } from 'redux-saga/effects';
import { REQUEST_TOPICS } from './constants';
import { takeLatest } from 'redux-saga';
-import { call } from 'redux-saga/effects';
+import { call, put } from 'redux-saga/effects';
+import { requestTopicsSucceeded, requestTopicsFailed } from './actions';
export function fetchTopicsFromServer() {
- return fetch('http://locahost:3000/api/topics')
+ return fetch('http://localhost:3000/api/topics')
.then(response => response.json());
}
// Generator functions: do async logic without
// using callbacks.
function* fetchTopics() {
- const topics = yield call(fetchTopicsFromServer);
- console.log('Topics from server: ', topics);
+ try {
+ const topics = yield call(fetchTopicsFromServer);
+ yield put(requestTopicsSucceeded(topics));
+ } catch (e) {
+ yield put(requestTopicsFailed(e.message));
+ }
}
export function* fetchTopicsSaga() { |
9703839e2484f4bd603c65f02ca6ca3dad30f2d2 | src/main/webapp/js/imcms/components/imcms_displacing_array.js | src/main/webapp/js/imcms/components/imcms_displacing_array.js | /**
* Array with fixed max length and displacing first element on oversize.
*
* @author Serhii Maksymchuk from Ubrainians for imCode
* 10.05.18
*/
Imcms.define('imcms-displacing-array', [], function () {
var DisplacingArray = function (size) {
if (typeof size !== 'number') throw new Error("Size should be integer!");
if (size < 1) throw new Error("Size should be >= 1");
this.size = size;
this.elements = [];
};
DisplacingArray.prototype = {
push: function (content) {
if (this.elements.length > this.size) {
this.elements.splice(0, 1); // removes first element
}
this.elements.push(content);
},
forEach: function (doForEach) {
this.elements.forEach(doForEach);
}
};
return DisplacingArray;
});
| /**
* Array with fixed max length and displacing first element on oversize.
*
* @author Serhii Maksymchuk from Ubrainians for imCode
* 10.05.18
*/
Imcms.define('imcms-displacing-array', [], function () {
var DisplacingArray = function (size) {
if (typeof size !== 'number') throw new Error("Size should be integer!");
if (size < 1) throw new Error("Size should be >= 1");
this.size = size;
this.elements = [];
};
DisplacingArray.prototype = {
push: function (content) {
if (this.elements.length > this.size) {
this.elements.splice(0, 1); // removes first element
}
this.elements.push(content);
this.length = this.elements.length;
},
forEach: function (doForEach) {
this.elements.forEach(doForEach);
}
};
return DisplacingArray;
});
| Add a "pin" icon to imCMS's panel: - Refreshing elements length for displacing array. | IMCMS-290: Add a "pin" icon to imCMS's panel:
- Refreshing elements length for displacing array.
| JavaScript | agpl-3.0 | imCodePartnerAB/imcms,imCodePartnerAB/imcms,imCodePartnerAB/imcms | ---
+++
@@ -21,6 +21,7 @@
}
this.elements.push(content);
+ this.length = this.elements.length;
},
forEach: function (doForEach) {
this.elements.forEach(doForEach); |
d9a3ed959f61ddf0af6a393305486cfd02ac988d | js/shiv-test-util.js | js/shiv-test-util.js | if (!shiv) {
throw(new Error("Don't load this file directly! Use shiv.load()"));
}
shiv.test(
"shiv.map",
function() {
return shiv.map([1,2,3], function(x) { return x * 2; });
},
function(res) {
return (
(res[0] == 1) &&
(res[1] == 4) &&
(res[2] == 6)
);
}
);
| if (!shiv) {
throw(new Error("Don't load this file directly! Use shiv.load()"));
}
shiv.test(
"shiv.map",
function() {
return shiv.map([1,2,3], function(x) { return x * 2; });
},
function(res) {
//
// Array equality has to be tested element by element in JS
//
return (
(res[0] == 1) &&
(res[1] == 4) &&
(res[2] == 6)
);
}
);
| Comment added to shiv.map test | Comment added to shiv.map test
| JavaScript | mit | michiel/shivjs | ---
+++
@@ -8,11 +8,17 @@
return shiv.map([1,2,3], function(x) { return x * 2; });
},
function(res) {
+
+ //
+ // Array equality has to be tested element by element in JS
+ //
+
return (
(res[0] == 1) &&
(res[1] == 4) &&
(res[2] == 6)
);
+
}
);
|
622ea2706b200059053e311b14e8cd7e44c8942c | test/selectors/petitionSupportable.js | test/selectors/petitionSupportable.js | import { assert } from 'chai';
import getPetionSupportable from 'selectors/petitionSupportable';
describe('getPetionSupportable', () => {
context('with a new petition', () => {
const actual = getPetionSupportable({});
const expected = false;
it('returns false', () => assert.equal(actual, expected));
});
context('with a published petition', () => {
const actual = getPetionSupportable({state: { name: 'pending', parent: 'supportable' }});
const expected = true;
it('returns true', () => assert.equal(actual, expected));
});
});
| import { assert } from 'chai';
import getPetitionSupportable from 'selectors/petitionSupportable';
describe('getPetitionSupportable', () => {
context('with a new petition', () => {
const actual = getPetitionSupportable({});
const expected = false;
it('returns false', () => assert.equal(actual, expected));
});
context('with a published petition', () => {
const actual = getPetitionSupportable({state: { name: 'pending', parent: 'supportable' }});
const expected = true;
it('returns true', () => assert.equal(actual, expected));
});
});
| Fix a typo in selector test | Fix a typo in selector test
| JavaScript | apache-2.0 | iris-dni/iris-frontend,iris-dni/iris-frontend,iris-dni/iris-frontend | ---
+++
@@ -1,16 +1,16 @@
import { assert } from 'chai';
-import getPetionSupportable from 'selectors/petitionSupportable';
+import getPetitionSupportable from 'selectors/petitionSupportable';
-describe('getPetionSupportable', () => {
+describe('getPetitionSupportable', () => {
context('with a new petition', () => {
- const actual = getPetionSupportable({});
+ const actual = getPetitionSupportable({});
const expected = false;
it('returns false', () => assert.equal(actual, expected));
});
context('with a published petition', () => {
- const actual = getPetionSupportable({state: { name: 'pending', parent: 'supportable' }});
+ const actual = getPetitionSupportable({state: { name: 'pending', parent: 'supportable' }});
const expected = true;
it('returns true', () => assert.equal(actual, expected)); |
e033432500d70b2a0ea04fd0548a665d6ec4bf2f | api/src/lib/form-handler.js | api/src/lib/form-handler.js | const logger = require('./logger');
module.exports = (
userService,
themeService,
clientService
) => {
return (templateName, getView, postHandler) => async (request, reply, source, error) => {
if (error && error.output.statusCode === 404) {
reply(error);
}
try {
const client = await clientService.findById(request.query.client_id);
let user = null;
if (request.auth.isAuthenticated) {
user = request.auth.strategy === 'email_token'
? request.auth.credentials.user
: await userService.findById(request.auth.credentials.accountId());
}
const render = async e => {
const viewContext = getView(user, client, request, e);
const template = await themeService.renderThemedTemplate(request.query.client_id, templateName, viewContext);
if (template) {
reply(template);
} else {
reply.view(templateName, viewContext);
}
}
if (!error && request.method === 'post') {
error = await postHandler(request, reply, user, client, render);
} else {
await render(error);
}
} catch(e) {
reply(e);
}
};
};
module.exports['@singleton'] = true;
module.exports['@require'] = [
'user/user-service',
'theme/theme-service',
'client/client-service',
];
| const logger = require('./logger');
module.exports = (
userService,
themeService,
clientService
) => {
return (templateName, getView, postHandler) => async (request, reply, source, error) => {
if (error && error.output.statusCode === 404) {
return reply(error);
}
try {
const client = await clientService.findById(request.query.client_id);
let user = null;
if (request.auth.isAuthenticated) {
user = request.auth.strategy === 'email_token'
? request.auth.credentials.user
: await userService.findById(request.auth.credentials.accountId());
}
const render = async e => {
const viewContext = getView(user, client, request, e);
const template = await themeService.renderThemedTemplate(request.query.client_id, templateName, viewContext);
if (template) {
return reply(template);
} else {
return reply.view(templateName, viewContext);
}
}
if (!error && request.method === 'post') {
error = await postHandler(request, reply, user, client, render);
} else {
await render(error);
}
} catch(e) {
return reply(e);
}
};
};
module.exports['@singleton'] = true;
module.exports['@require'] = [
'user/user-service',
'theme/theme-service',
'client/client-service',
];
| Add return to replies so they don't get called multiple times | Add return to replies so they don't get called multiple times
| JavaScript | mit | synapsestudios/oidc-platform,synapsestudios/oidc-platform,synapsestudios/oidc-platform,synapsestudios/oidc-platform | ---
+++
@@ -7,7 +7,7 @@
) => {
return (templateName, getView, postHandler) => async (request, reply, source, error) => {
if (error && error.output.statusCode === 404) {
- reply(error);
+ return reply(error);
}
try {
const client = await clientService.findById(request.query.client_id);
@@ -22,9 +22,9 @@
const viewContext = getView(user, client, request, e);
const template = await themeService.renderThemedTemplate(request.query.client_id, templateName, viewContext);
if (template) {
- reply(template);
+ return reply(template);
} else {
- reply.view(templateName, viewContext);
+ return reply.view(templateName, viewContext);
}
}
@@ -34,7 +34,7 @@
await render(error);
}
} catch(e) {
- reply(e);
+ return reply(e);
}
};
}; |
33b118bba40c4cd86e6bef67d375422e9bb02490 | src/actions/settings.js | src/actions/settings.js | import * as types from './types';
export function updateField(key, value) {
return {
type: types.SETTING_UPDATE,
payload: {
key,
value,
},
};
}
| import {
CHECKBOX_UPDATE,
RANGE_UPDATE,
FUZZY,
} from './types';
export function updateCheckbox(key, value) {
return {
type: CHECKBOX_UPDATE,
payload: {
key,
value,
},
};
}
export function updateFuzzyCheckbox(key, value) {
return {
type: FUZZY + CHECKBOX_UPDATE,
payload: {
key,
value,
},
};
}
export function updateFuzzyRange(key, value) {
return {
type: FUZZY + RANGE_UPDATE,
payload: {
key,
value,
},
};
}
| Add actions for handling setting state in the background | Add actions for handling setting state in the background
| JavaScript | mit | reblws/tab-search,reblws/tab-search | ---
+++
@@ -1,11 +1,36 @@
-import * as types from './types';
+import {
+ CHECKBOX_UPDATE,
+ RANGE_UPDATE,
+ FUZZY,
+} from './types';
-export function updateField(key, value) {
+
+export function updateCheckbox(key, value) {
return {
- type: types.SETTING_UPDATE,
+ type: CHECKBOX_UPDATE,
payload: {
key,
value,
},
};
}
+
+export function updateFuzzyCheckbox(key, value) {
+ return {
+ type: FUZZY + CHECKBOX_UPDATE,
+ payload: {
+ key,
+ value,
+ },
+ };
+}
+
+export function updateFuzzyRange(key, value) {
+ return {
+ type: FUZZY + RANGE_UPDATE,
+ payload: {
+ key,
+ value,
+ },
+ };
+} |
469dc586285709a67cd2b1ebc0470df9baba5a90 | packages/react-proxy/modules/requestForceUpdateAll.js | packages/react-proxy/modules/requestForceUpdateAll.js | var deepForceUpdate = require('./deepForceUpdate');
var isRequestPending = false;
module.exports = function requestForceUpdateAll(getRootInstances, React) {
if (isRequestPending) {
return;
}
/**
* Forces deep re-render of all mounted React components.
* Hat's off to Omar Skalli (@Chetane) for suggesting this approach:
* https://gist.github.com/Chetane/9a230a9fdcdca21a4e29
*/
function forceUpdateAll() {
isRequestPending = false;
var rootInstances = getRootInstances(),
rootInstance;
for (var key in rootInstances) {
if (rootInstances.hasOwnProperty(key)) {
deepForceUpdate(rootInstances[key], React);
}
}
}
setTimeout(forceUpdateAll);
}; | var deepForceUpdate = require('./deepForceUpdate');
var isRequestPending = false;
module.exports = function requestForceUpdateAll(getRootInstances, React) {
if (isRequestPending) {
return;
}
/**
* Forces deep re-render of all mounted React components.
* Hat's off to Omar Skalli (@Chetane) for suggesting this approach:
* https://gist.github.com/Chetane/9a230a9fdcdca21a4e29
*/
function forceUpdateAll() {
isRequestPending = false;
var rootInstances = getRootInstances(),
rootInstance;
for (var key in rootInstances) {
if (rootInstances.hasOwnProperty(key)) {
rootInstance = rootInstances[key];
// `|| rootInstance` for React 0.12 and earlier
rootInstance = rootInstance._reactInternalInstance || rootInstance;
deepForceUpdate(rootInstance, React);
}
}
}
setTimeout(forceUpdateAll);
}; | Fix usage with external React on 0.13+ | Fix usage with external React on 0.13+
| JavaScript | mit | gaearon/react-hot-loader,gaearon/react-hot-loader | ---
+++
@@ -20,7 +20,11 @@
for (var key in rootInstances) {
if (rootInstances.hasOwnProperty(key)) {
- deepForceUpdate(rootInstances[key], React);
+ rootInstance = rootInstances[key];
+
+ // `|| rootInstance` for React 0.12 and earlier
+ rootInstance = rootInstance._reactInternalInstance || rootInstance;
+ deepForceUpdate(rootInstance, React);
}
}
} |
8c69a9c5faf7d8a6238be02fca5b026e33dede48 | adapters/axios.js | adapters/axios.js | require('native-promise-only');
var axios = require('axios');
var Axios = function(settings) {
return new Promise(function(resolve, reject) {
var options = {
method: settings.type.toLowerCase(),
url: settings.url,
responseType: "text"
};
if (settings.headers) {
options.headers = settings.headers;
}
if (settings.processData) {
options.params = settings.data;
} else {
options.data = settings.data;
}
return axios(options).then(function(response) {
settings.success(response.data);
return resolve(response);
}).catch(function(response) {
var error = response.data || response;
settings.error(error);
return reject(response);
});
});
};
module.exports = Axios;
| var extend = require('../utils').extend;
require('native-promise-only');
var axios = require('axios');
var Axios = function(settings) {
return new Promise(function(resolve, reject) {
var options = {
method: settings.type.toLowerCase(),
url: settings.url,
responseType: "text",
headers: {
'Content-Type': 'application/json;charset=utf-8'
}
};
if (settings.headers) {
options.headers = extend(options.headers, settings.headers);
}
if (settings.processData) {
options.params = settings.data;
} else {
options.data = settings.data;
}
return axios(options).then(function(response) {
settings.success(response.data);
return resolve(response);
}).catch(function(response) {
var error = response.data || response;
settings.error(error);
return reject(response);
});
});
};
module.exports = Axios;
| Use application/json as default content-type with Axios | Use application/json as default content-type with Axios
| JavaScript | mit | hoppula/vertebrae,hoppula/vertebrae | ---
+++
@@ -1,3 +1,4 @@
+var extend = require('../utils').extend;
require('native-promise-only');
var axios = require('axios');
@@ -6,10 +7,13 @@
var options = {
method: settings.type.toLowerCase(),
url: settings.url,
- responseType: "text"
+ responseType: "text",
+ headers: {
+ 'Content-Type': 'application/json;charset=utf-8'
+ }
};
if (settings.headers) {
- options.headers = settings.headers;
+ options.headers = extend(options.headers, settings.headers);
}
if (settings.processData) {
options.params = settings.data; |
d87500c1aadbfb56a059a8855c79448a11ed9d99 | tests/integration/components/froala-content-test.js | tests/integration/components/froala-content-test.js | import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | froala-content', function(hooks) {
setupRenderingTest(hooks);
test('.fr-view class is applied', async function(assert) {
await render(hbs`{{froala-content elementId="editor"}}`);
assert.ok(this.$('#editor').hasClass('fr-view'));
});
test("'content' is output inside the block", async function(assert) {
await render(hbs`{{froala-content content="foobar"}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
test("positional param 'content' is output inside the block", async function(assert) {
await render(hbs`{{froala-content "foobar"}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
test("block content is properly yield'ed", async function(assert) {
await render(hbs`{{#froala-content}}foobar{{/froala-content}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
});
| import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import $ from 'jquery';
module('Integration | Component | froala-content', function(hooks) {
setupRenderingTest(hooks);
test('.fr-view class is applied', async function(assert) {
await render(hbs`{{froala-content elementId="editor"}}`);
assert.ok($('#editor', this.element).hasClass('fr-view'));
});
test("'content' is output inside the block", async function(assert) {
await render(hbs`{{froala-content content="foobar"}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
test("positional param 'content' is output inside the block", async function(assert) {
await render(hbs`{{froala-content "foobar"}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
test("block content is properly yield'ed", async function(assert) {
await render(hbs`{{#froala-content}}foobar{{/froala-content}}`);
assert.equal(this.element.textContent.trim(), 'foobar');
});
});
| Remove usage of ember jquery integration in tests | Remove usage of ember jquery integration in tests
Note, the ember-jquery addon re-enables usage of this.$() within components without a depreciation warning.
https://deprecations.emberjs.com/v3.x/#toc_jquery-apis
| JavaScript | mit | Panman8201/ember-froala-editor,froala/ember-froala-editor,froala/ember-froala-editor,Panman8201/ember-froala-editor | ---
+++
@@ -2,6 +2,7 @@
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
+import $ from 'jquery';
module('Integration | Component | froala-content', function(hooks) {
setupRenderingTest(hooks);
@@ -10,7 +11,7 @@
await render(hbs`{{froala-content elementId="editor"}}`);
- assert.ok(this.$('#editor').hasClass('fr-view'));
+ assert.ok($('#editor', this.element).hasClass('fr-view'));
});
|
dc90ee7975d4210e4818d3818e97fe019886c81f | src/app/get-projects.js | src/app/get-projects.js | import ProjectConfigurationRepository from '../domain/project-configuration-repository'
import fs from 'fs'
const repository = new ProjectConfigurationRepository()
/**
* @param {string} path The path to todo.conf.yml
*/
export default (path) => {
const paths = [path, `${process.env.PWD}/${path}`, `${process.env.HOME}/${path}`]
for (let i = 1; i < paths.length; i++) {
let path = paths[i]
if (fs.existsSync(path)) {
return repository.getByPath(path).getProjects()
}
}
throw new Error(`todo config file not found: ${JSON.stringify(paths)}`)
}
| import ProjectConfigurationRepository from '../domain/project-configuration-repository'
import fs from 'fs'
const repository = new ProjectConfigurationRepository()
/**
* @param {string} path The path to todo.conf.yml
*/
export default (path) => {
const paths = [path, `${process.env.PWD}/${path}`, `${process.env.HOME}/.${path}`]
for (let i = 1; i < paths.length; i++) {
let path = paths[i]
if (fs.existsSync(path)) {
return repository.getByPath(path).getProjects()
}
}
throw new Error(`todo config file not found: ${JSON.stringify(paths)}`)
}
| Rename conf file in home dir | Rename conf file in home dir
| JavaScript | mit | kt3k/view-todo,kt3k/view-todo | ---
+++
@@ -9,7 +9,7 @@
*/
export default (path) => {
- const paths = [path, `${process.env.PWD}/${path}`, `${process.env.HOME}/${path}`]
+ const paths = [path, `${process.env.PWD}/${path}`, `${process.env.HOME}/.${path}`]
for (let i = 1; i < paths.length; i++) {
let path = paths[i] |
82c9a371707bd8d85b1f6ebf0004bdfccde4f231 | src/app/index.module.js | src/app/index.module.js | /* global malarkey:false, toastr:false, moment:false */
import config from './index.config';
import routerConfig from './index.route';
import runBlock from './index.run';
import MainController from './main/main.controller';
import GithubContributorService from '../app/components/githubContributor/githubContributor.service';
import WebDevTecService from '../app/components/webDevTec/webDevTec.service';
import NavbarDirective from '../app/components/navbar/navbar.directive';
import MalarkeyDirective from '../app/components/malarkey/malarkey.directive';
import './bookmarks/bookmarks.module';
angular.module('ngBookmarks', ['restangular', 'ngRoute', 'ui.bootstrap', 'bookmarks'])
.constant('malarkey', malarkey)
.constant('toastr', toastr)
.constant('moment', moment)
.config(config)
.config(routerConfig)
.run(runBlock)
.service('githubContributor', GithubContributorService)
.service('webDevTec', WebDevTecService)
.controller('MainController', MainController)
.directive('acmeNavbar', () => new NavbarDirective())
.directive('acmeMalarkey', () => new MalarkeyDirective(malarkey));
| /* global malarkey:false, toastr:false, moment:false */
import config from './index.config';
import routerConfig from './index.route';
import runBlock from './index.run';
import MainController from './main/main.controller';
import GithubContributorService from '../app/components/githubContributor/githubContributor.service';
import WebDevTecService from '../app/components/webDevTec/webDevTec.service';
import NavbarDirective from '../app/components/navbar/navbar.directive';
import MalarkeyDirective from '../app/components/malarkey/malarkey.directive';
import './bookmarks/bookmarks.module';
angular.module('ngBookmarks', ['ngRoute', 'ui.bootstrap', 'bookmarks'])
.constant('malarkey', malarkey)
.constant('toastr', toastr)
.constant('moment', moment)
.config(config)
.config(routerConfig)
.run(runBlock)
.service('githubContributor', GithubContributorService)
.service('webDevTec', WebDevTecService)
.controller('MainController', MainController)
.directive('acmeNavbar', () => new NavbarDirective())
.directive('acmeMalarkey', () => new MalarkeyDirective(malarkey));
| Remove 'restangular' as a direct dependency of the top level app | Remove 'restangular' as a direct dependency of the top level app
| JavaScript | mit | tekerson/ng-bookmarks,tekerson/ng-bookmarks | ---
+++
@@ -11,7 +11,7 @@
import MalarkeyDirective from '../app/components/malarkey/malarkey.directive';
import './bookmarks/bookmarks.module';
-angular.module('ngBookmarks', ['restangular', 'ngRoute', 'ui.bootstrap', 'bookmarks'])
+angular.module('ngBookmarks', ['ngRoute', 'ui.bootstrap', 'bookmarks'])
.constant('malarkey', malarkey)
.constant('toastr', toastr)
.constant('moment', moment) |
231c2560393d2766e924fed02b4a2268aa6e1dc7 | lib/tasks/extra/DocTask.js | lib/tasks/extra/DocTask.js | "use strict";
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
fs = require('fs');
class DocTask extends Task {
constructor(buildManager) {
super(buildManager);
this.command = "doc";
}
action() {
//Dirty trick to capture Mocha output into a file
//since gulp-mocha does not pipe the test output
fs.writeFileSync('./doc.html', '');
var originalWrite = process.stdout.write;
process.stdout.write = function (chunk) {
var textChunk = chunk.toString('utf8');
if (!textChunk.match(/finished.+after/gmi)) {
fs.appendFile('./doc.html', chunk);
}
originalWrite.apply(this, arguments);
};
return gulp.src(this._buildManager.options.test, {read: false})
.pipe(mocha({reporter: 'doc'}));
}
}
module.exports = DocTask; | "use strict";
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
fs = require('fs');
class DocTask extends Task {
constructor(buildManager) {
super(buildManager);
this.command = "doc";
}
action() {
//Dirty trick to capture Mocha output into a file
//since gulp-mocha does not pipe the test output
fs.writeFileSync('./doc.html', '');
var originalWrite = process.stdout.write;
process.stdout.write = function (chunk) {
var textChunk = chunk.toString('utf8');
if (!textChunk.match(/finished.+after/gmi)) {
fs.appendFile('./doc.html', chunk);
}
originalWrite.apply(this, arguments);
};
return gulp.src(this._buildManager.options.test, {read: false})
.pipe(mocha({
reporter: 'doc',
compilers: {
ts: require('ts-node/register'),
js: require('babel-core/register')
}
}));
}
}
module.exports = DocTask; | Add compilers to doc task | Add compilers to doc task
| JavaScript | mit | mtfranchetto/smild,mtfranchetto/smild,mtfranchetto/smild | ---
+++
@@ -26,7 +26,13 @@
};
return gulp.src(this._buildManager.options.test, {read: false})
- .pipe(mocha({reporter: 'doc'}));
+ .pipe(mocha({
+ reporter: 'doc',
+ compilers: {
+ ts: require('ts-node/register'),
+ js: require('babel-core/register')
+ }
+ }));
}
}
|
76813e0e74d12a2ec47830b811fd143f0f1a6781 | zoltar/zoltar.js | zoltar/zoltar.js | // Module for interacting with zoltar
const rp = require('request-promise-native')
const buildUrl = require('build-url')
async function get (url) {
return rp(url, { json: true })
}
async function gets (url) {
return rp(url, { json: false })
}
function proxifyObject (obj, root) {
let handler = {
get(target, propKey, receiver) {
let value = target[propKey]
if (typeof value === 'string' && (value.toString()).startsWith(root)) {
return (async () => {
let resp = await get(value)
return proxifyObject(resp, root)
})()
} else if (typeof value === 'object') {
return proxifyObject(value, root)
} else {
return value
}
}
}
return new Proxy(obj, handler)
}
function zoltar (rootUrl) {
let baseObject = {
projects: `${rootUrl}/projects`
}
return proxifyObject(baseObject, rootUrl)
}
module.exports.zoltar = zoltar
| // Module for interacting with zoltar
const rp = require('request-promise-native')
const buildUrl = require('build-url')
async function get (url) {
return rp(url, { json: true })
}
async function gets (url) {
return rp(url, { json: false })
}
function proxifyObject (obj, root) {
let handler = {
get(target, propKey, receiver) {
let value = target[propKey]
switch (propKey.toString()) {
case 'url':
return value
case 'csv':
{
if ('forecast_data' in target) {
return (async () => {
let resp = await gets(`${target['forecast_data']}?format=csv`)
return resp
})()
} else {
throw new Error('This is not a forecast object')
}
}
}
if (typeof value === 'string' && (value.toString()).startsWith(root)) {
return (async () => {
let resp = await get(value)
return proxifyObject(resp, root)
})()
} else if (typeof value === 'object') {
return proxifyObject(value, root)
} else {
return value
}
}
}
return new Proxy(obj, handler)
}
function zoltar (rootUrl) {
let baseObject = {
projects: `${rootUrl}/projects`
}
return proxifyObject(baseObject, rootUrl)
}
module.exports.zoltar = zoltar
| Handle url and csv getters separately | Handle url and csv getters separately
| JavaScript | mit | reichlab/flusight,reichlab/flusight,reichlab/flusight | ---
+++
@@ -15,6 +15,22 @@
let handler = {
get(target, propKey, receiver) {
let value = target[propKey]
+
+ switch (propKey.toString()) {
+ case 'url':
+ return value
+ case 'csv':
+ {
+ if ('forecast_data' in target) {
+ return (async () => {
+ let resp = await gets(`${target['forecast_data']}?format=csv`)
+ return resp
+ })()
+ } else {
+ throw new Error('This is not a forecast object')
+ }
+ }
+ }
if (typeof value === 'string' && (value.toString()).startsWith(root)) {
return (async () => { |
c3888cc45823cb0bb5112b8e20eaacbf7ff58d7b | app/assets/javascripts/angular/common/services/auth-service.js | app/assets/javascripts/angular/common/services/auth-service.js | (function(){
'use strict';
angular.module('secondLead.common')
.factory('Auth', ['$http', 'store', function($http, store) {
return {
isAuthenticated: function() {
return store.get('jwt');
},
login: function(credentials) {
var login = $http.post('/auth/login', credentials);
login.success(function(result) {
store.set('jwt', result.token);
store.set('user', result.user);
});
return login;
},
logout: function() {
store.remove('jwt');
store.remove('user');
}
};
}])
})(); | (function(){
'use strict';
angular.module('secondLead.common')
.factory('Auth', ['$http', 'store', function($http, store) {
return {
isAuthenticated: function() {
return store.get('jwt');
},
login: function(credentials) {
var login = $http.post('/auth/login', credentials);
login.success(function(result) {
store.set('jwt', result.token);
store.set('user', result.user);
});
return login;
},
logout: function() {
var clearJWT = store.remove('jwt');
var clearUser = store.remove('user');
return {
jwt: clearJWT,
user: clearUser
};
}
};
}])
})(); | Refactor logout in auth service | Refactor logout in auth service
| JavaScript | mit | ac-adekunle/secondlead,ac-adekunle/secondlead,ac-adekunle/secondlead | ---
+++
@@ -19,8 +19,12 @@
},
logout: function() {
- store.remove('jwt');
- store.remove('user');
+ var clearJWT = store.remove('jwt');
+ var clearUser = store.remove('user');
+ return {
+ jwt: clearJWT,
+ user: clearUser
+ };
}
}; |
064be8a3d6833c5cbe591cbc9241b8c7bbc32796 | client/app/states/marketplace/details/details.state.js | client/app/states/marketplace/details/details.state.js | (function() {
'use strict';
angular.module('app.states')
.run(appRun);
/** @ngInject */
function appRun(routerHelper) {
routerHelper.configureStates(getStates());
}
function getStates() {
return {
'marketplace.details': {
url: '/:serviceTemplateId',
templateUrl: 'app/states/marketplace/details/details.html',
controller: StateController,
controllerAs: 'vm',
title: 'Service Template Details',
resolve: {
serviceTemplate: resolveServiceTemplate
}
}
};
}
/** @ngInject */
function resolveServiceTemplate($stateParams, CollectionsApi) {
return CollectionsApi.get('service_templates', $stateParams.serviceTemplateId);
}
/** @ngInject */
function StateController(serviceTemplate) {
var vm = this;
vm.title = 'Service Template Details';
vm.serviceTemplate = serviceTemplate;
}
})();
| (function() {
'use strict';
angular.module('app.states')
.run(appRun);
/** @ngInject */
function appRun(routerHelper) {
routerHelper.configureStates(getStates());
}
function getStates() {
return {
'marketplace.details': {
url: '/:serviceTemplateId',
templateUrl: 'app/states/marketplace/details/details.html',
controller: StateController,
controllerAs: 'vm',
title: 'Service Template Details',
resolve: {
dialogs: resolveDialogs,
serviceTemplate: resolveServiceTemplate
}
}
};
}
/** @ngInject */
function resolveServiceTemplate($stateParams, CollectionsApi) {
return CollectionsApi.get('service_templates', $stateParams.serviceTemplateId);
}
/** @ngInject */
function resolveDialogs($stateParams, CollectionsApi) {
var options = {expand: true, attributes: 'content'};
return CollectionsApi.query('service_templates/' + $stateParams.serviceTemplateId + '/service_dialogs', options);
}
/** @ngInject */
function StateController(dialogs, serviceTemplate) {
var vm = this;
vm.title = 'Service Template Details';
vm.dialogs = dialogs.resources[0].content;
vm.serviceTemplate = serviceTemplate;
}
})();
| Add API call to return service dialogs | Add API call to return service dialogs
https://trello.com/c/qfdnTNlk
| JavaScript | apache-2.0 | ManageIQ/manageiq-ui-self_service,AllenBW/manageiq-ui-service,AllenBW/manageiq-ui-service,ManageIQ/manageiq-ui-service,dtaylor113/manageiq-ui-self_service,AllenBW/manageiq-ui-service,ManageIQ/manageiq-ui-service,ManageIQ/manageiq-ui-self_service,dtaylor113/manageiq-ui-self_service,ManageIQ/manageiq-ui-self_service,AllenBW/manageiq-ui-service,dtaylor113/manageiq-ui-self_service,ManageIQ/manageiq-ui-service | ---
+++
@@ -18,6 +18,7 @@
controllerAs: 'vm',
title: 'Service Template Details',
resolve: {
+ dialogs: resolveDialogs,
serviceTemplate: resolveServiceTemplate
}
}
@@ -30,10 +31,18 @@
}
/** @ngInject */
- function StateController(serviceTemplate) {
+ function resolveDialogs($stateParams, CollectionsApi) {
+ var options = {expand: true, attributes: 'content'};
+
+ return CollectionsApi.query('service_templates/' + $stateParams.serviceTemplateId + '/service_dialogs', options);
+ }
+
+ /** @ngInject */
+ function StateController(dialogs, serviceTemplate) {
var vm = this;
vm.title = 'Service Template Details';
+ vm.dialogs = dialogs.resources[0].content;
vm.serviceTemplate = serviceTemplate;
}
})(); |
ce58e8eb67d354f624a4965e965fdf0c047433bf | ReactTests/mocks/MockPromise.js | ReactTests/mocks/MockPromise.js | class MockPromise {
constructor(returnSuccess, result) {
this.returnSuccess = returnSuccess;
this.result = result || (returnSuccess ? 'my data': 'my error')
}
then(success, failure) {
if (this.returnSuccess) {
success(this.result);
}
else {
failure(this.result);
}
}
}
export default MockPromise
| //This is a super-simple mock of a JavaScript Promise
//It only implement the 'then(success, failure)' function
//as that is the only function that the kanban calls
//in the modules that use the KanbanApi
class MockPromise {
constructor(returnSuccess, result) {
this.returnSuccess = returnSuccess;
this.result = result || (returnSuccess ? 'my data': 'my error')
}
then(success, failure) {
if (this.returnSuccess) {
success(this.result);
}
else {
failure(this.result);
}
}
}
export default MockPromise
| Comment to say its a limited mock of a promise | Comment to say its a limited mock of a promise
| JavaScript | mit | JonPSmith/AspNetReactSamples,JonPSmith/AspNetReactSamples,JonPSmith/AspNetReactSamples | ---
+++
@@ -1,4 +1,8 @@
-class MockPromise {
+//This is a super-simple mock of a JavaScript Promise
+//It only implement the 'then(success, failure)' function
+//as that is the only function that the kanban calls
+//in the modules that use the KanbanApi
+class MockPromise {
constructor(returnSuccess, result) {
this.returnSuccess = returnSuccess;
this.result = result || (returnSuccess ? 'my data': 'my error') |
0159ff31725252f1a04451c297258e17872a4a01 | app/js/app.js | app/js/app.js | window.ContactManager = {
Models: {},
Collections: {},
Views: {},
start: function(data) {
var contacts = new ContactManager.Collections.Contacts(data.contacts),
router = new ContactManager.Router();
router.on('route:home', function() {
router.navigate('contacts', {
trigger: true,
replace: true
});
});
router.on('route:showContacts', function() {
var contactsView = new ContactManager.Views.Contacts({
collection: contacts
});
$('.main-container').html(contactsView.render().$el);
});
router.on('route:newContact', function() {
var newContactForm = new ContactManager.Views.ContactForm({
model: new ContactManager.Models.Contact()
});
newContactForm.on('form:submitted', function(attrs) {
attrs.id = contacts.isEmpty() ? 1 : (_.max(contacts.pluck('id')) + 1);
contacts.add(attrs);
router.navigate('contacts', true);
});
$('.main-container').html(newContactForm.render().$el);
});
router.on('route:editContact', function(id) {
var contact = contacts.get(id),
editContactForm;
if (contact) {
editContactForm = new ContactManager.Views.ContactForm({
model: contact
});
$('.main-container').html(editContactForm.render().$el);
} else {
router.navigate('contacts', true);
}
});
Backbone.history.start();
}
};
| window.ContactManager = {
Models: {},
Collections: {},
Views: {},
start: function(data) {
var contacts = new ContactManager.Collections.Contacts(data.contacts),
router = new ContactManager.Router();
router.on('route:home', function() {
router.navigate('contacts', {
trigger: true,
replace: true
});
});
router.on('route:showContacts', function() {
var contactsView = new ContactManager.Views.Contacts({
collection: contacts
});
$('.main-container').html(contactsView.render().$el);
});
router.on('route:newContact', function() {
var newContactForm = new ContactManager.Views.ContactForm({
model: new ContactManager.Models.Contact()
});
newContactForm.on('form:submitted', function(attrs) {
attrs.id = contacts.isEmpty() ? 1 : (_.max(contacts.pluck('id')) + 1);
contacts.add(attrs);
router.navigate('contacts', true);
});
$('.main-container').html(newContactForm.render().$el);
});
router.on('route:editContact', function(id) {
var contact = contacts.get(id),
editContactForm;
if (contact) {
editContactForm = new ContactManager.Views.ContactForm({
model: contact
});
editContactForm.on('form:submitted', function(attrs) {
contact.set(attrs);
router.navigate('contacts', true);
});
$('.main-container').html(editContactForm.render().$el);
} else {
router.navigate('contacts', true);
}
});
Backbone.history.start();
}
};
| Update contact on form submitted | Update contact on form submitted
| JavaScript | mit | giastfader/backbone-contact-manager,EaswarRaju/angular-contact-manager,SomilKumar/backbone-contact-manager,vinnu-313/backbone-contact-manager,dmytroyarmak/backbone-contact-manager,SomilKumar/backbone-contact-manager,hrundik/angular-contact-manager,hrundik/angular-contact-manager,giastfader/backbone-contact-manager,hrundik/angular-contact-manager,vinnu-313/backbone-contact-manager | ---
+++
@@ -45,6 +45,11 @@
model: contact
});
+ editContactForm.on('form:submitted', function(attrs) {
+ contact.set(attrs);
+ router.navigate('contacts', true);
+ });
+
$('.main-container').html(editContactForm.render().$el);
} else {
router.navigate('contacts', true); |
fa025070c1eeb7e751b4b7210cce4e088781e2bc | app/assets/javascripts/messages.js | app/assets/javascripts/messages.js | function scrollToBottom() {
var $messages = $('#messages');
if ($messages.length > 0) {
$messages.scrollTop($messages[0].scrollHeight);
}
}
$(document).ready(scrollToBottom);
| function scrollToBottom() {
var $messages = $('#messages');
if ($messages.length > 0) {
$messages.scrollTop($messages[0].scrollHeight);
}
}
$(document).ready(scrollToBottom);
$(document).on('turbolinks:load', scrollToBottom);
| Fix scrollToBottom action on turbolinks:load | Fix scrollToBottom action on turbolinks:load
| JavaScript | mit | JulianNicholls/BuffetCar-5,JulianNicholls/BuffetCar-5,JulianNicholls/BuffetCar-5 | ---
+++
@@ -7,3 +7,4 @@
}
$(document).ready(scrollToBottom);
+$(document).on('turbolinks:load', scrollToBottom); |
4deeb7ddc71647bafc1f932e6590d9b58e6b7af3 | Resize/script.js | Resize/script.js | function adjustStyle() {
var width = 0;
// get the width.. more cross-browser issues
if (window.innerHeight) {
width = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientHeight) {
width = document.documentElement.clientWidth;
} else if (document.body) {
width = document.body.clientWidth;
}
// now we should have it
if (width < 600) {
document.getElementById("myCSS").setAttribute("href", "_css/narrow.css");
} else {
document.getElementById("myCSS").setAttribute("href", "_css/main.css");
}
}
// now call it when the window is resized.
window.onresize = function () {
adjustStyle();
};
| function adjustStyle() {
var width = 0;
// get the width.. more cross-browser issues
if (window.innerHeight) {
width = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientHeight) {
width = document.documentElement.clientWidth;
} else if (document.body) {
width = document.body.clientWidth;
}
// now we should have it
if (width < 600) {
document.getElementById("myCSS").setAttribute("href", "_css/narrow.css");
} else {
document.getElementById("myCSS").setAttribute("href", "_css/main.css");
}
}
// now call it when the window is resized.
window.onresize = function () {
adjustStyle();
};
window.onload = function () {
adjustStyle();
}; | Add window.onload for style adjust | Add window.onload for style adjust
| JavaScript | mit | SHoar/lynda_essentialJStraining | ---
+++
@@ -21,3 +21,6 @@
adjustStyle();
};
+window.onload = function () {
+ adjustStyle();
+}; |
43d771162f5993035a231857d02e97d94e74c3a6 | koans/AboutPromises.js | koans/AboutPromises.js | describe("About Promises", function () {
describe("Asynchronous Flow", function () {
it("should understand promise usage", function () {
function isZero(number) {
return new Promise(function(resolve, reject) {
if(number === 0) {
resolve();
} else {
reject(number + ' is not zero!');
}
})
}
expect(isZero(0) instanceof Promise).toEqual(FILL_ME_IN);
expect(typeof isZero(0)).toEqual(FILL_ME_IN);
});
});
});
| describe("About Promises", function () {
describe("Asynchronous Flow", function () {
it("should understand Promise type", function () {
function promise(number) {
return new Promise(function(resolve, reject) {
resolve();
})
}
// expect(promise() instanceof Promise).toEqual(FILL_ME_IN);
// expect(typeof promise()).toEqual(FILL_ME_IN);
});
it('should understand a Promise can be fulfilled / resolved', function(done) {
function promiseResolved() {
return new Promise(function(resolve, reject) {
resolve('promise me this');
});
}
promiseResolved()
.then(function(promiseValue) {
expect(promiseValue).toEqual(promiseValue);
})
.then(done)
})
});
});
| Add in extra promise koan | feat: Add in extra promise koan
| JavaScript | mit | tawashley/es6-javascript-koans,tawashley/es6-javascript-koans,tawashley/es6-javascript-koans | ---
+++
@@ -2,20 +2,32 @@
describe("Asynchronous Flow", function () {
- it("should understand promise usage", function () {
+ it("should understand Promise type", function () {
- function isZero(number) {
+ function promise(number) {
return new Promise(function(resolve, reject) {
- if(number === 0) {
resolve();
- } else {
- reject(number + ' is not zero!');
- }
})
}
- expect(isZero(0) instanceof Promise).toEqual(FILL_ME_IN);
- expect(typeof isZero(0)).toEqual(FILL_ME_IN);
+ // expect(promise() instanceof Promise).toEqual(FILL_ME_IN);
+ // expect(typeof promise()).toEqual(FILL_ME_IN);
});
+
+ it('should understand a Promise can be fulfilled / resolved', function(done) {
+
+ function promiseResolved() {
+ return new Promise(function(resolve, reject) {
+ resolve('promise me this');
+ });
+ }
+
+ promiseResolved()
+ .then(function(promiseValue) {
+ expect(promiseValue).toEqual(promiseValue);
+ })
+ .then(done)
+ })
+
});
}); |
4e1b78d76157761c251ecdf10cf6126ea03479e5 | app/templates/src/main/webapp/scripts/app/account/social/directive/_social.directive.js | app/templates/src/main/webapp/scripts/app/account/social/directive/_social.directive.js | 'use strict';
angular.module('<%=angularAppName%>')
.directive('jhSocial', function($translatePartialLoader, $translate, $filter, SocialService) {
return {
restrict: 'E',
scope: {
provider: "@ngProvider"
},
templateUrl: 'scripts/app/account/social/directive/social.html',
link: function(scope, element, attrs) {
$translatePartialLoader.addPart('social');
$translate.refresh();
scope.label = $filter('capitalize')(scope.provider);
scope.providerSetting = SocialService.getProviderSetting(scope.provider);
scope.providerURL = SocialService.getProviderURL(scope.provider);
scope.csrf = SocialService.getCSRF();
}
}
});
| 'use strict';
angular.module('<%=angularAppName%>')
.directive('jhSocial', function(<% if (enableTranslation){ %>$translatePartialLoader, $translate, <% } %>$filter, SocialService) {
return {
restrict: 'E',
scope: {
provider: "@ngProvider"
},
templateUrl: 'scripts/app/account/social/directive/social.html',
link: function(scope, element, attrs) {<% if (enableTranslation){ %>
$translatePartialLoader.addPart('social');
$translate.refresh();
<% } %>
scope.label = $filter('capitalize')(scope.provider);
scope.providerSetting = SocialService.getProviderSetting(scope.provider);
scope.providerURL = SocialService.getProviderURL(scope.provider);
scope.csrf = SocialService.getCSRF();
}
}
});
| Fix translation issue in the social login | Fix translation issue in the social login
| JavaScript | apache-2.0 | yongli82/generator-jhipster,rkohel/generator-jhipster,dimeros/generator-jhipster,danielpetisme/generator-jhipster,Tcharl/generator-jhipster,Tcharl/generator-jhipster,maniacneron/generator-jhipster,sendilkumarn/generator-jhipster,erikkemperman/generator-jhipster,atomfrede/generator-jhipster,ziogiugno/generator-jhipster,cbornet/generator-jhipster,siliconharborlabs/generator-jhipster,dynamicguy/generator-jhipster,wmarques/generator-jhipster,duderoot/generator-jhipster,dalbelap/generator-jhipster,xetys/generator-jhipster,dynamicguy/generator-jhipster,jkutner/generator-jhipster,maniacneron/generator-jhipster,ramzimaalej/generator-jhipster,ruddell/generator-jhipster,sohibegit/generator-jhipster,mosoft521/generator-jhipster,baskeboler/generator-jhipster,duderoot/generator-jhipster,mraible/generator-jhipster,duderoot/generator-jhipster,liseri/generator-jhipster,sendilkumarn/generator-jhipster,dimeros/generator-jhipster,ziogiugno/generator-jhipster,nkolosnjaji/generator-jhipster,gzsombor/generator-jhipster,hdurix/generator-jhipster,mraible/generator-jhipster,sendilkumarn/generator-jhipster,liseri/generator-jhipster,eosimosu/generator-jhipster,dynamicguy/generator-jhipster,xetys/generator-jhipster,lrkwz/generator-jhipster,ctamisier/generator-jhipster,jkutner/generator-jhipster,wmarques/generator-jhipster,ctamisier/generator-jhipster,sohibegit/generator-jhipster,wmarques/generator-jhipster,sohibegit/generator-jhipster,JulienMrgrd/generator-jhipster,lrkwz/generator-jhipster,lrkwz/generator-jhipster,nkolosnjaji/generator-jhipster,JulienMrgrd/generator-jhipster,robertmilowski/generator-jhipster,dalbelap/generator-jhipster,gzsombor/generator-jhipster,ctamisier/generator-jhipster,mosoft521/generator-jhipster,erikkemperman/generator-jhipster,gmarziou/generator-jhipster,vivekmore/generator-jhipster,jhipster/generator-jhipster,rifatdover/generator-jhipster,cbornet/generator-jhipster,hdurix/generator-jhipster,Tcharl/generator-jhipster,eosimosu/generator-jhipster,dimeros/generator-jhipster,yongli82/generator-jhipster,baskeboler/generator-jhipster,duderoot/generator-jhipster,maniacneron/generator-jhipster,nkolosnjaji/generator-jhipster,deepu105/generator-jhipster,stevehouel/generator-jhipster,danielpetisme/generator-jhipster,gzsombor/generator-jhipster,baskeboler/generator-jhipster,JulienMrgrd/generator-jhipster,atomfrede/generator-jhipster,erikkemperman/generator-jhipster,hdurix/generator-jhipster,siliconharborlabs/generator-jhipster,dalbelap/generator-jhipster,gmarziou/generator-jhipster,lrkwz/generator-jhipster,danielpetisme/generator-jhipster,dimeros/generator-jhipster,gzsombor/generator-jhipster,stevehouel/generator-jhipster,ramzimaalej/generator-jhipster,vivekmore/generator-jhipster,jkutner/generator-jhipster,mosoft521/generator-jhipster,jkutner/generator-jhipster,siliconharborlabs/generator-jhipster,pascalgrimaud/generator-jhipster,Tcharl/generator-jhipster,Tcharl/generator-jhipster,yongli82/generator-jhipster,PierreBesson/generator-jhipster,rkohel/generator-jhipster,hdurix/generator-jhipster,eosimosu/generator-jhipster,atomfrede/generator-jhipster,cbornet/generator-jhipster,baskeboler/generator-jhipster,ruddell/generator-jhipster,deepu105/generator-jhipster,mraible/generator-jhipster,ctamisier/generator-jhipster,ruddell/generator-jhipster,gzsombor/generator-jhipster,ruddell/generator-jhipster,erikkemperman/generator-jhipster,gmarziou/generator-jhipster,maniacneron/generator-jhipster,cbornet/generator-jhipster,gmarziou/generator-jhipster,JulienMrgrd/generator-jhipster,siliconharborlabs/generator-jhipster,deepu105/generator-jhipster,jhipster/generator-jhipster,pascalgrimaud/generator-jhipster,yongli82/generator-jhipster,vivekmore/generator-jhipster,pascalgrimaud/generator-jhipster,atomfrede/generator-jhipster,stevehouel/generator-jhipster,atomfrede/generator-jhipster,ctamisier/generator-jhipster,jkutner/generator-jhipster,xetys/generator-jhipster,wmarques/generator-jhipster,mosoft521/generator-jhipster,wmarques/generator-jhipster,deepu105/generator-jhipster,rkohel/generator-jhipster,maniacneron/generator-jhipster,ziogiugno/generator-jhipster,jhipster/generator-jhipster,sendilkumarn/generator-jhipster,mosoft521/generator-jhipster,eosimosu/generator-jhipster,nkolosnjaji/generator-jhipster,cbornet/generator-jhipster,stevehouel/generator-jhipster,ramzimaalej/generator-jhipster,gmarziou/generator-jhipster,jhipster/generator-jhipster,danielpetisme/generator-jhipster,pascalgrimaud/generator-jhipster,lrkwz/generator-jhipster,mraible/generator-jhipster,dimeros/generator-jhipster,erikkemperman/generator-jhipster,jhipster/generator-jhipster,vivekmore/generator-jhipster,siliconharborlabs/generator-jhipster,JulienMrgrd/generator-jhipster,liseri/generator-jhipster,baskeboler/generator-jhipster,PierreBesson/generator-jhipster,ruddell/generator-jhipster,dalbelap/generator-jhipster,hdurix/generator-jhipster,nkolosnjaji/generator-jhipster,danielpetisme/generator-jhipster,liseri/generator-jhipster,vivekmore/generator-jhipster,robertmilowski/generator-jhipster,sendilkumarn/generator-jhipster,xetys/generator-jhipster,deepu105/generator-jhipster,robertmilowski/generator-jhipster,PierreBesson/generator-jhipster,pascalgrimaud/generator-jhipster,liseri/generator-jhipster,rkohel/generator-jhipster,PierreBesson/generator-jhipster,duderoot/generator-jhipster,PierreBesson/generator-jhipster,mraible/generator-jhipster,stevehouel/generator-jhipster,rkohel/generator-jhipster,rifatdover/generator-jhipster,yongli82/generator-jhipster,ziogiugno/generator-jhipster,robertmilowski/generator-jhipster,robertmilowski/generator-jhipster,eosimosu/generator-jhipster,ziogiugno/generator-jhipster,sohibegit/generator-jhipster,sohibegit/generator-jhipster,dynamicguy/generator-jhipster,dalbelap/generator-jhipster,rifatdover/generator-jhipster | ---
+++
@@ -1,17 +1,17 @@
'use strict';
angular.module('<%=angularAppName%>')
- .directive('jhSocial', function($translatePartialLoader, $translate, $filter, SocialService) {
+ .directive('jhSocial', function(<% if (enableTranslation){ %>$translatePartialLoader, $translate, <% } %>$filter, SocialService) {
return {
restrict: 'E',
scope: {
provider: "@ngProvider"
},
templateUrl: 'scripts/app/account/social/directive/social.html',
- link: function(scope, element, attrs) {
+ link: function(scope, element, attrs) {<% if (enableTranslation){ %>
$translatePartialLoader.addPart('social');
$translate.refresh();
-
+<% } %>
scope.label = $filter('capitalize')(scope.provider);
scope.providerSetting = SocialService.getProviderSetting(scope.provider);
scope.providerURL = SocialService.getProviderURL(scope.provider); |
afcb675b6681611867be57c523a58b0ba4d831b4 | lib/componentHelper.js | lib/componentHelper.js | var
fs = require('fs'),
Builder = require('component-builder'),
rimraf = require('rimraf'),
config = require('../config'),
utils = require('./utils'),
component = require('./component'),
options = {
dest: config.componentInstallDir
};
/**
* Installs `model`s component from registry
* into the install dir
*
* @param {Model} model
* @param {Function} callback
*/
exports.install = function (model, callback) {
var pkg = component.install(model.repo, '*', options);
pkg.on('end', callback);
pkg.install();
};
/**
* Builds component from model's attributes,
* calls callback with err and built js in UTF-8
*
* @param {Model} model
* @param {Function} callback
*/
exports.build = function (model, callback) {
var builder = new Builder(utils.getInstallDir(model.repo));
builder.addLookup(config.componentInstallDir);
builder.build(function (err, res) {
if (err || (res && !res.js)) {
return callback(err);
}
callback(err, res.js);
});
};
/**
* Deletes all components in the install dir
*
* @param {Function} callback
*/
exports.clearInstall = function (callback) {
rimraf(config.componentInstallDir, function (err) {
callback(err);
});
};
| var
fs = require('fs-extra'),
Builder = require('component-builder'),
config = require('../config'),
utils = require('./utils'),
component = require('./component'),
options = {
dest: config.componentInstallDir
};
/**
* Installs `model`s component from registry
* into the install dir
*
* @param {Model} model
* @param {Function} callback
*/
exports.install = function (model, callback) {
var pkg = component.install(model.repo, '*', options);
pkg.on('end', callback);
pkg.install();
};
/**
* Builds component from model's attributes,
* calls callback with err and built js in UTF-8
*
* @param {Model} model
* @param {Function} callback
*/
exports.build = function (model, callback) {
var builder = new Builder(utils.getInstallDir(model.repo));
builder.addLookup(config.componentInstallDir);
builder.build(function (err, res) {
if (err || (res && !res.js)) {
return callback(err);
}
callback(err, res.js);
});
};
/**
* Deletes all components in the install dir
*
* @param {Function} callback
*/
exports.clearInstall = function (callback) {
fs.remove(config.componentInstallDir, function (err) {
console.log('fs-extra remove: ', err, err && err.stack);
callback(err);
});
};
| Use fs-extra to remove recurisvely rather than rimraf | Use fs-extra to remove recurisvely rather than rimraf
| JavaScript | mit | web-audio-components/web-audio-components-service | ---
+++
@@ -1,7 +1,6 @@
var
- fs = require('fs'),
+ fs = require('fs-extra'),
Builder = require('component-builder'),
- rimraf = require('rimraf'),
config = require('../config'),
utils = require('./utils'),
component = require('./component'),
@@ -48,7 +47,8 @@
* @param {Function} callback
*/
exports.clearInstall = function (callback) {
- rimraf(config.componentInstallDir, function (err) {
+ fs.remove(config.componentInstallDir, function (err) {
+ console.log('fs-extra remove: ', err, err && err.stack);
callback(err);
});
}; |
974405ece1e52023ee05c962bb6dc9991e248e58 | bin/server.js | bin/server.js | import config from '../config'
import server from '../server/main'
import _debug from 'debug'
const debug = _debug('app:bin:server')
const port = config.server_port
const host = config.server_host
server.listen(port)
debug(`Server is now running at ${host}:${port}.`)
| import config from '../config'
import server from '../server/main'
import _debug from 'debug'
const debug = _debug('app:bin:server')
const port = config.server_port
const host = config.server_host
server.listen(port)
debug(`Server is now running at http://${host}:${port}.`)
| Make the app link clickable | chore(compile): Make the app link clickable
This small change makes the link clickable in some terminal emulators (like xfce-terminal), which makes it easier to open the app in a browser.
| JavaScript | mit | tonyxiao/segment-debugger,jaronoff97/listmkr,tonyxiao/segment-debugger,pptang/ggm,JohanGustafsson91/React-JWT-Authentication-Redux-Router,VladGne/Practice2017,Vaishali512/mysampleapp,okmttdhr/aupa,chozandrias76/responsive-sesame-test,gohup/react_testcase,GreGGus/MIMApp,EngineerMostafa/CircleCI,flftfqwxf/react-redux-starter-kit,lf2941270/react-zhihu-daily,jhash/jhash,flftfqwxf/react-redux-starter-kit,GreGGus/MIMApp,przeor/ReactC,josedab/react-redux-i18n-starter-kit,andreasnc/summer-project-tasks-2017,Dimitrievskislavcho/funfunfuncReduxCI,kolyaka006/imaginarium,rui19921122/StationTransformBrowserClient,KNMI/GeoWeb-FrontEnd,houston88/housty-home-react,z0d14c/system-performance-viewer,gabrielmf/SIR-EDU-2.0,theosherry/mx_pl,hustlrb/yjbAdmin,parkgaram/solidware-mini-project,rui19921122/StationTransformBrowserClient,maartenlterpstra/GeoWeb-FrontEnd,przeor/ReactC,KNMI/GeoWeb-FrontEnd,SteveHoggNZ/Choice-As,Gouthamve/BINS-FRONT,jarirepo/simple-ci-test-app,dfalling/todo,duongthien291291/react-redux-starter-kit-munchery-theme,haozeng/react-redux-filter,SteveHoggNZ/Choice-As,vasekric/regrinder,dingyoujian/webpack-react-demo,PalmasLab/palmasplay,dannyrdalton/example_signup_flow,ahthamrin/kbri-admin2,ahthamrin/kbri-admin2,flftfqwxf/react-redux-starter-kit,stefanwille/react-gameoflife,paulmorar/jxpectapp,gohup/react_testcase,arseneyr/yt-party,guileen/react-forum,piu130/react-redux-gpa-app,baronkwan/ig_clone,rwenor/react-ci-app,dannyrdalton/example_signup_flow,cohenpts/CircleCITut,tylerbarabas/bbTools,corbinpage/react-play,haozeng/react-redux-filter,diMosellaAtWork/GeoWeb-FrontEnd,jeffaustin81/cropcompass-ui,roychoo/upload-invoices,eunvanz/handpokemon2,lf2941270/react-zhihu-daily,dkushner/ArborJs-Playground,willthefirst/book-buddy,fhassa/my-react-redux-start-ki,far-fetched/kiwi,duongthien291291/react-redux-starter-kit-munchery-theme,corbinpage/react-play,learningnewthings/funfunapp,pachoulie/projects,maartenlterpstra/GeoWeb-FrontEnd,flftfqwxf/react-redux-starter-kit,gribilly/react-redux-starter-kit,yangbin1994/react-redux-starter-kit,neverfox/react-redux-starter-kit,tkshi/q,tkshi/q,codingarchitect/react-counter-pair,stranbury/react-miuus,flftfqwxf/react-redux-starter-kit,treeforever/voice-recognition-photo-gallary,VladGne/Practice2017,rrlk/se2present,Vaishali512/mysampleapp,ahthamrin/kbri-admin2,Sixtease/MakonReact,simors/yjbAdmin,TestKitt/TestKittUI,treeforever/voice-recognition-photo-gallary,bhoomit/formula-editor,jhash/jhash,techcoop/techcoop.group,NguyenManh94/circle-ci,huangc28/palestine,guileen/react-forum,B1ll1/CircleCI,josedab/react-redux-i18n-starter-kit,pawelniewie/zen,sonofbjorn/circle-ci-test,sljuka/buzzler-ui,eunvanz/flowerhada,stranbury/react-miuus,weixing2014/iTodo,ethcards/react-redux-starter-kit,filucian/funfunapp,VinodJayasinghe/CircleCI,OlivierWinsemius/circleci_test,thanhiro/techmatrix,kevinchiu/react-redux-starter-kit,pawelniewie/czy-to-jest-paleo,longseespace/quickflix,parkgaram/solidware-mini-project,commute-sh/commute-web,loliver/anz-code-test,oliveirafabio/wut-blog,flftfqwxf/react-redux-starter-kit,atomdmac/roc-game-dev-gallery,danieljwest/ExamGenerator,wilwong89/didactic-web-game,weixing2014/iTodo,dfalling/todo,flftfqwxf/react-redux-starter-kit,j3dimaster/CircleCi-test,nkostelnik/blaiseclicks,febobo/react-redux-start,OlivierWinsemius/circleci_test,hustlrb/yjbAdmin,davezuko/wirk-starter,pptang/ggm,dmassaneiro/integracao-continua,billdevcode/spaceship-emporium,janoist1/route-share,arseneyr/yt-party,larsdolvik/portfolio,flftfqwxf/react-redux-starter-kit,chozandrias76/responsive-sesame-test,kerwynrg/company-crud-app,youdeshi/single-page-app-best-practice-client,PalmasLab/palmasplay,jhardin293/style-guide-manager,jarirepo/simple-ci-test-app,KNMI/GeoWeb-FrontEnd,wswoodruff/strangeluv-native,levsero/planning-app-ui,sonofbjorn/circle-ci-test,flftfqwxf/react-redux-starter-kit,bhoomit/formula-editor,stefanwille/react-gameoflife,Sixtease/MakonReact,kolpav/react-redux-starter-kit,Sixtease/MakonReact,davezuko/wirk-starter,Anomen/universal-react-redux-starter-kit,z0d14c/system-performance-viewer,paulmorar/jxpectapp,theosherry/mx_pl,Stas-Buzunko/cyber-school,adrienhobbs/redux-glow,baronkwan/ig_clone,jakehm/mapgame2,Dylan1312/pool-elo,k2data/react-redux-starter-kit,atomdmac/roc-game-dev-gallery,Ryann10/hci_term,janoist1/route-share,techcoop/techcoop.group,gribilly/react-redux-starter-kit,nodepie/react-redux-starter-kit,adrienhobbs/redux-glow,codingarchitect/react-counter-pair,NguyenManh94/circle-ci,Gouthamve/BINS-FRONT,Croissong/sntModelViewer,davezuko/react-redux-starter-kit,okmttdhr/aupa,rrlk/se2present,popaulina/grackle,VinodJayasinghe/CircleCI,nivas8292/myapp,flftfqwxf/react-redux-starter-kit,aibolik/my-todomvc,kolpav/react-redux-starter-kit,jeffaustin81/cropcompass-ui,kerwynrg/company-crud-app,simors/yjbAdmin,thanhiro/techmatrix,eunvanz/flowerhada,ethcards/react-redux-starter-kit,z0d14c/system-performance-viewer,EngineerMostafa/CircleCI,warcraftlfg/warcrafthub-client,learningnewthings/funfunapp,Dylan1312/pool-elo,Ryann10/hci_term,B1ll1/CircleCI,maartenplieger/GeoWeb-FrontEnd,anthonyraymond/react-redux-starter-kit,flftfqwxf/react-redux-starter-kit,levkus/react-overcounters2,gReis89/sam-ovens-website,chozandrias76/responsive-sesame-test,lodelestra/SWClermont_2016,roslaneshellanoo/react-redux-tutorial,MingYinLv/blog-admin,damirv/react-redux-starter-kit,pachoulie/projects,cohenpts/CircleCITut,larsdolvik/portfolio,Croissong/sntModelViewer,BigRoomStudios/strangeluv,alukach/react-map-app,commute-sh/commute-web,davezuko/react-redux-starter-kit,3a-classic/score,oliveirafabio/wut-blog,wilwong89/didactic-web-game,fhassa/my-react-redux-start-ki,armaanshah96/lunchbox,rwenor/react-ci-app,levsero/planning-app-ui,roychoo/upload-invoices,far-fetched/kiwi,anthonyraymond/react-redux-starter-kit,crssn/funfunapp,kevinchiu/react-redux-starter-kit,dingyoujian/webpack-react-demo,pawelniewie/zen,huangc28/palestine,alukach/react-map-app,youdeshi/single-page-app-best-practice-client,vasekric/regrinder,michaelgu95/ZltoReduxCore,nodepie/react-redux-starter-kit,chozandrias76/responsive-sesame-test,roslaneshellanoo/react-redux-tutorial,bingomanatee/ridecell,sljuka/buzzler-ui,eunvanz/handpokemon2,pawelniewie/czy-to-jest-paleo,michaelgu95/ZltoReduxCore,nivas8292/myapp,houston88/housty-home-react,longseespace/quickflix,andreasnc/summer-project-tasks-2017,filucian/funfunapp,j3dimaster/CircleCi-test,jenyckee/midi-redux,nkostelnik/blaiseclicks,crssn/funfunapp,KirillSkomarovskiy/light-it,SHBailey/echo-mvp,flftfqwxf/react-redux-starter-kit,rickyduck/pp-frontend,jaronoff97/listmkr,Stas-Buzunko/cyber-school,lodelestra/SWClermont_2016,febobo/react-redux-start,billdevcode/spaceship-emporium,TestKitt/TestKittUI,ptim/react-redux-starter-kit,3a-classic/score,shuliang/ReactConventionDemo,rbhat0987/funfunapp,maartenlterpstra/GeoWeb-FrontEnd,dkushner/ArborJs-Playground,Edmondton/weather-forecasts,Dimitrievskislavcho/funfunfuncReduxCI,eunvanz/flowerhada,danieljwest/ExamGenerator,aibolik/my-todomvc,flftfqwxf/react-redux-starter-kit,loliver/anz-code-test,flftfqwxf/react-redux-starter-kit,jaronoff97/listmkr,rui19921122/StationTransformBrowserClient,flftfqwxf/react-redux-starter-kit,MingYinLv/blog-admin,willthefirst/book-buddy,yangbin1994/react-redux-starter-kit,neverfox/react-redux-starter-kit,janoist1/universal-react-redux-starter-kit,flftfqwxf/react-redux-starter-kit,gabrielmf/SIR-EDU-2.0,popaulina/grackle,jenyckee/midi-redux,rickyduck/pp-frontend,gReis89/sam-ovens-website,tylerbarabas/bbTools,shuliang/ReactConventionDemo,JohanGustafsson91/React-JWT-Authentication-Redux-Router,miyanokomiya/b-net,jakehm/mapgame2,RequestTimeout408/alba-task,levkus/react-overcounters2,dmassaneiro/integracao-continua,maartenplieger/GeoWeb-FrontEnd,flftfqwxf/react-redux-starter-kit,KirillSkomarovskiy/light-it,rbhat0987/funfunapp,RequestTimeout408/alba-task,flftfqwxf/react-redux-starter-kit,jhardin293/style-guide-manager,kolyaka006/imaginarium,SHBailey/echo-mvp,bingomanatee/ridecell,armaanshah96/lunchbox,bhj/karaoke-forever,k2data/react-redux-starter-kit,miyanokomiya/b-net,damirv/react-redux-starter-kit,diMosellaAtWork/GeoWeb-FrontEnd,BigRoomStudios/strangeluv,Edmondton/weather-forecasts,bhj/karaoke-forever,flftfqwxf/react-redux-starter-kit,longseespace/quickflix,warcraftlfg/warcrafthub-client,ptim/react-redux-starter-kit,pawelniewie/czy-to-jest-paleo | ---
+++
@@ -7,4 +7,4 @@
const host = config.server_host
server.listen(port)
-debug(`Server is now running at ${host}:${port}.`)
+debug(`Server is now running at http://${host}:${port}.`) |
f4679665a92b2a34277179615aabd02f2be1db22 | src/eventDispatchers/touchEventHandlers/touchStartActive.js | src/eventDispatchers/touchEventHandlers/touchStartActive.js | // State
import { getters, state } from './../../store/index.js';
import getActiveToolsForElement from './../../store/getActiveToolsForElement.js';
import addNewMeasurement from './addNewMeasurement.js';
import baseAnnotationTool from '../../base/baseAnnotationTool.js';
export default function (evt) {
if (state.isToolLocked) {
return;
}
const element = evt.detail.element;
const tools = getActiveToolsForElement(element, getters.touchTools());
const activeTool = tools[0];
// Note: custom `addNewMeasurement` will need to prevent event bubbling
if (activeTool.addNewMeasurement) {
activeTool.addNewMeasurement(evt, 'touch');
} else if (activeTool instanceof baseAnnotationTool) {
addNewMeasurement(evt, activeTool);
}
}
| // State
import { getters, state } from './../../store/index.js';
import getActiveToolsForElement from './../../store/getActiveToolsForElement.js';
import addNewMeasurement from './addNewMeasurement.js';
import baseAnnotationTool from '../../base/baseAnnotationTool.js';
export default function (evt) {
if (state.isToolLocked) {
return;
}
const element = evt.detail.element;
const tools = getActiveToolsForElement(element, getters.touchTools());
const activeTool = tools[0];
// Note: custom `addNewMeasurement` will need to prevent event bubbling
if (activeTool && activeTool.addNewMeasurement) {
activeTool.addNewMeasurement(evt, 'touch');
} else if (activeTool instanceof baseAnnotationTool) {
addNewMeasurement(evt, activeTool);
}
}
| Fix for when no touchTools are active | Fix for when no touchTools are active
| JavaScript | mit | cornerstonejs/cornerstoneTools,cornerstonejs/cornerstoneTools,chafey/cornerstoneTools,cornerstonejs/cornerstoneTools | ---
+++
@@ -14,7 +14,7 @@
const activeTool = tools[0];
// Note: custom `addNewMeasurement` will need to prevent event bubbling
- if (activeTool.addNewMeasurement) {
+ if (activeTool && activeTool.addNewMeasurement) {
activeTool.addNewMeasurement(evt, 'touch');
} else if (activeTool instanceof baseAnnotationTool) {
addNewMeasurement(evt, activeTool); |
95b588e256df806c6353bd130c2f8340a9893cae | lib/themes/dosomething/paraneue_dosomething/js/jquery.dev.js | lib/themes/dosomething/paraneue_dosomething/js/jquery.dev.js | define(function() {
"use strict";
// In development, we concatenate jQuery to the app.js build
// so that it is exposed as a global for Drupal scripts (rather
// than loading it normally.)
return jQuery;
});
| define(function() {
"use strict";
// In development, we concatenate jQuery to the app.js build
// so that it is exposed as a global for Drupal scripts (rather
// than loading it normally.)
return window.jQuery;
});
| Make window jQuery object a bit more explicit. | Make window jQuery object a bit more explicit.
| JavaScript | mit | mshmsh5000/dosomething,sbsmith86/dosomething,angaither/dosomething,mshmsh5000/dosomething-1,sbsmith86/dosomething,DoSomething/phoenix,mshmsh5000/dosomething-1,chloealee/dosomething,angaither/dosomething,angaither/dosomething,sergii-tkachenko/phoenix,angaither/dosomething,mshmsh5000/dosomething-1,deadlybutter/phoenix,jonuy/dosomething,sbsmith86/dosomething,chloealee/dosomething,DoSomething/phoenix,sbsmith86/dosomething,DoSomething/phoenix,deadlybutter/phoenix,DoSomething/dosomething,DoSomething/dosomething,sergii-tkachenko/phoenix,chloealee/dosomething,chloealee/dosomething,DoSomething/dosomething,DoSomething/dosomething,sbsmith86/dosomething,chloealee/dosomething,angaither/dosomething,angaither/dosomething,deadlybutter/phoenix,sergii-tkachenko/phoenix,mshmsh5000/dosomething,mshmsh5000/dosomething-1,DoSomething/phoenix,mshmsh5000/dosomething,chloealee/dosomething,sergii-tkachenko/phoenix,DoSomething/dosomething,jonuy/dosomething,jonuy/dosomething,sbsmith86/dosomething,mshmsh5000/dosomething,sergii-tkachenko/phoenix,deadlybutter/phoenix,deadlybutter/phoenix,DoSomething/phoenix,mshmsh5000/dosomething-1,jonuy/dosomething,DoSomething/dosomething,jonuy/dosomething,jonuy/dosomething | ---
+++
@@ -5,5 +5,5 @@
// so that it is exposed as a global for Drupal scripts (rather
// than loading it normally.)
- return jQuery;
+ return window.jQuery;
}); |
a5820158db8a23a61776a545e9e3f416b3568dd2 | server/openstorefront/openstorefront-web/src/main/webapp/client/scripts/component/savedSearchLinkInsertWindow.js | server/openstorefront/openstorefront-web/src/main/webapp/client/scripts/component/savedSearchLinkInsertWindow.js | /*
* Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
*
* 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.
*/
/* global Ext, CoreService */
Ext.define('OSF.component.SavedSearchLinkInsertWindow', {
extend: 'Ext.window.Window',
alias: 'osf.widget.SavedSearchLinkInsertWindow',
layout: 'fit',
title: 'Insert Link to Saved Search',
modal: true,
width: '60%',
height: '50%',
initComponent: function () {
this.callParent();
var savedSearchLinkInsertWindow = this;
savedSearchLinkInsertWindow.getLink = function() {
return "Link text goes here.";
};
}
});
| /*
* Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
*
* 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.
*/
/* global Ext, CoreService */
Ext.define('OSF.component.SavedSearchLinkInsertWindow', {
extend: 'Ext.window.Window',
alias: 'osf.widget.SavedSearchLinkInsertWindow',
layout: 'fit',
title: 'Insert Link to Saved Search',
modal: true,
width: '60%',
height: '50%',
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
items: [
{
text: 'Cancel'
},
{
xtype: 'tbfill'
},
{
text: 'Insert Link'
}
]
}
],
initComponent: function () {
this.callParent();
var savedSearchLinkInsertWindow = this;
savedSearchLinkInsertWindow.getLink = function() {
return "Link text goes here.";
};
}
});
| Add action buttons for link insert window | Add action buttons for link insert window
| JavaScript | apache-2.0 | jbottel/openstorefront,jbottel/openstorefront,jbottel/openstorefront,jbottel/openstorefront | ---
+++
@@ -25,6 +25,24 @@
width: '60%',
height: '50%',
+ dockedItems: [
+ {
+ xtype: 'toolbar',
+ dock: 'bottom',
+ items: [
+ {
+ text: 'Cancel'
+ },
+ {
+ xtype: 'tbfill'
+ },
+ {
+ text: 'Insert Link'
+ }
+ ]
+ }
+ ],
+
initComponent: function () {
this.callParent();
|
d4bc885cc31cf92aafd4fef846a015c58a7e5cbe | client/reactComponents/TankBody.js | client/reactComponents/TankBody.js | import React from 'react';
import { TANK_RADIUS } from '../../simulation/constants';
class TankBody extends React.Component {
constructor(props) {
super(props);
this.radius = props.radius || TANK_RADIUS;
this.material = props.material || 'color: red;'
}
render () {
return (
<a-sphere
position='0 0 0'
rotation={this.props.rotation}
material={this.material}
socket-controls={`simulationAttribute: tankRotation; characterId: ${this.props.characterId}`}
radius={this.radius}>
<a-torus
position='0 0 0'
rotation='90 0 0'
material={this.material}
radius={this.radius}
radius-tubular={0.1}/>
<a-sphere // Windows
position={`0 0.6 ${0.4 - this.radius}`}
radius='0.5'
scale='2.5 1 1.5'
material='color:black; opacity:0.4;'/>
<a-sphere
position={`${-(this.radius - 0.5)} 0.6 -1`}
radius='0.4'
material='color:black; opacity:0.4;'/>
<a-sphere
position={`${this.radius - 0.5} 0.6 -1`}
radius='0.4'
material='color:black; opacity:0.4;'/>
{this.props.children}
</a-sphere>
)
}
}
module.exports = TankBody;
| import React from 'react';
import { TANK_RADIUS } from '../../simulation/constants';
class TankBody extends React.Component {
constructor(props) {
super(props);
this.radius = props.radius || TANK_RADIUS;
this.material = props.material || 'color: red;'
this.socketControlsDisabled = props.socketControlsDisabled || false;
}
render () {
return (
<a-sphere
position='0 0 0'
rotation={this.props.rotation}
material={this.material}
socket-controls={`simulationAttribute: tankRotation; `+
`characterId: ${this.props.characterId}; `+
`enabled: ${!this.socketControlsDisabled}`}
radius={this.radius}>
<a-torus
position='0 0 0'
rotation='90 0 0'
material={this.material}
radius={this.radius}
radius-tubular={0.1}/>
<a-sphere // Windows
position={`0 0.6 ${0.4 - this.radius}`}
radius='0.5'
scale='2.5 1 1.5'
material='color:black; opacity:0.4;'/>
<a-sphere
position={`${-(this.radius - 0.5)} 0.6 -1`}
radius='0.4'
material='color:black; opacity:0.4;'/>
<a-sphere
position={`${this.radius - 0.5} 0.6 -1`}
radius='0.4'
material='color:black; opacity:0.4;'/>
{this.props.children}
</a-sphere>
)
}
}
module.exports = TankBody;
| Enable disabling for inanimate enemy tanks | Enable disabling for inanimate enemy tanks
| JavaScript | mit | ourvrisrealerthanyours/tanks,elliotaplant/tanks,ourvrisrealerthanyours/tanks,elliotaplant/tanks | ---
+++
@@ -7,6 +7,7 @@
super(props);
this.radius = props.radius || TANK_RADIUS;
this.material = props.material || 'color: red;'
+ this.socketControlsDisabled = props.socketControlsDisabled || false;
}
render () {
@@ -15,7 +16,9 @@
position='0 0 0'
rotation={this.props.rotation}
material={this.material}
- socket-controls={`simulationAttribute: tankRotation; characterId: ${this.props.characterId}`}
+ socket-controls={`simulationAttribute: tankRotation; `+
+ `characterId: ${this.props.characterId}; `+
+ `enabled: ${!this.socketControlsDisabled}`}
radius={this.radius}>
<a-torus
position='0 0 0' |
820dc2d669d10d1fe125b4581ed5db9e4249b551 | conf/grunt/grunt-release.js | conf/grunt/grunt-release.js | 'use strict';
module.exports = function (grunt) {
grunt.registerTask('release', 'Create and tag a release',
function () {
grunt.task.run(['checkbranch:master', 'compile', 'bump']);
}
);
};
| module.exports = function (grunt) {
'use strict';
grunt.registerTask('release', 'Create and tag a release',
function (increment) {
var bump = 'bump:' + (increment || 'patch');
grunt.task.run(['checkbranch:master', 'compile', bump]);
}
);
};
| Add version increment option to release task. | Add version increment option to release task.
| JavaScript | mit | elmarquez/threejs-cad,elmarquez/threejs-cad | ---
+++
@@ -1,9 +1,9 @@
-'use strict';
-
module.exports = function (grunt) {
- grunt.registerTask('release', 'Create and tag a release',
- function () {
- grunt.task.run(['checkbranch:master', 'compile', 'bump']);
- }
- );
+ 'use strict';
+ grunt.registerTask('release', 'Create and tag a release',
+ function (increment) {
+ var bump = 'bump:' + (increment || 'patch');
+ grunt.task.run(['checkbranch:master', 'compile', bump]);
+ }
+ );
}; |
37a1762d76945cca5a0bf184fc42ef9ed6dba0f7 | packages/tools/addon/components/cs-active-composition-panel.js | packages/tools/addon/components/cs-active-composition-panel.js | import Component from '@ember/component';
import layout from '../templates/components/cs-active-composition-panel';
import { task, timeout } from 'ember-concurrency';
import scrollToBounds from '../scroll-to-bounds';
import { inject as service } from '@ember/service';
export default Component.extend({
layout,
classNames: ['cs-active-composition-panel'],
validationErrors: null,
data: service('cardstack-data'),
validate: task(function * () {
let errors = yield this.get('data').validate(this.model);
this.set('validationErrors', errors);
}),
highlightAndScrollToField: task(function * (field) {
this.get('highlightField')(field);
if (field) {
yield timeout(500);
scrollToBounds(field.bounds());
}
}).restartable()
});
| import Component from '@ember/component';
import layout from '../templates/components/cs-active-composition-panel';
import { task, timeout } from 'ember-concurrency';
import scrollToBounds from '../scroll-to-bounds';
import { inject as service } from '@ember/service';
import { camelize } from '@ember/string';
export default Component.extend({
layout,
classNames: ['cs-active-composition-panel'],
validationErrors: null,
data: service('cardstack-data'),
validate: task(function * () {
let errors = yield this.get('data').validate(this.model);
let errorsForFieldNames = {};
for (let key in errors) {
errorsForFieldNames[camelize(key)] = errors[key];
}
this.set('validationErrors', errorsForFieldNames);
}),
highlightAndScrollToField: task(function * (field) {
this.get('highlightField')(field);
if (field) {
yield timeout(500);
scrollToBounds(field.bounds());
}
}).restartable()
});
| Fix showing validation errors for dashed field names | Fix showing validation errors for dashed field names
| JavaScript | mit | cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack | ---
+++
@@ -3,6 +3,7 @@
import { task, timeout } from 'ember-concurrency';
import scrollToBounds from '../scroll-to-bounds';
import { inject as service } from '@ember/service';
+import { camelize } from '@ember/string';
export default Component.extend({
layout,
@@ -14,7 +15,11 @@
validate: task(function * () {
let errors = yield this.get('data').validate(this.model);
- this.set('validationErrors', errors);
+ let errorsForFieldNames = {};
+ for (let key in errors) {
+ errorsForFieldNames[camelize(key)] = errors[key];
+ }
+ this.set('validationErrors', errorsForFieldNames);
}),
highlightAndScrollToField: task(function * (field) { |
d61d559936d5a7168e86e928a024cabd53abea60 | build/copy.js | build/copy.js | module.exports = {
all: {
files: [
{ expand: true, src: ['config.json'], dest: 'dist' },
{ expand: true, src: ['javascript.json'], dest: 'dist' },
{ expand: true, cwd: 'src/config/', src: ['**'], dest: 'dist/config/' },
{ expand: true, cwd: 'src/images/', src: ['**'], dest: 'dist/images/', },
{ expand: true, cwd: 'src/flash/', src: ['**'], dest: 'dist/flash/' },
{ expand: true, cwd: 'src/templates/', src: ['**'], dest: 'dist/templates/' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/images/', src: ['**'], dest: 'dist/css/images' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/', src: ['*.css'], dest: 'dist/css/' },
{ expand: true, cwd: 'src/javascript/', src: ['**'], dest: 'dist/dev/src/javascript/' }
]
}
};
| module.exports = {
all: {
files: [
{ expand: true, src: ['config.json'], dest: 'dist' },
{ expand: true, src: ['javascript.json'], dest: 'dist' },
{ expand: true, cwd: 'src/config/', src: ['**'], dest: 'dist/config/' },
{ expand: true, cwd: 'src/images/', src: ['**'], dest: 'dist/images/', },
{ expand: true, cwd: 'src/flash/', src: ['**'], dest: 'dist/flash/' },
{ expand: true, cwd: 'src/templates/', src: ['**'], dest: 'dist/templates/' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/images/', src: ['**'], dest: 'dist/css/images' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/', src: ['*.css'], dest: 'dist/css/' },
{ expand: true, cwd: 'src/javascript/', src: ['**'], dest: 'dist/dev/src/javascript/' },
{ expand: true, cwd: 'src/javascript/gtm/', src: ['experimental.js'], dest: 'dist/js/gtm/' }
]
}
};
| Copy gtml file to dist directory | Copy gtml file to dist directory
| JavaScript | apache-2.0 | junbon/binary-static-www2,einhverfr/binary-static,massihx/binary-static,einhverfr/binary-static,borisyankov/binary-static,massihx/binary-static,animeshsaxena/binary-static,borisyankov/binary-static,brodiecapel16/binary-static,borisyankov/binary-static,einhverfr/binary-static,massihx/binary-static,animeshsaxena/binary-static,animeshsaxena/binary-static,einhverfr/binary-static,tfoertsch/binary-static,brodiecapel16/binary-static,borisyankov/binary-static,tfoertsch/binary-static,animeshsaxena/binary-static,brodiecapel16/binary-static,brodiecapel16/binary-static,massihx/binary-static,junbon/binary-static-www2 | ---
+++
@@ -9,7 +9,8 @@
{ expand: true, cwd: 'src/templates/', src: ['**'], dest: 'dist/templates/' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/images/', src: ['**'], dest: 'dist/css/images' },
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/', src: ['*.css'], dest: 'dist/css/' },
- { expand: true, cwd: 'src/javascript/', src: ['**'], dest: 'dist/dev/src/javascript/' }
+ { expand: true, cwd: 'src/javascript/', src: ['**'], dest: 'dist/dev/src/javascript/' },
+ { expand: true, cwd: 'src/javascript/gtm/', src: ['experimental.js'], dest: 'dist/js/gtm/' }
]
}
}; |
e08a21c9a4e067e692dd35e82ffde8608b3f3044 | lib/assert-called.js | lib/assert-called.js | var assert = require('assert');
var assertCalled = module.exports = function (cb) {
var index = assertCalled.wanted.push({ callback: cb, error: new Error() });
return function () {
wanted.splice(index - 1, 1);
cb.apply(this, arguments);
};
};
var wanted = assertCalled.wanted = [];
process.on('exit', function () {
var msg;
if (wanted.length) {
msg = wanted.length + ' callback' + (wanted.length > 1 ? 's' : '') + ' not called:';
wanted.forEach(function (func) {
var stack;
msg += '\n ' + (func.callback.name ? func.callback.name : '<anonymous>') + '\n';
stack = func.error.stack.split('\n');
stack.splice(0, 2);
msg += stack.join('\n') + '\n';
});
throw new assert.AssertionError({
message: msg,
actual: wanted.length,
expected: 0
});
}
});
| var assert = require('assert');
var assertCalled = module.exports = function (cb) {
var index = assertCalled.wanted.push({ callback: cb, error: new Error() });
return function () {
wanted[index - 1] = null;
cb.apply(this, arguments);
};
};
var wanted = assertCalled.wanted = [];
process.on('exit', function () {
var msg;
wanted = wanted.filter(Boolean);
if (wanted.length) {
msg = wanted.length + ' callback' + (wanted.length > 1 ? 's' : '') + ' not called:';
wanted.forEach(function (func) {
var stack;
msg += '\n ' + (func.callback.name ? func.callback.name : '<anonymous>') + '\n';
stack = func.error.stack.split('\n');
stack.splice(0, 2);
msg += stack.join('\n') + '\n';
});
throw new assert.AssertionError({
message: msg,
actual: wanted.length,
expected: 0
});
}
});
| Fix problem with callbacks called out of order | [fix] Fix problem with callbacks called out of order
| JavaScript | mit | mmalecki/assert-called | ---
+++
@@ -3,7 +3,7 @@
var assertCalled = module.exports = function (cb) {
var index = assertCalled.wanted.push({ callback: cb, error: new Error() });
return function () {
- wanted.splice(index - 1, 1);
+ wanted[index - 1] = null;
cb.apply(this, arguments);
};
};
@@ -12,6 +12,9 @@
process.on('exit', function () {
var msg;
+
+ wanted = wanted.filter(Boolean);
+
if (wanted.length) {
msg = wanted.length + ' callback' + (wanted.length > 1 ? 's' : '') + ' not called:';
wanted.forEach(function (func) { |
739298c7826ea6109b8a2632d54c8d867f7d03cc | react/features/base/participants/components/styles.js | react/features/base/participants/components/styles.js | import { createStyleSheet } from '../../styles';
/**
* The style of the avatar and participant view UI (components).
*/
export const styles = createStyleSheet({
/**
* Avatar style.
*/
avatar: {
flex: 1,
width: '100%'
},
/**
* ParticipantView style.
*/
participantView: {
alignItems: 'stretch',
flex: 1
}
});
| import { createStyleSheet } from '../../styles';
/**
* The style of the avatar and participant view UI (components).
*/
export const styles = createStyleSheet({
/**
* Avatar style.
*/
avatar: {
alignSelf: 'center',
// FIXME I don't understand how a 100 border radius of a 50x50 square
// results in a circle.
borderRadius: 100,
flex: 1,
height: 50,
width: 50
},
/**
* ParticipantView style.
*/
participantView: {
alignItems: 'stretch',
flex: 1
}
});
| Use rounded avatars in the film strip | [RN] Use rounded avatars in the film strip
| JavaScript | apache-2.0 | jitsi/jitsi-meet,bgrozev/jitsi-meet,gpolitis/jitsi-meet,jitsi/jitsi-meet,bgrozev/jitsi-meet,jitsi/jitsi-meet,bgrozev/jitsi-meet,bgrozev/jitsi-meet,bgrozev/jitsi-meet,jitsi/jitsi-meet,bgrozev/jitsi-meet,gpolitis/jitsi-meet,jitsi/jitsi-meet,jitsi/jitsi-meet,jitsi/jitsi-meet,gpolitis/jitsi-meet,gpolitis/jitsi-meet,gpolitis/jitsi-meet,gpolitis/jitsi-meet,jitsi/jitsi-meet,gpolitis/jitsi-meet,gpolitis/jitsi-meet | ---
+++
@@ -8,8 +8,14 @@
* Avatar style.
*/
avatar: {
+ alignSelf: 'center',
+
+ // FIXME I don't understand how a 100 border radius of a 50x50 square
+ // results in a circle.
+ borderRadius: 100,
flex: 1,
- width: '100%'
+ height: 50,
+ width: 50
},
/** |
d15d9e09ec0b338d52d6db33ae91b4b96d6190df | src/events/memberAdd.js | src/events/memberAdd.js | exports.run = async function(payload) {
const claimEnabled = this.cfg.issues.commands.assign.claim.aliases.length;
if (payload.action !== "added" || !claimEnabled) return;
const newMember = payload.member.login;
const invite = this.invites.get(newMember);
if (!invite) return;
const repo = payload.repository;
const repoFullName = invite.split("#")[0];
if (repoFullName !== repo.full_name) return;
const number = invite.split("#")[1];
const repoOwner = repoFullName.split("/")[0];
const repoName = repoFullName.split("/")[1];
const response = await this.issues.addAssigneesToIssue({
owner: repoOwner, repo: repoName, number: number, assignees: [newMember]
});
if (response.data.assignees.length) return;
const error = "**ERROR:** Issue claiming failed (no assignee was added).";
this.issues.createComment({
owner: repoOwner, repo: repoName, number: number, body: error
});
};
exports.events = ["member"];
| exports.run = async function(payload) {
const claimEnabled = this.cfg.issues.commands.assign.claim.length;
if (payload.action !== "added" || !claimEnabled) return;
const newMember = payload.member.login;
const invite = this.invites.get(newMember);
if (!invite) return;
const repo = payload.repository;
const repoFullName = invite.split("#")[0];
if (repoFullName !== repo.full_name) return;
const number = invite.split("#")[1];
const repoOwner = repoFullName.split("/")[0];
const repoName = repoFullName.split("/")[1];
const response = await this.issues.addAssigneesToIssue({
owner: repoOwner, repo: repoName, number: number, assignees: [newMember]
});
if (response.data.assignees.length) return;
const error = "**ERROR:** Issue claiming failed (no assignee was added).";
this.issues.createComment({
owner: repoOwner, repo: repoName, number: number, body: error
});
};
exports.events = ["member"];
| Fix broken JSON path for member events. | events: Fix broken JSON path for member events.
| JavaScript | apache-2.0 | synicalsyntax/zulipbot | ---
+++
@@ -1,5 +1,5 @@
exports.run = async function(payload) {
- const claimEnabled = this.cfg.issues.commands.assign.claim.aliases.length;
+ const claimEnabled = this.cfg.issues.commands.assign.claim.length;
if (payload.action !== "added" || !claimEnabled) return;
|
bf37fb0886485102fe832c67909aae07ae6daaf8 | web/config.js | web/config.js | var path = require('path'),
fs = require('fs'),
log4js = require('log4js');
var config = {
DNODE_PORT: 0xC5EA,
SEARCH_REPO: path.join(__dirname, "../../linux"),
SEARCH_REF: "v3.0",
SEARCH_ARGS: [],
BACKEND_CONNECTIONS: 8,
BACKENDS: [
["localhost", 0xC5EA]
],
LOG4JS_CONFIG: path.join(__dirname, "log4js.json")
};
try {
fs.statSync(path.join(__dirname, 'config.local.js'));
var local = require('./config.local.js');
Object.keys(local).forEach(
function (k){
config[k] = local[k]
})
} catch (e) {
}
log4js.configure(config.LOG4JS_CONFIG);
module.exports = config;
| var path = require('path'),
fs = require('fs'),
log4js = require('log4js');
var config = {
DNODE_PORT: 0xC5EA,
SEARCH_REPO: path.join(__dirname, "../../linux"),
SEARCH_REF: "v3.0",
SEARCH_ARGS: [],
BACKEND_CONNECTIONS: 4,
BACKENDS: [
["localhost", 0xC5EA]
],
LOG4JS_CONFIG: path.join(__dirname, "log4js.json")
};
try {
fs.statSync(path.join(__dirname, 'config.local.js'));
var local = require('./config.local.js');
Object.keys(local).forEach(
function (k){
config[k] = local[k]
})
} catch (e) {
}
log4js.configure(config.LOG4JS_CONFIG);
module.exports = config;
| Drop the default number of backend connections to 4. | Drop the default number of backend connections to 4.
| JavaScript | bsd-2-clause | wfxiang08/livegrep,lekkas/livegrep,lekkas/livegrep,lekkas/livegrep,paulproteus/livegrep,paulproteus/livegrep,lekkas/livegrep,paulproteus/livegrep,wfxiang08/livegrep,wfxiang08/livegrep,wfxiang08/livegrep,paulproteus/livegrep,wfxiang08/livegrep,paulproteus/livegrep,paulproteus/livegrep,lekkas/livegrep,wfxiang08/livegrep,lekkas/livegrep | ---
+++
@@ -7,7 +7,7 @@
SEARCH_REPO: path.join(__dirname, "../../linux"),
SEARCH_REF: "v3.0",
SEARCH_ARGS: [],
- BACKEND_CONNECTIONS: 8,
+ BACKEND_CONNECTIONS: 4,
BACKENDS: [
["localhost", 0xC5EA]
], |
c78de429e9f6c4d6ecf32ff0cc768a8ef8d0e917 | mac/resources/open_wctb.js | mac/resources/open_wctb.js | define(function() {
return function(resource) {
var dv = new DataView(resource.data.buffer, resource.data.byteOffset, resource.data.byteLength);
var entryCount = dv.getInt16(6, false) + 1;
if (entryCount < 0) {
console.error('color table resource: invalid number of entries');
}
var palCanvas = document.createElement('CANVAS');
palCanvas.width = entryCount;
palCanvas.height = 1;
var palCtx = palCanvas.getContext('2d');
var palData = palCtx.createImageData(entryCount, 1);
for (var icolor = 0; icolor < entryCount; icolor++) {
var offset = dv.getInt16(8 + icolor*8, false) * 4;
if (offset >= 0) {
palData.data[offset] = resource.data[8 + icolor*8 + 2];
palData.data[offset + 1] = resource.data[8 + icolor*8 + 4];
palData.data[offset + 2] = resource.data[8 + icolor*8 + 6];
palData.data[offset + 3] = 255;
}
}
palCtx.putImageData(palData, 0, 0);
resource.image = {
width: entryCount,
height: 1,
url: palCanvas.toDataURL(),
};
};
});
| define(function() {
return function(resource) {
var dv = new DataView(resource.data.buffer, resource.data.byteOffset, resource.data.byteLength);
var entryCount = dv.getInt16(6, false) + 1;
if (entryCount < 0) {
console.error('color table resource: invalid number of entries');
}
var palCanvas = document.createElement('CANVAS');
palCanvas.width = entryCount;
if (entryCount === 0) {
palCanvas.height = 0;
}
else {
palCanvas.height = 1;
var palCtx = palCanvas.getContext('2d');
var palData = palCtx.createImageData(entryCount, 1);
for (var icolor = 0; icolor < entryCount; icolor++) {
var offset = dv.getInt16(8 + icolor*8, false) * 4;
if (offset >= 0) {
palData.data[offset] = resource.data[8 + icolor*8 + 2];
palData.data[offset + 1] = resource.data[8 + icolor*8 + 4];
palData.data[offset + 2] = resource.data[8 + icolor*8 + 6];
palData.data[offset + 3] = 255;
}
}
palCtx.putImageData(palData, 0, 0);
},
resource.image = {
width: palCanvas.width,
height: palCanvas.height,
url: palCanvas.toDataURL(),
};
};
});
| Fix for zero-length color tables | Fix for zero-length color tables | JavaScript | mit | radishengine/drowsy,radishengine/drowsy | ---
+++
@@ -8,22 +8,27 @@
}
var palCanvas = document.createElement('CANVAS');
palCanvas.width = entryCount;
- palCanvas.height = 1;
- var palCtx = palCanvas.getContext('2d');
- var palData = palCtx.createImageData(entryCount, 1);
- for (var icolor = 0; icolor < entryCount; icolor++) {
- var offset = dv.getInt16(8 + icolor*8, false) * 4;
- if (offset >= 0) {
- palData.data[offset] = resource.data[8 + icolor*8 + 2];
- palData.data[offset + 1] = resource.data[8 + icolor*8 + 4];
- palData.data[offset + 2] = resource.data[8 + icolor*8 + 6];
- palData.data[offset + 3] = 255;
+ if (entryCount === 0) {
+ palCanvas.height = 0;
+ }
+ else {
+ palCanvas.height = 1;
+ var palCtx = palCanvas.getContext('2d');
+ var palData = palCtx.createImageData(entryCount, 1);
+ for (var icolor = 0; icolor < entryCount; icolor++) {
+ var offset = dv.getInt16(8 + icolor*8, false) * 4;
+ if (offset >= 0) {
+ palData.data[offset] = resource.data[8 + icolor*8 + 2];
+ palData.data[offset + 1] = resource.data[8 + icolor*8 + 4];
+ palData.data[offset + 2] = resource.data[8 + icolor*8 + 6];
+ palData.data[offset + 3] = 255;
+ }
}
- }
- palCtx.putImageData(palData, 0, 0);
+ palCtx.putImageData(palData, 0, 0);
+ },
resource.image = {
- width: entryCount,
- height: 1,
+ width: palCanvas.width,
+ height: palCanvas.height,
url: palCanvas.toDataURL(),
};
|
31925ae17346c45902d2762cd91dcd2d1d52bfeb | lib/string-helper.js | lib/string-helper.js | 'use babel';
export const raw = (strings, ...values) => {
return strings[0].replace(/^[ \t\r]+/gm, "");
};
| 'use babel';
// TODO: Move to underscore-plus?
export const raw = (strings, ...values) => {
return strings[0].replace(/^[ \t\r]+/gm, "");
};
| Add TODO about moving string helper to underscore-plus | :memo: Add TODO about moving string helper to underscore-plus
| JavaScript | mit | atom/toggle-quotes | ---
+++
@@ -1,5 +1,6 @@
'use babel';
+// TODO: Move to underscore-plus?
export const raw = (strings, ...values) => {
return strings[0].replace(/^[ \t\r]+/gm, "");
}; |
949d26db4397a375e2587a68ea66f099fbe4f3ba | test/integration/saucelabs.conf.js | test/integration/saucelabs.conf.js | exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
capabilities: {
'browserName': 'chrome',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'smoke test'
},
specs: ['*.spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
},
baseUrl: 'http://localhost:' + (process.env.HTTP_PORT || '3000')
}
| exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
capabilities: {
'browserName': 'chrome',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'smoke test'
},
specs: ['*.spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
isVerbose: true
},
baseUrl: 'http://localhost:' + (process.env.HTTP_PORT || '3000')
}
| Add additional logging setting for Travis CI debugging | Add additional logging setting for Travis CI debugging | JavaScript | bsd-3-clause | CodeForBrazil/streetmix,codeforamerica/streetmix,macGRID-SRN/streetmix,kodujdlapolski/streetmix,magul/streetmix,kodujdlapolski/streetmix,magul/streetmix,kodujdlapolski/streetmix,CodeForBrazil/streetmix,codeforamerica/streetmix,CodeForBrazil/streetmix,macGRID-SRN/streetmix,magul/streetmix,macGRID-SRN/streetmix,codeforamerica/streetmix | ---
+++
@@ -13,7 +13,8 @@
jasmineNodeOpts: {
showColors: true,
- defaultTimeoutInterval: 30000
+ defaultTimeoutInterval: 30000,
+ isVerbose: true
},
baseUrl: 'http://localhost:' + (process.env.HTTP_PORT || '3000') |
b37380d1ea4bc04f07859f8f0b748bbe676e4317 | codebrag-ui/app/scripts/common/directives/contactFormPopup.js | codebrag-ui/app/scripts/common/directives/contactFormPopup.js | angular.module('codebrag.common.directives').directive('contactFormPopup', function() {
function ContactFormPopup($scope, $http) {
$scope.isVisible = false;
$scope.submit = function() {
sendFeedbackViaUservoice().then(success, failure);
function success() {
$scope.success = true;
clearFormFields();
}
function failure() {
$scope.failure = true;
}
};
$scope.$on('openContactFormPopup', function() {
$scope.isVisible = true;
});
$scope.close = function() {
$scope.isVisible = false;
delete $scope.success;
delete $scope.failure;
clearFormFields();
};
function clearFormFields() {
$scope.msg = {};
$scope.contactForm.$setPristine();
}
function sendFeedbackViaUservoice() {
var apiKey = 'vvT4cCa8uOpfhokERahg';
var data = {
format: 'json',
client: apiKey,
ticket: {
message: $scope.msg.body,
subject: $scope.msg.subject
},
email: $scope.msg.email
};
var url = 'https://codebrag.uservoice.com/api/v1/tickets/create_via_jsonp.json?' + $.param(data) + '&callback=JSON_CALLBACK';
return $http.jsonp(url);
}
}
return {
restrict: 'E',
replace: true,
scope: {},
templateUrl: 'views/popups/contactForm.html',
controller: ContactFormPopup
};
}); | angular.module('codebrag.common.directives').directive('contactFormPopup', function() {
function ContactFormPopup($scope, $http) {
$scope.isVisible = false;
$scope.submit = function() {
clearStatus();
sendFeedbackViaUservoice().then(success, failure);
function success() {
$scope.success = true;
clearFormFields();
}
function failure() {
$scope.failure = true;
}
};
$scope.$on('openContactFormPopup', function() {
$scope.isVisible = true;
});
$scope.close = function() {
$scope.isVisible = false;
clearStatus();
clearFormFields();
};
function clearStatus() {
delete $scope.success;
delete $scope.failure;
}
function clearFormFields() {
$scope.msg = {};
$scope.contactForm.$setPristine();
}
function sendFeedbackViaUservoice() {
var apiKey = 'vvT4cCa8uOpfhokERahg';
var data = {
format: 'json',
client: apiKey,
ticket: {
message: $scope.msg.body,
subject: $scope.msg.subject
},
email: $scope.msg.email
};
var url = 'https://codebrag.uservoice.com/api/v1/tickets/create_via_jsonp.json?' + $.param(data) + '&callback=JSON_CALLBACK';
return $http.jsonp(url);
}
}
return {
restrict: 'E',
replace: true,
scope: {},
templateUrl: 'views/popups/contactForm.html',
controller: ContactFormPopup
};
}); | Hide contact form when sending succeeded. | Hide contact form when sending succeeded.
| JavaScript | agpl-3.0 | cazacugmihai/codebrag,softwaremill/codebrag,cazacugmihai/codebrag,cazacugmihai/codebrag,softwaremill/codebrag,cazacugmihai/codebrag,cazacugmihai/codebrag,softwaremill/codebrag,softwaremill/codebrag | ---
+++
@@ -5,6 +5,7 @@
$scope.isVisible = false;
$scope.submit = function() {
+ clearStatus();
sendFeedbackViaUservoice().then(success, failure);
function success() {
$scope.success = true;
@@ -21,10 +22,14 @@
$scope.close = function() {
$scope.isVisible = false;
+ clearStatus();
+ clearFormFields();
+ };
+
+ function clearStatus() {
delete $scope.success;
delete $scope.failure;
- clearFormFields();
- };
+ }
function clearFormFields() {
$scope.msg = {}; |
5c714a27bbfb28922771db47a249efbd24dfae31 | tests/integration/components/organization-menu-test.js | tests/integration/components/organization-menu-test.js | import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('organization-menu', 'Integration | Component | organization menu', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });"
this.render(hbs`{{organization-menu}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:"
this.render(hbs`
{{#organization-menu}}
template block text
{{/organization-menu}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('organization-menu', 'Integration | Component | organization menu', {
integration: true
});
test('it renders', function(assert) {
assert.expect(1);
this.render(hbs`{{organization-menu}}`);
assert.equal(this .$('.organization-menu').length, 1, 'Component\'s element is rendered');
});
test('it renders all required menu elements properly', function(assert) {
assert.expect(3);
this.render(hbs`{{organization-menu}}`);
assert.equal(this.$('.organization-menu li').length, 2, 'All the links rendered');
assert.equal(this.$('.organization-menu li:eq(0)').text().trim(), 'Projects', 'The projects link is rendered');
assert.equal(this.$('.organization-menu li:eq(1)').text().trim(), 'Settings', 'The settings link is rendered');
});
| Add organization menu component test | Add organization menu component test
| JavaScript | mit | jderr-mx/code-corps-ember,code-corps/code-corps-ember,jderr-mx/code-corps-ember,eablack/code-corps-ember,eablack/code-corps-ember,code-corps/code-corps-ember | ---
+++
@@ -6,19 +6,19 @@
});
test('it renders', function(assert) {
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });"
+ assert.expect(1);
+ this.render(hbs`{{organization-menu}}`);
+
+ assert.equal(this .$('.organization-menu').length, 1, 'Component\'s element is rendered');
+});
+
+
+test('it renders all required menu elements properly', function(assert) {
+ assert.expect(3);
this.render(hbs`{{organization-menu}}`);
- assert.equal(this.$().text().trim(), '');
-
- // Template block usage:"
- this.render(hbs`
- {{#organization-menu}}
- template block text
- {{/organization-menu}}
- `);
-
- assert.equal(this.$().text().trim(), 'template block text');
+ assert.equal(this.$('.organization-menu li').length, 2, 'All the links rendered');
+ assert.equal(this.$('.organization-menu li:eq(0)').text().trim(), 'Projects', 'The projects link is rendered');
+ assert.equal(this.$('.organization-menu li:eq(1)').text().trim(), 'Settings', 'The settings link is rendered');
}); |
32fbe3dc4686e413886911f5d373137648f08614 | packages/shim/src/index.js | packages/shim/src/index.js | /* eslint-disable global-require */
require('@webcomponents/template');
if (!window.customElements) require('@webcomponents/custom-elements');
if (!document.body.attachShadow) require('@webcomponents/shadydom');
require('@webcomponents/shadycss/scoping-shim.min');
require('@webcomponents/shadycss/apply-shim.min');
| /* eslint-disable global-require */
require('@webcomponents/template');
if (!document.body.attachShadow) require('@webcomponents/shadydom');
if (!window.customElements) require('@webcomponents/custom-elements');
require('@webcomponents/shadycss/scoping-shim.min');
require('@webcomponents/shadycss/apply-shim.min');
| Fix ShadyDOM before Custom Elements polyfill | Fix ShadyDOM before Custom Elements polyfill
| JavaScript | mit | hybridsjs/hybrids | ---
+++
@@ -1,8 +1,8 @@
/* eslint-disable global-require */
require('@webcomponents/template');
+if (!document.body.attachShadow) require('@webcomponents/shadydom');
if (!window.customElements) require('@webcomponents/custom-elements');
-if (!document.body.attachShadow) require('@webcomponents/shadydom');
require('@webcomponents/shadycss/scoping-shim.min');
require('@webcomponents/shadycss/apply-shim.min'); |
5bab1d44e4d2667a0997bd72002a22385aeae8fd | test/socket-api.test.js | test/socket-api.test.js | var assert = require('chai').assert;
var nodemock = require('nodemock');
var utils = require('./test-utils');
var express = require('express');
var socketAdaptor = require('../lib/socket-adaptor');
var Connection = require('../lib/backend-adaptor').Connection;
var client = require('socket.io-client');
suite('Socket.IO API', function() {
var server;
teardown(function() {
if (server) {
server.close();
}
server = undefined;
});
test('front to back', function() {
var connection = nodemock
.mock('emitMessage')
.takes('search', { requestMessage: true }, function() {});
var application = express();
server = utils.setupServer(application);
socketAdaptor.registerHandlers(application, server, {
connection: connection
});
var clientSocket = client.connect('http://localhost:' + utils.testServerPort);
clientSocket.emit('search', { requestMessage: true });
connection.assertThrow();
});
});
| var assert = require('chai').assert;
var nodemock = require('nodemock');
var utils = require('./test-utils');
var express = require('express');
var socketAdaptor = require('../lib/socket-adaptor');
var Connection = require('../lib/backend-adaptor').Connection;
var client = require('socket.io-client');
suite('Socket.IO API', function() {
var server;
teardown(function() {
if (server) {
server.close();
}
server = undefined;
});
test('front to back', function() {
var connection = nodemock
.mock('emitMessage')
.takes('search', { requestMessage: true }, function() {});
var application = express();
server = utils.setupServer(application);
socketAdaptor.registerHandlers(application, server, {
connection: connection
});
var clientSocket = client.connect('http://localhost:' + utils.testServerPort);
clientSocket.emit('search', { requestMessage: true });
connection.assertThrows();
});
});
| Fix typo: assertThrow => assertThrows | Fix typo:
assertThrow =>
assertThrows
| JavaScript | mit | droonga/express-droonga,droonga/express-droonga,KitaitiMakoto/express-droonga,KitaitiMakoto/express-droonga | ---
+++
@@ -33,7 +33,7 @@
var clientSocket = client.connect('http://localhost:' + utils.testServerPort);
clientSocket.emit('search', { requestMessage: true });
- connection.assertThrow();
+ connection.assertThrows();
});
});
|
4643995ca77ef4ed695d337da9fc36fdf7918749 | test/events.emitter.test.js | test/events.emitter.test.js | define(['events/lib/emitter'],
function(Emitter) {
describe("Emitter", function() {
it('should alias addListener to on', function() {
expect(Emitter.prototype.addListener).to.be.equal(Emitter.prototype.on);
});
it('should alias removeListener to off', function() {
expect(Emitter.prototype.removeListener).to.be.equal(Emitter.prototype.off);
});
});
return { name: "test.events.emitter" }
});
| define(['events/lib/emitter'],
function(Emitter) {
describe("Emitter", function() {
it('should alias addListener to on', function() {
expect(Emitter.prototype.addListener).to.be.equal(Emitter.prototype.on);
});
it('should alias removeListener to off', function() {
expect(Emitter.prototype.removeListener).to.be.equal(Emitter.prototype.off);
});
describe("emit", function() {
var emitter = new Emitter();
var fooSpy = [];
emitter.on('foo', function() {
fooSpy.push({});
});
it('should call listener with zero arguments', function() {
var rv = emitter.emit('foo');
expect(rv).to.be.true;
expect(fooSpy).to.have.length(1);
});
it('should not call unknown listener', function() {
var rv = emitter.emit('fubar');
expect(rv).to.be.false;
});
});
});
return { name: "test.events.emitter" }
});
| Test case for zero argument emit. | Test case for zero argument emit.
| JavaScript | mit | anchorjs/events,anchorjs/events | ---
+++
@@ -11,6 +11,27 @@
expect(Emitter.prototype.removeListener).to.be.equal(Emitter.prototype.off);
});
+
+ describe("emit", function() {
+ var emitter = new Emitter();
+ var fooSpy = [];
+
+ emitter.on('foo', function() {
+ fooSpy.push({});
+ });
+
+ it('should call listener with zero arguments', function() {
+ var rv = emitter.emit('foo');
+ expect(rv).to.be.true;
+ expect(fooSpy).to.have.length(1);
+ });
+
+ it('should not call unknown listener', function() {
+ var rv = emitter.emit('fubar');
+ expect(rv).to.be.false;
+ });
+ });
+
});
return { name: "test.events.emitter" } |
c78dbbec9ad549b8a850abce62f3a4757540eae8 | server/mongoose-handler.js | server/mongoose-handler.js | var mongoose = require('mongoose');
var log = require('./logger').log;
var process = require('process');
var options = require('./options-handler').options;
exports.init = function(callback) {
mongoose.connect(options['database']['uri']);
var db = mongoose.connection;
db.on('error', function(err) {
log.error(err);
process.exit(1);
});
db.once('open', callback);
};
| var mongoose = require('mongoose');
var log = require('./logger').log;
var options = require('./options-handler').options;
exports.init = function(callback) {
mongoose.connect(options['database']['uri']);
var db = mongoose.connection;
db.on('error', function(err) {
log.error(err);
setTimeout(function() {
process.exit(1);
}, 1000);
});
db.once('open', callback);
};
| Fix exiting on DB error. | Fix exiting on DB error.
| JavaScript | mit | MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave,MisterTea/TidalWave | ---
+++
@@ -1,6 +1,5 @@
var mongoose = require('mongoose');
var log = require('./logger').log;
-var process = require('process');
var options = require('./options-handler').options;
@@ -9,7 +8,9 @@
var db = mongoose.connection;
db.on('error', function(err) {
log.error(err);
- process.exit(1);
+ setTimeout(function() {
+ process.exit(1);
+ }, 1000);
});
db.once('open', callback);
}; |
cd810325efa67beac2cd339cd0bb5beeced14ec1 | app/assets/javascripts/transactions.js | app/assets/javascripts/transactions.js | (function () {
"use strict"
window.GOVUK = window.GOVUK || {};
window.GOVUK.Transactions = {
trackStartPageTabs : function (e) {
var pagePath = e.target.href;
GOVUK.analytics.trackEvent('startpages', 'tab', {label: pagePath, nonInteraction: true});
}
};
})();
$(document).ready(function () {
$('form#completed-transaction-form').
append('<input type="hidden" name="service_feedback[javascript_enabled]" value="true"/>').
append($('<input type="hidden" name="referrer">').val(document.referrer || "unknown"));
$('#completed-transaction-form button.button').click(function() {
$(this).attr('disabled', 'disabled');
$(this).parents('form').submit();
});
$('.transaction .govuk-tabs__tab').click(window.GOVUK.Transactions.trackStartPageTabs);
});
| (function () {
"use strict"
window.GOVUK = window.GOVUK || {};
window.GOVUK.Transactions = {
trackStartPageTabs : function (e) {
var pagePath = e.target.href;
GOVUK.analytics.trackEvent('startpages', 'tab', {label: pagePath, nonInteraction: true});
}
};
})();
$(document).ready(function () {
$('form#completed-transaction-form').
append('<input type="hidden" name="service_feedback[javascript_enabled]" value="true"/>').
append($('<input type="hidden" name="referrer">').val(document.referrer || "unknown"));
$('#completed-transaction-form button[type="submit"]').click(function() {
$(this).attr('disabled', 'disabled');
$(this).parents('form').submit();
});
$('.transaction .govuk-tabs__tab').click(window.GOVUK.Transactions.trackStartPageTabs);
});
| Update JS following component usage | Update JS following component usage
| JavaScript | mit | alphagov/frontend,alphagov/frontend,alphagov/frontend,alphagov/frontend | ---
+++
@@ -19,7 +19,7 @@
append('<input type="hidden" name="service_feedback[javascript_enabled]" value="true"/>').
append($('<input type="hidden" name="referrer">').val(document.referrer || "unknown"));
- $('#completed-transaction-form button.button').click(function() {
+ $('#completed-transaction-form button[type="submit"]').click(function() {
$(this).attr('disabled', 'disabled');
$(this).parents('form').submit();
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.