commit
stringlengths
40
40
old_file
stringlengths
4
264
new_file
stringlengths
4
264
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
624
message
stringlengths
15
4.7k
lang
stringclasses
3 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
616729f152d9f513bf02ad3b0f41a21fbc89761a
lib/instagram.js
lib/instagram.js
var config = { clientId: '', clientSecret: '', hashTag: 'ruisrock2014' } var getIg = function(){ var ig = require('instagram-node').instagram(); ig.use({ client_id: config.clientId, client_secret: config.clientSecret}); return ig; } var parseIgMediaObject = function(media){ return { link: media.link, title: (media.caption==null)?"":media.caption.text, thumbnail: media.images.thumbnail.url, small_image: media.images.low_resolution.url, image: media.images.standard_resolution.url, likes: media.likes.count, tags: media.tags } } var parseIgMedia = function(medias){ var data = []; medias.forEach(function(media){ data.push(parseIgMediaObject(media)); }); return data; } module.exports = { tagMedia: function(req, res) { try{ getIg().tag_media_recent(config.hashTag, function(err, medias, pagination, limit) { if(err) throw new Error("Virhe"); res.send(JSON.stringify({status: 200, media: parseIgMedia(medias)})); }); }catch(err){ res.send(500, JSON.stringify({status: 500, error: err.message})); } } }
var config = { clientId: '', clientSecret: '', hashTag: 'ruisrock2014' } var getIg = function(){ var ig = require('instagram-node').instagram(); ig.use({ client_id: config.clientId, client_secret: config.clientSecret}); return ig; } var parseIgMediaObject = function(media){ return { link: media.link, title: (media.caption==null)?"":media.caption.text, thumbnail: media.images.thumbnail.url, small_image: media.images.low_resolution.url, image: media.images.standard_resolution.url, likes: media.likes.count, tags: media.tags } } var parseIgMedia = function(medias){ var data = []; medias.forEach(function(media){ data.push(parseIgMediaObject(media)); }); return data; } module.exports = { tagMedia: function(req, res) { try{ getIg().tag_media_recent(config.hashTag, function(err, medias, pagination, limit) { if(err)res.send(500); else res.send(JSON.stringify({media: parseIgMedia(medias)})); }); }catch(err){ res.send(500); } } }
Send 500 every now and then
Send 500 every now and then
JavaScript
mit
futurice/festapp-server,futurice/sec-conference-server,0is1/festapp-server,futurice/sec-conference-server
a5f3d39929b4886ae28711d607c05275bfab74ca
dev/_/components/js/comparisonSetCollection.js
dev/_/components/js/comparisonSetCollection.js
AV.ComparisonSetCollection = Backbone.Collection.extend({ url: AV.URL('set.json'), updateURL: function() { this.url = AV.URL('set.json'); } });
AV.ComparisonSetCollection = Backbone.Collection.extend({ url: AV.URL('set'),//'.json'), updateURL: function() { this.url = AV.URL('set');//'.json'); } });
Remove .json from the set url
Remove .json from the set url
JavaScript
bsd-3-clause
Swarthmore/juxtaphor,Swarthmore/juxtaphor
98148ba689955cd9f07a55e6360207f613ceb6aa
gest.js
gest.js
#! /usr/bin/env node const args = require('./args') // TODO const path = require('path') const { graphql: config } = require(path.join(process.cwd(), 'package.json')) const { sendQuery, readFile, checkPath, REPL } = require('./src/api') const { pullHeaders, colorResponse } = require('./src/util') args .option('header', 'HTTP request header') .option('baseUrl', 'Base URL for sending HTTP requests') const flags = args.parse(process.argv) if (!flags.help && !flags.version) { let schema try { schema = require(path.join(process.cwd(), (config && config.schema) || 'schema.js')) } catch (e) { console.log('\nSchema not found. Trying running `gest` with your `schema.js` in the current working directory.\n') process.exit() } const options = Object.assign({}, config, pullHeaders(flags), { baseURL: flags.baseUrl }) if (args.sub && args.sub.length) { checkPath(path.join(__dirname, args.sub[0])) .then(readFile) .catch(() => args.sub[0]) .then(sendQuery(schema, options)) .then(colorResponse) .then(console.log) .catch(console.log) .then(() => process.exit()) } else { // REPL REPL(schema, options) } }
#! /usr/bin/env node const args = require('./args') // TODO const path = require('path') const { sendQuery, readFile, checkPath, REPL } = require('./src/api') const { pullHeaders, colorResponse } = require('./src/util') args .option('header', 'HTTP request header') .option('baseUrl', 'Base URL for sending HTTP requests') const flags = args.parse(process.argv) if (!flags.help && !flags.version) { let config let schema try { config = require(path.join(process.cwd(), 'package.json')) } catch (e) {} try { schema = require(path.join(process.cwd(), (config && config.schema) || 'schema')) } catch (e) { switch (e.code) { case 'MODULE_NOT_FOUND': console.log('\nSchema not found. Trying running `gest` with your `schema.js` in the current working directory.\n') break default: console.log(e) } process.exit() } const options = Object.assign({}, config, pullHeaders(flags), { baseURL: flags.baseUrl }) if (args.sub && args.sub.length) { checkPath(path.join(__dirname, args.sub[0])) .then(readFile) .catch(() => args.sub[0]) .then(sendQuery(schema, options)) .then(colorResponse) .then(console.log) .catch(console.log) .then(() => process.exit()) } else { // REPL REPL(schema, options) } }
Add error handling to chekcing package.json
Add error handling to chekcing package.json
JavaScript
mit
mfix22/graphicli
c488bae8b97a3a9207d1aa0bbea424c92d493df0
lib/handlers/providers/index.js
lib/handlers/providers/index.js
"use strict"; var Anyfetch = require('anyfetch'); module.exports.get = function get(req, res, next) { var anyfetchClient = new Anyfetch(req.accessToken.token); anyfetchClient.getDocuments({ fields: 'facets.providers' }, function updated(err, anyfetchRes) { if(!err) { var providers = anyfetchRes.body.facets.providers; res.send({ 'count': providers.length }); } next(err); }); };
"use strict"; var Anyfetch = require('anyfetch'); module.exports.get = function get(req, res, next) { var anyfetchClient = new Anyfetch(req.accessToken.token); anyfetchClient.getDocuments({ fields: 'facets.providers' }, function updated(err, anyfetchRes) { if(!err) { var providers = anyfetchRes.body.facets.providers; res.send({ 'count': providers ? providers.length || 0 }); } next(err); }); };
Fix for missing providers length
Fix for missing providers length
JavaScript
mit
AnyFetch/companion-server
521c7e73b09e71d34d8966f35952cb26ce010bd0
src/nih_wayfinding/app/scripts/views/routing/directions/row-detail-directive.js
src/nih_wayfinding/app/scripts/views/routing/directions/row-detail-directive.js
(function () { 'use strict'; /* ngInject */ function RowDetail($compile) { // TODO: Animate the row appearing var template = [ '<tr ng-show="visible"><td colspan="2">', '<ul class="list-unstyled">', '<li ng-repeat="feature in item.directions.features">', '<img width="20px" height="20px" ng-src="{{ ::feature.img }}" />{{ ::feature.note }}', '</li>', '<li ng-repeat="warning in item.directions.warnings">', '<img width="20px" height="20px" ng-src="{{ ::warning.img }}" />{{ ::warning.note }}', '</li>', '</ul>', '</td></tr>' ].join(''); var module = { restrict: 'A', scope: false, link: link, }; return module; function link(scope, element) { if (!hasDetails(scope.item)) { return; } scope.visible = false; var row = $compile(template)(scope); element.after(row); element.click(function () { scope.visible = !scope.visible; scope.$apply(); }); function hasDetails(item) { var directions = item.directions; return directions && (directions.features.length || directions.warnings.length); } } } angular.module('nih.views.routing') .directive('rowDetail', RowDetail); })();
(function () { 'use strict'; /* ngInject */ function RowDetail($compile) { // TODO: Animate the row appearing var template = [ '<div class="block" ng-show="visible">', '<ul class="list-unstyled">', '<li ng-repeat="feature in item.directions.features">', '<img width="20px" height="20px" ng-src="{{ ::feature.img }}" /> {{ ::feature.note }}', '</li>', '<li ng-repeat="warning in item.directions.warnings">', '<img width="20px" height="20px" ng-src="{{ ::warning.img }}" /> {{ ::warning.note }}', '</li>', '</ul>', '</div>' ].join(''); var module = { restrict: 'A', scope: false, link: link, }; return module; function link(scope, element) { if (!hasDetails(scope.item)) { return; } scope.visible = false; var row = $compile(template)(scope); element.find('td:last-child').append(row); element.click(function () { scope.visible = !scope.visible; scope.$apply(); }); function hasDetails(item) { var directions = item.directions; return directions && (directions.features.length || directions.warnings.length); } } } angular.module('nih.views.routing') .directive('rowDetail', RowDetail); })();
Move step-by-step direction details into element
Move step-by-step direction details into element
JavaScript
apache-2.0
azavea/nih-wayfinding,azavea/nih-wayfinding
fea9882a1d77bae8f5710c79af3cd17677e97345
client/js/helpers/rosetexloader.js
client/js/helpers/rosetexloader.js
'use strict'; /** * @note Returns texture immediately, but doesn't load till later. */ var ROSETexLoader = {}; ROSETexLoader.load = function(path, callback) { var tex = DDS.load(path, function() { if (callback) { callback(); } }); tex.minFilter = tex.magFilter = THREE.LinearFilter; return tex; };
'use strict'; /** * @note Returns texture immediately, but doesn't load till later. */ var ROSETexLoader = {}; ROSETexLoader.load = function(path, callback) { var tex = DDS.load(path, function() { if (callback) { callback(); } }); tex.minFilter = tex.magFilter = THREE.LinearFilter; tex.path = path; return tex; };
Set .path in dds textures for debugging.
Set .path in dds textures for debugging.
JavaScript
agpl-3.0
brett19/rosebrowser,Jiwan/rosebrowser,exjam/rosebrowser,exjam/rosebrowser,Jiwan/rosebrowser,brett19/rosebrowser
4505a470372a5d4df66d6945039000a3da9f0358
006.js
006.js
var _ = require('lazy.js'); var square = function square (n) { return Math.pow(n, 2); }; var sum = function sum (n, m) { return n + m; }; var sumOfSquares = function sumOfSquares (range) { return range.map(square).reduce(sum); }; var squareOfSum = function squareOfSum (range) { return square(range.reduce(sum), 2); }; var difference = function difference (range) { return squareOfSum(range) - sumOfSquares(range); }; console.log(difference(_.range(1,11))); console.log(difference(_.range(1,101)));
Add initial global JS solution for problem 6
Add initial global JS solution for problem 6
JavaScript
mit
jrhorn424/euler,jrhorn424/euler
659234ef7c0c6efd14be14997ddd7d2e97a3d385
closure/goog/disposable/idisposable.js
closure/goog/disposable/idisposable.js
// Copyright 2011 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Definition of the disposable interface. A disposable object * has a dispose method to to clean up references and resources. * @author nnaze@google.com (Nathan Naze) */ goog.provide('goog.disposable.IDisposable'); /** * Interface for a disposable object. If a instance requires cleanup * (references COM objects, DOM notes, or other disposable objects), it should * implement this interface (it may subclass goog.Disposable). * @interface */ goog.disposable.IDisposable = function() {}; /** * Disposes of the object and its resources. * @return {void} Nothing. */ goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; /** * @return {boolean} Whether the object has been disposed of. */ goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod;
// Copyright 2011 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Definition of the disposable interface. A disposable object * has a dispose method to to clean up references and resources. * @author nnaze@google.com (Nathan Naze) */ goog.provide('goog.disposable.IDisposable'); /** * Interface for a disposable object. If a instance requires cleanup * (references COM objects, DOM nodes, or other disposable objects), it should * implement this interface (it may subclass goog.Disposable). * @record */ goog.disposable.IDisposable = function() {}; /** * Disposes of the object and its resources. * @return {void} Nothing. */ goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; /** * @return {boolean} Whether the object has been disposed of. */ goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod;
Allow object literals to be IDisposable
Allow object literals to be IDisposable RELNOTES[INC]: goog.disposable.IDisposable is now @record ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129902477
JavaScript
apache-2.0
redforks/closure-library,redforks/closure-library,redforks/closure-library,redforks/closure-library
bb6c53c86c6f9aabf70fd3cd70a885f2083ed790
app.js
app.js
'use strict'; /** * Imports. */ const express = require('express'); /** * Initialize Express. */ const app = express(); // Setup locals variable in config/index.js. app.locals = require('./config'); // Configure express app based on local configuration. app.set('env', app.locals.express.env); /** * Routing. */ // Root: app.get('/', (req, res) => { res.send('Hi, I\'m Blink!'); }); // Api root: app.use('/api', require('./api')); // API Version 1 app.use('/api/v1', require('./api/v1')); /** * Listen. */ app.listen(app.locals.express.port, () => { app.locals.logger.info(`Blink is listening on port:${app.locals.express.port} env:${app.get('env')}`); }); module.exports = app;
'use strict'; /** * Imports. */ const express = require('express'); const http = require('http'); /** * Initialize Express. */ const app = express(); // Setup locals variable in config/index.js. app.locals = require('./config'); // Configure express app based on local configuration. app.set('env', app.locals.express.env); /** * Routing. */ // Root: app.get('/', (req, res) => { res.send('Hi, I\'m Blink!'); }); // Api root: app.use('/api', require('./api')); // API Version 1 app.use('/api/v1', require('./api/v1')); /** * Create server. */ const server = http.createServer(app); server.listen(app.locals.express.port, () => { const address = server.address(); app.locals.logger.info(`Blink is listening on port:${address.port} env:${app.locals.express.env}`); }); module.exports = app;
Print actual port number in server init log
Print actual port number in server init log
JavaScript
mit
DoSomething/blink,DoSomething/blink
650756852a9ff4011afe2e662495066fdce079e8
app.js
app.js
#!/usr/bin/env node /* * SQL API loader * =============== * * node app [environment] * * environments: [development, test, production] * */ var _ = require('underscore'); // sanity check arguments var ENV = process.argv[2]; if (ENV != 'development' && ENV != 'production' && ENV != 'test') { console.error("\n./app [environment]"); console.error("environments: [development, test, production]"); process.exit(1); } // set Node.js app settings and boot global.settings = require(__dirname + '/config/settings'); var env = require(__dirname + '/config/environments/' + ENV); _.extend(global.settings, env); // kick off controller var app = require(global.settings.app_root + '/app/controllers/app'); app.listen(global.settings.node_port, global.settings.node_host, function() { console.log("CartoDB SQL API listening on " + global.settings.node_host + ":" + global.settings.node_port); });
#!/usr/bin/env node /* * SQL API loader * =============== * * node app [environment] * * environments: [development, test, production] * */ var _ = require('underscore'); // sanity check arguments var ENV = process.argv[2]; if (ENV != 'development' && ENV != 'production' && ENV != 'test') { console.error("\n./app [environment]"); console.error("environments: [development, test, production]"); process.exit(1); } // set Node.js app settings and boot global.settings = require(__dirname + '/config/settings'); var env = require(__dirname + '/config/environments/' + ENV); _.extend(global.settings, env); // kick off controller if ( ! global.settings.base_url ) global.settings.base_url = '/api/*'; var app = require(global.settings.app_root + '/app/controllers/app'); app.listen(global.settings.node_port, global.settings.node_host, function() { console.log("CartoDB SQL API listening on " + global.settings.node_host + ":" + global.settings.node_port + " with base_url " + global.settings.base_url); });
Use a default base_url when not specified in config file
Use a default base_url when not specified in config file Also report the base_url at startup
JavaScript
bsd-3-clause
calvinmetcalf/CartoDB-SQL-API,dbirchak/CartoDB-SQL-API,calvinmetcalf/CartoDB-SQL-API,calvinmetcalf/CartoDB-SQL-API,CartoDB/CartoDB-SQL-API,dbirchak/CartoDB-SQL-API,dbirchak/CartoDB-SQL-API,CartoDB/CartoDB-SQL-API,calvinmetcalf/CartoDB-SQL-API,dbirchak/CartoDB-SQL-API
61eb38969435727ff074b1a95253b577c88c4dfb
common/endpoints/endpoints.service.js
common/endpoints/endpoints.service.js
export default [ 'config', 'hs.common.laymanService', function (config, laymanService) { const me = this; function getItemsPerPageConfig(ds) { return angular.isDefined(ds.paging) && angular.isDefined(ds.paging.itemsPerPage) ? ds.paging.itemsPerPage : config.dsPaging || 20; } angular.extend(me, { endpoints: [ ...(config.status_manager_url ? { type: 'statusmanager', title: 'Status manager', url: config.status_manager_url, } : []), ...(config.datasources || []).map((ds) => { return { url: ds.url, type: ds.type, title: ds.title, datasourcePaging: { start: 0, limit: getItemsPerPageConfig(ds), loaded: false, }, compositionsPaging: { start: 0, limit: getItemsPerPageConfig(ds), }, paging: { itemsPerPage: getItemsPerPageConfig(ds), }, user: ds.user, liferayProtocol: ds.liferayProtocol, originalConfiguredUser: ds.user, getCurrentUserIfNeeded: laymanService.getCurrentUserIfNeeded, }; }), ], }); return me; }, ];
export default [ 'config', 'hs.common.laymanService', function (config, laymanService) { const me = this; function getItemsPerPageConfig(ds) { return angular.isDefined(ds.paging) && angular.isDefined(ds.paging.itemsPerPage) ? ds.paging.itemsPerPage : config.dsPaging || 20; } angular.extend(me, { endpoints: [ ...(config.status_manager_url ? [ { type: 'statusmanager', title: 'Status manager', url: config.status_manager_url, }, ] : []), ...(config.datasources || []).map((ds) => { return { url: ds.url, type: ds.type, title: ds.title, datasourcePaging: { start: 0, limit: getItemsPerPageConfig(ds), loaded: false, }, compositionsPaging: { start: 0, limit: getItemsPerPageConfig(ds), }, paging: { itemsPerPage: getItemsPerPageConfig(ds), }, user: ds.user, liferayProtocol: ds.liferayProtocol, originalConfiguredUser: ds.user, getCurrentUserIfNeeded: laymanService.getCurrentUserIfNeeded, }; }), ], }); return me; }, ];
Correct adding of statusmanager to endpoints
Correct adding of statusmanager to endpoints
JavaScript
mit
hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng
c320a3d7430bf3242bd9147ba7c6e95b09c45e52
src/constants.js
src/constants.js
'use strict'; const isClipMediaRef = { $not: { startTime: 0, endTime: null } } const isClipMediaRefWithTitle = { $not: { startTime: 0, endTime: null }, $not: { title: null }, $not: { title: '' } } module.exports = { isClipMediaRef: isClipMediaRef, isClipMediaRefWithTitle: isClipMediaRefWithTitle }
'use strict'; const isClipMediaRef = { $not: { startTime: 0, endTime: null } } const isClipMediaRefWithTitle = { $not: { startTime: 0, endTime: null }, $and: { $not: { title: null } }, $and: { $not: { title: '' } } } module.exports = { isClipMediaRef: isClipMediaRef, isClipMediaRefWithTitle: isClipMediaRefWithTitle }
Fix broken isClipMediaRefWithTitle for real this time (I think)
Fix broken isClipMediaRefWithTitle for real this time (I think)
JavaScript
agpl-3.0
podverse/podverse-web,podverse/podverse-web,podverse/podverse-web,podverse/podverse-web
c3352aa312e75183b629c3fb7b5948ccf4c2d080
spec/javascripts/reports/components/modal_open_name_spec.js
spec/javascripts/reports/components/modal_open_name_spec.js
import Vue from 'vue'; import Vuex from 'vuex'; import component from '~/reports/components/modal_open_name.vue'; import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; describe('Modal open name', () => { const Component = Vue.extend(component); let vm; const store = new Vuex.Store({ actions: { openModal: () => {}, }, state: {}, mutations: {}, }); beforeEach(() => { vm = mountComponentWithStore(Component, { store, props: { issue: { title: 'Issue', }, status: 'failed', }, }); }); afterEach(() => { vm.$destroy(); }); it('renders the issue name', () => { expect(vm.$el.textContent.trim()).toEqual('Issue'); }); it('calls openModal actions when button is clicked', () => { spyOn(vm, 'openModal'); vm.$el.click(); expect(vm.openModal).toHaveBeenCalled(); }); });
import Vue from 'vue'; import Vuex from 'vuex'; import component from '~/reports/components/modal_open_name.vue'; import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; Vue.use(Vuex); describe('Modal open name', () => { const Component = Vue.extend(component); let vm; const store = new Vuex.Store({ actions: { openModal: () => {}, }, state: {}, mutations: {}, }); beforeEach(() => { vm = mountComponentWithStore(Component, { store, props: { issue: { title: 'Issue', }, status: 'failed', }, }); }); afterEach(() => { vm.$destroy(); }); it('renders the issue name', () => { expect(vm.$el.textContent.trim()).toEqual('Issue'); }); it('calls openModal actions when button is clicked', () => { spyOn(vm, 'openModal'); vm.$el.click(); expect(vm.openModal).toHaveBeenCalled(); }); });
Add missing Vue.use in test
Add missing Vue.use in test
JavaScript
mit
stoplightio/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq
0aeefb8fb3b8e58f7312323aab397f622b251013
tests/local_protractor.conf.js
tests/local_protractor.conf.js
exports.config = { // Locally, we should just use the default standalone Selenium server // In Travis, we set up the Selenium serving via Sauce Labs // Tests to run specs: [ './protractor/**/*.spec.js' ], // Capabilities to be passed to the webdriver instance // For a full list of available capabilities, see https://code.google.com/p/selenium/wiki/DesiredCapabilities capabilities: { 'browserName': 'firefox', }, // Calls to protractor.get() with relative paths will be prepended with the baseUrl baseUrl: 'http://localhost:3030/tests/protractor/', // Selector for the element housing the angular app rootElement: 'body', // Options to be passed to minijasminenode jasmineNodeOpts: { // onComplete will be called just before the driver quits. onComplete: null, // If true, display spec names. isVerbose: true, // If true, print colors to the terminal. showColors: true, // If true, include stack traces in failures. includeStackTrace: true, // Default time to wait in ms before a test fails. defaultTimeoutInterval: 20000 } };
exports.config = { // Locally, we should just use the default standalone Selenium server // In Travis, we set up the Selenium serving via Sauce Labs // Tests to run specs: [ './protractor/**/*.spec.js' ], // Capabilities to be passed to the webdriver instance // For a full list of available capabilities, see https://code.google.com/p/selenium/wiki/DesiredCapabilities capabilities: { 'browserName': 'chrome', }, // Calls to protractor.get() with relative paths will be prepended with the baseUrl baseUrl: 'http://localhost:3030/tests/protractor/', // Selector for the element housing the angular app rootElement: 'body', // Options to be passed to minijasminenode jasmineNodeOpts: { // onComplete will be called just before the driver quits. onComplete: null, // If true, display spec names. isVerbose: true, // If true, print colors to the terminal. showColors: true, // If true, include stack traces in failures. includeStackTrace: true, // Default time to wait in ms before a test fails. defaultTimeoutInterval: 20000 } };
Change e2e tests back to running on Chrome
Change e2e tests back to running on Chrome
JavaScript
mit
denisKaranja/angularfire,douglascorrea/angularfire,jamestalmage/angularfire,fbentz/angularfire,fbentz/angularfire,FirebaseExtended/angularfire,FirebaseExtended/angularfire,nbr1ninrsan2/angularfire,bpietravalle/angularfire,FirebaseExtended/angularfire,yoda-yoda/angularfire,cesarmarinhorj/angularfire,bpietravalle/angularfire,yoda-yoda/angularfire,itxd/angularfire,cesarmarinhorj/angularfire,yoda-yoda/angularfire,cesarmarinhorj/angularfire,fbentz/angularfire,nbr1ninrsan2/angularfire,nbr1ninrsan2/angularfire,bpietravalle/angularfire,denisKaranja/angularfire,itxd/angularfire,douglascorrea/angularfire,jamestalmage/angularfire,douglascorrea/angularfire,itxd/angularfire,denisKaranja/angularfire,jamestalmage/angularfire
06cea187980cd50fd4699e689b4191ffb2a4d9fc
src/modules/__specs__/AppView.spec.js
src/modules/__specs__/AppView.spec.js
/*eslint-disable max-nested-callbacks*/ import React from 'react'; import {shallow} from 'enzyme'; import {describe, it} from 'mocha'; import {expect} from 'chai'; import Spinner from 'react-native-gifted-spinner'; import AppView from '../AppView'; describe('<AppView />', () => { describe('isReady', () => { it('should render a <Spinner /> if not ready', () => { const fn = () => {}; const wrapper = shallow( <AppView isReady={false} isLoggedIn={false} dispatch={fn} /> ); expect(wrapper.find(Spinner)).to.have.lengthOf(1); }); it('should not render a <Spinner /> if ready', () => { const fn = () => {}; const wrapper = shallow( <AppView isReady={true} isLoggedIn={false} dispatch={fn} /> ); expect(wrapper.find(Spinner)).to.have.lengthOf(0); }); }); });
/*eslint-disable max-nested-callbacks*/ import React from 'react'; import {shallow} from 'enzyme'; import {describe, it} from 'mocha'; import {expect} from 'chai'; import {ActivityIndicator} from 'react-native'; import AppView from '../AppView'; describe('<AppView />', () => { describe('isReady', () => { it('should render a <ActivityIndicator /> if not ready', () => { const fn = () => {}; const wrapper = shallow( <AppView isReady={false} isLoggedIn={false} dispatch={fn} /> ); expect(wrapper.find(ActivityIndicator)).to.have.lengthOf(1); }); it('should not render a <ActivityIndicator /> if ready', () => { const fn = () => {}; const wrapper = shallow( <AppView isReady={true} isLoggedIn={false} dispatch={fn} /> ); expect(wrapper.find(ActivityIndicator)).to.have.lengthOf(0); }); }); });
Fix AppView test to render activity indicator
Fix AppView test to render activity indicator
JavaScript
mit
WWCJSBoulder/DWClient,justinhaaheim/empower-app,BrianJVarley/simple-offset-pro,salokas/barcodebar,ming-cho/react-native-demo,AcademyPgh/Y1S2-ReplayFX-Schedule,keyifadami/CrewCrossCheck,mandlamag/ESXApp,ming-cho/react-native-demo,yogakurniawan/phoney-mobile,mandlamag/ESXApp,apoi/kahvi,WWCJSBoulder/DWClient,chriswohlfarth/mojifi-app,justinhaaheim/empower-app,chriswohlfarth/mojifi-app,mandlamag/ESXApp,keyifadami/CrewCrossCheck,ericmasiello/TrailReporter,justinhaaheim/empower-app,dominictracey/hangboard,3vangelos/reshout,3vangelos/reshout,AcademyPgh/Y1S2-ReplayFX-Schedule,justinhaaheim/empower-app,dominictracey/hangboard,3vangelos/reshout,fabriziomoscon/pepperoni-app-kit,yogakurniawan/phoney-mobile,keyifadami/CrewCrossCheck,salokas/barcodebar,3vangelos/reshout,AcademyPgh/Y1S2-ReplayFX-Schedule,salokas/barcodebar,keyifadami/CrewCrossCheck,apoi/kahvi,BrianJVarley/simple-offset-pro,keyifadami/CrewCrossCheck,Florenz23/sangoo_04,BrianJVarley/simple-offset-pro,fabriziomoscon/pepperoni-app-kit,Florenz23/sangoo_04,mandlamag/ESXApp,ericmasiello/TrailReporter,ming-cho/react-native-demo,Florenz23/sangoo_04,chriswohlfarth/mojifi-app,yogakurniawan/phoney-mobile,mandlamag/ESXApp,fabriziomoscon/pepperoni-app-kit,apoi/kahvi,fabriziomoscon/pepperoni-app-kit,apoi/kahvi,dominictracey/hangboard,ericmasiello/TrailReporter,chriswohlfarth/mojifi-app,BrianJVarley/simple-offset-pro,ming-cho/react-native-demo,dominictracey/hangboard,Florenz23/sangoo_04,yogakurniawan/phoney-mobile,ericmasiello/TrailReporter,AcademyPgh/Y1S2-ReplayFX-Schedule,3vangelos/reshout,chriswohlfarth/mojifi-app,ming-cho/react-native-demo,WWCJSBoulder/DWClient,justinhaaheim/empower-app,apoi/kahvi,salokas/barcodebar,dominictracey/hangboard,ericmasiello/TrailReporter,fabriziomoscon/pepperoni-app-kit,AcademyPgh/Y1S2-ReplayFX-Schedule,WWCJSBoulder/DWClient
e986ee873dd62c0c333aa7530a1753cef09af39f
chartflo/templates/dashboards/app.js
chartflo/templates/dashboards/app.js
function loadDashboard(page, dashboard) { var url = "/dashboards/page/"+dashboard+"/"+page+"/"; console.log("Getting", url); var spinner = '<div class="text-center" style="width:100%;margin-top:5em;opacity:0.6">'; spinner = spinner + '<i class="fa fa-spinner fa-spin fa-5x fa-fw"></i>\n</div>'; $("#content").html(spinner); axios.get(url).then(function (response) { $('#content').html(response.data); }).catch(function (error) { console.log(error); }); $(".sparkline-embeded").each(function () { var $this = $(this); $this.sparkline('html', $this.data()); }); } $(document).ready(function () { loadDashboard("index", "{{ dashboard }}"); $(".sparkline").each(function () { var $this = $(this); $this.sparkline('html', $this.data()); }); });
function loadDashboard(page, dashboard, destination) { var url = "/dashboards/page/"+dashboard+"/"+page+"/"; console.log("Getting", url); var spinner = '<div class="text-center" style="width:100%;margin-top:5em;opacity:0.6">'; spinner = spinner + '<i class="fa fa-spinner fa-spin fa-5x fa-fw"></i>\n</div>'; if ( destination === undefined) { destination = "#content" } $(destination).html(spinner); axios.get(url).then(function (response) { $(destination).html(response.data); }).catch(function (error) { console.log(error); }); $(".sparkline-embeded").each(function () { //console.log("LOAD"); var $this = $(this); $this.sparkline('html', $this.data()); console.log($this.data()) }); } $(document).ready(function () { loadDashboard("index", "{{ dashboard }}"); $(".sparkline").each(function () { //console.log("INIT"); var $this = $(this); $this.sparkline('html', $this.data()); console.log($this.data()) }); });
Improve the js pages loading function
Improve the js pages loading function
JavaScript
mit
synw/django-chartflo,synw/django-chartflo,synw/django-chartflo
5deb018244d0a06f6d3feccb21b1c0e26864321d
app/controllers/application.js
app/controllers/application.js
import Em from 'ember'; import { task, timeout } from 'ember-concurrency'; const { computed } = Em; var applicationController = Em.Controller.extend({ activeNote: null, hideSidePanel: false, init: function() { Em.run.scheduleOnce('afterRender', () => { $('body div').first().addClass('app-container'); }); }, // data sortedNotes: computed('model.[]', 'model.@each.updatedAt', function() { return this.get('model').sortBy('updatedAt', 'createdAt').reverseObjects(); }), deleteNoteTask: task(function *(note) { yield timeout(150); this.get('model').removeObject(note); if (Em.isEmpty(this.get('model'))) { this.send('createNote'); } else { this.send('showNote', this.get('sortedNotes.firstObject')); } yield note.destroyRecord(); }).drop(), actions: { createNote: function() { this.transitionToRoute('new'); }, deleteNote: function(note) { this.get('deleteNoteTask').perform(note); // this.get('model').removeObject(note); // if (Em.isEmpty(this.get('model'))) { // this.send('createNote'); // } else { // this.send('showNote', this.get('model.lastObject')); // } // note.destroyRecord(); }, // deleteAll: function() { // this.get('notes').forEach(function(note) { // note.destroyRecord(); // }); // }, toggleSidePanelHidden: function() { this.toggleProperty('hideSidePanel'); } } }); export default applicationController;
import Em from 'ember'; import { task, timeout } from 'ember-concurrency'; const { computed } = Em; var applicationController = Em.Controller.extend({ activeNote: null, hideSidePanel: false, init: function() { Em.run.scheduleOnce('afterRender', () => { $('body div').first().addClass('app-container'); }); }, // data sortedNotes: computed('model.[]', 'model.@each.updatedAt', function() { return this.get('model').sortBy('updatedAt', 'createdAt').reverseObjects(); }), deleteNote: task(function *(note) { yield timeout(150); this.get('model').removeObject(note); if (Em.isEmpty(this.get('model'))) { this.send('createNote'); } else { this.send('showNote', this.get('sortedNotes.firstObject')); } yield note.destroyRecord(); }).drop(), actions: { createNote() { this.transitionToRoute('new'); }, deleteNote(note) { this.get('deleteNote').perform(note); }, signOut() { this.get('session').close().then(()=> { this.transitionToRoute('signin'); }); }, toggleSidePanelHidden() { this.toggleProperty('hideSidePanel'); } } }); export default applicationController;
Include a `signOut` action. Make `deleteNote` an e-c task. ES6-ify some function syntax.
Include a `signOut` action. Make `deleteNote` an e-c task. ES6-ify some function syntax.
JavaScript
mit
ddoria921/Notes,ddoria921/Notes
82544193853cd0988ee2536d134d1fa451d8fbb4
day3/solution.js
day3/solution.js
let input = require("fs").readFileSync("./data").toString(); let santaPosition = [0, 0]; let roboSantaPosition = [0, 0]; let uniqueSantaPositions = []; function updateUniquePositions() { if (uniqueSantaPositions.indexOf(santaPosition.toString()) === -1) { uniqueSantaPositions.push(santaPosition.toString()); } if (uniqueSantaPositions.indexOf(roboSantaPosition.toString()) === -1) { uniqueSantaPositions.push(roboSantaPosition.toString()); } } updateUniquePositions(); input.split("").forEach((char, index) => { let currentSantaPos = index % 2 === 0 ? santaPosition : roboSantaPosition; // Part 2 if (char === "^") { currentSantaPos[1]++; } else if (char === "v") { currentSantaPos[1]--; } else if (char === ">") { currentSantaPos[0]++; } else if (char === "<") { currentSantaPos[0]--; } updateUniquePositions(); }); console.log("Houses with at least one present:", uniqueSantaPositions.length);
let input = require("fs").readFileSync("./data").toString(); let santaPosition = [0, 0]; let roboSantaPosition = [0, 0]; let uniqueSantaPositions = []; function updateUniquePositions() { let santaPositionStr = santaPosition.toString(); let roboSantaPositionStr = roboSantaPosition.toString(); if (uniqueSantaPositions.indexOf(santaPositionStr) === -1) { uniqueSantaPositions.push(santaPositionStr); } if (uniqueSantaPositions.indexOf(roboSantaPositionStr) === -1) { uniqueSantaPositions.push(roboSantaPositionStr); } } updateUniquePositions(); input.split("").forEach((char, index) => { let currentSantaPos = index % 2 === 0 ? santaPosition : roboSantaPosition; // Part 2 if (char === "^") { currentSantaPos[1]++; } else if (char === "v") { currentSantaPos[1]--; } else if (char === ">") { currentSantaPos[0]++; } else if (char === "<") { currentSantaPos[0]--; } updateUniquePositions(); }); console.log("Houses with at least one present:", uniqueSantaPositions.length);
Move toString conversions to only happen once.
Move toString conversions to only happen once.
JavaScript
mit
Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015
1856ce1b2b89d3d708f38e7bde323446864646c9
js/game.js
js/game.js
class Dice extends React.Component { constructor() { super(); this.state = { value: '', words: this.parseInput(decodeURIComponent(location.search.substring(5))), div: document.createElement("div") }; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } parseInput(input) { return input.split('\n\r').map(x => x.split('\n').filter(Boolean)); } handleChange(event) { this.setState({value: event.target.value}); } createChild(text) { var p = document.createElement("p"); p.appendChild(document.createTextNode(text)); return p; } handleSubmit() { var div = this.state.div; while (div.hasChildNodes()) { div.removeChild(div.lastChild); } var words = this.state.words; for(var i = 0; i < words.length; i++) { var random = words[i][Math.floor(Math.random()*(words.length-1))]; div.appendChild(this.createChild(random)); } document.body.appendChild(div); } render() { return ( <div> <input type="button" value="Throw dice" onClick={this.handleSubmit}/> </div> ); } } ReactDOM.render( <Dice />, document.getElementById('root') );
class Dice extends React.Component { constructor() { super(); this.state = { words: this.parseInput(decodeURIComponent(location.search.substring(5))), div: document.createElement("div") }; this.handleSubmit = this.handleSubmit.bind(this); } parseInput(input) { return input.split('\n\r').map(x => x.split('\n').filter(Boolean)); } image(word) { } appendWord(text) { var p = document.createElement("p"); p.appendChild(document.createTextNode(text)); return p; } appendImg(src) { var img = document.createElement("img"); img.className = 'img'; img.src = random; } handleSubmit() { var div = this.state.div; while (div.hasChildNodes()) { div.removeChild(div.lastChild); } var words = this.state.words; for(var i = 0; i < words.length; i++) { var random = words[i][Math.floor(Math.random()*(words.length-1))]; if (this.image(random)) { div.appendChild(this.appendImg(random)); } else { div.appendChild(this.appendWord(random)); } } document.body.appendChild(div); } render() { return ( <div> <input type="button" value="Throw dice" onClick={this.handleSubmit}/> </div> ); } } ReactDOM.render( <Dice />, document.getElementById('root') );
Add function to append img on the page
Add function to append img on the page
JavaScript
mit
testlnord/wurfelspiel,testlnord/wurfelspiel,testlnord/wurfelspiel
dbe567f5ce926657ecca94b48ab32666777ecffd
app/js/app.js
app/js/app.js
var app = angular.module('plugD', [ 'angularUtils.directives.dirPagination' ]); app.controller("PluginController",function(){ }); app.directive("pluginList", ['$http',function($http){ return { restrict:"E", templateUrl:"partials/plugin-list.html", controller: function($http){ var self = this; self.filter = {gmod:"", term:"", perPage:5}; self.sortKey = "name"; self.order ='+'; $http.get('api/plugins.json') .then(function(data){ self.plugins = data; }, function(data){ // todo: error }); }, controllerAs:"plug" } }]);
var app = angular.module('plugD', [ 'angularUtils.directives.dirPagination' ]); app.controller("PluginController",function(){ }); app.directive("pluginList", ['$http',function($http){ return { restrict:"E", templateUrl:"partials/plugin-list.html", controller: function($http){ var self = this; self.filter = {gmod:"", term:"", perPage:5}; self.sortKey = "name"; self.order ='+'; $http.get('api/plugins.json') .then(function(data){ self.plugins = data:data; }, function(data){ // todo: error }); }, controllerAs:"plug" } }]);
Use inner data array of response
Use inner data array of response
JavaScript
bsd-2-clause
vivekkrish/jbrowse-registry,GMOD/jbrowse-registry,vivekkrish/jbrowse-registry,vivekkrish/jbrowse-registry,GMOD/jbrowse-registry,GMOD/jbrowse-registry,GMOD/jbrowse-registry
212033e54f0d4729b0ade59aaaad19074b388cc0
server/main.js
server/main.js
import { Meteor } from 'meteor/meteor'; import { handleMigration } from './migrations'; Meteor.startup(() => { handleMigration(); });
import { Meteor } from 'meteor/meteor'; import { handleMigration } from './migrations'; import '/imports/minutes'; import '/imports/meetingseries'; Meteor.startup(() => { handleMigration(); });
Fix meteor method not found error by initializing meteor methods on the server
Fix meteor method not found error by initializing meteor methods on the server
JavaScript
mit
RobNeXX/4minitz,Huggle77/4minitz,RobNeXX/4minitz,RobNeXX/4minitz,4minitz/4minitz,Huggle77/4minitz,4minitz/4minitz,Huggle77/4minitz,4minitz/4minitz
08517b8cc97af75922ad40704fc333bdd0cba5fa
test/src/main.js
test/src/main.js
requirejs.config({ baseUrl: 'test', paths: { pvcf: '../../lib/pvcf', when: '../test/vendor/when/when', node: '../test/vendor/when/node', callbacks: '../test/vendor/when/callbacks' } }); requirejs(['pvcf'], function run(pvcf) { var definitions = pvcf.definitions; var ViewDefinition = definitions.ViewDefinition; var TabManager = pvcf.TabManager; // ### View list. ### // # Events # var addEvent = new ViewDefinition('test/templates/addEvent.html', ['test/modules/addEvent.js'], true); // # Tab manager # var tabManager = new TabManager(); var startTab = tabManager.openTab(); startTab.openView(addEvent).done(function () { tabManager.closeTab(startTab); }); tabManager.getContainerElement().appendChild(startTab.getContainerElement()); document.body.appendChild(tabManager.getContainerElement()); });
requirejs.config({ baseUrl: 'test', paths: { pvcf: '../../lib/pvcf', when: '../test/vendor/when/when', node: '../test/vendor/when/node', callbacks: '../test/vendor/when/callbacks' } }); requirejs(['pvcf'], function run(pvcf) { var definitions = pvcf.definitions; var ViewDefinition = definitions.ViewDefinition; var PatternDefinition = definitions.PatternDefinition; var PatternManager = pvcf.PatternManager; var TabManager = pvcf.TabManager; // ### View list ### // # Events # var addEvent = new ViewDefinition('test/templates/addEvent.html', ['test/modules/addEvent.js'], true); var showEvent = new ViewDefinition('test/templates/showEvent.html', ['test/modules/showEvent.js'], true); // # Pattern manager # var patternManager = new PatternManager(); // ### Pattern list ### patternManager.addPattern(new PatternDefinition('event/add', addEvent)); patternManager.addPattern(new PatternDefinition('event/show/:id', showEvent)); // # Tab manager # var tabManager = new TabManager(); document.body.appendChild(tabManager.getContainerElement()); function main() { console.log('Appliaction started!'); } // window.onload actions: var startTab = tabManager.openTab(); startTab.openView(addEvent).done(function () { tabManager.closeTab(startTab); }); tabManager.getContainerElement().appendChild(startTab.getContainerElement()); main(); // window.hashchange actions: window.addEventListener('hashchange', main); });
Extend initialize layer by pattern manager.
Extend initialize layer by pattern manager.
JavaScript
mit
rootsher/pvcf,rootsher/pvcf,rootsher/pvcf
3f90b18a50479eff488ee86fa64a2cc0412716b9
http/code.js
http/code.js
var runScraper = function() { $(this).attr('disabled', true) $(this).addClass('loading').html('Scraping&hellip;') var stocks = $('#stocks_input').val() var escaped_stocks = scraperwiki.shellEscape(stocks) scraperwiki.exec('python tool/pandas_finance.py ' + escaped_stocks, getStocksSuccess) } var getStocksSuccess = function(data) { $('#submitBtn').attr('disabled', false) if (data.indexOf('File "tool/pandas_finance.py"') != -1) { scraperwiki.alert('Error in pandas_finance.py', data, true) $('#submitBtn').removeClass('loading').html('<i class="icon-remove"></i> Error') $('#submitBtn').removeClass('btn-primary').addClass('btn-danger') setTimeout(function() { $('#submitBtn').html('Get Stocks') $('#submitBtn').removeClass('btn-danger').addClass('btn-primary') }, 4000) } else { $('#submitBtn').removeClass('loading').html('<i class="icon-ok"></i> Done') scraperwiki.tool.redirect("/dataset/" + scraperwiki.box) } } $(function() { $('#submitBtn').on('click', runScraper) })
var param_from_input = function(css) { return scraperwiki.shellEscape($(css).val()) } var runScraper = function() { $(this).attr('disabled', true) $(this).addClass('loading').html('Scraping&hellip;') var stocks = param_from_input('#stocks_input') var start_date = param_from_input('#start-date') var end_date = param_from_input('#end-date') var command = ['python tool/pandas_finance.py', stocks, start_date, end_date].join(' ') scraperwiki.exec(command, getStocksSuccess) } var getStocksSuccess = function(data) { $('#submitBtn').attr('disabled', false) if (data.indexOf('File "tool/pandas_finance.py"') != -1) { scraperwiki.alert('Error in pandas_finance.py', data, true) $('#submitBtn').removeClass('loading').html('<i class="icon-remove"></i> Error') $('#submitBtn').removeClass('btn-primary').addClass('btn-danger') setTimeout(function() { $('#submitBtn').html('Get Stocks') $('#submitBtn').removeClass('btn-danger').addClass('btn-primary') }, 4000) } else { $('#submitBtn').removeClass('loading').html('<i class="icon-ok"></i> Done') scraperwiki.tool.redirect("/dataset/" + scraperwiki.box) } } $(function() { $('#submitBtn').on('click', runScraper) })
Send command with date range from web UI.
Send command with date range from web UI.
JavaScript
agpl-3.0
scraperwiki/stock-tool,scraperwiki/stock-tool
a8cb21f70f884c5b854b54f1de85d993ef687aaf
index.ios.js
index.ios.js
let React = require('react-native'); let { AppRegistry, StyleSheet, Text, View, StatusBarIOS } = React; class Meowth extends React.Component { componentWillMount() { StatusBarIOS.setStyle('light-content'); } render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome to Meowth </Text> <Text style={styles.instructions}> Subtitle </Text> </View> ); } } var styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#084265', }, welcome: { color: '#F5FCFF', fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#CCCCCC', marginBottom: 5, }, }); AppRegistry.registerComponent('meowth', () => Meowth);
let React = require('react-native'); let FreshSetup = require('./src/FreshSetup'); let { AppRegistry, NavigatorIOS, StatusBarIOS, StyleSheet, } = React; class Meowth extends React.Component { componentWillMount() { StatusBarIOS.setStyle('light-content'); } render() { return ( <NavigatorIOS style={styles.container} initialRoute={{ component: FreshSetup, title: 'Welcome', backButtonTitle: 'Back', passProps: { pageId: 'welcome', } }} barTintColor="#084265" tintColor="#ffffff" titleTextColor="#ffffff" /> ); } } var styles = StyleSheet.create({ container: { flex: 1, }, }); AppRegistry.registerComponent('meowth', () => Meowth);
Add router navigation Externalise main component to a separate file
Add router navigation Externalise main component to a separate file
JavaScript
apache-2.0
yrezgui/meowth-ios
8f17182642f52022ed2664f7232dac5218302e02
gateways/paypal_express/script.js
gateways/paypal_express/script.js
(function() { /***********************************************************/ /* Handle Proceed to Payment /***********************************************************/ jQuery(function() { jQuery(document).on('proceedToPayment', function(event, ShoppingCart) { if (ShoppingCart.gateway != 'paypal_express') { return; } var order = { products: storejs.get('grav-shoppingcart-basket-data'), data: storejs.get('grav-shoppingcart-checkout-form-data'), shipping: storejs.get('grav-shoppingcart-shipping-method'), payment: 'paypal', token: storejs.get('grav-shoppingcart-order-token').token, amount: ShoppingCart.totalOrderPrice.toString(), gateway: ShoppingCart.gateway }; jQuery.ajax({ url: ShoppingCart.settings.baseURL + ShoppingCart.settings.urls.save_order_url + '?task=preparePayment', data: order, type: 'POST' }) .success(function(redirectUrl) { ShoppingCart.clearCart(); window.location = redirectUrl; }) .error(function() { alert('Payment not successful. Please contact us.'); }); }); }); })();
(function() { /***********************************************************/ /* Handle Proceed to Payment /***********************************************************/ jQuery(function() { jQuery(document).on('proceedToPayment', function(event, ShoppingCart) { if (ShoppingCart.gateway != 'paypal_express') { return; } var order = { products: storejs.get('grav-shoppingcart-basket-data'), data: storejs.get('grav-shoppingcart-checkout-form-data'), shipping: storejs.get('grav-shoppingcart-shipping-method'), payment: 'paypal', token: storejs.get('grav-shoppingcart-order-token').token, amount: ShoppingCart.totalOrderPrice.toString(), gateway: ShoppingCart.gateway }; jQuery.ajax({ url: ShoppingCart.settings.baseURL + ShoppingCart.settings.urls.save_order_url + '/task:preparePayment', data: order, type: 'POST' }) .success(function(redirectUrl) { ShoppingCart.clearCart(); window.location = redirectUrl; }) .error(function() { alert('Payment not successful. Please contact us.'); }); }); }); })();
Use new structure for 2.0
Use new structure for 2.0
JavaScript
mit
flaviocopes/grav-plugin-shoppingcart-paypal,flaviocopes/grav-plugin-shoppingcart-paypal
495d7a008b1621531cdf39f2d74ac22aee42deac
both/routes/authenticated.js
both/routes/authenticated.js
const authenticatedRoutes = FlowRouter.group({ name: 'authenticated' }); authenticatedRoutes.route( '/', { name: 'index', action() { BlazeLayout.render( 'default', { yield: 'index' } ); } }); authenticatedRoutes.route( '/dashboard', { name: 'dashboard', action() { BlazeLayout.render( 'default', { yield: 'dashboard' } ); } }); authenticatedRoutes.route('/wish-detail/:_id', { name: 'wishDetail', action() { BlazeLayout.render( 'default', { yield: 'wishDetail' } ); } });
const authenticatedRoutes = FlowRouter.group({ name: 'authenticated' }); authenticatedRoutes.route( '/', { name: 'index', action() { BlazeLayout.render( 'default', { yield: 'index' } ); } }); authenticatedRoutes.route( '/dashboard', { name: 'dashboard', action() { BlazeLayout.render( 'default', { yield: 'dashboard' } ); } }); authenticatedRoutes.route('/wish/:_id', { name: 'wishDetail', action() { BlazeLayout.render( 'default', { yield: 'wishDetail' } ); } }); authenticatedRoutes.route('/wish/new', { name: 'wishNew', action() { BlazeLayout.render( 'default', { yield: 'wishNew' } ); } });
Refactor wish-detail -> wish, added new route: wishNew.
Refactor wish-detail -> wish, added new route: wishNew.
JavaScript
mit
lnwKodeDotCom/WeWish,lnwKodeDotCom/WeWish
d0c02bdfc462c2f8bc748e44ce3f5d4552fc58db
background.js
background.js
chrome.webRequest.onBeforeRequest.addListener( (details) => { chrome.tabs.sendMessage(details.tabId, { content: "message" }, () => {}); const startTime = new Date().getTime(); let randNumber; while ((new Date().getTime() - startTime) < 5000) { /* prevent errors on empty fn in loop */ randNumber = Math.random(); } return { cancel: (randNumber + 1) > 0 }; }, { urls: [ "*://*.piguiqproxy.com/*", "*://*.amgload.net/*", "*://*.dsn-fishki.ru/*", "*://*.rcdn.pro/*", "*://*.smcheck.org/*", ] }, ["blocking"] );
chrome.webRequest.onBeforeRequest.addListener( (details) => { chrome.tabs.sendMessage(details.tabId, { content: "message" }, () => {}); const startTime = new Date().getTime(); let randNumber; while ((new Date().getTime() - startTime) < 5000) { /* prevent errors on empty fn in loop */ randNumber = Math.random(); } return { cancel: (randNumber + 1) > 0 }; }, { urls: [ "*://*.piguiqproxy.com/*", "*://*.amgload.net/*", "*://*.dsn-fishki.ru/*", "*://*.rcdn.pro/*", "*://*.smcheck.org/*", "*://*.zmctrack.net/*", ] }, ["blocking"] );
Add new one site to filter
Add new one site to filter
JavaScript
mit
VladReshet/no-ads-forever
ff72938231c463ff7d6ac0eb0b38c229f06e6246
components/Cards/PlaceListingCard/PlaceListingCard.js
components/Cards/PlaceListingCard/PlaceListingCard.js
import React, { PropTypes } from 'react'; import DestinationListingCard from '../DestinationListingCard/DestinationListingCard'; import Badge from '../../Badge/Badge'; import css from './PlaceListingCard.css'; const PlaceListingCard = (props) => { const { name, location, spaceDetail, ...rest, } = props; return ( <DestinationListingCard name={ <span> <Badge className={ css.badge } context="primary" hollow>Place</Badge> { name } </span> } information={ [location, spaceDetail] } { ...rest } /> ); }; PlaceListingCard.propTypes = { name: PropTypes.node, location: PropTypes.node, spaceDetail: PropTypes.node, price: PropTypes.node, priceUnit: PropTypes.node, priceFromLabel: PropTypes.node, }; export default PlaceListingCard;
import React, { PropTypes } from 'react'; import DestinationListingCard from '../DestinationListingCard/DestinationListingCard'; import Badge from '../../Badge/Badge'; import css from './PlaceListingCard.css'; const PlaceListingCard = (props) => { const { name, location, spaceDetail, placeBadgeText, ...rest, } = props; return ( <DestinationListingCard name={ <span> <Badge className={ css.badge } context="primary" hollow>{ placeBadgeText }</Badge> { name } </span> } information={ [location, spaceDetail] } { ...rest } /> ); }; PlaceListingCard.propTypes = { name: PropTypes.node, location: PropTypes.node, spaceDetail: PropTypes.node, placeBadgeText: PropTypes.string, price: PropTypes.node, priceUnit: PropTypes.node, priceFromLabel: PropTypes.node, }; PlaceListingCard.defaultProps = { placeBadgeText: 'Place', }; export default PlaceListingCard;
Allow place badge text to be localised
Allow place badge text to be localised
JavaScript
mit
NGMarmaduke/bloom,appearhere/bloom,NGMarmaduke/bloom,rdjpalmer/bloom,appearhere/bloom,rdjpalmer/bloom,appearhere/bloom,rdjpalmer/bloom,NGMarmaduke/bloom
2eacea5fc28a1edb0cc18319a32267cd6841aa7e
src/handler.js
src/handler.js
'use strict'; const dirs = { M1A: 'M1 → Kabaty', M1B: 'M1 → Młociny', M2A: 'M2 → Dworzec Wileński', M2B: 'M2 → Rondo Daszyńskiego', }; export default { onGetSchedules: function(res) { print( res.schedule.reduce( getDirections, dirs)); }, }; function print(dirs) { console.log( 'dirs = ' + JSON.stringify(dirs, null, 2)); } function getDirections(seq, cur) { return Object.assign( seq, ...cur.routes.map( route => getDirectionsForLine(cur.id, route))); } function getDirectionsForLine(id, route) { return { [id + route.dir]: id + ' → ' + route.end.name, }; }
'use strict'; const dirs = { M1A: 'M1 → Kabaty', M1B: 'M1 → Młociny', M2A: 'M2 → Dworzec Wileński', M2B: 'M2 → Rondo Daszyńskiego', }; export default { onGetSchedules: function(res) { print( res.schedule.reduce( getDirections, dirs)); }, }; function print(dirs) { console.log( 'dirs = ' + JSON.stringify(dirs, null, 2) + ';'); } function getDirections(seq, cur) { return Object.assign( seq, ...cur.routes.map( route => getDirectionsForLine(cur.id, route))); } function getDirectionsForLine(id, route) { return { [id + route.dir]: id + ' → ' + route.end.name, }; }
Add a trailing semicolon to the output
Add a trailing semicolon to the output
JavaScript
isc
stasm/get-ztm-dirs
b33be185ba08eef310536b73278aec60a1a3c3db
test/mock-xhr.js
test/mock-xhr.js
function MockXHR() { this.method = null this.url = null this.data = null this.headers = {} this.readyState = 0 this.status = 0 this.responseText = null } MockXHR.responses = {} MockXHR.prototype.open = function(method, url) { this.method = method this.url = url } MockXHR.prototype.setRequestHeader = function (name, value) { this.headers[name] = value } var origin = (function() { var link = document.createElement('a') link.href = '/' return link.href })() MockXHR.prototype.send = function(data) { this.data = data var xhr = this setTimeout(function() { var path = xhr.url.replace(origin, '/') var handle = MockXHR.responses[path] if (handle) { handle(xhr) } else { console.warn('missing mocked response', path) } }, 100); } MockXHR.prototype.respond = function(status, body) { this.readyState = 4 this.status = status this.responseText = body var event = {} this.onload(event) } MockXHR.prototype.abort = function() { // Do nothing. } MockXHR.prototype.slow = function() { var event = {} this.ontimeout(event) } MockXHR.prototype.error = function() { var event = {} this.onerror(event) }
function MockXHR() { this.method = null this.url = null this.data = null this.headers = {} this.readyState = 0 this.status = 0 this.responseText = null } MockXHR.responses = {} MockXHR.prototype.open = function(method, url) { this.method = method this.url = url } MockXHR.prototype.setRequestHeader = function (name, value) { this.headers[name] = value } var origin = (function() { var link = document.createElement('a') link.href = '/' return link.href })() MockXHR.prototype.send = function(data) { this.data = data var xhr = this setTimeout(function() { var path = xhr.url.replace(origin, '/') var handle = MockXHR.responses[path] if (handle) { handle(xhr) } else { throw 'missing mocked response: ' + path } }, 100); } MockXHR.prototype.respond = function(status, body) { this.readyState = 4 this.status = status this.responseText = body var event = {} this.onload(event) } MockXHR.prototype.abort = function() { // Do nothing. } MockXHR.prototype.slow = function() { var event = {} this.ontimeout(event) } MockXHR.prototype.error = function() { var event = {} this.onerror(event) }
Throw instead of console for linter
Throw instead of console for linter
JavaScript
mit
github/include-fragment-element,github/include-fragment-element
dccdf983e68961fd3cd6d87bd207dc7deb02086b
app/assets/javascripts/tinymce/plugins/uploadimage/plugin.js
app/assets/javascripts/tinymce/plugins/uploadimage/plugin.js
(function() { tinymce.PluginManager.requireLangPack('uploadimage'); tinymce.create('tinymce.plugins.UploadImage', { UploadImage: function(ed, url) { var form, iframe, win, editor = ed; function showDialog() { this.win = editor.windowManager.open({ width: 350 + parseInt(editor.getLang('uploadimage.delta_width', 0), 10), height: 180 + parseInt(editor.getLang('uploadimage.delta_height', 0), 10), url: url + '/dialog.html', }, { plugin_url: url }); } ed.addButton('uploadimage', { title: ed.translate('Insert an image from your computer'), onclick: showDialog, image: url + '/img/uploadimage.png', stateSelector: 'img[data-mce-uploadimage]' }); } }); tinymce.PluginManager.add('uploadimage', tinymce.plugins.UploadImage); })();
(function() { tinymce.PluginManager.requireLangPack('uploadimage'); tinymce.create('tinymce.plugins.UploadImage', { UploadImage: function(ed, url) { var form, iframe, win, editor = ed; function showDialog() { this.win = editor.windowManager.open({ width: 350 + parseInt(editor.getLang('uploadimage.delta_width', 0), 10), height: 180 + parseInt(editor.getLang('uploadimage.delta_height', 0), 10), url: url + '/dialog.html', }, { plugin_url: url }); } // Add a button that opens a window editor.addButton('uploadimage', { tooltip: ed.translate('Insert an image from your computer'), icon : 'image', onclick: showDialog }); // Adds a menu item to the tools menu editor.addMenuItem('uploadimage', { text: ed.translate('Insert an image from your computer'), icon : 'image', context: 'insert', onclick: showDialog }); } }); tinymce.PluginManager.add('uploadimage', tinymce.plugins.UploadImage); })();
Use the default TinyMCE4 image icon
Use the default TinyMCE4 image icon
JavaScript
mit
dancingbytes/tinymce-rails-imageupload,CraigJZ/tinymce-rails-imageupload-1,dancingbytes/tinymce-rails-imageupload,PerfectlyNormal/tinymce-rails-imageupload,PerfectlyNormal/tinymce-rails-imageupload,PerfectlyNormal/tinymce-rails-imageupload,ekubal/tinymce-rails-imageupload,ekubal/tinymce-rails-imageupload,ekubal/tinymce-rails-imageupload,CraigJZ/tinymce-rails-imageupload-1,dancingbytes/tinymce-rails-imageupload,CraigJZ/tinymce-rails-imageupload-1
1ff8ffaf7cc89670e9aa35745f52a605157bc934
build/webpack.config.js
build/webpack.config.js
/** * ownCloud - Music app * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Pauli Järvinen <pauli.jarvinen@gmail.com> * @copyright 2020 Pauli Järvinen * */ const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ESLintPlugin = require('eslint-webpack-plugin'); module.exports = { mode: 'production', entry: { app: '../js/config/index.js', files_music_player: '../js/embedded/index.js' }, output: { filename: 'webpack.[name].js', path: path.resolve(__dirname, '../js/public'), }, resolve: { alias: { 'angular': path.resolve(__dirname, '../js/vendor/angular'), 'lodash': path.resolve(__dirname, '../js/vendor/lodash'), } }, plugins: [ new MiniCssExtractPlugin({filename: 'webpack.app.css'}), new ESLintPlugin({ files: '../js' }) ], module: { rules: [ { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, 'css-loader', ], }, { test: /\.(png|svg|jpg|gif)$/, use: [ { loader: 'file-loader', options: { outputPath: 'img/' } } ], } ], }, };
/** * ownCloud - Music app * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Pauli Järvinen <pauli.jarvinen@gmail.com> * @copyright 2020 Pauli Järvinen * */ const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ESLintPlugin = require('eslint-webpack-plugin'); module.exports = { mode: 'production', devtool: 'source-map', entry: { app: '../js/config/index.js', files_music_player: '../js/embedded/index.js' }, output: { filename: 'webpack.[name].js', path: path.resolve(__dirname, '../js/public'), }, resolve: { alias: { 'angular': path.resolve(__dirname, '../js/vendor/angular'), 'lodash': path.resolve(__dirname, '../js/vendor/lodash'), } }, plugins: [ new MiniCssExtractPlugin({filename: 'webpack.app.css'}), new ESLintPlugin({ files: '../js' }) ], module: { rules: [ { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, 'css-loader', ], }, { test: /\.(png|svg|jpg|gif)$/, use: [ { loader: 'file-loader', options: { outputPath: 'img/' } } ], } ], }, };
Configure webpack so that `eval` is not used in the development mode
Configure webpack so that `eval` is not used in the development mode Using eval is not allowed by the CSP of newer Nextcloud versions.
JavaScript
agpl-3.0
paulijar/music,owncloud/music,owncloud/music,paulijar/music,paulijar/music,owncloud/music,paulijar/music,owncloud/music,owncloud/music,paulijar/music
d6ed0c7bc74b83ea46887c1afa1da3fd0f7f2481
client/packages/core-app-worona/src/app/settings-app-extension-worona/selectorCreators/index.js
client/packages/core-app-worona/src/app/settings-app-extension-worona/selectorCreators/index.js
import { find } from 'lodash'; export const getSettings = namespace => state => state.settings.collection[namespace]; export const getSetting = (namespace, setting) => state => state.settings.collection[namespace][setting]; export const getSettingById = _id => state => find(state.settings.collection, it => it._id === _id);
import { find } from 'lodash'; export const getSettings = namespace => state => state.settings.collection[namespace]; export const getSetting = (namespace, setting) => state => state.settings.collection[namespace][setting]; export const getSettingsById = _id => state => find(state.settings.collection, item => item._id === _id); export const getSettingById = (_id, setting) => state => find(state.settings.collection, item => item._id === _id)[setting];
Add getSettingById and fix getSettingsById.
Add getSettingById and fix getSettingsById.
JavaScript
mit
worona/worona-app,worona/worona-app
e3fde9655ce25219938afcb8d6aa056adbf1c545
src/components/QuestionForm.js
src/components/QuestionForm.js
import React, {Component} from 'react' import Field from './Field.js' import Select from './Select.js' import Input from './Input.js' import Label from './Label.js' export default class QuestionForm extends Component { handleChange = e => { const {name, value} = e.target this.props.onChange({ [name]: value }) } render() { const { id, number } = this.props.question return ( <form onChange={this.handleChange}> <Field> <Label htmlFor="type">Question Type</Label> <Select id="type" name="type" options={['Text', 'Numeric', 'Multiple - Radio', 'Multiple - Checkbox']} /> </Field> <Field> <Label htmlFor="id">Question ID</Label> <Input value={id} id="id" name="id" /> </Field> <Field> <Label htmlFor="number">Question Number</Label> <Input value={number} id="number" name="number" /> </Field> </form> ) } }
import React, {Component} from 'react' import Field from './Field.js' import Select from './Select.js' import Input from './Input.js' import Label from './Label.js' export default class QuestionForm extends Component { handleChange = e => { const {name, value} = e.target this.props.onChange({ [name]: value }) } render() { const { id, number, title } = this.props.question return ( <form onChange={this.handleChange}> <Field> <Label htmlFor="type">Question Type</Label> <Select id="type" name="type" options={['Text', 'Numeric', 'Multiple - Radio', 'Multiple - Checkbox']} /> </Field> <Field> <Label htmlFor="id">Question ID</Label> <Input value={id} id="id" name="id" /> </Field> <Field> <Label htmlFor="number">Question Number</Label> <Input value={number} id="number" name="number" /> </Field> <Field> <Label htmlFor="title">Question Title</Label> <Input value={title} id="question-title" name="title" /> </Field> <Field> <Label htmlFor="guidance-title">Question Guidance Title</Label> <Input value="" id="question-guidance-title" name="guidance-title" /> </Field> </form> ) } }
Add question title and guidance title fields.
Add question title and guidance title fields.
JavaScript
mit
ONSdigital/eq-author,ONSdigital/eq-author,ONSdigital/eq-author
b0b117554055bb0452c02955965627b00841ca94
packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/reservedNames.js
packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/reservedNames.js
const JS_BUILT_IN_OBJECTS = [ 'object', 'function', 'boolean', 'symbol', 'error', 'infinity', 'number', 'math', 'date', ]; const RESERVED_NAMES = ['admin', 'series', 'file', ...JS_BUILT_IN_OBJECTS]; export default RESERVED_NAMES;
const JS_BUILT_IN_OBJECTS = [ 'boolean', 'date', 'error', 'function', 'infinity', 'map', 'math', 'number', 'object', 'symbol', ]; const RESERVED_NAMES = [ 'admin', 'series', 'file', 'news', ...JS_BUILT_IN_OBJECTS, ]; export default RESERVED_NAMES;
Add map and series to RESERVED_NAMES
Add map and series to RESERVED_NAMES
JavaScript
mit
wistityhq/strapi,wistityhq/strapi
f9f8f7103cef43417a246414c311b2bcdad686c3
src/framework/util/util.js
src/framework/util/util.js
export function attemptChangeName(obj, name) { if (!canRedefineValue(obj, 'name')) { return; } Object.defineProperty(obj, 'name', { value: name, }); } export function canRedefineValue(obj, property) { const descriptor = Object.getOwnPropertyDescriptor(obj, property); return descriptor.configurable || descriptor.writable; } function suicide() { throw new TypeError('This method does not generate any actions. It cannot be called.'); } export function killMethod(providerClass, propertyName) { replaceMethod(providerClass, propertyName, suicide); } export function replaceMethod(clazz, propertyName, replacement) { if (!canRedefineValue(clazz, propertyName)) { throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`); } Object.defineProperty(clazz, propertyName, { value: replacement }); attemptChangeName(replacement, propertyName); }
export function attemptChangeName(obj, name) { if (!canRedefineValue(obj, 'name')) { return; } Object.defineProperty(obj, 'name', { value: name, }); } export function canRedefineValue(obj, property) { const descriptor = Object.getOwnPropertyDescriptor(obj, property); return descriptor.configurable || descriptor.writable; } function suicide() { throw new TypeError('This method cannot be called.'); } Object.freeze(suicide); export function killMethod(Class, propertyName) { replaceMethod(Class, propertyName, suicide); } export function replaceMethod(clazz, propertyName, replacement) { if (!canRedefineValue(clazz, propertyName)) { throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`); } Object.defineProperty(clazz, propertyName, { value: replacement }); attemptChangeName(replacement, propertyName); }
Rename generic methods to use generic names
Rename generic methods to use generic names
JavaScript
mit
foobarhq/reworkjs,reworkjs/reworkjs,reworkjs/reworkjs,reworkjs/reworkjs,foobarhq/reworkjs
9c2f44c60b714ac83ba3a1ca38c0898d4d37e07a
src/helpers.js
src/helpers.js
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; // I know, not technically correct... if (filesize >= 1000000) { size = (filesize / 1000000) + ' megabytes'; } else if (filesize >= 1000) { size = (filesize / 1000) + ' kilobytes'; } else { size = filesize + ' bytes'; } return size; } export async function createFileFromUrl(url) { const response = await fetch(url); const data = await response.blob(); const metadata = {type: data.type}; const filename = url.replace(/\?.+/, '').split('/').pop(); return new File([data], filename, metadata); } export function readFile(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = (event) => { resolve(event?.target?.result); }; reader.onerror = (event) => { reader.abort(); reject(event); }; reader.readAsDataURL(file); }); }
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; if (filesize >= 1048576) { size = (filesize / 1048576) + ' megabytes'; } else if (filesize >= 1024) { size = (filesize / 1024) + ' kilobytes'; } else { size = filesize + ' bytes'; } return size; } export async function createFileFromUrl(url) { const response = await fetch(url); const data = await response.blob(); const metadata = {type: data.type}; const filename = url.replace(/\?.+/, '').split('/').pop(); return new File([data], filename, metadata); } export function readFile(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = (event) => { resolve(event?.target?.result); }; reader.onerror = (event) => { reader.abort(); reject(event); }; reader.readAsDataURL(file); }); }
Use binary system instead of decimal for size error
:bug: Use binary system instead of decimal for size error
JavaScript
mit
Yuvaleros/material-ui-dropzone
594b03ceb00f0ac76ad015a7380a4c9f23903f50
lib/__tests__/ActionCable-test.js
lib/__tests__/ActionCable-test.js
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import { ActionCableProvider, ActionCable } from '../index'; test('ActionCable render without children', () => { const node = shallow( <ActionCableProvider> <ActionCable /> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); }); test('ActionCable render with children', () => { const node = shallow( <ActionCableProvider> <ActionCable> <div>Hello</div> </ActionCable> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); const div = node.find('div') expect(div).to.have.length(1); });
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import Provider, { ActionCableProvider, ActionCable } from '../index'; test('ActionCable render without children', () => { const node = shallow( <ActionCableProvider> <ActionCable /> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); }); test('ActionCable render with children', () => { const node = shallow( <ActionCableProvider> <ActionCable> <div>Hello</div> </ActionCable> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); const div = node.find('div') expect(div).to.have.length(1); }); test('Default exporting ActionCableProvider works', () => { const node = shallow( <Provider> <ActionCable /> </Provider> ); expect(node.find(ActionCable)).to.have.length(1); });
Add test for default exporting ActionCableProvider
Add test for default exporting ActionCableProvider
JavaScript
mit
cpunion/react-actioncable-provider
6f9dcc82d086a79e173338007f984570cfdc3185
webpack.rules.js
webpack.rules.js
module.exports = [ { test: /\.jsx?/, exclude: /node_modules/, loader: 'babel-loader', }, { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, ];
module.exports = [ { test: /\.jsx?/, exclude: /node_modules/, loader: 'babel-loader', }, { test: /\.css$/, use: [ { loader: 'style-loader', }, { loader: 'css-loader', options: { localIdentName: 'rat-[name]_[local]', }, }, ] }, ];
Use more descriptive class names
Use more descriptive class names This will make it easier to add custom styling on top of the default one.
JavaScript
mit
trotzig/react-available-times,trotzig/react-available-times
8067e9fc0de92888653237558213ab8c9298a99b
lib/constants.js
lib/constants.js
'use strict'; var path = require('path'); // #ARCHIVE:0 Eliminate unused config options id:1203 var DEFAULT_EXCLUDE_PATTERN = "^(node_modules|bower_components|\\.imdone|target|build|dist|logs)[\\/\\\\]?|\\.(git|svn|hg|npmignore)|\\~$|\\.(jpg|png|gif|swp|ttf|otf)$"; var CONFIG_DIR = ".imdone"; module.exports = { CONFIG_DIR: CONFIG_DIR, CONFIG_FILE: path.join(CONFIG_DIR,"config.json"), IGNORE_FILE: '.imdoneignore', DEFAULT_FILE_PATTERN: "^(readme\\.md|home\\.md)$", DEFAULT_EXCLUDE_PATTERN: DEFAULT_EXCLUDE_PATTERN, DEFAULT_CONFIG: { exclude: [DEFAULT_EXCLUDE_PATTERN], watcher: true, keepEmptyPriority: false, code: { include_lists:[ "TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE", "HACK", "CHANGED", "XXX", "IDEA", "NOTE", "REVIEW" ] }, lists: [], marked : { gfm: true, tables: true, breaks: false, pedantic: false, smartLists: true, langPrefix: 'language-' } }, ERRORS: { NOT_A_FILE: "file must be of type File", CALLBACK_REQUIRED: "Last paramter must be a callback function" } };
'use strict'; var path = require('path'); // #ARCHIVE:0 Eliminate unused config options id:1203 var DEFAULT_EXCLUDE_PATTERN = "^(node_modules|bower_components|\\.imdone|target|build|dist|logs)[\\/\\\\]?|\\.(git|svn|hg|npmignore)|\\~$|\\.(jpg|png|gif|swp|ttf|otf)$"; var CONFIG_DIR = ".imdone"; module.exports = { CONFIG_DIR: CONFIG_DIR, CONFIG_FILE: path.join(CONFIG_DIR,"config.json"), IGNORE_FILE: '.imdoneignore', DEFAULT_FILE_PATTERN: "^(readme\\.md|home\\.md)$", DEFAULT_EXCLUDE_PATTERN: DEFAULT_EXCLUDE_PATTERN, DEFAULT_CONFIG: { exclude: [DEFAULT_EXCLUDE_PATTERN], watcher: true, keepEmptyPriority: true, code: { include_lists:[ "TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE", "HACK", "CHANGED", "XXX", "IDEA", "NOTE", "REVIEW" ] }, lists: [], marked : { gfm: true, tables: true, breaks: false, pedantic: false, smartLists: true, langPrefix: 'language-' } }, ERRORS: { NOT_A_FILE: "file must be of type File", CALLBACK_REQUIRED: "Last paramter must be a callback function" } };
Change keepEmptyPriority default to true
Change keepEmptyPriority default to true
JavaScript
mit
imdone/imdone-core,imdone/imdone-core
4accf166520646369b2f3e2b2ecf7ee3a158ff0a
client/react/src/App.js
client/react/src/App.js
import React, { Component } from 'react'; import './App.css'; import Table from './Table'; class App extends Component { constructor () { super(); const ws = new WebSocket('ws://localhost:42745/websocket') this.state = { ws: ws } ws.onopen = () => console.log("OPENED") }; login = (event) => { let name = this.nameInput.value if (!name) { console.log("No name supplied"); return } console.log("Logging in as " + name); let msg = { method: "login", name: name } this.state.ws.send(JSON.stringify(msg)) } render() { return ( <div> <div className="App"> <div className="App-header"> <h2>Welcome to Tarabish Online</h2> </div> <div> <input type="text" placeholder="Name" ref={(ref) => this.nameInput = ref} /> <input type="button" value="Login" onClick={this.login} /> </div> <div><Table name="Test Table 1"/></div> </div> </div> ); } } export default App;
import React, { Component } from 'react'; import './App.css'; import Table from './Table'; class App extends Component { constructor () { super(); let ws_url = process.env.REACT_APP_WS_URL if (!ws_url) { const proto = (location.protocol === "https:")? "wss://" : "ws://" ws_url = proto + location.host + "/websocket" } this.ws = new WebSocket(ws_url) this.ws.onopen = () => console.log("OPENED") }; login = (event) => { let name = this.nameInput.value if (!name) { console.log("No name supplied"); return } console.log("Logging in as " + name); let msg = { method: "login", name: name } this.ws.send(JSON.stringify(msg)) } render() { return ( <div> <div className="App"> <div className="App-header"> <h2>Welcome to Tarabish Online</h2> </div> <div> <input type="text" placeholder="Name" ref={(ref) => this.nameInput = ref} /> <input type="button" value="Login" onClick={this.login} /> </div> <div><Table name="Test Table 1"/></div> </div> </div> ); } } export default App;
Make the WS URL configurable
Make the WS URL configurable Also store it outside of the state.
JavaScript
mit
KenMacD/tarabish,KenMacD/tarabish,KenMacD/tarabish,KenMacD/tarabish
ef05e8d694820d3638a01139320d447deb335918
resources/assets/js/util/url.js
resources/assets/js/util/url.js
import { router, stringifyQuery, parseQuery } from '../router'; const defaultQuery = { 'x-access-from': 'ui' }; function normalize(url) { const urlLocation = new URL(url, /^\//.test(url) ? location.origin : undefined); const query = { ...parseQuery(urlLocation.search), ...defaultQuery, }; return urlLocation.pathname + stringifyQuery(query); } function routeUrl(location) { const { href } = router().resolve(location); return href; } export function getBackUrl(breadcrumb) { const item = breadcrumb[breadcrumb.length - 2]; return item ? normalize(item.url) : null; } export function getListBackUrl(breadcrumb) { const listItem = breadcrumb.find(item => item.type === 'entityList'); return normalize(listItem.url); } export function formUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'form', params: { entityKey, instanceId }, })); } export function listUrl(entityKey) { return normalize(routeUrl({ name: 'entity-list', params: { id: entityKey }, })); } export function showUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'show', params: { entityKey, instanceId } })); }
import { router, stringifyQuery, parseQuery } from '../router'; const defaultQuery = { 'x-access-from': 'ui' }; function normalize(url) { const urlLocation = /^\//.test(url) ? new URL(url, location.origin) : new URL(url); const query = { ...parseQuery(urlLocation.search), ...defaultQuery, }; return urlLocation.pathname + stringifyQuery(query); } function routeUrl(location) { const { href } = router().resolve(location); return href; } export function getBackUrl(breadcrumb) { const item = breadcrumb[breadcrumb.length - 2]; return item ? normalize(item.url) : null; } export function getListBackUrl(breadcrumb) { const listItem = breadcrumb.find(item => item.type === 'entityList'); return normalize(listItem.url); } export function formUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'form', params: { entityKey, instanceId }, })); } export function listUrl(entityKey) { return normalize(routeUrl({ name: 'entity-list', params: { id: entityKey }, })); } export function showUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'show', params: { entityKey, instanceId } })); }
Fix URL type error on safari
Fix URL type error on safari
JavaScript
mit
code16/sharp,code16/sharp,code16/sharp
2a4ec61b2b04c3a548c30a2fb993964aaeff7c34
lib/run-sagas.js
lib/run-sagas.js
module.exports = function runSagas(routes, dispatch, props, sagaMiddleware) { return Promise.all( routes .filter(function(route) { var sagasToRun; return route.component && (sagasToRun = route.component.sagasToRun) && typeof sagasToRun === 'function'; }) .map(function(route) { var sagasToRun = route.component.sagasToRun(dispatch, props); if (sagasToRun == null || !(sagasToRun instanceof Array) || sagasToRun.some( s => !(s instanceof Array) )) { return Promise.reject( new Error(`\`sagasToRun()\` must return an array of arrays, in route component ${route.component.displayName}`)); } return Promise.all( sagasToRun.map(function(args) { // Run each Saga // http://yelouafi.github.io/redux-saga/docs/api/index.html#middlewarerunsaga-args // …returning the Task descriptor's Promise // http://yelouafi.github.io/redux-saga/docs/api/index.html#task-descriptor return sagaMiddleware.run.apply(null, args).done; }) ) }) ) }
module.exports = function runSagas(routes, dispatch, props, sagaMiddleware) { return Promise.all( routes .filter(function(route) { var sagasToRun; return route.component && (sagasToRun = route.component.sagasToRun) && typeof sagasToRun === 'function'; }) .map(function(route) { var sagasToRun = route.component.sagasToRun(dispatch, props); if (sagasToRun == null || !(sagasToRun instanceof Array) || sagasToRun.some(function(s) { return !(s instanceof Array) })) { return Promise.reject( new Error(`\`sagasToRun()\` must return an array of arrays, in route component ${route.component.displayName}`)); } return Promise.all( sagasToRun.map(function(args) { // Run each Saga // http://yelouafi.github.io/redux-saga/docs/api/index.html#middlewarerunsaga-args // …returning the Task descriptor's Promise // http://yelouafi.github.io/redux-saga/docs/api/index.html#task-descriptor return sagaMiddleware.run.apply(null, args).done; }) ) }) ) }
Fix to use vanilla JS.
Fix to use vanilla JS.
JavaScript
mit
heroku/create-render-4r
67fc0a2b92f49250b14562a04539b775f0d55cc4
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
import $ from 'jquery'; import setupNativeFormVariableList from '~/ci_variable_list/native_form_variable_list'; describe('NativeFormVariableList', () => { preloadFixtures('pipeline_schedules/edit.html.raw'); let $wrapper; beforeEach(() => { loadFixtures('pipeline_schedules/edit.html.raw'); $wrapper = $('.js-ci-variable-list-section'); setupNativeFormVariableList({ container: $wrapper, formField: 'schedule', }); }); describe('onFormSubmit', () => { it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => { const $row = $wrapper.find('.js-row'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][key]'); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][value]'); $wrapper.closest('form').trigger('trigger-submit'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe(''); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe(''); }); }); });
import $ from 'jquery'; import setupNativeFormVariableList from '~/ci_variable_list/native_form_variable_list'; describe('NativeFormVariableList', () => { preloadFixtures('pipeline_schedules/edit.html.raw'); let $wrapper; beforeEach(() => { loadFixtures('pipeline_schedules/edit.html.raw'); $wrapper = $('.js-ci-variable-list-section'); setupNativeFormVariableList({ container: $wrapper, formField: 'schedule', }); }); describe('onFormSubmit', () => { it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => { const $row = $wrapper.find('.js-row'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][secret_key]'); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][secret_value]'); $wrapper.closest('form').trigger('trigger-submit'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe(''); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe(''); }); }); });
Check for secret_key and secret_value in CI Variable native list js spec
Check for secret_key and secret_value in CI Variable native list js spec
JavaScript
mit
iiet/iiet-git,jirutka/gitlabhq,jirutka/gitlabhq,axilleas/gitlabhq,iiet/iiet-git,dreampet/gitlab,axilleas/gitlabhq,dreampet/gitlab,dreampet/gitlab,jirutka/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,stoplightio/gitlabhq,iiet/iiet-git,axilleas/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,mmkassem/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,jirutka/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq
683e4c5056eacf561e69835c5531b5411df3fb66
prolific.tcp/tcp.argv.js
prolific.tcp/tcp.argv.js
/* ___ usage ___ en_US ___ usage: prolific tcp <options> -u, --url <string> The URL of the logging destination. -r, --rotate <number> Reopen TCP connection after specified number of bytes. --help Display this message. ___ $ ___ en_US ___ ___ . ___ */ require('arguable')(module, require('cadence')(function (async, program) { program.helpIf(program.command.params.help) var response = { moduleName: 'prolific.tcp/tcp.processor', parameters: { params: program.command.param }, argv: program.argv, terminal: program.command.terminal } if (process.mainModule == module) { console.log(response) } return response }))
/* ___ usage ___ en_US ___ usage: prolific tcp <options> -u, --url <string> The URL of the logging destination. -r, --rotate <number> Reopen TCP connection after specified number of bytes. --help Display this message. ___ $ ___ en_US ___ ___ . ___ */ require('arguable')(module, require('cadence')(function (async, program) { program.helpIf(program.command.params.help) var response = { moduleName: 'prolific.tcp/tcp.processor', parameters: { params: program.command.param }, argv: program.argv, terminal: program.command.terminal } if (process.mainModule == module) { console.log(response) } return response })) module.exports.isProlific = true
Add flag for new module loader.
Add flag for new module loader.
JavaScript
mit
bigeasy/prolific,bigeasy/prolific
f24f92487abf2529faea31622f33c8a656530f24
src/utilities/NumbersHelper.js
src/utilities/NumbersHelper.js
/** * Formats a number to the American `1,000.00` format * * @param {number|string} number The value to format * @return {string} The formatted number */ export default function numberWithCommas(number) { const parts = number.toString().split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); return parts.join('.'); }
/** * Formats numbers */ export default class NumbersHelper { /** * Formats a number to the American `1,000.00` format * @param {number|string} number The value to format * @return {string} The formatted number */ static numberWithCommas = (number, hideRemainderIfZero) => { const parts = number.toString().split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); // Remove the decimal place if it is empty if (hideRemainderIfZero && parts.length > 1 && /^0*$/.test(parts[1])) { parts.splice(1, 1); } return parts.join('.'); } /** * Formats a number to a short format with: * K = thousands * M = millions * B = billions * T = trillions * It also supports fractional formats. So a number like 1050 can be turned * into 1.05K by providing 2 or more for the decimals param. * * @param {number} number The value to format * @param {integer} decimals The amount of decimal places after the operator * @return {string} The formatted number */ static formatToShortNumber = (number, decimals = 1) => { let mult = 1.0; let sym = ''; const decimalMult = 10 ** decimals; if (number >= 1000 && number < 1000000) { sym = 'K'; mult = 1000.0; } else if (number >= 1000000 && number < 1000000000) { sym = 'M'; mult = 1000000.0; } else if (number >= 1000000000 && number < 1000000000000) { sym = 'B'; mult = 1000000000.0; } else if (number >= 1000000000000 && number < 1000000000000000) { sym = 'T'; mult = 1000000000000.0; } const total = (Math.floor((number * decimalMult) / mult) / decimalMult); return total + sym; } }
Format the new numbers helper
Format the new numbers helper
JavaScript
mit
HarvestProfit/harvest-profit-ui
b268949468a4f32677dfeca0d1a8da19f8ad39a9
lib/index.js
lib/index.js
import apiClient from 'api-client'; import loader from 'loader'; const init = (apikey, security) => { const client = apiClient.init(apikey, security); return { getSecurity() { return client.getSecurity(); }, setSecurity(sec) { return client.setSecurity(sec); }, pick(options) { return loader.loadModule(ENV.picker) .then((pickerConstructor) => { return pickerConstructor(client, options); }); }, storeURL(url, options) { return client.storeURL(url, options); }, transform(url, options) { return client.transform(url, options); }, upload(file, uploadOptions, storeOptions, token) { return client.upload(file, uploadOptions, storeOptions, token); }, retrieve(handle, options) { return client.retrieve(handle, options); }, remove(handle) { return client.remove(handle); }, metadata(handle, options) { return client.metadata(handle, options); }, }; }; export default { version: '@{VERSION}', init, };
import apiClient from 'api-client'; import loader from 'loader'; const init = (apikey, security, cname) => { const client = apiClient.init(apikey, security, cname); return { getSecurity() { return client.getSecurity(); }, setSecurity(sec) { return client.setSecurity(sec); }, pick(options) { return loader.loadModule(ENV.picker) .then((pickerConstructor) => { return pickerConstructor(client, options); }); }, storeURL(url, options) { return client.storeURL(url, options); }, transform(url, options) { return client.transform(url, options); }, upload(file, uploadOptions, storeOptions, token) { return client.upload(file, uploadOptions, storeOptions, token); }, retrieve(handle, options) { return client.retrieve(handle, options); }, remove(handle) { return client.remove(handle); }, metadata(handle, options) { return client.metadata(handle, options); }, }; }; export default { version: '@{VERSION}', init, };
Add cname option to init wrapper
Add cname option to init wrapper
JavaScript
mit
filestack/filestack-js,filestack/filestack-js
802d6bb7174eb2d444246ffb0523e7c6c45a83c3
lib/index.js
lib/index.js
"use strict"; const path = require("path"); const rollup = require("rollup"); function createPreprocessor(options, preconfig, basePath, logger) { const cache = new Map(); const log = logger.create("preprocessor.rollup"); return async function preprocess(original, file, done) { try { const config = Object.assign({}, options, preconfig.options, { input: file.path, cache: cache.get(file.path) }); const bundle = await rollup.rollup(config); cache.set(file.path, bundle.cache); const { output } = await bundle.generate(config); for (const result of output) { if (!result.isAsset) { const { code, map } = result; const { sourcemap } = config.output; file.sourceMap = map; const processed = sourcemap === "inline" ? code + `\n//# sourceMappingURL=${map.toUrl()}\n` : code; return done(null, processed); } } log.warn("Nothing was processed."); done(null, original); } catch (error) { const location = path.relative(basePath, file.path); log.error("Failed to process ./%s\n\n%s\n", location, error.stack); done(error, null); } }; } createPreprocessor.$inject = [ "config.rollupPreprocessor", "args", "config.basePath", "logger" ]; module.exports = { "preprocessor:rollup": ["factory", createPreprocessor] };
"use strict"; const path = require("path"); const rollup = require("rollup"); function createPreprocessor(options, preconfig, basePath, logger) { const cache = new Map(); const log = logger.create("preprocessor.rollup"); return async function preprocess(original, file, done) { const location = path.relative(basePath, file.path); try { const config = Object.assign({}, options, preconfig.options, { input: file.path, cache: cache.get(file.path) }); const bundle = await rollup.rollup(config); cache.set(file.path, bundle.cache); log.info("Generating bundle for ./%s", location); const { output } = await bundle.generate(config); for (const result of output) { if (!result.isAsset) { const { code, map } = result; const { sourcemap } = config.output; file.sourceMap = map; const processed = sourcemap === "inline" ? code + `\n//# sourceMappingURL=${map.toUrl()}\n` : code; return done(null, processed); } } log.warn("Nothing was processed."); done(null, original); } catch (error) { log.error("Failed to process ./%s\n\n%s\n", location, error.stack); done(error, null); } }; } createPreprocessor.$inject = [ "config.rollupPreprocessor", "args", "config.basePath", "logger" ]; module.exports = { "preprocessor:rollup": ["factory", createPreprocessor] };
Add more info log output
Add more info log output Partial reimplementation of #39
JavaScript
mit
showpad/karma-rollup-preprocessor,jlmakes/karma-rollup-preprocessor,jlmakes/karma-rollup-preprocessor
7b9e2f1fc757c941b87ad9f3107b09796f4fac21
src/utils/init-autoplay.js
src/utils/init-autoplay.js
/** * handle autoplay * * @param {element} slideTo slide to frame function * @param {element} options slider options */ export default function initAutoplay (slide, options) { let autoplayTime = (typeof options.autoplay === 'number') ? options.autoplay : 3000; let onAutoplayStart = window.setInterval(() => { slide(false, true); }, autoplayTime); return onAutoplayStart; }
/** * handle autoplay * * @param {element} slideTo slide to frame function * @param {element} options slider options */ export default function initAutoplay (slide, options) { let autoplayTime = (typeof options.autoplay === 'number') ? options.autoplay : 3000; let onAutoplayStart = window.setInterval(() => { slide(false, options.direction === 'ltr' ? true : false); }, autoplayTime); return onAutoplayStart; }
Fix Autoplay diretion in case of RTL
Fix Autoplay diretion in case of RTL
JavaScript
mit
AmitM30/basic-swiper,AmitM30/basic-swiper
1af1be4cad8db37e096724d0f2c666bd860b330f
local-cli/runMacOS/findXcodeProject.js
local-cli/runMacOS/findXcodeProject.js
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; const path = require('path'); type ProjectInfo = { name: string; isWorkspace: boolean; } function findXcodeProject(files: Array<string>): ?ProjectInfo { const sortedFiles = files.sort(); for (let i = sortedFiles.length - 1; i >= 0; i--) { const fileName = files[i]; const ext = path.extname(fileName); if (ext === '.xcworkspace') { return { name: fileName, isWorkspace: true, }; } if (ext === '.xcodeproj') { return { name: fileName, isWorkspace: false, }; } } return null; } module.exports = findXcodeProject;
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; const path = require('path'); function findXcodeProject(files) { const sortedFiles = files.sort(); for (let i = sortedFiles.length - 1; i >= 0; i--) { const fileName = files[i]; const ext = path.extname(fileName); if (ext === '.xcworkspace') { return { name: fileName, isWorkspace: true, }; } if (ext === '.xcodeproj') { return { name: fileName, isWorkspace: false, }; } } return null; } module.exports = findXcodeProject;
Remove typescript, as it is not compiled by rnpm
Remove typescript, as it is not compiled by rnpm
JavaScript
mit
ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos
0d67458b71a5cbb7127d455bcc993fd1a0b2e969
test/crypto.js
test/crypto.js
const assert = require('assert'); const { crypto, config } = require('./config'); describe("WebCrypto", () => { it("get random values", () => { var buf = new Uint8Array(16); var check = new Buffer(buf).toString("base64"); assert.notEqual(new Buffer(crypto.getRandomValues(buf)).toString("base64"), check, "Has no random values"); }) it("get random values with large buffer", () => { var buf = new Uint8Array(65600); assert.throws(() => { crypto.getRandomValues(buf); }, Error); }) it("reset", (done) => { var WebCrypto = require("../").WebCrypto; const crypto = new WebCrypto(config); const currentHandle = crypto.session.handle.toString("hex"); crypto.reset() .then(() => { const newHandle = crypto.session.handle.toString("hex"); assert(currentHandle !== newHandle, true, "handle of session wasn't changed"); }) .then(done, done); }) })
const assert = require('assert'); const { crypto, config } = require('./config'); describe("WebCrypto", () => { it("get random values", () => { var buf = new Uint8Array(16); var check = new Buffer(buf).toString("base64"); assert.notEqual(new Buffer(crypto.getRandomValues(buf)).toString("base64"), check, "Has no random values"); }) it("get random values with large buffer", () => { var buf = new Uint8Array(65600); assert.throws(() => { crypto.getRandomValues(buf); }, Error); }) it("reset", (done) => { const currentHandle = crypto.session.handle.toString("hex"); crypto.reset() .then(() => { crypto.login(config.pin); const newHandle = crypto.session.handle.toString("hex"); assert(currentHandle !== newHandle, true, "handle of session wasn't changed"); }) .then(done, done); }) })
Update - cannot open 2 session
Update - cannot open 2 session
JavaScript
mit
PeculiarVentures/node-webcrypto-p11,PeculiarVentures/node-webcrypto-p11
8487e1f2ae9532bfc58d1aceaf27aaf95b37fb72
website/app/application/core/projects/project/files/file-edit-controller.js
website/app/application/core/projects/project/files/file-edit-controller.js
(function (module) { module.controller("FilesEditController", FilesEditController); FilesEditController.$inject = ['file']; /* @ngInject */ function FilesEditController(file) { var ctrl = this; ctrl.file = file; } }(angular.module('materialscommons')));
(function (module) { module.controller("FileEditController", FileEditController); FileEditController.$inject = ['file']; /* @ngInject */ function FileEditController(file) { var ctrl = this; ctrl.file = file; } }(angular.module('materialscommons')));
Change name of controller to match file.
Change name of controller to match file.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
e746455d849e06f7c8b59bf097631a78da53a2ff
spec/paths/approved_invoice.js
spec/paths/approved_invoice.js
'use strict'; module.exports = { 'get': { 'description': 'This endpoint returns information about invoices that have been approved. The response includes basic details of each invoice, such as sender and receiver information.', 'responses': { '200': { 'description': 'An array of approved invoices', 'schema': { '$ref': '#/definitions/InvoiceApproved' } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } }, 'post': { 'description': 'This endpoint allows you to send approved invoices.', 'parameters': [ { 'name': 'body', 'in': 'body', 'description': 'The Invoice JSON you want to POST', 'schema': { 'pendingInvoices': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'required': true } ], 'responses': { '200': { 'description': 'Ids of the approved invoices', 'schema': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } } };
'use strict'; module.exports = { 'get': { 'description': 'This endpoint returns information about invoices that have been approved. The response includes basic details of each invoice, such as sender and receiver information.', 'responses': { '200': { 'description': 'An array of approved invoices', 'schema': { '$ref': '#/definitions/InvoiceApproved' } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } }, // XXXXX: figure out proper semantics for approving (separate resource?) /* 'post': { 'description': 'This endpoint allows you to send approved invoices.', 'parameters': [ { 'name': 'body', 'in': 'body', 'description': 'The Invoice JSON you want to POST', 'schema': { 'approvedInvoices': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'required': true } ], 'responses': { '200': { 'description': 'Ids of the approved invoices', 'schema': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } } */ };
Disable POST approved invoice for now
Disable POST approved invoice for now Need to rethink this. Looks like some dependency change (swagger-tools) broke this. Anyway, there should be a way to transform drafts into approved into paid. Maybe single endpoint would do.
JavaScript
mit
bebraw/react-crm-backend,koodilehto/koodilehto-crm-backend
474163478d11e839b493417b584e16a80a1559d1
src/routes/user/component/indexRoute/__tests__/WrapperUserIndexPage-test.js
src/routes/user/component/indexRoute/__tests__/WrapperUserIndexPage-test.js
import chai, { expect } from 'chai'; import mockery from 'mockery'; import dirtyChai from 'dirty-chai'; chai.use(dirtyChai); import { shallow } from 'enzyme'; import React from 'react'; describe('WrapperUserIndexPage', () => { beforeEach(() => { mockery.enable({ warnOnReplace: false, warnOnUnregistered: false, useCleanCache: true, }); mockery.registerMock( 'decorators', require('helpers/test/decoratorsMock') ); }); afterEach(() => { mockery.deregisterMock('decorators'); mockery.disable(); }); it('should exists', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper).to.have.length(1); }); it('should render inner components', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper.find('div')).to.have.length(1); }); });
import chai, { expect } from 'chai'; import mockery from 'mockery'; import dirtyChai from 'dirty-chai'; chai.use(dirtyChai); import { shallow } from 'enzyme'; import React from 'react'; describe('WrapperUserIndexPage', () => { beforeEach(() => { mockery.enable({ warnOnReplace: false, warnOnUnregistered: false, useCleanCache: true, }); mockery.registerMock( 'decorators', require('helpers/test/decoratorsMock') ); mockery.registerMock( 'components/CardsList', require('helpers/test/componentsMock').CardsList ); mockery.registerMock( 'components/WelcomeCard', require('helpers/test/componentsMock').WelcomeCard ); }); afterEach(() => { mockery.deregisterMock('decorators'); mockery.deregisterMock('components/CardsList'); mockery.deregisterMock('components/WelcomeCard'); mockery.disable(); }); it('should exists', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper).to.have.length(1); }); it('should render inner components', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper.find('CardsList')).to.have.length(1); expect(wrapper.find('WelcomeCard')).to.have.length(1); expect(wrapper.find('div')).to.have.length(1); }); });
Update wrapper user index route tests.
Update wrapper user index route tests.
JavaScript
mit
retaxJS/retax-seed
c1221144279bffcfd8f21b1cd3116dd40ac6253d
server/updaters/mainUpdater.js
server/updaters/mainUpdater.js
'use strict'; var tablesUpdater = require('./tablesUpdater'); var resultsUpdater = require('./resultsUpdater'); var tournamentsUpdater = require('./tournamentsUpdater'); var groupsUpdater = require('./groupsUpdater'); var scorersUpdater = require('./scorersUpdater'); var assistsUpdater = require('./assistsUpdater'); // Updates league data function updateLeague(leagueArg) { leagueArg = leagueArg || true; tablesUpdater.update(leagueArg); resultsUpdater.update(leagueArg); scorersUpdater.update(leagueArg, null); assistsUpdater.update(leagueArg, null); } // Updates competition data function updateCompetition(competitionArg) { competitionArg = competitionArg || true; tournamentsUpdater.update(competitionArg); groupsUpdater.update(competitionArg); scorersUpdater.update(null, competitionArg); assistsUpdater.update(null, competitionArg); } module.exports = { updateLeague: updateLeague, updateCompetition: updateCompetition };
'use strict'; var tablesUpdater = require('./tablesUpdater'); var resultsUpdater = require('./resultsUpdater'); var tournamentsUpdater = require('./tournamentsUpdater'); // var groupsUpdater = require('./groupsUpdater'); var scorersUpdater = require('./scorersUpdater'); var assistsUpdater = require('./assistsUpdater'); // Updates league data function updateLeague(leagueArg) { leagueArg = leagueArg || true; tablesUpdater.update(leagueArg); resultsUpdater.update(leagueArg); scorersUpdater.update(leagueArg, null); assistsUpdater.update(leagueArg, null); } // Updates competition data function updateCompetition(competitionArg) { competitionArg = competitionArg || true; tournamentsUpdater.update(competitionArg); // groupsUpdater.update(competitionArg); Disable groups update until next year scorersUpdater.update(null, competitionArg); assistsUpdater.update(null, competitionArg); } module.exports = { updateLeague: updateLeague, updateCompetition: updateCompetition };
Disable groups update until next year
Disable groups update until next year
JavaScript
apache-2.0
Softcadbury/FootballDashboard,Softcadbury/DashboardFootball,Softcadbury/DashboardFootball,Softcadbury/football-peek,Softcadbury/FootballDashboard
ccddceeef4ca5bf1208c2873b4775aac0994f00e
aura-components/src/test/components/lockerTest/secureNavigatorTest/secureNavigatorTestController.js
aura-components/src/test/components/lockerTest/secureNavigatorTest/secureNavigatorTestController.js
({ testPropertiesExposed: function(cmp) { var testUtils = cmp.get("v.testUtils"); ["appCodeName", "appName", "appVersion", "cookieEnabled", "geolocation", "language", "onLine", "platform", "product", "userAgent"].forEach(function(name) { testUtils.assertTrue(name in window.navigator, "Expected window.navigator." + name + " to be exposed as a property"); }); }, testLanguage: function(cmp) { var testUtils = cmp.get("v.testUtils"); testUtils.assertEquals(window.navigator.language, "en-US", "Expect window.navigator.language to be 'en-US'"); } })
({ testPropertiesExposed: function(cmp) { var testUtils = cmp.get("v.testUtils"); ["appCodeName", "appName", "appVersion", "cookieEnabled", "geolocation", "language", "onLine", "platform", "product", "userAgent"].forEach(function(name) { testUtils.assertTrue(name in window.navigator, "Expected window.navigator." + name + " to be exposed as a property"); }); }, testLanguage: function(cmp) { var testUtils = cmp.get("v.testUtils"); testUtils.assertEquals("en-us", window.navigator.language.toLowerCase(), "Unexpected window.navigator.language value"); } })
Fix case sensitivity issue in test
Fix case sensitivity issue in test @bug W-3021252@ @rev cheng@
JavaScript
apache-2.0
badlogicmanpreet/aura,madmax983/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,badlogicmanpreet/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,badlogicmanpreet/aura,badlogicmanpreet/aura,badlogicmanpreet/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,badlogicmanpreet/aura
acedb6440d409145dce37b61a9dea76eebb05172
src/Oro/Bundle/UIBundle/Resources/public/js/extend/bootstrap/bootstrap-typeahead.js
src/Oro/Bundle/UIBundle/Resources/public/js/extend/bootstrap/bootstrap-typeahead.js
define(function(require) { 'use strict'; var $ = require('jquery'); require('bootstrap'); /** * This customization allows to define own focus, click, render, show, lookup functions for Typeahead */ var Typeahead; var origTypeahead = $.fn.typeahead.Constructor; var origFnTypeahead = $.fn.typeahead; Typeahead = function(element, options) { var opts = $.extend({}, $.fn.typeahead.defaults, options); this.focus = opts.focus || this.focus; this.render = opts.render || this.render; this.show = opts.show || this.show; this.lookup = opts.lookup || this.lookup; origTypeahead.apply(this, arguments); }; Typeahead.prototype = origTypeahead.prototype; Typeahead.prototype.constructor = Typeahead; $.fn.typeahead = function(option) { return this.each(function() { var $this = $(this); var data = $this.data('typeahead'); var options = typeof option === 'object' && option; if (!data) { $this.data('typeahead', (data = new Typeahead(this, options))); } if (typeof option === 'string') { data[option](); } }); }; $.fn.typeahead.defaults = origFnTypeahead.defaults; $.fn.typeahead.Constructor = Typeahead; $.fn.typeahead.noConflict = origFnTypeahead.noConflict; });
define(function(require) { 'use strict'; var $ = require('jquery'); require('bootstrap'); /** * This customization allows to define own functions for Typeahead */ var Typeahead; var origTypeahead = $.fn.typeahead.Constructor; var origFnTypeahead = $.fn.typeahead; Typeahead = function(element, options) { var _this = this; var opts = $.extend({}, $.fn.typeahead.defaults, options); _.each(opts, function(value, name) { _this[name] = value || _this[name]; }); origTypeahead.apply(this, arguments); }; Typeahead.prototype = origTypeahead.prototype; Typeahead.prototype.constructor = Typeahead; $.fn.typeahead = function(option) { return this.each(function() { var $this = $(this); var data = $this.data('typeahead'); var options = typeof option === 'object' && option; if (!data) { $this.data('typeahead', (data = new Typeahead(this, options))); } if (typeof option === 'string') { data[option](); } }); }; $.fn.typeahead.defaults = origFnTypeahead.defaults; $.fn.typeahead.Constructor = Typeahead; $.fn.typeahead.noConflict = origFnTypeahead.noConflict; });
Add validation functionality to RuleEditorComponent - temp commit (polish of suggestion output)
BB-4210: Add validation functionality to RuleEditorComponent - temp commit (polish of suggestion output)
JavaScript
mit
orocrm/platform,orocrm/platform,orocrm/platform
c594979d9be6b93542095108b04a723501ca9e12
tests/index.js
tests/index.js
const assert = require('assert') const Application = require('spectron').Application describe('application launch', function () { this.timeout(10000) beforeEach(function () { this.app = new Application({ path: __dirname + '/../node_modules/.bin/electron', args: [__dirname + '/../app/main/index.js'] }) return this.app.start() }) afterEach(function () { if (this.app && this.app.isRunning()) { return this.app.stop() } }) it('shows an initial window', function () { return this.app.client.getWindowCount().then(function (count) { assert.equal(count, 1) }) }) })
const assert = require('assert') const Application = require('spectron').Application describe('application launch', function () { this.timeout(10000) beforeEach(function () { this.app = new Application({ path: require('electron'), args: [__dirname + '/../app/main/index.js'] }) return this.app.start() }) afterEach(function () { if (this.app && this.app.isRunning()) { return this.app.stop() } }) it('shows an initial window', function () { return this.app.client.getWindowCount().then(function (count) { assert.equal(count, 1) }) }) })
Use the standard method to get the electron app location
Use the standard method to get the electron app location As per the guidance at https://github.com/electron-userland/electron-prebuilt programmatic usage acquires the path to electron by require('electron')
JavaScript
apache-2.0
brainwane/zulip-electron,steele/zulip-electron,zulip/zulip-desktop,brainwane/zulip-electron,zulip/zulip-electron,zulip/zulip-electron,zulip/zulip-electron,brainwane/zulip-electron,steele/zulip-electron,zulip/zulip-desktop,steele/zulip-electron,zulip/zulip-desktop,zulip/zulip-desktop
fc6cb30f7323e35be709e3ad591bbb136f0ef5df
webpack.config.babel.js
webpack.config.babel.js
import path from 'path'; import HtmlWebpackPlugin from 'webpack-html-plugin'; import webpack from 'webpack'; const array = (target) => target.filter((item) => item); export default ({dev, prod}) => ({ entry: array([ dev && 'react-hot-loader/patch', 'babel-polyfill', './src/', ]), output: { path: path.resolve(__dirname, 'dist'), publicPath: '/', filename: 'bundle.js', }, plugins: array([ new HtmlWebpackPlugin({ template: 'src/index.html', inject: true, }), dev && new webpack.NoErrorsPlugin(), ]), module: { rules: [ { test: /\.js$/, use: 'babel-loader', exclude: '/node_modules/', options: { presets: ['es2015', 'react'], modules: false, }, }, { test: /\.less$/, use: [ {loader: 'style-loader'}, {loader: 'css-loader'}, {loader: 'less-loader'}, ], }, ], }, });
import path from 'path'; import HtmlWebpackPlugin from 'webpack-html-plugin'; import webpack from 'webpack'; /** removes empty items from array */ const array = (target) => target.filter((item) => item); /** removes empty properties from object */ const object = (target) => Object.keys(target).filter((key) => target[key]).reduce((result, key) => Object.assign({[key]: target[key]}, result), {}); export default ({dev, prod}) => ({ entry: array([ dev && 'react-hot-loader/patch', 'babel-polyfill', './src/', ]), output: { path: path.resolve(__dirname, 'dist'), publicPath: '/', filename: 'bundle.js', }, plugins: array([ new HtmlWebpackPlugin({ template: 'src/index.html', inject: true, }), dev && new webpack.NoErrorsPlugin(), ]), module: { rules: [ { test: /\.js$/, use: 'babel-loader', exclude: '/node_modules/', options: { presets: ['es2015', 'react'], modules: false, }, }, { test: /\.less$/, use: [ {loader: 'style-loader'}, {loader: 'css-loader'}, {loader: 'less-loader'}, ], }, ], }, });
Remove empty properties from object
Remove empty properties from object
JavaScript
mit
tomvej/redux-starter,tomvej/redux-starter
47f7ac51444b54d4790586950832632fbdf30612
build/connect.js
build/connect.js
const rewrite = require('connect-modrewrite'); const serveIndex = require('serve-index'); const serveStatic = require('serve-static'); module.exports = function (grunt) { return { livereload: { options: { hostname : '127.0.0.1', port : 443, protocol : 'https', base : 'dist', open : 'https://localhost.localdomain', middleware: (connect, options) => { const middlewares = [ require('connect-livereload')(), ]; const rules = [ '^/binary-static/(.*)$ /$1', ]; middlewares.push(rewrite(rules)); if (!Array.isArray(options.base)) { options.base = [options.base]; } options.base.forEach((base) => { middlewares.push(serveStatic(base)); }); const directory = options.directory || options.base[options.base.length - 1]; middlewares.push(serveIndex(directory)); middlewares.push((req, res) => { const path_404 = `${options.base[0]}/404.html`; if (grunt.file.exists(path_404)) { require('fs').createReadStream(path_404).pipe(res); return; } res.statusCode(404); // 404.html not found res.end(); }); return middlewares; } } }, }; };
const rewrite = require('connect-modrewrite'); const serveIndex = require('serve-index'); const serveStatic = require('serve-static'); module.exports = function (grunt) { return { livereload: { options: { hostname : '0.0.0.0', port : 443, protocol : 'https', base : 'dist', open : 'https://localhost.localdomain', middleware: (connect, options) => { const middlewares = [ require('connect-livereload')(), ]; const rules = [ '^/binary-static/(.*)$ /$1', ]; middlewares.push(rewrite(rules)); if (!Array.isArray(options.base)) { options.base = [options.base]; } options.base.forEach((base) => { middlewares.push(serveStatic(base)); }); const directory = options.directory || options.base[options.base.length - 1]; middlewares.push(serveIndex(directory)); middlewares.push((req, res) => { const path_404 = `${options.base[0]}/404.html`; if (grunt.file.exists(path_404)) { require('fs').createReadStream(path_404).pipe(res); return; } res.statusCode(404); // 404.html not found res.end(); }); return middlewares; } } }, }; };
Allow Local LAN devices to access the livereload machine
Allow Local LAN devices to access the livereload machine
JavaScript
apache-2.0
binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,ashkanx/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,negar-binary/binary-static,ashkanx/binary-static,ashkanx/binary-static,binary-com/binary-static,negar-binary/binary-static,negar-binary/binary-static,binary-com/binary-static,4p00rv/binary-static
911ba266f0f5fd01c9c66948dad967af27edbc1b
website/src/app/global.services/store/state-store.service.js
website/src/app/global.services/store/state-store.service.js
import MCStoreBus from './mcstorebus'; class StateStoreService { /*@ngInject*/ constructor() { this.states = {}; this.bus = new MCStoreBus(); } updateState(key, value) { this.states[key] = angular.copy(value); let val = angular.copy(this.states[key]); this.bus.fireEvent(key, val); } getState(key) { if (_.has(this.states, key)) { return angular.copy(this.states[key]); } return null; } subscribe(state, fn) { return this.bus.subscribe(state, fn); } } angular.module('materialscommons').service('mcStateStore', StateStoreService);
import MCStoreBus from './mcstorebus'; class StateStoreService { /*@ngInject*/ constructor() { this.states = {}; this.bus = new MCStoreBus(); } updateState(key, value) { this.states[key] = angular.copy(value); let val = this.states[key]; this.bus.fireEvent(key, val); } getState(key) { if (_.has(this.states, key)) { return angular.copy(this.states[key]); } return null; } subscribe(state, fn) { return this.bus.subscribe(state, fn); } } angular.module('materialscommons').service('mcStateStore', StateStoreService);
Make contract that client needs to copy or not change value
Make contract that client needs to copy or not change value
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
aeab0f4207efb2c2880552d7994077bf453f8099
bin/sass-lint.js
bin/sass-lint.js
#!/usr/bin/env node 'use strict'; var program = require('commander'), meta = require('../package.json'), lint = require('../index'); var detects, formatted, configPath, ignores, configOptions = {}; program .version(meta.version) .usage('[options] <pattern>') .option('-c, --config [path]', 'path to custom config file') .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `') .option('-q, --no-exit', 'do not exit on errors') .option('-v, --verbose', 'verbose output') .parse(process.argv); if (program.config && program.config !== true) { configPath = program.config; } if (program.ignore && program.ignore !== true) { ignores = program.ignore.split(', '); configOptions = { 'files': { 'ignore': ignores } }; } detects = lint.lintFiles(program.args[0], configOptions, configPath); formatted = lint.format(detects); if (program.verbose) { lint.outputResults(formatted); } if (program.exit) { lint.failOnError(detects); }
#!/usr/bin/env node 'use strict'; var program = require('commander'), meta = require('../package.json'), lint = require('../index'); var configPath, ignores, configOptions = {}; var detectPattern = function (pattern) { var detects, formatted; detects = lint.lintFiles(pattern, configOptions, configPath); formatted = lint.format(detects); if (program.verbose) { lint.outputResults(formatted); } if (program.exit) { lint.failOnError(detects); } }; program .version(meta.version) .usage('[options] <pattern>') .option('-c, --config [path]', 'path to custom config file') .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `') .option('-q, --no-exit', 'do not exit on errors') .option('-v, --verbose', 'verbose output') .parse(process.argv); if (program.config && program.config !== true) { configPath = program.config; } if (program.ignore && program.ignore !== true) { ignores = program.ignore.split(', '); configOptions = { 'files': { 'ignore': ignores } }; } if (program.args.length === 0) { detectPattern(null); } else { program.args.forEach(function (path) { detectPattern(path); }); }
Allow multiple paths for CLI
Allow multiple paths for CLI Resolves #60
JavaScript
mit
skovhus/sass-lint,DanPurdy/sass-lint,srowhani/sass-lint,flacerdk/sass-lint,Snugug/sass-lint,joshuacc/sass-lint,Dru89/sass-lint,MethodGrab/sass-lint,sasstools/sass-lint,bgriffith/sass-lint,sktt/sass-lint,alansouzati/sass-lint,ngryman/sass-lint,zallek/sass-lint,sasstools/sass-lint,benthemonkey/sass-lint,carsonmcdonald/sass-lint,donabrams/sass-lint,srowhani/sass-lint,zaplab/sass-lint
edb1532478facc1b121c52d1bad2ed361d669232
plugins/ember.js
plugins/ember.js
/** * Ember.js plugin * * Patches event handler callbacks and ajax callbacks. */ ;(function(window, Raven, Ember) { 'use strict'; // quit if Ember isn't on the page if (!Ember) { return; } var _oldOnError = Ember.onerror; Ember.onerror = function EmberOnError(error) { Raven.captureException(error); if (typeof _oldOnError === 'function') { _oldOnError.call(this, error); } }; Ember.RSVP.on('error', function (reason) { if (reason instanceof Error) { Raven.captureException(reason); } else { try { throw new Error('Unhandled Promise error detected'); } catch (err) { Raven.captureException(err, {extra: {reason: reason}}); } } }); }(window, window.Raven, window.Ember));
/** * Ember.js plugin * * Patches event handler callbacks and ajax callbacks. */ ;(function(window, Raven, Ember) { 'use strict'; // quit if Ember isn't on the page if (!Ember) { return; } var _oldOnError = Ember.onerror; Ember.onerror = function EmberOnError(error) { Raven.captureException(error); if (typeof _oldOnError === 'function') { _oldOnError.call(this, error); } }; Ember.RSVP.on('error', function (reason) { if (reason instanceof Error) { Raven.captureException(reason, {extra: {context: 'Unhandled RSVP error'}}); } else { try { throw new Error('Unhandled Promise error detected'); } catch (err) { Raven.captureException(err, {extra: {reason: reason}}); } } }); }(window, window.Raven, window.Ember));
Include context in RSVP handler.
Include context in RSVP handler.
JavaScript
bsd-3-clause
iodine/raven-js,clara-labs/raven-js,grelas/raven-js,malandrew/raven-js,chrisirhc/raven-js,eaglesjava/raven-js,hussfelt/raven-js,getsentry/raven-js,Mappy/raven-js,getsentry/raven-js,eaglesjava/raven-js,housinghq/main-raven-js,danse/raven-js,getsentry/raven-js,iodine/raven-js,getsentry/raven-js,benoitg/raven-js,grelas/raven-js,benoitg/raven-js,housinghq/main-raven-js,Mappy/raven-js,danse/raven-js,PureBilling/raven-js,hussfelt/raven-js,Mappy/raven-js,PureBilling/raven-js,clara-labs/raven-js,chrisirhc/raven-js,housinghq/main-raven-js,malandrew/raven-js
8f4a856c5f8fb1fd6c90dbf64a73760b7f5e5016
ember/ember-cli-build.js
ember/ember-cli-build.js
/* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { var vendorFiles = {}; if (EmberApp.env() !== 'test') { vendorFiles['jquery.js'] = null; } var app = new EmberApp(defaults, { storeConfigInMeta: false, fingerprint: { enabled: false, }, vendorFiles: vendorFiles, gzip: { keepUncompressed: true, }, }); // Use `app.import` to add additional libraries to the generated // output files. // // If you need to use different assets in different // environments, specify an object as the first parameter. That // object's keys should be the environment name and the values // should be the asset to use in that environment. // // If the library that you are including contains AMD or ES6 // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. app.import('vendor/shims/openlayers.js'); app.import('vendor/shims/ol3-cesium.js'); app.import('bower_components/remarkable/dist/remarkable.js'); app.import('vendor/shims/remarkable.js'); return app.toTree(); };
/* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { var vendorFiles = {}; if (EmberApp.env() !== 'test') { vendorFiles['jquery.js'] = null; } var app = new EmberApp(defaults, { storeConfigInMeta: false, fingerprint: { enabled: false, }, vendorFiles: vendorFiles, gzip: { keepUncompressed: true, }, }); // Use `app.import` to add additional libraries to the generated // output files. // // If you need to use different assets in different // environments, specify an object as the first parameter. That // object's keys should be the environment name and the values // should be the asset to use in that environment. // // If the library that you are including contains AMD or ES6 // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. app.import('vendor/shims/openlayers.js'); app.import('vendor/shims/ol3-cesium.js'); app.import({ development: 'bower_components/remarkable/dist/remarkable.js', production: 'bower_components/remarkable/dist/remarkable.min.js', }); app.import('vendor/shims/remarkable.js'); return app.toTree(); };
Use minified "remarkable" version in production
Use minified "remarkable" version in production
JavaScript
agpl-3.0
skylines-project/skylines,Harry-R/skylines,kerel-fs/skylines,Harry-R/skylines,Harry-R/skylines,Turbo87/skylines,Turbo87/skylines,skylines-project/skylines,shadowoneau/skylines,kerel-fs/skylines,kerel-fs/skylines,RBE-Avionik/skylines,skylines-project/skylines,RBE-Avionik/skylines,shadowoneau/skylines,RBE-Avionik/skylines,Harry-R/skylines,shadowoneau/skylines,Turbo87/skylines,skylines-project/skylines,Turbo87/skylines,shadowoneau/skylines,RBE-Avionik/skylines
ba19c41de3da74bf26f76a435bc412f43b5631d5
migrations/20161117225616_index.js
migrations/20161117225616_index.js
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTable('users', table => { table.uuid('id') .primary() .defaultTo(knex.raw('uuid_generate_v4()')); table.string('username', 20) .unique(); table.string('password'); table.float('saldo') .defaultTo(0); }), knex.schema.createTable('transactionTypes', table => { table.increments('id') .primary(); table.string('typename'); }), knex.schema.createTable('transactions', table => { table.increments('id') .primary(); table.integer('typeId') .unsigned() .references('id') .inTable('transactionTypes') .onDelete('SET NULL'); table.uuid('userId') .references('id') .inTable('users') .onDelete('SET NULL'); table.timestamp('timestamp') .defaultTo(knex.raw('now()')); table.float('oldSaldo'); table.float('newSaldo'); table.string('comment'); }) ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('transactions'), knex.schema.dropTable('users'), knex.schema.dropTable('transactionTypes') ]);
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTable('users', table => { table.uuid('id') .primary() .defaultTo(knex.raw('uuid_generate_v4()')); table.string('username', 20) .notNullable() .unique(); table.string('password') .notNullable(); table.float('saldo') .notNullable() .defaultTo(0); }), knex.schema.createTable('transactions', table => { table.increments('id') .primary(); table.uuid('userId') .notNullable() .references('id') .inTable('users') .onDelete('SET NULL'); table.timestamp('timestamp') .defaultTo(knex.raw('now()')); table.float('oldSaldo') .notNullable(); table.float('newSaldo') .notNullable(); table.string('comment') .nullable(); }) ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('transactions'), knex.schema.dropTable('users') ]);
Remove transactionTypes table and specify column nullablility
Remove transactionTypes table and specify column nullablility
JavaScript
mit
majori/piikki
e583d332d04d6fa45e387525793d6f120ee7dcd4
packages/@sanity/default-layout/src/components/DefaultLayoutRouter.js
packages/@sanity/default-layout/src/components/DefaultLayoutRouter.js
import React from 'react' import DefaultLayout from './DefaultLayout' import {Router, Route, NotFound, Redirect} from 'router:@sanity/base/router' import locationStore from 'datastore:@sanity/base/location' import SanityIntlProvider from 'component:@sanity/base/sanity-intl-provider' class DefaultLayoutRouter extends React.Component { constructor() { super() this.state = {} this.handleNavigate = this.handleNavigate.bind(this) } componentWillMount() { this.pathSubscription = locationStore .state .subscribe({next: event => this.setState({location: event.location})}) } componentWillUnmount() { this.pathSubscription.unsubscribe() } handleNavigate(newUrl, options) { locationStore.actions.navigate(newUrl) } render() { const {location} = this.state if (!location) { return null } return ( <SanityIntlProvider> <Router location={location} navigate={this.handleNavigate}> <Route path="/:site/*" component={DefaultLayout} /> <Redirect path="/" to="/some-site" /> <NotFound component={() => <div>Not found</div>} /> </Router> </SanityIntlProvider> ) } } export default DefaultLayoutRouter
import React from 'react' import DefaultLayout from './DefaultLayout' import {Router, Route, NotFound, Redirect} from 'router:@sanity/base/router' import locationStore from 'datastore:@sanity/base/location' import SanityIntlProvider from 'component:@sanity/base/sanity-intl-provider' import LoginWrapper from 'component:@sanity/base/login-wrapper' class DefaultLayoutRouter extends React.Component { constructor() { super() this.state = {} this.handleNavigate = this.handleNavigate.bind(this) } componentWillMount() { this.pathSubscription = locationStore .state .subscribe({next: event => this.setState({location: event.location})}) } componentWillUnmount() { this.pathSubscription.unsubscribe() } handleNavigate(newUrl, options) { locationStore.actions.navigate(newUrl) } render() { const {location} = this.state if (!location) { return null } return ( <SanityIntlProvider> <LoginWrapper> <Router location={location} navigate={this.handleNavigate}> <Route path="/:site/*" component={DefaultLayout} /> <Redirect path="/" to="/some-site" /> <NotFound component={() => <div>Not found</div>} /> </Router> </LoginWrapper> </SanityIntlProvider> ) } } export default DefaultLayoutRouter
Put loginwrapper inside main router
Put loginwrapper inside main router
JavaScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
d69c40a6ced3b25a582b093dae6ab07d738947f4
public/scripts/ui.js
public/scripts/ui.js
define(['views/user/login', 'views/user/signup', 'views/header', 'views/order/vl_orders'], function (UserLogin, UserSignup, HeaderView, OrdersView) { var Ui = {}; var loginView = new UserLogin() var signupView = new UserSignup() var headerView = new HeaderView({el: '#header'}) var ordersView = new OrdersView(); Ui.initialize = function () { headerView.setUserData(window.localStorage.getItem('User') || {}); }; Ui.showHome = function () { loginView.render(); }; Ui.showSignup = function () { signupView.render(); } Ui.showOrders = function() { ordersView.render(); } // This always receive a JSON object with a standard API error Ui.error = function (err) { alert("Error: " + err.message); } // This always receive a jQuery error object from an API call Ui.errorAPI = function (res) { alert("Error: " + res.responseJSON.error.message); } // Event subscription Backbone.on('api:login:error', function (data, res) { Ui.error(res.responseJSON.error); }); Backbone.on('api:signup:error', function (data, res) { Ui.error(res.responseJSON.error); }); return Ui; });
define([ 'backbone', 'api', 'collections/c_orders', 'views/user/login', 'views/user/signup', 'views/header', 'views/order/vl_orders'], function (Backbone, Api, CollectionOrder, UserLogin, UserSignup, HeaderView, OrdersView) { var Ui = {}; var loginView = new UserLogin() var signupView = new UserSignup() var headerView = new HeaderView({el: '#header'}) var ordersView = new OrdersView(); Ui.initialize = function () { headerView.setUserData(Backbone.localStorage.getItem('user')); }; Ui.showHome = function () { loginView.render(); }; Ui.showSignup = function () { signupView.render(); } Ui.showOrders = function () { var orders = new CollectionOrder(); orders.fetch({ success: ordersView.render.bind(ordersView), error: Ui.errorBackbone }); } Ui.errorBackbone = function (data, res) { alert("Error: " + res.responseJSON.error.message); } // This always receive a JSON object with a standard API error Ui.error = function (err, err2) { alert("Error: " + err.message); } // This always receive a jQuery error object from an API call Ui.errorAPI = function (res) { alert("Error: " + res.responseJSON.error.message); } // Event subscription Backbone.on('api:login:error', function (res) { Ui.error(res.responseJSON.error); }); Backbone.on('api:signup:error', function (res) { Ui.error(res.responseJSON.error); }); return Ui; });
Use convenience localStorage functions from Backbone Use Backbone collection to fetch orders Added new error function to Ui Fix parameters for event callbacks
Use convenience localStorage functions from Backbone Use Backbone collection to fetch orders Added new error function to Ui Fix parameters for event callbacks
JavaScript
apache-2.0
neich/nodebb,neich/nodebb,neich/nodebb
9a46fd4a6a7bbc408f258a23b141f44297b853d0
packages/zent/src/design/stripUUID.js
packages/zent/src/design/stripUUID.js
import has from 'lodash/has'; import isPlainObject from 'lodash/isPlainObject'; import isArray from 'lodash/isArray'; const UUID_KEY_PATTERN = /__.+uuid__/i; export default function stripUUID(value) { if (isPlainObject(value)) { // eslint-disable-next-line for (const key in value) { if (has(value, key)) { if (UUID_KEY_PATTERN.test(key)) { delete value[key]; } else { const oldValue = value[key]; const newValue = stripUUID(oldValue); if (newValue !== oldValue) { value[key] = newValue; } } } } } else if (isArray(value)) { value.forEach(v => stripUUID(v)); } return value; }
import has from 'lodash/has'; import isPlainObject from 'lodash/isPlainObject'; import isArray from 'lodash/isArray'; const UUID_KEY_PATTERN = /__.+uuid__/i; const OLD_KEY = 'zent-design-uuid'; export default function stripUUID(value) { if (isPlainObject(value)) { // eslint-disable-next-line for (const key in value) { if (has(value, key)) { if (OLD_KEY === key || UUID_KEY_PATTERN.test(key)) { delete value[key]; } else { const oldValue = value[key]; const newValue = stripUUID(oldValue); if (newValue !== oldValue) { value[key] = newValue; } } } } } else if (isArray(value)) { value.forEach(v => stripUUID(v)); } return value; }
Add compatibility to old uuid key
Add compatibility to old uuid key
JavaScript
mit
youzan/zent,youzan/zent,youzan/zent,youzan/zent
5caa4281c7f5e1bace711f95fe91d8edbb2fb194
test/js/fixtures/common.js
test/js/fixtures/common.js
// We use factories for the models we want to test so just set // empty fixtures here to keep the DS.FixtureAdapter quiet App.CurrentUser.FIXTURES = []; App.WallPost.FIXTURES = []; App.ProjectPhase.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Organization.FIXTURES = []; App.Project.FIXTURES = []; App.TaskFile.FIXTURES = []; App.TaskMember.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Task.FIXTURES = []; App.Page.FIXTURES = []; App.PartnerOrganization.FIXTURES = []; App.Quote.FIXTURES = []; App.Project.FIXTURES = []; App.WallPost.FIXTURES = [];
// We use factories for the models we want to test so just set // empty fixtures here to keep the DS.FixtureAdapter quiet App.CurrentUser.FIXTURES = []; App.WallPost.FIXTURES = []; App.ProjectPhase.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Organization.FIXTURES = []; App.Project.FIXTURES = []; App.TaskFile.FIXTURES = []; App.TaskMember.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Task.FIXTURES = []; App.Page.FIXTURES = []; App.Quote.FIXTURES = []; App.Project.FIXTURES = []; App.WallPost.FIXTURES = [];
Remove PartnerOrg Fixture from tests.
Remove PartnerOrg Fixture from tests. PartenrOrg are moved to 1%
JavaScript
bsd-3-clause
onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle
6359226476d6724133863ec9a806d70c2ceaadb1
routes/socket.js
routes/socket.js
/* * Socket.io Communication */ // module dependencies var crypto = require('crypto'); // variable declarations var socketCodes = {}; module.exports = function(socket) { // establish connection socket.emit('pair:init', {}); // receive device type socket.on('pair:deviceType', function(data) { // if deviceType is 'pc', generate a unique code and send to PC if(data.deviceType == 'pc') { // generate a code var code = crypto.randomBytes(3).toString('hex'); // ensure uniqueness while(code in socketCodes) { code = crypto.randomBytes(3).toString('hex'); } // store pairing code / socket assocation socketCodes[code] = this; socket.code = code; // show code on PC socket.emit('pair:sendCode', { code: code }); } // if deviceType is 'mobile', check if submitted code is valid and pair else if(data.deviceType == 'mobile') { socket.on('pair:getCode', function(data) { if(data.code in socketCodes) { // save the code for controller commands socket.code = data.code; // initialize the controller socket.emit('pair:connected', {}); // start the PC socketCodes[data.code].emit('pair:connected', {}); } else { socket.emit('pair:fail', {}); socket.disconnect(); } }); } }); };
/* * Socket.io Communication */ // module dependencies var crypto = require('crypto'); // variable declarations var socketCodes = {}; module.exports = function(socket) { // establish connection socket.emit('pair:init', {}); // pair mobile and PC // Reference: http://blog.artlogic.com/2013/06/21/phone-to-browser-html5-gaming-using-node-js-and-socket-io/ socket.on('pair:deviceType', function(data) { // if deviceType is 'pc', generate a unique code and send to PC if(data.deviceType == 'pc') { // generate a code var code = crypto.randomBytes(3).toString('hex'); // ensure code is unique while(code in socketCodes) { code = crypto.randomBytes(3).toString('hex'); } // store code / socket assocation socketCodes[code] = this; socket.code = code; // show code on PC socket.emit('pair:sendCode', { code: code }); } // if deviceType is 'mobile', check if submitted code is valid and pair else if(data.deviceType == 'mobile') { socket.on('pair:getCode', function(data) { if(data.code in socketCodes) { // save the code for mobile commands socket.code = data.code; // start mobile connection socket.emit('pair:connected', {}); // start PC connection socketCodes[data.code].emit('pair:connected', {}); } else { socket.emit('pair:fail', {}); socket.disconnect(); } }); } }); };
Add comments to pairing section
Add comments to pairing section
JavaScript
mit
drejkim/multi-screen-demo,drejkim/multi-screen-demo,drejkim/multi-screen-demo
dfaf7349385de1877225c2662b3a6fe83a7b2e23
public/script.js
public/script.js
'use strict'; /* * Tanura demo app. * * This is the main script of the app demonstrating Tanura's features. */ /** * Bootstrapping routine. */ window.onload = () => { console.log("Tanura demo."); }
'use strict'; /* * Tanura demo app. * * This is the main script of the app demonstrating Tanura's features. */ /** * Bootstrapping routine. */ window.onload = () => { console.log("Initializing Tanura..."); tanura.init({audio: true, video: true}); }
Update the demo to use tanura.init().
Update the demo to use tanura.init().
JavaScript
agpl-3.0
theOtherNuvanda/Tanura,theOtherNuvanda/Tanura,theOtherNuvanda/Tanura
e1795c6888e4a26bb563623da18217b5c6096e0d
website/src/app/project/experiments/experiment/components/tasks/mc-experiment-task-details.component.js
website/src/app/project/experiments/experiment/components/tasks/mc-experiment-task-details.component.js
angular.module('materialscommons').component('mcExperimentTaskDetails', { templateUrl: 'app/project/experiments/experiment/components/tasks/mc-experiment-task-details.html', controller: MCExperimentTaskDetailsComponentController, bindings: { task: '=' } }); /*@ngInject*/ function MCExperimentTaskDetailsComponentController($scope, editorOpts, currentTask, templates, template, experimentsService, $stateParams, toast) { let ctrl = this; ctrl.currentTask = currentTask.get(); var t = templates.getTemplate('As Received'); template.set(t); $scope.editorOptions = editorOpts({height: 25, width: 20}); ctrl.selectedTemplate = (templateId, processId) => { console.log('selectedTemplate', templateId, processId); }; ctrl.updateTaskNote = () => { console.log('updateTaskNote'); if (ctrl.task.note === null) { ctrl.task.note = ""; } experimentsService.updateTask($stateParams.project_id, $stateParams.experiment_id, ctrl.task.id, {note: ctrl.task.note}) .then( () => null, () => toast.error('Unable to update task note.') ); }; }
angular.module('materialscommons').component('mcExperimentTaskDetails', { templateUrl: 'app/project/experiments/experiment/components/tasks/mc-experiment-task-details.html', controller: MCExperimentTaskDetailsComponentController, bindings: { task: '=' } }); /*@ngInject*/ function MCExperimentTaskDetailsComponentController($scope, editorOpts, currentTask, templates, template, experimentsService, $stateParams, toast) { let ctrl = this; ctrl.currentTask = currentTask.get(); var t = templates.getTemplate('As Received'); template.set(t); $scope.editorOptions = editorOpts({height: 25, width: 20}); ctrl.selectedTemplate = (templateId, processId) => { console.log('selectedTemplate', templateId, processId); }; ctrl.updateTaskNote = () => { if (ctrl.task.note === null) { return; } experimentsService.updateTask($stateParams.project_id, $stateParams.experiment_id, ctrl.task.id, {note: ctrl.task.note}) .then( () => null, () => toast.error('Unable to update task note.') ); }; }
Return if note is null.
Return if note is null.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
2bb4efab77c87ffd6c395c77d00b7890542d0630
test/editor.js
test/editor.js
var confy = require('../index'); var testCase = require('nodeunit').testCase; confy.configFile = __dirname + '/.confy'; confy.clean(); process.ENV.EDITOR = __dirname + '/editorcmd'; module.exports = testCase({ setUp: function (callback) { confy.clean(); callback(); }, tearDown: function (callback) { confy.clean(); callback(); }, editor: function(t) { confy.get('foo', { require: { foo: "" } }, function(err, res) { t.ok(!err, 'error is null'); t.deepEqual(res, { foo: 'bar' }, 'editor write file'); t.done(); }); } });
var confy = require('../index'); var testCase = require('nodeunit').testCase; confy.configFile = __dirname + '/.confy'; confy.clean(); process.env.EDITOR = __dirname + '/editorcmd'; module.exports = testCase({ setUp: function (callback) { confy.clean(); callback(); }, tearDown: function (callback) { confy.clean(); callback(); }, editor: function(t) { confy.get('foo', { require: { foo: "" } }, function(err, res) { t.ok(!err, 'error is null'); t.deepEqual(res, { foo: 'bar' }, 'editor write file'); t.done(); }); } });
Fix process.ENV is not supported v0.6.x
Fix process.ENV is not supported v0.6.x
JavaScript
mit
hokaccha/node-confy
be3e67e981125cb4e835abedc87df3c693152a2c
src/query/NicknameQuery.js
src/query/NicknameQuery.js
import { db, Rat } from '../db' import Query from './index' /** * A class representing a rat query */ class NicknameQuery extends Query { /** * Create a sequelize rat query from a set of parameters * @constructor * @param params * @param connection */ constructor (params, connection) { super(params, connection) if (params.nickname) { let formattedNickname = params.nickname.replace(/\[(.*?)]$/g, '') this._query.where.nicknames = { $overlap: db.literal(`ARRAY[${db.escape(params.nickname)}, ${db.escape(formattedNickname)}]::citext[]`) } delete this._query.where.nickname } this._query.attributes = [ 'id', 'createdAt', 'updatedAt', 'email', 'displayRatId', [db.cast(db.col('nicknames'), 'text[]'), 'nicknames'] ] this._query.include = [{ model: Rat, as: 'rats', required: false, attributes: { exclude: [ 'deletedAt' ] } }] } } module.exports = NicknameQuery
import { db, Rat } from '../db' import Query from './index' /** * A class representing a rat query */ class NicknameQuery extends Query { /** * Create a sequelize rat query from a set of parameters * @constructor * @param params * @param connection */ constructor (params, connection) { super(params, connection) if (params.nickname) { let formattedNickname = params.nickname.replace(/\[(.*?)]$/g, '') this._query.where.nicknames = { $overlap: [params.nickname, formattedNickname] } delete this._query.where.nickname } this._query.attributes = [ 'id', 'createdAt', 'updatedAt', 'email', 'displayRatId', 'nicknames' ] this._query.include = [{ model: Rat, as: 'rats', required: false, attributes: { exclude: [ 'deletedAt' ] } }] } } module.exports = NicknameQuery
Remove some lingering citext stuff from nickname query
Remove some lingering citext stuff from nickname query
JavaScript
bsd-3-clause
FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com
d2dde55619473b30dd16fd2276e81977dffd5593
src/rar-file/rar-stream.js
src/rar-file/rar-stream.js
//@flow import {Readable} from 'stream'; import RarFileChunk from './rar-file-chunk'; export default class RarStream extends Readable { _rarFileChunks: RarFileChunk[]; _byteOffset: number = 0; constructor(...rarFileChunks: RarFileChunk[]){ super(); this._next(rarFileChunks); } pushData(stream: Readable, chunk: ?(Buffer | string)) : ?boolean { if (!super.push(chunk)){ stream.pause(); } } _next(rarFileChunks: RarFileChunk[]) { const chunk = rarFileChunks.shift(); if(!chunk){ this.push(null); } else { chunk.getStream().then((stream) => { stream.on('data', (data) => this.pushData(stream, data)); stream.on('end', () => this._next(rarFileChunks)); }); } } _read (){ this.resume(); } }
//@flow import {Readable} from 'stream'; import RarFileChunk from './rar-file-chunk'; export default class RarStream extends Readable { constructor(...rarFileChunks: RarFileChunk[]){ super(); this._next(rarFileChunks); } pushData(stream: Readable, chunk: ?(Buffer | string)) : ?boolean { if (!super.push(chunk)){ stream.pause(); } } _next(rarFileChunks: RarFileChunk[]) { const chunk = rarFileChunks.shift(); if(!chunk){ this.push(null); } else { chunk.getStream().then((stream) => { stream.on('data', (data) => this.pushData(stream, data)); stream.on('end', () => this._next(rarFileChunks)); }); } } _read (){ this.resume(); } }
Remove class state from RarStream
Remove class state from RarStream
JavaScript
mit
1313/rar-stream
6e2d7b798504d57c549e3e3750d88e0785f70f71
src/components/WeaveElement.js
src/components/WeaveElement.js
import React, { Component } from 'react'; import '../styles/WeaveElement.css'; class WeaveElement extends Component { constructor() { super(); this.state = {red: false}; this.handleClick = this.handleClick.bind(this); } render() { const style = this.state.red ? "WeaveElement redWeaveElement" : "WeaveElement whiteWeaveElement"; return (<div onClick={this.handleClick} className={style}></div>); } handleClick(e) { if (this.state.red) this.setState({'red': false}); else this.setState({'red': true}); } } export default WeaveElement;
import React, { Component } from 'react'; import '../styles/WeaveElement.css'; class WeaveElement extends Component { constructor() { super(); this.handleClick = this.handleClick.bind(this); } componentState() { const row = this.props.row; const col = this.props.col; const weaves = this.props.currentState.weaves; if (weaves[row]) { if (weaves[row][col] === undefined || weaves[row][col] === false) { return false; } else { return true; } } else { return false; } } render() { const style = this.componentState() ? "WeaveElement redWeaveElement" : "WeaveElement whiteWeaveElement"; return (<div onClick={this.handleClick} className={style}></div>); } handleClick(e) { if (this.componentState()) this.props.offClick(this.props.row, this.props.col); else this.props.onClick(this.props.row, this.props.col); } } export default WeaveElement;
Add method componentState and remove inner state
Add method componentState and remove inner state
JavaScript
mit
nobus/weaver,nobus/weaver
7fd8521156a34ddee04f150548e00838561aa97c
src/components/common/index.js
src/components/common/index.js
export { Avatar } from './Avatar'; export Button from './Button'; export FloatingAction from './FloatingAction'; export FullScreenTextArea from './FullScreenTextArea'; export Icon from './Icon'; export User from './User';
export { Avatar } from './Avatar'; export Button from './Button'; export FullScreenTextArea from './FullScreenTextArea'; export Icon from './Icon'; export User from './User';
Remove floating action from export
Remove floating action from export
JavaScript
mit
tobycyanide/felony,tobycyanide/felony,henryboldi/felony,henryboldi/felony
6ca61608e8bed65e03d59b224af62e312dcd1626
generators/gulp/index.js
generators/gulp/index.js
'use strict'; var yeoman = require('yeoman-generator'); module.exports = yeoman.generators.Base.extend({ initializing: function() { this.option('gh_page_type', { type: String, required: true, desc: 'Github page type (user or project)' }); this._set_branch_option(); }, _set_branch_option: function() { this.options.branch_name = this.options.gh_page_type === 'user' ? 'master' : 'gh-pages'; }, writing: function() { this.fs.copyTpl( this.templatePath('gulpfile.js'), this.destinationPath('gulpfile.js'), this.options ); } });
'use strict'; var yeoman = require('yeoman-generator'); module.exports = yeoman.generators.Base.extend({ initializing: function() { this.option('gh_page_type', { type: String, required: true, desc: 'Github page type (user, organization, or project)' }); this._set_branch_option(); }, _set_branch_option: function() { var is_user_or_org = (/user|organization/i).test(this.options.gh_page_type); this.options.branch_name = is_user_or_org ? 'master' : 'gh-pages'; }, writing: function() { this.fs.copyTpl( this.templatePath('gulpfile.js'), this.destinationPath('gulpfile.js'), this.options ); } });
Adjust gulp generator to support github orgs
Adjust gulp generator to support github orgs
JavaScript
mit
gjeck/generator-jekyll-ghpages,gjeck/generator-jekyll-ghpages,gjeck/generator-jekyll-ghpages
297a346983d1353b4eaa82ca25cfae88a2eed208
app/js/directives/morph_form.js
app/js/directives/morph_form.js
annotationApp.directive('morphForm', function() { return { restrict: 'E', scope: true, templateUrl: 'templates/morph_form.html' }; });
"use strict"; annotationApp.directive('morphForm', function() { return { restrict: 'E', scope: true, templateUrl: 'templates/morph_form.html' }; });
Use strict in morphForm directive
Use strict in morphForm directive
JavaScript
mit
PonteIneptique/arethusa,latin-language-toolkit/arethusa,Masoumeh/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,latin-language-toolkit/arethusa,PonteIneptique/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa
1646d23736e1f9fb7125136ed2ed934556d197d0
Build/Config.js
Build/Config.js
// Project configuration. var pkg = require("../package"); module.exports = { "package" : pkg, "paths" : { "private": "Resources/Private", "public": "Resources/Public", }, "Sass" : { "sassDir" : "Resources/Private/Sass", "cssDir" : "Resources/Public/Stylesheets" }, "JavaScripts" : { "devDir" : "Resources/Private/Javascripts", "distDir" : "Resources/Public/Javascripts", "config" : "Resources/Private/Javascripts/Main.js", "requireJS" : "Resources/Private/Javascripts/Libaries/RequireJS/require", "compileDistFile" : "Resources/Public/Javascripts/Main.min.js" }, "Images" : { "devDir" : "Resources/Private/Images", "distDir" : "Resources/Public/Images", "optimizationLevel" : 5 }, "packageIsDefault" : (pkg.name === "t3b_template") ? true : false // Check if the defaults in 'package.json' are customized. };
// Project configuration. var pkg = require("../package"); module.exports = { "package" : pkg, "paths" : { "private": "Resources/Private", "public": "Resources/Public", }, "Sass" : { "sassDir" : "Resources/Private/Sass", "cssDir" : "Resources/Public/Stylesheets" }, "JavaScripts" : { "devDir" : "Resources/Private/Javascripts", "distDir" : "Resources/Public/Javascripts", "config" : "Resources/Private/Javascripts/Main.js", "requireJS" : "Resources/Private/Javascripts/Libaries/RequireJS/require", "compileDistFile" : "Resources/Public/Javascripts/Main.min.js" }, "Images" : { "devDir" : "Resources/Private/Images", "distDir" : "Resources/Public/Images", "optimizationLevel" : 5 }, "packageIsDefault" : pkg.name === "t3b_template" // Check if the defaults in 'package.json' are customized. };
Simplify the grunt 'packageIsDefault' check
[MISC] Simplify the grunt 'packageIsDefault' check
JavaScript
mit
t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template
ca1b5aa9ad844425fe7efae1d1cf03ff97125a5b
server/database/index.js
server/database/index.js
import Sequelize from 'sequelize' import logger from '../helpers/logger' import config from './config' const { url, dialect } = config[process.env.NODE_ENV] export default new Sequelize(url, { logging: msg => { logger.debug(msg) }, dialect, operatorsAliases: false, // @TODO Remove this option in sequelize@>=5.0 })
import Sequelize from 'sequelize' import config from './config' import logger from '../helpers/logger' const { url, dialect } = config[process.env.NODE_ENV] export default new Sequelize(url, { dialect, logging: msg => { logger.debug(msg) }, })
Remove unneded database options after upgrading to Sequelize 5
Remove unneded database options after upgrading to Sequelize 5
JavaScript
agpl-3.0
adzialocha/hoffnung3000,adzialocha/hoffnung3000
85acc479edf0d08bd3216b4a0b36748117670dc1
source/popup/js/index.js
source/popup/js/index.js
import { placeStylesheet } from "../../common/styles"; window.Buttercup = { fetchArchives: function() { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out getting archive list")), 200); chrome.runtime.sendMessage({ command: "get-archive-states" }, function(response) { clearTimeout(timeout); resolve(response); }); }); }, lockArchive: function(name) { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 200); chrome.runtime.sendMessage({ command: "lock-archive", name }, function(response) { clearTimeout(timeout); if (response && response.ok) { resolve(response); } else { reject(new Error(response.error)); } }); }); } }; placeStylesheet();
import { placeStylesheet } from "../../common/styles"; window.Buttercup = { fetchArchives: function() { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out getting archive list")), 200); chrome.runtime.sendMessage({ command: "get-archive-states" }, function(response) { clearTimeout(timeout); resolve(response); }); }); }, lockArchive: function(name) { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 4000); chrome.runtime.sendMessage({ command: "lock-archive", name }, function(response) { clearTimeout(timeout); if (response && response.ok) { resolve(response); } else { reject(new Error(response.error)); } }); }); } }; placeStylesheet();
Increase timeout for locking archives
Increase timeout for locking archives
JavaScript
mit
perry-mitchell/buttercup-chrome,perry-mitchell/buttercup-chrome,buttercup-pw/buttercup-browser-extension,buttercup-pw/buttercup-browser-extension
58d921e92620f220dc73d49792f791add873caaf
packages/test-in-browser/package.js
packages/test-in-browser/package.js
Package.describe({ summary: "Run tests interactively in the browser", version: '1.0.6' }); Package.onUse(function (api) { // XXX this should go away, and there should be a clean interface // that tinytest and the driver both implement? api.use('tinytest'); api.use('bootstrap@1.0.1'); api.use('underscore'); api.use('session'); api.use('reload'); api.use(['blaze', 'templating', 'spacebars', 'ddp', 'tracker'], 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles([ 'driver.css', 'driver.html', 'driver.js' ], "client"); api.use('autoupdate', 'server', {weak: true}); api.use('random', 'server'); api.addFiles('autoupdate.js', 'server'); });
Package.describe({ summary: "Run tests interactively in the browser", version: '1.0.6', documentation: null }); Package.onUse(function (api) { // XXX this should go away, and there should be a clean interface // that tinytest and the driver both implement? api.use('tinytest'); api.use('bootstrap@1.0.1'); api.use('underscore'); api.use('session'); api.use('reload'); api.use(['blaze', 'templating', 'spacebars', 'ddp', 'tracker'], 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles([ 'driver.css', 'driver.html', 'driver.js' ], "client"); api.use('autoupdate', 'server', {weak: true}); api.use('random', 'server'); api.addFiles('autoupdate.js', 'server'); });
Test in browser doesn't need docs right now
Test in browser doesn't need docs right now Conflicts: packages/test-in-browser/package.js
JavaScript
mit
mauricionr/meteor,jenalgit/meteor,shmiko/meteor,vacjaliu/meteor,iman-mafi/meteor,papimomi/meteor,chasertech/meteor,jagi/meteor,vjau/meteor,framewr/meteor,vacjaliu/meteor,daltonrenaldo/meteor,chengxiaole/meteor,dev-bobsong/meteor,EduShareOntario/meteor,stevenliuit/meteor,allanalexandre/meteor,shrop/meteor,Prithvi-A/meteor,deanius/meteor,devgrok/meteor,AnjirHossain/meteor,zdd910/meteor,cbonami/meteor,cherbst/meteor,chasertech/meteor,TribeMedia/meteor,henrypan/meteor,daslicht/meteor,Jonekee/meteor,codingang/meteor,youprofit/meteor,lpinto93/meteor,lassombra/meteor,AnthonyAstige/meteor,4commerce-technologies-AG/meteor,karlito40/meteor,steedos/meteor,yanisIk/meteor,yanisIk/meteor,Eynaliyev/meteor,chmac/meteor,yinhe007/meteor,HugoRLopes/meteor,LWHTarena/meteor,mirstan/meteor,michielvanoeffelen/meteor,karlito40/meteor,brdtrpp/meteor,lorensr/meteor,lieuwex/meteor,aldeed/meteor,codedogfish/meteor,guazipi/meteor,EduShareOntario/meteor,Hansoft/meteor,daslicht/meteor,sdeveloper/meteor,chasertech/meteor,yiliaofan/meteor,GrimDerp/meteor,planet-training/meteor,meteor-velocity/meteor,namho102/meteor,qscripter/meteor,allanalexandre/meteor,codedogfish/meteor,ashwathgovind/meteor,iman-mafi/meteor,Prithvi-A/meteor,sitexa/meteor,Profab/meteor,newswim/meteor,williambr/meteor,fashionsun/meteor,Jonekee/meteor,l0rd0fwar/meteor,udhayam/meteor,neotim/meteor,Ken-Liu/meteor,juansgaitan/meteor,alexbeletsky/meteor,AnthonyAstige/meteor,arunoda/meteor,guazipi/meteor,shrop/meteor,emmerge/meteor,queso/meteor,tdamsma/meteor,evilemon/meteor,neotim/meteor,DAB0mB/meteor,pandeysoni/meteor,planet-training/meteor,kengchau/meteor,Jeremy017/meteor,benstoltz/meteor,eluck/meteor,jagi/meteor,nuvipannu/meteor,yalexx/meteor,fashionsun/meteor,rozzzly/meteor,jirengu/meteor,johnthepink/meteor,vacjaliu/meteor,elkingtonmcb/meteor,guazipi/meteor,baysao/meteor,yonas/meteor-freebsd,jg3526/meteor,skarekrow/meteor,Eynaliyev/meteor,rabbyalone/meteor,daslicht/meteor,brettle/meteor,katopz/meteor,justintung/meteor,kengchau/meteor,PatrickMcGuinness/meteor,TribeMedia/meteor,jirengu/meteor,jirengu/meteor,ndarilek/meteor,rabbyalone/meteor,lassombra/meteor,ljack/meteor,akintoey/meteor,yiliaofan/meteor,yonglehou/meteor,msavin/meteor,D1no/meteor,henrypan/meteor,chengxiaole/meteor,LWHTarena/meteor,wmkcc/meteor,henrypan/meteor,benstoltz/meteor,shmiko/meteor,eluck/meteor,cog-64/meteor,hristaki/meteor,kencheung/meteor,ashwathgovind/meteor,zdd910/meteor,shadedprofit/meteor,meteor-velocity/meteor,rozzzly/meteor,Eynaliyev/meteor,ljack/meteor,bhargav175/meteor,sclausen/meteor,iman-mafi/meteor,AlexR1712/meteor,imanmafi/meteor,jagi/meteor,lpinto93/meteor,chmac/meteor,lassombra/meteor,evilemon/meteor,mjmasn/meteor,bhargav175/meteor,ashwathgovind/meteor,benstoltz/meteor,h200863057/meteor,Paulyoufu/meteor-1,Hansoft/meteor,cherbst/meteor,yyx990803/meteor,Urigo/meteor,aldeed/meteor,Ken-Liu/meteor,sunny-g/meteor,karlito40/meteor,mjmasn/meteor,fashionsun/meteor,Ken-Liu/meteor,paul-barry-kenzan/meteor,guazipi/meteor,fashionsun/meteor,daltonrenaldo/meteor,jrudio/meteor,luohuazju/meteor,PatrickMcGuinness/meteor,4commerce-technologies-AG/meteor,pjump/meteor,EduShareOntario/meteor,modulexcite/meteor,esteedqueen/meteor,qscripter/meteor,Urigo/meteor,youprofit/meteor,qscripter/meteor,baiyunping333/meteor,HugoRLopes/meteor,Profab/meteor,saisai/meteor,sitexa/meteor,oceanzou123/meteor,newswim/meteor,cbonami/meteor,D1no/meteor,somallg/meteor,namho102/meteor,oceanzou123/meteor,newswim/meteor,brdtrpp/meteor,wmkcc/meteor,lassombra/meteor,alexbeletsky/meteor,ndarilek/meteor,yanisIk/meteor,meteor-velocity/meteor,JesseQin/meteor,brdtrpp/meteor,shmiko/meteor,brettle/meteor,meonkeys/meteor,framewr/meteor,somallg/meteor,DAB0mB/meteor,elkingtonmcb/meteor,queso/meteor,planet-training/meteor,somallg/meteor,AlexR1712/meteor,lieuwex/meteor,kengchau/meteor,Quicksteve/meteor,yyx990803/meteor,Eynaliyev/meteor,elkingtonmcb/meteor,udhayam/meteor,pjump/meteor,GrimDerp/meteor,youprofit/meteor,h200863057/meteor,planet-training/meteor,DCKT/meteor,papimomi/meteor,ericterpstra/meteor,alphanso/meteor,shrop/meteor,h200863057/meteor,mjmasn/meteor,DAB0mB/meteor,baiyunping333/meteor,TribeMedia/meteor,rabbyalone/meteor,jirengu/meteor,somallg/meteor,colinligertwood/meteor,aldeed/meteor,sdeveloper/meteor,ljack/meteor,joannekoong/meteor,hristaki/meteor,calvintychan/meteor,mauricionr/meteor,daltonrenaldo/meteor,lpinto93/meteor,TechplexEngineer/meteor,lpinto93/meteor,emmerge/meteor,cbonami/meteor,somallg/meteor,vacjaliu/meteor,dev-bobsong/meteor,sclausen/meteor,alexbeletsky/meteor,HugoRLopes/meteor,justintung/meteor,yinhe007/meteor,Theviajerock/meteor,daltonrenaldo/meteor,kidaa/meteor,HugoRLopes/meteor,joannekoong/meteor,vacjaliu/meteor,katopz/meteor,Ken-Liu/meteor,codingang/meteor,mubassirhayat/meteor,Theviajerock/meteor,benjamn/meteor,colinligertwood/meteor,aldeed/meteor,elkingtonmcb/meteor,calvintychan/meteor,Jeremy017/meteor,yalexx/meteor,steedos/meteor,hristaki/meteor,Theviajerock/meteor,jrudio/meteor,AnthonyAstige/meteor,rozzzly/meteor,tdamsma/meteor,Profab/meteor,Eynaliyev/meteor,meonkeys/meteor,hristaki/meteor,kencheung/meteor,Urigo/meteor,jrudio/meteor,codedogfish/meteor,daltonrenaldo/meteor,jdivy/meteor,PatrickMcGuinness/meteor,emmerge/meteor,DAB0mB/meteor,TechplexEngineer/meteor,Urigo/meteor,Urigo/meteor,vacjaliu/meteor,pandeysoni/meteor,shadedprofit/meteor,somallg/meteor,esteedqueen/meteor,lawrenceAIO/meteor,whip112/meteor,bhargav175/meteor,williambr/meteor,dfischer/meteor,dfischer/meteor,emmerge/meteor,deanius/meteor,jdivy/meteor,DCKT/meteor,HugoRLopes/meteor,vjau/meteor,ndarilek/meteor,akintoey/meteor,rabbyalone/meteor,Eynaliyev/meteor,Quicksteve/meteor,jeblister/meteor,johnthepink/meteor,zdd910/meteor,brettle/meteor,Jonekee/meteor,chmac/meteor,sitexa/meteor,modulexcite/meteor,SeanOceanHu/meteor,chiefninew/meteor,pjump/meteor,guazipi/meteor,yonglehou/meteor,codedogfish/meteor,brettle/meteor,msavin/meteor,yalexx/meteor,michielvanoeffelen/meteor,Hansoft/meteor,alexbeletsky/meteor,l0rd0fwar/meteor,kengchau/meteor,paul-barry-kenzan/meteor,papimomi/meteor,chengxiaole/meteor,ndarilek/meteor,shadedprofit/meteor,saisai/meteor,lawrenceAIO/meteor,allanalexandre/meteor,sunny-g/meteor,SeanOceanHu/meteor,joannekoong/meteor,dandv/meteor,shmiko/meteor,vjau/meteor,vjau/meteor,aldeed/meteor,Theviajerock/meteor,codingang/meteor,cog-64/meteor,msavin/meteor,ericterpstra/meteor,saisai/meteor,wmkcc/meteor,colinligertwood/meteor,jg3526/meteor,imanmafi/meteor,lorensr/meteor,fashionsun/meteor,judsonbsilva/meteor,whip112/meteor,mubassirhayat/meteor,ericterpstra/meteor,SeanOceanHu/meteor,JesseQin/meteor,dfischer/meteor,michielvanoeffelen/meteor,servel333/meteor,Prithvi-A/meteor,AnthonyAstige/meteor,judsonbsilva/meteor,imanmafi/meteor,framewr/meteor,alphanso/meteor,katopz/meteor,ndarilek/meteor,bhargav175/meteor,esteedqueen/meteor,mubassirhayat/meteor,lorensr/meteor,DAB0mB/meteor,stevenliuit/meteor,queso/meteor,juansgaitan/meteor,arunoda/meteor,youprofit/meteor,udhayam/meteor,whip112/meteor,nuvipannu/meteor,rabbyalone/meteor,Jonekee/meteor,Paulyoufu/meteor-1,Prithvi-A/meteor,planet-training/meteor,rozzzly/meteor,kidaa/meteor,brettle/meteor,yinhe007/meteor,jagi/meteor,rozzzly/meteor,dboyliao/meteor,mirstan/meteor,sitexa/meteor,kidaa/meteor,ericterpstra/meteor,deanius/meteor,chinasb/meteor,benjamn/meteor,judsonbsilva/meteor,oceanzou123/meteor,aldeed/meteor,neotim/meteor,williambr/meteor,meteor-velocity/meteor,papimomi/meteor,deanius/meteor,chiefninew/meteor,aleclarson/meteor,dboyliao/meteor,framewr/meteor,lorensr/meteor,kencheung/meteor,chmac/meteor,yalexx/meteor,tdamsma/meteor,SeanOceanHu/meteor,aramk/meteor,yyx990803/meteor,namho102/meteor,yyx990803/meteor,mirstan/meteor,kidaa/meteor,framewr/meteor,msavin/meteor,katopz/meteor,DAB0mB/meteor,chasertech/meteor,dboyliao/meteor,johnthepink/meteor,JesseQin/meteor,colinligertwood/meteor,vjau/meteor,LWHTarena/meteor,chinasb/meteor,jagi/meteor,meonkeys/meteor,shadedprofit/meteor,lieuwex/meteor,AnjirHossain/meteor,sunny-g/meteor,skarekrow/meteor,mirstan/meteor,mauricionr/meteor,chiefninew/meteor,ashwathgovind/meteor,namho102/meteor,elkingtonmcb/meteor,shrop/meteor,l0rd0fwar/meteor,cherbst/meteor,AnthonyAstige/meteor,colinligertwood/meteor,whip112/meteor,IveWong/meteor,hristaki/meteor,allanalexandre/meteor,lieuwex/meteor,chiefninew/meteor,allanalexandre/meteor,ljack/meteor,sclausen/meteor,Theviajerock/meteor,chasertech/meteor,sdeveloper/meteor,jg3526/meteor,akintoey/meteor,meonkeys/meteor,chiefninew/meteor,TechplexEngineer/meteor,ljack/meteor,luohuazju/meteor,Hansoft/meteor,IveWong/meteor,lieuwex/meteor,fashionsun/meteor,brdtrpp/meteor,juansgaitan/meteor,qscripter/meteor,yonas/meteor-freebsd,Ken-Liu/meteor,saisai/meteor,allanalexandre/meteor,yiliaofan/meteor,yonas/meteor-freebsd,rabbyalone/meteor,aramk/meteor,GrimDerp/meteor,calvintychan/meteor,michielvanoeffelen/meteor,jdivy/meteor,aleclarson/meteor,AnthonyAstige/meteor,kencheung/meteor,dev-bobsong/meteor,Urigo/meteor,cog-64/meteor,baiyunping333/meteor,paul-barry-kenzan/meteor,williambr/meteor,pandeysoni/meteor,fashionsun/meteor,Quicksteve/meteor,lpinto93/meteor,oceanzou123/meteor,baiyunping333/meteor,nuvipannu/meteor,pandeysoni/meteor,yiliaofan/meteor,nuvipannu/meteor,baysao/meteor,yonglehou/meteor,jeblister/meteor,hristaki/meteor,iman-mafi/meteor,4commerce-technologies-AG/meteor,AlexR1712/meteor,Eynaliyev/meteor,chengxiaole/meteor,alphanso/meteor,benjamn/meteor,justintung/meteor,jirengu/meteor,chasertech/meteor,Puena/meteor,justintung/meteor,johnthepink/meteor,Ken-Liu/meteor,h200863057/meteor,steedos/meteor,lassombra/meteor,jenalgit/meteor,codedogfish/meteor,chmac/meteor,wmkcc/meteor,skarekrow/meteor,AnthonyAstige/meteor,mjmasn/meteor,dfischer/meteor,joannekoong/meteor,yonas/meteor-freebsd,allanalexandre/meteor,johnthepink/meteor,devgrok/meteor,cherbst/meteor,servel333/meteor,tdamsma/meteor,steedos/meteor,JesseQin/meteor,brdtrpp/meteor,jeblister/meteor,udhayam/meteor,Puena/meteor,kidaa/meteor,SeanOceanHu/meteor,dandv/meteor,devgrok/meteor,steedos/meteor,Prithvi-A/meteor,yanisIk/meteor,eluck/meteor,karlito40/meteor,codingang/meteor,codingang/meteor,baysao/meteor,steedos/meteor,chengxiaole/meteor,evilemon/meteor,ericterpstra/meteor,msavin/meteor,EduShareOntario/meteor,cbonami/meteor,tdamsma/meteor,AnjirHossain/meteor,Jeremy017/meteor,arunoda/meteor,evilemon/meteor,newswim/meteor,mirstan/meteor,evilemon/meteor,mjmasn/meteor,codedogfish/meteor,Jeremy017/meteor,dandv/meteor,queso/meteor,Theviajerock/meteor,lpinto93/meteor,namho102/meteor,codedogfish/meteor,HugoRLopes/meteor,jg3526/meteor,lawrenceAIO/meteor,JesseQin/meteor,brdtrpp/meteor,D1no/meteor,jenalgit/meteor,cog-64/meteor,meteor-velocity/meteor,queso/meteor,colinligertwood/meteor,paul-barry-kenzan/meteor,shadedprofit/meteor,yiliaofan/meteor,Puena/meteor,cbonami/meteor,EduShareOntario/meteor,yinhe007/meteor,qscripter/meteor,yanisIk/meteor,meonkeys/meteor,alexbeletsky/meteor,queso/meteor,jdivy/meteor,calvintychan/meteor,luohuazju/meteor,Hansoft/meteor,somallg/meteor,sdeveloper/meteor,youprofit/meteor,benjamn/meteor,Paulyoufu/meteor-1,vacjaliu/meteor,dboyliao/meteor,joannekoong/meteor,daltonrenaldo/meteor,aleclarson/meteor,Jonekee/meteor,jdivy/meteor,esteedqueen/meteor,framewr/meteor,elkingtonmcb/meteor,modulexcite/meteor,TechplexEngineer/meteor,LWHTarena/meteor,devgrok/meteor,deanius/meteor,calvintychan/meteor,daslicht/meteor,kencheung/meteor,jenalgit/meteor,baysao/meteor,kengchau/meteor,iman-mafi/meteor,nuvipannu/meteor,udhayam/meteor,jrudio/meteor,sitexa/meteor,evilemon/meteor,akintoey/meteor,skarekrow/meteor,daslicht/meteor,guazipi/meteor,katopz/meteor,lawrenceAIO/meteor,Ken-Liu/meteor,pjump/meteor,jirengu/meteor,sunny-g/meteor,TechplexEngineer/meteor,PatrickMcGuinness/meteor,saisai/meteor,kencheung/meteor,eluck/meteor,neotim/meteor,arunoda/meteor,oceanzou123/meteor,PatrickMcGuinness/meteor,alphanso/meteor,zdd910/meteor,emmerge/meteor,allanalexandre/meteor,Quicksteve/meteor,baysao/meteor,IveWong/meteor,pandeysoni/meteor,h200863057/meteor,AnjirHossain/meteor,dboyliao/meteor,eluck/meteor,DCKT/meteor,arunoda/meteor,DAB0mB/meteor,msavin/meteor,Puena/meteor,dev-bobsong/meteor,cog-64/meteor,karlito40/meteor,steedos/meteor,yalexx/meteor,johnthepink/meteor,sdeveloper/meteor,shmiko/meteor,luohuazju/meteor,whip112/meteor,4commerce-technologies-AG/meteor,sdeveloper/meteor,luohuazju/meteor,justintung/meteor,ericterpstra/meteor,newswim/meteor,jenalgit/meteor,GrimDerp/meteor,shmiko/meteor,daslicht/meteor,namho102/meteor,Puena/meteor,HugoRLopes/meteor,youprofit/meteor,AlexR1712/meteor,Profab/meteor,baysao/meteor,planet-training/meteor,LWHTarena/meteor,alphanso/meteor,D1no/meteor,paul-barry-kenzan/meteor,katopz/meteor,lieuwex/meteor,benjamn/meteor,DCKT/meteor,D1no/meteor,kengchau/meteor,saisai/meteor,dandv/meteor,imanmafi/meteor,baiyunping333/meteor,yanisIk/meteor,lassombra/meteor,udhayam/meteor,devgrok/meteor,ericterpstra/meteor,dboyliao/meteor,rozzzly/meteor,GrimDerp/meteor,luohuazju/meteor,skarekrow/meteor,imanmafi/meteor,GrimDerp/meteor,kencheung/meteor,lieuwex/meteor,SeanOceanHu/meteor,emmerge/meteor,dboyliao/meteor,sclausen/meteor,henrypan/meteor,jg3526/meteor,mubassirhayat/meteor,DCKT/meteor,imanmafi/meteor,sunny-g/meteor,saisai/meteor,TechplexEngineer/meteor,lpinto93/meteor,servel333/meteor,williambr/meteor,PatrickMcGuinness/meteor,shadedprofit/meteor,Quicksteve/meteor,D1no/meteor,ashwathgovind/meteor,pjump/meteor,jrudio/meteor,johnthepink/meteor,yinhe007/meteor,AlexR1712/meteor,jagi/meteor,williambr/meteor,ashwathgovind/meteor,esteedqueen/meteor,oceanzou123/meteor,joannekoong/meteor,namho102/meteor,chmac/meteor,cherbst/meteor,codingang/meteor,servel333/meteor,papimomi/meteor,aramk/meteor,alphanso/meteor,jg3526/meteor,sunny-g/meteor,JesseQin/meteor,yyx990803/meteor,jrudio/meteor,EduShareOntario/meteor,SeanOceanHu/meteor,judsonbsilva/meteor,rabbyalone/meteor,bhargav175/meteor,yalexx/meteor,stevenliuit/meteor,cherbst/meteor,chengxiaole/meteor,Eynaliyev/meteor,judsonbsilva/meteor,sclausen/meteor,chengxiaole/meteor,Jonekee/meteor,mubassirhayat/meteor,whip112/meteor,wmkcc/meteor,akintoey/meteor,shrop/meteor,tdamsma/meteor,ndarilek/meteor,yonglehou/meteor,nuvipannu/meteor,kidaa/meteor,sunny-g/meteor,sunny-g/meteor,chmac/meteor,meteor-velocity/meteor,neotim/meteor,benstoltz/meteor,stevenliuit/meteor,jirengu/meteor,Jeremy017/meteor,4commerce-technologies-AG/meteor,lorensr/meteor,juansgaitan/meteor,akintoey/meteor,karlito40/meteor,msavin/meteor,youprofit/meteor,udhayam/meteor,yinhe007/meteor,l0rd0fwar/meteor,dev-bobsong/meteor,papimomi/meteor,henrypan/meteor,qscripter/meteor,codingang/meteor,eluck/meteor,vjau/meteor,sclausen/meteor,rozzzly/meteor,yonglehou/meteor,lawrenceAIO/meteor,yonas/meteor-freebsd,benstoltz/meteor,jenalgit/meteor,dev-bobsong/meteor,mauricionr/meteor,michielvanoeffelen/meteor,arunoda/meteor,bhargav175/meteor,yiliaofan/meteor,modulexcite/meteor,oceanzou123/meteor,DCKT/meteor,mauricionr/meteor,Prithvi-A/meteor,wmkcc/meteor,IveWong/meteor,cbonami/meteor,justintung/meteor,henrypan/meteor,stevenliuit/meteor,Hansoft/meteor,juansgaitan/meteor,TribeMedia/meteor,lawrenceAIO/meteor,ashwathgovind/meteor,AnjirHossain/meteor,neotim/meteor,ljack/meteor,pjump/meteor,jeblister/meteor,TechplexEngineer/meteor,kidaa/meteor,yonglehou/meteor,dandv/meteor,sitexa/meteor,sitexa/meteor,karlito40/meteor,4commerce-technologies-AG/meteor,servel333/meteor,yonas/meteor-freebsd,mauricionr/meteor,bhargav175/meteor,chinasb/meteor,judsonbsilva/meteor,neotim/meteor,chinasb/meteor,pandeysoni/meteor,brettle/meteor,yonglehou/meteor,shadedprofit/meteor,l0rd0fwar/meteor,akintoey/meteor,ndarilek/meteor,luohuazju/meteor,Theviajerock/meteor,dev-bobsong/meteor,Urigo/meteor,juansgaitan/meteor,mirstan/meteor,vjau/meteor,dfischer/meteor,paul-barry-kenzan/meteor,LWHTarena/meteor,benstoltz/meteor,Hansoft/meteor,servel333/meteor,benjamn/meteor,cherbst/meteor,alexbeletsky/meteor,GrimDerp/meteor,AnjirHossain/meteor,brdtrpp/meteor,baiyunping333/meteor,elkingtonmcb/meteor,jeblister/meteor,jg3526/meteor,lorensr/meteor,yiliaofan/meteor,chiefninew/meteor,shrop/meteor,EduShareOntario/meteor,Paulyoufu/meteor-1,modulexcite/meteor,TribeMedia/meteor,chinasb/meteor,chinasb/meteor,mubassirhayat/meteor,planet-training/meteor,sclausen/meteor,ljack/meteor,lassombra/meteor,michielvanoeffelen/meteor,l0rd0fwar/meteor,Paulyoufu/meteor-1,deanius/meteor,jagi/meteor,henrypan/meteor,Paulyoufu/meteor-1,jdivy/meteor,esteedqueen/meteor,AlexR1712/meteor,meonkeys/meteor,kengchau/meteor,Jeremy017/meteor,DCKT/meteor,aramk/meteor,Jeremy017/meteor,aramk/meteor,skarekrow/meteor,qscripter/meteor,zdd910/meteor,aldeed/meteor,Profab/meteor,brdtrpp/meteor,brettle/meteor,calvintychan/meteor,dandv/meteor,colinligertwood/meteor,planet-training/meteor,whip112/meteor,yanisIk/meteor,jdivy/meteor,jenalgit/meteor,framewr/meteor,pjump/meteor,AnthonyAstige/meteor,TribeMedia/meteor,zdd910/meteor,iman-mafi/meteor,LWHTarena/meteor,servel333/meteor,Quicksteve/meteor,SeanOceanHu/meteor,cog-64/meteor,emmerge/meteor,mirstan/meteor,shmiko/meteor,mauricionr/meteor,yyx990803/meteor,HugoRLopes/meteor,zdd910/meteor,judsonbsilva/meteor,evilemon/meteor,arunoda/meteor,modulexcite/meteor,somallg/meteor,daltonrenaldo/meteor,meteor-velocity/meteor,stevenliuit/meteor,baysao/meteor,queso/meteor,paul-barry-kenzan/meteor,yanisIk/meteor,esteedqueen/meteor,servel333/meteor,Puena/meteor,devgrok/meteor,Quicksteve/meteor,skarekrow/meteor,pandeysoni/meteor,michielvanoeffelen/meteor,yinhe007/meteor,IveWong/meteor,stevenliuit/meteor,D1no/meteor,alexbeletsky/meteor,hristaki/meteor,aramk/meteor,l0rd0fwar/meteor,dfischer/meteor,TribeMedia/meteor,ljack/meteor,mubassirhayat/meteor,Jonekee/meteor,tdamsma/meteor,chiefninew/meteor,AnjirHossain/meteor,Puena/meteor,Prithvi-A/meteor,AlexR1712/meteor,Profab/meteor,williambr/meteor,imanmafi/meteor,IveWong/meteor,Paulyoufu/meteor-1,mubassirhayat/meteor,cog-64/meteor,alphanso/meteor,chiefninew/meteor,chasertech/meteor,meonkeys/meteor,IveWong/meteor,karlito40/meteor,deanius/meteor,Profab/meteor,devgrok/meteor,dboyliao/meteor,joannekoong/meteor,shrop/meteor,PatrickMcGuinness/meteor,justintung/meteor,tdamsma/meteor,papimomi/meteor,nuvipannu/meteor,yalexx/meteor,wmkcc/meteor,yonas/meteor-freebsd,guazipi/meteor,newswim/meteor,mjmasn/meteor,benjamn/meteor,h200863057/meteor,modulexcite/meteor,dandv/meteor,daslicht/meteor,ndarilek/meteor,katopz/meteor,jeblister/meteor,calvintychan/meteor,chinasb/meteor,lawrenceAIO/meteor,4commerce-technologies-AG/meteor,jeblister/meteor,lorensr/meteor,iman-mafi/meteor,baiyunping333/meteor,eluck/meteor,yyx990803/meteor,alexbeletsky/meteor,D1no/meteor,JesseQin/meteor,juansgaitan/meteor,daltonrenaldo/meteor,newswim/meteor,mjmasn/meteor,benstoltz/meteor,eluck/meteor,sdeveloper/meteor,aramk/meteor,dfischer/meteor,h200863057/meteor,cbonami/meteor
47e48049229d5393c024c0b742bd8511693d5e09
static/js/share-buttons.js
static/js/share-buttons.js
// https://github.com/kni-labs/rrssb var popupCenter = function(url, title, w, h) { // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = width / 2 - w / 2 + dualScreenLeft; var top = height / 3 - h / 3 + dualScreenTop; var newWindow = window.open( url, title, "scrollbars=yes, width=" + w + ", height=" + h + ", top=" + top + ", left=" + left ); // Puts focus on the newWindow if (newWindow && newWindow.focus) { newWindow.focus(); } }; document.querySelectorAll(".popup").forEach(function(el) { el.addEventListener("click", function(e) { popupCenter(el.getAttribute("href"), "TODO", 580, 470); e.preventDefault(); }); });
// https://github.com/kni-labs/rrssb var popupCenter = function(url) { var w = 580; var h = 470; // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = width / 2 - w / 2 + dualScreenLeft; var top = height / 3 - h / 3 + dualScreenTop; var newWindow = window.open( url, "share-popup", "scrollbars=yes, width=" + w + ", height=" + h + ", top=" + top + ", left=" + left ); // Puts focus on the newWindow if (newWindow && newWindow.focus) { newWindow.focus(); } }; document.querySelectorAll(".popup").forEach(function(el) { el.addEventListener("click", function(e) { popupCenter(el.getAttribute("href")); e.preventDefault(); }); });
Remove title w and h params in popupCenter
Remove title w and h params in popupCenter
JavaScript
mit
DeveloperDavo/learnitmyway,DeveloperDavo/learnitmyway
875e1aa44952cd946e739b9ffa52cae074ded129
documentation/more/classes.js
documentation/more/classes.js
noUiSlider.create(slider, { start: 80, range: { min: 0, max: 100 }, cssPrefix: 'noUi-', // defaults to 'noUi-', cssClasses: { // Full list of classnames to override. // Does NOT extend the default classes. // Have a look at the source for the full, current list: // https://github.com/leongersen/noUiSlider/blob/master/src/js/options.js#L398 } });
noUiSlider.create(slider, { start: 80, range: { min: 0, max: 100 }, cssPrefix: 'noUi-', // defaults to 'noUi-', cssClasses: { // Full list of classnames to override. // Does NOT extend the default classes. // Have a look at the source for the full, current list: // https://github.com/leongersen/noUiSlider/blob/master/src/nouislider.js#L880 } });
Remove dead link to full list of class names
Remove dead link to full list of class names
JavaScript
mit
leongersen/noUiSlider,leongersen/noUiSlider,leongersen/noUiSlider,leongersen/noUiSlider
2e66a868619fd017b1e409da3b60c750ac7e4960
providers/oauth/oauth.identity.js
providers/oauth/oauth.identity.js
/*globals chrome,console */ /*jslint indent:2,browser:true, node:true */ var PromiseCompat = require('es6-promise').Promise; var oAuthRedirectId = "freedom.oauth.redirect.handler"; var ChromeIdentityAuth = function() { "use strict"; }; ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuation) { "use strict"; var i; if (typeof chrome !== 'undefined' && typeof chrome.permissions !== 'undefined' && //cca doesn't support chrome.permissions yet typeof chrome.identity !== 'undefined') { for (i = 0; i < redirectURIs.length; i += 1) { if (redirectURIs[i].indexOf('https://') === 0 && redirectURIs[i].indexOf('.chromiumapp.org') > 0) { continuation({ redirect: redirectURIs[i], state: oAuthRedirectId + Math.random() }); return true; } } } return false; }; ChromeIdentityAuth.prototype.launchAuthFlow = function(authUrl, stateObj, continuation) { chrome.identity.launchWebAuthFlow({ url: authUrl, interactive: true }, function(stateObj, continuation, responseUrl) { continuation(responseUrl); }.bind({}, stateObj, continuation)); }; /** * If we have access to chrome.identity, use the built-in support for oAuth flows * chrome.identity exposes a very similar interface to core.oauth. */ module.exports = ChromeIdentityAuth;
/*globals chrome,console */ /*jslint indent:2,browser:true, node:true */ var PromiseCompat = require('es6-promise').Promise; var oAuthRedirectId = "freedom.oauth.redirect.handler"; var ChromeIdentityAuth = function() { "use strict"; }; ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuation) { "use strict"; var i; if (typeof chrome !== 'undefined' && typeof chrome.identity !== 'undefined') { for (i = 0; i < redirectURIs.length; i += 1) { if (redirectURIs[i].indexOf('https://') === 0 && redirectURIs[i].indexOf('.chromiumapp.org') > 0) { continuation({ redirect: redirectURIs[i], state: oAuthRedirectId + Math.random() }); return true; } } } return false; }; ChromeIdentityAuth.prototype.launchAuthFlow = function(authUrl, stateObj, continuation) { chrome.identity.launchWebAuthFlow({ url: authUrl, interactive: true }, function(stateObj, continuation, responseUrl) { continuation(responseUrl); }.bind({}, stateObj, continuation)); }; /** * If we have access to chrome.identity, use the built-in support for oAuth flows * chrome.identity exposes a very similar interface to core.oauth. */ module.exports = ChromeIdentityAuth;
Remove superfluous check in core.oauth
Remove superfluous check in core.oauth
JavaScript
apache-2.0
freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome
1b273af40df9a093271b2d21cebcc545f2f55dce
string/palindrome-check.js
string/palindrome-check.js
// Program to determine if string is a palindrome function checkPalindrome(str) { // identify non-alphanumeric characters through regular expression var regEx = /[^A-Za-z0-9]/g; // lower case all characters in string and remove all non-alphanumeric characters var lowCaseReg = str.toLowerCase().replace(regEx, ''); // check for palindrome with loop for (var i = 0; i < (str.length)/2; i++) { if (str[i] !== str[(str.length) - 1 - i]) { // loop will go on as long as characters match return false; } } return true; // string is palindrome }
// Program to determine if string is a palindrome function checkPalindrome(str) { // identify non-alphanumeric characters through regular expression var regEx = /[^A-Za-z0-9]/g; // lower case all characters in string and remove all non-alphanumeric characters var lowCaseReg = str.toLowerCase().replace(regEx, ''); // check for palindrome with loop for (var i = 0; i < (lowCaseReg.length)/2; i++) { if (lowCaseReg[i] !== lowCaseReg[(lowCaseReg.length) - 1 - i]) { // loop will go on as long as characters match return false; } } return true; // string is palindrome } // test cases checkPalindrome("racecar"); // expect true checkPalindrome("race car"); // expect true checkPalindrome("nope"); // expect false checkPalindrome("not palindrome"); // expect false checkPalindrome("A man, a plan, a canal. Panama"); // expect true checkPalindrome("0_0 (: /-\ :) 0_0"); // expect true
Add test cases to check for palindrome in string function
Add test cases to check for palindrome in string function
JavaScript
mit
derekmpham/interview-prep,derekmpham/interview-prep
e91dc89930431c8c79a02d3adb1a136ea55b4665
client/app/services/services.js
client/app/services/services.js
angular.module('cat-buddy.services', []) .factory('Animals', function($http) { var getAllFromInternetByZipCode = function(animalName, zipCode, offset) { offset = offset || 0; return $http({ method: 'GET', url: 'http://api.petfinder.com/pet.find', data: { key: PETFINDER_API_KEY, //to fix animal: animalName, count: 20, offset: offset, location: zipCode, format: 'json' } }) .then(function(resp){ return resp.petfinder.pets; }); }; var getAllFromSaved = function() { return $http({ method: 'GET', url: '/api/' + animalName }); }; var addOneToSaved = function(animal) { return $http({ method: 'POST', url: '/api/' + animalName, data: animal }); }; return { getAllFromInternetByZipCode: getAllFromInternetByZipCode, getAllFromSaved: getAllFromSaved, addOneToSaved: addOneToSaved }; });
angular.module('cat-buddy.services', []) .factory('Animals', function($http) { var getAllFromInternetByZipCode = function(animalName, zipCode, count, offset) { offset = offset || 0; return $http({ method: 'GET', url: 'http://api.petfinder.com/pet.find', data: { key: PETFINDER_API_KEY, animal: animalName, count: count, offset: offset, location: zipCode, format: 'json' } }) .then(function(resp){ return resp.petfinder.pets; }); }; var getAllFromSaved = function() { return $http({ method: 'GET', url: '/api/' + animalName }); }; var addOneToSaved = function(animal) { return $http({ method: 'POST', url: '/api/' + animalName, data: animal }); }; return { getAllFromInternetByZipCode: getAllFromInternetByZipCode, getAllFromSaved: getAllFromSaved, addOneToSaved: addOneToSaved }; });
Remove magic number for "count" in get requests
Remove magic number for "count" in get requests
JavaScript
mit
reinaisnothere/mvp,reinaisnothere/mvp
c53adcb912b3a370556f6e078968d954d46b1f7f
modules/orders/client/controllers/recipt.client.controller.js
modules/orders/client/controllers/recipt.client.controller.js
(function() { 'use strict'; angular .module('orders') .controller('ReciptController', ReciptController); ReciptController.$inject = ['$scope', 'OrdersService', '$stateParams', '$location']; function ReciptController($scope, OrdersService, $stateParams, $location) { var vm = this; vm.order = {}; // Recipt controller logic // ... $scope.date = new Date(); $scope.recipt = function(){ console.log($stateParams.orderId); var getorder = OrdersService.get({ orderId: $stateParams.orderId }, function() { vm.order = getorder; console.log(getorder); }); }; $scope.print = function(){ /*window.print();*/ var bdhtml=window.document.body.innerHTML; var sprnstr="<!--startprint-->"; var eprnstr="<!--endprint-->"; var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); console.log(prnhtml); window.document.body.innerHTML=prnhtml; window.print(); }; $scope.close = function(){ // $state.go('home',{}); $location.path('/'); }; } })();
(function() { 'use strict'; angular .module('orders') .controller('ReciptController', ReciptController); ReciptController.$inject = ['$timeout', '$state', '$scope', 'OrdersService', '$stateParams', '$location']; function ReciptController($timeout, $state,$scope, OrdersService, $stateParams, $location) { var vm = this; vm.order = {}; // Recipt controller logic // ... $scope.date = new Date(); $scope.recipt = function(){ console.log($stateParams.orderId); var getorder = OrdersService.get({ orderId: $stateParams.orderId }, function() { vm.order = getorder; console.log(getorder); }); }; $scope.print = function(){ /*window.print();*/ var bdhtml=window.document.body.innerHTML; var sprnstr="<!--startprint-->"; var eprnstr="<!--endprint-->"; var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); window.document.body.innerHTML=prnhtml; window.print(); // window.close(); // $timeout(function () { window.close(); }, 40); // $state.go('recipt',{ orderId: $stateParams.orderId }); }; /* $scope.onPrintFinished = function(print){ window.close(); };*/ $scope.close = function(){ // $state.go('home',{}); $location.path('/'); }; } })();
Add method to go back after print in the recipt page
Add method to go back after print in the recipt page
JavaScript
mit
JavaScriptAcademy/oneStep,JavaScriptAcademy/oneStep,JavaScriptAcademy/oneStep
c9a809bbc3edc47377a42b10efdfbf32158268dd
gulp/download-locales.js
gulp/download-locales.js
var downloadLocales = require('webmaker-download-locales'); var glob = require('glob'); var fs = require('fs-extra'); // Which languages should we pull down? // Don't include en-US because that's committed into git already var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN']; module.exports = function (callback) { glob('!./locale/!(en_US)/**.json', function (err, files) { files.forEach(function (file) { fs.removeSync(file); }); downloadLocales({ app: 'webmaker-app', dir: 'locale', languages: supportedLanguages }, callback); }); };
var downloadLocales = require('webmaker-download-locales'); var glob = require('glob'); var fs = require('fs-extra'); // Which languages should we pull down? // Don't include en-US because that's committed into git already var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN', 'es', 'el', 'pt', 'es_AR', 'zh_TW', 'pt_BR', 'zh_CN', 'tr_TR', 'da_DK', 'fi', 'ru', 'sq', 'es_MX']; module.exports = function (callback) { glob('!./locale/!(en_US)/**.json', function (err, files) { files.forEach(function (file) { fs.removeSync(file); }); downloadLocales({ app: 'webmaker-app', dir: 'locale', languages: supportedLanguages }, callback); }); };
Enable other locales that fully translated on Transifex
Enable other locales that fully translated on Transifex
JavaScript
mpl-2.0
k88hudson/webmaker-android,gvn/webmaker-android,mozilla/webmaker-android,secretrobotron/webmaker-android,adamlofting/webmaker-android,j796160836/webmaker-android,alicoding/webmaker-android,secretrobotron/webmaker-android,vazquez/webmaker-android,alanmoo/webmaker-android,bolaram/webmaker-android,bolaram/webmaker-android,j796160836/webmaker-android,gvn/webmaker-android,vazquez/webmaker-android,alanmoo/webmaker-android,mozilla/webmaker-android,rodmoreno/webmaker-android,alicoding/webmaker-android,rodmoreno/webmaker-android,k88hudson/webmaker-android
21fe3174410756b25281bed5a446516f2c053016
node_modules/hotCoreErrorProtocol/lib/hotCoreErrorProtocol.js
node_modules/hotCoreErrorProtocol/lib/hotCoreErrorProtocol.js
"use strict"; var dummy , hotplate = require('hotplate') , path = require('path') ; // exports.sendResponse = function(method, res, obj){ exports.sendResponse = function(res, obj, status){ var status; var isOK; status = status || 200; isOK = (status >= 200 && status < 300) || // allow any 2XX error code status === 304; // or, get it out of the cache if( isOK ){ res.json( status, obj ); } else { obj = typeof(obj) == 'object' ? obj : { }; var error = {}; // Assign "legal" keys if( obj.message ) error.message = obj.message; if( obj.errors ) error.errors = obj.errors; if( obj.data ) error.data = obj.data; if( obj.emit ) error.emit = obj.emit; res.json(status, error); } } hotplate.hotEvents.on( 'pageElements', 'hotCoreErrorProtocol', function( done ){ done( null, { jses: [ 'hotFixErrorResponse.js'] }); }); hotplate.hotEvents.on( 'clientPath', 'hotCoreErrorProtocol', function( done ){ done( null, path.join(__dirname, '../client') ); })
"use strict"; var dummy , hotplate = require('hotplate') , path = require('path') ; // exports.sendResponse = function(method, res, obj){ exports.sendResponse = function(res, obj, status){ var status; var isOK; status = status || 200; isOK = (status >= 200 && status < 300) || // allow any 2XX error code status === 304; // or, get it out of the cache if( isOK ){ res.status( status ).json( obj ); } else { obj = typeof(obj) == 'object' ? obj : { }; var error = {}; // Assign "legal" keys if( obj.message ) error.message = obj.message; if( obj.errors ) error.errors = obj.errors; if( obj.data ) error.data = obj.data; if( obj.emit ) error.emit = obj.emit; res.status( status ).json( error ); } } hotplate.hotEvents.on( 'pageElements', 'hotCoreErrorProtocol', function( done ){ done( null, { jses: [ 'hotFixErrorResponse.js'] }); }); hotplate.hotEvents.on( 'clientPath', 'hotCoreErrorProtocol', function( done ){ done( null, path.join(__dirname, '../client') ); })
Update to latest Express API
Update to latest Express API
JavaScript
mit
shelsonjava/hotplate,mercmobily/hotplate,mercmobily/hotplate,shelsonjava/hotplate
3b0492386a595331d147c2a1e5f3748c1e0963c3
src/index.js
src/index.js
import { join } from 'path' import buildWebpackConfig from './config/build-webpack-config' import buildKarmaConfig from './config/build-karma-config' import startDevelop from './action/start-develop' import runTest from './action/run-test' import install from './action/install' import json from './util/json' export default { develop (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) startDevelop(webpackConfig) }, test (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) const karmaConfig = buildKarmaConfig(env, options, webpackConfig) runTest(karmaConfig) }, install (env, options) { check(env) install(env.projectPath) } } function check ({ projectPath }) { const packagePath = join(projectPath, 'package.json') const packageJSON = json.read(packagePath) if (packageJSON.name === 'sagui') throw new InvalidUsage() } export class InvalidUsage extends Error { constructor () { super() this.name = 'InvalidUsage' } }
import { join } from 'path' import { statSync } from 'fs' import buildWebpackConfig from './config/build-webpack-config' import buildKarmaConfig from './config/build-karma-config' import startDevelop from './action/start-develop' import runTest from './action/run-test' import install from './action/install' import json from './util/json' export default { develop (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) startDevelop(webpackConfig) }, test (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) const karmaConfig = buildKarmaConfig(env, options, webpackConfig) runTest(karmaConfig) }, install (env, options) { check(env) install(env.projectPath) } } function check ({ projectPath }) { const packagePath = join(projectPath, 'package.json') if (!fileExists(packagePath)) throw new InvalidUsage() const packageJSON = json.read(packagePath) if (packageJSON.name === 'sagui') throw new InvalidUsage() } function fileExists (file) { try { statSync(file) return true } catch (e) { return false } } export class InvalidUsage extends Error { constructor () { super() this.name = 'InvalidUsage' } }
Fix check that would crash if folder didn’t contain a package.json file
Fix check that would crash if folder didn’t contain a package.json file
JavaScript
mit
saguijs/sagui,saguijs/sagui
f4955e86bb284b7111c71f8a9f270da7c8818c15
src/index.js
src/index.js
export default class UserLocation { constructor({ apiKey, cacheTtl = 604800, // 7 days fallback = 'exact', // If IP-based geolocation fails specificity = 'general', }) { let coordsLoaded = false; const coords = { latitude: null, longitude: null, accuracy: null, }; const promise = new Promise((resolve, reject) => { if (coordsLoaded) { resolve(coords); } else if (specificity === 'exact') { navigator.geolocation.getCurrentPosition( (pos) => { coordsLoaded = true; coords.latitude = pos.coords.latitude; coords.longitude = pos.coords.longitude; coords.accuracy = pos.coords.accuracy; resolve(coords); }, (err) => { reject(`${err.message} (error code: ${err.code})`); } ); } else if (specificity === 'general') { // Use GeoIP lookup to get general area } else { throw new Error('Invalid configuration value for location specificity.'); } }); console.log(apiKey, cacheTtl, fallback); return promise; } }
export default class UserLocation { constructor({ apiKey = null, cacheTtl = 604800, // 7 days fallback = 'exact', // If IP-based geolocation fails specificity = 'general', }) { let coordsLoaded = false; const coords = { latitude: null, longitude: null, accuracy: null, }; if (apiKey === null && (specificity === 'general' || fallback === 'general')) { throw new Error('An API key must be included when using GeoCarrot\'s GeoIP lookup.'); } const promise = new Promise((resolve, reject) => { if (coordsLoaded) { resolve(coords); } else if (specificity === 'exact') { navigator.geolocation.getCurrentPosition( (pos) => { coordsLoaded = true; coords.latitude = pos.coords.latitude; coords.longitude = pos.coords.longitude; coords.accuracy = pos.coords.accuracy; resolve(coords); }, (err) => { reject(`${err.message} (error code: ${err.code})`); } ); } else if (specificity === 'general') { // Use GeoIP lookup to get general area } else { throw new Error('Invalid configuration value for location specificity.'); } }); console.log(apiKey, cacheTtl, fallback); return promise; } }
Add a check to ensure apiKey is included in config when using GeoCarrot’s GeoIP lookup.
Add a check to ensure apiKey is included in config when using GeoCarrot’s GeoIP lookup.
JavaScript
apache-2.0
kevinsmith/user-location
7ce25e9c841a98ac2d428a6d7e1a70015e890349
src/index.js
src/index.js
'use strict'; import backbone from 'backbone'; import _ from 'underscore'; class Person extends backbone.Model { getFullName() { return this.get('firstName') + ' ' + this.get('lastName'); } } // Using benmccormick's suggestion // for decorators to apply properties to class // before instantiation // https://github.com/jashkenas/backbone/issues/3560#issuecomment-113709224 function props(value) { return function decorator(target) { _.extend(target.prototype, value); } } @props({ events: { 'click': function() { console.log('clicked!'); } } }) class Hello extends backbone.View { initialize() { this.person = new Person({ firstName: 'George', lastName: 'Washington' }); } render() { this.$el.html('Hello, ' + this.person.getFullName() + '.'); } } var myView = new Hello({el: document.getElementById('root')}); myView.render();
'use strict'; import backbone from 'backbone'; import _ from 'underscore'; class Person extends backbone.Model { getFullName() { return this.get('firstName') + ' ' + this.get('lastName'); } } // Using benmccormick's suggestion // for decorators to apply properties to class // before instantiation // https://github.com/jashkenas/backbone/issues/3560#issuecomment-113709224 function props(value) { return function decorator(target) { _.extend(target.prototype, value); } } @props({ events: { 'click': function() { console.log('clicked!'); } } }) class Hello extends backbone.View { render() { this.$el.html('Hello, ' + this.model.getFullName() + '.'); } } var myView = new Hello({el: document.getElementById('root'), model: new Person({ firstName: 'George', lastName: 'Washington' })}); myView.render();
Move model to this.model in constructor
Move model to this.model in constructor
JavaScript
mit
andrewrota/backbone-with-es6-classes,andrewrota/backbone-with-es6-classes
c45f77f19e84ad54d70574b019198dd9a9fc43f8
test/vue-countdown.spec.js
test/vue-countdown.spec.js
import Vue from 'vue'; import Countdown from '../src/vue-countdown'; import {getVM} from './helpers'; describe('Vue countdown component', () => { it('sets passed label correctly', () => { const vm = getVM(Countdown, { propsData: { message: 'Boom' } }); expect(vm.$data.label).toBe('Boom'); }); it('initializes timer properly', () => { const vm = getVM(Countdown, { propsData: { seconds: 5 } }); expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('00:00:05'); }); it('counts to zero', (done) => { const vm = getVM(Countdown, { propsData: { seconds: 1 } }); setTimeout(() => { expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('Time\'s up!'); done(); }, 1000); }); });
import Vue from 'vue'; import Countdown from '../src/vue-countdown'; import {getVM} from './helpers'; describe('Vue countdown component', () => { it('sets passed label correctly', () => { const vm = getVM(Countdown, { propsData: { message: 'Boom' } }); expect(vm.$data.label).toBe('Boom'); }); it('initializes timer properly', () => { const vm = getVM(Countdown, { propsData: { seconds: 5 } }); expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('00:00:05'); }); it('counts to zero', (done) => { const vm = getVM(Countdown, { propsData: { seconds: 1 } }); setTimeout(() => { expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('Time\'s up!'); done(); }, 1000); }); it('triggers an event when timer has finished', (done) => { const vm = new Vue({ methods: { handleTimeExpire() { // should be called } }, render: h => h(Countdown, { props: { seconds: 1 }, on: { 'time-expire': vm.handleTimeExpire } }) }) spyOn(vm, 'handleTimeExpire'); vm.$mount(); setTimeout(() => { expect(vm.handleTimeExpire).toHaveBeenCalled(); done(); }, 1000); }); });
Add test for time-expire event when timer finishes
Add test for time-expire event when timer finishes
JavaScript
mit
maksimovicdanijel/vue-countdown,maksimovicdanijel/vue-countdown
39430a54cdcac3cae01fb49c54b4e81f66303522
commands/kill.js
commands/kill.js
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { return (args, player) => { const room = rooms.getAt(player.getLocation()); const npc = CommandUtil.findNpcInRoom(npcs, args, room, player, true); if (!npc) { return player.warn(`Kill ${args}? If you can find them, maybe.`); } if (!npc.isPacifist) { console.log('fucked up ', npc); } if (npc.isPacifist()) { return player.warn(`${npc.getShortDesc()} radiates a calming aura.`); } if (!player.hasEnergy(5)) { return player.noEnergy(); } util.log(player.getName() + ' is on the offensive...'); const fightingPlayer = _.has(npc.getInCombat(), player); if (fightingPlayer) { player.say('You are already fighting them!'); return; } else if (npc.isInCombat()) { player.say('They are busy fighting someone else, no fair!'); return; } npc.emit('combat', player, room, players, npcs, rooms, cleanup); function cleanup(success) { // cleanup here... } }; };
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { return (args, player) => { const room = rooms.getAt(player.getLocation()); const npc = CommandUtil.findNpcInRoom(npcs, args, room, player, true); if (!npc) { return player.warn(`Kill ${args}? If you can find them, maybe.`); } if (npc.isPacifist()) { return player.warn(`${npc.getShortDesc()} radiates a calming aura.`); } if (!player.hasEnergy(5)) { return player.noEnergy(); } util.log(player.getName() + ' is on the offensive...'); const fightingPlayer = _.has(npc.getInCombat(), player); if (fightingPlayer) { return player.say(`You are already fighting that ${npc.getShortDesc()}!`); } else if (npc.isInCombat()) { return player.say('That ${npc.getShortDesc()} is busy fighting someone else, no fair!'); } npc.emit('combat', player, room, players, npcs, rooms, cleanup); function cleanup(success) { // cleanup here... } }; };
Remove unneeded console logs, improve messaging to player.
Remove unneeded console logs, improve messaging to player.
JavaScript
mit
seanohue/ranviermud,seanohue/ranviermud,shawncplus/ranviermud
959b28ea1da440d8c71e9d739c2ea099721f5de4
app/routes/seq.js
app/routes/seq.js
import Ember from 'ember'; export default Ember.Route.extend({ model(params) { return this.store.find('seq', params.lang + "-" + params.seq).then( (model) => model, (error) => null); }, afterModel(model) { this._super(model); if(Ember.isEmpty(model)) { this.notifier.error("No such word found!"); this.transitionTo("application"); } else { this.tracker.log("word", "viewed"); Ember.$(document).attr('title', 'What does \"' + model.get("text") + '\" mean?'); } }, });
import Ember from 'ember'; import ENV from '../config/environment'; export default Ember.Route.extend({ model(params) { const key = params.lang + "-" + params.seq; const _this = this; return Ember.$.getJSON(ENV.api + "/seqs/" + key).then( (data) => { _this.store.pushPayload('wordset', data); return _this.store.getById('seq', key); } ) }, afterModel(model) { this._super(model); if(Ember.isEmpty(model)) { this.notifier.error("No such word found!"); this.transitionTo("application"); } else { this.tracker.log("word", "viewed"); Ember.$(document).attr('title', 'What does \"' + model.get("text") + '\" mean?'); } }, setupController(controller, model) { this._super(controller, model); console.log("Setup controller", controller) controller.set("isEditing", false); } });
Set up the controller after a route change wrt editing
Set up the controller after a route change wrt editing
JavaScript
mit
wordset/wordset-ui,BryanCode/wordset-ui,wordset/wordset-ui,wordset/wordset-ui,BryanCode/wordset-ui,BryanCode/wordset-ui
af52d32fe73ba180ef6975edff4ef04c42e5149b
scripts/cd-server.js
scripts/cd-server.js
// Continuous delivery server const { spawn } = require('child_process') const { resolve } = require('path') const { createServer } = require('http') const { urlencoded } = require('body-parser') const hostname = '127.0.0.1' const port = 80 const server = createServer((req, res) => { const { headers, method, url } = request // When a successful build has happened, kill the process, triggering a restart if (req.method === 'POST' && req.url === '/webhook') { // Send response res.statusCode = 200 res.end() let body = [] request .on('error', err => { console.error(err) }) .on('data', chunk => { body.push(chunk) }) .on('end', () => { body = Buffer.concat(body).toString() const data = urlencoded(body) console.log(data) }) } res.statusCode = 404 res.end() }).listen(port)
// Continuous delivery server const { spawn } = require('child_process') const { resolve } = require('path') const { createServer } = require('http') const { urlencoded } = require('body-parser') const hostname = '127.0.0.1' const port = 80 const server = createServer((req, res) => { const { headers, method, url } = req // When a successful build has happened, kill the process, triggering a restart if (req.method === 'POST' && req.url === '/webhook') { // Send response res.statusCode = 200 res.end() let body = [] request .on('error', err => { console.error(err) }) .on('data', chunk => { body.push(chunk) }) .on('end', () => { body = Buffer.concat(body).toString() const data = urlencoded(body) console.log(data) }) } res.statusCode = 404 res.end() }).listen(port)
Fix typo in CD server.
Fix typo in CD server.
JavaScript
mit
jsonnull/jsonnull.com,jsonnull/jsonnull.com,jsonnull/jsonnull.com
3c71fc5e7e9c146b0ac59eb792bca74a0c52a0d0
app/views/room.js
app/views/room.js
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('form', {method: 'post', action: `/${gameID}`}, [ h('button', {type: 'button', id: 'min'}, '-'), h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'button', id: 'max'}, '+'), h('button', {type: 'submit'}, 'Start') ]), h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, dataPlayerId: playerID }, 'Score: ' + player.score) })) ]) ]); };
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('form', {method: 'post', action: `/${gameID}`}, [ h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'submit'}, 'Start') ]), h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, dataPlayerId: playerID }, 'Score: ' + player.score) })) ]) ]); };
Remove + / - buttons
Remove + / - buttons
JavaScript
mit
rijkvanzanten/luaus
9c0c8362aeb27327a1c5747d51e9e87a7497e73f
src/browser_app_skeleton/src/js/app.js
src/browser_app_skeleton/src/js/app.js
/* eslint no-console:0 */ // RailsUjs is *required* for links in Lucky that use DELETE, POST and PUT. import RailsUjs from "rails-ujs"; // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/ import Turbolinks from "turbolinks"; RailsUjs.start(); Turbolinks.start();
/* eslint no-console:0 */ // RailsUjs is *required* for links in Lucky that use DELETE, POST and PUT. // Though it says "Rails" it actually works with any framework. import RailsUjs from "rails-ujs"; // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/ import Turbolinks from "turbolinks"; RailsUjs.start(); Turbolinks.start(); // If using Turbolinks, you can attach events to page load like this: // // document.addEventListener("turbolinks:load", function() { // ... // })
Clarify how to attach events and RailsUjs
Clarify how to attach events and RailsUjs
JavaScript
mit
luckyframework/cli,luckyframework/cli,luckyframework/cli