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
012942d0f2d13ce7e3fe20b1fadecbf57248ce9f
src/space-case.js
src/space-case.js
const spaceCase = (a) => { return a .replace(/(_|-|\.)/g, ' ') .replace(/([A-Z])/g, ' $1') .replace(/\s+/g, ' ') .replace(/^\s+/, '') .replace(/\s$/, ''); }; export default spaceCase;
const spaceCase = (a) => { return a .replace(/(_|-|\.)/g, ' ') .replace(/([A-Z])/g, ' $1') .replace(/\s+/g, ' ') .replace(/(^\s|\s$)/g, ''); }; export default spaceCase;
Refactor spaceCase to combine "ltrim/rtrim" into one regex
Refactor spaceCase to combine "ltrim/rtrim" into one regex
JavaScript
mit
restrung/restrung-regex
--- +++ @@ -3,8 +3,7 @@ .replace(/(_|-|\.)/g, ' ') .replace(/([A-Z])/g, ' $1') .replace(/\s+/g, ' ') - .replace(/^\s+/, '') - .replace(/\s$/, ''); + .replace(/(^\s|\s$)/g, ''); }; export default spaceCase;
d6cb6adf103ace89ee6a3ab8c249a953cc0052ba
bin/bot.js
bin/bot.js
// Include needed files var fluffbot = require('../lib/fluffbot') var discord = require('discord.js') var event = require('../lib/event') // Instantiate bots var fluffbot = new fluffbot() discord = new discord.Client({autoReconnect:true}) discord.login(fluffbot.settings.bot_token) // Initiate the playing game to say the current version discord.on('ready', function(event) { this.status('online', 'Alpha v2.0.4 by FluffyMatt'); }) // Event listener when bot is added to a server discord.on('serverCreated', function(server) { this.sendMessage(server.generalChannel ,'@here FluffBot has joined '+server.name+' and is here to help!'); }) // Event listener for new member joining discord.on('serverNewMember', function(server, user) { this.sendMessage(server.generalChannel ,'@here Welcome '+user.toString()+' to the Fam'); }) // Event listener registered event.bus.on('response', function(message, data) { discord.reply(message, data) }) // Event listener registered event.bus.on('message', function(message, data) { discord.sendMessage(message, data) }) // Message event listener discord.on('message', function(message) { if (message.content.indexOf('!') > -1 && message.content[0] == '!') { fluffbot._runCommand(message) } })
// Include needed files var fluffbot = require('../lib/fluffbot') var discord = require('discord.js') var event = require('../lib/event') // Instantiate bots var fluffbot = new fluffbot() discord = new discord.Client({autoReconnect:true}) discord.login(fluffbot.settings.bot_token) // Initiate the playing game to say the current version discord.on('ready', function(event) { this.setStatus('online', 'Alpha v2.0.4 by FluffyMatt'); }) // Event listener when bot is added to a server discord.on('serverCreated', function(server) { this.sendMessage(server.generalChannel ,'@here FluffBot has joined '+server.name+' and is here to help!'); }) // Event listener for new member joining discord.on('serverNewMember', function(server, user) { this.sendMessage(server.generalChannel ,'@here Welcome '+user.toString()+' to the Fam'); }) // Event listener registered event.bus.on('response', function(message, data) { discord.reply(message, data) }) // Event listener registered event.bus.on('message', function(message, data) { discord.sendMessage(message, data) }) // Message event listener discord.on('message', function(message) { if (message.content.indexOf('!') > -1 && message.content[0] == '!') { fluffbot._runCommand(message) } })
Use method instead of property
Use method instead of property
JavaScript
mit
FluffyMatt/fluffbot
--- +++ @@ -11,7 +11,7 @@ // Initiate the playing game to say the current version discord.on('ready', function(event) { - this.status('online', 'Alpha v2.0.4 by FluffyMatt'); + this.setStatus('online', 'Alpha v2.0.4 by FluffyMatt'); }) // Event listener when bot is added to a server
bf7e23827e2aa912b6431e906763ceaa871f7640
commands/sa.js
commands/sa.js
'use strict'; var exec = require('child_process').exec; module.exports = function reboot(controller) { controller.hears('technical assessment', ['direct_message','mention','direct_mention', 'message_received'], function(bot, message) { bot.reply(message, 'May god have mercy on your souls...'); // console.log(message._client.channels.C0LFUN4F2.name); }); }
'use strict'; var exec = require('child_process').exec; module.exports = function reboot(controller) { controller.hears('technical assessment', ['direct_message','mention','direct_mention', 'message_received'], function(bot, message) { bot.reply(message, 'no comment'); // console.log(message._client.channels.C0LFUN4F2.name); }); }
Revert "Fixed the response to any mention of the technical (summary) assessment."
Revert "Fixed the response to any mention of the technical (summary) assessment." This reverts commit 36ab954db67f20fbb0612d10d2017bb4df893878.
JavaScript
mit
remotebeta/codybot
--- +++ @@ -4,7 +4,7 @@ module.exports = function reboot(controller) { controller.hears('technical assessment', ['direct_message','mention','direct_mention', 'message_received'], function(bot, message) { - bot.reply(message, 'May god have mercy on your souls...'); + bot.reply(message, 'no comment'); // console.log(message._client.channels.C0LFUN4F2.name); }); }
86d34450e5e0268e24b86aadf23ca1182fd7f06e
modules/authorization/route.js
modules/authorization/route.js
var Series = require('hapi-next'), Validator = require('modules/authorization/validator'), Controller = require('modules/authorization/controller'); module.exports = { login : { method : 'POST', path : '/login', config : { validate : Validator.validateReqLogin(), handler : function(request,reply) { var series = new Series([ Validator.login, Controller.login ]); series.execute(request,reply); } } }, logout : { method : 'POST', path : '/logout', config : { handler : function(request,reply) { var series = new Series([ Controller.logout ]); series.execute(request,reply); } } } }
var Series = require('hapi-next'), Validator = require('modules/authorization/validator'), Controller = require('modules/authorization/controller'); module.exports = { login : { method : 'POST', path : '/login', config : { validate : Validator.validateReqLogin(), handler : function(request,reply) { var series = new Series([ Validator.login, Controller.login ]); series.execute(request,reply); } } }, logout : { method : 'POST', path : '/logout', config : { handler : function(request,reply) { var series = new Series([ Controller.logout ]); series.execute(request,reply); } } } }
Update indentation to 2 spaces
Update indentation to 2 spaces
JavaScript
mit
Pranay92/lets-chat,Pranay92/collaborate
--- +++ @@ -3,37 +3,37 @@ Controller = require('modules/authorization/controller'); module.exports = { - - login : { - method : 'POST', - path : '/login', - config : { - validate : Validator.validateReqLogin(), - handler : function(request,reply) { + + login : { + method : 'POST', + path : '/login', + config : { + validate : Validator.validateReqLogin(), + handler : function(request,reply) { - var series = new Series([ - Validator.login, - Controller.login - ]); - - series.execute(request,reply); - } - } - }, + var series = new Series([ + Validator.login, + Controller.login + ]); + + series.execute(request,reply); + } + } + }, - logout : { - method : 'POST', - path : '/logout', - config : { - handler : function(request,reply) { + logout : { + method : 'POST', + path : '/logout', + config : { + handler : function(request,reply) { - var series = new Series([ - Controller.logout - ]); - - series.execute(request,reply); - } - } - } - + var series = new Series([ + Controller.logout + ]); + + series.execute(request,reply); + } + } + } + }
a416b0a1f674d8ab05472c961da780d69df8aa5b
packages/lambda/src/api/dbCreateItems/index.js
packages/lambda/src/api/dbCreateItems/index.js
import response from 'cfn-response' import SNS from 'aws/sns' import { Settings } from 'model/settings' export async function handle (event, context, callback) { if (event.RequestType === 'Update' || event.RequestType === 'Delete') { response.send(event, context, response.SUCCESS) return } const { AdminPageURL: adminPageURL, StatusPageURL: statusPageURL, CognitoPoolID: cognitoPoolID, IncidentNotificationTopic: incidentNotificationTopic } = event.ResourceProperties const settings = new Settings() try { if (statusPageURL) { await settings.setStatusPageURL(statusPageURL) } } catch (error) { // failed due to the unknown SNS topic. console.warn(error.message) } try { await new SNS().notifyIncidentToTopic(incidentNotificationTopic) if (adminPageURL) { await settings.setAdminPageURL(adminPageURL) } if (cognitoPoolID) { await settings.setCognitoPoolID(cognitoPoolID) } response.send(event, context, response.SUCCESS) } catch (error) { console.log(error.message) console.log(error.stack) response.send(event, context, response.FAILED) } }
import response from 'cfn-response' import SNS from 'aws/sns' import { Settings } from 'model/settings' export async function handle (event, context, callback) { if (event.RequestType === 'Update' || event.RequestType === 'Delete') { response.send(event, context, response.SUCCESS) return } const { AdminPageURL: adminPageURL, StatusPageURL: statusPageURL, CognitoPoolID: cognitoPoolID, IncidentNotificationTopic: incidentNotificationTopic } = event.ResourceProperties const settings = new Settings() try { if (statusPageURL) { await settings.setStatusPageURL(statusPageURL) } } catch (error) { // setStatusPageURL always fails due to the unknown SNS topic. So ignore the error here. // TODO: improve error handling. There may be other kinds of errors. console.warn(error.message) } try { await new SNS().notifyIncidentToTopic(incidentNotificationTopic) if (adminPageURL) { await settings.setAdminPageURL(adminPageURL) } if (cognitoPoolID) { await settings.setCognitoPoolID(cognitoPoolID) } await settings.createApiKey() response.send(event, context, response.SUCCESS) } catch (error) { console.log(error.message) console.log(error.stack) response.send(event, context, response.FAILED) } }
Create new API key on launching a new stack
Create new API key on launching a new stack
JavaScript
apache-2.0
ks888/LambStatus,ks888/LambStatus,ks888/LambStatus
--- +++ @@ -21,7 +21,8 @@ await settings.setStatusPageURL(statusPageURL) } } catch (error) { - // failed due to the unknown SNS topic. + // setStatusPageURL always fails due to the unknown SNS topic. So ignore the error here. + // TODO: improve error handling. There may be other kinds of errors. console.warn(error.message) } @@ -34,6 +35,9 @@ if (cognitoPoolID) { await settings.setCognitoPoolID(cognitoPoolID) } + + await settings.createApiKey() + response.send(event, context, response.SUCCESS) } catch (error) { console.log(error.message)
f01dc34ca41fcd59afd5da35b46b35659a835f55
test/conductor.js
test/conductor.js
// Test runner var runTests = require('./affixing-header-specs'), browsers = [ {browserName: 'chrome'}, {browserName: 'firefox'} ]; // var browserConfig = require('./helpers/browser-config'); if (process.env.TRAVIS_JOB_NUMBER) { browsers.push( {browserName: 'Safari', version: '7'}, {browserName: 'Safari', deviceName: 'iPhone Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7'}, {browserName: 'Safari', deviceName: 'iPad Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7'}, {browserName: 'Browser', deviceName: 'Samsung Galaxy S4 Emulator', platformName: 'Android', platformVersion: '4.4', appiumVersion: '1.3.7'}, {browserName: 'internet explorer'} ); } browsers.forEach(function(browser) { runTests(browser); });
// Test runner var runTests = require('./affixing-header-specs'), browsers = [ {browserName: 'chrome'}, {browserName: 'firefox'} ]; // var browserConfig = require('./helpers/browser-config'); if (process.env.TRAVIS_JOB_NUMBER) { browsers.push( {browserName: 'Safari', version: '7'}, {browserName: 'Safari', deviceName: 'iPhone Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, {browserName: 'Safari', deviceName: 'iPad Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, {browserName: 'Browser', deviceName: 'Android Emulator', platformName: 'Android', platformVersion: '4.4', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, {browserName: 'internet explorer'} ); } browsers.forEach(function(browser) { runTests(browser); });
Use generic Android Emulator, add device-orientation
Use generic Android Emulator, add device-orientation
JavaScript
cc0-1.0
acusti/affixing-header,acusti/affixing-header
--- +++ @@ -10,9 +10,9 @@ if (process.env.TRAVIS_JOB_NUMBER) { browsers.push( {browserName: 'Safari', version: '7'}, - {browserName: 'Safari', deviceName: 'iPhone Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7'}, - {browserName: 'Safari', deviceName: 'iPad Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7'}, - {browserName: 'Browser', deviceName: 'Samsung Galaxy S4 Emulator', platformName: 'Android', platformVersion: '4.4', appiumVersion: '1.3.7'}, + {browserName: 'Safari', deviceName: 'iPhone Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, + {browserName: 'Safari', deviceName: 'iPad Simulator', platformName: 'iOS', platformVersion: '8.2', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, + {browserName: 'Browser', deviceName: 'Android Emulator', platformName: 'Android', platformVersion: '4.4', appiumVersion: '1.3.7', 'device-orientation': 'portrait'}, {browserName: 'internet explorer'} ); }
ca33d145097d8c7bb4c022be010d0f939250bccc
workflows/createDeployment.js
workflows/createDeployment.js
'use strict'; // workflows/createDeployment var Joi = require('joi'); module.exports = { schema: Joi.object({ deployerId: Joi.string().required(), name: Joi.string().min(1).required(), }).required().unknown(true), version: '1.0', decider: function(args) { return { createDeploymentDoc: { activity: 'createDeploymentDoc', input: (env) => ({}), output: (env) => ({ theId: env.id, newValueThatIWant: env.newValueThatIWant }) }, startNewDeployment: { dependsOn: ['createDeploymentDoc'], input: (env) => ({ deploymentId: env.theId }), workflow: 'startDeployment' }, doSomethingWithDeployment: { dependsOn: ['startNewDeployment'], input: (env) => { return { theValue: env.newValueThatIWant }; }, output: (env) => { env.BLAMMO = 'mrow0'; return { env }; }, workflow: 'doSomething' }, setDeploymentStateCreated: { dependsOn: ['startNewDeployment'], input: (env) => { return { state: 'Running', id: env.theId }; }, activity: 'setDeploymentDocState', }, } }, output: function(results) { return { env: { deployment: results.startNewDeployment } }; } };
'use strict'; // workflows/createDeployment var Joi = require('joi'); module.exports = { schema: Joi.object({ deployerId: Joi.string().required(), name: Joi.string().min(1).required(), }).required().unknown(true), version: '1.0', decider: function(args) { return { createDeploymentDoc: { activity: 'createDeploymentDoc', input: (env) => ({}), output: (env) => { return { env: { theId: env.id, newValueThatIWant: env.newValueThatIWant } }; } }, startNewDeployment: { dependsOn: ['createDeploymentDoc'], input: (env) => { return { deploymentId: env.theId }; }, workflow: 'startDeployment' }, doSomethingWithDeployment: { dependsOn: ['startNewDeployment'], input: (env) => { return { theValue: env.newValueThatIWant }; }, output: (env) => { env.BLAMMO = 'mrow0'; return { env }; }, workflow: 'doSomething' }, setDeploymentStateCreated: { dependsOn: ['startNewDeployment'], input: (env) => { return { state: 'Running', id: env.theId }; }, activity: 'setDeploymentDocState', }, } }, output: function(results) { return { env: { deployment: results.startNewDeployment } }; } };
Update examples to return env from output defined on parent workflow
Update examples to return env from output defined on parent workflow
JavaScript
mit
f5itc/swf-graph,f5itc/swf-graph,f5itc/swf-graph
--- +++ @@ -17,12 +17,16 @@ createDeploymentDoc: { activity: 'createDeploymentDoc', input: (env) => ({}), - output: (env) => ({ theId: env.id, newValueThatIWant: env.newValueThatIWant }) + output: (env) => { + return { env: { theId: env.id, newValueThatIWant: env.newValueThatIWant } }; + } }, startNewDeployment: { dependsOn: ['createDeploymentDoc'], - input: (env) => ({ deploymentId: env.theId }), + input: (env) => { + return { deploymentId: env.theId }; + }, workflow: 'startDeployment' },
093ab10177a6a70fdf073c63421346c442613647
src/modules/spaceshipsDataReducer.js
src/modules/spaceshipsDataReducer.js
import { createAction, handleActions } from 'redux-actions' export const INITIAL_DATA = 'INITIAL_DATA' export const initialData = createAction(INITIAL_DATA) const spaceshipsDataReducer = handleActions({ [INITIAL_DATA]: (state, action) => { const { payload } = action return { ...state, spaceships: payload.products } } }, { spaceships: [] }) export default spaceshipsDataReducer
import { createAction, handleActions } from 'redux-actions' export const selectSpaceshipsData = state => state.spaceshipsData.spaceships export const INITIAL_DATA = 'INITIAL_DATA' export const initialData = createAction(INITIAL_DATA) const spaceshipsDataReducer = handleActions({ [INITIAL_DATA]: (state, action) => { const { payload } = action return { ...state, spaceships: payload.products } } }, { spaceships: [] }) export default spaceshipsDataReducer
Move selectSpaceshipsData to global reducer
Move selectSpaceshipsData to global reducer
JavaScript
mit
billdevcode/spaceship-emporium,billdevcode/spaceship-emporium
--- +++ @@ -1,4 +1,6 @@ import { createAction, handleActions } from 'redux-actions' + +export const selectSpaceshipsData = state => state.spaceshipsData.spaceships export const INITIAL_DATA = 'INITIAL_DATA'
39d5e9f4be50ba9ec8ca0bff4138c26e8ddeefe8
lib/archive-tree.js
lib/archive-tree.js
module.exports = { sortChildren (data) { data.forEach((el) => { if (el.parent) { this.findNestedObject(data, el.parent[0].admin.uid).children.push(el); } }); return this.arrangeChildren(data[0]); }, findNestedObject (objects, id) { var found; for (var i = 0; i < objects.length; i++) { if (objects[i].id === id) { found = objects[i]; break; } else if (objects[i].children) { found = this.findNestedObject(objects[i].children, id); if (found) { break; } } } if (found) { if (!found.children) found.children = []; return found; } }, arrangeChildren (item) { if (item.children) { for (var i = 0; i < item.children.length; i++) { this.arrangeChildren(item.children[i]); } item.children = item.children.sort(sortByIdentifier); } return item; } }; function sortByIdentifier (a, b) { var aIdentifier = a.identifier; var bIdentifier = b.identifier; if (aIdentifier < bIdentifier) { return -1; } if (aIdentifier > bIdentifier) { return 1; } return 0; }
module.exports = { sortChildren (data) { data.forEach((el) => { if (el.parent) { if (this.findNestedObject(data, el.parent[0].admin.uid)) { this.findNestedObject(data, el.parent[0].admin.uid).children.push(el); } } }); return this.arrangeChildren(data[0]); }, findNestedObject (objects, id) { var found; for (var i = 0; i < objects.length; i++) { if (objects[i].id === id) { found = objects[i]; break; } else if (objects[i].children) { found = this.findNestedObject(objects[i].children, id); if (found) { break; } } } if (found) { if (!found.children) found.children = []; return found; } }, arrangeChildren (item) { if (item.children) { for (var i = 0; i < item.children.length; i++) { this.arrangeChildren(item.children[i]); } item.children = item.children.sort(sortByIdentifier); } return item; } }; function sortByIdentifier (a, b) { var aIdentifier = a.identifier; var bIdentifier = b.identifier; if (aIdentifier < bIdentifier) { return -1; } if (aIdentifier > bIdentifier) { return 1; } return 0; }
Check for element before tryign to retrive an attibiute of that element
Check for element before tryign to retrive an attibiute of that element
JavaScript
mit
TheScienceMuseum/collectionsonline,TheScienceMuseum/collectionsonline
--- +++ @@ -2,7 +2,9 @@ sortChildren (data) { data.forEach((el) => { if (el.parent) { - this.findNestedObject(data, el.parent[0].admin.uid).children.push(el); + if (this.findNestedObject(data, el.parent[0].admin.uid)) { + this.findNestedObject(data, el.parent[0].admin.uid).children.push(el); + } } }); return this.arrangeChildren(data[0]);
c3b367a8c05ae7e21701c8d487d9e9e70f95d7f0
lib/orbit-common.js
lib/orbit-common.js
import OC from 'orbit-common/main'; import Cache from 'orbit-common/cache'; import IdMap from 'orbit-common/id-map'; import Schema from 'orbit-common/schema'; import Serializer from 'orbit-common/serializer'; import Source from 'orbit-common/source'; import MemorySource from 'orbit-common/memory-source'; import { OperationNotAllowed, RecordNotFoundException, LinkNotFoundException, RecordAlreadyExistsException } from 'orbit-common/lib/exceptions'; OC.Cache = Cache; OC.Schema = Schema; OC.Serializer = Serializer; OC.Source = Source; OC.MemorySource = MemorySource; // exceptions OC.OperationNotAllowed = OperationNotAllowed; OC.RecordNotFoundException = RecordNotFoundException; OC.LinkNotFoundException = LinkNotFoundException; OC.RecordAlreadyExistsException = RecordAlreadyExistsException; export default OC;
import OC from 'orbit-common/main'; import Cache from 'orbit-common/cache'; import Schema from 'orbit-common/schema'; import Serializer from 'orbit-common/serializer'; import Source from 'orbit-common/source'; import MemorySource from 'orbit-common/memory-source'; import { OperationNotAllowed, RecordNotFoundException, LinkNotFoundException, RecordAlreadyExistsException } from 'orbit-common/lib/exceptions'; OC.Cache = Cache; OC.Schema = Schema; OC.Serializer = Serializer; OC.Source = Source; OC.MemorySource = MemorySource; // exceptions OC.OperationNotAllowed = OperationNotAllowed; OC.RecordNotFoundException = RecordNotFoundException; OC.LinkNotFoundException = LinkNotFoundException; OC.RecordAlreadyExistsException = RecordAlreadyExistsException; export default OC;
Remove IdMap from Orbit exports.
Remove IdMap from Orbit exports.
JavaScript
mit
orbitjs/orbit.js,beni55/orbit.js,jpvanhal/orbit-core,opsb/orbit.js,orbitjs/orbit-core,ProlificLab/orbit.js,lytbulb/orbit.js,orbitjs/orbit.js,lytbulb/orbit.js,rollokb/orbit.js,jpvanhal/orbit.js,opsb/orbit-firebase,opsb/orbit-firebase,opsb/orbit-firebase,lytbulb/orbit-firebase,gnarf/orbit.js,ProlificLab/orbit.js,beni55/orbit.js,rollokb/orbit.js,opsb/orbit-firebase,greyhwndz/orbit.js,SmuliS/orbit.js,jpvanhal/orbit.js,lytbulb/orbit-firebase,jpvanhal/orbit-core,greyhwndz/orbit.js,opsb/orbit.js,SmuliS/orbit.js,lytbulb/orbit-firebase
--- +++ @@ -1,6 +1,5 @@ import OC from 'orbit-common/main'; import Cache from 'orbit-common/cache'; -import IdMap from 'orbit-common/id-map'; import Schema from 'orbit-common/schema'; import Serializer from 'orbit-common/serializer'; import Source from 'orbit-common/source';
3fba933315cc62c0255ae52936f5e375813fbd3b
Omise/Payment/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js
Omise/Payment/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js
define( [ 'Magento_Payment/js/view/payment/cc-form' ], function (Component) { 'use strict'; return Component.extend({ defaults: { template: 'Omise_Payment/payment/omise-cc-form' }, }); } );
define( [ 'Magento_Payment/js/view/payment/cc-form' ], function (Component) { 'use strict'; return Component.extend({ defaults: { template: 'Omise_Payment/payment/omise-cc-form' }, getCode: function() { return 'omise'; }, isActive: function() { return true; } }); } );
Add client side script functions to display the checkout form
Add client side script functions to display the checkout form
JavaScript
mit
omise/omise-magento,omise/omise-magento,omise/omise-magento
--- +++ @@ -8,6 +8,14 @@ defaults: { template: 'Omise_Payment/payment/omise-cc-form' }, + + getCode: function() { + return 'omise'; + }, + + isActive: function() { + return true; + } }); } );
c808428d7a8ff3accab13f944e62573a3ee38128
registrar/models/university.js
registrar/models/university.js
'use strict'; module.exports = function(sequelize, DataTypes) { var University = sequelize.define("University", { name: { type: DataTypes.STRING, allowNull: false, }, country: { type: DataTypes.STRING, allowNull: false, }, }, { indexes: [ {unique: true, fields: ['name']} ], }); return University; };
'use strict'; module.exports = function(sequelize, DataTypes) { var University = sequelize.define("University", { name: { type: DataTypes.STRING, allowNull: false, }, country: { type: DataTypes.STRING, allowNull: false, }, }, { indexes: [ {unique: true, fields: ['name']} ], classMethods: { associate: (models) => { University.hasMany(models.User); University.hasMany(models.School); } } }); return University; };
Add University associations with User, School
Add University associations with User, School
JavaScript
mit
dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet
--- +++ @@ -14,6 +14,12 @@ indexes: [ {unique: true, fields: ['name']} ], + classMethods: { + associate: (models) => { + University.hasMany(models.User); + University.hasMany(models.School); + } + } }); return University;
e96036e8dc450b8ddfccbda9c9c831aed64735d4
functions/index.js
functions/index.js
const functions = require('firebase-functions'); const { getPullRequestsForUser } = require('./github.js'); exports.user = functions.https.onRequest(async (request, response) => { try { const data = await getPullRequestsForUser(request.params[0]); response.send({ ...data, config: process.env.FIREBASE_CONFIG }); } catch(error) { response.send({ error: error.toString(), stacktrace: error.stack, config: process.env.FIREBASE_CONFIG }); } });
const functions = require('firebase-functions'); const { getPullRequestsForUser } = require('./github.js'); exports.user = functions.https.onRequest(async (request, response) => { try { const data = await getPullRequestsForUser(request.params[0]); response.send(data); } catch(error) { response.send({ error: error.toString(), stacktrace: error.stack }); } });
Remove firebase config from resp
Remove firebase config from resp
JavaScript
mit
karanjthakkar/showmyprs.com
--- +++ @@ -4,15 +4,11 @@ exports.user = functions.https.onRequest(async (request, response) => { try { const data = await getPullRequestsForUser(request.params[0]); - response.send({ - ...data, - config: process.env.FIREBASE_CONFIG - }); + response.send(data); } catch(error) { response.send({ error: error.toString(), - stacktrace: error.stack, - config: process.env.FIREBASE_CONFIG + stacktrace: error.stack }); } });
5dcbf8c82bec5ccc94a1a3ee209697bfae0bc45c
js/components/content-header.js
js/components/content-header.js
(function(app) { 'use strict'; var jCore = require('jcore'); var helper = app.helper || require('../helper.js'); var ContentHeader = helper.inherits(function() { ContentHeader.super_.call(this); }, jCore.Component); if (typeof module !== 'undefined' && module.exports) module.exports = ContentHeader; else app.ContentHeader = ContentHeader; })(this.app || (this.app = {}));
(function(app) { 'use strict'; var jCore = require('jcore'); var helper = app.helper || require('../helper.js'); var ContentHeader = helper.inherits(function(props) { ContentHeader.super_.call(this); this.element = this.prop(props.element); }, jCore.Component); if (typeof module !== 'undefined' && module.exports) module.exports = ContentHeader; else app.ContentHeader = ContentHeader; })(this.app || (this.app = {}));
Add property to access element of the content header
Add property to access element of the content header
JavaScript
mit
ionstage/modular,ionstage/modular
--- +++ @@ -4,8 +4,10 @@ var jCore = require('jcore'); var helper = app.helper || require('../helper.js'); - var ContentHeader = helper.inherits(function() { + var ContentHeader = helper.inherits(function(props) { ContentHeader.super_.call(this); + + this.element = this.prop(props.element); }, jCore.Component); if (typeof module !== 'undefined' && module.exports)
8eb04e26730dbaa622140a90b0d1f63bdbd5c65b
samples/templateweb/server.js
samples/templateweb/server.js
var cobs = require('../..'), http = require('http'), fs = require('fs'); function compileFile(filename) { var content = fs.readFileSync(filename).toString(); var code = cobs.compileTemplate(content); var parser = new cobs.Parser(code); var program = parser.parseProgram(); program.text = program.command.compile(program); return program; }; var program = compileFile('./factorial.cobp'); http.createServer(function(req, res) { var runtime = { display: function() { if (arguments && arguments.length) for (var k = 0; k < arguments.length; k++) if (arguments[k]) res.write(arguments[k].toString()); res.write('\r\n'); }, write: function() { if (arguments && arguments.length) for (var k = 0; k < arguments.length; k++) if (arguments[k]) res.write(arguments[k].toString()); } } cobs.run(program.text, runtime, program); res.end(); }).listen(8000); console.log('Server started, listening at port 8000');
var cobs = require('../..'), http = require('http'), fs = require('fs'); var program = cobs.compileTemplateFile('./factorial.cobp'); http.createServer(function(req, res) { var runtime = { display: function() { if (arguments && arguments.length) for (var k = 0; k < arguments.length; k++) if (arguments[k]) res.write(arguments[k].toString()); res.write('\r\n'); }, write: function() { if (arguments && arguments.length) for (var k = 0; k < arguments.length; k++) if (arguments[k]) res.write(arguments[k].toString()); } } program.run(runtime); res.end(); }).listen(8000); console.log('Server started, listening at port 8000');
Refactor template web sample to use compileTemplateFile
Refactor template web sample to use compileTemplateFile
JavaScript
mit
ajlopez/CobolScript
--- +++ @@ -3,16 +3,7 @@ http = require('http'), fs = require('fs'); -function compileFile(filename) { - var content = fs.readFileSync(filename).toString(); - var code = cobs.compileTemplate(content); - var parser = new cobs.Parser(code); - var program = parser.parseProgram(); - program.text = program.command.compile(program); - return program; -}; - -var program = compileFile('./factorial.cobp'); +var program = cobs.compileTemplateFile('./factorial.cobp'); http.createServer(function(req, res) { var runtime = { @@ -32,7 +23,7 @@ } } - cobs.run(program.text, runtime, program); + program.run(runtime); res.end(); }).listen(8000);
c47361846c3a0e8051f7e08fa5bc0478b8104bce
server/methods/residencies.js
server/methods/residencies.js
import newResidentAndResidencySchema from '/both/schemas/newResidentAndResidencySchema'; Meteor.methods({ addNewResidentAndResidency (document) { // set up validation context based on new resident and residency schama const validationContext = newResidentAndResidencySchema.newContext(); // Check if submitted document is valid const documentIsValid = validationContext.validate(document); if (documentIsValid) { // Get fields from object firstName = document.firstName; lastInitial = document.lastInitial; homeId = document.homeId; moveIn = document.moveIn; // Create new resident // TODO: migrate homeId out of resident schema const residentId = Residents.insert({ firstName, lastInitial, homeId }); if (residentId) { // Insert residency document const residencyId = Residencies.insert({ residentId, homeId, moveIn }); if (residencyId) { // Submission was successful return true; } else { // Could not create residency throw new Meteor.Error( 'could-not-create-residency', 'Could not create residency.' ) } } else { // Could not create resident throw new Meteor.Error( 'could-not-create-resident', 'Could not create resident.' ) } } else { // Document is not valid throw new Meteor.Error( 'resident-and-residency-invalid', 'Resident and residency document is not valid.' ) } } });
import newResidentAndResidencySchema from '/both/schemas/newResidentAndResidencySchema'; Meteor.methods({ addNewResidentAndResidency (document) { // set up validation context based on new resident and residency schama const validationContext = newResidentAndResidencySchema.newContext(); // Check if submitted document is valid const documentIsValid = validationContext.validate(document); if (documentIsValid) { // Get fields from object const { firstName, lastInitial, homeId, moveIn } = document; // Create new resident // TODO: migrate homeId out of resident schema const residentId = Residents.insert({ firstName, lastInitial, homeId }); if (residentId) { // Insert residency document const residencyId = Residencies.insert({ residentId, homeId, moveIn }); if (residencyId) { // Submission was successful return true; } else { // Could not create residency throw new Meteor.Error( 'could-not-create-residency', 'Could not create residency.' ) } } else { // Could not create resident throw new Meteor.Error( 'could-not-create-resident', 'Could not create resident.' ) } } else { // Document is not valid throw new Meteor.Error( 'resident-and-residency-invalid', 'Resident and residency document is not valid.' ) } } });
Use object destructuring for resident attributes
Use object destructuring for resident attributes
JavaScript
agpl-3.0
brylie/juhani-wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing
--- +++ @@ -10,10 +10,7 @@ if (documentIsValid) { // Get fields from object - firstName = document.firstName; - lastInitial = document.lastInitial; - homeId = document.homeId; - moveIn = document.moveIn; + const { firstName, lastInitial, homeId, moveIn } = document; // Create new resident // TODO: migrate homeId out of resident schema
cdeca36337d76404cb8ea02f90e84ed9d0ca0c4e
scripts/models/graphs-model.js
scripts/models/graphs-model.js
// TODO: This is not a real model or controller App.Graphs = Ember.Controller.extend({ graph: function(emberId, entityName, entityType, numSeries) { entityName = entityName.replace(/\./g, '-'); var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName; if (numSeries) url += '&numSeries=' + numSeries; return Ember.$.ajax({ url: url, type: 'GET', dataType: 'json' }).then(function (data) { if (entityType == 'node') { App.store.getById('node', emberId).set('graphs', App.associativeToNumericArray(data)); } else if (entityType == 'vm') { App.store.getById('vm', emberId).set('graphs', App.associativeToNumericArray(data)); } }); } }); App.graphs = App.Graphs.create();
// TODO: This is not a real model or controller App.Graphs = Ember.Controller.extend({ graph: function(emberId, entityName, entityType, numSeries) { entityName = entityName.replace(/\./g, '-'); var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName '&graphVars={"colorList":"yellow,green,orange,red,blue,pink"}'; if (numSeries) url += '&numSeries=' + numSeries; return Ember.$.ajax({ url: url, type: 'GET', dataType: 'json' }).then(function (data) { if (entityType == 'node') { App.store.getById('node', emberId).set('graphs', App.associativeToNumericArray(data)); } else if (entityType == 'vm') { App.store.getById('vm', emberId).set('graphs', App.associativeToNumericArray(data)); } }); } }); App.graphs = App.Graphs.create();
Use brighter colors in contextual Graphite graphs
Use brighter colors in contextual Graphite graphs
JavaScript
apache-2.0
vine77/saa-ui,vine77/saa-ui,vine77/saa-ui
--- +++ @@ -2,7 +2,7 @@ App.Graphs = Ember.Controller.extend({ graph: function(emberId, entityName, entityType, numSeries) { entityName = entityName.replace(/\./g, '-'); - var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName; + var url = ((!localStorage.apiDomain) ? '' : '//' + localStorage.apiDomain) + '/api/v1/graphs?entityType=' + entityType + '&entityName=' + entityName '&graphVars={"colorList":"yellow,green,orange,red,blue,pink"}'; if (numSeries) url += '&numSeries=' + numSeries; return Ember.$.ajax({ url: url,
0c02a02ce126113e7ea3a36a571f326b9c186cab
webpack.config.js
webpack.config.js
const path = require('path'); const context = path.join(__dirname, 'site'); const public = path.join(__dirname, 'public'); module.exports = { context, devServer: { contentBase: public, historyApiFallback: true, open: true }, devtool: 'source-map', entry: './index.js', module: { rules: [ { test: /\.js$/, use: { loader: 'babel-loader', options: { plugins: [ ['transform-react-jsx', { pragma: 'h' }], 'transform-skate-flow-props' ], presets: ['env', 'flow', 'react', 'stage-0'] } } }, { test: /\.(html|png)/, use: { loader: 'file-loader', options: { name: '[path][name].[ext]' } } } ] }, output: { filename: '[name].js', path: public, publicPath: '/' } };
const path = require('path'); const context = path.join(__dirname, 'site'); const public = path.join(__dirname, 'public'); const webpack = require('webpack'); module.exports = { context, devServer: { contentBase: public, historyApiFallback: true, open: true }, devtool: 'source-map', entry: './index.js', module: { rules: [ { test: /\.js$/, use: { loader: 'babel-loader', options: { plugins: [ ['transform-react-jsx', { pragma: 'h' }], 'transform-skate-flow-props' ], presets: ['env', 'flow', 'react', 'stage-0'] } } }, { test: /\.(html|png)/, use: { loader: 'file-loader', options: { name: '[path][name].[ext]' } } } ] }, output: { filename: '[name].js', path: public, publicPath: '/' }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ name: 'main', minChunks: 2, children: true, deepChildren: true }) ] };
Add common chunks to dedupe common deps between lazy components.
Add common chunks to dedupe common deps between lazy components.
JavaScript
mit
skatejs/skatejs,skatejs/skatejs,skatejs/skatejs,chrisdarroch/skatejs,chrisdarroch/skatejs
--- +++ @@ -1,6 +1,7 @@ const path = require('path'); const context = path.join(__dirname, 'site'); const public = path.join(__dirname, 'public'); +const webpack = require('webpack'); module.exports = { context, @@ -41,5 +42,13 @@ filename: '[name].js', path: public, publicPath: '/' - } + }, + plugins: [ + new webpack.optimize.CommonsChunkPlugin({ + name: 'main', + minChunks: 2, + children: true, + deepChildren: true + }) + ] };
bdb390a1adfae17297c11de4395dca0c5fe7d9eb
app/scripts/components/openstack/openstack-tenant/appstore-field-select-openstack-tenant.js
app/scripts/components/openstack/openstack-tenant/appstore-field-select-openstack-tenant.js
import template from './appstore-field-select-openstack-tenant.html'; class AppstoreFieldSelectOpenstackTenantController { // @ngInject constructor(ncUtilsFlash, openstackTenantsService, currentStateService) { this.ncUtilsFlash = ncUtilsFlash; this.openstackTenantsService = openstackTenantsService; this.currentStateService = currentStateService; } $onInit() { this.loading = true; this.currentStateService.getProject().then(project => { this.openstackTenantsService.getAll({ field: ['name', 'uuid'], project_uuid: project.uuid, }).then(tenants => { this.choices = tenants.map(tenant => ({ display_name: tenant.name, value: `UUID: ${tenant.uuid}. Name: ${tenant.name}` })); this.loading = false; this.loaded = true; }) .catch(response => { this.ncUtilsFlash.errorFromResponse(response, gettext('Unable to get list of OpenStack tenants.')); this.loading = false; this.loaded = false; }); }); } } const appstoreFieldSelectOpenstackTenant = { template, bindings: { field: '<', model: '<' }, controller: AppstoreFieldSelectOpenstackTenantController, }; export default appstoreFieldSelectOpenstackTenant;
import template from './appstore-field-select-openstack-tenant.html'; class AppstoreFieldSelectOpenstackTenantController { // @ngInject constructor(ncUtilsFlash, openstackTenantsService, currentStateService) { this.ncUtilsFlash = ncUtilsFlash; this.openstackTenantsService = openstackTenantsService; this.currentStateService = currentStateService; } $onInit() { this.loading = true; this.currentStateService.getProject().then(project => { this.openstackTenantsService.getAll({ field: ['name', 'uuid'], project_uuid: project.uuid, }).then(tenants => { this.choices = tenants.map(tenant => ({ display_name: tenant.name, value: `Tenant UUID: ${tenant.backend_id}. Name: ${tenant.name}` })); this.loading = false; this.loaded = true; }) .catch(response => { this.ncUtilsFlash.errorFromResponse(response, gettext('Unable to get list of OpenStack tenants.')); this.loading = false; this.loaded = false; }); }); } } const appstoreFieldSelectOpenstackTenant = { template, bindings: { field: '<', model: '<' }, controller: AppstoreFieldSelectOpenstackTenantController, }; export default appstoreFieldSelectOpenstackTenant;
Use backend_id instead of Waldur UUID for OpenStack
Use backend_id instead of Waldur UUID for OpenStack
JavaScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -17,7 +17,7 @@ }).then(tenants => { this.choices = tenants.map(tenant => ({ display_name: tenant.name, - value: `UUID: ${tenant.uuid}. Name: ${tenant.name}` + value: `Tenant UUID: ${tenant.backend_id}. Name: ${tenant.name}` })); this.loading = false; this.loaded = true;
242705eae5ed23fbc1b10c7e3b6dc1f187433082
webpack.config.js
webpack.config.js
module.exports = { entry: "./src/ko-calendar.js", output: { filename: "./ko-calendar.js", libraryTarget: "commonjs2" } }
module.exports = { entry: "./src/ko-calendar.js", output: { filename: "./ko-calendar.js", libraryTarget: "commonjs" } }
Change webpack library target to commonjs
Change webpack library target to commonjs
JavaScript
mit
Seikho/ko-calendar,Seikho/ko-calendar,Seikho/ko-calendar
--- +++ @@ -2,6 +2,6 @@ entry: "./src/ko-calendar.js", output: { filename: "./ko-calendar.js", - libraryTarget: "commonjs2" + libraryTarget: "commonjs" } }
5e5072ced3b8fcec76b91f6fa7addaedb6702a35
configs/biomes.js
configs/biomes.js
var biomes = { "riverLand": { probability: 0.8, tiles: { "bambooBush": 0.8, "rockCluster": 0.2 } }, "forest": { probability: 0.5, tiles: { "loneTree": 0.25, "rockCluster": 0.75 } }, "desert": { probability: 0.5, tiles: { "loneTree": 0.25, "rockCluster": 0.75 } } }
var biomes = { "riverLand": { probability: 0, tiles: { "bambooBush": 0, "rockCluster": 0.2 } }, "forest": { probability: 0.5, tiles: { "loneTree": 0.25, "rockCluster": 0.75 } }, "desert": { probability: 0.5, tiles: { "loneTree": 0.25, "rockCluster": 0.75 } } }
Set bamboo generation percent to 0 until water is ready
Set bamboo generation percent to 0 until water is ready
JavaScript
mit
zkingston/coroga,zkingston/coroga
--- +++ @@ -1,8 +1,8 @@ var biomes = { "riverLand": { - probability: 0.8, + probability: 0, tiles: { - "bambooBush": 0.8, + "bambooBush": 0, "rockCluster": 0.2 } },
cace74599168013eb66cf9e9ab2623fb1ad392e3
webpack.config.js
webpack.config.js
/* eslint-env node */ /* eslint-disable no-console */ const webpack = require('webpack'); const debug = require('debug')('app:webpack'); const isDev = process.env.NODE_ENV !== 'production'; debug(`Running in ${(isDev ? 'development' : 'production')} mode`); module.exports = { entry: { 'main': './src/browser/main', 'service-worker': './src/browser/service-worker.js', }, output: { path: './public/compiled/scripts', filename: '[name].js', }, module: { rules: [ {test: /\.js$/, exclude: /node_modules/, use: ['babel-loader']}, ], }, plugins: [].concat( isDev ? [] : new webpack.optimize.UglifyJsPlugin({sourceMap: true}), new webpack.DefinePlugin({BUILD_ID: Date.now()}), new webpack.BannerPlugin({banner: `Build date: ${new Date()}`}) ), devtool: 'source-map', };
/* eslint-env node */ /* eslint-disable no-console */ const webpack = require('webpack'); const debug = require('debug')('app:webpack'); const isDev = process.env.NODE_ENV !== 'production'; debug(`Running in ${(isDev ? 'development' : 'production')} mode`); module.exports = { entry: { 'main': './src/browser/main', 'service-worker': './src/browser/service-worker.js', }, output: { path: `${__dirname}/public/compiled/scripts`, filename: '[name].js', }, module: { rules: [ {test: /\.js$/, exclude: /node_modules/, use: ['babel-loader']}, ], }, plugins: [].concat( isDev ? [] : new webpack.optimize.UglifyJsPlugin({sourceMap: true}), new webpack.DefinePlugin({BUILD_ID: Date.now()}), new webpack.BannerPlugin({banner: `Build date: ${new Date()}`}) ), devtool: 'source-map', };
Fix error "The provided value ... is not an absolute path!"
Fix error "The provided value ... is not an absolute path!"
JavaScript
mit
frosas/lag,frosas/lag,frosas/lag
--- +++ @@ -13,7 +13,7 @@ 'service-worker': './src/browser/service-worker.js', }, output: { - path: './public/compiled/scripts', + path: `${__dirname}/public/compiled/scripts`, filename: '[name].js', }, module: {
2b29a5df0e61f49dcf2875b89b93c0dcfca13daf
webpack.config.js
webpack.config.js
const fs = require('fs'); const Encore = require('@symfony/webpack-encore'); const { paths, js: { entries, vendor } } = JSON.parse(fs.readFileSync('./package.json')).config; const env = process.env.NODE_ENV === 'production' ? 'production' : 'dev'; Encore.configureRuntimeEnvironment(env); Encore // directory where all compiled assets will be stored .setOutputPath(paths.dist.js) // what's the public path to this directory (relative to your project's document root dir) .setPublicPath('/') // empty the outputPath dir before each build .cleanupOutputBeforeBuild() .enableSourceMaps(!Encore.isProduction()) // Split vendor assets from the entries .createSharedEntry('vendor', vendor) // create hashed filenames (e.g. app.abc123.css) .enableVersioning(); // Dynamically load entry points entries.forEach((entry) => { Encore.addEntry(entry.replace('.js', ''), `${paths.source.js}/${entry}`); }); const config = Encore.getWebpackConfig(); config.bail = true; console.log(config); // export the final configuration module.exports = config;
const fs = require('fs'); const Encore = require('@symfony/webpack-encore'); const { paths, js: { entries, vendor } } = JSON.parse(fs.readFileSync('./package.json')).config; const env = process.env.NODE_ENV === 'production' ? 'production' : 'dev'; Encore.configureRuntimeEnvironment(env); Encore // directory where all compiled assets will be stored .setOutputPath(paths.dist.js) // what's the public path to this directory (relative to your project's document root dir) .setPublicPath('/') // empty the outputPath dir before each build .cleanupOutputBeforeBuild() .enableSourceMaps(!Encore.isProduction()) // Split vendor assets from the entries .createSharedEntry('vendor', vendor) // create hashed filenames (e.g. app.abc123.css) .enableVersioning(); // Dynamically load entry points entries.forEach((entry) => { Encore.addEntry(entry.replace('.js', ''), `${paths.source.js}/${entry}`); }); // Check for errors and exit the process if (env === 'production') { Encore.addPlugin(function () { // eslint-disable-line func-names, needed to expose `this` this.plugin('done', (stats) => { if (stats.compilation.errors && stats.compilation.errors.length) { throw new Error('webpack build failed'); } }); }); } // export the final configuration module.exports = Encore.getWebpackConfig();
Exit the process if there is a compile error in a production build
Exit the process if there is a compile error in a production build
JavaScript
mit
e-sites/fe-boilerplate-poc,e-sites/fe-boilerplate-poc
--- +++ @@ -1,10 +1,13 @@ const fs = require('fs'); const Encore = require('@symfony/webpack-encore'); + const { paths, js: { entries, vendor } } = JSON.parse(fs.readFileSync('./package.json')).config; const env = process.env.NODE_ENV === 'production' ? 'production' : 'dev'; + Encore.configureRuntimeEnvironment(env); + Encore // directory where all compiled assets will be stored @@ -24,16 +27,24 @@ // create hashed filenames (e.g. app.abc123.css) .enableVersioning(); + // Dynamically load entry points entries.forEach((entry) => { Encore.addEntry(entry.replace('.js', ''), `${paths.source.js}/${entry}`); }); -const config = Encore.getWebpackConfig(); -config.bail = true; +// Check for errors and exit the process +if (env === 'production') { + Encore.addPlugin(function () { // eslint-disable-line func-names, needed to expose `this` + this.plugin('done', (stats) => { + if (stats.compilation.errors && stats.compilation.errors.length) { + throw new Error('webpack build failed'); + } + }); + }); +} -console.log(config); // export the final configuration -module.exports = config; +module.exports = Encore.getWebpackConfig();
b766115ed6f960d5b488857129725a4faf5bec7c
src/SumoCoders/FrameworkCoreBundle/Resources/assets/js/Framework/Slider.js
src/SumoCoders/FrameworkCoreBundle/Resources/assets/js/Framework/Slider.js
import {PluginNotFound} from 'Exception/PluginNotFound'; export class Slider { constructor(element) { if (!$.isFunction($.fn.slider)) { throw new PluginNotFound('Slider'); } this.element = element; this.initSlider(); } initSlider() { this.element.slider( { min: 0, max: 50, values: [10, 40], range: true, } ) } }
import {PluginNotFound} from 'Exception/PluginNotFound'; export class Slider { constructor(element, min = 0, max = 50, values = [10, 40], range = true) { if (!$.isFunction($.fn.slider)) { throw new PluginNotFound('Slider'); } this.element = element; this.min = min; this.max = max; this.values = values; this.range = range; this.initSlider(); } initSlider() { this.element.slider( { min: this.min, max: this.max, values: this.values, range: this.range, } ) } }
Set default values for slider
Set default values for slider
JavaScript
mit
jonasdekeukelaere/Framework,sumocoders/Framework,sumocoders/Framework,jonasdekeukelaere/Framework,sumocoders/Framework,jonasdekeukelaere/Framework,sumocoders/Framework,jonasdekeukelaere/Framework
--- +++ @@ -2,13 +2,17 @@ export class Slider { - constructor(element) + constructor(element, min = 0, max = 50, values = [10, 40], range = true) { if (!$.isFunction($.fn.slider)) { throw new PluginNotFound('Slider'); } this.element = element; + this.min = min; + this.max = max; + this.values = values; + this.range = range; this.initSlider(); } @@ -16,10 +20,10 @@ { this.element.slider( { - min: 0, - max: 50, - values: [10, 40], - range: true, + min: this.min, + max: this.max, + values: this.values, + range: this.range, } ) }
c223f86f6878dc77a89ea64bb41811eac842e964
packages/react-scripts/template/src/App.js
packages/react-scripts/template/src/App.js
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import { version, name } from '../package.json'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> <p>{`${name} v${version}`}</p> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
Remove import package.json from template
Remove import package.json from template
JavaScript
bsd-3-clause
iamdoron/create-react-app,iamdoron/create-react-app,iamdoron/create-react-app
--- +++ @@ -1,7 +1,6 @@ import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; -import { version, name } from '../package.json'; class App extends Component { render() { @@ -10,7 +9,6 @@ <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>Welcome to React</h2> - <p>{`${name} v${version}`}</p> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload.
3e7b6c1be45cfa4adce0e3b6dfed80357ba5470d
webpack.config.js
webpack.config.js
const path = require('path') module.exports = { context: __dirname, entry: './src/index.js', devtool: 'source-map', output: { library: 'es2016-starter', libraryTarget: 'umd', path: path.resolve('dist'), filename: 'es2015-starter.js', }, resolve: { extensions: ['.js'], modules: [ path.resolve('node_modules'), path.resolve('src'), ], }, module: { loaders: [ { use: ['babel-loader'], test: /\.js$/, exclude: [path.resolve('node_modules')], }, { use: 'file-loader', test: /.*/, exclude: [/\.js$/], }, ], }, watchOptions: { ignored: /node_modules/, }, devServer: { port: 3030, contentBase: path.resolve('src'), stats: 'errors-only', overlay: { warnings: true, errors: true, }, }, }
const path = require('path') const webpack = require('webpack') module.exports = { context: __dirname, entry: './src/index.js', devtool: 'source-map', output: { library: 'es2015-starter', libraryTarget: 'umd', path: path.resolve('dist'), filename: 'es2015-starter.js', }, resolve: { extensions: ['.js'], modules: [ path.resolve('node_modules'), path.resolve('src'), ], }, plugins: [ new webpack.optimize.ModuleConcatenationPlugin(), ], module: { loaders: [ { use: ['babel-loader'], test: /\.js$/, exclude: [path.resolve('node_modules')], }, { use: 'file-loader', test: /.*/, exclude: [/\.js$/], }, ], }, watchOptions: { ignored: /node_modules/, }, devServer: { port: 3030, contentBase: path.resolve('src'), stats: 'errors-only', overlay: { warnings: true, errors: true, }, }, }
Fix typo on output name, add module concat plugin.
Fix typo on output name, add module concat plugin.
JavaScript
mit
kroogs/scanty,kroogs/yaemit
--- +++ @@ -1,4 +1,5 @@ const path = require('path') +const webpack = require('webpack') module.exports = { context: __dirname, @@ -6,7 +7,7 @@ devtool: 'source-map', output: { - library: 'es2016-starter', + library: 'es2015-starter', libraryTarget: 'umd', path: path.resolve('dist'), filename: 'es2015-starter.js', @@ -19,6 +20,10 @@ path.resolve('src'), ], }, + + plugins: [ + new webpack.optimize.ModuleConcatenationPlugin(), + ], module: { loaders: [
7d9539421b17495570f779494d81ebb0b5cda7f8
webpack.config.js
webpack.config.js
const { resolve } = require('path') module.exports = { mode: 'production', entry: './dist.browser/index.js', module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ }, { test: /\.js$/, loader: 'file-replace-loader', options: { condition: 'always', replacement (resourcePath) { const mapping = { [resolve('./dist.browser/lib/logging.js')]: resolve( './browser/logging.js' ), [resolve('./dist.browser/lib/net/peer/libp2pnode.js')]: resolve( './browser/libp2pnode.js' ) } return mapping[resourcePath] }, async: true } } ] }, resolve: { extensions: ['.tsx', '.ts', '.js'] }, output: { filename: 'bundle.js', path: resolve(__dirname, 'dist'), library: 'ethereumjs' } }
const { resolve } = require('path') module.exports = { mode: 'production', entry: './dist.browser/browser/index.js', module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ }, { test: /\.js$/, loader: 'file-replace-loader', options: { condition: 'always', replacement (resourcePath) { const mapping = { [resolve('./dist.browser/lib/logging.js')]: resolve( './browser/logging.js' ), [resolve('./dist.browser/lib/net/peer/libp2pnode.js')]: resolve( './browser/libp2pnode.js' ) } return mapping[resourcePath] }, async: true } } ] }, resolve: { extensions: ['.tsx', '.ts', '.js'] }, output: { filename: 'bundle.js', path: resolve(__dirname, 'dist'), library: 'ethereumjs' } }
Revert webpack entry point change
Revert webpack entry point change
JavaScript
mpl-2.0
ethereumjs/ethereumjs-vm,ethereumjs/ethereumjs-vm,ethereum/ethereumjs-vm,ethereumjs/ethereumjs-vm,ethereumjs/ethereumjs-vm,ethereumjs/ethereumjs-vm
--- +++ @@ -2,7 +2,7 @@ module.exports = { mode: 'production', - entry: './dist.browser/index.js', + entry: './dist.browser/browser/index.js', module: { rules: [ {
a3b622643e4fcc2edc62327e8c9a33b2c6d419fa
ember-cli-build.js
ember-cli-build.js
/* eslint-env node */ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon') module.exports = function (defaults) { const app = new EmberAddon(defaults, { babel: { optional: ['es7.decorators'] }, 'ember-cli-mocha': { useLintTree: false }, sassOptions: { includePaths: [ 'node_modules/ember-frost-css-core/scss', 'node_modules/ember-frost-theme/scss' ] } }) return app.toTree() }
/* eslint-env node */ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon') module.exports = function (defaults) { const app = new EmberAddon(defaults, { babel: { optional: ['es7.decorators'] }, sassOptions: { includePaths: [ 'node_modules/ember-frost-css-core/scss', 'node_modules/ember-frost-theme/scss' ] } }) return app.toTree() }
Remove ember-cli-mocha useLintTree configuration option
Remove ember-cli-mocha useLintTree configuration option
JavaScript
mit
ciena-blueplanet/ember-test-utils,sophypal/ember-test-utils,ciena-blueplanet/ember-test-utils,ciena-blueplanet/ember-test-utils,sophypal/ember-test-utils,sophypal/ember-test-utils
--- +++ @@ -5,9 +5,6 @@ const app = new EmberAddon(defaults, { babel: { optional: ['es7.decorators'] - }, - 'ember-cli-mocha': { - useLintTree: false }, sassOptions: { includePaths: [
3e887dd433998679c673b3900857d5e13d6dfbeb
webpack.config.js
webpack.config.js
const path = require('path'); const webpack = require('webpack'); module.exports = { entry: { home: path.join(__dirname, 'app/src/home'), }, module: { loaders: [ { test: /\.sass$/, loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'], }, { test: /\.js$/, loader: 'babel-loader', exclude: 'node_modules', query: { presets: ['es2015'] }, }, { test: /\.(ttf|woff|woff2)$/, loader: 'file', query: { name: 'fonts/[name].[ext]' }, }, { test: /\.png$/, loader: 'file', }, { test: /\.html$/, loader: 'file-loader?name=[name].[ext]!extract-loader!html-loader', }, ], }, output: { path: path.join(__dirname, 'app/build'), publicPath: '/', filename: '[name].js', }, plugins: [ new webpack.optimize.UglifyJsPlugin({ minimize: true, compress: { warnings: false } }), ], // -------------------------------------------------------------------------- devServer: { contentBase: path.join(__dirname, 'app/build'), inline: true, }, };
const path = require('path'); const webpack = require('webpack'); module.exports = { entry: { home: path.join(__dirname, 'app/src/home'), }, module: { loaders: [ { test: /\.sass$/, loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'], }, { test: /\.js$/, loader: 'babel-loader', exclude: 'node_modules', query: { presets: ['es2015'] }, }, { test: /\.(ttf|woff|woff2)$/, loader: 'file', query: { name: 'fonts/[name].[ext]' }, }, { test: /\.png$/, loader: 'file', }, { test: /\.html$/, loader: 'file-loader?name=[name].[ext]!extract-loader!html-loader', }, ], }, output: { path: path.join(__dirname, 'app/build'), publicPath: '/', filename: '[name].js', }, plugins: [ new webpack.optimize.UglifyJsPlugin({ minimize: true, compress: { warnings: false } }), ], // -------------------------------------------------------------------------- devServer: { contentBase: path.join(__dirname, 'app/build'), }, };
Remove inline serving from webpack dev server
Remove inline serving from webpack dev server
JavaScript
mit
arkis/arkis.io,arkis/arkis.io
--- +++ @@ -50,6 +50,5 @@ devServer: { contentBase: path.join(__dirname, 'app/build'), - inline: true, }, };
072dbae8e4fb273a34a4c1d0ece641805d813fcc
webpack.config.js
webpack.config.js
var CopyWebpackPlugin = require('copy-webpack-plugin'); var path = require('path'); module.exports = [{ entry: { horizontal: './shim/horizontal.js', vertical: './shim/vertical.js' }, output: { library: 'ScratchBlocks', libraryTarget: 'commonjs2', path: path.resolve(__dirname, 'dist'), filename: '[name].js' } }, { output: { filename: '[name].js', path: path.resolve(__dirname, 'gh-pages') }, plugins: [ new CopyWebpackPlugin([{ from: 'node_modules/google-closure-library', to: 'closure-library' }, { from: 'blocks_common', to: 'playgrounds/blocks_common', }, { from: 'blocks_horizontal', to: 'playgrounds/blocks_horizontal', }, { from: 'blocks_vertical', to: 'playgrounds/blocks_vertical', }, { from: 'core', to: 'playgrounds/core' }, { from: 'media', to: 'playgrounds/media' }, { from: 'msg', to: 'playgrounds/msg' }, { from: 'tests', to: 'playgrounds/tests' }, { from: '*.js', ignore: 'webpack.config.js', to: 'playgrounds' }]) ] }];
var CopyWebpackPlugin = require('copy-webpack-plugin'); var path = require('path'); module.exports = [{ entry: { horizontal: './shim/horizontal.js', vertical: './shim/vertical.js' }, output: { library: 'ScratchBlocks', libraryTarget: 'commonjs2', path: path.resolve(__dirname, 'dist'), filename: '[name].js' } }, { entry: { horizontal: './shim/horizontal.js', vertical: './shim/vertical.js' }, output: { library: 'Blockly', libraryTarget: 'umd', path: path.resolve(__dirname, 'dist', 'web'), filename: '[name].js' } }, { output: { filename: '[name].js', path: path.resolve(__dirname, 'gh-pages') }, plugins: [ new CopyWebpackPlugin([{ from: 'node_modules/google-closure-library', to: 'closure-library' }, { from: 'blocks_common', to: 'playgrounds/blocks_common', }, { from: 'blocks_horizontal', to: 'playgrounds/blocks_horizontal', }, { from: 'blocks_vertical', to: 'playgrounds/blocks_vertical', }, { from: 'core', to: 'playgrounds/core' }, { from: 'media', to: 'playgrounds/media' }, { from: 'msg', to: 'playgrounds/msg' }, { from: 'tests', to: 'playgrounds/tests' }, { from: '*.js', ignore: 'webpack.config.js', to: 'playgrounds' }]) ] }];
Add UMD target for use without "require"/"import"
Add UMD target for use without "require"/"import"
JavaScript
apache-2.0
griffpatch/scratch-blocks,griffpatch/scratch-blocks,LLK/scratch-blocks,LLK/scratch-blocks,LLK/scratch-blocks,LLK/scratch-blocks,griffpatch/scratch-blocks,LLK/scratch-blocks,griffpatch/scratch-blocks,griffpatch/scratch-blocks
--- +++ @@ -13,6 +13,18 @@ filename: '[name].js' } }, { + entry: { + horizontal: './shim/horizontal.js', + vertical: './shim/vertical.js' + }, + output: { + library: 'Blockly', + libraryTarget: 'umd', + path: path.resolve(__dirname, 'dist', 'web'), + filename: '[name].js' + } +}, +{ output: { filename: '[name].js', path: path.resolve(__dirname, 'gh-pages')
a846b2b8aa57aa0e31080d10e6e92b793f19fb95
webpack.config.js
webpack.config.js
const webpack = require('webpack'); module.exports = { entry: `${__dirname}/src/index.js`, output: { path: `${__dirname}/build`, publicPath: '/build/', filename: 'bundle.js', }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, ], }, plugins: process.argv.indexOf('-p') === -1 ? [] : [ new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production'), }), new webpack.optimize.UglifyJsPlugin({ output: { comments: false, }, }), ], };
const webpack = require('webpack'); module.exports = { entry: `${__dirname}/src/index.js`, output: { path: `${__dirname}/build`, publicPath: '/build/', filename: 'bundle.js', }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, ], }, plugins: process.argv.indexOf('-p') === -1 ? [] : [ new webpack.optimize.UglifyJsPlugin({ output: { comments: false, }, }), ], };
Remove webpack plugin for node env production
Remove webpack plugin for node env production Webpack 2 sets this automatically with the -p flag
JavaScript
mit
ambershen/ambershen.github.io,ambershen/ambershen.github.io
--- +++ @@ -15,9 +15,6 @@ }, plugins: process.argv.indexOf('-p') === -1 ? [] : [ - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify('production'), - }), new webpack.optimize.UglifyJsPlugin({ output: { comments: false,
7922d5ea742c9e7eef5c317394b126bc5dc33784
webpack.config.js
webpack.config.js
var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { devtool: 'source-map', entry: { 'tree-chooser': './src/index.js', 'tree-chooser.min': './src/index.js' }, output: { path: './dist', filename: '[name].js' }, externals: { angular: 'angular', lodash: '_' }, module: { preLoaders: [ { test: /\.js/, exclude: /node_modules/, loader: 'jshint-loader!jscs-loader', }, ], loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'ng-annotate?single_quotes!babel?presets[]=es2015' }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, { test: /\.html$/, loader: 'html?minimize=true' } ] }, plugins: [ new ExtractTextPlugin('tree-chooser.css'), new webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/, minimize: true }) ], jshint: { failOnHint: true, esversion: 6, node: true, quotmark: 'single' }, jscs: { failOnHint: true } };
var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { devtool: 'source-map', entry: { 'tree-chooser': './src/index.js', 'tree-chooser.min': './src/index.js' }, output: { path: './dist', filename: '[name].js', library: 'tree-chooser', libraryTarget: 'commonjs' }, externals: { angular: 'angular', lodash : { 'commonjs': 'lodash' } }, module: { preLoaders: [ { test: /\.js/, exclude: /node_modules/, loader: 'jshint-loader!jscs-loader', }, ], loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'ng-annotate?single_quotes!babel?presets[]=es2015' }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, { test: /\.html$/, loader: 'html?minimize=true' } ] }, plugins: [ new ExtractTextPlugin('tree-chooser.css'), new webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/, minimize: true }) ], jshint: { failOnHint: true, esversion: 6, node: true, quotmark: 'single' }, jscs: { failOnHint: true } };
Make lodash an external for real
Make lodash an external for real
JavaScript
apache-2.0
randdusing/tree-chooser,albertian/tree-chooser,albertian/tree-chooser,randdusing/tree-chooser
--- +++ @@ -9,11 +9,15 @@ }, output: { path: './dist', - filename: '[name].js' + filename: '[name].js', + library: 'tree-chooser', + libraryTarget: 'commonjs' }, externals: { angular: 'angular', - lodash: '_' + lodash : { + 'commonjs': 'lodash' + } }, module: { preLoaders: [
4fd065919b64297536ddbceed9d52aed81fa4b0e
yarn-recursive.js
yarn-recursive.js
#!/usr/bin/env node const path = require('path'); const shell = require('shelljs'); const argv = require('yargs').argv; const clc = require('cli-color'); function packageJsonLocations(dirname) { return shell.find(dirname) .filter(fname => !(fname.indexOf('node_modules') > -1 || fname[0] === '.') && path.basename(fname) === 'package.json') .map(fname => path.dirname(fname)); } function yarn(directoryName) { let command = 'yarn'; if (argv.cmd) command += ' ' + argv.cmd; if (argv.opt) command += ' ' + argv.opt; console.log(clc.blueBright('Current yarn path: ' + directoryName + '/package.json...')); shell.cd(directoryName); let result = shell.exec(command); return { directoryName: directoryName, exitCode: result.code }; } function filterRoot(directoryName) { console.log('Root filtering'); return path.normalize(directoryName) === path.normalize(process.cwd()); } if (require.main === module) { let exitCode = packageJsonLocations(process.cwd()) .filter(argv.skipRoot ? filterRoot : filtered => filtered) .map(yarn) .reduce((code, result) =>result.exitCode > code ? result.exitCode : code, 0); console.log(clc.green('End of yarns')); process.exit(exitCode); } module.exports = { yarn: yarn };
#!/usr/bin/env node const path = require('path'); const shell = require('shelljs'); const argv = require('yargs').argv; const clc = require('cli-color'); function packageJsonLocations(dirname) { return shell.find(dirname) .filter(fname => !(fname.indexOf('node_modules') > -1 || fname[0] === '.') && path.basename(fname) === 'package.json') .map(fname => path.dirname(fname)); } function yarn(directoryName) { let command = 'yarn'; if (argv.cmd) command += ' ' + argv.cmd; if (argv.opt) command += ' ' + argv.opt; console.log(clc.blueBright('Current yarn path: ' + directoryName + path.sep + 'package.json...')); shell.cd(directoryName); let result = shell.exec(command); return { directoryName: directoryName, exitCode: result.code }; } function filterRoot(directoryName) { console.log('Root filtering'); return path.normalize(directoryName) === path.normalize(process.cwd()); } if (require.main === module) { let exitCode = packageJsonLocations(process.cwd()) .filter(argv.skipRoot ? filterRoot : filtered => filtered) .map(yarn) .reduce((code, result) =>result.exitCode > code ? result.exitCode : code, 0); console.log(clc.green('End of yarns')); process.exit(exitCode); } module.exports = { yarn: yarn };
Use platform-specific path separator in log messages.
Use platform-specific path separator in log messages.
JavaScript
mit
nrigaudiere/yarn-recursive
--- +++ @@ -20,7 +20,7 @@ if (argv.opt) command += ' ' + argv.opt; - console.log(clc.blueBright('Current yarn path: ' + directoryName + '/package.json...')); + console.log(clc.blueBright('Current yarn path: ' + directoryName + path.sep + 'package.json...')); shell.cd(directoryName); let result = shell.exec(command);
3914130255de502902fe35893fb435cbeb94e8c4
.storybook/main.js
.storybook/main.js
module.exports = { stories: ['../components/*.stories.js'], addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/storyshots'], };
module.exports = { stories: ['../components/*.stories.js'], addons: ['@storybook/addon-actions', '@storybook/addon-links'], };
Remove redundant storyshot plugin configuration
Remove redundant storyshot plugin configuration
JavaScript
mit
cofacts/rumors-site,cofacts/rumors-site
--- +++ @@ -1,4 +1,4 @@ module.exports = { stories: ['../components/*.stories.js'], - addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/storyshots'], + addons: ['@storybook/addon-actions', '@storybook/addon-links'], };
74bd30e8deee50bdc41fc21f9616df76ceb7a994
www/js/BeerTap.js
www/js/BeerTap.js
define(['Twitter', 'TwitterConfirmer', 'TapsModel', 'JQMListView', 'ListPresenter', 'JQMEditView', 'EditPresenter', 'FollowingPresenter', 'SettingsPage'], function(Twitter, TwitterConfirmer, TapsModel, JQMListView, ListPresenter, JQMEditView, EditPresenter, FollowingPresenter, SettingsPage) { function BeerTap(twitterProxy) { this.twitter = new Twitter(localStorage, twitterProxy); var listModel = new TapsModel(this.twitter); var listView = new JQMListView("listPage"); var listPresenter = new ListPresenter("listPage", listModel, listView); var editView = new JQMEditView("editPage"); var editModel = new TapsModel(new TwitterConfirmer(this.twitter, editView.page)); var editPresenter = new EditPresenter("editPage", editModel, editView); var settingsPresenter = new SettingsPage("settings", this.twitter); this.mainPage = new FollowingPresenter("main", this.twitter, listPresenter, editPresenter, settingsPresenter); $(document).ajaxStart(function() { $.mobile.loading( 'show' ); }); $(document).ajaxStop(function() { $.mobile.loading( 'hide' ); }); $(document).ajaxError(function() { alert("Error fetching data"); }); $.mobile.changePage("#main", { changeHash:false }); } return BeerTap; });
define(['Twitter', 'TwitterConfirmer', 'TapsModel', 'JQMListView', 'ListPresenter', 'JQMEditView', 'EditPresenter', 'FollowingPresenter', 'SettingsPage'], function(Twitter, TwitterConfirmer, TapsModel, JQMListView, ListPresenter, JQMEditView, EditPresenter, FollowingPresenter, SettingsPage) { function BeerTap(twitterProxy) { this.twitter = new Twitter(localStorage, twitterProxy); var listModel = new TapsModel(this.twitter); var listView = new JQMListView("listPage"); var listPresenter = new ListPresenter("listPage", listModel, listView); var editView = new JQMEditView("editPage"); var editModel = new TapsModel(new TwitterConfirmer(this.twitter, editView.page)); var editPresenter = new EditPresenter("editPage", editModel, editView); var settingsPresenter = new SettingsPage("settings", this.twitter); this.mainPage = new FollowingPresenter("main", this.twitter, listPresenter, editPresenter, settingsPresenter); $(document).ajaxStart(function() { $.mobile.loading( 'show' ); }); $(document).ajaxStop(function() { $.mobile.loading( 'hide' ); }); $(document).ajaxError(function() { alert("Error fetching data"); }); $.mobile.changePage("#main"); } return BeerTap; });
Revert previous change to changePage() call - it's causing problems.
Revert previous change to changePage() call - it's causing problems.
JavaScript
mit
coolhandmook/BeerTap,coolhandmook/BeerTap
--- +++ @@ -21,7 +21,7 @@ $(document).ajaxStop(function() { $.mobile.loading( 'hide' ); }); $(document).ajaxError(function() { alert("Error fetching data"); }); - $.mobile.changePage("#main", { changeHash:false }); + $.mobile.changePage("#main"); } return BeerTap;
f6524d0f0f092258ff5d491138b6a78c4e4dc3b8
example/app.js
example/app.js
var express = require('express'); var http = require('http'); var routes = require('./routes'); var app = express(); app.set('views', __dirname); app.set('view engine', 'ejs'); if (app.get('env') === 'development') { var browserSync = require('browser-sync'); var bs = browserSync({ logSnippet: false }); app.use(require('connect-browser-sync')(bs)); } app.get('/', routes.index); var port = 3000; http.createServer(app).listen(port, function() { console.log('Listening on port ' + port + '...'); });
var express = require('express'); var http = require('http'); var routes = require('./routes'); var app = express(); app.set('views', __dirname); app.set('view engine', 'ejs'); if (app.get('env') === 'development') { var browserSync = require('browser-sync'); var bs = browserSync.create().init({ logSnippet: false }); app.use(require('connect-browser-sync')(bs)); } app.get('/', routes.index); var port = 3000; http.createServer(app).listen(port, function() { console.log('Listening on port ' + port + '...'); });
Use BrowserSync 2.0 form of initialization.
Use BrowserSync 2.0 form of initialization.
JavaScript
mit
schmich/connect-browser-sync,schmich/connect-browser-sync
--- +++ @@ -8,7 +8,7 @@ if (app.get('env') === 'development') { var browserSync = require('browser-sync'); - var bs = browserSync({ logSnippet: false }); + var bs = browserSync.create().init({ logSnippet: false }); app.use(require('connect-browser-sync')(bs)); }
aca697b17742b680cc6732ec2a9adae951b01ea0
webpack.config.js
webpack.config.js
const path = require('path'); const webpack = require('webpack'); const buildEntryPoint = entryPoint => { return [ 'react-hot-loader/patch', 'webpack-dev-server/client?http://localhost:3000', 'webpack/hot/only-dev-server', entryPoint ]; }; const plugins = [ new webpack.optimize.CommonsChunkPlugin({ name: 'commons', filename: 'common.js' }), new webpack.HotModuleReplacementPlugin() ]; module.exports = { entry: { app: buildEntryPoint('./src') }, output: { path: path.join(__dirname, 'dev'), publicPath: '/', filename: '[name].js' }, module: { loaders: [ { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', include: path.join(__dirname, 'src') }, { test: /\.css$/, loader: 'style!css' } ] }, resolve: { root: [ path.resolve(__dirname, 'src') ], extensions: ['', '.js', '.jsx'], }, plugins: plugins, devServer: { historyApiFallback: true, contentBase: path.resolve(__dirname, 'dev'), hot: true, inline: true, stats: { colors: true }, port: 3000 }, devtool: 'source-map' };
const path = require('path'); const webpack = require('webpack'); const buildEntryPoint = entryPoint => { return [ 'react-hot-loader/patch', 'webpack-dev-server/client?http://localhost:3000', 'webpack/hot/only-dev-server', entryPoint ]; }; const plugins = [ new webpack.optimize.CommonsChunkPlugin({ name: 'commons', filename: 'common.js' }), new webpack.HotModuleReplacementPlugin() ]; module.exports = { entry: { app: buildEntryPoint('./src') }, output: { path: path.join(__dirname, 'dev'), publicPath: '/', filename: '[name].js' }, module: { loaders: [ { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', include: path.join(__dirname, 'src') }, { test: /\.css$/, loader: 'style!css' } ] }, resolve: { root: [ path.resolve(__dirname, 'src') ], extensions: ['', '.js', '.jsx'], }, plugins: plugins, devServer: { historyApiFallback: true, contentBase: path.resolve(__dirname, 'dev'), hot: true, inline: true, stats: { assets: true, colors: true, version: false, hash: false, timings: true, chunks: false, chunkModules: false }, port: 3000 }, devtool: 'source-map' };
Clean up Webpack Dev Server Logs
Clean up Webpack Dev Server Logs
JavaScript
mit
ibleedfilm/fcc-react-project,ibleedfilm/recipe-box,ibleedfilm/recipe-box,ibleedfilm/fcc-react-project
--- +++ @@ -52,7 +52,13 @@ hot: true, inline: true, stats: { - colors: true + assets: true, + colors: true, + version: false, + hash: false, + timings: true, + chunks: false, + chunkModules: false }, port: 3000 },
f6af9188e6bbac4f9231fcceecf53c125e520ec7
webpack.config.js
webpack.config.js
const path = require('path'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const WebpackAutoInject = require('webpack-auto-inject-version'); module.exports = { entry: { 'typedjson': './src/typedjson.ts', 'typedjson.min': './src/typedjson.ts', }, devtool: 'source-map', module: { rules: [ { test: /\.[jt]s$/, use: 'ts-loader', exclude: /node_modules/, }, ], }, resolve: { extensions: [ '.ts', '.js' ], }, output: { filename: '[name].js', path: path.resolve(__dirname, 'js'), library: 'typedjson', libraryTarget: 'umd', umdNamedDefine: true, }, optimization: { minimizer: [ new UglifyJsPlugin({ include: /\.min\.js$/, sourceMap: true, }) ], }, plugins: [ new WebpackAutoInject({ SHORT: 'typedjson', components: { AutoIncreaseVersion: false, }, componentsOptions: { InjectAsComment: { tag: 'Version: {version} - {date}', dateFormat: 'isoDate', }, }, }), ], mode: "production", };
const path = require('path'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const WebpackAutoInject = require('webpack-auto-inject-version'); module.exports = { entry: { 'typedjson': './src/typedjson.ts', 'typedjson.min': './src/typedjson.ts', }, devtool: 'source-map', module: { rules: [ { test: /\.[jt]s$/, use: 'ts-loader', exclude: /node_modules/, }, ], }, resolve: { extensions: [ '.ts', '.js' ], }, output: { filename: '[name].js', path: path.resolve(__dirname, 'js'), library: 'typedjson', libraryTarget: 'umd', umdNamedDefine: true, globalObject: `(typeof self !== 'undefined' ? self : this)`, }, optimization: { minimizer: [ new UglifyJsPlugin({ include: /\.min\.js$/, sourceMap: true, }) ], }, plugins: [ new WebpackAutoInject({ SHORT: 'typedjson', components: { AutoIncreaseVersion: false, }, componentsOptions: { InjectAsComment: { tag: 'Version: {version} - {date}', dateFormat: 'isoDate', }, }, }), ], mode: "production", };
Change global to node compatible
Change global to node compatible
JavaScript
mit
JohnWhiteTB/TypedJSON,JohnWhiteTB/TypedJSON,JohnWeisz/TypedJSON,JohnWeisz/TypedJSON,JohnWhiteTB/TypedJSON
--- +++ @@ -26,6 +26,7 @@ library: 'typedjson', libraryTarget: 'umd', umdNamedDefine: true, + globalObject: `(typeof self !== 'undefined' ? self : this)`, }, optimization: { minimizer: [
8c075d8c2dd3231309cdff9d9363fcd9b8cb5457
webpack.config.js
webpack.config.js
module.exports = { devtool: 'source-map', entry: './src/Home.jsx', output: { path: './public', filename: './js/app.js', publicPath: '/' }, devServer: { inline: true, contentBase: './public', }, module: { loaders: [ { test: /[\.js$|\.jsx$]/, loader: 'babel-loader', exclude: /(node_modules|bower_components)/, query: { cacheDirectory: false, presets: ['es2015', 'react'], plugins: ['transform-object-rest-spread'] } } ] }, cache: false, resolve: { extensions: ['', '.js', '.jsx'] } };
module.exports = { devtool: 'source-map', entry: './src/browser.jsx', output: { path: './public', filename: './js/app.js', publicPath: '/' }, devServer: { inline: true, contentBase: './public', }, module: { loaders: [ { test: /[\.js$|\.jsx$]/, loader: 'babel-loader', exclude: /(node_modules|bower_components)/, query: { cacheDirectory: false, presets: ['es2015', 'react'], plugins: ['transform-object-rest-spread'] } } ] }, cache: false, resolve: { extensions: ['', '.js', '.jsx'] } };
Include browser file as entry point
Include browser file as entry point
JavaScript
mit
Juan1ll0/es6-react-server-side-render,Juan1ll0/es6-react-server-side-render
--- +++ @@ -1,6 +1,6 @@ module.exports = { devtool: 'source-map', - entry: './src/Home.jsx', + entry: './src/browser.jsx', output: { path: './public', filename: './js/app.js',
288ce5205edcf7e6c1afda5fa62d95c479aa6c30
src/components/ProfilePage.js
src/components/ProfilePage.js
import React from 'react'; import { connect } from 'react-redux'; class ProfilePage extends React.Component { constructor(props){ super(props); this.logoff = this.logoff.bind(this); } logoff(){ localStorage.setItem('token', ''); this.props.history.push('/login'); } render(){ return ( <div> <h1>Profile Page</h1> <button onClick={this.logoff}>Log Off</button> </div> ); } } ProfilePage.propTypes = { logout: React.PropTypes.function }; const mapStateToProps = () => { return { token: localStorage.token }; }; export default connect(mapStateToProps)(ProfilePage);
import React from 'react'; import { connect } from 'react-redux'; import { setChartAction } from '../actions/chartActions'; class ProfilePage extends React.Component { constructor(props){ super(props); this.logoff = this.logoff.bind(this); } logoff(){ localStorage.setItem('token', ''); this.props.logout(); this.props.history.push('/login'); } render(){ return ( <div> <h1>Profile Page</h1> <button onClick={this.logoff}>Log Off</button> </div> ); } } ProfilePage.propTypes = { logout: React.PropTypes.function }; const mapStateToProps = () => { return { token: localStorage.token }; }; const mapDispatchToProps = dispatch => { return { logout: () => dispatch(setChartAction([])) } } export default connect(mapStateToProps, mapDispatchToProps)(ProfilePage);
Delete charts in store on logout
Delete charts in store on logout
JavaScript
mit
MouseZero/voting-app,MouseZero/voting-app
--- +++ @@ -1,5 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; +import { setChartAction } from '../actions/chartActions'; class ProfilePage extends React.Component { constructor(props){ @@ -9,6 +10,7 @@ logoff(){ localStorage.setItem('token', ''); + this.props.logout(); this.props.history.push('/login'); } @@ -29,5 +31,10 @@ token: localStorage.token }; }; +const mapDispatchToProps = dispatch => { +return { + logout: () => dispatch(setChartAction([])) + } +} -export default connect(mapStateToProps)(ProfilePage); +export default connect(mapStateToProps, mapDispatchToProps)(ProfilePage);
ddeb0918712169f45f744682279440d0a317032e
src/ol/format/XLink.js
src/ol/format/XLink.js
/** * @module ol/format/XLink */ /** * @const * @type {string} */ const NAMESPACE_URI = 'http://www.w3.org/1999/xlink'; /** * @param {Node} node Node. * @return {boolean|undefined} Boolean. */ export function readHref(node) { return node.getAttributeNS(NAMESPACE_URI, 'href'); }
/** * @module ol/format/XLink */ /** * @const * @type {string} */ const NAMESPACE_URI = 'http://www.w3.org/1999/xlink'; /** * @param {Node} node Node. * @return {string|undefined} href. */ export function readHref(node) { return node.getAttributeNS(NAMESPACE_URI, 'href'); }
Fix wrong return type for readHref function
Fix wrong return type for readHref function
JavaScript
bsd-2-clause
mzur/ol3,fredj/ol3,tschaub/ol3,geekdenz/ol3,oterral/ol3,bjornharrtell/ol3,fredj/ol3,mzur/ol3,stweil/ol3,mzur/ol3,adube/ol3,tschaub/ol3,ahocevar/ol3,tschaub/ol3,geekdenz/openlayers,geekdenz/ol3,geekdenz/ol3,adube/ol3,ahocevar/openlayers,oterral/ol3,stweil/ol3,ahocevar/openlayers,stweil/openlayers,openlayers/openlayers,ahocevar/ol3,stweil/openlayers,ahocevar/ol3,openlayers/openlayers,mzur/ol3,geekdenz/ol3,oterral/ol3,ahocevar/ol3,stweil/ol3,geekdenz/openlayers,stweil/ol3,ahocevar/openlayers,geekdenz/openlayers,adube/ol3,bjornharrtell/ol3,fredj/ol3,tschaub/ol3,stweil/openlayers,fredj/ol3,openlayers/openlayers,bjornharrtell/ol3
--- +++ @@ -12,7 +12,7 @@ /** * @param {Node} node Node. - * @return {boolean|undefined} Boolean. + * @return {string|undefined} href. */ export function readHref(node) { return node.getAttributeNS(NAMESPACE_URI, 'href');
9da51749c48c09bcd443b3a32ea51734dc34d60a
src/pages/_document.js
src/pages/_document.js
/* eslint-disable react/no-danger */ import Document, { Head, Main, NextScript } from 'next/document' import React from 'react' // The document (which is SSR-only) needs to be customized to expose the locale // data for the user's locale for React Intl to work in the browser. export default class IntlDocument extends Document { static async getInitialProps(context) { const props = await super.getInitialProps(context) const { req: { locale, localeDataScript }, } = context return { ...props, locale, localeDataScript, } } render() { // Polyfill Intl API for older browsers const polyfill = `https://cdn.polyfill.io/v2/polyfill.min.js ?features=Intl.~locale.${this.props.locale}` return ( <html lang={this.props.locale}> <Head> <meta content="text/html; charset=utf-8" httpEquiv="Content-type" /> <meta content="width=device-width, initial-scale=1" name="viewport" /> <meta content="IE=Edge" httpEquiv="X-UA-Compatible" /> <link href="/_next/static/style.css" rel="stylesheet" /> </Head> <body> <Main /> <script src={polyfill} /> <script dangerouslySetInnerHTML={{ __html: this.props.localeDataScript, }} /> <NextScript /> </body> </html> ) } }
/* eslint-disable react/no-danger */ import Document, { Head, Main, NextScript } from 'next/document' import React from 'react' // The document (which is SSR-only) needs to be customized to expose the locale // data for the user's locale for React Intl to work in the browser. export default class IntlDocument extends Document { static async getInitialProps(context) { const props = await super.getInitialProps(context) const { req: { locale, localeDataScript }, } = context return { ...props, locale, localeDataScript, } } render() { // Polyfill Intl API for older browsers const polyfill = `https://cdn.polyfill.io/v2/polyfill.min.js ?features=default,fetch,Intl,Intl.~locale.de,Intl.~locale.en` return ( <html lang={this.props.locale}> <Head> <meta content="text/html; charset=utf-8" httpEquiv="Content-type" /> <meta content="width=device-width, initial-scale=1" name="viewport" /> <meta content="IE=Edge" httpEquiv="X-UA-Compatible" /> <link href="/_next/static/style.css" rel="stylesheet" /> </Head> <body> <Main /> <script src={polyfill} /> <script dangerouslySetInnerHTML={{ __html: this.props.localeDataScript, }} /> <NextScript /> </body> </html> ) } }
Update polyfill url to include default
Update polyfill url to include default
JavaScript
agpl-3.0
uzh-bf/klicker-react,uzh-bf/klicker-react
--- +++ @@ -22,7 +22,7 @@ render() { // Polyfill Intl API for older browsers const polyfill = `https://cdn.polyfill.io/v2/polyfill.min.js - ?features=Intl.~locale.${this.props.locale}` + ?features=default,fetch,Intl,Intl.~locale.de,Intl.~locale.en` return ( <html lang={this.props.locale}>
423bbaf03c83313d327b6c84e6b77ad6787de9e4
generators/client/templates/src/main/webapp/app/account/social/_social.service.js
generators/client/templates/src/main/webapp/app/account/social/_social.service.js
(function() { 'use strict'; angular .module('<%=angularAppName%>') .factory('SocialService', SocialService); SocialService.$inject = ['$document']; function SocialService ($document) { var socialService = { getProviderSetting: getProviderSetting, getProviderURL: getProviderURL, getCSRF: getCSRF }; return socialService; function getProviderSetting (provider) { switch(provider) { case 'google': return 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; case 'facebook': return 'public_profile,email'; case 'twitter': return ''; // jhipster-needle-add-social-button default: return 'Provider setting not defined'; } } function getProviderURL (provider) { return 'signin/' + provider; } function getCSRF () { /* globals document */ var name = 'XSRF-TOKEN='; var ca = $document[0].cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === ' ') { c = c.substring(1); } if (c.indexOf(name) !== -1) { return c.substring(name.length, c.length); } } return ''; } } })();
(function() { 'use strict'; angular .module('<%=angularAppName%>') .factory('SocialService', SocialService); SocialService.$inject = ['$document', '$http', '$cookies']; function SocialService ($document, $http, $cookies) { var socialService = { getProviderSetting: getProviderSetting, getProviderURL: getProviderURL, getCSRF: getCSRF }; return socialService; function getProviderSetting (provider) { switch(provider) { case 'google': return 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; case 'facebook': return 'public_profile,email'; case 'twitter': return ''; // jhipster-needle-add-social-button default: return 'Provider setting not defined'; } } function getProviderURL (provider) { return 'signin/' + provider; } function getCSRF () { return $cookies.get($http.defaults.xsrfCookieName); } } })();
Use $cookies to retrive CSRF cookie token value
Use $cookies to retrive CSRF cookie token value
JavaScript
apache-2.0
rifatdover/generator-jhipster,baskeboler/generator-jhipster,JulienMrgrd/generator-jhipster,ziogiugno/generator-jhipster,vivekmore/generator-jhipster,vivekmore/generator-jhipster,mosoft521/generator-jhipster,gmarziou/generator-jhipster,baskeboler/generator-jhipster,dimeros/generator-jhipster,PierreBesson/generator-jhipster,sohibegit/generator-jhipster,jhipster/generator-jhipster,erikkemperman/generator-jhipster,jkutner/generator-jhipster,pascalgrimaud/generator-jhipster,atomfrede/generator-jhipster,wmarques/generator-jhipster,siliconharborlabs/generator-jhipster,dynamicguy/generator-jhipster,sohibegit/generator-jhipster,nkolosnjaji/generator-jhipster,nkolosnjaji/generator-jhipster,deepu105/generator-jhipster,maniacneron/generator-jhipster,dimeros/generator-jhipster,ctamisier/generator-jhipster,rifatdover/generator-jhipster,jhipster/generator-jhipster,ctamisier/generator-jhipster,ramzimaalej/generator-jhipster,ctamisier/generator-jhipster,liseri/generator-jhipster,sendilkumarn/generator-jhipster,dimeros/generator-jhipster,robertmilowski/generator-jhipster,maniacneron/generator-jhipster,sohibegit/generator-jhipster,cbornet/generator-jhipster,erikkemperman/generator-jhipster,rkohel/generator-jhipster,vivekmore/generator-jhipster,dalbelap/generator-jhipster,robertmilowski/generator-jhipster,lrkwz/generator-jhipster,ctamisier/generator-jhipster,PierreBesson/generator-jhipster,atomfrede/generator-jhipster,robertmilowski/generator-jhipster,lrkwz/generator-jhipster,lrkwz/generator-jhipster,PierreBesson/generator-jhipster,danielpetisme/generator-jhipster,ziogiugno/generator-jhipster,duderoot/generator-jhipster,rifatdover/generator-jhipster,siliconharborlabs/generator-jhipster,danielpetisme/generator-jhipster,pascalgrimaud/generator-jhipster,mraible/generator-jhipster,mraible/generator-jhipster,ruddell/generator-jhipster,ruddell/generator-jhipster,jkutner/generator-jhipster,yongli82/generator-jhipster,gmarziou/generator-jhipster,jhipster/generator-jhipster,Tcharl/generator-jhipster,hdurix/generator-jhipster,vivekmore/generator-jhipster,eosimosu/generator-jhipster,maniacneron/generator-jhipster,baskeboler/generator-jhipster,stevehouel/generator-jhipster,rkohel/generator-jhipster,gzsombor/generator-jhipster,siliconharborlabs/generator-jhipster,dalbelap/generator-jhipster,PierreBesson/generator-jhipster,JulienMrgrd/generator-jhipster,mraible/generator-jhipster,danielpetisme/generator-jhipster,ctamisier/generator-jhipster,nkolosnjaji/generator-jhipster,eosimosu/generator-jhipster,mosoft521/generator-jhipster,rkohel/generator-jhipster,yongli82/generator-jhipster,Tcharl/generator-jhipster,wmarques/generator-jhipster,sohibegit/generator-jhipster,pascalgrimaud/generator-jhipster,maniacneron/generator-jhipster,mosoft521/generator-jhipster,deepu105/generator-jhipster,Tcharl/generator-jhipster,erikkemperman/generator-jhipster,wmarques/generator-jhipster,robertmilowski/generator-jhipster,stevehouel/generator-jhipster,stevehouel/generator-jhipster,lrkwz/generator-jhipster,dynamicguy/generator-jhipster,cbornet/generator-jhipster,duderoot/generator-jhipster,erikkemperman/generator-jhipster,dimeros/generator-jhipster,jhipster/generator-jhipster,duderoot/generator-jhipster,eosimosu/generator-jhipster,pascalgrimaud/generator-jhipster,dalbelap/generator-jhipster,wmarques/generator-jhipster,ruddell/generator-jhipster,JulienMrgrd/generator-jhipster,nkolosnjaji/generator-jhipster,maniacneron/generator-jhipster,ramzimaalej/generator-jhipster,JulienMrgrd/generator-jhipster,hdurix/generator-jhipster,mraible/generator-jhipster,yongli82/generator-jhipster,deepu105/generator-jhipster,dynamicguy/generator-jhipster,hdurix/generator-jhipster,liseri/generator-jhipster,liseri/generator-jhipster,hdurix/generator-jhipster,gmarziou/generator-jhipster,ramzimaalej/generator-jhipster,sendilkumarn/generator-jhipster,sendilkumarn/generator-jhipster,dynamicguy/generator-jhipster,robertmilowski/generator-jhipster,duderoot/generator-jhipster,cbornet/generator-jhipster,Tcharl/generator-jhipster,gzsombor/generator-jhipster,deepu105/generator-jhipster,dalbelap/generator-jhipster,dimeros/generator-jhipster,deepu105/generator-jhipster,yongli82/generator-jhipster,cbornet/generator-jhipster,atomfrede/generator-jhipster,ruddell/generator-jhipster,liseri/generator-jhipster,mraible/generator-jhipster,ziogiugno/generator-jhipster,jkutner/generator-jhipster,gzsombor/generator-jhipster,jkutner/generator-jhipster,wmarques/generator-jhipster,Tcharl/generator-jhipster,baskeboler/generator-jhipster,sendilkumarn/generator-jhipster,mosoft521/generator-jhipster,siliconharborlabs/generator-jhipster,siliconharborlabs/generator-jhipster,danielpetisme/generator-jhipster,PierreBesson/generator-jhipster,JulienMrgrd/generator-jhipster,jkutner/generator-jhipster,erikkemperman/generator-jhipster,eosimosu/generator-jhipster,stevehouel/generator-jhipster,jhipster/generator-jhipster,dalbelap/generator-jhipster,mosoft521/generator-jhipster,baskeboler/generator-jhipster,yongli82/generator-jhipster,rkohel/generator-jhipster,cbornet/generator-jhipster,stevehouel/generator-jhipster,atomfrede/generator-jhipster,gzsombor/generator-jhipster,ruddell/generator-jhipster,nkolosnjaji/generator-jhipster,hdurix/generator-jhipster,pascalgrimaud/generator-jhipster,ziogiugno/generator-jhipster,ziogiugno/generator-jhipster,lrkwz/generator-jhipster,duderoot/generator-jhipster,gzsombor/generator-jhipster,vivekmore/generator-jhipster,eosimosu/generator-jhipster,gmarziou/generator-jhipster,rkohel/generator-jhipster,atomfrede/generator-jhipster,danielpetisme/generator-jhipster,gmarziou/generator-jhipster,liseri/generator-jhipster,sohibegit/generator-jhipster,sendilkumarn/generator-jhipster
--- +++ @@ -5,9 +5,9 @@ .module('<%=angularAppName%>') .factory('SocialService', SocialService); - SocialService.$inject = ['$document']; + SocialService.$inject = ['$document', '$http', '$cookies']; - function SocialService ($document) { + function SocialService ($document, $http, $cookies) { var socialService = { getProviderSetting: getProviderSetting, getProviderURL: getProviderURL, @@ -31,19 +31,7 @@ } function getCSRF () { - /* globals document */ - var name = 'XSRF-TOKEN='; - var ca = $document[0].cookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) === ' ') { - c = c.substring(1); - } - if (c.indexOf(name) !== -1) { - return c.substring(name.length, c.length); - } - } - return ''; + return $cookies.get($http.defaults.xsrfCookieName); } } })();
a47277dc01719beb91bbe71e5bfcf33eefbfa2b9
server.js
server.js
const Hapi = require('@hapi/hapi'); const routes = require('./routes'); const auth = require('./auth'); module.exports = async (elastic, config, cb) => { const server = new Hapi.Server({ port: config.port, routes: { cors: true, log: { collect: true } } }); server.route(routes(elastic, config)); if (config.auth) { server.route(auth()); await server.register(require('hapi-auth-jwt2')); await server.register(require('./auth/authentication')); } try { await server.register([ { plugin: require('good'), options: { reporters: { console: [{ module: 'good-console' }, 'stdout'] } } }, require('inert'), require('vision'), require('h2o2'), { plugin: require('./routes/plugins/error'), options: { config: config } } ]); } catch (err) { return cb(err); } server.views({ engines: { html: { module: require('handlebars'), compileMode: 'sync' } }, relativeTo: __dirname, path: './templates/pages', layout: 'default', layoutPath: './templates/layouts', partialsPath: './templates/partials', helpersPath: './templates/helpers' }); cb(null, { server, elastic }); };
const Hapi = require('@hapi/hapi'); const routes = require('./routes'); const auth = require('./auth'); module.exports = async (elastic, config, cb) => { const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: "ignore" }, log: { collect: true } } }); server.route(routes(elastic, config)); if (config.auth) { server.route(auth()); await server.register(require('hapi-auth-jwt2')); await server.register(require('./auth/authentication')); } try { await server.register([ { plugin: require('good'), options: { reporters: { console: [{ module: 'good-console' }, 'stdout'] } } }, require('inert'), require('vision'), require('h2o2'), { plugin: require('./routes/plugins/error'), options: { config: config } } ]); } catch (err) { return cb(err); } server.views({ engines: { html: { module: require('handlebars'), compileMode: 'sync' } }, relativeTo: __dirname, path: './templates/pages', layout: 'default', layoutPath: './templates/layouts', partialsPath: './templates/partials', helpersPath: './templates/helpers' }); cb(null, { server, elastic }); };
Enable CORS ignore orgin header
Enable CORS ignore orgin header
JavaScript
mit
TheScienceMuseum/collectionsonline,TheScienceMuseum/collectionsonline
--- +++ @@ -3,7 +3,7 @@ const auth = require('./auth'); module.exports = async (elastic, config, cb) => { - const server = new Hapi.Server({ port: config.port, routes: { cors: true, log: { collect: true } } }); + const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: "ignore" }, log: { collect: true } } }); server.route(routes(elastic, config));
9ba37879aab75e4817ab7673a144521a86464580
src/server/xhr-proxy.js
src/server/xhr-proxy.js
// Copyright (c) Microsoft Corporation. All rights reserved. var http = require('http'), url = require('url'); module.exports.attach = function (app) { app.all('/xhr_proxy', function proxyXHR(request, response) { var requestURL = url.parse(unescape(request.query.rurl)); request.headers.host = requestURL.host; // fixes encoding issue delete request.headers['accept-encoding']; var options = { host: requestURL.host, path: requestURL.path, port: requestURL.port, method: request.method, headers: request.headers }; var proxyCallback = function (proxyReponse) { proxyReponse.pipe(response); }; http.request(options, proxyCallback).end(); }); };
// Copyright (c) Microsoft Corporation. All rights reserved. var http = require('http'), https = require('https'), url = require('url'); module.exports.attach = function (app) { app.all('/xhr_proxy', function proxyXHR(request, response) { var requestURL = url.parse(unescape(request.query.rurl)); request.headers.host = requestURL.host; // fixes encoding issue delete request.headers['accept-encoding']; var options = { host: requestURL.host, path: requestURL.path, port: requestURL.port, method: request.method, headers: request.headers }; var proxyCallback = function (proxyReponse) { proxyReponse.pipe(response); }; if (requestURL.protocol === "https:") { https.request(options, proxyCallback).end(); } else { http.request(options, proxyCallback).end(); } }); };
Support for HTTPS in XHR proxy.
Support for HTTPS in XHR proxy.
JavaScript
mit
TimBarham/cordova-simulate,Microsoft/taco-simulate-server,Microsoft/taco-simulate-server,TimBarham/cordova-simulate
--- +++ @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. var http = require('http'), + https = require('https'), url = require('url'); module.exports.attach = function (app) { @@ -22,7 +23,11 @@ var proxyCallback = function (proxyReponse) { proxyReponse.pipe(response); }; - - http.request(options, proxyCallback).end(); + + if (requestURL.protocol === "https:") { + https.request(options, proxyCallback).end(); + } else { + http.request(options, proxyCallback).end(); + } }); };
44d44c1a110f66a5cfd51608d3fb463cc87705f0
gulpfile.js
gulpfile.js
var gulp = require("gulp"); var browserify = require("browserify"); var source = require("vinyl-source-stream"); var buffer = require("vinyl-buffer"); var reactify = require("reactify"); var watch = require("gulp-watch"); var plumber = require("gulp-plumber"); var uglify = require('gulp-uglify'); gulp.task("browserify", function() { var bs = browserify({ entries: ["./src/main.js"], transform: [reactify] }); bs.bundle() .on("error", function() {}) .pipe(plumber()) .pipe(source("app.js")) .pipe(buffer()) .pipe(uglify()) .pipe(gulp.dest("./public/js")); }); gulp.task("watch", function() { gulp.watch("src/*.js", ["browserify"]); gulp.watch("src/*.jsx", ["browserify"]); }); gulp.task("default", ["browserify"]);
var gulp = require("gulp"); var browserify = require("browserify"); var source = require("vinyl-source-stream"); var buffer = require("vinyl-buffer"); var reactify = require("reactify"); var watch = require("gulp-watch"); var plumber = require("gulp-plumber"); var uglify = require('gulp-uglify'); gulp.task("browserify", function() { var bs = browserify({ entries: ["./src/main.js"], transform: [reactify] }); bs.bundle() .on("error", function(e) { console.log(e.message) }) .pipe(plumber()) .pipe(source("app.js")) .pipe(buffer()) .pipe(uglify()) .pipe(gulp.dest("./public/js")); }); gulp.task("watch", function() { gulp.watch("src/*.js", ["browserify"]); gulp.watch("src/*.jsx", ["browserify"]); }); gulp.task("default", ["browserify"]);
Change to show error message when browserify failed
Change to show error message when browserify failed
JavaScript
mit
Sixeight/iwai,Sixeight/iwai,Sixeight/iwai
--- +++ @@ -13,7 +13,7 @@ transform: [reactify] }); bs.bundle() - .on("error", function() {}) + .on("error", function(e) { console.log(e.message) }) .pipe(plumber()) .pipe(source("app.js")) .pipe(buffer())
7c867bc44d695ab15ecf63bdcf71db4088893551
sketch.js
sketch.js
const WIDTH = 800; const HEIGHT = 600; var setup = function() { createCanvas(WIDTH, HEIGHT); background(0); fill(255); angleMode(DEGREES); stroke(255); strokeWeight(1); strokeCap(SQUARE); } var draw = function() { translate(200, 200); rotate(45); rect(-50, -25, 100, 50); }
const WIDTH = 800; const HEIGHT = 600; var setup = function() { createCanvas(WIDTH, HEIGHT); background(0); fill(255); angleMode(DEGREES); stroke(255); strokeWeight(1); strokeCap(SQUARE); } var draw = function() { push(); translate(200, 200); rotate(45); rect(-50, -25, 100, 50); pop(); push(); translate(100, 300); rotate(45); rect(-50, -25, 100, 50); pop(); push(); translate(300, 100); rotate(45); rect(-50, -25, 100, 50); pop(); }
Use push and pop for different rectangles
Use push and pop for different rectangles
JavaScript
mit
SimonHFrost/my-p5,SimonHFrost/my-p5
--- +++ @@ -14,7 +14,21 @@ } var draw = function() { + push(); translate(200, 200); rotate(45); rect(-50, -25, 100, 50); + pop(); + + push(); + translate(100, 300); + rotate(45); + rect(-50, -25, 100, 50); + pop(); + + push(); + translate(300, 100); + rotate(45); + rect(-50, -25, 100, 50); + pop(); }
dbc8ad8b2a0bcd6229585910611808ae7c29791d
js/songz.js
js/songz.js
const songs = [...document.querySelectorAll('.songList li')]; const currentSong = document.querySelector('#currentSong'); songs.map((s) => { s.addEventListener('click', () => { currentSong.setAttribute('src', "https://archive.org/download/plays_some_standards/" + s.textContent.toLowerCase().replace(/\s/g, '_') + ".mp3"); }); });
const songs = [...document.querySelectorAll('.songList li')]; const currentSong = document.querySelector('#currentSong'); songs.map((s) => { s.addEventListener('click', () => { currentSong.setAttribute('src', "https://archive.org/download/plays_some_standards/" + s.textContent.toLowerCase().replace(/\s/g, '_') + ".mp3"); songs.map((i) => { i.style.textDecoration = 'none'; }); s.style.textDecoration = 'underline'; }); });
Add underline to playing song.
Add underline to playing song.
JavaScript
mpl-2.0
ryanpcmcquen/ryanpcmcquen.github.io,ryanpcmcquen/ryanpcmcquen.github.io
--- +++ @@ -3,5 +3,9 @@ songs.map((s) => { s.addEventListener('click', () => { currentSong.setAttribute('src', "https://archive.org/download/plays_some_standards/" + s.textContent.toLowerCase().replace(/\s/g, '_') + ".mp3"); + songs.map((i) => { + i.style.textDecoration = 'none'; + }); + s.style.textDecoration = 'underline'; }); });
46bf3ad1bee7ac96ccf23c26033b69b2d6394220
src/utils/convertToMoment.js
src/utils/convertToMoment.js
import moment from 'moment'; import {has} from 'ramda'; export default (newProps, momentProps) => { const dest = {}; momentProps.forEach(key => { const value = newProps[key]; if (value === null || value === undefined) { dest[key] = null; if (key === 'initial_visible_month') { dest[key] = moment( newProps.start_date || newProps.min_date_allowed || newProps.end_date || newProps.max_date_allowed || undefined ); } } else if (Array.isArray(value)) { dest[key] = value.map(moment); } else { dest[key] = moment(value); if (key === 'max_date_allowed' && has(key, dest)) { dest[key].add(1, 'days'); } } }); return dest; };
import moment from 'moment'; import {has} from 'ramda'; export default (newProps, momentProps) => { const dest = {}; momentProps.forEach(key => { const value = newProps[key]; if (value === null || value === undefined) { dest[key] = null; if (key === 'initial_visible_month') { dest[key] = moment( newProps.start_date || newProps.min_date_allowed || newProps.end_date || newProps.max_date_allowed || undefined ); } } else if (Array.isArray(value)) { dest[key] = value.map(d => moment(d)); } else { dest[key] = moment(value); if (key === 'max_date_allowed' && has(key, dest)) { dest[key].add(1, 'days'); } } }); return dest; };
Fix problem with moment conversion
Fix problem with moment conversion
JavaScript
mit
plotly/dash-core-components
--- +++ @@ -20,7 +20,7 @@ ); } } else if (Array.isArray(value)) { - dest[key] = value.map(moment); + dest[key] = value.map(d => moment(d)); } else { dest[key] = moment(value);
0825096862510c43b937ddac5c83b58a7a133f47
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var gutil = require('gulp-util'); var bower = require('bower'); var concat = require('gulp-concat'); var sh = require('shelljs'); var del = require('del'); var copyHTML = require('ionic-gulp-html-copy'); var requireDir = require('require-dir'); var gulpTask = requireDir('./gulp'); gulp.task('default', ['clean'], function() { gulp.start('build'); }); gulp.task('install', ['git-check'], function() { return bower.commands.install() .on('log', function(data) { gutil.log('bower', gutil.colors.cyan(data.id), data.message); }); }); gulp.task('git-check', function(done) { if (!sh.which('git')) { console.log( ' ' + gutil.colors.red('Git is not installed.'), '\n Git, the version control system, is required to download Ionic.', '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' ); process.exit(1); } done(); }); gulp.task('html', function() { return copyHTML({ dest: 'www' }); }); gulp.task('clean', function() { return del(['www/css', 'www/pages', 'www/js']); });
var gulp = require('gulp'); var gutil = require('gulp-util'); var bower = require('bower'); var concat = require('gulp-concat'); var sh = require('shelljs'); var del = require('del'); var copyHTML = require('ionic-gulp-html-copy'); var requireDir = require('require-dir'); var gulpTask = requireDir('./gulp'); gulp.task('default', ['clean'], function() { gulp.start('build', 'watch'); }); gulp.task('install', ['git-check'], function() { return bower.commands.install() .on('log', function(data) { gutil.log('bower', gutil.colors.cyan(data.id), data.message); }); }); gulp.task('git-check', function(done) { if (!sh.which('git')) { console.log( ' ' + gutil.colors.red('Git is not installed.'), '\n Git, the version control system, is required to download Ionic.', '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' ); process.exit(1); } done(); }); gulp.task('html', function() { return copyHTML({ dest: 'www' }); }); gulp.task('clean', function() { return del(['www/css', 'www/pages', 'www/js']); });
Add watch task to default
Add watch task to default
JavaScript
mit
naratipud/ionic-ts-sample,naratipud/ionic-ts-sample,naratipud/ionic-ts-sample
--- +++ @@ -9,7 +9,7 @@ var gulpTask = requireDir('./gulp'); gulp.task('default', ['clean'], function() { - gulp.start('build'); + gulp.start('build', 'watch'); }); gulp.task('install', ['git-check'], function() {
14537e283e19802f2decfae2f269caf0c8860b20
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var elm = require('gulp-elm'); var plumber = require('gulp-plumber'); var del = require('del'); var browserSync = require('browser-sync'); // builds elm files and static resources (i.e. html and css) from src to dist folder var paths = { dest: 'dist', elm: 'src/*.elm', staticAssets: 'src/*.{html,css}' }; gulp.task('clean', function(cb) { del([paths.dest], cb); }); gulp.task('elm-init', elm.init); gulp.task('elm', ['elm-init'], function() { return gulp.src(paths.elm) .pipe(plumber()) .pipe(elm()) .pipe(gulp.dest(paths.dest)) .pipe(browserSync.stream()); }); gulp.task('staticAssets', function() { return gulp.src(paths.staticAssets) .pipe(plumber()) .pipe(gulp.dest(paths.dest)) .pipe(browserSync.stream()); }); gulp.task('browser-sync', function() { browserSync.init({ server: { baseDir: "dist/" } }); }); gulp.task('watch', function() { gulp.watch(paths.elm, ['elm']); gulp.watch(paths.staticAssets, ['staticAssets']); }); gulp.task('build', ['elm', 'staticAssets']); gulp.task('dev', ['build', 'browser-sync', 'watch']); gulp.task('default', ['build']);
var gulp = require('gulp'); var elm = require('gulp-elm'); var plumber = require('gulp-plumber'); var del = require('del'); var browserSync = require('browser-sync'); // builds elm files and static resources (i.e. html and css) from src to dist folder var paths = { dest: 'dist', elm: 'src/*.elm', staticAssets: 'src/*.{html,css}' }; gulp.task('clean', function(cb) { del([paths.dest], cb); }); gulp.task('elm-init', elm.init); gulp.task('elm', ['elm-init'], function() { return gulp.src(paths.elm) .pipe(plumber()) .pipe(elm()) .pipe(gulp.dest(paths.dest)) .pipe(browserSync.stream()); }); gulp.task('staticAssets', function() { return gulp.src(paths.staticAssets) .pipe(plumber()) .pipe(gulp.dest(paths.dest)) .pipe(browserSync.stream()); }); gulp.task('browser-sync', function() { browserSync.init({ server: { baseDir: "dist/" }, notify: false }); }); gulp.task('watch', function() { gulp.watch(paths.elm, ['elm']); gulp.watch(paths.staticAssets, ['staticAssets']); }); gulp.task('build', ['elm', 'staticAssets']); gulp.task('dev', ['build', 'browser-sync', 'watch']); gulp.task('default', ['build']);
Disable notification in browser-sync as it caused issues with layout
Disable notification in browser-sync as it caused issues with layout
JavaScript
mit
martin-kolinek/elm-dashboard,martin-kolinek/elm-dashboard
--- +++ @@ -36,7 +36,8 @@ browserSync.init({ server: { baseDir: "dist/" - } + }, + notify: false }); });
14909c3d779edddad99b5f08ad5b17a4802abc13
app/assets/javascripts/profile.js
app/assets/javascripts/profile.js
const checkStatus = () => { fetch("/load_status", { credentials: "same-origin" }) .then(response => { return response.text(); }) .then(data => { document.getElementById("repo-alert").style.display = "block"; if (data === "true") { document.getElementById("repo-load-info").innerHTML = "Repositories refreshed! Click <a href='/profile'>here</a> to reload."; } else { setTimeout(checkStatus, 1000); } }); }; document.addEventListener("DOMContentLoaded", () => { if (document.getElementById("repo-alert")) { checkStatus(); } });
const checkStatus = () => { fetch("/repositories/load_status", { credentials: "same-origin" }) .then(response => { return response.text(); }) .then(data => { document.getElementById("repo-alert").style.display = "block"; if (data === "true") { document.getElementById("repo-load-info").innerHTML = "Repositories refreshed! Click <a href='/profile'>here</a> to reload."; } else { setTimeout(checkStatus, 1000); } }); }; document.addEventListener("DOMContentLoaded", () => { if (document.getElementById("repo-alert")) { checkStatus(); } });
Use correct load_status path in JS
Use correct load_status path in JS
JavaScript
mit
schneidmaster/gitreports.com,schneidmaster/gitreports.com,schneidmaster/gitreports.com
--- +++ @@ -1,5 +1,5 @@ const checkStatus = () => { - fetch("/load_status", { + fetch("/repositories/load_status", { credentials: "same-origin" }) .then(response => {
c67221a0661795471bc5c650292d3e6321e623a8
gulpfile.js
gulpfile.js
var gulp = require('gulp') var browserify = require('browserify') var source = require('vinyl-source-stream') var serve = require('gulp-serve') var concat = require('gulp-concat') // Static file server gulp.task('server', serve({ root: ['example', 'dist'], port: 7000 })) gulp.task('build', function () { return browserify('./src/opbeat.js', { standalone: 'Opbeat' }).bundle() .pipe(source('opbeat.js')) .pipe(gulp.dest('./dist')) }) // Development mode gulp.task('watch', [], function (cb) { gulp.run( 'build', 'server' ) // Watch JS files gulp.watch(['libs/**', 'src/**'], ['build']) console.log('\nExample site running on http://localhost:7000/\n') }) // // Default task // gulp.task('default', function () { var response = ['', 'No task selected.', 'Available tasks:', '', 'gulp watch - Watch files and preview example site on localhost.', '' ].join('\n') console.log(response) })
var gulp = require('gulp') var source = require('vinyl-source-stream') var serve = require('gulp-serve') var rename = require('gulp-rename') var browserify = require('browserify') var buffer = require('vinyl-buffer') var uglify = require('gulp-uglify') var taskListing = require('gulp-task-listing') // Static file server gulp.task('server', serve({ root: ['example', 'dist'], port: 7000 })) gulp.task('release', function () { return browserify('./src/opbeat.js', { standalone: 'Opbeat' }).bundle() .pipe(source('opbeat.js')) .pipe(gulp.dest('./dist')) .pipe(rename('opbeat.min.js')) .pipe(buffer()) .pipe(uglify()) .pipe(gulp.dest('./dist')) }) gulp.task('build', function () { return browserify('./src/opbeat.js', { standalone: 'Opbeat' }).bundle() .pipe(source('opbeat.js')) .pipe(gulp.dest('./dist')) }) // Development mode gulp.task('watch', [], function (cb) { gulp.run( 'build', 'server' ) // Watch JS files gulp.watch(['libs/**', 'src/**'], ['build']) console.log('\nExample site running on http://localhost:7000/\n') }) gulp.task('default', taskListing)
Add gulp release script to generate minified build.
Add gulp release script to generate minified build.
JavaScript
mit
opbeat/opbeat-react,opbeat/opbeat-angular,opbeat/opbeat-react,opbeat/opbeat-angular,opbeat/opbeat-js-core,jahtalab/opbeat-js,opbeat/opbeat-react,opbeat/opbeat-js-core,jahtalab/opbeat-js,jahtalab/opbeat-js,opbeat/opbeat-angular
--- +++ @@ -1,14 +1,29 @@ var gulp = require('gulp') -var browserify = require('browserify') var source = require('vinyl-source-stream') var serve = require('gulp-serve') -var concat = require('gulp-concat') +var rename = require('gulp-rename') +var browserify = require('browserify') +var buffer = require('vinyl-buffer') +var uglify = require('gulp-uglify') +var taskListing = require('gulp-task-listing') // Static file server gulp.task('server', serve({ root: ['example', 'dist'], port: 7000 })) + +gulp.task('release', function () { + return browserify('./src/opbeat.js', { + standalone: 'Opbeat' + }).bundle() + .pipe(source('opbeat.js')) + .pipe(gulp.dest('./dist')) + .pipe(rename('opbeat.min.js')) + .pipe(buffer()) + .pipe(uglify()) + .pipe(gulp.dest('./dist')) +}) gulp.task('build', function () { return browserify('./src/opbeat.js', { @@ -27,19 +42,7 @@ // Watch JS files gulp.watch(['libs/**', 'src/**'], ['build']) - console.log('\nExample site running on http://localhost:7000/\n') }) -// -// Default task -// -gulp.task('default', function () { - var response = ['', - 'No task selected.', - 'Available tasks:', '', - 'gulp watch - Watch files and preview example site on localhost.', '' - ].join('\n') - - console.log(response) -}) +gulp.task('default', taskListing)
b9f206997eed1fbadfdeea81dd165fb17750f6a4
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var less = require('gulp-less'); var plumber = require("gulp-plumber"); var browserSync = require('browser-sync').create(); gulp.task('run', function() { browserSync.init({ server: "./" }); gulp.watch(['komforta.less', 'less/*.less'], ['compile']); gulp.watch('*.css').on('change', browserSync.reload); }); gulp.task('compile', function() { return gulp.src('./komforta.less') .pipe(plumber()) .pipe(less({ paths: ['./'] })) .pipe(gulp.dest('./')) .pipe(browserSync.stream()); });
var gulp = require('gulp'); var less = require('gulp-less'); var plumber = require("gulp-plumber"); var browserSync = require('browser-sync').create(); gulp.task('run', function() { browserSync.init({ server: "./" }); gulp.watch(['komforta.less', 'less/*.less'], ['compile']); gulp.watch('*.css').on('change', browserSync.reload); }); gulp.task('compile', function() { return gulp.src('./komforta.less') .pipe(plumber({ errorHandler: function(error) { console.log(error.message); this.emit('end'); } })) .pipe(less()) .pipe(gulp.dest('./')) .pipe(browserSync.stream()); });
Add settings when error occured
Add settings when error occured
JavaScript
mit
rochefort/hatena-blog-theme-komforta,rochefort/hatena-blog-theme-komforta
--- +++ @@ -13,10 +13,13 @@ gulp.task('compile', function() { return gulp.src('./komforta.less') - .pipe(plumber()) - .pipe(less({ - paths: ['./'] + .pipe(plumber({ + errorHandler: function(error) { + console.log(error.message); + this.emit('end'); + } })) + .pipe(less()) .pipe(gulp.dest('./')) .pipe(browserSync.stream()); });
9f4144ee6c33e14aa5e824b117450083c3296ec9
target.js
target.js
Target = function(x, y) { this.x = x; this.y = y; this.life = 11; this.size = 12; return this; } Target.prototype.render = function() { var x = this.x - gCamera.x; var y = this.y - gCamera.y; // Only render if within the camera's bounds if (gCamera.isInView(this)) { renderPath([['arc', x + 2, y + 2, 13, 0, Math.PI * 2]]); fill('#222'); renderPath([['arc', x, y, this.size, 0, Math.PI * 2]]); fill('rgb(' + Math.round(255 * (this.life / this.size)) + ',' + Math.round(255 * ((this.size - this.life) / this.size)) + ',' + 0x22 + ')'); } }
Target = function(x, y, type) { this.x = x; this.y = y; this.life = 11; this.size = 12; this.type = typeof type === 'string' ? type : 'circle'; return this; } Target.prototype.render = function() { var x = this.x - gCamera.x; var y = this.y - gCamera.y; // Only render if within the camera's bounds if (gCamera.isInView(this)) { switch(this.type) { case 'circle': renderPath([['arc', x + 2, y + 2, 13, 0, Math.PI * 2]]); fill('#222'); renderPath([['arc', x, y, this.size, 0, Math.PI * 2]]); fill('rgb(' + Math.round(255 * (this.life / this.size)) + ',' + Math.round(255 * ((this.size - this.life) / this.size)) + ',' + 0x22 + ')'); break; } } }
Update Target to accept different types
Update Target to accept different types
JavaScript
mit
peternatewood/shmup,peternatewood/shmup,peternatewood/shmup
--- +++ @@ -1,8 +1,9 @@ -Target = function(x, y) { +Target = function(x, y, type) { this.x = x; this.y = y; this.life = 11; this.size = 12; + this.type = typeof type === 'string' ? type : 'circle'; return this; } @@ -12,10 +13,14 @@ // Only render if within the camera's bounds if (gCamera.isInView(this)) { - renderPath([['arc', x + 2, y + 2, 13, 0, Math.PI * 2]]); - fill('#222'); + switch(this.type) { + case 'circle': + renderPath([['arc', x + 2, y + 2, 13, 0, Math.PI * 2]]); + fill('#222'); - renderPath([['arc', x, y, this.size, 0, Math.PI * 2]]); - fill('rgb(' + Math.round(255 * (this.life / this.size)) + ',' + Math.round(255 * ((this.size - this.life) / this.size)) + ',' + 0x22 + ')'); + renderPath([['arc', x, y, this.size, 0, Math.PI * 2]]); + fill('rgb(' + Math.round(255 * (this.life / this.size)) + ',' + Math.round(255 * ((this.size - this.life) / this.size)) + ',' + 0x22 + ')'); + break; + } } }
89ad381b6aa24b12ab02c3de9a049806bd1bd20a
patches/promise.js
patches/promise.js
'use strict'; function PromiseWrap() {} module.exports = function patchPromise() { const hooks = this._hooks; const state = this._state; const Promise = global.Promise; const oldThen = Promise.prototype.then; Promise.prototype.then = wrappedThen; function makeWrappedHandler(fn, handle, uid) { if ('function' !== typeof fn) return fn; return function wrappedHandler() { hooks.pre.call(handle); try { return fn.apply(this, arguments); } finally { hooks.post.call(handle); hooks.destroy.call(null, uid); } }; } function wrappedThen(onFulfilled, onRejected) { if (!state.enabled) return oldThen.call(this, onFulfilled, onRejected); const handle = new PromiseWrap(); const uid = --state.counter; hooks.init.call(handle, 0, uid, null); return oldThen.call( this, makeWrappedHandler(onFulfilled, handle, uid), makeWrappedHandler(onRejected, handle, uid) ); } };
'use strict'; function PromiseWrap() {} module.exports = function patchPromise() { const hooks = this._hooks; const state = this._state; const Promise = global.Promise; /* As per ECMAScript 2015, .catch must be implemented by calling .then, as * such we need needn't patch .catch as well. see: * http://www.ecma-international.org/ecma-262/6.0/#sec-promise.prototype.catch */ const oldThen = Promise.prototype.then; Promise.prototype.then = wrappedThen; function makeWrappedHandler(fn, handle, uid) { if ('function' !== typeof fn) return fn; return function wrappedHandler() { hooks.pre.call(handle); try { return fn.apply(this, arguments); } finally { hooks.post.call(handle); hooks.destroy.call(null, uid); } }; } function wrappedThen(onFulfilled, onRejected) { if (!state.enabled) return oldThen.call(this, onFulfilled, onRejected); const handle = new PromiseWrap(); const uid = --state.counter; hooks.init.call(handle, 0, uid, null); return oldThen.call( this, makeWrappedHandler(onFulfilled, handle, uid), makeWrappedHandler(onRejected, handle, uid) ); } };
Add comment explaining why it is unnecessary to patch .catch
Add comment explaining why it is unnecessary to patch .catch
JavaScript
mit
AndreasMadsen/async-hook
--- +++ @@ -7,6 +7,11 @@ const state = this._state; const Promise = global.Promise; + + /* As per ECMAScript 2015, .catch must be implemented by calling .then, as + * such we need needn't patch .catch as well. see: + * http://www.ecma-international.org/ecma-262/6.0/#sec-promise.prototype.catch + */ const oldThen = Promise.prototype.then; Promise.prototype.then = wrappedThen;
d2d24f2c3a0daf1db0bc75f598fce9e17d87e675
tests/dummy/app/app.js
tests/dummy/app/app.js
import Ember from 'ember'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; Ember.MODEL_FACTORY_INJECTIONS = true; App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver }); loadInitializers(App, config.modulePrefix); export default App;
import Ember from 'ember'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver }); loadInitializers(App, config.modulePrefix); export default App;
Fix Model Factory Injections Deprecation
Fix Model Factory Injections Deprecation Fix ember-metal.model-factory-injections deprecation by removing code that set the MODEL_FACTORY_INJECTIONS flag, which is no longer needed.
JavaScript
mit
OCTRI/ember-i18next,OCTRI/ember-i18next
--- +++ @@ -4,8 +4,6 @@ import config from './config/environment'; let App; - -Ember.MODEL_FACTORY_INJECTIONS = true; App = Ember.Application.extend({ modulePrefix: config.modulePrefix,
a08eccf9b84b5754f7cf09c06292a76ea3f1a6bb
testem.js
testem.js
'use strict'; let isCI = !!process.env.CI; let smokeTests = !!process.env.SMOKE_TESTS; let config = { framework: 'qunit', test_page: smokeTests ? 'tests/index.html?smoke_tests=true' : 'tests/index.html?hidepassed', disable_watching: true, browser_start_timeout: smokeTests ? 300000 : 30000, browser_args: { Chrome: { mode: 'ci', args: [ // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio', '--remote-debugging-port=0', '--window-size=1440,900', ], }, }, launch_in_dev: ['Chrome'], launch_in_ci: ['Chrome'], }; if (isCI) { config.tap_quiet_logs = true; } module.exports = config;
'use strict'; let isCI = !!process.env.CI; let smokeTests = !!process.env.SMOKE_TESTS; let config = { framework: 'qunit', test_page: smokeTests ? 'tests/index.html?smoke_tests=true' : 'tests/index.html?hidepassed', disable_watching: true, browser_start_timeout: smokeTests ? 300000 : 30000, browser_disconnect_timeout: smokeTests ? 120 : 10, browser_args: { Chrome: { mode: 'ci', args: [ // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio', '--remote-debugging-port=0', '--window-size=1440,900', ], }, }, launch_in_dev: ['Chrome'], launch_in_ci: ['Chrome'], }; if (isCI) { config.tap_quiet_logs = true; } module.exports = config;
Increase browser disconnect timeout in smoke tests
Increase browser disconnect timeout in smoke tests
JavaScript
mit
glimmerjs/glimmer-vm,tildeio/glimmer,glimmerjs/glimmer-vm,tildeio/glimmer,tildeio/glimmer,glimmerjs/glimmer-vm
--- +++ @@ -8,6 +8,7 @@ test_page: smokeTests ? 'tests/index.html?smoke_tests=true' : 'tests/index.html?hidepassed', disable_watching: true, browser_start_timeout: smokeTests ? 300000 : 30000, + browser_disconnect_timeout: smokeTests ? 120 : 10, browser_args: { Chrome: { mode: 'ci',
ca287bf5f22637d98af2ea9c78b499c7fc058766
busstops/static/js/global.js
busstops/static/js/global.js
/*jslint browser: true*/ if (navigator.serviceWorker && location.protocol === 'https://') { try { navigator.serviceWorker.register('/serviceworker.js', { scope: '/' }); window.addEventListener('load', function () { if (navigator.serviceWorker.controller) { navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'}); } }); } catch {} } (function () { var cookieMessage = document.getElementById('cookie-message'); if (cookieMessage && document.cookie.indexOf('seen_cookie_message=yes') === -1) { cookieMessage.style.display = 'block'; document.cookie = 'seen_cookie_message=yes; max-age=31536000; path=/'; } })();
/*jslint browser: true*/ if (navigator.serviceWorker && location.host !== 'localhost:8000') { navigator.serviceWorker.register('/serviceworker.js', { scope: '/' }); window.addEventListener('load', function () { if (navigator.serviceWorker.controller) { navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'}); } }); } (function () { var cookieMessage = document.getElementById('cookie-message'); if (cookieMessage && document.cookie.indexOf('seen_cookie_message=yes') === -1) { cookieMessage.style.display = 'block'; document.cookie = 'seen_cookie_message=yes; max-age=31536000; path=/'; } })();
Revert "catch service worker error?"
Revert "catch service worker error?" This reverts commit c14cfe8917c1f1c23ccd4bbd25a7b40d6c5d6b2b.
JavaScript
mpl-2.0
jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk
--- +++ @@ -1,16 +1,14 @@ /*jslint browser: true*/ -if (navigator.serviceWorker && location.protocol === 'https://') { - try { - navigator.serviceWorker.register('/serviceworker.js', { - scope: '/' - }); - window.addEventListener('load', function () { - if (navigator.serviceWorker.controller) { - navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'}); - } - }); - } catch {} +if (navigator.serviceWorker && location.host !== 'localhost:8000') { + navigator.serviceWorker.register('/serviceworker.js', { + scope: '/' + }); + window.addEventListener('load', function () { + if (navigator.serviceWorker.controller) { + navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'}); + } + }); } (function () {
96a7e42c5ee0226dee571e9aa0ef9774d2eb4c77
topics/about_numbers.js
topics/about_numbers.js
module("About Numbers (topics/about_numbers.js)"); test("types", function() { var typeOfIntegers = typeof(6); var typeOfFloats = typeof(3.14159); equal(__, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?'); equal(__, typeOfIntegers, 'what is the javascript numeric type?'); equal(__, 1.0, 'what is a integer number equivalent to 1.0?'); }); test("NaN", function() { var resultOfFailedOperations = 7/'apple'; equal(__, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?'); equal(__, resultOfFailedOperations == NaN, 'is NaN == NaN?'); });
module("About Numbers (topics/about_numbers.js)"); test("types", function() { var typeOfIntegers = typeof(6); var typeOfFloats = typeof(3.14159); equal(true, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?'); equal('number', typeOfIntegers, 'what is the javascript numeric type?'); equal(1, 1.0, 'what is a integer number equivalent to 1.0?'); }); test("NaN", function() { var resultOfFailedOperations = 7/'apple'; equal(true, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?'); equal(false, resultOfFailedOperations == NaN, 'is NaN == NaN?'); });
Complete numbers tests to pass
Complete numbers tests to pass
JavaScript
mit
supportbeam/javascript_koans,supportbeam/javascript_koans
--- +++ @@ -4,13 +4,13 @@ test("types", function() { var typeOfIntegers = typeof(6); var typeOfFloats = typeof(3.14159); - equal(__, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?'); - equal(__, typeOfIntegers, 'what is the javascript numeric type?'); - equal(__, 1.0, 'what is a integer number equivalent to 1.0?'); + equal(true, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?'); + equal('number', typeOfIntegers, 'what is the javascript numeric type?'); + equal(1, 1.0, 'what is a integer number equivalent to 1.0?'); }); test("NaN", function() { var resultOfFailedOperations = 7/'apple'; - equal(__, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?'); - equal(__, resultOfFailedOperations == NaN, 'is NaN == NaN?'); + equal(true, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?'); + equal(false, resultOfFailedOperations == NaN, 'is NaN == NaN?'); });
6c66286a761072fd7b69aabd85a7d75a93b7c80c
lib/initial.js
lib/initial.js
/*! * stylus-initial * Copyright (c) 2014 Pierre-Antoine "Leny" Delnatte <info@flatland.be> * (Un)Licensed */ "use strict"; var utils = require( "stylus" ).utils, rInitial = /([a-z\-]+)\s*:\s*(initial);/gi, oInitialValues = require( "./values.json" ); var plugin = function() { return function( stylus ) { stylus.on( "end", function( err, css ) { return css.replace( rInitial, function( sRule, sProperty ) { var mInitialValue; if( ( mInitialValue = oInitialValues[ sProperty ] ) != null ) { return sProperty + ": " + mInitialValue + ";"; } return sRule; } ); } ); }; }; module.exports = plugin; module.exports.version = require( "../package.json" ).version;
/*! * stylus-initial * Copyright (c) 2014 Pierre-Antoine "Leny" Delnatte <info@flatland.be> * (Un)Licensed */ "use strict"; var utils = require( "stylus" ).utils, rInitial = /([a-z\-]+)\s*:\s*(initial);/gi, oInitialValues = require( "./values.json" ); var plugin = function() { return function( stylus ) { var oEvaluator = this.evaluator, nodes = this.nodes, _fVisitProperty = oEvaluator.visitProperty; oEvaluator.visitProperty = function( oNode ) { var oCurrentValue, mInitialValue; _fVisitProperty.call( oEvaluator, oNode ); if( oNode.nodeName !== "property" || oNode.expr.isList || ( oCurrentValue = oNode.expr.first ).nodeName !== "ident" || oCurrentValue.string !== "initial" ) { return oNode; } if( ( mInitialValue = oInitialValues[ oNode.name ] ) != null ) { oNode.expr = new nodes.Literal( mInitialValue ); } return oNode; }; }; }; module.exports = plugin; module.exports.version = require( "../package.json" ).version;
Refactor the code to be a pre-processing task.
Refactor the code to be a pre-processing task.
JavaScript
unlicense
leny/stylus-initial
--- +++ @@ -12,15 +12,21 @@ var plugin = function() { return function( stylus ) { - stylus.on( "end", function( err, css ) { - return css.replace( rInitial, function( sRule, sProperty ) { - var mInitialValue; - if( ( mInitialValue = oInitialValues[ sProperty ] ) != null ) { - return sProperty + ": " + mInitialValue + ";"; - } - return sRule; - } ); - } ); + var oEvaluator = this.evaluator, + nodes = this.nodes, + _fVisitProperty = oEvaluator.visitProperty; + + oEvaluator.visitProperty = function( oNode ) { + var oCurrentValue, mInitialValue; + _fVisitProperty.call( oEvaluator, oNode ); + if( oNode.nodeName !== "property" || oNode.expr.isList || ( oCurrentValue = oNode.expr.first ).nodeName !== "ident" || oCurrentValue.string !== "initial" ) { + return oNode; + } + if( ( mInitialValue = oInitialValues[ oNode.name ] ) != null ) { + oNode.expr = new nodes.Literal( mInitialValue ); + } + return oNode; + }; }; };
28141a5f615c5d11151e850beb7b6541045daeab
src/utils/general.js
src/utils/general.js
const getTaggedTemplateLiteralContent = require('./tagged-template-literal').getTaggedTemplateLiteralContent const getCSS = (node) => ` .selector { ${getTaggedTemplateLiteralContent(node)} } ` const getKeyframes = (node) => ` @keyframes { ${getTaggedTemplateLiteralContent(node)} } ` exports.getKeyframes = getKeyframes exports.getCSS = getCSS
const getTaggedTemplateLiteralContent = require('./tagged-template-literal').getTaggedTemplateLiteralContent const getCSS = (node) => `.selector {${getTaggedTemplateLiteralContent(node)}}\n` const getKeyframes = (node) => `@keyframes {${getTaggedTemplateLiteralContent(node)}}\n` exports.getKeyframes = getKeyframes exports.getCSS = getCSS
Fix whitespace in generated CSS
Fix whitespace in generated CSS
JavaScript
mit
styled-components/stylelint-processor-styled-components
--- +++ @@ -1,16 +1,8 @@ const getTaggedTemplateLiteralContent = require('./tagged-template-literal').getTaggedTemplateLiteralContent -const getCSS = (node) => ` -.selector { - ${getTaggedTemplateLiteralContent(node)} -} -` +const getCSS = (node) => `.selector {${getTaggedTemplateLiteralContent(node)}}\n` -const getKeyframes = (node) => ` -@keyframes { - ${getTaggedTemplateLiteralContent(node)} -} -` +const getKeyframes = (node) => `@keyframes {${getTaggedTemplateLiteralContent(node)}}\n` exports.getKeyframes = getKeyframes exports.getCSS = getCSS
92510dc784b2ee72684b33668614d43e278542f5
src/lib/config.example.js
src/lib/config.example.js
module.exports = { SESSION_TOKEN_KEY: 'SESSION_TOKEN_KEY', backend: { hapiRemote: true, hapiLocal: false, parseRemote: false, parseLocal: false }, HAPI: { local: { url: 'http://localhost:5000' }, remote: { url: 'https://snowflakeserver-bartonhammond.rhcloud.com/' } }, PARSE: { appId: 'snowflake', // match APP_ID in parse-server's index.js local: { url: 'http://localhost:1337/parse' // match SERVER_URL in parse-server's index.js }, remote: { url: 'http://snowflake-parse.herokuapp.com/parse' // match SERVER_URL in parse-server's index.js } } }
module.exports = { SESSION_TOKEN_KEY: 'SESSION_TOKEN_KEY', backend: { hapiRemote: false, hapiLocal: false, parseRemote: true, parseLocal: false }, HAPI: { local: { url: 'http://localhost:5000' }, remote: { url: 'https://snowflakeserver-bartonhammond.rhcloud.com/' } }, PARSE: { appId: 'snowflake', // match APP_ID in parse-server's index.js local: { url: 'http://localhost:1337/parse' // match SERVER_URL in parse-server's index.js }, remote: { url: 'http://snowflake-parse.herokuapp.com/parse' // match SERVER_URL in parse-server's index.js } } }
Change default remote server to a working one
Change default remote server to a working one
JavaScript
mit
mkurutin/snowflake,mkurutin/snowflake,mkurutin/snowflake,mkurutin/snowflake
--- +++ @@ -1,9 +1,9 @@ module.exports = { SESSION_TOKEN_KEY: 'SESSION_TOKEN_KEY', backend: { - hapiRemote: true, + hapiRemote: false, hapiLocal: false, - parseRemote: false, + parseRemote: true, parseLocal: false }, HAPI: {
56f1f0c255d80f21d55828ba0c7d40bdeb62431b
src/main/webapp/js/app.js
src/main/webapp/js/app.js
'use strict'; /* App Module */ angular.module('nestorshop', ['nestorshopServices']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/products', {templateUrl: 'partials/product-list.html', controller: ProductListCtrl}). when('/products/:productId', {templateUrl: 'partials/product-detail.html', controller: ProductDetailCtrl}). when('/shoplists', {templateUrl: 'partials/shoplist-list.html', controller: ShopListsCtrl}). when('/shoplists/:shoplistId', {templateUrl: 'partials/shoplist-detail.html', controller: ShopListDetailCtrl}). otherwise({redirectTo: '/products'}); }]);
'use strict'; /* App Module */ angular.module('nestorshop', ['nestorshopServices'], function($httpProvider) { // Use x-www-form-urlencoded Content-Type $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; // Override $http service's default transformRequest $httpProvider.defaults.transformRequest = [function(data) { return angular.isObject(data) && String(data) !== '[object File]' ? jQuery.param(data) : data; }]; }). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/products', {templateUrl: 'partials/product-list.html', controller: ProductListCtrl}). when('/products/:productId', {templateUrl: 'partials/product-detail.html', controller: ProductDetailCtrl}). when('/shoplists', {templateUrl: 'partials/shoplist-list.html', controller: ShopListsCtrl}). when('/shoplists/:shoplistId', {templateUrl: 'partials/shoplist-detail.html', controller: ShopListDetailCtrl}). otherwise({redirectTo: '/products'}); }]);
Change POST of angular to send values in FormData (for jersey to read)
Change POST of angular to send values in FormData (for jersey to read) By default it sends parameters as Request Payload, and jersey ignores them. Read : http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/
JavaScript
apache-2.0
nestorpina/nestor-shop,IGZnestorpina/nestor-shop,nestorpina/nestor-shop,IGZnestorpina/nestor-shop,nestorpina/nestor-shop,IGZnestorpina/nestor-shop
--- +++ @@ -2,7 +2,15 @@ /* App Module */ -angular.module('nestorshop', ['nestorshopServices']). +angular.module('nestorshop', ['nestorshopServices'], function($httpProvider) { + // Use x-www-form-urlencoded Content-Type + $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; + + // Override $http service's default transformRequest + $httpProvider.defaults.transformRequest = [function(data) { + return angular.isObject(data) && String(data) !== '[object File]' ? jQuery.param(data) : data; + }]; + }). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/products', {templateUrl: 'partials/product-list.html', controller: ProductListCtrl}). @@ -10,4 +18,6 @@ when('/shoplists', {templateUrl: 'partials/shoplist-list.html', controller: ShopListsCtrl}). when('/shoplists/:shoplistId', {templateUrl: 'partials/shoplist-detail.html', controller: ShopListDetailCtrl}). otherwise({redirectTo: '/products'}); + }]); +
ed1ef7efea65c12f77551044f11feab4f4aeb291
src/main/webapp/search.js
src/main/webapp/search.js
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. function doSearch() { var topic = document.getElementById("topic-search-box").value; fetch("/search?topic="+topic).then(response => response.json()).then((results) => { console.log(results); }); }
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. function doSearch() { var topic = document.getElementById("topic-search-box").value; fetch("/search?topic="+topic).then(response => response.text()).then((results) => { console.log(results); }); }
Change response to text instead of json
Change response to text instead of json
JavaScript
apache-2.0
googleinterns/step132-2020,googleinterns/step132-2020,googleinterns/step132-2020
--- +++ @@ -16,7 +16,7 @@ var topic = document.getElementById("topic-search-box").value; - fetch("/search?topic="+topic).then(response => response.json()).then((results) => { + fetch("/search?topic="+topic).then(response => response.text()).then((results) => { console.log(results); });
93c7fafada259af365e9f98a2d9a139f528052ae
config/dev.js
config/dev.js
// Rollup plugins. import babel from 'rollup-plugin-babel' import cjs from 'rollup-plugin-commonjs' import globals from 'rollup-plugin-node-globals' import replace from 'rollup-plugin-replace' import resolve from 'rollup-plugin-node-resolve' export default { dest: 'build/app.js', entry: 'src/index.js', format: 'iife', plugins: [ babel({ babelrc: false, exclude: 'node_modules/**', presets: [ [ 'es2015', { modules: false } ], 'stage-0', 'react' ], plugins: [ 'external-helpers' ] }), cjs({ exclude: 'node_modules/process-es6/**', include: [ 'node_modules/fbjs/**', 'node_modules/object-assign/**', 'node_modules/react/**', 'node_modules/react-dom/**', 'node_modules/prop-types/**' ] }), globals(), replace({ 'process.env.NODE_ENV': JSON.stringify('development') }), resolve({ browser: true, main: true }) ], sourceMap: true }
// Rollup plugins. import babel from 'rollup-plugin-babel' import cjs from 'rollup-plugin-commonjs' import globals from 'rollup-plugin-node-globals' import replace from 'rollup-plugin-replace' import resolve from 'rollup-plugin-node-resolve' export default { dest: 'build/app.js', entry: 'src/index.js', format: 'iife', plugins: [ babel({ babelrc: false, exclude: 'node_modules/**', presets: [ [ 'es2015', { modules: false } ], 'stage-0', 'react' ], plugins: [ 'external-helpers' ] }), cjs({ exclude: 'node_modules/process-es6/**', include: [ 'node_modules/create-react-class/**', 'node_modules/fbjs/**', 'node_modules/object-assign/**', 'node_modules/react/**', 'node_modules/react-dom/**', 'node_modules/prop-types/**' ] }), globals(), replace({ 'process.env.NODE_ENV': JSON.stringify('development') }), resolve({ browser: true, main: true }) ], sourceMap: true }
Include create-react-class in Rollup configuration :newspaper:.
Include create-react-class in Rollup configuration :newspaper:.
JavaScript
mit
yamafaktory/babel-react-rollup-starter,yamafaktory/babel-react-rollup-starter
--- +++ @@ -19,6 +19,7 @@ cjs({ exclude: 'node_modules/process-es6/**', include: [ + 'node_modules/create-react-class/**', 'node_modules/fbjs/**', 'node_modules/object-assign/**', 'node_modules/react/**',
a65fae011bce4e2ca9a920b51a0fc681ee21c178
components/hoc/with-errors.js
components/hoc/with-errors.js
import React from 'react' import PropTypes from 'prop-types' import hoist from 'hoist-non-react-statics' import ErrorPage from '../../pages/_error' export default Page => { const Extended = hoist(class extends React.Component { static propTypes = { error: PropTypes.object } static defaultProps = { error: null } state = { error: null } componentDidCatch(error) { this.setState({ error }) } render() { const {error: stateError} = this.state const {error: propsError} = this.props const error = stateError || propsError if (error) { return ( <ErrorPage {...this.props} code={error.code} /> ) } return ( <Page {...this.props} /> ) } }, Page) if (Page.getInitialProps) { Extended.getInitialProps = async context => { try { return await Page.getInitialProps(context) } catch (error) { return { error } } } } return Extended }
import React from 'react' import PropTypes from 'prop-types' import hoist from 'hoist-non-react-statics' import ErrorPage from '../../pages/_error' export default Page => { const Extended = hoist(class extends React.Component { static propTypes = { error: PropTypes.object } static defaultProps = { error: null } state = { error: null } componentDidCatch(error) { this.setState({ error }) } render() { const {error: stateError} = this.state const {error: propsError} = this.props const error = stateError || propsError if (error) { return ( <ErrorPage {...this.props} code={error.code} /> ) } return ( <Page {...this.props} /> ) } }, Page) Extended.getInitialProps = async context => { if (Page.getInitialProps) { try { return await Page.getInitialProps(context) } catch (error) { if (context.res) { context.res.statusCode = error.code || 500 } return { error } } } return {} } return Extended }
Set server statusCode on error
Set server statusCode on error
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -42,16 +42,22 @@ } }, Page) - if (Page.getInitialProps) { - Extended.getInitialProps = async context => { + Extended.getInitialProps = async context => { + if (Page.getInitialProps) { try { return await Page.getInitialProps(context) } catch (error) { + if (context.res) { + context.res.statusCode = error.code || 500 + } + return { error } } } + + return {} } return Extended
29211d88af3f1820293637f23680a4f24656c32e
src/models/send-to-api.js
src/models/send-to-api.js
'use strict'; const { addOauthHeader } = require('@clevercloud/client/cjs/oauth.node.js'); const { prefixUrl } = require('@clevercloud/client/cjs/prefix-url.js'); const { request } = require('@clevercloud/client/cjs/request.request.js'); const { conf, loadOAuthConf } = require('../models/configuration.js'); async function sendToApi (requestParams) { const tokens = await loadOAuthConf().toPromise(); return Promise.resolve(requestParams) .then(prefixUrl(conf.API_HOST)) .then(addOauthHeader({ OAUTH_CONSUMER_KEY: conf.OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET: conf.OAUTH_CONSUMER_SECRET, API_OAUTH_TOKEN: tokens.token, API_OAUTH_TOKEN_SECRET: tokens.secret, })) .then(request); } async function getHostAndTokens () { const userTokens = await loadOAuthConf().toPromise(); return { apiHost: conf.API_HOST, tokens: { OAUTH_CONSUMER_KEY: conf.OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET: conf.OAUTH_CONSUMER_SECRET, API_OAUTH_TOKEN: userTokens.token, API_OAUTH_TOKEN_SECRET: userTokens.secret, }, }; } module.exports = { sendToApi, getHostAndTokens };
'use strict'; const { addOauthHeader } = require('@clevercloud/client/cjs/oauth.node.js'); const { prefixUrl } = require('@clevercloud/client/cjs/prefix-url.js'); const { request } = require('@clevercloud/client/cjs/request.superagent.js'); const { conf, loadOAuthConf } = require('../models/configuration.js'); async function sendToApi (requestParams) { const tokens = await loadOAuthConf().toPromise(); return Promise.resolve(requestParams) .then(prefixUrl(conf.API_HOST)) .then(addOauthHeader({ OAUTH_CONSUMER_KEY: conf.OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET: conf.OAUTH_CONSUMER_SECRET, API_OAUTH_TOKEN: tokens.token, API_OAUTH_TOKEN_SECRET: tokens.secret, })) .then(request); } async function getHostAndTokens () { const userTokens = await loadOAuthConf().toPromise(); return { apiHost: conf.API_HOST, tokens: { OAUTH_CONSUMER_KEY: conf.OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET: conf.OAUTH_CONSUMER_SECRET, API_OAUTH_TOKEN: userTokens.token, API_OAUTH_TOKEN_SECRET: userTokens.secret, }, }; } module.exports = { sendToApi, getHostAndTokens };
Use @clevercloud/client superagent helper instead of request
Use @clevercloud/client superagent helper instead of request
JavaScript
apache-2.0
CleverCloud/clever-tools,CleverCloud/clever-tools,CleverCloud/clever-tools
--- +++ @@ -2,7 +2,7 @@ const { addOauthHeader } = require('@clevercloud/client/cjs/oauth.node.js'); const { prefixUrl } = require('@clevercloud/client/cjs/prefix-url.js'); -const { request } = require('@clevercloud/client/cjs/request.request.js'); +const { request } = require('@clevercloud/client/cjs/request.superagent.js'); const { conf, loadOAuthConf } = require('../models/configuration.js'); async function sendToApi (requestParams) {
106c51e36add35f2b98bcf940c98363e707d2acb
public/javascripts/labelingGuidePanelResize.js
public/javascripts/labelingGuidePanelResize.js
function checkWindowSize(){ var w = document.documentElement.clientWidth; var panel = document.getElementById("help-panel"); if (w < 978) { panel.style.position = "static"; panel.style.width = "auto"; } else if (w >= 978 && w < 1184) { panel.style.position = "fixed"; panel.style.width = "250px"; unfix(); } else { panel.style.position = "fixed"; panel.style.width = "275px"; unfix(); } } function unfix() { if (document.readyState === "complete") { var panel = document.getElementById("help-panel"); if (panel.style.position !== "static") { var panelRect = panel.getBoundingClientRect(); var yOffset = document.body.clientHeight - 600 - panelRect.height - 95; if (window.pageYOffset > yOffset) { panel.style.top = "" + yOffset + "px"; panel.style.position = "absolute"; } else if (window.pageYOffset < yOffset) { panel.style.top = "95px"; panel.style.position = "fixed"; } } } } window.addEventListener("resize", checkWindowSize); window.addEventListener("scroll", unfix); $(document).ready(function() { checkWindowSize(); });
function checkWindowSize(){ var w = document.documentElement.clientWidth; var panel = document.getElementById("help-panel"); if (w < 978) { panel.style.position = "static"; panel.style.width = "auto"; } else if (w >= 978 && w < 1184) { panel.style.position = "fixed"; panel.style.width = "250px"; unfix(); } else { panel.style.position = "fixed"; panel.style.width = "275px"; unfix(); } } function unfix() { if (document.readyState === "complete") { var panel = document.getElementById("help-panel"); if (panel.style.position !== "static") { var panelRect = panel.getBoundingClientRect(); var yOffset = document.body.clientHeight - 600 - panelRect.height - 95; if (window.pageYOffset > yOffset) { panel.style.top = "" + yOffset + "px"; panel.style.position = "absolute"; } else if (window.pageYOffset < yOffset) { panel.style.top = "95px"; panel.style.position = "fixed"; } } } } window.addEventListener("resize", checkWindowSize); window.addEventListener("scroll", unfix); $(document).ready(function() { checkWindowSize(); });
Add newline to end of file
Add newline to end of file
JavaScript
mit
ProjectSidewalk/SidewalkWebpage,ProjectSidewalk/SidewalkWebpage,ProjectSidewalk/SidewalkWebpage,ProjectSidewalk/SidewalkWebpage,ProjectSidewalk/SidewalkWebpage,ProjectSidewalk/SidewalkWebpage
870c1e1c0b1fa98430331689da51fb15c563895a
test/unitSpecs/commonSpec.js
test/unitSpecs/commonSpec.js
/** * Created by rgwozdz on 8/15/15. */ var moduleUnderTest = require("../../app/common.js") var assert = require('chai').assert; var equal = require('deep-equal'); describe('common.js module', function() { describe('parseQueryOptions', function () { it('should return expected Object with properties and values', function () { var result = moduleUnderTest.parseQueryOptions({fields:'a,b', limit: 2, order_by: 'a,b', order:'DESC', returnGeom:'false'},'a,b,c', { geometryColumn: null }); var expectedResult = { columns: 'a,b', geometryColumn: null, limit: 'LIMIT 2', order_by: 'ORDER BY a,b' }; assert.equal(equal(result,expectedResult), true); }); it('should return expected Object with properties and values', function () { var result = moduleUnderTest.parseQueryOptions({},'a,b,c', { columns: 'a,b,c', geometryColumn: 'geom'}); var expectedResult = { columns: 'a,b,c', geometryColumn: null }; assert.equal(equal(result,expectedResult), true); }); }); });
/** * Created by rgwozdz on 8/15/15. */ var moduleUnderTest = require("../../app/common.js") var assert = require('chai').assert; var equal = require('deep-equal'); describe('common.js module', function() { describe('parseQueryOptions', function () { it('should return expected Object with properties and values', function () { var result = moduleUnderTest.parseQueryOptions({fields:'a,b', limit: 2, order_by: 'a,b', order:'DESC', returnGeom:'false'},'a,b,c', { geometryColumn: null }); var expectedResult = { columns: 'a,b', geometryColumn: null, limit: 'LIMIT 2', order_by: 'ORDER BY a,b DESC' }; assert.equal(equal(result,expectedResult), true); }); it('should return expected Object with properties and values', function () { var result = moduleUnderTest.parseQueryOptions({},'a,b,c', { columns: 'a,b,c', geometryColumn: 'geom'}); var expectedResult = { columns: 'a,b,c', geometryColumn: null }; assert.equal(equal(result,expectedResult), true); }); }); });
Adjust unit test expected result.
Adjust unit test expected result.
JavaScript
apache-2.0
Cadasta/cadasta-api,Cadasta/cadasta-api,Cadasta/cadasta-api
--- +++ @@ -17,7 +17,7 @@ columns: 'a,b', geometryColumn: null, limit: 'LIMIT 2', - order_by: 'ORDER BY a,b' + order_by: 'ORDER BY a,b DESC' }; assert.equal(equal(result,expectedResult), true);
d6a80dc1d374a88d771c3bd7aad0cad91c67bd03
core/server/api/sandstorm.js
core/server/api/sandstorm.js
// # Sandstorm API // RESTful API for the Sandstorm resource var capnp = require('capnp'), url = require('url'), sandstorm; var HackSession = capnp.importSystem("hack-session.capnp"); var publicIdPromise; var initPromise = function () { if (!publicIdPromise) { var connection = capnp.connect("unix:/tmp/sandstorm-api"); var session = connection.restore("HackSessionContext", HackSession.HackSessionContext); publicIdPromise = session.getPublicId(); publicIdPromise.tap = function () { return publicIdPromise; }; } }; sandstorm = { /** * ## live * Return link to live site * @param {{context}} options (optional) * @returns hash containing url */ live: function browse() { initPromise(); var promise = publicIdPromise.then(function (data) { return {url: data.autoUrl}; }); promise.tap = function () { return promise; }; return promise; }, /** * ## faq * Return data for faq page * @param {{context}} options (optional) * @returns hash of relevant data */ faq: function browse() { initPromise(); var promise = publicIdPromise.then(function (data) { data.autoUrl = url.parse(data.autoUrl).host; return data; }); promise.tap = function () { return promise; }; return promise; }, }; module.exports = sandstorm;
// # Sandstorm API // RESTful API for the Sandstorm resource var capnp = require('capnp'), url = require('url'), _ = require('lodash'), sandstorm; var HackSession = capnp.importSystem("hack-session.capnp"); var publicIdPromise; var initPromise = function () { if (!publicIdPromise) { var connection = capnp.connect("unix:/tmp/sandstorm-api"); var session = connection.restore("HackSessionContext", HackSession.HackSessionContext); publicIdPromise = session.getPublicId(); publicIdPromise.tap = function () { return publicIdPromise; }; } }; sandstorm = { /** * ## live * Return link to live site * @param {{context}} options (optional) * @returns hash containing url */ live: function browse() { initPromise(); var promise = publicIdPromise.then(function (data) { return {url: data.autoUrl}; }); promise.tap = function () { return promise; }; return promise; }, /** * ## faq * Return data for faq page * @param {{context}} options (optional) * @returns hash of relevant data */ faq: function browse() { initPromise(); var promise = publicIdPromise.then(function (data) { var ret = _.clone(data); ret.autoUrl = url.parse(ret.autoUrl).host; return ret; }); promise.tap = function () { return promise; }; return promise; }, }; module.exports = sandstorm;
Fix bug in returning autoUrl for Sandstorm
Fix bug in returning autoUrl for Sandstorm
JavaScript
mit
jparyani/GhostSS,jparyani/GhostSS,jparyani/GhostSS
--- +++ @@ -2,6 +2,7 @@ // RESTful API for the Sandstorm resource var capnp = require('capnp'), url = require('url'), + _ = require('lodash'), sandstorm; var HackSession = capnp.importSystem("hack-session.capnp"); @@ -47,8 +48,9 @@ faq: function browse() { initPromise(); var promise = publicIdPromise.then(function (data) { - data.autoUrl = url.parse(data.autoUrl).host; - return data; + var ret = _.clone(data); + ret.autoUrl = url.parse(ret.autoUrl).host; + return ret; }); promise.tap = function () { return promise;
f95b32c8678ca2814dca9b502a7bb592fb287c24
web/static/js/reducers/idea.js
web/static/js/reducers/idea.js
const idea = (state = [], action) => { switch (action.type) { case "SET_IDEAS": return action.ideas case "ADD_IDEA": return [...state, action.idea] case "UPDATE_IDEA": return state.map(idea => { return (idea.id === action.ideaId) ? Object.assign({}, idea, action.newAttributes) : idea }) case "DELETE_IDEA": return state.filter(idea => idea.id !== action.ideaId) default: return state } } export default idea
const idea = (state = [], action) => { switch (action.type) { case "SET_IDEAS": return action.ideas case "ADD_IDEA": return [...state, action.idea] case "UPDATE_IDEA": return state.map(idea => { return (idea.id === action.ideaId) ? { ...idea, ...action.newAttributes } : idea }) case "DELETE_IDEA": return state.filter(idea => idea.id !== action.ideaId) default: return state } } export default idea
Use spread operator rather than Object.assign
Use spread operator rather than Object.assign
JavaScript
mit
stride-nyc/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,tnewell5/remote_retro
--- +++ @@ -6,7 +6,7 @@ return [...state, action.idea] case "UPDATE_IDEA": return state.map(idea => { - return (idea.id === action.ideaId) ? Object.assign({}, idea, action.newAttributes) : idea + return (idea.id === action.ideaId) ? { ...idea, ...action.newAttributes } : idea }) case "DELETE_IDEA": return state.filter(idea => idea.id !== action.ideaId)
34049a1d776a4bb7c9b397fee63da30faa2bc30b
api/actions/boardgames/loadFromBGG.js
api/actions/boardgames/loadFromBGG.js
import request from 'request'; import { parseString } from 'xml2js'; export default function loadFromBGG(req) { return new Promise((resolve, reject) => { request({ url: `http://www.boardgamegeek.com/xmlapi2/search?query=${req.query.q}&type=boardgame`, timeout: 10000 }, (error, response, body) => { if (error) reject(error); parseString(body, (err, res) => { if (err) reject(err); if (Array.isArray(res.items.item)) { resolve(res.items.item .map((el) => { return { bggid: el.$.id, type: el.$.type, name: el.name[0].$.value, year: el.yearpublished ? Number(el.yearpublished[0].$.value) : 0 }; }) .filter((el) => { return el.type === 'boardgame'; }) .sort((prev, current) => { return current.year - prev.year; })); } else { resolve([]); } }); }); }); }
import request from 'request'; import { parseString } from 'xml2js'; export default function loadFromBGG(req) { return new Promise((resolve, reject) => { request({ url: `http://www.boardgamegeek.com/xmlapi2/search?query=${req.query.q}&type=boardgame`, timeout: 10000 }, (error, response, body) => { if (error) reject(error); parseString(body, (err, res) => { if (err) reject(err); if (Array.isArray(res.items.item)) { resolve(res.items.item .map((el) => { return { bggid: el.$.id, type: el.$.type, name: el.name[0].$.value, year: el.yearpublished ? Number(el.yearpublished[0].$.value) : 0 }; }) .filter((el) => { return el.type === 'boardgame'; }) .sort((prev, current) => { // TODO: Should the items be sorted by year? // return current.year - prev.year; })); } else { resolve([]); } }); }); }); }
Comment out sorting function for now
Comment out sorting function for now
JavaScript
mit
fuczak/pipsy
--- +++ @@ -24,7 +24,8 @@ return el.type === 'boardgame'; }) .sort((prev, current) => { - return current.year - prev.year; + // TODO: Should the items be sorted by year? + // return current.year - prev.year; })); } else { resolve([]);
35ad895d4885e3caf9cc7c3073c78bd2c13ad32d
samples/VanillaJSTestApp/app/b2c/authConfig.js
samples/VanillaJSTestApp/app/b2c/authConfig.js
// Config object to be passed to Msal on creation const msalConfig = { auth: { clientId: "e760cab2-b9a1-4c0d-86fb-ff7084abd902", authority: "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_susi", knownAuthorities: ["fabrikamb2c.b2clogin.com"] }, cache: { cacheLocation: "localStorage", // This configures where your cache will be stored storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge }, system: { telemetry: { applicationName: 'msalVanillaTestApp', applicationVersion: 'test1.0', telemetryEmitter: (events) => { console.log("Telemetry Events", events); } } } }; // Add here scopes for id token to be used at MS Identity Platform endpoints. const loginRequest = { scopes: ["https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read"], forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }; const editProfileRequest = { scopes: ["openid"], authority: "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_edit_profile", forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }
// Config object to be passed to Msal on creation const msalConfig = { auth: { clientId: "5dac5d6d-225c-4a98-a5e4-e29c82c0c4c9", authority: "https://public.msidlabb2c.com/tfp/cpimtestpartners.onmicrosoft.com/b2c_1_signupsignin_userflow", knownAuthorities: ["public.msidlabb2c.com"] }, cache: { cacheLocation: "localStorage", // This configures where your cache will be stored storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge }, system: { telemetry: { applicationName: 'msalVanillaTestApp', applicationVersion: 'test1.0', telemetryEmitter: (events) => { console.log("Telemetry Events", events); } } } }; // Add here scopes for id token to be used at MS Identity Platform endpoints. const loginRequest = { scopes: ["openid", "profile"], forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }; const editProfileRequest = { scopes: ["openid"], authority: "https://public.msidlabb2c.com/tfp/cpimtestpartners.onmicrosoft.com/b2c_1_editprofile_userflow", forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }
Update with lab app registration
Update with lab app registration
JavaScript
mit
AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js
--- +++ @@ -1,9 +1,9 @@ // Config object to be passed to Msal on creation const msalConfig = { auth: { - clientId: "e760cab2-b9a1-4c0d-86fb-ff7084abd902", - authority: "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_susi", - knownAuthorities: ["fabrikamb2c.b2clogin.com"] + clientId: "5dac5d6d-225c-4a98-a5e4-e29c82c0c4c9", + authority: "https://public.msidlabb2c.com/tfp/cpimtestpartners.onmicrosoft.com/b2c_1_signupsignin_userflow", + knownAuthorities: ["public.msidlabb2c.com"] }, cache: { cacheLocation: "localStorage", // This configures where your cache will be stored @@ -22,12 +22,12 @@ // Add here scopes for id token to be used at MS Identity Platform endpoints. const loginRequest = { - scopes: ["https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read"], + scopes: ["openid", "profile"], forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }; const editProfileRequest = { scopes: ["openid"], - authority: "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_edit_profile", + authority: "https://public.msidlabb2c.com/tfp/cpimtestpartners.onmicrosoft.com/b2c_1_editprofile_userflow", forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token }
109da2da9a35318d59060400833d4378c7622b6f
app/assets/javascripts/application.js
app/assets/javascripts/application.js
/* global $ */ /* global GOVUK */ // Warn about using the kit in production if ( window.sessionStorage && window.sessionStorage.getItem('prototypeWarning') !== 'false' && window.console && window.console.info ) { window.console.info('GOV.UK Prototype Kit - do not use for production') window.sessionStorage.setItem('prototypeWarning', true) } $(document).ready(function () { // Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button, // with role="button" when the space key is pressed. GOVUK.shimLinksWithButtonRole.init() // Show and hide toggled content // Where .multiple-choice uses the data-target attribute // to toggle hidden content var showHideContent = new GOVUK.ShowHideContent() showHideContent.init() })
/* global $ */ /* global GOVUK */ // Warn about using the kit in production if (window.console && window.console.info) { window.console.info('GOV.UK Prototype Kit - do not use for production') } $(document).ready(function () { // Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button, // with role="button" when the space key is pressed. GOVUK.shimLinksWithButtonRole.init() // Show and hide toggled content // Where .multiple-choice uses the data-target attribute // to toggle hidden content var showHideContent = new GOVUK.ShowHideContent() showHideContent.init() })
Fix JS error in Safari’s Private Browsing mode
Fix JS error in Safari’s Private Browsing mode Safari in Private Browsing mode sets a session storage quota of 0 which means that attempts to write to it result in a QuotaExceededError being thrown, breaking JavaScript on the rest of the page. The existing code is flawed in that it sets `prototypeWarning` to true but tests for 'false', so the warning is already shown on every page anyway. As such, this simplifies it to remove the use of session storage entirely.
JavaScript
mit
dwpdigitaltech/hrt-prototype,gavinwye/govuk_prototype_kit,dwpdigitaltech/hrt-prototype,joelanman/govuk_prototype_kit,benjeffreys/hmcts-idam-proto,joelanman/govuk_prototype_kit,benjeffreys/hmcts-idam-proto,alphagov/govuk_prototype_kit,alphagov/govuk_prototype_kit,hannalaakso/accessible-timeout-warning,joelanman/govuk_prototype_kit,DilwoarH/GDS-Prototype-DM-SavedSearch,hannalaakso/accessible-timeout-warning,DilwoarH/GDS-Prototype-DM-SavedSearch,DilwoarH/GDS-Prototype-DM-SavedSearch,dwpdigitaltech/hrt-prototype,alphagov/govuk_prototype_kit,hannalaakso/accessible-timeout-warning,gavinwye/govuk_prototype_kit,benjeffreys/hmcts-idam-proto
--- +++ @@ -2,12 +2,8 @@ /* global GOVUK */ // Warn about using the kit in production -if ( - window.sessionStorage && window.sessionStorage.getItem('prototypeWarning') !== 'false' && - window.console && window.console.info -) { +if (window.console && window.console.info) { window.console.info('GOV.UK Prototype Kit - do not use for production') - window.sessionStorage.setItem('prototypeWarning', true) } $(document).ready(function () {
3d782cc9f93ae645ef9eb4f8fafbf57117aa111c
lib/init.js
lib/init.js
var _ = require('lodash'); module.exports = function(grunt) { var module = {}; module.domain = function() { return process.env.GRUNT_DRUPAL_DOMAIN || grunt.config('config.domain') || require('os').hostname(); }; // Ensure a default URL for the project. module.siteUrls = function() { return grunt.config('config.siteUrls.default') || "http://<%= config.domain %>"; } module.buildPaths = function() { // Set implicit global configuration. var buildPaths = grunt.config('config.buildPaths'); buildPaths = _.extend({ build: 'build', html: 'build/html', package: 'build/packages', reports: 'build/reports', temp: 'build/temp' }, buildPaths); return buildPaths; } module.init = function() { if (grunt.config('config.siteUrls') === undefined) grunt.config('config.siteUrls', {}); grunt.config('config.domain', module.domain()); grunt.config('config.siteUrls.default', module.siteUrls(defaultUrl)); grunt.config('config.buildPaths', module.buildPaths()); }; return module; };
var _ = require('lodash'); module.exports = function(grunt) { var module = {}; module.domain = function() { return process.env.GRUNT_DRUPAL_DOMAIN || grunt.config('config.domain') || require('os').hostname(); }; // Ensure a default URL for the project. module.siteUrls = function() { return grunt.config('config.siteUrls.default') || "http://<%= config.domain %>"; } module.buildPaths = function() { // Set implicit global configuration. var buildPaths = grunt.config('config.buildPaths'); buildPaths = _.extend({ build: 'build', html: 'build/html', package: 'build/packages', reports: 'build/reports', temp: 'build/temp' }, buildPaths); return buildPaths; } module.init = function() { if (grunt.config('config.siteUrls') === undefined) grunt.config('config.siteUrls', {}); grunt.config('config.domain', module.domain()); grunt.config('config.siteUrls.default', module.siteUrls()); grunt.config('config.buildPaths', module.buildPaths()); }; return module; };
Remove stray variable breaking defaultUrl calculation.
Remove stray variable breaking defaultUrl calculation.
JavaScript
mit
AndBicScadMedia/grunt-drupal-tasks,EvanLovely/grunt-drupal-tasks,phase2/grunt-drupal-tasks,EvanLovely/grunt-drupal-tasks,AndBicScadMedia/grunt-drupal-tasks,phase2/grunt-drupal-tasks,EvanLovely/grunt-drupal-tasks,phase2/grunt-drupal-tasks,AndBicScadMedia/grunt-drupal-tasks,AndBicScadMedia/grunt-drupal-tasks,EvanLovely/grunt-drupal-tasks
--- +++ @@ -31,7 +31,7 @@ grunt.config('config.siteUrls', {}); grunt.config('config.domain', module.domain()); - grunt.config('config.siteUrls.default', module.siteUrls(defaultUrl)); + grunt.config('config.siteUrls.default', module.siteUrls()); grunt.config('config.buildPaths', module.buildPaths()); };
980fc6cfc3702645eafd18dc46d9a399ca7fb3ad
lib/mime.js
lib/mime.js
/*! * YUI Mocha * Copyright 2011 Yahoo! Inc. * Licensed under the BSD license. */ /** * @module mime */ /** * File extension to MIME type map. * * Used by `serve.js` when streaming files from disk. * * @property contentTypes * @type object */ this.contentTypes = { "css": "text/css", "html": "text/html", "ico": "image/vnd.microsoft.icon", "jpeg": "image/jpeg", "jpg": "image/jpeg", "js": "application/javascript", "json": "application/json", "less": "text/css", "png": "image/png", "svg": "image/svg+xml", "swf": "application/x-shockwave-flash", "tiff": "image/tiff", "txt": "text/plain", "xml": "text/xml" };
/*! * YUI Mocha * Copyright 2011 Yahoo! Inc. * Licensed under the BSD license. */ /** * @module mime */ /** * File extension to MIME type map. * * Used by `serve.js` when streaming files from disk. * * @property contentTypes * @type object */ this.contentTypes = { "css": "text/css", "html": "text/html", "ico": "image/vnd.microsoft.icon", "jpeg": "image/jpeg", "jpg": "image/jpeg", "js": "application/javascript", "json": "application/json", "less": "text/css", "png": "image/png", "svg": "image/svg+xml", "swf": "application/x-shockwave-flash", "tiff": "image/tiff", "txt": "text/plain", "xml": "application/xml" };
Use same .xml MIME type as rgrove/combohandler.
Use same .xml MIME type as rgrove/combohandler.
JavaScript
bsd-3-clause
reid/onyx,reid/onyx
--- +++ @@ -30,5 +30,5 @@ "swf": "application/x-shockwave-flash", "tiff": "image/tiff", "txt": "text/plain", - "xml": "text/xml" + "xml": "application/xml" };
1b3faf12cf97bc2a534c941a59ac026ab49e0565
src/numbers.js
src/numbers.js
'use strict'; /** * * @param {integer } digit * @returns {string} Returns Nepali converted string of given digit or numbers. * @example * * numbers(2090873) * // => २०९०८७३ * * numbers() * // => false * */ function numbers (digit) { if(!digit) { console.log("@numbers: Yuck, got nothing"); return false; } if(isNaN(parseInt(digit, 10))) { console.log("@numbers: Commooon, give it a numbers"); return false; } const nepaliNumberss = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९']; const digitToConvert = digit.toString().split(''); const output = digitToConvert.map(num => { let i = 0; const l = parseInt(num, 10); for (i; i < 10; i += 1) { if (i === l) { return nepaliNumberss[i]; } } }); return output.join(''); } export default numbers;
'use strict'; /** * * @param {integer } digit * @returns {string} Returns Nepali converted string of given digit or numbers. * @example * * numbers(2090873) * // => २०९०८७३ * * numbers() * // => false * */ function numbers (digit) { const isdigit = parseInt(digit, 10); if(typeof isdigit !== "number") { console.log("@numbers: Yuck, got nothing"); return false; } if(isNaN(isdigit)) { console.log("@numbers: Commooon, give it a numbers"); return false; } const nepaliNumberss = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९']; const digitToConvert = digit.toString().split(''); const output = digitToConvert.map(num => { let i = 0; const l = parseInt(num, 10); for (i; i < 10; i += 1) { if (i === l) { return nepaliNumberss[i]; } } }); return output.join(''); } export default numbers;
Check typeof of given value
Check typeof of given value
JavaScript
mit
shekhardesigner/NepaliDateConverter
--- +++ @@ -15,12 +15,13 @@ function numbers (digit) { - if(!digit) { + const isdigit = parseInt(digit, 10); + if(typeof isdigit !== "number") { console.log("@numbers: Yuck, got nothing"); return false; } - if(isNaN(parseInt(digit, 10))) { + if(isNaN(isdigit)) { console.log("@numbers: Commooon, give it a numbers"); return false; }
452ff1c3ce7ae04695f640b8b4e642f724d6be55
lib/util.js
lib/util.js
'use strict'; /** * Retrieve a localized configuration value or the default if the localization * is unavailable. * * @param {String} configuration value * @param {String} language * @param {Object} Hexo configuration object * @param {String} Hexo locals object * @returns {*} localized or default configuration value */ exports._c = function _c(value, lang, config, locals) { if (locals.data['config_' + lang] != null) { return retrieveItem(locals.data['config_' + lang], value) || retrieveItem(config, value); } return retrieveItem(config, value); }; /** * Retrieve nested item from object/array (http://stackoverflow.com/a/16190716) * @param {Object|Array} obj * @param {String} path dot separated * @param {*} def default value ( if result undefined ) * @returns {*} */ function retrieveItem(obj, path, def) { var i, len; for (i = 0, path = path.split('.'), len = path.length; i < len; i++) { if (!obj || typeof obj !== 'object') return def; obj = obj[path[i]]; } if (obj === undefined) return def; return obj; }
'use strict'; /** * Retrieve a localized configuration value or the default if the localization * is unavailable. * * @param {String} configuration value * @param {String} language * @param {Object} Hexo configuration object * @param {String} Hexo locals object * @returns {*} localized or default configuration value */ exports._c = function _c(value, lang, config, locals) { if (locals.data['config_' + lang] != null) { var localized = retrieveItem(locals.data['config_' + lang], value) return localized != undefined ? localized : retrieveItem(config, value); } return retrieveItem(config, value); }; /** * Retrieve nested item from object/array (http://stackoverflow.com/a/16190716) * @param {Object|Array} obj * @param {String} path dot separated * @param {*} def default value ( if result undefined ) * @returns {*} */ function retrieveItem(obj, path, def) { var i, len; for (i = 0, path = path.split('.'), len = path.length; i < len; i++) { if (!obj || typeof obj !== 'object') return def; obj = obj[path[i]]; } if (obj === undefined) return def; return obj; }
Check for undefined localized values
Check for undefined localized values Fixes #2.
JavaScript
mit
ahaasler/hexo-multilingual
--- +++ @@ -12,7 +12,8 @@ */ exports._c = function _c(value, lang, config, locals) { if (locals.data['config_' + lang] != null) { - return retrieveItem(locals.data['config_' + lang], value) || retrieveItem(config, value); + var localized = retrieveItem(locals.data['config_' + lang], value) + return localized != undefined ? localized : retrieveItem(config, value); } return retrieveItem(config, value); };
3984d6e214a81837361a3a65a405b84344b54120
app/modules/main/directives/Header.js
app/modules/main/directives/Header.js
'use strict'; header.$inject = ['$rootScope', '$state', 'AuthService']; function header($rootScope, $state, AuthService) { return { name: 'header', template: require('./templates/header.html'), scope: true, link: function link(scope) { scope.toggled = false; scope.toggleNav = toggleNav; scope.logout = logout; $rootScope.$on('$stateChangeSuccess', function() { scope.toggled = false; scope.isAuthenticated = AuthService.isAuthenticated; }); function toggleNav() { scope.toggled = !scope.toggled; } function logout() { AuthService.logout(); $state.go('home'); } } }; } module.exports = header;
'use strict'; header.$inject = ['$rootScope', '$state', 'AuthService']; function header($rootScope, $state, AuthService) { return { name: 'header', template: require('./templates/header.html'), scope: true, link: function link(scope) { scope.toggled = false; scope.toggleNav = toggleNav; scope.logout = logout; $rootScope.$on('$stateChangeSuccess', function() { scope.toggled = false; scope.isAuthenticated = AuthService.isAuthenticated; }); function toggleNav() { scope.toggled = !scope.toggled; } function logout() { AuthService.logout(); $state.go('home', {}, {reload: true}); } } }; } module.exports = header;
Set logout button to reload state if current state is 'home'
Set logout button to reload state if current state is 'home'
JavaScript
mit
zdizzle6717/hapi-angular-stack,zdizzle6717/hapi-angular-stack
--- +++ @@ -22,7 +22,7 @@ function logout() { AuthService.logout(); - $state.go('home'); + $state.go('home', {}, {reload: true}); } } };
1ef82c281c5df2ded7dd4f1954fc0beb34e53899
tasks/sismd.js
tasks/sismd.js
/* task for generating html from sisdocs markdown */ module.exports = function(grunt) { 'use strict'; var marked = require('marked'); var hljs = require('highlight.js'); marked.setOptions({ breaks : true, highlight: function(code, lang) { var result = hljs.highlight(lang, code).value; return result; } }); grunt.registerMultiTask('sismd', "Converts SIS-web markdown to html", function() { var options = this.options({ }); this.files.forEach(function(file) { var data = file.src.filter(function(path) { if (!grunt.file.isFile(path)) { grunt.log.warn("File does not exist. %s", source); return false; } return true; }).map(function(path) { return grunt.file.read(path); }).join("\n"); var dest = file.dest; if (options.preprocess) { data = options.preprocess(data); } var output = marked(data); grunt.file.write(dest, output); }); }); };
/* task for generating html from sisdocs markdown */ module.exports = function(grunt) { 'use strict'; var marked = require('marked'); var hljs = require('highlight.js'); var renderer = new marked.Renderer(); var oldLink = renderer.link; renderer.link = function(href, title, text) { if (href[0] === '#' && text.indexOf('.') !== -1) { href = '#' + text.replace(/[^\w:]/g, '-').toLowerCase(); } return oldLink.call(this, href, title, text); }; marked.setOptions({ breaks : true, highlight: function(code, lang) { var result = hljs.highlight(lang, code).value; return result; }, renderer : renderer }); grunt.registerMultiTask('sismd', "Converts SIS-web markdown to html", function() { var options = this.options({ }); this.files.forEach(function(file) { var data = file.src.filter(function(path) { if (!grunt.file.isFile(path)) { grunt.log.warn("File does not exist. %s", source); return false; } return true; }).map(function(path) { return grunt.file.read(path); }).join("\n"); var dest = file.dest; if (options.preprocess) { data = options.preprocess(data); } var output = marked(data); grunt.file.write(dest, output); }); }); };
Fix a bug in documentation generation
Fix a bug in documentation generation
JavaScript
bsd-3-clause
sis-cmdb/sis-ui,sis-cmdb/sis-ui
--- +++ @@ -3,12 +3,23 @@ 'use strict'; var marked = require('marked'); var hljs = require('highlight.js'); + var renderer = new marked.Renderer(); + + var oldLink = renderer.link; + renderer.link = function(href, title, text) { + if (href[0] === '#' && text.indexOf('.') !== -1) { + href = '#' + text.replace(/[^\w:]/g, '-').toLowerCase(); + } + return oldLink.call(this, href, title, text); + }; + marked.setOptions({ breaks : true, highlight: function(code, lang) { var result = hljs.highlight(lang, code).value; return result; - } + }, + renderer : renderer }); grunt.registerMultiTask('sismd', "Converts SIS-web markdown to html", function() {
ad25532c3601d23df11a23b8295cfc753a79e2ec
spec/javascripts/fixtures/educatorsViewJson.js
spec/javascripts/fixtures/educatorsViewJson.js
export default { "id": 101, "email": "hugo@demo.studentinsights.org", "admin": false, "full_name": "Teacher, Hugo", "staff_type": null, "schoolwide_access": false, "grade_level_access": [], "restricted_to_sped_students": false, "restricted_to_english_language_learners": false, "can_view_restricted_notes": false, "districtwide_access": false, "labels": [], "school": { "id": 9, "name": "Somerville High" }, "sections": [ { "id": 3, "section_number": "ART-302A", "course_description": "Ceramic Art 3" }, { "id": 4, "section_number": "ART-302B", "course_description": "Ceramic Art 3" } ], "labels": [] };
export default { "id": 101, "email": "hugo@demo.studentinsights.org", "admin": false, "full_name": "Teacher, Hugo", "staff_type": null, "schoolwide_access": false, "grade_level_access": [], "restricted_to_sped_students": false, "restricted_to_english_language_learners": false, "can_view_restricted_notes": false, "districtwide_access": false, "school": { "id": 9, "name": "Somerville High" }, "sections": [ { "id": 3, "section_number": "ART-302A", "course_description": "Ceramic Art 3" }, { "id": 4, "section_number": "ART-302B", "course_description": "Ceramic Art 3" } ], "labels": [] };
Fix lint error in JS fixture
Fix lint error in JS fixture
JavaScript
mit
studentinsights/studentinsights,studentinsights/studentinsights,studentinsights/studentinsights,studentinsights/studentinsights
--- +++ @@ -10,7 +10,6 @@ "restricted_to_english_language_learners": false, "can_view_restricted_notes": false, "districtwide_access": false, - "labels": [], "school": { "id": 9, "name": "Somerville High"
cbec8ddeaa98e7510e2616f18f64df8340dd97e0
src/item-button.js
src/item-button.js
import { select } from 'd3'; import Item from './item'; export default class ButtonItem extends Item { constructor() { super(); this._root .classed('button', true) .styles({ 'background': '#FFF', 'cursor': 'pointer', 'height': '3em', 'justify-content': 'center' }); this._text = this._root .append('button') .attrs({ 'tabindex': -1, 'type': 'button' }) .styles({ 'background': 'none', 'border': '1px solid transparent', 'color': 'inherit', 'cursor': 'inherit', 'line-height': '2em', 'margin': 0, 'padding': '0 0.25em' }); this._padding.styles({ 'display': 'none' }); } tabindex(value = null) { if (value === null) { return this._text.attr('tabindex'); } this._text.attr('tabindex', value); return this; } text(value = null) { if (value === null) { return this._text; } this._text.text(value); return this; } _click() { if (this._disabled === false && this._model) { this._model.set(this._name, this._value); } } }
import Item from './item'; export default class ButtonItem extends Item { constructor() { super(); this._root .classed('button', true) .styles({ 'background': '#FFF', 'cursor': 'pointer', 'height': '3em', 'justify-content': 'center', 'padding': '0.5em 0' }); this._text = this._root .append('button') .attrs({ 'tabindex': -1, 'type': 'button' }) .styles({ 'background': 'none', 'border': '1px solid transparent', 'color': 'inherit', 'cursor': 'inherit', 'line-height': '2em', 'margin': 0, 'padding': '0 0.25em' }); this._padding.styles({ 'display': 'none' }); } tabindex(value = null) { if (value === null) { return this._text.attr('tabindex'); } this._text.attr('tabindex', value); return this; } text(value = null) { if (value === null) { return this._text; } this._text.text(value); return this; } _click() { if (this._disabled === false && this._model) { this._model.set(this._name, this._value); } } }
Add padding to button item
Add padding to button item
JavaScript
mit
scola84/node-d3-list
--- +++ @@ -1,4 +1,3 @@ -import { select } from 'd3'; import Item from './item'; export default class ButtonItem extends Item { @@ -11,7 +10,8 @@ 'background': '#FFF', 'cursor': 'pointer', 'height': '3em', - 'justify-content': 'center' + 'justify-content': 'center', + 'padding': '0.5em 0' }); this._text = this._root
e0b595bb8e631c29add7d486db9dc84285bab3f3
public/js/admin.js
public/js/admin.js
window.admin = {}; $(document).ready(function() { $("#admin-feedback").on("tabOpened", function() { window.api.get("admin/feedback/getList", function(resp) { $("#admin-feedback-list").text(""); for (var feedbackIndex in resp.feedback) { var feedbackItem = resp.feedback[feedbackIndex]; var $feedbackLi = $('<li></li>'); var $feedbackDesc = $('<div></div>'); $feedbackDesc.text(" #" + feedbackItem.feedbackId + " " + feedbackItem.msg); var $icon = $('<i class="fa"></i>'); if (feedbackItem.type == "smile") { $icon.addClass("fa-smile-o"); } else if (feedbackItem.type == "frown") { $icon.addClass("fa-frown-o"); } else if (feedbackItem.type == "idea") { $icon.addClass("fa-lightbulb-o"); } $feedbackDesc.prepend($icon); $feedbackLi.append($feedbackDesc); var $feedbackName = $('<div></div>'); $feedbackName.text(feedbackItem.name); $feedbackLi.append($feedbackName); $("#admin-feedback-list").append($feedbackLi); }; }); }); });
window.admin = {}; $(document).ready(function() { $("#admin-feedback").on("tabOpened", function() { window.api.get("admin/feedback/getList", function(resp) { $("#admin-feedback-list").text(""); for (var feedbackIndex in resp.feedback) { var feedbackItem = resp.feedback[feedbackIndex]; var $feedbackLi = $('<li></li>'); var $feedbackDesc = $('<div></div>'); $feedbackDesc.text(" #" + feedbackItem.feedbackId + " " + feedbackItem.msg); var $icon = $('<i class="fa"></i>'); if (feedbackItem.type == "smile") { $icon.addClass("fa-smile-o"); } else if (feedbackItem.type == "frown") { $icon.addClass("fa-frown-o"); } else if (feedbackItem.type == "idea") { $icon.addClass("fa-lightbulb-o"); } $feedbackDesc.prepend($icon); $feedbackLi.append($feedbackDesc); var $feedbackName = $('<div></div>'); $feedbackName.text(feedbackItem.name + " (" + feedbackItem.username + ")"); $feedbackLi.append($feedbackName); $("#admin-feedback-list").append($feedbackLi); }; }); }); });
Add username to feedback entries
Add username to feedback entries
JavaScript
mit
MyHomeworkSpace/MyHomeworkSpace,PlanHubMe/PlanHub,MyHomeworkSpace/MyHomeworkSpace,PlanHubMe/PlanHub,MyHomeworkSpace/MyHomeworkSpace
--- +++ @@ -20,7 +20,7 @@ $feedbackDesc.prepend($icon); $feedbackLi.append($feedbackDesc); var $feedbackName = $('<div></div>'); - $feedbackName.text(feedbackItem.name); + $feedbackName.text(feedbackItem.name + " (" + feedbackItem.username + ")"); $feedbackLi.append($feedbackName); $("#admin-feedback-list").append($feedbackLi); };
44d11c878d7085b3ec320041f3182156497be91b
src/tests/setup.js
src/tests/setup.js
import Enzyme from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import 'jest-enzyme'; // better matchers Enzyme.configure({ adapter: new Adapter(), });
import Enzyme from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import 'jest-enzyme'; // better matchers Enzyme.configure({ adapter: new Adapter(), }); if (process.env.CI) { // Hide all console output console.log = jest.fn(); console.warn = jest.fn(); console.error = jest.fn(); }
Disable console output in Travis
Disable console output in Travis
JavaScript
agpl-3.0
sMteX/WoWAnalyzer,fyruna/WoWAnalyzer,enragednuke/WoWAnalyzer,ronaldpereira/WoWAnalyzer,anom0ly/WoWAnalyzer,sMteX/WoWAnalyzer,Juko8/WoWAnalyzer,hasseboulen/WoWAnalyzer,FaideWW/WoWAnalyzer,yajinni/WoWAnalyzer,Juko8/WoWAnalyzer,hasseboulen/WoWAnalyzer,Juko8/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer,ronaldpereira/WoWAnalyzer,enragednuke/WoWAnalyzer,anom0ly/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,fyruna/WoWAnalyzer,hasseboulen/WoWAnalyzer,yajinni/WoWAnalyzer,FaideWW/WoWAnalyzer,enragednuke/WoWAnalyzer,anom0ly/WoWAnalyzer,ronaldpereira/WoWAnalyzer,FaideWW/WoWAnalyzer,yajinni/WoWAnalyzer,fyruna/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer
--- +++ @@ -5,3 +5,10 @@ Enzyme.configure({ adapter: new Adapter(), }); + +if (process.env.CI) { + // Hide all console output + console.log = jest.fn(); + console.warn = jest.fn(); + console.error = jest.fn(); +}
22098b256358982f8a845b05242465db33edd008
src/utils/fetch.js
src/utils/fetch.js
/** * Fetch module. * @module base/utils/fetch */ import fetchJsonP from 'fetch-jsonp' export var defaultOptions = { credentials: 'same-origin' } export var defaultJsonpOptions = { timeout: 5000, jsonpCallback: 'callback', jsonpCallbackFunction: null } export function checkStatus(response) { if (response.status >= 200 && response.status < 300) { return response } else { var error = new Error(response.statusText) error.response = response throw error } } export function url(u, opts = {}) { opts = Object.assign({}, defaultOptions, opts) return fetch(u, opts).then(checkStatus) } export function json(u, opts = {}) { return url(u, opts).then(r => r.json()) } export function jsonP(u, opts = {}) { opts = Object.assign({}, defaultJsonpOptions, opts) return fetchJsonP(u, opts).then(r => r.json()) } export function text(u, opts = {}) { return url(u, opts).then(r => r.text()) } export default { defaultOptions, defaultJsonpOptions, url, json, jsonP, text }
/** * Fetch module. * @module base/utils/fetch */ import fetchJsonP from 'fetch-jsonp' export var defaultOptions = { credentials: 'same-origin', headers: { 'http_x_requested_with': 'fetch' } } export var defaultJsonpOptions = { timeout: 5000, jsonpCallback: 'callback', jsonpCallbackFunction: null } export function checkStatus(response) { if (response.status >= 200 && response.status < 300) { return response } else { var error = new Error(response.statusText) error.response = response throw error } } export function url(u, opts = {}) { opts = Object.assign({}, defaultOptions, opts) // TODO: implement queryParams // if (opts.queryParams) { // } return fetch(u, opts).then(checkStatus) } export function json(u, opts = {}) { return url(u, opts).then(r => r.json()) } export function jsonP(u, opts = {}) { opts = Object.assign({}, defaultJsonpOptions, opts) // TODO: implement queryParams // if (opts.queryParams) { // } return fetchJsonP(u, opts).then(r => r.json()) } export function text(u, opts = {}) { return url(u, opts).then(r => r.text()) } export default { defaultOptions, defaultJsonpOptions, url, json, jsonP, text }
Send http_x_requested_with header to be able to check for ajax request
Send http_x_requested_with header to be able to check for ajax request
JavaScript
mit
Goldinteractive/js-base,Goldinteractive/js-base
--- +++ @@ -6,7 +6,10 @@ import fetchJsonP from 'fetch-jsonp' export var defaultOptions = { - credentials: 'same-origin' + credentials: 'same-origin', + headers: { + 'http_x_requested_with': 'fetch' + } } export var defaultJsonpOptions = { @@ -27,6 +30,12 @@ export function url(u, opts = {}) { opts = Object.assign({}, defaultOptions, opts) + + // TODO: implement queryParams + // if (opts.queryParams) { + + // } + return fetch(u, opts).then(checkStatus) } @@ -36,6 +45,12 @@ export function jsonP(u, opts = {}) { opts = Object.assign({}, defaultJsonpOptions, opts) + + // TODO: implement queryParams + // if (opts.queryParams) { + + // } + return fetchJsonP(u, opts).then(r => r.json()) }
36dfe83249242444a747a2c97c1febce3b0c173b
lib/job.js
lib/job.js
var events = require('events'); var util = require('util'); module.exports = Job; function Job(collection, data) { this.collection = collection; if(data){ data.__proto__ = JobData.prototype; //Convert plain object to JobData type this.data = data; } else { this.data = new JobData(); } } util.inherits(Job, events.EventEmitter); Job.prototype.save = function(callback) { var self = this; this.collection.save(this.data, function(err, doc) { if (err) return callback(err); if (doc && self.data._id === undefined) self.data._id = doc._id; callback(null, self); }); }; Job.prototype.complete = function(result, callback) { this.data.status = 'complete'; this.data.ended = new Date(); this.data.result = result; this.save(callback); }; Job.prototype.fail = function(error, callback) { this.data.status = 'failed'; this.data.ended = new Date(); this.data.error = error.message; this.save(callback); }; function JobData() {} Object.defineProperty(JobData.prototype, 'id', { get: function(){ return this._id && this._id.toHexString && this._id.toHexString(); } });
var events = require('events'); var util = require('util'); module.exports = Job; function Job(collection, data) { this.collection = collection; if(data){ data.__proto__ = JobData.prototype; //Convert plain object to JobData type this.data = data; } else { this.data = new JobData(); } } util.inherits(Job, events.EventEmitter); Job.prototype.save = function(callback) { var self = this; this.collection.save(this.data, function(err, doc) { if (err) return callback(err); if (doc && self.data._id === undefined) self.data._id = doc._id; callback(null, self); }); }; Job.prototype.complete = function(result, callback) { this.data.status = 'complete'; this.data.ended = new Date(); this.data.result = result; this.save(callback); }; Job.prototype.fail = function(error, callback) { this.data.status = 'failed'; this.data.ended = new Date(); this.data.error = error.message; this.save(callback); }; function JobData() {} Object.defineProperty(JobData.prototype, 'id', { get: function(){ return this._id && this._id.toString && this._id.toString(); } });
Use toString instead of toHexString
Use toString instead of toHexString
JavaScript
mit
trsouz/monq,dhritzkiv/monq,dioscouri/nodejs-monq,arifsetiawan/monq,saintedlama/monq,Santinell/monq,deployable/monq,scttnlsn/monq
--- +++ @@ -45,6 +45,6 @@ Object.defineProperty(JobData.prototype, 'id', { get: function(){ - return this._id && this._id.toHexString && this._id.toHexString(); + return this._id && this._id.toString && this._id.toString(); } });
a0bfebc24d8eec171cbca7696a3823c388b543c1
src/components/Activity.js
src/components/Activity.js
import React, { Component, PropTypes } from 'react'; import moment from 'moment'; class Activity extends Component { render() { const { timestamp, activity, deleteActivity } = this.props; return ( <div className="row row--middle"> <div className="col--2"> <p>{moment(+timestamp).format('MMMM DD, YYYY')}</p> </div> <div className="col--4"> <span>{activity.description}</span> <span className="pl" onClick={() => deleteActivity(timestamp)}>Delete</span> </div> </div> ); } } Activity.propTypes = { timestamp: PropTypes.string.isRequired, activity: PropTypes.object.isRequired, deleteActivity: PropTypes.func.isRequired, } export default Activity;
import React, { Component, PropTypes } from 'react'; import moment from 'moment'; class Activity extends Component { render() { const { timestamp, activity, deleteActivity } = this.props; return ( <div className="row row--middle"> <div className="col--4"> <p> {activity.description} <span className="pl" onClick={() => deleteActivity(timestamp)}>Delete</span> </p> </div> </div> ); } } Activity.propTypes = { timestamp: PropTypes.string.isRequired, activity: PropTypes.object.isRequired, deleteActivity: PropTypes.func.isRequired, } export default Activity;
Remove date string from activity
Remove date string from activity
JavaScript
mit
mknudsen01/today,mknudsen01/today
--- +++ @@ -8,12 +8,11 @@ return ( <div className="row row--middle"> - <div className="col--2"> - <p>{moment(+timestamp).format('MMMM DD, YYYY')}</p> - </div> <div className="col--4"> - <span>{activity.description}</span> - <span className="pl" onClick={() => deleteActivity(timestamp)}>Delete</span> + <p> + {activity.description} + <span className="pl" onClick={() => deleteActivity(timestamp)}>Delete</span> + </p> </div> </div> );
9a26b6c509419f91726a4b31c93931540ddd33f0
src/components/GameList.js
src/components/GameList.js
import React from 'react'; import '../styles/games.css'; export default class GameList extends React.Component { constructor(props) { super(props); this.state = {games: []}; } componentWillReceiveProps(nextProps) { let games = []; nextProps.games.forEach(game => { games.push(<li key={game.id}>{game.title}</li>); }); this.setState({games: games}); } render() { if (this.props.games.length > 0) { return ( <ul className='games'>{this.state.games}</ul> ); } else { return ( <div className='games empty'>No games found.</div> ); } } }
import React from 'react'; import '../styles/games.css'; export default class GameList extends React.Component { constructor(props) { super(props); this.state = {games: []}; } componentWillReceiveProps(nextProps) { let games = []; nextProps.games.forEach(game => { games.push(<li key={game.id} data-id={game.id} onClick={this.handleClick.bind(this)}>{game.title}</li>); }); this.setState({games: games}); } handleClick(event) { this.props.onSelect(this.props.games.find(game => game.id === Number(event.target.dataset.id))); } render() { if (this.props.games.length > 0) { return ( <ul className='games'>{this.state.games}</ul> ); } else { return ( <div className='games empty'>No games found.</div> ); } } }
Call onSelect event when a game is clicked.
Call onSelect event when a game is clicked.
JavaScript
mit
Julzso23/player.me-one-click-share,Julzso23/player.me-one-click-share
--- +++ @@ -11,9 +11,13 @@ componentWillReceiveProps(nextProps) { let games = []; nextProps.games.forEach(game => { - games.push(<li key={game.id}>{game.title}</li>); + games.push(<li key={game.id} data-id={game.id} onClick={this.handleClick.bind(this)}>{game.title}</li>); }); this.setState({games: games}); + } + + handleClick(event) { + this.props.onSelect(this.props.games.find(game => game.id === Number(event.target.dataset.id))); } render() {
2e0235e8495dd47dcbf15fd2bd6e012d5d615054
bin/codeclimate.js
bin/codeclimate.js
#!/usr/bin/env node var Formatter = require("../formatter"); var client = require('../http_client'); process.stdin.resume(); process.stdin.setEncoding("utf8"); var input = ""; process.stdin.on("data", function(chunk) { input += chunk; }); process.stdin.on("end", function() { formatter = new Formatter() formatter.format(input, function(err, json) { if (err) { console.error("A problem occurred parsing the lcov data", err); } else { json['repo_token'] = process.env.CODECLIMATE_REPO_TOKEN; client.postJson(json); } }); });
#!/usr/bin/env node var Formatter = require("../formatter"); var client = require('../http_client'); process.stdin.resume(); process.stdin.setEncoding("utf8"); var input = ""; process.stdin.on("data", function(chunk) { input += chunk; }); process.stdin.on("end", function() { formatter = new Formatter() formatter.format(input, function(err, json) { if (err) { console.error("A problem occurred parsing the lcov data", err); } else { if (process.env.CC_OUTPUT == "stdout") { console.log(json); } else { json['repo_token'] = process.env.CODECLIMATE_REPO_TOKEN; client.postJson(json); } } }); });
Add ability to print to stdout instead of POSTing
Add ability to print to stdout instead of POSTing
JavaScript
mit
kyroskoh/javascript-test-reporter,therebelbeta/javascript-test-reporter,codeclimate/javascript-test-reporter,buildkite/javascript-test-reporter
--- +++ @@ -18,8 +18,12 @@ if (err) { console.error("A problem occurred parsing the lcov data", err); } else { - json['repo_token'] = process.env.CODECLIMATE_REPO_TOKEN; - client.postJson(json); + if (process.env.CC_OUTPUT == "stdout") { + console.log(json); + } else { + json['repo_token'] = process.env.CODECLIMATE_REPO_TOKEN; + client.postJson(json); + } } }); });
6b701f707390938a069ab5742a15668e5c03f91d
src/custom-rx-operators.js
src/custom-rx-operators.js
import {Observable, Disposable} from 'rx'; Observable.prototype.subUnsub = function(onSub=null, onUnsub=null) { return Observable.create((subj) => { if (onSub) onSub(); let d = this.subscribe(subj); return Disposable.create(() => { if (onUnsub) onUnsub(); d.dispose(); }); }); }; Observable.prototype.permaRefcount = function() { let connected = null; return Observable.create((subj) => { let d = this.subscribe(subj); if (!connected) connected = this.connect(); return d; }); };
import {Observable, Disposable} from 'rx'; Observable.prototype.subUnsub = function(onSub=null, onUnsub=null) { return Observable.create((subj) => { if (onSub) onSub(); let d = this.subscribe(subj); return Disposable.create(() => { if (onUnsub) onUnsub(); d.dispose(); }); }); }; Observable.prototype.permaRefcount = function() { let connected = null; return Observable.create((subj) => { let d = this.subscribe(subj); if (!connected) connected = this.connect(); return d; }); }; Observable.prototype.delayFailures = function(source, delayTime) { return source .catch((e) => { return Observable.timeout(delayTime) .flatMap(() => Observable.throw(e)); }); };
Add an operator to delay failures
Add an operator to delay failures
JavaScript
mit
surf-build/surf,surf-build/surf,surf-build/surf,surf-build/surf
--- +++ @@ -22,3 +22,11 @@ return d; }); }; + +Observable.prototype.delayFailures = function(source, delayTime) { + return source + .catch((e) => { + return Observable.timeout(delayTime) + .flatMap(() => Observable.throw(e)); + }); +};
18a6a22170a2f0d4adb304351cd2c073942586b1
reporters/tap.js
reporters/tap.js
/** * Results formatter for --format=tap * * @see http://podwiki.hexten.net/TAP/TAP.html?page=TAP * @see https://github.com/isaacs/node-tap */ var Producer = require('tap').Producer; module.exports = function(results) { // public API return { render: function() { var metrics = results.getMetricsNames(), res = []; res.push(results.getGenerator() + ' results for <' + results.getUrl() + '>'); // metrics metrics.forEach(function(metric) { var entry = { ok: true, name: metric }; // check asserts if (results.hasAssertion(metric)) { if (!results.assert(metric)) { entry.ok = false; entry.expected = results.getAssertion(metric); entry.actual = results.getMetric(metric); } } else { // mark metrics with no assertions as skipped entry.skip = true; } // add offenders var offenders = results.getOffenders(metric); if (offenders) { entry.offenders = offenders; } res.push(entry); }); return Producer.encode(res, true /* emit yanlish data in TAP */); } }; };
/** * Results formatter for --format=tap * * @see http://podwiki.hexten.net/TAP/TAP.html?page=TAP * @see https://github.com/isaacs/node-tap */ var Producer = require('tap').Producer; module.exports = function(results) { // public API return { render: function() { var metrics = results.getMetricsNames(), res = []; res.push(results.getGenerator() + ' results for <' + results.getUrl() + '>'); // metrics metrics.forEach(function(metric) { var entry = { ok: true, name: metric }; // check asserts if (results.hasAssertion(metric)) { if (!results.assert(metric)) { entry.ok = false; entry.expected = results.getAssertion(metric); entry.actual = results.getMetric(metric); } } else { // mark metrics with no assertions as skipped entry.skip = true; } // add offenders var offenders = results.getOffenders(metric); if (offenders) { // properly encode YAML to make it work in Jenkins offenders = offenders.map(function(entry) { return '"' + entry.replace(/"/g, '') + '"'; }); entry.offenders = offenders; } res.push(entry); }); return Producer.encode(res, true /* emit yanlish data in TAP */); } }; };
Format YAMLish properly to make it work in Jenkins
Format YAMLish properly to make it work in Jenkins
JavaScript
bsd-2-clause
william-p/phantomas,ingoclaro/phantomas,william-p/phantomas,gmetais/phantomas,ingoclaro/phantomas,william-p/phantomas,macbre/phantomas,ingoclaro/phantomas,macbre/phantomas,gmetais/phantomas,gmetais/phantomas,macbre/phantomas
--- +++ @@ -39,6 +39,11 @@ // add offenders var offenders = results.getOffenders(metric); if (offenders) { + // properly encode YAML to make it work in Jenkins + offenders = offenders.map(function(entry) { + return '"' + entry.replace(/"/g, '') + '"'; + }); + entry.offenders = offenders; }
0d1917939110865a62136dc6d66fac5749574881
app/controllers/application.js
app/controllers/application.js
import Ember from 'ember'; export default Ember.Controller.extend({ session: Ember.inject.service(), isExpanded: true, isNotLogin: Ember.computed('this.currentPath', function() { if (this.currentPath !== 'login') { return true; } else { return false; } }), sizeContainer: function() { var winWidth = Ember.$(window).width(); if (winWidth < 992 && this.isExpanded) { this.send('toggleMenu'); } }, attachResizeListener : function () { Ember.$(window).on('resize', Ember.run.bind(this, this.sizeContainer)); }.on('init'), actions: { toggleMenu: function() { this.toggleProperty('isExpanded'); }, invalidateSession: function() { return this.get('session').invalidate().then(() => { window.location.reload(true); }); } } });
import Ember from 'ember'; export default Ember.Controller.extend({ session: Ember.inject.service(), isExpanded: true, isNotLogin: Ember.computed('currentPath', function() { return this.get('currentPath') !== 'login'; }), sizeContainer: function() { var winWidth = Ember.$(window).width(); if (winWidth < 992 && this.isExpanded) { this.send('toggleMenu'); } }, attachResizeListener : function () { Ember.$(window).on('resize', Ember.run.bind(this, this.sizeContainer)); }.on('init'), actions: { toggleMenu: function() { this.toggleProperty('isExpanded'); }, invalidateSession: function() { return this.get('session').invalidate().then(() => { window.location.reload(true); }); } } });
Fix display artifact that prevented sidebar from showing after login, until page was refreshed
Fix display artifact that prevented sidebar from showing after login, until page was refreshed [#LEI-294]
JavaScript
apache-2.0
abought/experimenter,abought/experimenter
--- +++ @@ -3,12 +3,8 @@ export default Ember.Controller.extend({ session: Ember.inject.service(), isExpanded: true, - isNotLogin: Ember.computed('this.currentPath', function() { - if (this.currentPath !== 'login') { - return true; - } else { - return false; - } + isNotLogin: Ember.computed('currentPath', function() { + return this.get('currentPath') !== 'login'; }), sizeContainer: function() { var winWidth = Ember.$(window).width();
268db5ed4558028c630c3b03bcd9b5cd4a578686
app/js/services.js
app/js/services.js
(function() { 'use strict'; /* Services */ angular.module('myApp.services', []) // put your services here! // .service('serviceName', ['dependency', function(dependency) {}]); .service('messageList', ['fbutil', function(fbutil) { return fbutil.syncArray('messages', {limit: 10, endAt: null}); }]); })();
(function() { 'use strict'; /* Services */ angular.module('myApp.services', []) // put your services here! // .service('serviceName', ['dependency', function(dependency) {}]); .factory('messageList', ['fbutil', function(fbutil) { return fbutil.syncArray('messages', {limit: 10, endAt: null}); }]); })();
Switch service with factory (it's not a Class called with new)
Switch service with factory (it's not a Class called with new)
JavaScript
mit
birdwell/Fantasy-Football,kmarwah/Seed,rawrsome/angularfire-seed,harish-myaccount/vigilante,russellf9/diary,u910328/Coding-Parrot-2.1,timothy-clifford/dashshelf,snowpeame/snowpeas,JonBergman/angularfire-seed,morganric/wildfirio,morganric/wildfirio,robotnoises/angularfire-seed,pmconnolly80/angularfire-seed,dialectica/angularfire-testbed,ap149/angularfire-seed,birdwell/FantasyFootball,quantiply-fork/angularfire-seed,rawrsome/angularfire-seed,clarkdever/ITNShadow,stevewitman/angularfire-seed,henry-hz/angularfire-seed,birdwell/FantasyFootball,joehannes-generation/angularfire-seed,googlearchive/angularfire-seed,clarkdever/ITNShadow,u910328/Coding-Parrot-2.1,harish-myaccount/vigilante,stevewitman/angularfire-seed,missmellyg85/books,ap149/angularfire-seed,missmellyg85/books,kmarwah/Seed,JonBergman/angularfire-seed,deuxnids/ruhrig,missmellyg85/angularfire-seed,semiosis/moop-mapp,semiosis/moop-mapp,bthj/like-breeding,robotnoises/angularfire-seed,googlearchive/angularfire-seed,joehannes-generation/angularfire-seed,russellf9/f9-angular-fire,baolocdo/angularfire-seed,timothy-clifford/dashshelf,baolocdo/angularfire-seed,pmconnolly80/angularfire-seed,dialectica/angularfire-testbed,birdwell/Fantasy-Football,snowpeame/snowpeas,missmellyg85/angularfire-seed
--- +++ @@ -8,7 +8,7 @@ // put your services here! // .service('serviceName', ['dependency', function(dependency) {}]); - .service('messageList', ['fbutil', function(fbutil) { + .factory('messageList', ['fbutil', function(fbutil) { return fbutil.syncArray('messages', {limit: 10, endAt: null}); }]);
319871c7b722c2a540ba48c9fe0fdfe07df9fef5
app/assets/javascripts/sw.js
app/assets/javascripts/sw.js
console.log('Started', self); self.addEventListener('install', function(event) { self.skipWaiting(); console.log('Installed', event); }); self.addEventListener('activate', function(event) { console.log('Activated', event); }); self.addEventListener('push', function(event) { if (event.data) { var json = event.data.json(); self.registration.showNotification(json.title, json); } }); self.addEventListener('notificationclick', function(event) { console.log('Notification click: tag ', event.notification.tag); event.notification.close(); var action = event.action || 'open-app'; var url = false; if (action === 'open-app') { url = '//glassycollections.com/'; } else if (action === 'record-pendant') { url = '//glassycollections.com/my/pendant_records/new'; } if (url) { event.waitUntil(clients.matchAll({ includeUncontrolled: true, type: 'window' }).then( function(activeClients) { if (activeClients.length > 0) { activeClients[0].navigate(url); activeClients[0].focus(); } else { clients.openWindow(url); } }) ); } });
console.log('Started', self); self.addEventListener('install', function(event) { self.skipWaiting(); console.log('Installed', event); }); self.addEventListener('activate', function(event) { console.log('Activated', event); }); self.addEventListener('push', function(event) { if (event.data) { var json = event.data.json(); self.registration.showNotification(json.title, json); } }); self.addEventListener('notificationclick', function(event) { console.log('Notification click: tag ', event.notification.tag); event.notification.close(); var action = event.action || 'open-app'; var url = event.url; if (action === 'open-app') { url = '//glassycollections.com/'; } else if (action === 'record-pendant') { url = '//glassycollections.com/my/pendant_records/new'; } if (url) { event.waitUntil(clients.matchAll({ includeUncontrolled: true, type: 'window' }).then( function(activeClients) { if (activeClients.length > 0) { activeClients[0].navigate(url); activeClients[0].focus(); } else { clients.openWindow(url); } }) ); } });
Add ability to launch arb url from push
Add ability to launch arb url from push
JavaScript
mit
coreyja/glassy-collections,coreyja/glassy-collections,coreyja/glassy-collections
--- +++ @@ -18,7 +18,7 @@ var action = event.action || 'open-app'; - var url = false; + var url = event.url; if (action === 'open-app') { url = '//glassycollections.com/';
f9faf808f414ae53d372fe3ad5b4c6ca9b6e86c9
src/webroot/js/fancybox.js
src/webroot/js/fancybox.js
/** * Call the fancybox for displaying organism details in a lightbox */ $(".fancybox").fancybox({ maxWidth: 1000, maxHeight: 800 });
/** * Call the fancybox for displaying organism details in a lightbox */ $(".fancybox").fancybox({ minWidth: 1000, maxWidth: 1000, maxHeight: 800, minHeight: 800 });
Set size of fancy box
Set size of fancy box
JavaScript
mit
molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec
--- +++ @@ -2,6 +2,8 @@ * Call the fancybox for displaying organism details in a lightbox */ $(".fancybox").fancybox({ + minWidth: 1000, maxWidth: 1000, - maxHeight: 800 + maxHeight: 800, + minHeight: 800 });
88207533c117a9ccc89f0d0b0e4a74fb97b6c821
scripts/offsets.js
scripts/offsets.js
'use strict'; const exec = require('child_process').execSync; const ios = require('./contours-ios.json'); const web = require('./contours-web.json'); const fs = require('fs'); var offsets = {}; for (let font in web) { const offset = { x: web[font].x - ios[font].x, y: web[font].y - ios[font].y }; offsets[font] = offset; } fs.writeFile('./offsets.json', JSON.stringify(offsets));
"use strict"; const exec = require("child_process").execSync; const ios = require("./contours-ios.json"); const web = require("./contours-web.json"); const fs = require("fs"); var offsets = {}; for (let font in web) { const offset = { x: web[font].x - ios[font].x, y: web[font].y - ios[font].y, top: ios[font].topInset }; offsets[font] = offset; } fs.writeFile("./offsets.json", JSON.stringify(offsets));
Update script to add top inset
Update script to add top inset
JavaScript
mit
ninjaprox/TextContour,ninjaprox/TextContour,ninjaprox/TextContour,ninjaprox/TextContour
--- +++ @@ -1,19 +1,20 @@ -'use strict'; +"use strict"; -const exec = require('child_process').execSync; -const ios = require('./contours-ios.json'); -const web = require('./contours-web.json'); -const fs = require('fs'); +const exec = require("child_process").execSync; +const ios = require("./contours-ios.json"); +const web = require("./contours-web.json"); +const fs = require("fs"); var offsets = {}; for (let font in web) { const offset = { x: web[font].x - ios[font].x, - y: web[font].y - ios[font].y + y: web[font].y - ios[font].y, + top: ios[font].topInset }; offsets[font] = offset; } -fs.writeFile('./offsets.json', JSON.stringify(offsets)); +fs.writeFile("./offsets.json", JSON.stringify(offsets));
f486e827dbfa258cbb051fd0ba08da86940ba066
test/tests-test.js
test/tests-test.js
var buster = require("buster"); var firestarter = require('../')(); buster.testCase('Test testing framework', { 'Test' : function(){ 'use strict'; assert(firestarter.config.testValue); } });
var buster = require("buster"); var firestarter = require('../')(); buster.testCase('Test testing framework', { 'Test' : function(){ 'use strict'; assert(!firestarter.config.testValue); } });
Test of Travis failing build
Test of Travis failing build
JavaScript
mit
davewilliamson/firestarter
--- +++ @@ -7,6 +7,6 @@ 'Test' : function(){ 'use strict'; - assert(firestarter.config.testValue); + assert(!firestarter.config.testValue); } });
0c0fa72464530d3a9896a18d9b752626835dc1b2
ui/src/registrator/PrihlaskyDohlasky/Platby/NovaPlatbaInputContainer.js
ui/src/registrator/PrihlaskyDohlasky/Platby/NovaPlatbaInputContainer.js
import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import InputContainer from '../Input/InputContainer'; import { inputChanged } from './PlatbyActions'; import { formatValue, inputOptions, inputValid, isInputEnabled, isInputVisible } from './platbyReducer'; const mapStateToProps = (state, ownProps) => { const form = state.registrator.prihlasky.platby; const { name } = ownProps; const [, subName] = name.split('.'); const rawValue = form[subName]; return { form, rawValue, formatValue, inputChanged, inputOptions, inputValid, isInputEnabled, isInputVisible, ...ownProps }; }; const PlatbyInputContainer = connect(mapStateToProps, {})(InputContainer); PlatbyInputContainer.propTypes = { name: PropTypes.string.isRequired }; export default PlatbyInputContainer;
import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import InputContainer from '../Input/InputContainer'; import { inputChanged } from './PlatbyActions'; import { formatValue, inputOptions, inputValid, isInputEnabled, isInputVisible } from './platbyReducer'; const mapStateToProps = (state, ownProps) => { const form = state.registrator.prihlasky.platby; const { name } = ownProps; const [, subName] = name.split('.'); const rawValue = form[subName]; return { form, rawValue, formatValue, inputChanged, inputOptions, inputValid, isInputEnabled, isInputVisible, ...ownProps }; }; const NovaPlatbaInputContainer = connect(mapStateToProps, {})(InputContainer); NovaPlatbaInputContainer.propTypes = { name: PropTypes.string.isRequired }; export default NovaPlatbaInputContainer;
Unify component name and filename.
Unify component name and filename.
JavaScript
mit
ivosh/jcm2018,ivosh/jcm2018,ivosh/jcm2018
--- +++ @@ -29,10 +29,10 @@ }; }; -const PlatbyInputContainer = connect(mapStateToProps, {})(InputContainer); +const NovaPlatbaInputContainer = connect(mapStateToProps, {})(InputContainer); -PlatbyInputContainer.propTypes = { +NovaPlatbaInputContainer.propTypes = { name: PropTypes.string.isRequired }; -export default PlatbyInputContainer; +export default NovaPlatbaInputContainer;
4ed6fd92ad2f2b3b4088842d544e2154c4302b49
src/rules/accessible-emoji.js
src/rules/accessible-emoji.js
/** * @fileoverview Enforce emojis are wrapped in <span> and provide screenreader access. * @author Ethan Cohen */ // ---------------------------------------------------------------------------- // Rule Definition // ---------------------------------------------------------------------------- import emojiRegex from 'emoji-regex'; import { getProp, getLiteralPropValue, elementType } from 'jsx-ast-utils'; import { generateObjSchema } from '../util/schemas'; const errorMessage = 'Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby.'; const schema = generateObjSchema(); module.exports = { meta: { docs: {}, schema: [schema], }, create: context => ({ JSXOpeningElement: (node) => { const literalChildValue = node.parent.children.find((child) => { if (child.type === 'Literal') { return child.value; } return false; }); if (literalChildValue && emojiRegex().test(literalChildValue.value)) { const rolePropValue = getLiteralPropValue(getProp(node.attributes, 'role')); const ariaLabelProp = getProp(node.attributes, 'aria-label'); const arialLabelledByProp = getProp(node.attributes, 'aria-labelledby'); const hasLabel = ariaLabelProp !== undefined || arialLabelledByProp !== undefined; const isSpan = elementType(node) === 'span'; if (hasLabel === false || rolePropValue !== 'img' || isSpan === false) { context.report({ node, message: errorMessage, }); } } }, }), };
/** * @fileoverview Enforce emojis are wrapped in <span> and provide screenreader access. * @author Ethan Cohen */ // ---------------------------------------------------------------------------- // Rule Definition // ---------------------------------------------------------------------------- import emojiRegex from 'emoji-regex'; import { getProp, getLiteralPropValue, elementType } from 'jsx-ast-utils'; import { generateObjSchema } from '../util/schemas'; const errorMessage = 'Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby.'; const schema = generateObjSchema(); module.exports = { meta: { docs: {}, schema: [schema], }, create: context => ({ JSXOpeningElement: (node) => { const literalChildValue = node.parent.children.find( child => child.type === 'Literal', ); if (literalChildValue && emojiRegex().test(literalChildValue.value)) { const rolePropValue = getLiteralPropValue(getProp(node.attributes, 'role')); const ariaLabelProp = getProp(node.attributes, 'aria-label'); const arialLabelledByProp = getProp(node.attributes, 'aria-labelledby'); const hasLabel = ariaLabelProp !== undefined || arialLabelledByProp !== undefined; const isSpan = elementType(node) === 'span'; if (hasLabel === false || rolePropValue !== 'img' || isSpan === false) { context.report({ node, message: errorMessage, }); } } }, }), };
Return just a boolean from find
Return just a boolean from find
JavaScript
mit
evcohen/eslint-plugin-jsx-a11y,jessebeach/eslint-plugin-jsx-a11y
--- +++ @@ -24,12 +24,9 @@ create: context => ({ JSXOpeningElement: (node) => { - const literalChildValue = node.parent.children.find((child) => { - if (child.type === 'Literal') { - return child.value; - } - return false; - }); + const literalChildValue = node.parent.children.find( + child => child.type === 'Literal', + ); if (literalChildValue && emojiRegex().test(literalChildValue.value)) { const rolePropValue = getLiteralPropValue(getProp(node.attributes, 'role'));